webflow-api 1.0.3 → 1.1.1

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 (74) hide show
  1. package/README.md +4 -5
  2. package/dist/api/collection.d.ts +51 -0
  3. package/dist/api/collection.js +35 -0
  4. package/dist/api/index.d.ts +7 -0
  5. package/dist/api/index.js +33 -0
  6. package/dist/api/item.d.ts +143 -0
  7. package/dist/api/item.js +131 -0
  8. package/dist/api/membership.d.ts +91 -0
  9. package/dist/api/membership.js +80 -0
  10. package/dist/api/meta.d.ts +51 -0
  11. package/dist/api/meta.js +24 -0
  12. package/dist/api/oauth.d.ts +67 -0
  13. package/dist/api/oauth.js +65 -0
  14. package/dist/api/site.d.ts +65 -0
  15. package/dist/api/site.js +59 -0
  16. package/dist/api/webhook.d.ts +80 -0
  17. package/dist/api/webhook.js +67 -0
  18. package/dist/core/client.d.ts +40 -0
  19. package/dist/core/client.js +49 -0
  20. package/dist/core/error.d.ts +19 -0
  21. package/dist/core/error.js +23 -0
  22. package/dist/core/index.d.ts +3 -0
  23. package/dist/core/index.js +19 -0
  24. package/dist/core/options.d.ts +8 -0
  25. package/dist/core/options.js +5 -0
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.js +2 -9
  28. package/dist/webflow.d.ts +366 -0
  29. package/dist/webflow.js +388 -0
  30. package/dist/wrapper/collection.d.ts +85 -0
  31. package/dist/wrapper/collection.js +94 -0
  32. package/dist/wrapper/index.d.ts +6 -0
  33. package/dist/wrapper/index.js +22 -0
  34. package/dist/wrapper/item.d.ts +140 -0
  35. package/dist/wrapper/item.js +153 -0
  36. package/dist/wrapper/membership.d.ts +91 -0
  37. package/dist/wrapper/membership.js +106 -0
  38. package/dist/wrapper/response.d.ts +16 -0
  39. package/dist/wrapper/response.js +17 -0
  40. package/dist/wrapper/site.d.ts +119 -0
  41. package/dist/wrapper/site.js +136 -0
  42. package/dist/wrapper/webhook.d.ts +78 -0
  43. package/dist/wrapper/webhook.js +82 -0
  44. package/package.json +16 -18
  45. package/src/api/collection.ts +87 -0
  46. package/src/api/index.ts +7 -0
  47. package/src/api/item.ts +231 -0
  48. package/src/api/membership.ts +125 -0
  49. package/src/api/meta.ts +61 -0
  50. package/src/api/oauth.ts +119 -0
  51. package/src/api/site.ts +86 -0
  52. package/src/api/webhook.ts +125 -0
  53. package/src/core/client.ts +76 -0
  54. package/src/core/error.ts +32 -0
  55. package/src/core/index.ts +3 -0
  56. package/src/core/options.ts +9 -0
  57. package/src/index.ts +3 -0
  58. package/src/webflow.ts +487 -0
  59. package/src/wrapper/collection.ts +115 -0
  60. package/src/wrapper/index.ts +6 -0
  61. package/src/wrapper/item.ts +218 -0
  62. package/src/wrapper/membership.ts +138 -0
  63. package/src/wrapper/response.ts +25 -0
  64. package/src/wrapper/site.ts +164 -0
  65. package/src/wrapper/webhook.ts +116 -0
  66. package/yarn.lock +392 -1515
  67. package/dist/ResponseWrapper.js +0 -135
  68. package/dist/Webflow.js +0 -344
  69. package/dist/WebflowClient.js +0 -115
  70. package/index.d.ts +0 -430
  71. package/src/ResponseWrapper.js +0 -103
  72. package/src/Webflow.js +0 -301
  73. package/src/WebflowClient.js +0 -98
  74. package/src/index.js +0 -3
package/README.md CHANGED
@@ -19,7 +19,6 @@ The constructor takes in a few optional parameters to initialize the API client
19
19
  * `token` - the access token to use
20
20
  * `headers` - additional headers to add to the request
21
21
  * `version` - the version of the API you wish to use
22
- * `mode` - the [sec-fetch-mode](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-Mode) to use
23
22
 
24
23
  ``` javascript
25
24
  const Webflow = require("webflow-api");
@@ -31,7 +30,6 @@ const webflow = new Webflow({ token: "[ACCESS TOKEN]" });
31
30
  const webflow = new Webflow({
32
31
  token: "[ACCESS TOKEN]",
33
32
  version: "1.0.0",
34
- mode: "cors",
35
33
  headers: {
36
34
  "User-Agent": "My Webflow App / 1.0"
37
35
  }
@@ -85,6 +83,9 @@ const webflow = new Webflow();
85
83
 
86
84
  // set token
87
85
  webflow.token = "[ACCESS TOKEN]";
86
+
87
+ // remove the token
88
+ webflow.clearToken();
88
89
  ```
89
90
  ### Calling APIs Directly
90
91
  All Webflow API endpoints can be called directly using the `get`, `post`, `put`, and `delete` methods.
@@ -146,9 +147,7 @@ const result = await webflow.revokeToken({
146
147
  });
147
148
 
148
149
  // ensure it went through
149
- if (result.didRevoke) {
150
- // should equal true
151
- }
150
+ result.didRevoke === true
152
151
  ```
153
152
 
154
153
  ## Examples
@@ -0,0 +1,51 @@
1
+ import { Client, QueryString } from "../core";
2
+ /**************************************************************
3
+ * Types
4
+ **************************************************************/
5
+ export declare type CollectionFieldType = "Bool" | "Color" | "Date" | "ExtFileRef" | "Set" | "ImageRef" | "Set" | "ItemRef" | "ItemRefSet" | "Link" | "Number" | "Option" | "PlainText" | "RichText" | "Video" | "User" | string;
6
+ export declare type CollectionField = {
7
+ id: string;
8
+ type: CollectionFieldType;
9
+ slug: string;
10
+ name: string;
11
+ required: boolean;
12
+ editable: boolean;
13
+ validations?: any;
14
+ };
15
+ /**************************************************************
16
+ * Interfaces
17
+ **************************************************************/
18
+ export interface ICollection {
19
+ _id: string;
20
+ lastUpdated: string;
21
+ createdOn: string;
22
+ name: string;
23
+ slug: string;
24
+ singularName: string;
25
+ fields: CollectionField[];
26
+ }
27
+ /**************************************************************
28
+ * Functions
29
+ **************************************************************/
30
+ /**
31
+ * Get a list of Collections
32
+ * @param client The Webflow client
33
+ * @param params1 The params for the request
34
+ * @param params1.siteId The site ID
35
+ * @param params The query string parameters (optional)
36
+ * @returns A list of Collections
37
+ */
38
+ export declare function list(client: Client, { siteId }: {
39
+ siteId: string;
40
+ }, params?: QueryString): Promise<import("axios").AxiosResponse<ICollection[], any>>;
41
+ /**
42
+ * Get a single Collection
43
+ * @param client The Webflow client
44
+ * @param params The params for the request
45
+ * @param params.collectionId The collection ID
46
+ * @param params.params The query string parameters (optional)
47
+ * @returns A single Collection
48
+ */
49
+ export declare function getOne(client: Client, { collectionId }: {
50
+ collectionId: string;
51
+ }, params?: QueryString): Promise<import("axios").AxiosResponse<ICollection, any>>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOne = exports.list = void 0;
4
+ const core_1 = require("../core");
5
+ /**************************************************************
6
+ * Functions
7
+ **************************************************************/
8
+ /**
9
+ * Get a list of Collections
10
+ * @param client The Webflow client
11
+ * @param params1 The params for the request
12
+ * @param params1.siteId The site ID
13
+ * @param params The query string parameters (optional)
14
+ * @returns A list of Collections
15
+ */
16
+ function list(client, { siteId }, params) {
17
+ (0, core_1.requireArgs)({ siteId });
18
+ const path = `/sites/${siteId}/collections`;
19
+ return client.get(path, { params });
20
+ }
21
+ exports.list = list;
22
+ /**
23
+ * Get a single Collection
24
+ * @param client The Webflow client
25
+ * @param params The params for the request
26
+ * @param params.collectionId The collection ID
27
+ * @param params.params The query string parameters (optional)
28
+ * @returns A single Collection
29
+ */
30
+ function getOne(client, { collectionId }, params) {
31
+ (0, core_1.requireArgs)({ collectionId });
32
+ const path = `/collections/${collectionId}`;
33
+ return client.get(path, { params });
34
+ }
35
+ exports.getOne = getOne;
@@ -0,0 +1,7 @@
1
+ export * as Membership from "./membership";
2
+ export * as Collection from "./collection";
3
+ export * as Webhook from "./webhook";
4
+ export * as OAuth from "./oauth";
5
+ export * as Item from "./item";
6
+ export * as Site from "./site";
7
+ export * as Meta from "./meta";
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.Meta = exports.Site = exports.Item = exports.OAuth = exports.Webhook = exports.Collection = exports.Membership = void 0;
27
+ exports.Membership = __importStar(require("./membership"));
28
+ exports.Collection = __importStar(require("./collection"));
29
+ exports.Webhook = __importStar(require("./webhook"));
30
+ exports.OAuth = __importStar(require("./oauth"));
31
+ exports.Item = __importStar(require("./item"));
32
+ exports.Site = __importStar(require("./site"));
33
+ exports.Meta = __importStar(require("./meta"));
@@ -0,0 +1,143 @@
1
+ import { Client, PaginatedData } from "../core";
2
+ /**************************************************************
3
+ * Interfaces
4
+ **************************************************************/
5
+ export interface IItem {
6
+ _archived: boolean;
7
+ _draft: boolean;
8
+ _id: string;
9
+ _cid: string;
10
+ name: string;
11
+ slug: string;
12
+ "updated-on": string;
13
+ "created-on": string;
14
+ "updated-by": string;
15
+ "created-by": string;
16
+ "published-on"?: string | null;
17
+ "published-by"?: string | null;
18
+ }
19
+ export interface IItemDelete {
20
+ deleted: number;
21
+ }
22
+ export interface IPublishItems {
23
+ publishedItemIds: string[];
24
+ errors: string[];
25
+ }
26
+ export interface IDeletedItems {
27
+ deletedItemIds: string[];
28
+ errors: string[];
29
+ }
30
+ /**************************************************************
31
+ * Types
32
+ **************************************************************/
33
+ export declare type PageinatedItems = PaginatedData & {
34
+ items: IItem[];
35
+ };
36
+ /**************************************************************
37
+ * Functions
38
+ **************************************************************/
39
+ /**
40
+ * Get a single Item
41
+ * @param client The Webflow client
42
+ * @param params The params for the request
43
+ * @param params.collectionId The Collection ID
44
+ * @param params.itemId The Item ID
45
+ * @returns A single Item
46
+ */
47
+ export declare function getOne(client: Client, { collectionId, itemId }: {
48
+ collectionId: string;
49
+ itemId: string;
50
+ }): Promise<import("axios").AxiosResponse<PageinatedItems, any>>;
51
+ /**
52
+ * Get a list of Items
53
+ * @param client The Webflow client
54
+ * @param params The params for the request
55
+ * @param params.collectionId The Collection ID
56
+ * @param params.limit The number of items to return (optional)
57
+ * @param params.offset The number of items to skip (optional)
58
+ * @returns A list of Items
59
+ */
60
+ export declare function list(client: Client, { collectionId, limit, offset, }: {
61
+ collectionId: string;
62
+ limit?: number;
63
+ offset?: number;
64
+ }): Promise<import("axios").AxiosResponse<PageinatedItems, any>>;
65
+ /**
66
+ * Create a new Item
67
+ * @param client The Webflow client
68
+ * @param params The params for the request
69
+ * @param params.collectionId The Collection ID
70
+ * @param params.fields The Item fields to create
71
+ * @returns The created Item
72
+ */
73
+ export declare function create(client: Client, { collectionId, fields }: {
74
+ fields: any;
75
+ collectionId: string;
76
+ }): Promise<import("axios").AxiosResponse<IItem, any>>;
77
+ /**
78
+ * Update a single Item
79
+ * @param client The Webflow client
80
+ * @param params The params for the request
81
+ * @param params.collectionId The Collection ID
82
+ * @param params.itemId The Item ID
83
+ * @param params.fields The fields to update
84
+ * @returns The updated Item
85
+ */
86
+ export declare function update(client: Client, { collectionId, itemId, fields, }: {
87
+ fields: any;
88
+ itemId: string;
89
+ collectionId: string;
90
+ }): Promise<import("axios").AxiosResponse<IItem, any>>;
91
+ /**
92
+ * Patch 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 patch
98
+ * @returns The patched Item
99
+ */
100
+ export declare function patch(client: Client, { collectionId, itemId, fields, }: {
101
+ fields: any;
102
+ itemId: string;
103
+ collectionId: string;
104
+ }): Promise<import("axios").AxiosResponse<IItem, any>>;
105
+ /**
106
+ * Remove a single Item
107
+ * @param client The Webflow client
108
+ * @param params The params for the request
109
+ * @param params.collectionId The Collection ID
110
+ * @param params.itemId The Item ID
111
+ * @returns The result from the removal
112
+ */
113
+ export declare function remove(client: Client, { collectionId, itemId, }: {
114
+ itemId: string;
115
+ collectionId: string;
116
+ }): Promise<import("axios").AxiosResponse<IItemDelete, any>>;
117
+ /**
118
+ * Unpublishes a list of Items
119
+ * @param client The Webflow client
120
+ * @param params The params for the request
121
+ * @param params.collectionId The Collection ID
122
+ * @param params.live Unpublish from the live site
123
+ * @returns The result of the unpublish
124
+ */
125
+ export declare function unpublish(client: Client, { collectionId, itemIds, live, }: {
126
+ live?: boolean;
127
+ itemIds: string[];
128
+ collectionId: string;
129
+ }): Promise<import("axios").AxiosResponse<IDeletedItems, any>>;
130
+ /**
131
+ * Publishes a list of Items
132
+ * @param client The Webflow client
133
+ * @param params The request parameters
134
+ * @param params.collectionId The Collection ID
135
+ * @param params.itemIds The list of Item IDs to publish
136
+ * @param params.live Publish to live site
137
+ * @returns The result of the publish
138
+ */
139
+ export declare function publish(client: Client, { itemIds, live, collectionId, }: {
140
+ live?: boolean;
141
+ itemIds: string[];
142
+ collectionId: string;
143
+ }): Promise<import("axios").AxiosResponse<IPublishItems, any>>;
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.publish = exports.unpublish = exports.remove = exports.patch = exports.update = exports.create = exports.list = exports.getOne = void 0;
4
+ const core_1 = require("../core");
5
+ /**************************************************************
6
+ * Functions
7
+ **************************************************************/
8
+ /**
9
+ * Get a single Item
10
+ * @param client The Webflow client
11
+ * @param params The params for the request
12
+ * @param params.collectionId The Collection ID
13
+ * @param params.itemId The Item ID
14
+ * @returns A single Item
15
+ */
16
+ function getOne(client, { collectionId, itemId }) {
17
+ (0, core_1.requireArgs)({ collectionId, itemId });
18
+ const path = `/collections/${collectionId}/items/${itemId}`;
19
+ // The API returns a paginated list with one record :(
20
+ return client.get(path);
21
+ }
22
+ exports.getOne = getOne;
23
+ /**
24
+ * Get a list of Items
25
+ * @param client The Webflow client
26
+ * @param params The params for the request
27
+ * @param params.collectionId The Collection ID
28
+ * @param params.limit The number of items to return (optional)
29
+ * @param params.offset The number of items to skip (optional)
30
+ * @returns A list of Items
31
+ */
32
+ function list(client, { collectionId, limit, offset, }) {
33
+ (0, core_1.requireArgs)({ collectionId });
34
+ const params = { limit, offset };
35
+ const path = `/collections/${collectionId}/items`;
36
+ return client.get(path, { params });
37
+ }
38
+ exports.list = list;
39
+ /**
40
+ * Create a new Item
41
+ * @param client The Webflow client
42
+ * @param params The params for the request
43
+ * @param params.collectionId The Collection ID
44
+ * @param params.fields The Item fields to create
45
+ * @returns The created Item
46
+ */
47
+ function create(client, { collectionId, fields }) {
48
+ (0, core_1.requireArgs)({ collectionId });
49
+ const path = `/collections/${collectionId}/items`;
50
+ return client.post(path, { fields });
51
+ }
52
+ exports.create = create;
53
+ /**
54
+ * Update a single Item
55
+ * @param client The Webflow client
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
+ * @returns The updated Item
61
+ */
62
+ function update(client, { collectionId, itemId, fields, }) {
63
+ (0, core_1.requireArgs)({ collectionId, itemId });
64
+ const path = `/collections/${collectionId}/items/${itemId}`;
65
+ return client.put(path, { fields });
66
+ }
67
+ exports.update = update;
68
+ /**
69
+ * Patch a single Item
70
+ * @param client The Webflow client
71
+ * @param params The params for the request
72
+ * @param params.collectionId The Collection ID
73
+ * @param params.itemId The Item ID
74
+ * @param params.fields The fields to patch
75
+ * @returns The patched Item
76
+ */
77
+ function patch(client, { collectionId, itemId, fields, }) {
78
+ (0, core_1.requireArgs)({ collectionId, itemId });
79
+ const path = `/collections/${collectionId}/items/${itemId}`;
80
+ return client.patch(path, { fields });
81
+ }
82
+ exports.patch = patch;
83
+ /**
84
+ * Remove a single Item
85
+ * @param client The Webflow client
86
+ * @param params The params for the request
87
+ * @param params.collectionId The Collection ID
88
+ * @param params.itemId The Item ID
89
+ * @returns The result from the removal
90
+ */
91
+ function remove(client, { collectionId, itemId, }) {
92
+ (0, core_1.requireArgs)({ collectionId, itemId });
93
+ const path = `/collections/${collectionId}/items/${itemId}`;
94
+ return client.delete(path);
95
+ }
96
+ exports.remove = remove;
97
+ /**
98
+ * Unpublishes a list of Items
99
+ * @param client The Webflow client
100
+ * @param params The params for the request
101
+ * @param params.collectionId The Collection ID
102
+ * @param params.live Unpublish from the live site
103
+ * @returns The result of the unpublish
104
+ */
105
+ function unpublish(client, { collectionId, itemIds, live = false, }) {
106
+ (0, core_1.requireArgs)({ collectionId, itemIds });
107
+ const params = { live };
108
+ const data = { itemIds };
109
+ const url = `/collections/${collectionId}/items`;
110
+ const _params = { method: "DELETE", url, data, params };
111
+ // DELETE spec doesn't support body in delete
112
+ // RFC-9110 https://tools.ietf.org/html/rfc9110
113
+ return client.request(_params);
114
+ }
115
+ exports.unpublish = unpublish;
116
+ /**
117
+ * Publishes a list of Items
118
+ * @param client The Webflow client
119
+ * @param params The request parameters
120
+ * @param params.collectionId The Collection ID
121
+ * @param params.itemIds The list of Item IDs to publish
122
+ * @param params.live Publish to live site
123
+ * @returns The result of the publish
124
+ */
125
+ function publish(client, { itemIds, live = false, collectionId, }) {
126
+ (0, core_1.requireArgs)({ collectionId, itemIds });
127
+ const params = { live };
128
+ const path = `/collections/${collectionId}/items/publish`;
129
+ return client.put(path, { itemIds }, { params });
130
+ }
131
+ exports.publish = publish;
@@ -0,0 +1,91 @@
1
+ import { Client, PaginatedData } from "../core";
2
+ /**************************************************************
3
+ * Interfaces
4
+ **************************************************************/
5
+ export interface IUser {
6
+ emailVerified: boolean;
7
+ lastUpdated?: string;
8
+ createdOn: string;
9
+ _id: string;
10
+ data: any;
11
+ }
12
+ export interface IUserDelete {
13
+ deleted: number;
14
+ }
15
+ /**************************************************************
16
+ * Types
17
+ **************************************************************/
18
+ export declare type PaginatedUsers = PaginatedData & {
19
+ users: IUser[];
20
+ };
21
+ export declare type UserIdParam = {
22
+ siteId: string;
23
+ userId: string;
24
+ };
25
+ /**************************************************************
26
+ * Functions
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
+ export declare function list(client: Client, { siteId, limit, offset }: {
38
+ siteId: string;
39
+ limit?: number;
40
+ offset?: number;
41
+ }): Promise<import("axios").AxiosResponse<PaginatedUsers, any>>;
42
+ /**
43
+ * Get a single 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
+ * @returns A single User
49
+ */
50
+ export declare function getOne(client: Client, { siteId, userId }: {
51
+ siteId: string;
52
+ userId: string;
53
+ }): Promise<import("axios").AxiosResponse<IUser, any>>;
54
+ /**
55
+ * Update a User
56
+ * @param client The Webflow client
57
+ * @param params The params for the request
58
+ * @param params.siteId The site ID
59
+ * @param params.userId The user ID
60
+ * @param params.data The data to update
61
+ * @returns The updated User
62
+ */
63
+ export declare function update(client: Client, { siteId, userId, data, }: {
64
+ data: object;
65
+ siteId: string;
66
+ userId: string;
67
+ }): Promise<import("axios").AxiosResponse<IUser, any>>;
68
+ /**
69
+ * Invite a User to a site
70
+ * @param client The Webflow client
71
+ * @param params The params for the request
72
+ * @param params.siteId The site ID
73
+ * @param params.email The email address of the user to invite
74
+ * @returns The newly created User
75
+ */
76
+ export declare function invite(client: Client, { siteId, email }: {
77
+ siteId: string;
78
+ email: string;
79
+ }): Promise<import("axios").AxiosResponse<IUser, any>>;
80
+ /**
81
+ * Remove a User
82
+ * @param client The Webflow client
83
+ * @param params The params for the request
84
+ * @param params.siteId The site ID
85
+ * @param params.userId The user ID
86
+ * @returns The result of the remove
87
+ */
88
+ export declare function remove(client: Client, { siteId, userId }: {
89
+ siteId: string;
90
+ userId: string;
91
+ }): Promise<import("axios").AxiosResponse<IUserDelete, any>>;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.remove = exports.invite = exports.update = exports.getOne = exports.list = void 0;
4
+ const core_1 = require("../core");
5
+ /**************************************************************
6
+ * Functions
7
+ **************************************************************/
8
+ /**
9
+ * Get a list of Users
10
+ * @param client The Webflow client
11
+ * @param params The params for the request
12
+ * @param params.siteId The site ID
13
+ * @param params.limit The number of items to return (optional)
14
+ * @param params.offset The number of items to skip (optional)
15
+ * @returns A list of Users
16
+ */
17
+ function list(client, { siteId, limit, offset }) {
18
+ (0, core_1.requireArgs)({ siteId });
19
+ const params = { limit, offset };
20
+ const path = `/sites/${siteId}/users`;
21
+ return client.get(path, { params });
22
+ }
23
+ exports.list = list;
24
+ /**
25
+ * Get a single User
26
+ * @param client The Webflow client
27
+ * @param params The params for the request
28
+ * @param params.siteId The site ID
29
+ * @param params.userId The user ID
30
+ * @returns A single User
31
+ */
32
+ function getOne(client, { siteId, userId }) {
33
+ (0, core_1.requireArgs)({ siteId, userId });
34
+ const path = `/sites/${siteId}/users/${userId}`;
35
+ return client.get(path);
36
+ }
37
+ exports.getOne = getOne;
38
+ /**
39
+ * Update a User
40
+ * @param client The Webflow client
41
+ * @param params The params for the request
42
+ * @param params.siteId The site ID
43
+ * @param params.userId The user ID
44
+ * @param params.data The data to update
45
+ * @returns The updated User
46
+ */
47
+ function update(client, { siteId, userId, data, }) {
48
+ (0, core_1.requireArgs)({ siteId, userId });
49
+ const path = `/sites/${siteId}/users/${userId}`;
50
+ return client.patch(path, data);
51
+ }
52
+ exports.update = update;
53
+ /**
54
+ * Invite a User to a site
55
+ * @param client The Webflow client
56
+ * @param params The params for the request
57
+ * @param params.siteId The site ID
58
+ * @param params.email The email address of the user to invite
59
+ * @returns The newly created User
60
+ */
61
+ async function invite(client, { siteId, email }) {
62
+ (0, core_1.requireArgs)({ siteId, email });
63
+ const path = `/sites/${siteId}/users/invite`;
64
+ return client.post(path, { email });
65
+ }
66
+ exports.invite = invite;
67
+ /**
68
+ * Remove a User
69
+ * @param client The Webflow client
70
+ * @param params The params for the request
71
+ * @param params.siteId The site ID
72
+ * @param params.userId The user ID
73
+ * @returns The result of the remove
74
+ */
75
+ function remove(client, { siteId, userId }) {
76
+ (0, core_1.requireArgs)({ siteId, userId });
77
+ const path = `/sites/${siteId}/users/${userId}`;
78
+ return client.delete(path);
79
+ }
80
+ exports.remove = remove;
@@ -0,0 +1,51 @@
1
+ import { Client } from "../core";
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
+ * Functions
39
+ **************************************************************/
40
+ /**
41
+ * Get the authentication info for the current token
42
+ * @param client The Webflow client
43
+ * @returns The authentication info
44
+ */
45
+ export declare function info(client: Client): Promise<import("axios").AxiosResponse<IAuthentiationInfo, any>>;
46
+ /**
47
+ * Get the authenticated user
48
+ * @param client The Webflow client
49
+ * @returns The authenticated user
50
+ */
51
+ export declare function user(client: Client): Promise<import("axios").AxiosResponse<IAuthenticatedUser, any>>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.user = exports.info = void 0;
4
+ /**************************************************************
5
+ * Functions
6
+ **************************************************************/
7
+ /**
8
+ * Get the authentication info for the current token
9
+ * @param client The Webflow client
10
+ * @returns The authentication info
11
+ */
12
+ function info(client) {
13
+ return client.get("/info");
14
+ }
15
+ exports.info = info;
16
+ /**
17
+ * Get the authenticated user
18
+ * @param client The Webflow client
19
+ * @returns The authenticated user
20
+ */
21
+ function user(client) {
22
+ return client.get("/user");
23
+ }
24
+ exports.user = user;