webflow-api 1.1.2 → 1.2.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 (70) hide show
  1. package/dist/api/collection.d.ts +85 -24
  2. package/dist/api/collection.js +88 -29
  3. package/dist/api/index.d.ts +7 -7
  4. package/dist/api/index.js +9 -19
  5. package/dist/api/item.d.ts +141 -107
  6. package/dist/api/item.js +145 -125
  7. package/dist/api/meta.d.ts +16 -14
  8. package/dist/api/meta.js +20 -19
  9. package/dist/api/oauth.d.ts +38 -36
  10. package/dist/api/oauth.js +59 -59
  11. package/dist/api/site.d.ts +118 -43
  12. package/dist/api/site.js +131 -53
  13. package/dist/{wrapper/membership.d.ts → api/user.d.ts} +59 -47
  14. package/dist/api/user.js +103 -0
  15. package/dist/api/webhook.d.ts +77 -55
  16. package/dist/api/webhook.js +74 -61
  17. package/dist/core/error.d.ts +2 -0
  18. package/dist/core/error.js +8 -1
  19. package/dist/core/index.d.ts +2 -2
  20. package/dist/core/index.js +2 -2
  21. package/dist/core/response.d.ts +32 -0
  22. package/dist/core/response.js +26 -0
  23. package/dist/{webflow.d.ts → core/webflow.d.ts} +56 -59
  24. package/dist/{webflow.js → core/webflow.js} +101 -68
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +2 -2
  27. package/package.json +2 -4
  28. package/src/api/collection.ts +102 -35
  29. package/src/api/index.ts +7 -7
  30. package/src/api/item.ts +207 -176
  31. package/src/api/meta.ts +19 -18
  32. package/src/api/oauth.ts +62 -74
  33. package/src/api/site.ts +158 -55
  34. package/src/api/user.ts +152 -0
  35. package/src/api/webhook.ts +97 -80
  36. package/src/core/error.ts +8 -0
  37. package/src/core/index.ts +2 -2
  38. package/src/core/response.ts +50 -0
  39. package/src/{webflow.ts → core/webflow.ts} +131 -145
  40. package/src/index.ts +1 -1
  41. package/yarn.lock +0 -5
  42. package/dist/api/membership.d.ts +0 -114
  43. package/dist/api/membership.js +0 -96
  44. package/dist/core/client.d.ts +0 -27
  45. package/dist/core/client.js +0 -60
  46. package/dist/core/options.d.ts +0 -8
  47. package/dist/core/options.js +0 -5
  48. package/dist/wrapper/collection.d.ts +0 -85
  49. package/dist/wrapper/collection.js +0 -94
  50. package/dist/wrapper/index.d.ts +0 -6
  51. package/dist/wrapper/index.js +0 -22
  52. package/dist/wrapper/item.d.ts +0 -140
  53. package/dist/wrapper/item.js +0 -153
  54. package/dist/wrapper/membership.js +0 -123
  55. package/dist/wrapper/response.d.ts +0 -16
  56. package/dist/wrapper/response.js +0 -17
  57. package/dist/wrapper/site.d.ts +0 -168
  58. package/dist/wrapper/site.js +0 -191
  59. package/dist/wrapper/webhook.d.ts +0 -78
  60. package/dist/wrapper/webhook.js +0 -82
  61. package/src/api/membership.ts +0 -155
  62. package/src/core/client.ts +0 -82
  63. package/src/core/options.ts +0 -9
  64. package/src/wrapper/collection.ts +0 -115
  65. package/src/wrapper/index.ts +0 -6
  66. package/src/wrapper/item.ts +0 -218
  67. package/src/wrapper/membership.ts +0 -163
  68. package/src/wrapper/response.ts +0 -25
  69. package/src/wrapper/site.ts +0 -228
  70. package/src/wrapper/webhook.ts +0 -116
@@ -1,153 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ItemWrapper = void 0;
4
- const _1 = require(".");
5
- const api_1 = require("../api");
6
- class ItemWrapper {
7
- constructor(client, item) {
8
- this.client = client;
9
- Object.assign(this, item);
10
- }
11
- /**************************************************************
12
- * Static Methods
13
- **************************************************************/
14
- /**
15
- * Create a new Item
16
- * @param client The Webflow client
17
- * @param params The params for the request
18
- * @param params.collectionId The Collection ID
19
- * @param params.fields The Item fields to create
20
- * @returns The created Item
21
- */
22
- static async create(client, { collectionId, fields }) {
23
- const res = await api_1.Item.create(client, { collectionId, fields });
24
- const item = new ItemWrapper(client, res.data);
25
- return (0, _1.ResponseWrapper)(res, item);
26
- }
27
- /**
28
- * Get a single Item
29
- * @param client The Webflow client
30
- * @param params The params for the request
31
- * @param params.collectionId The Collection ID
32
- * @param params.itemId The Item ID
33
- * @returns A single Item
34
- */
35
- static async getOne(client, itemParams) {
36
- const res = await api_1.Item.getOne(client, itemParams);
37
- const item = new ItemWrapper(client, res.data.items[0]);
38
- return (0, _1.ResponseWrapper)(res, item);
39
- }
40
- /**
41
- * Get a list of Items
42
- * @param client The Webflow client
43
- * @param params The params for the request
44
- * @param params.collectionId The Collection ID
45
- * @param params.limit The number of items to return (optional)
46
- * @param params.offset The number of items to skip (optional)
47
- * @returns A list of Items
48
- */
49
- static async list(client, { collectionId, limit, offset }) {
50
- const res = await api_1.Item.list(client, { collectionId, limit, offset });
51
- const items = res.data.items.map((i) => new ItemWrapper(client, i));
52
- return (0, _1.ResponseWrapper)(res, items);
53
- }
54
- /**
55
- * Remove a single Item
56
- * @param client The Webflow client
57
- * @param params The params for the request
58
- * @param params.collectionId The Collection ID
59
- * @param params.itemId The Item ID
60
- * @returns The result from the removal
61
- */
62
- static async remove(client, { collectionId, itemId }) {
63
- const res = await api_1.Item.remove(client, { collectionId, itemId });
64
- return (0, _1.ResponseWrapper)(res);
65
- }
66
- /**
67
- * Publishes a list of Items
68
- * @param client The Webflow client
69
- * @param params The request parameters
70
- * @param params.collectionId The Collection ID
71
- * @param params.itemIds The list of Item IDs to publish
72
- * @param params.live Publish to live site
73
- * @returns The result of the publish
74
- */
75
- static async publish(client, { collectionId, itemIds, live, }) {
76
- const res = await api_1.Item.publish(client, { collectionId, itemIds, live });
77
- return (0, _1.ResponseWrapper)(res);
78
- }
79
- /**
80
- * Unpublishes a list of Items
81
- * @param client The Webflow client
82
- * @param params The params for the request
83
- * @param params.collectionId The Collection ID
84
- * @param params.live Unpublish from the live site
85
- * @returns The result of the unpublish
86
- */
87
- static async unpublish(client, { collectionId, itemIds, live, }) {
88
- const res = await api_1.Item.unpublish(client, { collectionId, itemIds, live });
89
- return (0, _1.ResponseWrapper)(res);
90
- }
91
- /**
92
- * Update a single Item
93
- * @param client The Webflow client
94
- * @param params The params for the request
95
- * @param params.collectionId The Collection ID
96
- * @param params.itemId The Item ID
97
- * @param params.fields The fields to update
98
- * @returns The updated Item
99
- */
100
- static async update(client, { collectionId, itemId, fields, }) {
101
- const res = await api_1.Item.update(client, {
102
- collectionId,
103
- fields,
104
- itemId,
105
- });
106
- const item = new ItemWrapper(client, res.data);
107
- return (0, _1.ResponseWrapper)(res, item);
108
- }
109
- /**
110
- * Patch a single Item
111
- * @param client The Webflow client
112
- * @param params The params for the request
113
- * @param params.collectionId The Collection ID
114
- * @param params.itemId The Item ID
115
- * @param params.fields The fields to patch
116
- * @returns The patched Item
117
- */
118
- static async patch(client, { collectionId, itemId, fields, }, params) {
119
- const res = await api_1.Item.patch(client, {
120
- collectionId,
121
- fields,
122
- itemId,
123
- });
124
- const item = new ItemWrapper(client, res.data);
125
- return (0, _1.ResponseWrapper)(res, item);
126
- }
127
- /**************************************************************
128
- * Instance Methods
129
- **************************************************************/
130
- /**
131
- * Update a single Item
132
- * @param fields The fields to update
133
- * @returns The updated Item
134
- */
135
- update({ ...fields }) {
136
- return ItemWrapper.update(this.client, {
137
- collectionId: this._cid,
138
- itemId: this._id,
139
- fields,
140
- });
141
- }
142
- /**
143
- * Remove a single Item
144
- * @returns The result from the removal
145
- */
146
- remove() {
147
- return ItemWrapper.remove(this.client, {
148
- collectionId: this._cid,
149
- itemId: this._id,
150
- });
151
- }
152
- }
153
- exports.ItemWrapper = ItemWrapper;
@@ -1,123 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MembershipWrapper = void 0;
4
- const _1 = require(".");
5
- const api_1 = require("../api");
6
- class MembershipWrapper {
7
- constructor(client, siteId, membership) {
8
- this.client = client;
9
- this.siteId = siteId;
10
- Object.assign(this, membership);
11
- }
12
- /**************************************************************
13
- * Static Methods
14
- **************************************************************/
15
- /**
16
- * Get a single User
17
- * @param client The Webflow client
18
- * @param params The params for the request
19
- * @param params.siteId The site ID
20
- * @param params.userId The user ID
21
- * @returns A single User
22
- */
23
- static async getOne(client, { userId, siteId }) {
24
- const res = await api_1.Membership.getOne(client, { userId, siteId });
25
- const user = (0, _1.ResponseWrapper)(res);
26
- return new MembershipWrapper(client, siteId, user);
27
- }
28
- /**
29
- * Get a list of Users
30
- * @param client The Webflow client
31
- * @param params The params for the request
32
- * @param params.siteId The site ID
33
- * @param params.limit The number of items to return (optional)
34
- * @param params.offset The number of items to skip (optional)
35
- * @returns A list of Users
36
- */
37
- static async list(client, { siteId, limit, offset }) {
38
- const res = await api_1.Membership.list(client, { siteId, limit, offset });
39
- const users = res.data.users.map((u) => new MembershipWrapper(client, siteId, u));
40
- return (0, _1.ResponseWrapper)(res, users);
41
- }
42
- /**
43
- * Update a User
44
- * @param client The Webflow client
45
- * @param params The params for the request
46
- * @param params.siteId The site ID
47
- * @param params.userId The user ID
48
- * @param params.data The data to update
49
- * @returns The updated User
50
- */
51
- static async update(client, { userId, siteId, data }) {
52
- const res = await api_1.Membership.update(client, { userId, siteId, ...data });
53
- const user = (0, _1.ResponseWrapper)(res);
54
- return new MembershipWrapper(client, siteId, user);
55
- }
56
- /**
57
- * Invite a User to a site
58
- * @param client The Webflow client
59
- * @param params The params for the request
60
- * @param params.siteId The site ID
61
- * @param params.email The email address of the user to invite
62
- * @returns The newly created User
63
- */
64
- static async invite(client, { siteId, email }) {
65
- const res = await api_1.Membership.invite(client, { siteId, email });
66
- return (0, _1.ResponseWrapper)(res);
67
- }
68
- /**
69
- * Get a list of Access Groups
70
- * @param client The Webflow client
71
- * @param params The params for the request
72
- * @param params.siteId The Site ID
73
- * @param params.limit The number of items to return (optional)
74
- * @param params.offset The number of items to skip (optional)
75
- * @returns A list of Access Groups
76
- */
77
- static async accessGroups(client, { siteId, limit, offset, }) {
78
- const res = await api_1.Membership.accessGroups(client, {
79
- siteId,
80
- limit,
81
- offset,
82
- });
83
- return (0, _1.ResponseWrapper)(res);
84
- }
85
- /**
86
- * Remove a User
87
- * @param client The Webflow client
88
- * @param params The params for the request
89
- * @param params.siteId The site ID
90
- * @param params.userId The user ID
91
- * @returns The result of the remove
92
- */
93
- static async remove(client, { siteId, userId }) {
94
- const res = await api_1.Membership.remove(client, { userId, siteId });
95
- return (0, _1.ResponseWrapper)(res);
96
- }
97
- /**************************************************************
98
- * Instance Methods
99
- **************************************************************/
100
- /**
101
- * Update a User
102
- * @param data The data to update
103
- * @returns The updated User
104
- */
105
- async update(data) {
106
- return MembershipWrapper.update(this.client, {
107
- siteId: this.siteId,
108
- userId: this._id,
109
- data,
110
- });
111
- }
112
- /**
113
- * Remove a User
114
- * @returns The result of the remove
115
- */
116
- async remove() {
117
- return MembershipWrapper.remove(this.client, {
118
- siteId: this.siteId,
119
- userId: this._id,
120
- });
121
- }
122
- }
123
- exports.MembershipWrapper = MembershipWrapper;
@@ -1,16 +0,0 @@
1
- import { AxiosResponse } from "axios";
2
- export declare type MetaResponse<T> = T & {
3
- _meta: {
4
- rateLimit: {
5
- limit: number;
6
- remaining: number;
7
- };
8
- };
9
- };
10
- /**
11
- * Wraps an HTTP response with Webflow Rate Limiting information
12
- * @param response The HTTP response
13
- * @param data The data to use (defaults to response.data)
14
- * @returns The response with Webflow Rate Limiting information
15
- */
16
- export declare function ResponseWrapper<T>(response: AxiosResponse, data?: T): MetaResponse<T>;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ResponseWrapper = void 0;
4
- /**
5
- * Wraps an HTTP response with Webflow Rate Limiting information
6
- * @param response The HTTP response
7
- * @param data The data to use (defaults to response.data)
8
- * @returns The response with Webflow Rate Limiting information
9
- */
10
- function ResponseWrapper(response, data) {
11
- const limit = parseInt(response.headers["x-ratelimit-limit"], 10);
12
- const remaining = parseInt(response.headers["x-ratelimit-remaining"], 10);
13
- const result = data || response.data;
14
- result._meta = { rateLimit: { limit, remaining } };
15
- return result;
16
- }
17
- exports.ResponseWrapper = ResponseWrapper;
@@ -1,168 +0,0 @@
1
- import { CreateWebhookParams, CollectionWrapper, WebhookWrapper, MembershipWrapper } from ".";
2
- import { Client, QueryString } from "../core";
3
- import { Site } from "../api";
4
- export declare class SiteWrapper implements Site.ISite {
5
- private client;
6
- lastPublished: string;
7
- previewUrl: string;
8
- createdOn: string;
9
- shortName: string;
10
- timezone: string;
11
- database: string;
12
- name: string;
13
- _id: string;
14
- constructor(client: Client, site: Site.ISite);
15
- /**************************************************************
16
- * Static Methods
17
- **************************************************************/
18
- /**
19
- * Get a single Site
20
- * @param client The Webflow client
21
- * @param params The Site information
22
- * @param params.siteId The Site ID
23
- * @returns The Site
24
- */
25
- static getOne(client: Client, { siteId }: {
26
- siteId: string;
27
- }): Promise<import("./response").MetaResponse<SiteWrapper>>;
28
- /**
29
- * Get a list of Sites available
30
- * @param client The Webflow client
31
- * @param params The query parameters (optional)
32
- * @returns A list of Sites
33
- */
34
- static list(client: Client, params?: QueryString): Promise<import("./response").MetaResponse<SiteWrapper[]>>;
35
- /**
36
- * Get a list of Domains for a Site
37
- * @param client The Webflow client
38
- * @param params The Site information
39
- * @param params.siteId The Site ID
40
- * @returns A list of Domains
41
- */
42
- static domains(client: Client, { siteId }: {
43
- siteId: string;
44
- }): Promise<import("./response").MetaResponse<Site.IDomain[]>>;
45
- /**
46
- * Publish a Site
47
- * @param client The Webflow client
48
- * @param params The Site information
49
- * @param params.siteId The Site ID
50
- * @param params.domain The domains to publish
51
- * @returns The result of the publish
52
- */
53
- static publish(client: Client, { siteId, domains }: {
54
- siteId: string;
55
- domains: string[];
56
- }): Promise<import("./response").MetaResponse<Site.IPublishSite>>;
57
- /**************************************************************
58
- * Instance Methods
59
- **************************************************************/
60
- /**
61
- * Get a list of domains for a site
62
- * @returns A list of domains
63
- */
64
- domains(): Promise<import("./response").MetaResponse<Site.IDomain[]>>;
65
- /**
66
- * Publish a site
67
- * @param domains The domains to publish to
68
- * @returns The publish result
69
- */
70
- publishSite(domains: string[]): Promise<import("./response").MetaResponse<Site.IPublishSite>>;
71
- /**
72
- * Get a single Collection
73
- * @param params The params for the request
74
- * @param params.collectionId The collection ID
75
- * @returns A single Collection
76
- */
77
- collection({ collectionId }: {
78
- collectionId: string;
79
- }): Promise<import("./response").MetaResponse<CollectionWrapper>>;
80
- /**
81
- * Get a list of Collections
82
- * @returns A list of Collections
83
- */
84
- collections(): Promise<import("./response").MetaResponse<CollectionWrapper[]>>;
85
- /**
86
- * Get a single Webhook
87
- * @param params The params for the request
88
- * @param params.webhookId The webhook ID
89
- * @returns A single Webhook
90
- */
91
- webhook({ webhookId }: {
92
- webhookId: string;
93
- }): Promise<import("./response").MetaResponse<WebhookWrapper>>;
94
- /**
95
- * Get a list of Webhooks
96
- * @param params The query string parameters (optional)
97
- * @returns A list of Webhooks
98
- */
99
- webhooks(params?: QueryString): Promise<import("./response").MetaResponse<WebhookWrapper[]>>;
100
- /**
101
- * Remove a Webhook
102
- * @param params The query string parameters (optional)
103
- * @param params.webhookId The Webhook ID
104
- * @returns The result of the removal
105
- */
106
- removeWebhook({ webhookId }: {
107
- webhookId: string;
108
- }): Promise<import("./response").MetaResponse<import("../api/webhook").IRemoveResult>>;
109
- /**
110
- * Create a new Webhook
111
- * @param params1 The params for the request
112
- * @param params1.url The URL to send the webhook to
113
- * @param params1.triggerType The event to trigger the webhook
114
- * @param params1.filter The filter to apply to the webhook (optional: form_submission only)
115
- * @param params The query string parameters (optional)
116
- * @returns The created webhook
117
- */
118
- createWebhook({ triggerType, filter, url }: CreateWebhookParams): Promise<import("./response").MetaResponse<WebhookWrapper>>;
119
- /**
120
- * Get a list of Users
121
- * @param params The params for the request
122
- * @param params.limit The number of items to return (optional)
123
- * @param params.offset The number of items to skip (optional)
124
- * @returns A list of Users
125
- */
126
- users({ limit, offset }?: {
127
- limit?: number;
128
- offset?: number;
129
- }): Promise<import("./response").MetaResponse<MembershipWrapper[]>>;
130
- /**
131
- * Get a single User
132
- * @param params The params for the request
133
- * @param params.userId The user ID
134
- * @returns A single User
135
- */
136
- user({ userId }: {
137
- userId: string;
138
- }): Promise<MembershipWrapper>;
139
- /**
140
- * Invite a User to a site
141
- * @param params The params for the request
142
- * @param params.email The email address of the user to invite
143
- * @returns The newly created User
144
- */
145
- inviteUser({ email }: {
146
- email: string;
147
- }): Promise<import("./response").MetaResponse<import("../api/membership").IUser>>;
148
- /**
149
- * Get a list of Access Groups
150
- * @param params The params for the request
151
- * @param params.limit The number of items to return (optional)
152
- * @param params.offset The number of items to skip (optional)
153
- * @returns A list of Access Groups
154
- */
155
- accessGroups({ limit, offset, }?: {
156
- limit?: number;
157
- offset?: number;
158
- }): Promise<import("./response").MetaResponse<import("../api/membership").PaginatedAccessGroups>>;
159
- /**
160
- * Remove a User
161
- * @param params The params for the request
162
- * @param params.userId The user ID
163
- * @returns The result of the remove
164
- */
165
- removeUser({ userId }: {
166
- userId: string;
167
- }): Promise<import("./response").MetaResponse<import("../api/membership").IUserDelete>>;
168
- }
@@ -1,191 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SiteWrapper = void 0;
4
- const _1 = require(".");
5
- const api_1 = require("../api");
6
- class SiteWrapper {
7
- constructor(client, site) {
8
- this.client = client;
9
- Object.assign(this, site);
10
- }
11
- /**************************************************************
12
- * Static Methods
13
- **************************************************************/
14
- /**
15
- * Get a single Site
16
- * @param client The Webflow client
17
- * @param params The Site information
18
- * @param params.siteId The Site ID
19
- * @returns The Site
20
- */
21
- static async getOne(client, { siteId }) {
22
- const res = await api_1.Site.getOne(client, { siteId });
23
- const site = new SiteWrapper(client, res.data);
24
- return (0, _1.ResponseWrapper)(res, site);
25
- }
26
- /**
27
- * Get a list of Sites available
28
- * @param client The Webflow client
29
- * @param params The query parameters (optional)
30
- * @returns A list of Sites
31
- */
32
- static async list(client, params) {
33
- const res = await api_1.Site.list(client, params);
34
- const sites = res.data.map((s) => new SiteWrapper(client, s));
35
- return (0, _1.ResponseWrapper)(res, sites);
36
- }
37
- /**
38
- * Get a list of Domains for a Site
39
- * @param client The Webflow client
40
- * @param params The Site information
41
- * @param params.siteId The Site ID
42
- * @returns A list of Domains
43
- */
44
- static async domains(client, { siteId }) {
45
- const res = await api_1.Site.domains(client, { siteId });
46
- return (0, _1.ResponseWrapper)(res, res.data);
47
- }
48
- /**
49
- * Publish a Site
50
- * @param client The Webflow client
51
- * @param params The Site information
52
- * @param params.siteId The Site ID
53
- * @param params.domain The domains to publish
54
- * @returns The result of the publish
55
- */
56
- static async publish(client, { siteId, domains }) {
57
- const res = await api_1.Site.publish(client, { siteId, domains });
58
- return (0, _1.ResponseWrapper)(res);
59
- }
60
- /**************************************************************
61
- * Instance Methods
62
- **************************************************************/
63
- /**
64
- * Get a list of domains for a site
65
- * @returns A list of domains
66
- */
67
- async domains() {
68
- const res = await api_1.Site.domains(this.client, { siteId: this._id });
69
- return (0, _1.ResponseWrapper)(res);
70
- }
71
- /**
72
- * Publish a site
73
- * @param domains The domains to publish to
74
- * @returns The publish result
75
- */
76
- async publishSite(domains) {
77
- const res = await api_1.Site.publish(this.client, { siteId: this._id, domains });
78
- return (0, _1.ResponseWrapper)(res);
79
- }
80
- /**
81
- * Get a single Collection
82
- * @param params The params for the request
83
- * @param params.collectionId The collection ID
84
- * @returns A single Collection
85
- */
86
- async collection({ collectionId }) {
87
- return _1.CollectionWrapper.getOne(this.client, { collectionId });
88
- }
89
- /**
90
- * Get a list of Collections
91
- * @returns A list of Collections
92
- */
93
- async collections() {
94
- return _1.CollectionWrapper.list(this.client, { siteId: this._id });
95
- }
96
- /**
97
- * Get a single Webhook
98
- * @param params The params for the request
99
- * @param params.webhookId The webhook ID
100
- * @returns A single Webhook
101
- */
102
- async webhook({ webhookId }) {
103
- return _1.WebhookWrapper.getOne(this.client, { siteId: this._id, webhookId });
104
- }
105
- /**
106
- * Get a list of Webhooks
107
- * @param params The query string parameters (optional)
108
- * @returns A list of Webhooks
109
- */
110
- async webhooks(params) {
111
- return _1.WebhookWrapper.list(this.client, { siteId: this._id }, params);
112
- }
113
- /**
114
- * Remove a Webhook
115
- * @param params The query string parameters (optional)
116
- * @param params.webhookId The Webhook ID
117
- * @returns The result of the removal
118
- */
119
- async removeWebhook({ webhookId }) {
120
- return _1.WebhookWrapper.remove(this.client, { siteId: this._id, webhookId });
121
- }
122
- /**
123
- * Create a new Webhook
124
- * @param params1 The params for the request
125
- * @param params1.url The URL to send the webhook to
126
- * @param params1.triggerType The event to trigger the webhook
127
- * @param params1.filter The filter to apply to the webhook (optional: form_submission only)
128
- * @param params The query string parameters (optional)
129
- * @returns The created webhook
130
- */
131
- async createWebhook({ triggerType, filter, url }) {
132
- const _params = { url, siteId: this._id, triggerType, filter };
133
- return _1.WebhookWrapper.create(this.client, _params);
134
- }
135
- /**
136
- * Get a list of Users
137
- * @param params The params for the request
138
- * @param params.limit The number of items to return (optional)
139
- * @param params.offset The number of items to skip (optional)
140
- * @returns A list of Users
141
- */
142
- async users({ limit, offset } = {}) {
143
- return _1.MembershipWrapper.list(this.client, {
144
- siteId: this._id,
145
- limit,
146
- offset,
147
- });
148
- }
149
- /**
150
- * Get a single User
151
- * @param params The params for the request
152
- * @param params.userId The user ID
153
- * @returns A single User
154
- */
155
- async user({ userId }) {
156
- return _1.MembershipWrapper.getOne(this.client, { siteId: this._id, userId });
157
- }
158
- /**
159
- * Invite a User to a site
160
- * @param params The params for the request
161
- * @param params.email The email address of the user to invite
162
- * @returns The newly created User
163
- */
164
- async inviteUser({ email }) {
165
- return _1.MembershipWrapper.invite(this.client, { siteId: this._id, email });
166
- }
167
- /**
168
- * Get a list of Access Groups
169
- * @param params The params for the request
170
- * @param params.limit The number of items to return (optional)
171
- * @param params.offset The number of items to skip (optional)
172
- * @returns A list of Access Groups
173
- */
174
- async accessGroups({ limit, offset, } = {}) {
175
- return _1.MembershipWrapper.accessGroups(this.client, {
176
- siteId: this._id,
177
- limit,
178
- offset,
179
- });
180
- }
181
- /**
182
- * Remove a User
183
- * @param params The params for the request
184
- * @param params.userId The user ID
185
- * @returns The result of the remove
186
- */
187
- async removeUser({ userId }) {
188
- return _1.MembershipWrapper.remove(this.client, { siteId: this._id, userId });
189
- }
190
- }
191
- exports.SiteWrapper = SiteWrapper;