diff --git a/src/index.ts b/src/index.ts index 88dd4610..2b8b679a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,4 +11,5 @@ if (!semver.satisfies(process.version, requiredVersion)) { export * from "./clients"; export * from "./utils"; +export * from "./types" export { Configuration } from "./clients/configuration"; diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 00000000..5049a61f --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1 @@ +export * from "./webhooks" \ No newline at end of file diff --git a/src/types/webhooks.ts b/src/types/webhooks.ts new file mode 100644 index 00000000..f17c6223 --- /dev/null +++ b/src/types/webhooks.ts @@ -0,0 +1,84 @@ +import { Cast, User } from "../api"; + +interface UserDehydrated { + fid: number; + object: "user_dehydrated"; + username: string; +} + +interface CastDehydrated { + hash: string; + author: UserDehydrated; + object: "cast_dehydrated"; +} + +export interface WebhookFollowCreated { + data: { + event_timestamp: string; + user: UserDehydrated; + object: "follow"; + timestamp: string; + target_user: UserDehydrated; + }; + type: "follow.created"; + created_at: number; +} + +export interface WebhookFollowDeleted { + data: { + event_timestamp: string; + user: UserDehydrated; + object: "unfollow"; + timestamp: string; + target_user: UserDehydrated; + }; + type: "follow.deleted"; + created_at: number; +} + +export interface WebhookReactionCreated { + data: { + cast: CastDehydrated; + event_timestamp: string; + user: UserDehydrated; + object: "reaction"; + timestamp: string; + reaction_type: 1 | 2; + }; + type: "reaction.created"; + created_at: number; +} + +export interface WebhookReactionDeleted { + data: { + cast: CastDehydrated; + event_timestamp: string; + user: UserDehydrated; + object: "reaction"; + timestamp: string; + reaction_type: 1 | 2; + }; + type: "reaction.deleted"; + created_at: number; +} + +export interface WebhookCastCreated { + data: Cast; + type: "cast.created"; + created_at: number; + event_timestamp: string; +} + +export interface WebhookUserCreated { + data: User; + type: "user.created"; + created_at: number; + event_timestamp: string; +} + +export interface WebhookUserUpdated { + data: User; + type: "user.updated"; + created_at: number; + event_timestamp: string; +}