Skip to content

Commit

Permalink
Get user by custody address
Browse files Browse the repository at this point in the history
Get user by custody address
  • Loading branch information
Shreyaschorge authored Nov 14, 2023
2 parents e3d64c1 + 0b1c9d1 commit 5c1a5b1
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 44 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.11.0",
"version": "0.11.1",
"description": "SDK to interact with Neynar APIs (https://docs.neynar.com/)",
"main": "./build/index.js",
"types": "./build/index.d.ts",
Expand Down
11 changes: 11 additions & 0 deletions src/neynar-api/neynar-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
UserSearchResponse,
CastResponse,
CastsResponse,
UserResponse,
} from "./neynar-v2-api/openapi-farcaster";

import {
Expand Down Expand Up @@ -459,6 +460,16 @@ export class NeynarAPIClient {
return await this.clients.v2.searchUser(q, viewerFid);
}

/**
* Lookup User by Custody Address
* See [Neynar documentation](https://docs.neynar.com/reference/lookup-user-by-custody-address)
*/
public async lookupUserByCustodyAddress(
custodyAddress: string
): Promise<UserResponse> {
return await this.clients.v2.lookupUserByCustodyAddress(custodyAddress);
}

// ------------ Cast ------------

/**
Expand Down
14 changes: 14 additions & 0 deletions src/neynar-api/neynar-v2-api/neynar-api-v2-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
UserSearchResponse,
CastResponse,
CastsResponse,
UserResponse,
} from "./openapi-farcaster";
import axios, { AxiosError, AxiosInstance } from "axios";
import { silentLogger, Logger } from "../common/logger";
Expand Down Expand Up @@ -320,6 +321,19 @@ export class NeynarV2APIClient {
return response.data;
}

/**
* Lookup User by Custody Address
* See [Neynar documentation](https://docs.neynar.com/reference/lookup-user-by-custody-address)
*/
public async lookupUserByCustodyAddress(
custodyAddress: string
): Promise<UserResponse> {
const response = await this.apis.user.lookupUserByCustodyAddress({
custodyAddress,
});
return response.data;
}

// ------------ Cast ------------

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ models/user-bulk200-response.ts
models/user-dehydrated.ts
models/user-profile-bio.ts
models/user-profile.ts
models/user-response.ts
models/user-search-response-result.ts
models/user-search-response.ts
models/user-viewer-context.ts
Expand Down
Loading

0 comments on commit 5c1a5b1

Please sign in to comment.