diff --git a/package.json b/package.json index efe35f6..fc62801 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@neynar/nodejs-sdk", - "version": "1.68.0", + "version": "1.69.0", "description": "SDK to interact with Neynar APIs (https://docs.neynar.com/)", "main": "./build/index.js", "types": "./build/index.d.ts", diff --git a/src/neynar-api/common/version.ts b/src/neynar-api/common/version.ts index 9c9953f..610aea1 100644 --- a/src/neynar-api/common/version.ts +++ b/src/neynar-api/common/version.ts @@ -1 +1 @@ -export const version = "1.68.0"; \ No newline at end of file +export const version = "1.69.0"; \ No newline at end of file diff --git a/src/neynar-api/neynar-api-client.ts b/src/neynar-api/neynar-api-client.ts index 9d76e4a..a2ceaea 100644 --- a/src/neynar-api/neynar-api-client.ts +++ b/src/neynar-api/neynar-api-client.ts @@ -3834,7 +3834,7 @@ export class NeynarAPIClient { * console.log('Blocked Fids:', response); * }); * - * For more information, refer to the [Neynar documentation](https://docs.neynar.com/reference/block-list). + * For more information, refer to the [Neynar documentation](https://docs.neynar.com/reference/fetch-block-list). */ public async fetchBlockList(options?: { blockerFid: number; @@ -3845,6 +3845,53 @@ export class NeynarAPIClient { return await this.clients.v2.fetchBlockList(options); } + /** + * Adds a block for a given fid. + * @summary Adds a block for a fid. + * @param {string} signerUuid - UUID of the signer who is performing the action. + * @param {number} blockedFid The fid of the user being blocked. + * + * @returns {Promise} A promise that resolves to a `OperationResponse` object. + * + * @example + * // Example: Block a user + * client.publishBlock(3, 19960).then(response => { + * console.log('Block Response:', response); + * }); + * + * For more information, refer to the [Neynar documentation](https://docs.neynar.com/reference/publish-block). + * + */ + public async publishBlock( + signerUuid: string, + blockedFid: number + ): Promise { + return await this.clients.v2.publishBlock(signerUuid, blockedFid); + } + + /** + * Deletes a block for a given fid. + * @summary Deletes a block for a fid. + * @param {string} signerUuid - UUID of the signer who is performing the action. + * @param {number} blockedFid The fid of the user being unblocked. + * + * @returns {Promise} A promise that resolves to a `OperationResponse` object. + * + * @example + * // Example: Unblock a user + * client.deleteBlock(3, 19960).then(response => { + * console.log('Block Response:', response); + * }); + * + * For more information, refer to the [Neynar documentation](https://docs.neynar.com/reference/delete-block). + */ + public async deleteBlock( + signerUuid: string, + blockedFid: number + ): Promise { + return await this.clients.v2.deleteBlock(signerUuid, blockedFid); + } + // ------------ Ban ------------ /** diff --git a/src/neynar-api/v2/client.ts b/src/neynar-api/v2/client.ts index 358a03e..ae4c8e0 100644 --- a/src/neynar-api/v2/client.ts +++ b/src/neynar-api/v2/client.ts @@ -3876,7 +3876,7 @@ export class NeynarV2APIClient { * console.log('Blocked Fids:', response); * }); * - * For more information, refer to the [Neynar documentation](https://docs.neynar.com/reference/block-list). + * For more information, refer to the [Neynar documentation](https://docs.neynar.com/reference/fetch-block-list). */ public async fetchBlockList(options?: { blockerFid: number; @@ -3884,7 +3884,7 @@ export class NeynarV2APIClient { limit?: number; cursor: string; }): Promise { - const response = await this.apis.block.blockList( + const response = await this.apis.block.fetchBlockList( options?.blockerFid, options?.blockedFid, options?.limit, @@ -3893,6 +3893,61 @@ export class NeynarV2APIClient { return response.data; } + /** + * Adds a block for a given fid. + * @summary Adds a block for a fid. + * @param {string} signerUuid - A signer uuid for the user blocking another user. + * @param {number} blockedFid - The fid of the user being blocked. + * + * @returns {Promise} A promise that resolves to a `OperationResponse` object. + * + * @example + * // Example: Block a user + * client.publishBlock('aaa-aaa-aaa', 19960).then(response => { + * console.log('Block Response:', response); + * }); + * For more information, refer to the [Neynar documentation](https://docs.neynar.com/reference/publish-block). + */ + public async publishBlock( + signerUuid: string, + blockedFid: number + ): Promise { + const addBlockBody = { + signer_uuid: signerUuid, + blocked_fid: blockedFid, + }; + const response = await this.apis.block.publishBlock(addBlockBody); + return response.data; + } + + /** + * Deletes a block for a given fid. + * @summary Deletes a block for a fid. + * @param {string} signerUuid - A signer uuid for the user unblocking another user. + * @param {number} blockedFid - The fid of the user being unblocked. + * + * @returns {Promise} A promise that resolves to a `OperationResponse` object. + * + * @example + * // Example: Unblock a user + * client.deleteBlock('aaa-aaa-aaa', 19960).then(response => { + * console.log('Block Response:', response); + * }); + * + * For more information, refer to the [Neynar documentation](https://docs.neynar.com/reference/delete-block). + */ + public async deleteBlock( + signerUuid: string, + blockedFid: number + ): Promise { + const deleteBlockBody = { + signer_uuid: signerUuid, + blocked_fid: blockedFid, + }; + const response = await this.apis.block.deleteBlock(deleteBlockBody); + return response.data; + } + // ------------ Ban ------------ /** diff --git a/src/neynar-api/v2/openapi-farcaster/.openapi-generator/FILES b/src/neynar-api/v2/openapi-farcaster/.openapi-generator/FILES index e9115b7..3eb5f0b 100644 --- a/src/neynar-api/v2/openapi-farcaster/.openapi-generator/FILES +++ b/src/neynar-api/v2/openapi-farcaster/.openapi-generator/FILES @@ -33,6 +33,7 @@ models/ban-req-body.ts models/ban-response.ts models/block-list-response.ts models/block-record.ts +models/block-req-body.ts models/bulk-casts-response.ts models/bulk-follow-response.ts models/bulk-users-response.ts diff --git a/src/neynar-api/v2/openapi-farcaster/apis/block-api.ts b/src/neynar-api/v2/openapi-farcaster/apis/block-api.ts index 8514c92..e2fe333 100644 --- a/src/neynar-api/v2/openapi-farcaster/apis/block-api.ts +++ b/src/neynar-api/v2/openapi-farcaster/apis/block-api.ts @@ -24,24 +24,67 @@ import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError // @ts-ignore import type { BlockListResponse } from '../models'; // @ts-ignore +import type { BlockReqBody } from '../models'; +// @ts-ignore import type { ErrorRes } from '../models'; +// @ts-ignore +import type { OperationResponse } from '../models'; /** * BlockApi - axios parameter creator * @export */ export const BlockApiAxiosParamCreator = function (configuration?: Configuration) { return { + /** + * Deletes a block for a given FID. + * @summary Unblock FID + * @param {BlockReqBody} blockReqBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteBlock: async (blockReqBody: BlockReqBody, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'blockReqBody' is not null or undefined + assertParamExists('deleteBlock', 'blockReqBody', blockReqBody) + const localVarPath = `/farcaster/block`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication ApiKeyAuth required + await setApiKeyToObject(localVarHeaderParameter, "x-api-key", configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(blockReqBody, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * Fetches all FIDs that a user has blocked or has been blocked by * @summary Blocked / Blocked by FIDs * @param {number} [blockerFid] Providing this will return the users that this user has blocked * @param {number} [blockedFid] Providing this will return the users that have blocked this user - * @param {number} [limit] Number of results to fetch (default 20, max 100). + * @param {number} [limit] Number of results to fetch * @param {string} [cursor] Pagination cursor. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - blockList: async (blockerFid?: number, blockedFid?: number, limit?: number, cursor?: string, options: RawAxiosRequestConfig = {}): Promise => { + fetchBlockList: async (blockerFid?: number, blockedFid?: number, limit?: number, cursor?: string, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/farcaster/block/list`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -79,6 +122,45 @@ export const BlockApiAxiosParamCreator = function (configuration?: Configuration let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Adds a block for a given FID. + * @summary Block FID + * @param {BlockReqBody} blockReqBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + publishBlock: async (blockReqBody: BlockReqBody, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'blockReqBody' is not null or undefined + assertParamExists('publishBlock', 'blockReqBody', blockReqBody) + const localVarPath = `/farcaster/block`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication ApiKeyAuth required + await setApiKeyToObject(localVarHeaderParameter, "x-api-key", configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(blockReqBody, localVarRequestOptions, configuration) + return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, @@ -94,20 +176,46 @@ export const BlockApiAxiosParamCreator = function (configuration?: Configuration export const BlockApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = BlockApiAxiosParamCreator(configuration) return { + /** + * Deletes a block for a given FID. + * @summary Unblock FID + * @param {BlockReqBody} blockReqBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteBlock(blockReqBody: BlockReqBody, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteBlock(blockReqBody, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['BlockApi.deleteBlock']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, /** * Fetches all FIDs that a user has blocked or has been blocked by * @summary Blocked / Blocked by FIDs * @param {number} [blockerFid] Providing this will return the users that this user has blocked * @param {number} [blockedFid] Providing this will return the users that have blocked this user - * @param {number} [limit] Number of results to fetch (default 20, max 100). + * @param {number} [limit] Number of results to fetch * @param {string} [cursor] Pagination cursor. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async blockList(blockerFid?: number, blockedFid?: number, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.blockList(blockerFid, blockedFid, limit, cursor, options); + async fetchBlockList(blockerFid?: number, blockedFid?: number, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.fetchBlockList(blockerFid, blockedFid, limit, cursor, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['BlockApi.fetchBlockList']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Adds a block for a given FID. + * @summary Block FID + * @param {BlockReqBody} blockReqBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async publishBlock(blockReqBody: BlockReqBody, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.publishBlock(blockReqBody, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['BlockApi.blockList']?.[localVarOperationServerIndex]?.url; + const localVarOperationServerBasePath = operationServerMap['BlockApi.publishBlock']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } @@ -120,18 +228,38 @@ export const BlockApiFp = function(configuration?: Configuration) { export const BlockApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = BlockApiFp(configuration) return { + /** + * Deletes a block for a given FID. + * @summary Unblock FID + * @param {BlockReqBody} blockReqBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteBlock(blockReqBody: BlockReqBody, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.deleteBlock(blockReqBody, options).then((request) => request(axios, basePath)); + }, /** * Fetches all FIDs that a user has blocked or has been blocked by * @summary Blocked / Blocked by FIDs * @param {number} [blockerFid] Providing this will return the users that this user has blocked * @param {number} [blockedFid] Providing this will return the users that have blocked this user - * @param {number} [limit] Number of results to fetch (default 20, max 100). + * @param {number} [limit] Number of results to fetch * @param {string} [cursor] Pagination cursor. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - blockList(blockerFid?: number, blockedFid?: number, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.blockList(blockerFid, blockedFid, limit, cursor, options).then((request) => request(axios, basePath)); + fetchBlockList(blockerFid?: number, blockedFid?: number, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.fetchBlockList(blockerFid, blockedFid, limit, cursor, options).then((request) => request(axios, basePath)); + }, + /** + * Adds a block for a given FID. + * @summary Block FID + * @param {BlockReqBody} blockReqBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + publishBlock(blockReqBody: BlockReqBody, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.publishBlock(blockReqBody, options).then((request) => request(axios, basePath)); }, }; }; @@ -143,19 +271,43 @@ export const BlockApiFactory = function (configuration?: Configuration, basePath * @extends {BaseAPI} */ export class BlockApi extends BaseAPI { + /** + * Deletes a block for a given FID. + * @summary Unblock FID + * @param {BlockReqBody} blockReqBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof BlockApi + */ + public deleteBlock(blockReqBody: BlockReqBody, options?: RawAxiosRequestConfig) { + return BlockApiFp(this.configuration).deleteBlock(blockReqBody, options).then((request) => request(this.axios, this.basePath)); + } + /** * Fetches all FIDs that a user has blocked or has been blocked by * @summary Blocked / Blocked by FIDs * @param {number} [blockerFid] Providing this will return the users that this user has blocked * @param {number} [blockedFid] Providing this will return the users that have blocked this user - * @param {number} [limit] Number of results to fetch (default 20, max 100). + * @param {number} [limit] Number of results to fetch * @param {string} [cursor] Pagination cursor. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BlockApi */ - public blockList(blockerFid?: number, blockedFid?: number, limit?: number, cursor?: string, options?: RawAxiosRequestConfig) { - return BlockApiFp(this.configuration).blockList(blockerFid, blockedFid, limit, cursor, options).then((request) => request(this.axios, this.basePath)); + public fetchBlockList(blockerFid?: number, blockedFid?: number, limit?: number, cursor?: string, options?: RawAxiosRequestConfig) { + return BlockApiFp(this.configuration).fetchBlockList(blockerFid, blockedFid, limit, cursor, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Adds a block for a given FID. + * @summary Block FID + * @param {BlockReqBody} blockReqBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof BlockApi + */ + public publishBlock(blockReqBody: BlockReqBody, options?: RawAxiosRequestConfig) { + return BlockApiFp(this.configuration).publishBlock(blockReqBody, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/src/neynar-api/v2/openapi-farcaster/models/block-req-body.ts b/src/neynar-api/v2/openapi-farcaster/models/block-req-body.ts new file mode 100644 index 0000000..c78465f --- /dev/null +++ b/src/neynar-api/v2/openapi-farcaster/models/block-req-body.ts @@ -0,0 +1,36 @@ +/* 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 + * @interface BlockReqBody + */ +export interface BlockReqBody { + /** + * UUID of the signer + * @type {string} + * @memberof BlockReqBody + */ + 'signer_uuid': string; + /** + * The unique identifier of a farcaster user (unsigned integer) + * @type {number} + * @memberof BlockReqBody + */ + 'blocked_fid': number; +} + diff --git a/src/neynar-api/v2/openapi-farcaster/models/index.ts b/src/neynar-api/v2/openapi-farcaster/models/index.ts index 70ff81c..e63395a 100644 --- a/src/neynar-api/v2/openapi-farcaster/models/index.ts +++ b/src/neynar-api/v2/openapi-farcaster/models/index.ts @@ -7,6 +7,7 @@ export * from './ban-req-body'; export * from './ban-response'; export * from './block-list-response'; export * from './block-record'; +export * from './block-req-body'; export * from './bulk-casts-response'; export * from './bulk-follow-response'; export * from './bulk-users-response'; diff --git a/src/oas b/src/oas index 26a6796..842706f 160000 --- a/src/oas +++ b/src/oas @@ -1 +1 @@ -Subproject commit 26a679622d0d3ff66f4c6dbcb601629ea85ffcdc +Subproject commit 842706f778e192a45cf1bfeb64a04e67f384dde2