webflow-api 1.2.2 → 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.
- package/.eslintrc +31 -0
- package/.github/workflows/code-quality.yml +102 -0
- package/.github/workflows/npm-publish.yml +21 -0
- package/.github/workflows/semgrep.yml +24 -0
- package/.prettierignore +5 -0
- package/.prettierrc +6 -0
- package/README.md +50 -1
- package/jest.config.js +17 -0
- package/package.json +2 -7
- package/src/api/collection.ts +1 -1
- package/src/api/item.ts +4 -4
- package/src/api/meta.ts +2 -2
- package/src/api/oauth.ts +8 -2
- package/src/core/error.ts +1 -1
- package/src/core/webflow.ts +111 -4
- package/tests/api/collection.test.ts +147 -0
- package/tests/api/item.test.ts +180 -0
- package/tests/api/meta.test.ts +38 -0
- package/tests/api/oauth.test.ts +44 -0
- package/tests/api/site.test.ts +202 -0
- package/tests/api/user.test.ts +139 -0
- package/tests/api/webhook.test.ts +82 -0
- package/tests/core/error.test.ts +19 -0
- package/tests/core/response.test.ts +36 -0
- package/tests/core/webflow.test.ts +540 -0
- package/tests/fixtures/collection.fixture.ts +374 -0
- package/tests/fixtures/index.ts +7 -0
- package/tests/fixtures/item.fixture.ts +193 -0
- package/tests/fixtures/meta.fixture.ts +34 -0
- package/tests/fixtures/oauth.fixture.ts +38 -0
- package/tests/fixtures/site.fixture.ts +78 -0
- package/tests/fixtures/user.fixture.ts +175 -0
- package/tests/fixtures/webhook.fixture.ts +69 -0
- package/tsconfig.eslint.json +7 -0
- package/tsconfig.json +14 -0
- package/dist/api/collection.d.ts +0 -112
- package/dist/api/collection.js +0 -94
- package/dist/api/index.d.ts +0 -7
- package/dist/api/index.js +0 -23
- package/dist/api/item.d.ts +0 -177
- package/dist/api/item.js +0 -151
- package/dist/api/meta.d.ts +0 -53
- package/dist/api/meta.js +0 -25
- package/dist/api/oauth.d.ts +0 -69
- package/dist/api/oauth.js +0 -66
- package/dist/api/site.d.ts +0 -140
- package/dist/api/site.js +0 -137
- package/dist/api/user.d.ts +0 -143
- package/dist/api/user.js +0 -119
- package/dist/api/webhook.d.ts +0 -102
- package/dist/api/webhook.js +0 -80
- package/dist/core/error.d.ts +0 -21
- package/dist/core/error.js +0 -30
- package/dist/core/index.d.ts +0 -3
- package/dist/core/index.js +0 -19
- package/dist/core/response.d.ts +0 -32
- package/dist/core/response.js +0 -26
- package/dist/core/webflow.d.ts +0 -386
- package/dist/core/webflow.js +0 -445
- package/dist/index.d.ts +0 -2
- package/yarn.lock +0 -2830
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export const SiteFixture = {
|
|
2
|
+
list: {
|
|
3
|
+
response: [
|
|
4
|
+
{
|
|
5
|
+
_id: "580e63e98c9a982ac9b8b741",
|
|
6
|
+
createdOn: "2016-10-24T19:41:29.156Z",
|
|
7
|
+
name: "api_docs_sample_json",
|
|
8
|
+
shortName: "api-docs-sample-json",
|
|
9
|
+
lastPublished: "2016-10-24T23:06:51.251Z",
|
|
10
|
+
previewUrl:
|
|
11
|
+
"https://d1otoma47x30pg.cloudfront.net/580e63e98c9a982ac9b8b741/201610241603.png",
|
|
12
|
+
timezone: "America/Los_Angeles",
|
|
13
|
+
database: "580e63fc8c9a982ac9b8b744",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
_id: "580ff8c3ba3e45ba9fe588bb",
|
|
17
|
+
createdOn: "2016-10-26T00:28:54.191Z",
|
|
18
|
+
name: "Copy of api_docs_sample_json",
|
|
19
|
+
shortName: "api-docs-sample-json-086c6538f9b0583762",
|
|
20
|
+
lastPublished: null,
|
|
21
|
+
previewUrl:
|
|
22
|
+
"https://d1otoma47x30pg.cloudfront.net/580e63e98c9a982ac9b8b741/201610241603.png",
|
|
23
|
+
timezone: "America/Los_Angeles",
|
|
24
|
+
database: "580ff8c3ba3e45ba9fe588bf",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
_id: "580ff8d7ba3e45ba9fe588e9",
|
|
28
|
+
createdOn: "2016-10-26T00:29:13.634Z",
|
|
29
|
+
name: "Copy of api_docs_sample_json",
|
|
30
|
+
shortName: "api-docs-sample-json-ce077aa6c5cd3e0177",
|
|
31
|
+
lastPublished: null,
|
|
32
|
+
previewUrl:
|
|
33
|
+
"https://d1otoma47x30pg.cloudfront.net/580e63e98c9a982ac9b8b741/201610241603.png",
|
|
34
|
+
timezone: "America/Los_Angeles",
|
|
35
|
+
database: "580ff8d7ba3e45ba9fe588ed",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
getOne: {
|
|
40
|
+
parameters: {
|
|
41
|
+
siteId: "580e63e98c9a982ac9b8b741",
|
|
42
|
+
},
|
|
43
|
+
response: {
|
|
44
|
+
_id: "580e63e98c9a982ac9b8b741",
|
|
45
|
+
createdOn: "2016-10-24T19:41:29.156Z",
|
|
46
|
+
name: "api_docs_sample_json",
|
|
47
|
+
shortName: "api-docs-sample-json",
|
|
48
|
+
lastPublished: "2016-10-24T19:43:17.271Z",
|
|
49
|
+
previewUrl: "https://d1otoma47x30pg.cloudfront.net/580e63e98c9a982ac9b8b741/201610241243.png",
|
|
50
|
+
timezone: "America/Los_Angeles",
|
|
51
|
+
database: "580e63fc8c9a982ac9b8b744",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
domains: {
|
|
55
|
+
parameters: {
|
|
56
|
+
siteId: "580e63e98c9a982ac9b8b741",
|
|
57
|
+
},
|
|
58
|
+
response: [
|
|
59
|
+
{
|
|
60
|
+
_id: "589a331aa51e760df7ccb89d",
|
|
61
|
+
name: "test-api-domain.com",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
_id: "589a331aa51e760df7ccb89e",
|
|
65
|
+
name: "www.test-api-domain.com",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
publish: {
|
|
70
|
+
parameters: {
|
|
71
|
+
siteId: "580e63e98c9a982ac9b8b741",
|
|
72
|
+
domains: ["test-api-domain.com"],
|
|
73
|
+
},
|
|
74
|
+
response: {
|
|
75
|
+
queued: true,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
export const UserFixture = {
|
|
2
|
+
getOne: {
|
|
3
|
+
parameters: {
|
|
4
|
+
userId: "6287ec36a841b25637c663df",
|
|
5
|
+
siteId: "580e63e98c9a982ac9b8b741",
|
|
6
|
+
},
|
|
7
|
+
response: {
|
|
8
|
+
_id: "6287ec36a841b25637c663df",
|
|
9
|
+
createdOn: "2022-05-20T13:46:12.093Z",
|
|
10
|
+
updatedOn: "2022-05-20T13:46:12.093Z",
|
|
11
|
+
emailVerified: true,
|
|
12
|
+
status: "verified",
|
|
13
|
+
data: {
|
|
14
|
+
"accept-privacy": false,
|
|
15
|
+
"accept-communications": false,
|
|
16
|
+
email: "Some.One@home.com",
|
|
17
|
+
name: "Some One",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
list: {
|
|
22
|
+
parameters: {
|
|
23
|
+
siteId: "580e63e98c9a982ac9b8b741",
|
|
24
|
+
},
|
|
25
|
+
response: {
|
|
26
|
+
users: [
|
|
27
|
+
{
|
|
28
|
+
_id: "6287ec36a841b25637c663df",
|
|
29
|
+
createdOn: "2022-05-20T13:46:12.093Z",
|
|
30
|
+
updatedOn: "2022-05-20T13:46:12.093Z",
|
|
31
|
+
emailVerified: false,
|
|
32
|
+
status: "unverified",
|
|
33
|
+
data: {
|
|
34
|
+
"accept-privacy": false,
|
|
35
|
+
"accept-communications": false,
|
|
36
|
+
email: "Person.One@home.com",
|
|
37
|
+
name: "Person One",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
_id: "6287ec36a841b25637c663f0",
|
|
42
|
+
createdOn: "2022-05-19T05:32:04.581Z",
|
|
43
|
+
updatedOn: "2022-05-19T05:32:04.581Z",
|
|
44
|
+
emailVerified: false,
|
|
45
|
+
status: "unverified",
|
|
46
|
+
data: {
|
|
47
|
+
"accept-privacy": false,
|
|
48
|
+
"accept-communications": false,
|
|
49
|
+
email: "Person.Two@home.com",
|
|
50
|
+
name: "Person Two",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
_id: "6287ec36a841b25637c663d9",
|
|
55
|
+
createdOn: "2022-05-17T03:34:06.720Z",
|
|
56
|
+
updatedOn: "2022-05-17T03:34:06.720Z",
|
|
57
|
+
emailVerified: true,
|
|
58
|
+
status: "verified",
|
|
59
|
+
data: {
|
|
60
|
+
"accept-privacy": false,
|
|
61
|
+
"accept-communications": false,
|
|
62
|
+
email: "Person.Three@home.com",
|
|
63
|
+
name: "Person Three",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
_id: "6287ec37a841b25637c6641b",
|
|
68
|
+
createdOn: "2022-05-15T03:46:09.748Z",
|
|
69
|
+
updatedOn: "2022-05-15T03:46:09.748Z",
|
|
70
|
+
emailVerified: false,
|
|
71
|
+
status: "unverified",
|
|
72
|
+
data: {
|
|
73
|
+
"accept-privacy": false,
|
|
74
|
+
"accept-communications": false,
|
|
75
|
+
email: "Person.Four@home.com",
|
|
76
|
+
name: "Person Four",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
_id: "6287ec37a841b25637c66449",
|
|
81
|
+
createdOn: "2022-05-15T02:55:38.786Z",
|
|
82
|
+
updatedOn: "2022-05-15T02:55:38.786Z",
|
|
83
|
+
emailVerified: true,
|
|
84
|
+
status: "verified",
|
|
85
|
+
data: {
|
|
86
|
+
"accept-privacy": false,
|
|
87
|
+
"accept-communications": false,
|
|
88
|
+
email: "Person.Five@home.com",
|
|
89
|
+
name: "Person Five",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
count: 5,
|
|
94
|
+
limit: 5,
|
|
95
|
+
offset: 0,
|
|
96
|
+
total: 201,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
invite: {
|
|
100
|
+
parameters: {
|
|
101
|
+
siteId: "580e63e98c9a982ac9b8b741",
|
|
102
|
+
email: "some.one@home.com",
|
|
103
|
+
},
|
|
104
|
+
response: {
|
|
105
|
+
_id: "6287ec36a841b25637c663df",
|
|
106
|
+
createdOn: "2022-05-20T13:46:12.093Z",
|
|
107
|
+
updatedOn: "2022-05-20T13:46:12.093Z",
|
|
108
|
+
emailVerified: true,
|
|
109
|
+
status: "verified",
|
|
110
|
+
data: {
|
|
111
|
+
"accept-privacy": false,
|
|
112
|
+
"accept-communications": false,
|
|
113
|
+
email: "some.one@home.com",
|
|
114
|
+
name: "Some One",
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
update: {
|
|
119
|
+
parameters: {
|
|
120
|
+
userId: "6287ec36a841b25637c663df",
|
|
121
|
+
siteId: "580e63e98c9a982ac9b8b741",
|
|
122
|
+
data: {
|
|
123
|
+
status: "verified",
|
|
124
|
+
data: {
|
|
125
|
+
"accept-privacy": false,
|
|
126
|
+
"accept-communications": false,
|
|
127
|
+
email: "Some.One@home.com",
|
|
128
|
+
name: "Some One",
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
response: {
|
|
133
|
+
_id: "6287ec36a841b25637c663df",
|
|
134
|
+
createdOn: "2022-05-20T13:46:12.093Z",
|
|
135
|
+
updatedOn: "2022-05-20T13:46:12.093Z",
|
|
136
|
+
emailVerified: true,
|
|
137
|
+
status: "verified",
|
|
138
|
+
data: {
|
|
139
|
+
"accept-privacy": false,
|
|
140
|
+
"accept-communications": false,
|
|
141
|
+
email: "Some.One@home.com",
|
|
142
|
+
name: "Some One",
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
delete: {
|
|
147
|
+
parameters: {
|
|
148
|
+
userId: "6287ec36a841b25637c663df",
|
|
149
|
+
siteId: "580e63e98c9a982ac9b8b741",
|
|
150
|
+
},
|
|
151
|
+
response: {
|
|
152
|
+
deleted: 1,
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
accessGroups: {
|
|
156
|
+
parameters: {
|
|
157
|
+
siteId: "580e63e98c9a982ac9b8b741",
|
|
158
|
+
},
|
|
159
|
+
response: {
|
|
160
|
+
accessGroups: [
|
|
161
|
+
{
|
|
162
|
+
_id: "62be58d404be8a6cc900c081",
|
|
163
|
+
name: "Webflowers",
|
|
164
|
+
shortId: "jo",
|
|
165
|
+
slug: "webflowers",
|
|
166
|
+
createdOn: "2022-08-01T19:41:48.349Z",
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
count: 1,
|
|
170
|
+
limit: 10,
|
|
171
|
+
offset: 0,
|
|
172
|
+
total: 1,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export const WebhookFixture = {
|
|
2
|
+
getOne: {
|
|
3
|
+
parameters: {
|
|
4
|
+
siteId: "580e63e98c9a982ac9b8b741",
|
|
5
|
+
webhookId: "582266e0cd48de0f0e3c6d8b",
|
|
6
|
+
},
|
|
7
|
+
response: {
|
|
8
|
+
_id: "582266e0cd48de0f0e3c6d8b",
|
|
9
|
+
triggerType: "form_submission",
|
|
10
|
+
triggerId: "580e63e98c9a982ac9b8b741",
|
|
11
|
+
site: "580e63e98c9a982ac9b8b741",
|
|
12
|
+
createdOn: "2016-11-08T23:59:28.572Z",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
list: {
|
|
16
|
+
parameters: {
|
|
17
|
+
siteId: "580e63e98c9a982ac9b8b741",
|
|
18
|
+
},
|
|
19
|
+
response: [
|
|
20
|
+
{
|
|
21
|
+
_id: "57ca0a9e418c504a6e1acbb6",
|
|
22
|
+
triggerType: "form_submission",
|
|
23
|
+
triggerId: "580e63e98c9a982ac9b8b741",
|
|
24
|
+
site: "580e63e98c9a982ac9b8b741",
|
|
25
|
+
lastUsed: "2016-09-06T21:12:22.148Z",
|
|
26
|
+
createdOn: "2016-09-02T23:26:22.241Z",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
_id: "578d85cce0c47cd2865f4cf2",
|
|
30
|
+
triggerType: "form_submission",
|
|
31
|
+
triggerId: "580e63e98c9a982ac9b8b741",
|
|
32
|
+
site: "580e63e98c9a982ac9b8b741",
|
|
33
|
+
lastUsed: "2016-09-06T21:12:22.142Z",
|
|
34
|
+
createdOn: "2016-07-19T01:43:40.585Z",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
_id: "578d85cce0c47cd2865f4cf3",
|
|
38
|
+
triggerType: "form_submission",
|
|
39
|
+
triggerId: "580e63e98c9a982ac9b8b741",
|
|
40
|
+
site: "580e63e98c9a982ac9b8b741",
|
|
41
|
+
lastUsed: "2016-09-06T21:12:22.192Z",
|
|
42
|
+
createdOn: "2016-07-19T01:43:40.605Z",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
create: {
|
|
47
|
+
parameters: {
|
|
48
|
+
siteId: "580e63e98c9a982ac9b8b741",
|
|
49
|
+
triggerType: "form_submission",
|
|
50
|
+
url: "https://example.com",
|
|
51
|
+
},
|
|
52
|
+
response: {
|
|
53
|
+
_id: "582266e0cd48de0f0e3c6d8b",
|
|
54
|
+
triggerType: "form_submission",
|
|
55
|
+
triggerId: "580e63e98c9a982ac9b8b741",
|
|
56
|
+
site: "580e63e98c9a982ac9b8b741",
|
|
57
|
+
createdOn: "2016-11-08T23:59:28.572Z",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
delete: {
|
|
61
|
+
parameters: {
|
|
62
|
+
siteId: "580e63e98c9a982ac9b8b741",
|
|
63
|
+
webhookId: "582266e0cd48de0f0e3c6d8b",
|
|
64
|
+
},
|
|
65
|
+
response: {
|
|
66
|
+
deleted: 1,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": ["es6", "dom"],
|
|
4
|
+
"module": "CommonJS",
|
|
5
|
+
"target": "es2020",
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"moduleResolution": "Node",
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"baseUrl": "src",
|
|
11
|
+
"experimentalDecorators": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|
package/dist/api/collection.d.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance } from "axios";
|
|
2
|
-
import { WebflowRecord } from "../core";
|
|
3
|
-
import { Item } from ".";
|
|
4
|
-
/**************************************************************
|
|
5
|
-
* Types
|
|
6
|
-
**************************************************************/
|
|
7
|
-
export declare type CollectionFieldType = "Bool" | "Color" | "Date" | "ExtFileRef" | "Set" | "ImageRef" | "Set" | "ItemRef" | "ItemRefSet" | "Link" | "Number" | "Option" | "PlainText" | "RichText" | "Video" | "User" | string;
|
|
8
|
-
export declare type CollectionField = {
|
|
9
|
-
id: string;
|
|
10
|
-
type: CollectionFieldType;
|
|
11
|
-
slug: string;
|
|
12
|
-
name: string;
|
|
13
|
-
required: boolean;
|
|
14
|
-
editable: boolean;
|
|
15
|
-
validations?: Record<string, string | number | boolean | object>;
|
|
16
|
-
};
|
|
17
|
-
/**************************************************************
|
|
18
|
-
* Interfaces
|
|
19
|
-
**************************************************************/
|
|
20
|
-
export interface ICollection {
|
|
21
|
-
_id: string;
|
|
22
|
-
lastUpdated: string;
|
|
23
|
-
createdOn: string;
|
|
24
|
-
name: string;
|
|
25
|
-
slug: string;
|
|
26
|
-
singularName: string;
|
|
27
|
-
fields: CollectionField[];
|
|
28
|
-
}
|
|
29
|
-
/**************************************************************
|
|
30
|
-
* Class
|
|
31
|
-
**************************************************************/
|
|
32
|
-
export declare class Collection extends WebflowRecord<ICollection> implements ICollection {
|
|
33
|
-
fields: CollectionField[];
|
|
34
|
-
singularName: string;
|
|
35
|
-
lastUpdated: string;
|
|
36
|
-
createdOn: string;
|
|
37
|
-
_id: string;
|
|
38
|
-
name: string;
|
|
39
|
-
slug: string;
|
|
40
|
-
/**************************************************************
|
|
41
|
-
* Static Methods
|
|
42
|
-
**************************************************************/
|
|
43
|
-
/**
|
|
44
|
-
* Get a list of Collections
|
|
45
|
-
* @param params The params for the request
|
|
46
|
-
* @param params.siteId The site ID
|
|
47
|
-
* @param client The Axios client instance
|
|
48
|
-
* @returns A list of Collections
|
|
49
|
-
*/
|
|
50
|
-
static list({ siteId }: {
|
|
51
|
-
siteId: string;
|
|
52
|
-
}, client: AxiosInstance): Promise<import("axios").AxiosResponse<ICollection[], any>>;
|
|
53
|
-
/**
|
|
54
|
-
* Get a single Collection
|
|
55
|
-
* @param params The params for the request
|
|
56
|
-
* @param params.collectionId The collection ID
|
|
57
|
-
* @param client The Axios client instance
|
|
58
|
-
* @returns A single Collection
|
|
59
|
-
*/
|
|
60
|
-
static getOne({ collectionId }: {
|
|
61
|
-
collectionId: string;
|
|
62
|
-
}, client: AxiosInstance): Promise<import("axios").AxiosResponse<ICollection, any>>;
|
|
63
|
-
/**************************************************************
|
|
64
|
-
* Instance Methods
|
|
65
|
-
**************************************************************/
|
|
66
|
-
/**
|
|
67
|
-
* Get a single Item
|
|
68
|
-
* @param params The params for the request
|
|
69
|
-
* @param params.itemId The Item ID
|
|
70
|
-
* @returns A single Item
|
|
71
|
-
*/
|
|
72
|
-
item({ itemId }: {
|
|
73
|
-
itemId: string;
|
|
74
|
-
}): Promise<Item>;
|
|
75
|
-
/**
|
|
76
|
-
* Get a list of Items
|
|
77
|
-
* @param params The params for the request
|
|
78
|
-
* @param params.limit The number of items to return (optional)
|
|
79
|
-
* @param params.offset The number of items to skip (optional)
|
|
80
|
-
* @returns A list of Items
|
|
81
|
-
*/
|
|
82
|
-
items({ limit, offset }?: {
|
|
83
|
-
limit?: number;
|
|
84
|
-
offset?: number;
|
|
85
|
-
}): Promise<Item[]>;
|
|
86
|
-
/**
|
|
87
|
-
* Remove a single Item
|
|
88
|
-
* @param params The params for the request
|
|
89
|
-
* @param params.itemId The Item ID
|
|
90
|
-
* @returns The result from the removal
|
|
91
|
-
*/
|
|
92
|
-
removeItem({ itemId }: {
|
|
93
|
-
itemId: string;
|
|
94
|
-
}): Promise<import("./item").IItemDelete>;
|
|
95
|
-
/**
|
|
96
|
-
* Create a new Item
|
|
97
|
-
* @param fields The Item fields to create
|
|
98
|
-
* @returns The created Item
|
|
99
|
-
*/
|
|
100
|
-
createItem(fields: object): Promise<Item>;
|
|
101
|
-
/**
|
|
102
|
-
* Update a single Item
|
|
103
|
-
* @param params The params for the request
|
|
104
|
-
* @param params.itemId The Item ID
|
|
105
|
-
* @param params.fields The fields to update
|
|
106
|
-
* @returns The updated Item
|
|
107
|
-
*/
|
|
108
|
-
updateItem({ itemId, fields }: {
|
|
109
|
-
itemId: string;
|
|
110
|
-
fields: object;
|
|
111
|
-
}): Promise<Item>;
|
|
112
|
-
}
|
package/dist/api/collection.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Collection = void 0;
|
|
4
|
-
const core_1 = require("../core");
|
|
5
|
-
const _1 = require(".");
|
|
6
|
-
/**************************************************************
|
|
7
|
-
* Class
|
|
8
|
-
**************************************************************/
|
|
9
|
-
class Collection extends core_1.WebflowRecord {
|
|
10
|
-
/**************************************************************
|
|
11
|
-
* Static Methods
|
|
12
|
-
**************************************************************/
|
|
13
|
-
/**
|
|
14
|
-
* Get a list of Collections
|
|
15
|
-
* @param params The params for the request
|
|
16
|
-
* @param params.siteId The site ID
|
|
17
|
-
* @param client The Axios client instance
|
|
18
|
-
* @returns A list of Collections
|
|
19
|
-
*/
|
|
20
|
-
static list({ siteId }, client) {
|
|
21
|
-
(0, core_1.requireArgs)({ siteId });
|
|
22
|
-
const path = `/sites/${siteId}/collections`;
|
|
23
|
-
return client.get(path);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Get a single Collection
|
|
27
|
-
* @param params The params for the request
|
|
28
|
-
* @param params.collectionId The collection ID
|
|
29
|
-
* @param client The Axios client instance
|
|
30
|
-
* @returns A single Collection
|
|
31
|
-
*/
|
|
32
|
-
static getOne({ collectionId }, client) {
|
|
33
|
-
(0, core_1.requireArgs)({ collectionId });
|
|
34
|
-
const path = `/collections/${collectionId}`;
|
|
35
|
-
return client.get(path);
|
|
36
|
-
}
|
|
37
|
-
/**************************************************************
|
|
38
|
-
* Instance Methods
|
|
39
|
-
**************************************************************/
|
|
40
|
-
/**
|
|
41
|
-
* Get a single Item
|
|
42
|
-
* @param params The params for the request
|
|
43
|
-
* @param params.itemId The Item ID
|
|
44
|
-
* @returns A single Item
|
|
45
|
-
*/
|
|
46
|
-
async item({ itemId }) {
|
|
47
|
-
const res = await _1.Item.getOne({ itemId, collectionId: this._id }, this.client);
|
|
48
|
-
const [item] = res.data.items.map((data) => new _1.Item(this.client, { ...res, data }));
|
|
49
|
-
return item;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Get a list of Items
|
|
53
|
-
* @param params The params for the request
|
|
54
|
-
* @param params.limit The number of items to return (optional)
|
|
55
|
-
* @param params.offset The number of items to skip (optional)
|
|
56
|
-
* @returns A list of Items
|
|
57
|
-
*/
|
|
58
|
-
async items({ limit, offset } = {}) {
|
|
59
|
-
const res = await _1.Item.list({ collectionId: this._id, limit, offset }, this.client);
|
|
60
|
-
return res.data.items.map((data) => new _1.Item(this.client, { ...res, data }));
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Remove a single Item
|
|
64
|
-
* @param params The params for the request
|
|
65
|
-
* @param params.itemId The Item ID
|
|
66
|
-
* @returns The result from the removal
|
|
67
|
-
*/
|
|
68
|
-
async removeItem({ itemId }) {
|
|
69
|
-
const res = await _1.Item.remove({ itemId, collectionId: this._id }, this.client);
|
|
70
|
-
return res.data;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Create a new Item
|
|
74
|
-
* @param fields The Item fields to create
|
|
75
|
-
* @returns The created Item
|
|
76
|
-
*/
|
|
77
|
-
async createItem(fields) {
|
|
78
|
-
const res = await _1.Item.create({ collectionId: this._id, fields }, this.client);
|
|
79
|
-
return new _1.Item(this.client, res);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Update a single Item
|
|
83
|
-
* @param params The params for the request
|
|
84
|
-
* @param params.itemId The Item ID
|
|
85
|
-
* @param params.fields The fields to update
|
|
86
|
-
* @returns The updated Item
|
|
87
|
-
*/
|
|
88
|
-
async updateItem({ itemId, fields }) {
|
|
89
|
-
const params = { itemId, collectionId: this._id, fields };
|
|
90
|
-
const res = await _1.Item.update(params, this.client);
|
|
91
|
-
return new _1.Item(this.client, res);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
exports.Collection = Collection;
|
package/dist/api/index.d.ts
DELETED
package/dist/api/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./collection"), exports);
|
|
18
|
-
__exportStar(require("./user"), exports);
|
|
19
|
-
__exportStar(require("./webhook"), exports);
|
|
20
|
-
__exportStar(require("./item"), exports);
|
|
21
|
-
__exportStar(require("./site"), exports);
|
|
22
|
-
__exportStar(require("./oauth"), exports);
|
|
23
|
-
__exportStar(require("./meta"), exports);
|