-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from Foxy/bugfix/add-webhook-typedefs
fix: add missing webhook typedefs
- Loading branch information
Showing
7 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters