webflow-api 1.2.1 → 1.3.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.
Files changed (61) hide show
  1. package/.eslintrc +31 -0
  2. package/.github/workflows/code-quality.yml +102 -0
  3. package/.github/workflows/npm-publish.yml +21 -0
  4. package/.github/workflows/semgrep.yml +24 -0
  5. package/.prettierignore +5 -0
  6. package/.prettierrc +6 -0
  7. package/README.md +53 -4
  8. package/jest.config.js +17 -0
  9. package/package.json +2 -7
  10. package/src/api/collection.ts +1 -1
  11. package/src/api/item.ts +4 -4
  12. package/src/api/meta.ts +2 -2
  13. package/src/api/oauth.ts +10 -3
  14. package/src/core/error.ts +1 -1
  15. package/src/core/webflow.ts +111 -4
  16. package/tests/api/collection.test.ts +147 -0
  17. package/tests/api/item.test.ts +180 -0
  18. package/tests/api/meta.test.ts +38 -0
  19. package/tests/api/oauth.test.ts +44 -0
  20. package/tests/api/site.test.ts +202 -0
  21. package/tests/api/user.test.ts +139 -0
  22. package/tests/api/webhook.test.ts +82 -0
  23. package/tests/core/error.test.ts +19 -0
  24. package/tests/core/response.test.ts +36 -0
  25. package/tests/core/webflow.test.ts +540 -0
  26. package/tests/fixtures/collection.fixture.ts +374 -0
  27. package/tests/fixtures/index.ts +7 -0
  28. package/tests/fixtures/item.fixture.ts +193 -0
  29. package/tests/fixtures/meta.fixture.ts +34 -0
  30. package/tests/fixtures/oauth.fixture.ts +38 -0
  31. package/tests/fixtures/site.fixture.ts +78 -0
  32. package/tests/fixtures/user.fixture.ts +175 -0
  33. package/tests/fixtures/webhook.fixture.ts +69 -0
  34. package/tsconfig.eslint.json +7 -0
  35. package/tsconfig.json +14 -0
  36. package/dist/api/collection.d.ts +0 -112
  37. package/dist/api/collection.js +0 -94
  38. package/dist/api/index.d.ts +0 -7
  39. package/dist/api/index.js +0 -23
  40. package/dist/api/item.d.ts +0 -177
  41. package/dist/api/item.js +0 -151
  42. package/dist/api/meta.d.ts +0 -53
  43. package/dist/api/meta.js +0 -25
  44. package/dist/api/oauth.d.ts +0 -69
  45. package/dist/api/oauth.js +0 -65
  46. package/dist/api/site.d.ts +0 -140
  47. package/dist/api/site.js +0 -137
  48. package/dist/api/user.d.ts +0 -143
  49. package/dist/api/user.js +0 -119
  50. package/dist/api/webhook.d.ts +0 -102
  51. package/dist/api/webhook.js +0 -80
  52. package/dist/core/error.d.ts +0 -21
  53. package/dist/core/error.js +0 -30
  54. package/dist/core/index.d.ts +0 -3
  55. package/dist/core/index.js +0 -19
  56. package/dist/core/response.d.ts +0 -32
  57. package/dist/core/response.js +0 -26
  58. package/dist/core/webflow.d.ts +0 -386
  59. package/dist/core/webflow.js +0 -445
  60. package/dist/index.d.ts +0 -2
  61. package/yarn.lock +0 -2830
@@ -1,177 +0,0 @@
1
- import { AxiosInstance } from "axios";
2
- import { PaginatedData, WebflowRecord } from "../core";
3
- /**************************************************************
4
- * Interfaces
5
- **************************************************************/
6
- export interface IItem {
7
- _archived: boolean;
8
- _draft: boolean;
9
- _id: string;
10
- _cid: string;
11
- name: string;
12
- slug: string;
13
- "updated-on": string;
14
- "created-on": string;
15
- "updated-by": string;
16
- "created-by": string;
17
- "published-on"?: string | null;
18
- "published-by"?: string | null;
19
- }
20
- export interface IItemDelete {
21
- deleted: number;
22
- }
23
- export interface IPublishItems {
24
- publishedItemIds: string[];
25
- errors: string[];
26
- }
27
- export interface IDeletedItems {
28
- deletedItemIds: string[];
29
- errors: string[];
30
- }
31
- /**************************************************************
32
- * Types
33
- **************************************************************/
34
- export declare type PageinatedItems = PaginatedData & {
35
- items: IItem[];
36
- };
37
- /**************************************************************
38
- * Class
39
- **************************************************************/
40
- export declare class Item extends WebflowRecord<IItem> implements IItem {
41
- "published-on"?: string | null;
42
- "published-by"?: string | null;
43
- "updated-on": string;
44
- "created-on": string;
45
- "updated-by": string;
46
- "created-by": string;
47
- _archived: boolean;
48
- _draft: boolean;
49
- _cid: string;
50
- name: string;
51
- slug: string;
52
- _id: string;
53
- /**************************************************************
54
- * Static Methods
55
- **************************************************************/
56
- /**
57
- * Get a single Item
58
- * @param params The params for the request
59
- * @param params.collectionId The Collection ID
60
- * @param params.itemId The Item ID
61
- * @param client The Axios client instance
62
- * @returns A single Item
63
- */
64
- static getOne({ collectionId, itemId }: {
65
- collectionId: string;
66
- itemId: string;
67
- }, client: AxiosInstance): Promise<import("axios").AxiosResponse<PageinatedItems, any>>;
68
- /**
69
- * Get a list of Items
70
- * @param params The params for the request
71
- * @param params.collectionId The Collection ID
72
- * @param params.limit The number of items to return (optional)
73
- * @param params.offset The number of items to skip (optional)
74
- * @param client The Axios client instance
75
- * @returns A list of Items
76
- */
77
- static list({ collectionId, limit, offset }: {
78
- collectionId: string;
79
- limit?: number;
80
- offset?: number;
81
- }, client: AxiosInstance): Promise<import("axios").AxiosResponse<PageinatedItems, any>>;
82
- /**
83
- * Create a new Item
84
- * @param params The params for the request
85
- * @param params.collectionId The Collection ID
86
- * @param params.fields The Item fields to create
87
- * @param client The Axios client instance
88
- * @returns The created Item
89
- */
90
- static create({ collectionId, fields }: {
91
- fields: any;
92
- collectionId: string;
93
- }, client: AxiosInstance): Promise<import("axios").AxiosResponse<IItem, any>>;
94
- /**
95
- * Update a single Item
96
- * @param params The params for the request
97
- * @param params.collectionId The Collection ID
98
- * @param params.itemId The Item ID
99
- * @param params.fields The fields to update
100
- * @param client The Axios client instance
101
- * @returns The updated Item
102
- */
103
- static update({ collectionId, itemId, fields, }: {
104
- fields: any;
105
- itemId: string;
106
- collectionId: string;
107
- }, client: AxiosInstance): Promise<import("axios").AxiosResponse<IItem, any>>;
108
- /**
109
- * Patch a single Item
110
- * @param params The params for the request
111
- * @param params.collectionId The Collection ID
112
- * @param params.itemId The Item ID
113
- * @param params.fields The fields to patch
114
- * @param client The Axios client instance
115
- * @returns The patched Item
116
- */
117
- static patch({ collectionId, itemId, fields, }: {
118
- fields: any;
119
- itemId: string;
120
- collectionId: string;
121
- }, client: AxiosInstance): Promise<import("axios").AxiosResponse<IItem, any>>;
122
- /**
123
- * Remove a single Item
124
- * @param params The params for the request
125
- * @param params.collectionId The Collection ID
126
- * @param params.itemId The Item ID
127
- * @param client The Axios client instance
128
- * @returns The result from the removal
129
- */
130
- static remove({ collectionId, itemId, }: {
131
- itemId: string;
132
- collectionId: string;
133
- }, client: AxiosInstance): Promise<import("axios").AxiosResponse<IItemDelete, any>>;
134
- /**
135
- * Unpublishes a list of Items
136
- * @param params The params for the request
137
- * @param params.collectionId The Collection ID
138
- * @param params.live Unpublish from the live site
139
- * @param client The Axios client instance
140
- * @returns The result of the unpublish
141
- */
142
- static unpublish({ collectionId, itemIds, live, }: {
143
- live?: boolean;
144
- itemIds: string[];
145
- collectionId: string;
146
- }, client: AxiosInstance): Promise<import("axios").AxiosResponse<IDeletedItems, any>>;
147
- /**
148
- * Publishes a list of Items
149
- * @param params The request parameters
150
- * @param params.collectionId The Collection ID
151
- * @param params.itemIds The list of Item IDs to publish
152
- * @param params.live Publish to live site
153
- * @param client The Axios client instance
154
- * @returns The result of the publish
155
- */
156
- static publish({ itemIds, live, collectionId, }: {
157
- live?: boolean;
158
- itemIds: string[];
159
- collectionId: string;
160
- }, client: AxiosInstance): Promise<import("axios").AxiosResponse<IPublishItems, any>>;
161
- /**************************************************************
162
- * Instance Methods
163
- **************************************************************/
164
- /**
165
- * Update a single Item
166
- * @param fields The fields to update
167
- * @returns The updated Item
168
- */
169
- update({ ...fields }: {
170
- [x: string]: any;
171
- }): Promise<Item>;
172
- /**
173
- * Remove a single Item
174
- * @returns The result from the removal
175
- */
176
- remove(): Promise<IItemDelete>;
177
- }
package/dist/api/item.js DELETED
@@ -1,151 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Item = void 0;
4
- const core_1 = require("../core");
5
- /**************************************************************
6
- * Class
7
- **************************************************************/
8
- class Item extends core_1.WebflowRecord {
9
- /**************************************************************
10
- * Static Methods
11
- **************************************************************/
12
- /**
13
- * Get a single Item
14
- * @param params The params for the request
15
- * @param params.collectionId The Collection ID
16
- * @param params.itemId The Item ID
17
- * @param client The Axios client instance
18
- * @returns A single Item
19
- */
20
- static getOne({ collectionId, itemId }, client) {
21
- (0, core_1.requireArgs)({ collectionId, itemId });
22
- const path = `/collections/${collectionId}/items/${itemId}`;
23
- // The API returns a paginated list with one record :(
24
- return client.get(path);
25
- }
26
- /**
27
- * Get a list of Items
28
- * @param params The params for the request
29
- * @param params.collectionId The Collection ID
30
- * @param params.limit The number of items to return (optional)
31
- * @param params.offset The number of items to skip (optional)
32
- * @param client The Axios client instance
33
- * @returns A list of Items
34
- */
35
- static list({ collectionId, limit, offset }, client) {
36
- (0, core_1.requireArgs)({ collectionId });
37
- const params = { limit, offset };
38
- const path = `/collections/${collectionId}/items`;
39
- return client.get(path, { params });
40
- }
41
- /**
42
- * Create a new Item
43
- * @param params The params for the request
44
- * @param params.collectionId The Collection ID
45
- * @param params.fields The Item fields to create
46
- * @param client The Axios client instance
47
- * @returns The created Item
48
- */
49
- static create({ collectionId, fields }, client) {
50
- (0, core_1.requireArgs)({ collectionId });
51
- const path = `/collections/${collectionId}/items`;
52
- return client.post(path, { fields });
53
- }
54
- /**
55
- * Update a single Item
56
- * @param params The params for the request
57
- * @param params.collectionId The Collection ID
58
- * @param params.itemId The Item ID
59
- * @param params.fields The fields to update
60
- * @param client The Axios client instance
61
- * @returns The updated Item
62
- */
63
- static update({ collectionId, itemId, fields, }, client) {
64
- (0, core_1.requireArgs)({ collectionId, itemId });
65
- const path = `/collections/${collectionId}/items/${itemId}`;
66
- return client.put(path, { fields });
67
- }
68
- /**
69
- * Patch a single Item
70
- * @param params The params for the request
71
- * @param params.collectionId The Collection ID
72
- * @param params.itemId The Item ID
73
- * @param params.fields The fields to patch
74
- * @param client The Axios client instance
75
- * @returns The patched Item
76
- */
77
- static patch({ collectionId, itemId, fields, }, client) {
78
- (0, core_1.requireArgs)({ collectionId, itemId });
79
- const path = `/collections/${collectionId}/items/${itemId}`;
80
- return client.patch(path, { fields });
81
- }
82
- /**
83
- * Remove a single Item
84
- * @param params The params for the request
85
- * @param params.collectionId The Collection ID
86
- * @param params.itemId The Item ID
87
- * @param client The Axios client instance
88
- * @returns The result from the removal
89
- */
90
- static remove({ collectionId, itemId, }, client) {
91
- (0, core_1.requireArgs)({ collectionId, itemId });
92
- const path = `/collections/${collectionId}/items/${itemId}`;
93
- return client.delete(path);
94
- }
95
- /**
96
- * Unpublishes a list of Items
97
- * @param params The params for the request
98
- * @param params.collectionId The Collection ID
99
- * @param params.live Unpublish from the live site
100
- * @param client The Axios client instance
101
- * @returns The result of the unpublish
102
- */
103
- static unpublish({ collectionId, itemIds, live = false, }, client) {
104
- (0, core_1.requireArgs)({ collectionId, itemIds });
105
- const params = { live };
106
- const data = { itemIds };
107
- const url = `/collections/${collectionId}/items`;
108
- const _params = { method: "DELETE", url, data, params };
109
- // DELETE spec doesn't support body in delete
110
- // RFC-9110 https://tools.ietf.org/html/rfc9110
111
- return client.request(_params);
112
- }
113
- /**
114
- * Publishes a list of Items
115
- * @param params The request parameters
116
- * @param params.collectionId The Collection ID
117
- * @param params.itemIds The list of Item IDs to publish
118
- * @param params.live Publish to live site
119
- * @param client The Axios client instance
120
- * @returns The result of the publish
121
- */
122
- static publish({ itemIds, live = false, collectionId, }, client) {
123
- (0, core_1.requireArgs)({ collectionId, itemIds });
124
- const params = { live };
125
- const path = `/collections/${collectionId}/items/publish`;
126
- return client.put(path, { itemIds }, { params });
127
- }
128
- /**************************************************************
129
- * Instance Methods
130
- **************************************************************/
131
- /**
132
- * Update a single Item
133
- * @param fields The fields to update
134
- * @returns The updated Item
135
- */
136
- async update({ ...fields }) {
137
- const params = { collectionId: this._cid, itemId: this._id, fields };
138
- const res = await Item.update(params, this.client);
139
- return new Item(this.client, res);
140
- }
141
- /**
142
- * Remove a single Item
143
- * @returns The result from the removal
144
- */
145
- async remove() {
146
- const params = { collectionId: this._cid, itemId: this._id };
147
- const res = await Item.remove(params, this.client);
148
- return res.data;
149
- }
150
- }
151
- exports.Item = Item;
@@ -1,53 +0,0 @@
1
- import { AxiosInstance } from "axios";
2
- /**************************************************************
3
- * Types
4
- **************************************************************/
5
- export declare type InfoApplication = {
6
- description: string;
7
- ownerType: string;
8
- homepage: string;
9
- owner: string;
10
- name: string;
11
- _id: string;
12
- };
13
- /**************************************************************
14
- * Interfaces
15
- **************************************************************/
16
- export interface IAuthenticatedUser {
17
- user: {
18
- firstName: string;
19
- lastName: string;
20
- email: string;
21
- _id: string;
22
- };
23
- }
24
- export interface IAuthentiationInfo {
25
- application: InfoApplication;
26
- workspaces: string[];
27
- rateLimit: number;
28
- createdOn: string;
29
- grantType: string;
30
- lastUsed: string;
31
- sites: string[];
32
- users: string[];
33
- orgs: string[];
34
- status: string;
35
- _id: string;
36
- }
37
- /**************************************************************
38
- * Class
39
- **************************************************************/
40
- export declare class Meta {
41
- /**
42
- * Get the authentication info for the current token
43
- * @param client The Axios client instance
44
- * @returns The authentication info
45
- */
46
- static info(client: AxiosInstance): Promise<import("axios").AxiosResponse<IAuthentiationInfo, any>>;
47
- /**
48
- * Get the authenticated user
49
- * @param client The Axios client instance
50
- * @returns The authenticated user
51
- */
52
- static user(client: AxiosInstance): Promise<import("axios").AxiosResponse<IAuthenticatedUser, any>>;
53
- }
package/dist/api/meta.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Meta = void 0;
4
- /**************************************************************
5
- * Class
6
- **************************************************************/
7
- class Meta {
8
- /**
9
- * Get the authentication info for the current token
10
- * @param client The Axios client instance
11
- * @returns The authentication info
12
- */
13
- static info(client) {
14
- return client.get("/info");
15
- }
16
- /**
17
- * Get the authenticated user
18
- * @param client The Axios client instance
19
- * @returns The authenticated user
20
- */
21
- static user(client) {
22
- return client.get("/user");
23
- }
24
- }
25
- exports.Meta = Meta;
@@ -1,69 +0,0 @@
1
- import { AxiosInstance } from "axios";
2
- /**************************************************************
3
- * Interfaces
4
- **************************************************************/
5
- export interface IAuthorizeUrlParams {
6
- state?: string;
7
- scope?: string;
8
- client_id: string;
9
- redirect_uri?: string;
10
- response_type?: string;
11
- }
12
- export interface IRevokeTokenParams {
13
- client_secret: string;
14
- access_token: string;
15
- client_id: string;
16
- }
17
- export interface IAccessTokenParams {
18
- code: string;
19
- client_id: string;
20
- grant_type?: string;
21
- client_secret: string;
22
- redirect_uri?: string;
23
- }
24
- export interface IAccessToken {
25
- token_type: string;
26
- access_token: string;
27
- }
28
- export interface IRevokeToken {
29
- didRevoke: boolean;
30
- }
31
- /**************************************************************
32
- * Class
33
- **************************************************************/
34
- export declare class OAuth {
35
- /**
36
- * Get the URL to authorize a user
37
- * @param params The params for the request
38
- * @param params.client_id The OAuth client ID
39
- * @param params.scope The scope (optional)
40
- * @param params.state The state (optional)
41
- * @param params.redirect_uri The redirect URI (optional)
42
- * @param params.response_type The response type (default: code)
43
- * @param client The Axios client instance
44
- * @returns The URL to authorize a user
45
- */
46
- static authorizeUrl({ response_type, redirect_uri, client_id, state, scope }: IAuthorizeUrlParams, client: AxiosInstance): string;
47
- /**
48
- * Get an access token
49
- * @param params The params for the request
50
- * @param params.code The OAuth code
51
- * @param params.client_id The OAuth client ID
52
- * @param params.client_secret The OAuth client secret
53
- * @param params.redirect_uri The redirect URI (optional)
54
- * @param params.grant_type The grant type (default: "authorization_code")
55
- * @param client The Axios client instance
56
- * @returns An access token
57
- */
58
- static accessToken({ grant_type, client_secret, redirect_uri, client_id, code, }: IAccessTokenParams, client: AxiosInstance): Promise<import("axios").AxiosResponse<IAccessToken, any>>;
59
- /**
60
- * Revoke an access token
61
- * @param params The params for the request
62
- * @param params.client_id The OAuth client ID
63
- * @param params.client_secret The OAuth client secret
64
- * @param params.access_token The OAuth access token
65
- * @param client The Axios client instance
66
- * @returns The result of the revoke
67
- */
68
- static revokeToken({ client_secret, access_token, client_id }: IRevokeTokenParams, client: AxiosInstance): Promise<import("axios").AxiosResponse<IRevokeToken, any>>;
69
- }
package/dist/api/oauth.js DELETED
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OAuth = void 0;
4
- const core_1 = require("../core");
5
- /**************************************************************
6
- * Class
7
- **************************************************************/
8
- class OAuth {
9
- /**
10
- * Get the URL to authorize a user
11
- * @param params The params for the request
12
- * @param params.client_id The OAuth client ID
13
- * @param params.scope The scope (optional)
14
- * @param params.state The state (optional)
15
- * @param params.redirect_uri The redirect URI (optional)
16
- * @param params.response_type The response type (default: code)
17
- * @param client The Axios client instance
18
- * @returns The URL to authorize a user
19
- */
20
- static authorizeUrl({ response_type = "code", redirect_uri, client_id, state, scope }, client) {
21
- (0, core_1.requireArgs)({ client_id });
22
- const params = { response_type, client_id };
23
- if (redirect_uri)
24
- params["redirect_uri"] = redirect_uri;
25
- if (state)
26
- params["state"] = state;
27
- if (scope)
28
- params["scope"] = scope;
29
- const url = "/oauth/authorize";
30
- return client.getUri({ url, method: "GET", params });
31
- }
32
- /**
33
- * Get an access token
34
- * @param params The params for the request
35
- * @param params.code The OAuth code
36
- * @param params.client_id The OAuth client ID
37
- * @param params.client_secret The OAuth client secret
38
- * @param params.redirect_uri The redirect URI (optional)
39
- * @param params.grant_type The grant type (default: "authorization_code")
40
- * @param client The Axios client instance
41
- * @returns An access token
42
- */
43
- static accessToken({ grant_type = "authorization_code", client_secret, redirect_uri, client_id, code, }, client) {
44
- (0, core_1.requireArgs)({ client_id, client_secret, code });
45
- const path = "/oauth/access_token";
46
- const data = { client_secret, redirect_uri, grant_type, client_id, code };
47
- return client.post(path, data);
48
- }
49
- /**
50
- * Revoke an access token
51
- * @param params The params for the request
52
- * @param params.client_id The OAuth client ID
53
- * @param params.client_secret The OAuth client secret
54
- * @param params.access_token The OAuth access token
55
- * @param client The Axios client instance
56
- * @returns The result of the revoke
57
- */
58
- static revokeToken({ client_secret, access_token, client_id }, client) {
59
- (0, core_1.requireArgs)({ client_id, client_secret, access_token });
60
- const path = "/oauth/revoke_authorization";
61
- const data = { client_secret, access_token, client_id };
62
- return client.post(path, data);
63
- }
64
- }
65
- exports.OAuth = OAuth;
@@ -1,140 +0,0 @@
1
- import { AxiosInstance } from "axios";
2
- import { Webhook, Collection, WebhookFilter } from ".";
3
- import { WebflowRecord } from "../core";
4
- /**************************************************************
5
- * Interfaces
6
- *************************************************************/
7
- export interface IDomain {
8
- _id: string;
9
- name: string;
10
- }
11
- export interface ISite {
12
- lastPublished: string;
13
- previewUrl: string;
14
- createdOn: string;
15
- shortName: string;
16
- timezone: string;
17
- database: string;
18
- name: string;
19
- _id: string;
20
- }
21
- export interface IPublishSite {
22
- queued: boolean;
23
- }
24
- /**************************************************************
25
- * Class
26
- **************************************************************/
27
- export declare class Site extends WebflowRecord<ISite> implements ISite {
28
- lastPublished: string;
29
- previewUrl: string;
30
- createdOn: string;
31
- shortName: string;
32
- timezone: string;
33
- database: string;
34
- name: string;
35
- _id: string;
36
- /**
37
- * Get a list of Sites
38
- * @param client The Axios client instance
39
- * @returns a list of Sites
40
- */
41
- static list(client: AxiosInstance): Promise<import("axios").AxiosResponse<ISite[], any>>;
42
- /**
43
- * Get a single Site
44
- * @param params The params for the request
45
- * @param params.siteId The site ID
46
- * @param params.params The query string parameters (optional)
47
- * @param client The Axios client instance
48
- * @returns A single Site
49
- */
50
- static getOne({ siteId }: {
51
- siteId: string;
52
- }, client: AxiosInstance): Promise<import("axios").AxiosResponse<ISite, any>>;
53
- /**
54
- * Publish a site
55
- * @param params The params for the request
56
- * @param params.siteId The site ID
57
- * @param params.domains The domains to publish to
58
- * @param client The Axios client instance
59
- * @returns The publish result
60
- */
61
- static publish({ siteId, domains }: {
62
- siteId: string;
63
- domains: string[];
64
- }, client: AxiosInstance): Promise<import("axios").AxiosResponse<IPublishSite, any>>;
65
- /**
66
- * Get a list of domains for a site
67
- * @param params The params for the request
68
- * @param params.siteId The site ID
69
- * @param client The Axios client instance
70
- * @returns A list of domains
71
- */
72
- static domains({ siteId }: {
73
- siteId: string;
74
- }, client: AxiosInstance): Promise<import("axios").AxiosResponse<IDomain[], any>>;
75
- /**************************************************************
76
- * Instance Methods
77
- **************************************************************/
78
- /**
79
- * Get a list of domains for a site
80
- * @returns A list of domains
81
- */
82
- domains(): Promise<IDomain[]>;
83
- /**
84
- * Publish a site
85
- * @param domains The domains to publish to
86
- * @returns The publish result
87
- */
88
- publishSite(domains: string[]): Promise<IPublishSite>;
89
- /**
90
- * Get a single Collection
91
- * @param params The params for the request
92
- * @param params.collectionId The collection ID
93
- * @returns A single Collection
94
- */
95
- collection({ collectionId }: {
96
- collectionId: string;
97
- }): Promise<Collection>;
98
- /**
99
- * Get a list of Collections
100
- * @returns A list of Collections
101
- */
102
- collections(): Promise<Collection[]>;
103
- /**
104
- * Get a single Webhook
105
- * @param params The params for the request
106
- * @param params.webhookId The webhook ID
107
- * @returns A single Webhook
108
- */
109
- webhook({ webhookId }: {
110
- webhookId: string;
111
- }): Promise<Webhook>;
112
- /**
113
- * Get a list of Webhooks
114
- * @returns A list of Webhooks
115
- */
116
- webhooks(): Promise<Webhook[]>;
117
- /**
118
- * Remove a Webhook
119
- * @param params The query string parameters (optional)
120
- * @param params.webhookId The Webhook ID
121
- * @returns The result of the removal
122
- */
123
- removeWebhook({ webhookId }: {
124
- webhookId: string;
125
- }): Promise<import("./webhook").IRemoveResult>;
126
- /**
127
- * Create a new Webhook
128
- * @param params The params for the request
129
- * @param params.url The URL to send the webhook to
130
- * @param params.triggerType The event to trigger the webhook
131
- * @param params.filter The filter to apply to the webhook (optional: form_submission only)
132
- * @returns The created webhook
133
- */
134
- createWebhook({ triggerType, filter, url, }: {
135
- url: string;
136
- siteId: string;
137
- triggerType: string;
138
- filter?: WebhookFilter;
139
- }): Promise<Webhook>;
140
- }