Skip to content

Commit

Permalink
Make webhook types fired from convoy available
Browse files Browse the repository at this point in the history
  • Loading branch information
Shreyaschorge committed Nov 13, 2024
1 parent 5b0ac7b commit a951eaa
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ if (!semver.satisfies(process.version, requiredVersion)) {

export * from "./clients";
export * from "./utils";
export * from "./types"
export { Configuration } from "./clients/configuration";
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./webhooks"
84 changes: 84 additions & 0 deletions src/types/webhooks.ts
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit a951eaa

Please sign in to comment.