@shipengine/js-api 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
package/types.d.ts CHANGED
@@ -23,6 +23,7 @@ export * from "./shipments/types";
23
23
  export * from "./shipping-rules/types";
24
24
  export * from "./themes/types";
25
25
  export * from "./warehouses/types";
26
+ export * from "./webhooks/types";
26
27
  export * from "./weight/types";
27
28
  export * from "./weight-band/types";
28
29
  export * from "./zones/types";
@@ -0,0 +1,48 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { Webhook, WebhookInput } from "./types";
3
+ export type ListWebhookOptions = {
4
+ includeInactive: boolean;
5
+ };
6
+ /**
7
+ * # Webhooks API module - /v1/environment/webhooks
8
+ * https://shipengine.github.io/shipengine-openapi/#tag/webhooks
9
+ */
10
+ export declare class WebhooksAPI {
11
+ private client;
12
+ constructor(client: AxiosInstance);
13
+ /**
14
+ * The `list` method retrieves a list of `webhooks`
15
+ * for a given user.
16
+ * https://shipengine.github.io/shipengine-openapi/#operation/list_webhooks
17
+ */
18
+ list: (options?: ListWebhookOptions) => Promise<import("axios").AxiosResponse<Webhook[], any>>;
19
+ /**
20
+ * The `create` method allows the creation of webhooks
21
+ * for a given user
22
+ * https://shipengine.github.io/shipengine-openapi/#operation/create_webhook
23
+ * @param webhook WebhookInput
24
+ * @returns new WebHook created
25
+ */
26
+ create: (webhook: WebhookInput) => Promise<import("axios").AxiosResponse<Webhook, any>>;
27
+ /**
28
+ * The `get` method retrieves a given webhooks
29
+ * @param webhookId string
30
+ * @returns WebHook
31
+ */
32
+ get: (webhookId: string) => Promise<import("axios").AxiosResponse<Webhook, any>>;
33
+ /**
34
+ * The `update` method updates a specific webhook for a
35
+ * given user by `webhookId`.
36
+ * @param webhookId string
37
+ * @param webhook new Webhook to update
38
+ * @returns WebHook updated
39
+ */
40
+ update: (webhook: Webhook) => Promise<import("axios").AxiosResponse<Webhook, any>>;
41
+ /**
42
+ * The `delete` method deletes a specific webhook
43
+ * for a given user by `webhookId`.
44
+ * @param webhookId string
45
+ * @returns void
46
+ */
47
+ delete: (webhookId: string) => Promise<import("axios").AxiosResponse<void, any>>;
48
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ export * from "./types";
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @category Entities
3
+ */
4
+ export interface WebhookHeader {
5
+ key: string;
6
+ value: string;
7
+ }
8
+ /**
9
+ * @category Entities
10
+ */
11
+ export type WebHookEvent = "batch" | "carrier_connected" | "order_source_refresh_complete" | "rate" | "report_complete" | "sales_orders_imported" | "track";
12
+ /**
13
+ * @category Entities
14
+ */
15
+ export interface Webhook {
16
+ event: WebHookEvent;
17
+ headers?: WebhookHeader[];
18
+ isActive: boolean;
19
+ url: string;
20
+ webhookId: string;
21
+ }
22
+ /**
23
+ * @category Entities
24
+ */
25
+ export type WebhookInput = Omit<Webhook, "webhookId" | "isActive">;