Skip to content

Commit

Permalink
Accept cast hashes in params
Browse files Browse the repository at this point in the history
Accept cast hashes in params
  • Loading branch information
Shreyaschorge authored Nov 13, 2023
2 parents 2006c4d + ccbe0b6 commit e3d64c1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 43 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.13",
"version": "0.11.0",
"description": "SDK to interact with Neynar APIs (https://docs.neynar.com/)",
"main": "./build/index.js",
"types": "./build/index.d.ts",
Expand Down
7 changes: 3 additions & 4 deletions src/neynar-api/neynar-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,12 +479,11 @@ export class NeynarAPIClient {
/**
* Gets information about an array of casts.
* See [Neynar documentation](https://docs.neynar.com/reference/casts)
* @param casts - Cast hashes (Comma Separated)
*
*/
public async fetchBulkCastsByHash(
castHashes: string[]
): Promise<CastsResponse> {
return await this.clients.v2.fetchBulkCastsByHash(castHashes);
public async fetchBulkCastsByHash(casts: string): Promise<CastsResponse> {
return await this.clients.v2.fetchBulkCastsByHash(casts);
}

/**
Expand Down
10 changes: 3 additions & 7 deletions src/neynar-api/neynar-v2-api/neynar-api-v2-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class NeynarV2APIClient {
basePath: basePath ? `${basePath}/v2` : BASE_PATH,
apiKey: apiKey,
});

this.apis = {
signer: new SignerApi(config, undefined, axiosInstance),
user: new UserApi(config, undefined, axiosInstance),
Expand Down Expand Up @@ -343,13 +343,9 @@ export class NeynarV2APIClient {
* See [Neynar documentation](https://docs.neynar.com/reference/casts)
*
*/
public async fetchBulkCastsByHash(
castHashes: string[]
): Promise<CastsResponse> {
public async fetchBulkCastsByHash(casts: string): Promise<CastsResponse> {
const response = await this.apis.cast.casts({
getCastsReqBody: {
casts: castHashes.map((hash) => ({ hash })),
},
casts,
});
return response.data;
}
Expand Down
51 changes: 21 additions & 30 deletions src/neynar-api/neynar-v2-api/openapi-farcaster/apis/cast-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ import { DeleteCastReqBody } from "../models";
// @ts-ignore
import { ErrorRes } from "../models";
// @ts-ignore
import { GetCastsReqBody } from "../models";
// @ts-ignore
import { OperationResponse } from "../models";
// @ts-ignore
import { PostCastReqBody } from "../models";
Expand Down Expand Up @@ -128,16 +126,16 @@ export const CastApiAxiosParamCreator = function (
/**
* Retrieve multiple casts using their respective hashes.
* @summary Gets information about an array of casts
* @param {GetCastsReqBody} getCastsReqBody
* @param {string} casts Hashes of the cast to be retrived (Comma separated)
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
casts: async (
getCastsReqBody: GetCastsReqBody,
casts: string,
options: AxiosRequestConfig = {}
): Promise<RequestArgs> => {
// verify required parameter 'getCastsReqBody' is not null or undefined
assertParamExists("casts", "getCastsReqBody", getCastsReqBody);
// verify required parameter 'casts' is not null or undefined
assertParamExists("casts", "casts", casts);
const localVarPath = `/farcaster/casts`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
Expand All @@ -154,15 +152,17 @@ export const CastApiAxiosParamCreator = function (
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;

if (casts !== undefined) {
localVarQueryParameter["casts"] = casts;
}

// authentication ApiKeyAuth required
await setApiKeyToObject(
localVarHeaderParameter,
"api_key",
configuration
);

localVarHeaderParameter["Content-Type"] = "application/json";

setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {};
Expand All @@ -171,21 +171,14 @@ export const CastApiAxiosParamCreator = function (
...headersFromBaseOptions,
...options.headers,
};
localVarRequestOptions.data = serializeDataIfNeeded(
getCastsReqBody,
localVarRequestOptions,
configuration
);

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Delete an existing cast.
* (In order to delete a cast `signer_uuid` must be approved)
*
* Delete an existing cast. \\ (In order to delete a cast `signer_uuid` must be approved)
* @summary Delete a cast
* @param {DeleteCastReqBody} deleteCastReqBody
* @param {*} [options] Override http request option.
Expand Down Expand Up @@ -338,18 +331,18 @@ export const CastApiFp = function (configuration?: Configuration) {
/**
* Retrieve multiple casts using their respective hashes.
* @summary Gets information about an array of casts
* @param {GetCastsReqBody} getCastsReqBody
* @param {string} casts Hashes of the cast to be retrived (Comma separated)
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async casts(
getCastsReqBody: GetCastsReqBody,
casts: string,
options?: AxiosRequestConfig
): Promise<
(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CastsResponse>
> {
const localVarAxiosArgs = await localVarAxiosParamCreator.casts(
getCastsReqBody,
casts,
options
);
return createRequestFunction(
Expand All @@ -360,8 +353,7 @@ export const CastApiFp = function (configuration?: Configuration) {
);
},
/**
* Delete an existing cast.
* (In order to delete a cast `signer_uuid` must be approved)
* Delete an existing cast. \\ (In order to delete a cast `signer_uuid` must be approved)
* @summary Delete a cast
* @param {DeleteCastReqBody} deleteCastReqBody
* @param {*} [options] Override http request option.
Expand Down Expand Up @@ -455,12 +447,11 @@ export const CastApiFactory = function (
options?: AxiosRequestConfig
): AxiosPromise<CastsResponse> {
return localVarFp
.casts(requestParameters.getCastsReqBody, options)
.casts(requestParameters.casts, options)
.then((request) => request(axios, basePath));
},
/**
* Delete an existing cast.
* (In order to delete a cast `signer_uuid` must be approved)
* Delete an existing cast. \\ (In order to delete a cast `signer_uuid` must be approved)
* @summary Delete a cast
* @param {CastApiDeleteCastRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
Expand Down Expand Up @@ -519,12 +510,13 @@ export interface CastApiCastRequest {
* @interface CastApiCastsRequest
*/
export interface CastApiCastsRequest {

/**
*
* @type {GetCastsReqBody}
* Hashes of the cast to be retrived (Comma separated)
* @type {string}
* @memberof CastApiCasts
*/
readonly getCastsReqBody: GetCastsReqBody;
readonly casts: string;
}

/**
Expand Down Expand Up @@ -592,13 +584,12 @@ export class CastApi extends BaseAPI {
options?: AxiosRequestConfig
) {
return CastApiFp(this.configuration)
.casts(requestParameters.getCastsReqBody, options)
.casts(requestParameters.casts, options)
.then((request) => request(this.axios, this.basePath));
}

/**
* Delete an existing cast.
* (In order to delete a cast `signer_uuid` must be approved)
* Delete an existing cast. \\ (In order to delete a cast `signer_uuid` must be approved)
* @summary Delete a cast
* @param {CastApiDeleteCastRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
Expand Down
2 changes: 1 addition & 1 deletion src/oas
Submodule oas updated 1 files
+15 −18 src/v2/spec.yaml

0 comments on commit e3d64c1

Please sign in to comment.