Skip to content

Commit

Permalink
Merge pull request #32 from Foxy/bugfix/add-webhook-typedefs
Browse files Browse the repository at this point in the history
fix: add missing webhook typedefs
  • Loading branch information
brettflorio authored May 12, 2022
2 parents 35c712f + 83f7271 commit e5d398a
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/backend/Graph/webhook.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import type { Graph } from '../../core';
import type { Store } from './store';
import type { WebhookLogs } from './webhook_logs';
import type { WebhookStatuses } from './webhook_statuses';
import type { Webhooks } from './webhooks';

export interface Webhook extends Graph {
curie: 'fx:webhook';

links: {
/** This resource. */
'self': Webhook;
/** Store this webhook was created in. */
'fx:store': Store;
/** List of all webhooks for the store. */
'fx:webhooks': Webhooks;
/** List of all webhook delivery attempts and their current states. */
'fx:statuses': WebhookStatuses;
/** List of all endpoint responses received during webhook delivery attempts. */
'fx:logs': WebhookLogs;
};

props: {
/** The type of this webhook. Required. */
format: 'json' | 'webflow' | 'zapier';
/** The version of this webhook. Should not be modified unless you have specific instructions from Foxy. Default value is 2. */
version: number;
/** The name of this webhook. Required. 255 characters or less. */
name: string;
/** The endpoint where we will send the webhook data. 1000 characters or less. */
url: string | null;
/** The webhook payload mirrors the API, and you can include more or less data according to your needs (using `zoom` and other modifiers). 1000 characters or less. Something like `zoom=items,items:options,customer`. */
query: string | null;
/** The JSON webhooks are encrypted in certain situations. This key is also used to generate a signature to verify the integrity of the payload. 1000 characters or less. */
encryption_key: string | null;
/** The type of resource to observe changes on. */
event_resource: ('subscription' | 'transaction' | 'customer')[];
/** The date this resource was created. */
date_created: string | null;
/** The date this resource was last modified. */
date_modified: string | null;
};
}
42 changes: 42 additions & 0 deletions src/backend/Graph/webhook_log.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import type { Customer } from './customer';
import type { Graph } from '../../core';
import type { Store } from './store';
import type { Subscription } from './subscription';
import type { Transaction } from './transaction';
import type { Webhook } from './webhook';

export interface WebhookLog extends Graph {
curie: 'fx:webhook_log';

links: {
/** This resource. */
'self': WebhookLog;
/** The store this webhook status is associated with. */
'fx:store': Store;
/** The webhook this status is associated with. */
'fx:webhook': Webhook;
/** The resource changes in which have triggered the webhook. */
'fx:resource': Transaction | Subscription | Customer;
};

props: {
/** The type of resource changes were observed on. */
resource_type: 'subscription' | 'transaction' | 'customer';
/** The ID of the resource changes in which have triggered the webhook. */
resource_id: number;
/** The ID of the webhook this status is associated with. */
webhook_id: number;
/** The code received from the server the webhook was sent to. */
response_code: string;
/** The content received from the server the webhook was sent to. */
response_body: string | null;
/** The date this resource was created. */
date_created: string | null;
/** The date this resource was last modified. */
date_modified: string | null;
};

zooms: {
webhook?: Webhook;
};
}
10 changes: 10 additions & 0 deletions src/backend/Graph/webhook_logs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
import type { Graph } from '../../core';
import type { WebhookLog } from './webhook_log';

export interface WebhookLogs extends Graph {
curie: 'fx:webhook_logs';
links: CollectionGraphLinks<WebhookLogs>;
props: CollectionGraphProps;
child: WebhookLog;
}
40 changes: 40 additions & 0 deletions src/backend/Graph/webhook_status.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type { Customer } from './customer';
import type { Graph } from '../../core';
import type { Store } from './store';
import type { Subscription } from './subscription';
import type { Transaction } from './transaction';
import type { Webhook } from './webhook';

export interface WebhookStatus extends Graph {
curie: 'fx:webhook_status';

links: {
/** This resource. */
'self': WebhookStatus;
/** The store this webhook status is associated with. */
'fx:store': Store;
/** The webhook this status is associated with. */
'fx:webhook': Webhook;
/** The resource changes in which have triggered the webhook. */
'fx:resource': Transaction | Subscription | Customer;
};

props: {
/** The type of resource changes were observed on. */
resource_type: 'subscription' | 'transaction' | 'customer';
/** The ID of the resource changes in which have triggered the webhook. */
resource_id: number;
/** The ID of the webhook this status is associated with. */
webhook_id: number;
/** The current state of this attempt. */
status: 'pending' | 'failed' | 'successful';
/** The date this resource was created. */
date_created: string | null;
/** The date this resource was last modified. */
date_modified: string | null;
};

zooms: {
webhook?: Webhook;
};
}
10 changes: 10 additions & 0 deletions src/backend/Graph/webhook_statuses.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
import type { Graph } from '../../core';
import type { WebhookStatus } from './webhook_status';

export interface WebhookStatuses extends Graph {
curie: 'fx:webhook_statuses';
links: CollectionGraphLinks<WebhookStatuses>;
props: CollectionGraphProps;
child: WebhookStatus;
}
10 changes: 10 additions & 0 deletions src/backend/Graph/webhooks.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
import type { Graph } from '../../core';
import type { Webhook } from './webhook';

export interface Webhooks extends Graph {
curie: 'fx:webhooks';
links: CollectionGraphLinks<Webhooks>;
props: CollectionGraphProps;
child: Webhook;
}
6 changes: 6 additions & 0 deletions src/backend/Rels.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,9 @@ export * from './Graph/user_access';
export * from './Graph/user_accesses';
export * from './Graph/users';
export * from './Graph/void';
export * from './Graph/webhook_log';
export * from './Graph/webhook_logs';
export * from './Graph/webhook_status';
export * from './Graph/webhook_statuses';
export * from './Graph/webhook';
export * from './Graph/webhooks';

0 comments on commit e5d398a

Please sign in to comment.