Skip to content

Commit

Permalink
wip: api
Browse files Browse the repository at this point in the history
  • Loading branch information
Complexlity committed Aug 8, 2024
1 parent 34cef05 commit 464efaa
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/playground.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const uniFarcasterSdk: any = {};

const sdk = new uniFarcasterSdk({
hubUrl: "string | hasDefaultValue",
neynarApiKey: "string | undefined",
airstackApiKey: "string | undefined",
});

const user: User = sdk.getUserByFid(11244, 213144);
const user2: User = sdk.getUserByUsername("complexlity", 213144);
const cast: Cast = sdk.getCastByHash("0xa0bc828", 213144);
const cast2: Cast = sdk.getCastByUrl("https://warpcast.com/0xa38dj", 213144);

type User = {
fid: number;
ethAddresses: string[];
solAddresses: string[];
username: string;
displayName: string;
bio: string;
pfpUrl: string;
followerCount: number;
followingCount: number;
powerBadge: boolean;
viewerContext: {
following: boolean;
followedBy: boolean;
};
};

type Cast = {
author: User;
userReactions: {
likes: number;
recasts: number;
};
viewerContext: {
liked: boolean;
recasted: boolean;
};
};

//Optional: Expose neynar and airstack for direct query when extra infor needed
const endpoint = "/user?limit=2";
const query = `SOME_GRAPHQL_QUERY`;
sdk.neynar(endpoint);
sdk.airstack(query);

0 comments on commit 464efaa

Please sign in to comment.