webflow-api 1.1.2 → 1.2.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.
- package/README.md +41 -17
- package/dist/api/collection.d.ts +86 -25
- package/dist/api/collection.js +88 -29
- package/dist/api/index.d.ts +7 -7
- package/dist/api/index.js +9 -19
- package/dist/api/item.d.ts +141 -107
- package/dist/api/item.js +145 -125
- package/dist/api/meta.d.ts +16 -14
- package/dist/api/meta.js +20 -19
- package/dist/api/oauth.d.ts +38 -36
- package/dist/api/oauth.js +59 -59
- package/dist/api/site.d.ts +118 -43
- package/dist/api/site.js +131 -53
- package/dist/api/user.d.ts +143 -0
- package/dist/api/user.js +119 -0
- package/dist/api/webhook.d.ts +77 -55
- package/dist/api/webhook.js +74 -61
- package/dist/core/error.d.ts +2 -0
- package/dist/core/error.js +8 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/core/response.d.ts +32 -0
- package/dist/core/response.js +26 -0
- package/dist/{webflow.d.ts → core/webflow.d.ts} +66 -54
- package/dist/{webflow.js → core/webflow.js} +114 -65
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +12 -8
- package/src/api/collection.ts +103 -36
- package/src/api/index.ts +7 -7
- package/src/api/item.ts +217 -176
- package/src/api/meta.ts +19 -18
- package/src/api/oauth.ts +71 -74
- package/src/api/site.ts +161 -55
- package/src/api/user.ts +192 -0
- package/src/api/webhook.ts +103 -80
- package/src/core/error.ts +8 -0
- package/src/core/index.ts +2 -2
- package/src/core/response.ts +50 -0
- package/src/{webflow.ts → core/webflow.ts} +153 -125
- package/src/index.ts +1 -1
- package/yarn.lock +4 -9
- package/dist/api/membership.d.ts +0 -114
- package/dist/api/membership.js +0 -96
- package/dist/core/client.d.ts +0 -27
- package/dist/core/client.js +0 -60
- package/dist/core/options.d.ts +0 -8
- package/dist/core/options.js +0 -5
- package/dist/wrapper/collection.d.ts +0 -85
- package/dist/wrapper/collection.js +0 -94
- package/dist/wrapper/index.d.ts +0 -6
- package/dist/wrapper/index.js +0 -22
- package/dist/wrapper/item.d.ts +0 -140
- package/dist/wrapper/item.js +0 -153
- package/dist/wrapper/membership.d.ts +0 -105
- package/dist/wrapper/membership.js +0 -123
- package/dist/wrapper/response.d.ts +0 -16
- package/dist/wrapper/response.js +0 -17
- package/dist/wrapper/site.d.ts +0 -168
- package/dist/wrapper/site.js +0 -191
- package/dist/wrapper/webhook.d.ts +0 -78
- package/dist/wrapper/webhook.js +0 -82
- package/src/api/membership.ts +0 -155
- package/src/core/client.ts +0 -82
- package/src/core/options.ts +0 -9
- package/src/wrapper/collection.ts +0 -115
- package/src/wrapper/index.ts +0 -6
- package/src/wrapper/item.ts +0 -218
- package/src/wrapper/membership.ts +0 -163
- package/src/wrapper/response.ts +0 -25
- package/src/wrapper/site.ts +0 -228
- package/src/wrapper/webhook.ts +0 -116
package/dist/api/item.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import { PaginatedData, WebflowRecord } from "../core";
|
|
2
3
|
/**************************************************************
|
|
3
4
|
* Interfaces
|
|
4
5
|
**************************************************************/
|
|
@@ -34,110 +35,143 @@ export declare type PageinatedItems = PaginatedData & {
|
|
|
34
35
|
items: IItem[];
|
|
35
36
|
};
|
|
36
37
|
/**************************************************************
|
|
37
|
-
*
|
|
38
|
+
* Class
|
|
38
39
|
**************************************************************/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
collectionId:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
itemId:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
itemIds:
|
|
142
|
-
|
|
143
|
-
|
|
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
CHANGED
|
@@ -1,131 +1,151 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Item = void 0;
|
|
4
4
|
const core_1 = require("../core");
|
|
5
5
|
/**************************************************************
|
|
6
|
-
*
|
|
6
|
+
* Class
|
|
7
7
|
**************************************************************/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
}
|
|
21
150
|
}
|
|
22
|
-
exports.
|
|
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;
|
|
151
|
+
exports.Item = Item;
|
package/dist/api/meta.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
2
|
/**************************************************************
|
|
3
3
|
* Types
|
|
4
4
|
**************************************************************/
|
|
@@ -35,17 +35,19 @@ export interface IAuthentiationInfo {
|
|
|
35
35
|
_id: string;
|
|
36
36
|
}
|
|
37
37
|
/**************************************************************
|
|
38
|
-
*
|
|
38
|
+
* Class
|
|
39
39
|
**************************************************************/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Meta = void 0;
|
|
4
4
|
/**************************************************************
|
|
5
|
-
*
|
|
5
|
+
* Class
|
|
6
6
|
**************************************************************/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
+
}
|
|
14
24
|
}
|
|
15
|
-
exports.
|
|
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;
|
|
25
|
+
exports.Meta = Meta;
|