From 83f72717d63276ffa7161f563bc838c2787a9efa Mon Sep 17 00:00:00 2001 From: Daniil Bratukhin Date: Thu, 12 May 2022 23:15:54 +0300 Subject: [PATCH] fix: add missing webhook typedefs --- src/backend/Graph/webhook.d.ts | 43 +++++++++++++++++++++++++ src/backend/Graph/webhook_log.d.ts | 42 ++++++++++++++++++++++++ src/backend/Graph/webhook_logs.d.ts | 10 ++++++ src/backend/Graph/webhook_status.d.ts | 40 +++++++++++++++++++++++ src/backend/Graph/webhook_statuses.d.ts | 10 ++++++ src/backend/Graph/webhooks.d.ts | 10 ++++++ src/backend/Rels.d.ts | 6 ++++ 7 files changed, 161 insertions(+) create mode 100644 src/backend/Graph/webhook.d.ts create mode 100644 src/backend/Graph/webhook_log.d.ts create mode 100644 src/backend/Graph/webhook_logs.d.ts create mode 100644 src/backend/Graph/webhook_status.d.ts create mode 100644 src/backend/Graph/webhook_statuses.d.ts create mode 100644 src/backend/Graph/webhooks.d.ts diff --git a/src/backend/Graph/webhook.d.ts b/src/backend/Graph/webhook.d.ts new file mode 100644 index 0000000..b7c9980 --- /dev/null +++ b/src/backend/Graph/webhook.d.ts @@ -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; + }; +} diff --git a/src/backend/Graph/webhook_log.d.ts b/src/backend/Graph/webhook_log.d.ts new file mode 100644 index 0000000..56bad13 --- /dev/null +++ b/src/backend/Graph/webhook_log.d.ts @@ -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; + }; +} diff --git a/src/backend/Graph/webhook_logs.d.ts b/src/backend/Graph/webhook_logs.d.ts new file mode 100644 index 0000000..7df255f --- /dev/null +++ b/src/backend/Graph/webhook_logs.d.ts @@ -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; + props: CollectionGraphProps; + child: WebhookLog; +} diff --git a/src/backend/Graph/webhook_status.d.ts b/src/backend/Graph/webhook_status.d.ts new file mode 100644 index 0000000..d400051 --- /dev/null +++ b/src/backend/Graph/webhook_status.d.ts @@ -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; + }; +} diff --git a/src/backend/Graph/webhook_statuses.d.ts b/src/backend/Graph/webhook_statuses.d.ts new file mode 100644 index 0000000..ebc46d7 --- /dev/null +++ b/src/backend/Graph/webhook_statuses.d.ts @@ -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; + props: CollectionGraphProps; + child: WebhookStatus; +} diff --git a/src/backend/Graph/webhooks.d.ts b/src/backend/Graph/webhooks.d.ts new file mode 100644 index 0000000..e561d6c --- /dev/null +++ b/src/backend/Graph/webhooks.d.ts @@ -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; + props: CollectionGraphProps; + child: Webhook; +} diff --git a/src/backend/Rels.d.ts b/src/backend/Rels.d.ts index aa0e61f..45b5b79 100644 --- a/src/backend/Rels.d.ts +++ b/src/backend/Rels.d.ts @@ -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';