Skip to content

Commit

Permalink
Bugfix/fix response schema for channel apis
Browse files Browse the repository at this point in the history
Bugfix/fix response schema for channel apis
  • Loading branch information
Shreyaschorge authored Feb 1, 2024
2 parents 159f163 + cdf5ae5 commit e994245
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 20 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": "1.9.1",
"version": "1.9.2",
"description": "SDK to interact with Neynar APIs (https://docs.neynar.com/)",
"main": "./build/index.js",
"types": "./build/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions src/neynar-api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export {
ReactionsType,
CastParamType,
ReactionType,
FrameButtonActionType
} from "./v2";
export { TimeWindow, BulkCastsSortType } from "./common/constants";
9 changes: 5 additions & 4 deletions src/neynar-api/neynar-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
FrameAction,
FrameActionResponse,
ValidateFrameActionResponse,
UsersResponse,
} from "./v2/openapi-farcaster";

import {
Expand Down Expand Up @@ -1585,7 +1586,7 @@ export class NeynarAPIClient {
* @param {string} [options.cursor] - Pagination cursor for the next set of results,
* omit this parameter for the initial request.
*
* @returns {Promise<BulkUsersResponse>} A promise that resolves to a `BulkUsersResponse` object,
* @returns {Promise<UsersResponse>} A promise that resolves to a `UsersResponse` object,
* containing the users active in the specified channel.
*
* @example
Expand All @@ -1612,7 +1613,7 @@ export class NeynarAPIClient {
limit?: number;
cursor?: string;
}
): Promise<BulkUsersResponse> {
): Promise<UsersResponse> {
return await this.clients.v2.fetchActiveUsersInSingleChannel(
id,
hasRootCastAuthors,
Expand Down Expand Up @@ -1731,7 +1732,7 @@ export class NeynarAPIClient {
* @param {string} [options.cursor] - Pagination cursor for the next set of results,
* omit this parameter for the initial request.
*
* @returns {Promise<BulkUsersResponse>} A promise that resolves to a `BulkUsersResponse` object,
* @returns {Promise<UsersResponse>} A promise that resolves to a `UsersResponse` object,
* containing a list of followers for the specified channel.
*
* @example
Expand All @@ -1745,7 +1746,7 @@ export class NeynarAPIClient {
public async fetchFollowersForAChannel(
id: string,
options?: { cursor?: string; limit?: number }
): Promise<BulkUsersResponse> {
): Promise<UsersResponse> {
return await this.clients.v2.fetchFollowersForAChannel(id, options);
}

Expand Down
9 changes: 5 additions & 4 deletions src/neynar-api/v2/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
FrameAction,
ValidateFrameRequest,
ValidateFrameActionResponse,
UsersResponse,
} from "./openapi-farcaster";
import axios, { AxiosError, AxiosInstance } from "axios";
import { silentLogger, Logger } from "../common/logger";
Expand Down Expand Up @@ -1274,7 +1275,7 @@ export class NeynarV2APIClient {
* @param {string} [options.cursor] - Pagination cursor for the next set of results,
* omit this parameter for the initial request.
*
* @returns {Promise<BulkUsersResponse>} A promise that resolves to a `BulkUsersResponse` object,
* @returns {Promise<UsersResponse>} A promise that resolves to a `UsersResponse` object,
* containing the users active in the specified channel.
*
* @example
Expand All @@ -1301,7 +1302,7 @@ export class NeynarV2APIClient {
cursor?: string;
limit?: number;
}
): Promise<BulkUsersResponse> {
): Promise<UsersResponse> {
const response = await this.apis.channel.channelUsers(
this.apiKey,
id,
Expand Down Expand Up @@ -1397,7 +1398,7 @@ export class NeynarV2APIClient {
* @param {string} [options.cursor] - Pagination cursor for the next set of results,
* omit this parameter for the initial request.
*
* @returns {Promise<BulkUsersResponse>} A promise that resolves to a `BulkUsersResponse` object,
* @returns {Promise<UsersResponse>} A promise that resolves to a `UsersResponse` object,
* containing a list of followers for the specified channel.
*
* @example
Expand All @@ -1414,7 +1415,7 @@ export class NeynarV2APIClient {
limit?: number;
cursor?: string;
}
): Promise<BulkUsersResponse> {
): Promise<UsersResponse> {
const response = await this.apis.channel.channelFollowers(
this.apiKey,
id,
Expand Down
2 changes: 2 additions & 0 deletions src/neynar-api/v2/openapi-farcaster/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ models/frame-action-button.ts
models/frame-action-req-body.ts
models/frame-action-response.ts
models/frame-action.ts
models/frame-button-action-type.ts
models/frame.ts
models/get-casts-req-body.ts
models/hydrated-follower.ts
Expand Down Expand Up @@ -97,6 +98,7 @@ models/user-search-response-result.ts
models/user-search-response.ts
models/user-viewer-context.ts
models/user.ts
models/users-response.ts
models/validate-frame-action-response.ts
models/validate-frame-request.ts
models/validated-frame-action.ts
12 changes: 6 additions & 6 deletions src/neynar-api/v2/openapi-farcaster/apis/channel-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObj
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
// @ts-ignore
import { BulkUsersResponse } from '../models';
// @ts-ignore
import { ChannelListResponse } from '../models';
// @ts-ignore
import { ChannelResponse } from '../models';
// @ts-ignore
import { ErrorRes } from '../models';
// @ts-ignore
import { UsersResponse } from '../models';
/**
* ChannelApi - axios parameter creator
* @export
Expand Down Expand Up @@ -364,7 +364,7 @@ export const ChannelApiFp = function(configuration?: Configuration) {
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async channelFollowers(apiKey: string, id: string, cursor?: string, limit?: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<BulkUsersResponse>> {
async channelFollowers(apiKey: string, id: string, cursor?: string, limit?: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UsersResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.channelFollowers(apiKey, id, cursor, limit, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
Expand All @@ -382,7 +382,7 @@ export const ChannelApiFp = function(configuration?: Configuration) {
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async channelUsers(apiKey: string, id: string, hasRootCastAuthors: boolean, hasCastLikers?: boolean, hasCastRecasters?: boolean, hasReplyAuthors?: boolean, cursor?: string, limit?: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<BulkUsersResponse>> {
async channelUsers(apiKey: string, id: string, hasRootCastAuthors: boolean, hasCastLikers?: boolean, hasCastRecasters?: boolean, hasReplyAuthors?: boolean, cursor?: string, limit?: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UsersResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.channelUsers(apiKey, id, hasRootCastAuthors, hasCastLikers, hasCastRecasters, hasReplyAuthors, cursor, limit, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
Expand Down Expand Up @@ -452,7 +452,7 @@ export const ChannelApiFactory = function (configuration?: Configuration, basePa
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
channelFollowers(apiKey: string, id: string, cursor?: string, limit?: number, options?: any): AxiosPromise<BulkUsersResponse> {
channelFollowers(apiKey: string, id: string, cursor?: string, limit?: number, options?: any): AxiosPromise<UsersResponse> {
return localVarFp.channelFollowers(apiKey, id, cursor, limit, options).then((request) => request(axios, basePath));
},
/**
Expand All @@ -469,7 +469,7 @@ export const ChannelApiFactory = function (configuration?: Configuration, basePa
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
channelUsers(apiKey: string, id: string, hasRootCastAuthors: boolean, hasCastLikers?: boolean, hasCastRecasters?: boolean, hasReplyAuthors?: boolean, cursor?: string, limit?: number, options?: any): AxiosPromise<BulkUsersResponse> {
channelUsers(apiKey: string, id: string, hasRootCastAuthors: boolean, hasCastLikers?: boolean, hasCastRecasters?: boolean, hasReplyAuthors?: boolean, cursor?: string, limit?: number, options?: any): AxiosPromise<UsersResponse> {
return localVarFp.channelUsers(apiKey, id, hasRootCastAuthors, hasCastLikers, hasCastRecasters, hasReplyAuthors, cursor, limit, options).then((request) => request(axios, basePath));
},
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
*/


// May contain unused imports in some cases
// @ts-ignore
import { FrameButtonActionType } from './frame-button-action-type';

/**
*
Expand All @@ -34,9 +37,11 @@ export interface FrameActionButton {
'index': number;
/**
*
* @type {string}
* @type {FrameButtonActionType}
* @memberof FrameActionButton
*/
'action_type'?: string;
'action_type'?: FrameButtonActionType;
}



Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* tslint:disable */
/* eslint-disable */
/**
* Farcaster API V2
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 2.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/



/**
*
* @export
* @enum {string}
*/

export const FrameButtonActionType = {
Post: 'post',
PostRedirect: 'post_redirect'
} as const;

export type FrameButtonActionType = typeof FrameButtonActionType[keyof typeof FrameButtonActionType];



2 changes: 2 additions & 0 deletions src/neynar-api/v2/openapi-farcaster/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export * from './frame-action';
export * from './frame-action-button';
export * from './frame-action-req-body';
export * from './frame-action-response';
export * from './frame-button-action-type';
export * from './get-casts-req-body';
export * from './hydrated-follower';
export * from './individual-hash-obj';
Expand Down Expand Up @@ -76,6 +77,7 @@ export * from './user-response';
export * from './user-search-response';
export * from './user-search-response-result';
export * from './user-viewer-context';
export * from './users-response';
export * from './validate-frame-action-response';
export * from './validate-frame-request';
export * from './validated-frame-action';
42 changes: 42 additions & 0 deletions src/neynar-api/v2/openapi-farcaster/models/users-response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* tslint:disable */
/* eslint-disable */
/**
* Farcaster API V2
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 2.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/


// May contain unused imports in some cases
// @ts-ignore
import { NextCursor } from './next-cursor';
// May contain unused imports in some cases
// @ts-ignore
import { User } from './user';

/**
*
* @export
* @interface UsersResponse
*/
export interface UsersResponse {
/**
*
* @type {Array<User>}
* @memberof UsersResponse
*/
'users': Array<User>;
/**
*
* @type {NextCursor}
* @memberof UsersResponse
*/
'next': NextCursor;
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ export interface ValidateFrameRequest {
*/
'message_bytes_in_hex': string;
/**
* Indicates whether the interactor reacted to the cast with the frame.
* Adds viewer_context inside the cast object to indicate whether the interactor reacted to the cast housing the frame.
* @type {boolean}
* @memberof ValidateFrameRequest
*/
'cast_reaction_context'?: boolean;
/**
* Indicates whether the interactor follows or is followed by the cast author.
* Adds viewer_context inside the user (interactor) object to indicate whether the interactor follows or is followed by the cast author.
* @type {boolean}
* @memberof ValidateFrameRequest
*/
Expand Down
2 changes: 1 addition & 1 deletion src/oas
Submodule oas updated 1 files
+68 −53 src/v2/spec.yaml

0 comments on commit e994245

Please sign in to comment.