Skip to content

Commit 750b4c9

Browse files
authored
Merge pull request #251 from webflow/add-asset-upload-helper
Add helper method for creating and uploading a Webflow Asset
2 parents b40a6a1 + 37d33fb commit 750b4c9

File tree

30 files changed

+508
-117
lines changed

30 files changed

+508
-117
lines changed

package.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webflow-api",
3-
"version": "3.1.1",
3+
"version": "3.1.2",
44
"private": false,
55
"repository": "https://github.com/webflow/js-webflow-api",
66
"main": "./index.js",
@@ -12,29 +12,30 @@
1212
"test": "jest"
1313
},
1414
"dependencies": {
15-
"url-join": "4.0.1",
15+
"crypto-browserify": "^3.12.1",
1616
"form-data": "^4.0.0",
1717
"formdata-node": "^6.0.3",
18+
"js-base64": "3.7.2",
1819
"node-fetch": "2.7.0",
1920
"qs": "6.11.2",
2021
"readable-stream": "^4.5.2",
21-
"js-base64": "3.7.2",
22-
"crypto-browserify": "^3.12.1"
22+
"url-join": "4.0.1"
2323
},
2424
"devDependencies": {
25-
"@types/url-join": "4.0.1",
26-
"@types/qs": "6.9.8",
25+
"@types/jest": "29.5.5",
26+
"@types/node": "17.0.33",
2727
"@types/node-fetch": "2.6.9",
28+
"@types/qs": "6.9.8",
2829
"@types/readable-stream": "^4.0.15",
29-
"webpack": "^5.94.0",
30-
"ts-loader": "^9.3.1",
30+
"@types/url-join": "4.0.1",
3131
"jest": "29.7.0",
32-
"@types/jest": "29.5.5",
33-
"ts-jest": "29.1.1",
3432
"jest-environment-jsdom": "29.7.0",
35-
"@types/node": "17.0.33",
33+
"jest-fetch-mock": "^3.0.3",
3634
"prettier": "2.7.1",
37-
"typescript": "4.6.4"
35+
"ts-jest": "29.1.1",
36+
"ts-loader": "^9.3.1",
37+
"typescript": "4.6.4",
38+
"webpack": "^5.94.0"
3839
},
3940
"browser": {
4041
"fs": false,

src/api/resources/accessGroups/client/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export class AccessGroups {
7878
Authorization: await this._getAuthorizationHeader(),
7979
"X-Fern-Language": "JavaScript",
8080
"X-Fern-SDK-Name": "webflow-api",
81-
"X-Fern-SDK-Version": "3.1.1",
82-
"User-Agent": "webflow-api/3.1.1",
81+
"X-Fern-SDK-Version": "3.1.2",
82+
"User-Agent": "webflow-api/3.1.2",
8383
"X-Fern-Runtime": core.RUNTIME.type,
8484
"X-Fern-Runtime-Version": core.RUNTIME.version,
8585
...requestOptions?.headers,

src/api/resources/assets/client/Client.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import * as Webflow from "../../../index";
88
import urlJoin from "url-join";
99
import * as serializers from "../../../../serialization/index";
1010
import * as errors from "../../../../errors/index";
11+
import crypto from "crypto";
12+
import fetch from "node-fetch";
13+
import FormData from 'form-data';
14+
import { Readable } from 'stream';
1115

1216
export declare namespace Assets {
1317
interface Options {
@@ -61,7 +65,7 @@ export class Assets {
6165
Authorization: await this._getAuthorizationHeader(),
6266
"X-Fern-Language": "JavaScript",
6367
"X-Fern-SDK-Name": "webflow-api",
64-
"X-Fern-SDK-Version": "3.1.1",
68+
"X-Fern-SDK-Version": "3.1.2",
6569
"User-Agent": "webflow-api/3.1.1",
6670
"X-Fern-Runtime": core.RUNTIME.type,
6771
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -195,7 +199,7 @@ export class Assets {
195199
Authorization: await this._getAuthorizationHeader(),
196200
"X-Fern-Language": "JavaScript",
197201
"X-Fern-SDK-Name": "webflow-api",
198-
"X-Fern-SDK-Version": "3.1.1",
202+
"X-Fern-SDK-Version": "3.1.2",
199203
"User-Agent": "webflow-api/3.1.1",
200204
"X-Fern-Runtime": core.RUNTIME.type,
201205
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -317,7 +321,7 @@ export class Assets {
317321
Authorization: await this._getAuthorizationHeader(),
318322
"X-Fern-Language": "JavaScript",
319323
"X-Fern-SDK-Name": "webflow-api",
320-
"X-Fern-SDK-Version": "3.1.1",
324+
"X-Fern-SDK-Version": "3.1.2",
321325
"User-Agent": "webflow-api/3.1.1",
322326
"X-Fern-Runtime": core.RUNTIME.type,
323327
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -434,7 +438,7 @@ export class Assets {
434438
Authorization: await this._getAuthorizationHeader(),
435439
"X-Fern-Language": "JavaScript",
436440
"X-Fern-SDK-Name": "webflow-api",
437-
"X-Fern-SDK-Version": "3.1.1",
441+
"X-Fern-SDK-Version": "3.1.2",
438442
"User-Agent": "webflow-api/3.1.1",
439443
"X-Fern-Runtime": core.RUNTIME.type,
440444
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -550,7 +554,7 @@ export class Assets {
550554
Authorization: await this._getAuthorizationHeader(),
551555
"X-Fern-Language": "JavaScript",
552556
"X-Fern-SDK-Name": "webflow-api",
553-
"X-Fern-SDK-Version": "3.1.1",
557+
"X-Fern-SDK-Version": "3.1.2",
554558
"User-Agent": "webflow-api/3.1.1",
555559
"X-Fern-Runtime": core.RUNTIME.type,
556560
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -672,7 +676,7 @@ export class Assets {
672676
Authorization: await this._getAuthorizationHeader(),
673677
"X-Fern-Language": "JavaScript",
674678
"X-Fern-SDK-Name": "webflow-api",
675-
"X-Fern-SDK-Version": "3.1.1",
679+
"X-Fern-SDK-Version": "3.1.2",
676680
"User-Agent": "webflow-api/3.1.1",
677681
"X-Fern-Runtime": core.RUNTIME.type,
678682
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -798,7 +802,7 @@ export class Assets {
798802
Authorization: await this._getAuthorizationHeader(),
799803
"X-Fern-Language": "JavaScript",
800804
"X-Fern-SDK-Name": "webflow-api",
801-
"X-Fern-SDK-Version": "3.1.1",
805+
"X-Fern-SDK-Version": "3.1.2",
802806
"User-Agent": "webflow-api/3.1.1",
803807
"X-Fern-Runtime": core.RUNTIME.type,
804808
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -925,7 +929,7 @@ export class Assets {
925929
Authorization: await this._getAuthorizationHeader(),
926930
"X-Fern-Language": "JavaScript",
927931
"X-Fern-SDK-Name": "webflow-api",
928-
"X-Fern-SDK-Version": "3.1.1",
932+
"X-Fern-SDK-Version": "3.1.2",
929933
"User-Agent": "webflow-api/3.1.1",
930934
"X-Fern-Runtime": core.RUNTIME.type,
931935
"X-Fern-Runtime-Version": core.RUNTIME.version,

src/api/resources/collections/client/Client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class Collections {
6363
Authorization: await this._getAuthorizationHeader(),
6464
"X-Fern-Language": "JavaScript",
6565
"X-Fern-SDK-Name": "webflow-api",
66-
"X-Fern-SDK-Version": "3.1.1",
66+
"X-Fern-SDK-Version": "3.1.2",
6767
"User-Agent": "webflow-api/3.1.1",
6868
"X-Fern-Runtime": core.RUNTIME.type,
6969
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -209,7 +209,7 @@ export class Collections {
209209
Authorization: await this._getAuthorizationHeader(),
210210
"X-Fern-Language": "JavaScript",
211211
"X-Fern-SDK-Name": "webflow-api",
212-
"X-Fern-SDK-Version": "3.1.1",
212+
"X-Fern-SDK-Version": "3.1.2",
213213
"User-Agent": "webflow-api/3.1.1",
214214
"X-Fern-Runtime": core.RUNTIME.type,
215215
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -335,7 +335,7 @@ export class Collections {
335335
Authorization: await this._getAuthorizationHeader(),
336336
"X-Fern-Language": "JavaScript",
337337
"X-Fern-SDK-Name": "webflow-api",
338-
"X-Fern-SDK-Version": "3.1.1",
338+
"X-Fern-SDK-Version": "3.1.2",
339339
"User-Agent": "webflow-api/3.1.1",
340340
"X-Fern-Runtime": core.RUNTIME.type,
341341
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -452,7 +452,7 @@ export class Collections {
452452
Authorization: await this._getAuthorizationHeader(),
453453
"X-Fern-Language": "JavaScript",
454454
"X-Fern-SDK-Name": "webflow-api",
455-
"X-Fern-SDK-Version": "3.1.1",
455+
"X-Fern-SDK-Version": "3.1.2",
456456
"User-Agent": "webflow-api/3.1.1",
457457
"X-Fern-Runtime": core.RUNTIME.type,
458458
"X-Fern-Runtime-Version": core.RUNTIME.version,

src/api/resources/collections/resources/fields/client/Client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class Fields {
105105
Authorization: await this._getAuthorizationHeader(),
106106
"X-Fern-Language": "JavaScript",
107107
"X-Fern-SDK-Name": "webflow-api",
108-
"X-Fern-SDK-Version": "3.1.1",
108+
"X-Fern-SDK-Version": "3.1.2",
109109
"User-Agent": "webflow-api/3.1.1",
110110
"X-Fern-Runtime": core.RUNTIME.type,
111111
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -232,7 +232,7 @@ export class Fields {
232232
Authorization: await this._getAuthorizationHeader(),
233233
"X-Fern-Language": "JavaScript",
234234
"X-Fern-SDK-Name": "webflow-api",
235-
"X-Fern-SDK-Version": "3.1.1",
235+
"X-Fern-SDK-Version": "3.1.2",
236236
"User-Agent": "webflow-api/3.1.1",
237237
"X-Fern-Runtime": core.RUNTIME.type,
238238
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -356,7 +356,7 @@ export class Fields {
356356
Authorization: await this._getAuthorizationHeader(),
357357
"X-Fern-Language": "JavaScript",
358358
"X-Fern-SDK-Name": "webflow-api",
359-
"X-Fern-SDK-Version": "3.1.1",
359+
"X-Fern-SDK-Version": "3.1.2",
360360
"User-Agent": "webflow-api/3.1.1",
361361
"X-Fern-Runtime": core.RUNTIME.type,
362362
"X-Fern-Runtime-Version": core.RUNTIME.version,

src/api/resources/collections/resources/items/client/Client.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class Items {
9393
Authorization: await this._getAuthorizationHeader(),
9494
"X-Fern-Language": "JavaScript",
9595
"X-Fern-SDK-Name": "webflow-api",
96-
"X-Fern-SDK-Version": "3.1.1",
96+
"X-Fern-SDK-Version": "3.1.2",
9797
"User-Agent": "webflow-api/3.1.1",
9898
"X-Fern-Runtime": core.RUNTIME.type,
9999
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -247,7 +247,7 @@ export class Items {
247247
Authorization: await this._getAuthorizationHeader(),
248248
"X-Fern-Language": "JavaScript",
249249
"X-Fern-SDK-Name": "webflow-api",
250-
"X-Fern-SDK-Version": "3.1.1",
250+
"X-Fern-SDK-Version": "3.1.2",
251251
"User-Agent": "webflow-api/3.1.1",
252252
"X-Fern-Runtime": core.RUNTIME.type,
253253
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -379,7 +379,7 @@ export class Items {
379379
Authorization: await this._getAuthorizationHeader(),
380380
"X-Fern-Language": "JavaScript",
381381
"X-Fern-SDK-Name": "webflow-api",
382-
"X-Fern-SDK-Version": "3.1.1",
382+
"X-Fern-SDK-Version": "3.1.2",
383383
"User-Agent": "webflow-api/3.1.1",
384384
"X-Fern-Runtime": core.RUNTIME.type,
385385
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -559,7 +559,7 @@ export class Items {
559559
Authorization: await this._getAuthorizationHeader(),
560560
"X-Fern-Language": "JavaScript",
561561
"X-Fern-SDK-Name": "webflow-api",
562-
"X-Fern-SDK-Version": "3.1.1",
562+
"X-Fern-SDK-Version": "3.1.2",
563563
"User-Agent": "webflow-api/3.1.1",
564564
"X-Fern-Runtime": core.RUNTIME.type,
565565
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -718,7 +718,7 @@ export class Items {
718718
Authorization: await this._getAuthorizationHeader(),
719719
"X-Fern-Language": "JavaScript",
720720
"X-Fern-SDK-Name": "webflow-api",
721-
"X-Fern-SDK-Version": "3.1.1",
721+
"X-Fern-SDK-Version": "3.1.2",
722722
"User-Agent": "webflow-api/3.1.1",
723723
"X-Fern-Runtime": core.RUNTIME.type,
724724
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -873,7 +873,7 @@ export class Items {
873873
Authorization: await this._getAuthorizationHeader(),
874874
"X-Fern-Language": "JavaScript",
875875
"X-Fern-SDK-Name": "webflow-api",
876-
"X-Fern-SDK-Version": "3.1.1",
876+
"X-Fern-SDK-Version": "3.1.2",
877877
"User-Agent": "webflow-api/3.1.1",
878878
"X-Fern-Runtime": core.RUNTIME.type,
879879
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -1006,7 +1006,7 @@ export class Items {
10061006
Authorization: await this._getAuthorizationHeader(),
10071007
"X-Fern-Language": "JavaScript",
10081008
"X-Fern-SDK-Name": "webflow-api",
1009-
"X-Fern-SDK-Version": "3.1.1",
1009+
"X-Fern-SDK-Version": "3.1.2",
10101010
"User-Agent": "webflow-api/3.1.1",
10111011
"X-Fern-Runtime": core.RUNTIME.type,
10121012
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -1183,7 +1183,7 @@ export class Items {
11831183
Authorization: await this._getAuthorizationHeader(),
11841184
"X-Fern-Language": "JavaScript",
11851185
"X-Fern-SDK-Name": "webflow-api",
1186-
"X-Fern-SDK-Version": "3.1.1",
1186+
"X-Fern-SDK-Version": "3.1.2",
11871187
"User-Agent": "webflow-api/3.1.1",
11881188
"X-Fern-Runtime": core.RUNTIME.type,
11891189
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -1341,7 +1341,7 @@ export class Items {
13411341
Authorization: await this._getAuthorizationHeader(),
13421342
"X-Fern-Language": "JavaScript",
13431343
"X-Fern-SDK-Name": "webflow-api",
1344-
"X-Fern-SDK-Version": "3.1.1",
1344+
"X-Fern-SDK-Version": "3.1.2",
13451345
"User-Agent": "webflow-api/3.1.1",
13461346
"X-Fern-Runtime": core.RUNTIME.type,
13471347
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -1478,7 +1478,7 @@ export class Items {
14781478
Authorization: await this._getAuthorizationHeader(),
14791479
"X-Fern-Language": "JavaScript",
14801480
"X-Fern-SDK-Name": "webflow-api",
1481-
"X-Fern-SDK-Version": "3.1.1",
1481+
"X-Fern-SDK-Version": "3.1.2",
14821482
"User-Agent": "webflow-api/3.1.1",
14831483
"X-Fern-Runtime": core.RUNTIME.type,
14841484
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -1611,7 +1611,7 @@ export class Items {
16111611
Authorization: await this._getAuthorizationHeader(),
16121612
"X-Fern-Language": "JavaScript",
16131613
"X-Fern-SDK-Name": "webflow-api",
1614-
"X-Fern-SDK-Version": "3.1.1",
1614+
"X-Fern-SDK-Version": "3.1.2",
16151615
"User-Agent": "webflow-api/3.1.1",
16161616
"X-Fern-Runtime": core.RUNTIME.type,
16171617
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -1739,7 +1739,7 @@ export class Items {
17391739
Authorization: await this._getAuthorizationHeader(),
17401740
"X-Fern-Language": "JavaScript",
17411741
"X-Fern-SDK-Name": "webflow-api",
1742-
"X-Fern-SDK-Version": "3.1.1",
1742+
"X-Fern-SDK-Version": "3.1.2",
17431743
"User-Agent": "webflow-api/3.1.1",
17441744
"X-Fern-Runtime": core.RUNTIME.type,
17451745
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -1876,7 +1876,7 @@ export class Items {
18761876
Authorization: await this._getAuthorizationHeader(),
18771877
"X-Fern-Language": "JavaScript",
18781878
"X-Fern-SDK-Name": "webflow-api",
1879-
"X-Fern-SDK-Version": "3.1.1",
1879+
"X-Fern-SDK-Version": "3.1.2",
18801880
"User-Agent": "webflow-api/3.1.1",
18811881
"X-Fern-Runtime": core.RUNTIME.type,
18821882
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -2011,7 +2011,7 @@ export class Items {
20112011
Authorization: await this._getAuthorizationHeader(),
20122012
"X-Fern-Language": "JavaScript",
20132013
"X-Fern-SDK-Name": "webflow-api",
2014-
"X-Fern-SDK-Version": "3.1.1",
2014+
"X-Fern-SDK-Version": "3.1.2",
20152015
"User-Agent": "webflow-api/3.1.1",
20162016
"X-Fern-Runtime": core.RUNTIME.type,
20172017
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -2140,7 +2140,7 @@ export class Items {
21402140
Authorization: await this._getAuthorizationHeader(),
21412141
"X-Fern-Language": "JavaScript",
21422142
"X-Fern-SDK-Name": "webflow-api",
2143-
"X-Fern-SDK-Version": "3.1.1",
2143+
"X-Fern-SDK-Version": "3.1.2",
21442144
"User-Agent": "webflow-api/3.1.1",
21452145
"X-Fern-Runtime": core.RUNTIME.type,
21462146
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -2274,7 +2274,7 @@ export class Items {
22742274
Authorization: await this._getAuthorizationHeader(),
22752275
"X-Fern-Language": "JavaScript",
22762276
"X-Fern-SDK-Name": "webflow-api",
2277-
"X-Fern-SDK-Version": "3.1.1",
2277+
"X-Fern-SDK-Version": "3.1.2",
22782278
"User-Agent": "webflow-api/3.1.1",
22792279
"X-Fern-Runtime": core.RUNTIME.type,
22802280
"X-Fern-Runtime-Version": core.RUNTIME.version,

src/api/resources/components/client/Client.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class Components {
7373
Authorization: await this._getAuthorizationHeader(),
7474
"X-Fern-Language": "JavaScript",
7575
"X-Fern-SDK-Name": "webflow-api",
76-
"X-Fern-SDK-Version": "3.1.1",
76+
"X-Fern-SDK-Version": "3.1.2",
7777
"User-Agent": "webflow-api/3.1.1",
7878
"X-Fern-Runtime": core.RUNTIME.type,
7979
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -217,7 +217,7 @@ export class Components {
217217
Authorization: await this._getAuthorizationHeader(),
218218
"X-Fern-Language": "JavaScript",
219219
"X-Fern-SDK-Name": "webflow-api",
220-
"X-Fern-SDK-Version": "3.1.1",
220+
"X-Fern-SDK-Version": "3.1.2",
221221
"User-Agent": "webflow-api/3.1.1",
222222
"X-Fern-Runtime": core.RUNTIME.type,
223223
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -377,7 +377,7 @@ export class Components {
377377
Authorization: await this._getAuthorizationHeader(),
378378
"X-Fern-Language": "JavaScript",
379379
"X-Fern-SDK-Name": "webflow-api",
380-
"X-Fern-SDK-Version": "3.1.1",
380+
"X-Fern-SDK-Version": "3.1.2",
381381
"User-Agent": "webflow-api/3.1.1",
382382
"X-Fern-Runtime": core.RUNTIME.type,
383383
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -529,7 +529,7 @@ export class Components {
529529
Authorization: await this._getAuthorizationHeader(),
530530
"X-Fern-Language": "JavaScript",
531531
"X-Fern-SDK-Name": "webflow-api",
532-
"X-Fern-SDK-Version": "3.1.1",
532+
"X-Fern-SDK-Version": "3.1.2",
533533
"User-Agent": "webflow-api/3.1.1",
534534
"X-Fern-Runtime": core.RUNTIME.type,
535535
"X-Fern-Runtime-Version": core.RUNTIME.version,
@@ -675,7 +675,7 @@ export class Components {
675675
Authorization: await this._getAuthorizationHeader(),
676676
"X-Fern-Language": "JavaScript",
677677
"X-Fern-SDK-Name": "webflow-api",
678-
"X-Fern-SDK-Version": "3.1.1",
678+
"X-Fern-SDK-Version": "3.1.2",
679679
"User-Agent": "webflow-api/3.1.1",
680680
"X-Fern-Runtime": core.RUNTIME.type,
681681
"X-Fern-Runtime-Version": core.RUNTIME.version,

0 commit comments

Comments
 (0)