POST
/
v1
/
fixer
import Benchify from 'benchify';

const client = new Benchify({
  apiKey: process.env['BENCHIFY_API_KEY'], // This is the default and can be omitted
});

async function main() {
  const response = await client.fixer.run({
    files: [
      {
        path: 'package.json',
        contents: '{"name": "simple-shopping-app", "version": "0.1.0", "scripts": {"build": "next build"}}',
      },
      {
        path: 'src/index.tsx',
        contents: "import Link from 'next/navigation/link';\nconsole.log('Hello world');",
      },
    ],
    fixes: { imports: true, stringLiterals: true, tsSuggestions: true },
  });

  console.log(response.data);
}

main();
{
  "data": {
    "success": true,
    "build_output": "\n> simple-shopping-app@0.1.0 build\n> next build\n\n- info Creating an optimized production build...\n- info Compiled successfully\n- info Linting and checking validity of types...\n- info Collecting page data...\n- info Generating static pages (0/11)\n- info Generating static pages (2/11)\n- info Generating static pages (5/11)\n- info Generating static pages (8/11)\n- info Generating static pages (11/11)\n- info Finalizing page optimization...\n\nRoute (app)                                Size     First Load JS\n┌ ○ /                                      181 B          84.5 kB\n├ ○ /cart                                  181 B          84.5 kB\n├ ○ /products                              181 B          84.5 kB\n└ ● /products/[id]                         414 B          84.7 kB\n    ├ /products/1\n    ├ /products/2\n    ├ /products/3\n    └ [+3 more paths]\n+ First Load JS shared by all              78.5 kB\n  ├ chunks/596-c294a7d39d9fe754.js         26.1 kB\n  ├ chunks/fd9d1056-a99b58d3cc150217.js    50.6 kB\n  ├ chunks/main-app-7d8b761209bcd0ba.js    219 B\n  └ chunks/webpack-d0f00866016e6a99.js     1.65 kB\n\nRoute (pages)                              Size     First Load JS\n─ ○ /404                                   181 B          76.5 kB\n+ First Load JS shared by all              76.3 kB\n  ├ chunks/framework-8883d1e9be70c3da.js   45 kB\n  ├ chunks/main-0591161756e062e3.js        29.4 kB\n  ├ chunks/pages/_app-52924524f99094ab.js  195 B\n  └ chunks/webpack-d0f00866016e6a99.js     1.65 kB\n\n○  (Static)  automatically rendered as static HTML (uses no initial props)\n●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)\n",
    "diff": "diff --git a/app/components/ProductCard.tsx b/app/components/ProductCard.tsx\nindex febbc23..6c8c885 100644\n--- a/app/components/ProductCard.tsx\n+++ b/app/components/ProductCard.tsx\n@@ -1,5 +1,5 @@\n-import Link from 'next/navigation/link';\n-import { Product } from '../Types';\n+import Link from 'next/dist/client/link';\n+import { Product } from '../types';\n \n interface ProductCardProps {\n   product: Product;\ndiff --git a/app/products/[id]/page.tsx b/app/products/[id]/page.tsx\nindex b1aef82..e4e63f6 100644\n--- a/app/products/[id]/page.tsx\n+++ b/app/products/[id]/page.tsx\n@@ -1,7 +1,7 @@\n import { notFound } from 'next/navigation';\n import Header from '../../components/Header';\n import Footer from '../../components/Footer';\n-import { products } from '../../productData';\n+import { products } from '../../data';\n \n export function generateStaticParams() {\n   return products.map(product => ({\ndiff --git a/app/products/page.tsx b/app/products/page.tsx\nindex 19233dd..8adb735 100644\n--- a/app/products/page.tsx\n+++ b/app/products/page.tsx\n@@ -1,7 +1,7 @@\n import Header from '../components/Header';\n import Footer from '../components/Footer';\n import ProductCard from '../components/ProductCard';\n-import { products } from '../../productData';\n+import { products } from '../../data';\n \n export default function ProductsPage() {\n   return (\n"
  },
  "meta": {
    "fixer_run_id": "fixer_a04a904c-2cc0-49f2-bf5f-3ca0e9246f18",
    "external_id": "customer-batch-001"
  }
}

Authorizations

Authorization
string
header
required

Benchify API Key. Obtain a key from the Benchify web portal under Settings > Credentials. Provide the key in the Authorization header as Bearer $BENCHIFY_KEY.

Body

application/json

Response

200
application/json

Successful operation

The response is of type object.