diff --git a/.gitignore b/.gitignore index 083e998a..5da7340c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ build .DS_Store -test-sdk.ts \ No newline at end of file +test-sdk.ts +test-sdk.js \ No newline at end of file diff --git a/scripts/generate-wrapper.ts b/scripts/generate-wrapper.ts index 3338709d..4d2eb032 100644 --- a/scripts/generate-wrapper.ts +++ b/scripts/generate-wrapper.ts @@ -755,8 +755,12 @@ export class ${clientClassName} { if (typeof config === 'string') { console.error('Error: config must be of type Configuration'); - console.log('Correct usage:'); console.log(\` +Seems, like you are using sdk v2 but the syntax on client instantiation is for sdk v1. +SDK v1 -> v2 migration guide: https://docs.neynar.com/reference/neynar-nodejs-sdk-v1-to-v2-migration-guide + +Correct usage way to instantiate the client: + import { ${clientClassName}, Configuration } from "@neynar/nodejs-sdk"; const config = new Configuration({ @@ -768,7 +772,7 @@ const config = new Configuration({ }, }); -const client = new ${clientClassName}(config);\`); +const client = new ${clientClassName}(config);\\n\`); throw new Error('Invalid configuration type. Expected Configuration object but received string.'); } diff --git a/src/clients/NeynarAPIClient.ts b/src/clients/NeynarAPIClient.ts index dae85082..f25c3248 100644 --- a/src/clients/NeynarAPIClient.ts +++ b/src/clients/NeynarAPIClient.ts @@ -106,8 +106,12 @@ export class NeynarAPIClient { if (typeof config === 'string') { console.error('Error: config must be of type Configuration'); - console.log('Correct usage:'); console.log(` +Seems, like you are using sdk v2 but the syntax on client instantiation is for sdk v1. +SDK v1 -> v2 migration guide: https://docs.neynar.com/reference/neynar-nodejs-sdk-v1-to-v2-migration-guide + +Correct usage way to instantiate the client: + import { NeynarAPIClient, Configuration } from "@neynar/nodejs-sdk"; const config = new Configuration({ @@ -119,7 +123,7 @@ const config = new Configuration({ }, }); -const client = new NeynarAPIClient(config);`); +const client = new NeynarAPIClient(config);\n`); throw new Error('Invalid configuration type. Expected Configuration object but received string.'); } diff --git a/src/clients/NeynarHubClient.ts b/src/clients/NeynarHubClient.ts index c0ed6d19..970578f2 100644 --- a/src/clients/NeynarHubClient.ts +++ b/src/clients/NeynarHubClient.ts @@ -94,8 +94,12 @@ export class NeynarHubClient { if (typeof config === 'string') { console.error('Error: config must be of type Configuration'); - console.log('Correct usage:'); console.log(` +Seems, like you are using sdk v2 but the syntax on client instantiation is for sdk v1. +SDK v1 -> v2 migration guide: https://docs.neynar.com/reference/neynar-nodejs-sdk-v1-to-v2-migration-guide + +Correct usage way to instantiate the client: + import { NeynarHubClient, Configuration } from "@neynar/nodejs-sdk"; const config = new Configuration({ @@ -107,7 +111,7 @@ const config = new Configuration({ }, }); -const client = new NeynarHubClient(config);`); +const client = new NeynarHubClient(config);\n`); throw new Error('Invalid configuration type. Expected Configuration object but received string.'); }