Skip to content

Commit

Permalink
Allow User to add basePath
Browse files Browse the repository at this point in the history
Allow User to add basePath
  • Loading branch information
Shreyaschorge authored Nov 9, 2023
2 parents b893c33 + 28057cd commit 9138ff5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neynar/nodejs-sdk",
"version": "0.10.9",
"version": "0.10.10",
"description": "SDK to interact with Neynar APIs (https://docs.neynar.com/)",
"main": "./build/index.js",
"types": "./build/index.d.ts",
Expand Down
11 changes: 8 additions & 3 deletions src/neynar-api/neynar-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ export class NeynarAPIClient {
constructor(
apiKey: string,
{
basePath,
logger = silentLogger,
axiosInstance,
}: { logger?: Logger; axiosInstance?: AxiosInstance } = {}
}: {
basePath?: string;
logger?: Logger;
axiosInstance?: AxiosInstance;
} = {}
) {
this.logger = logger;

Expand All @@ -70,8 +75,8 @@ export class NeynarAPIClient {
}

this.clients = {
v1: new NeynarV1APIClient(apiKey, { logger, axiosInstance }),
v2: new NeynarV2APIClient(apiKey, { logger, axiosInstance }),
v1: new NeynarV1APIClient(apiKey, { basePath, logger, axiosInstance }),
v2: new NeynarV2APIClient(apiKey, { basePath, logger, axiosInstance }),
};
}

Expand Down
9 changes: 7 additions & 2 deletions src/neynar-api/neynar-v1-api/neynar-api-v1-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@ export class NeynarV1APIClient {
constructor(
apiKey: string,
{
basePath,
logger = silentLogger,
axiosInstance,
}: { logger?: Logger; axiosInstance?: AxiosInstance } = {}
}: {
basePath?: string;
logger?: Logger;
axiosInstance?: AxiosInstance;
} = {}
) {
this.logger = logger;

Expand All @@ -76,7 +81,7 @@ export class NeynarV1APIClient {
);

const config: Configuration = new Configuration({
basePath: BASE_PATH,
basePath: basePath ?? BASE_PATH,
apiKey: apiKey,
});
this.apis = {
Expand Down
9 changes: 7 additions & 2 deletions src/neynar-api/neynar-v2-api/neynar-api-v2-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,14 @@ export class NeynarV2APIClient {
constructor(
apiKey: string,
{
basePath,
logger = silentLogger,
axiosInstance,
}: { logger?: Logger; axiosInstance?: AxiosInstance } = {}
}: {
basePath?: string;
logger?: Logger;
axiosInstance?: AxiosInstance;
} = {}
) {
this.logger = logger;

Expand All @@ -94,7 +99,7 @@ export class NeynarV2APIClient {
);

const config: Configuration = new Configuration({
basePath: BASE_PATH,
basePath: basePath ?? BASE_PATH,
apiKey: apiKey,
});
this.apis = {
Expand Down

0 comments on commit 9138ff5

Please sign in to comment.