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/oauth.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
2
|
/**************************************************************
|
|
3
3
|
* Interfaces
|
|
4
4
|
**************************************************************/
|
|
@@ -29,39 +29,41 @@ export interface IRevokeToken {
|
|
|
29
29
|
didRevoke: boolean;
|
|
30
30
|
}
|
|
31
31
|
/**************************************************************
|
|
32
|
-
*
|
|
32
|
+
* Class
|
|
33
33
|
**************************************************************/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
34
|
+
export declare class OAuth {
|
|
35
|
+
/**
|
|
36
|
+
* Get the URL to authorize a user
|
|
37
|
+
* @param params The params for the request
|
|
38
|
+
* @param params.client_id The OAuth client ID
|
|
39
|
+
* @param params.scope The scope (optional)
|
|
40
|
+
* @param params.state The state (optional)
|
|
41
|
+
* @param params.redirect_uri The redirect URI (optional)
|
|
42
|
+
* @param params.response_type The response type (default: code)
|
|
43
|
+
* @param client The Axios client instance
|
|
44
|
+
* @returns The URL to authorize a user
|
|
45
|
+
*/
|
|
46
|
+
static authorizeUrl({ response_type, redirect_uri, client_id, state, scope }: IAuthorizeUrlParams, client: AxiosInstance): string;
|
|
47
|
+
/**
|
|
48
|
+
* Get an access token
|
|
49
|
+
* @param params The params for the request
|
|
50
|
+
* @param params.code The OAuth code
|
|
51
|
+
* @param params.client_id The OAuth client ID
|
|
52
|
+
* @param params.client_secret The OAuth client secret
|
|
53
|
+
* @param params.redirect_uri The redirect URI (optional)
|
|
54
|
+
* @param params.grant_type The grant type (default: "authorization_code")
|
|
55
|
+
* @param client The Axios client instance
|
|
56
|
+
* @returns An access token
|
|
57
|
+
*/
|
|
58
|
+
static accessToken({ grant_type, client_secret, redirect_uri, client_id, code, }: IAccessTokenParams, client: AxiosInstance): Promise<import("axios").AxiosResponse<IAccessToken, any>>;
|
|
59
|
+
/**
|
|
60
|
+
* Revoke an access token
|
|
61
|
+
* @param params The params for the request
|
|
62
|
+
* @param params.client_id The OAuth client ID
|
|
63
|
+
* @param params.client_secret The OAuth client secret
|
|
64
|
+
* @param params.access_token The OAuth access token
|
|
65
|
+
* @param client The Axios client instance
|
|
66
|
+
* @returns The result of the revoke
|
|
67
|
+
*/
|
|
68
|
+
static revokeToken({ client_secret, access_token, client_id }: IRevokeTokenParams, client: AxiosInstance): Promise<import("axios").AxiosResponse<IRevokeToken, any>>;
|
|
69
|
+
}
|
package/dist/api/oauth.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.OAuth = 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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
8
|
+
class OAuth {
|
|
9
|
+
/**
|
|
10
|
+
* Get the URL to authorize a user
|
|
11
|
+
* @param params The params for the request
|
|
12
|
+
* @param params.client_id The OAuth client ID
|
|
13
|
+
* @param params.scope The scope (optional)
|
|
14
|
+
* @param params.state The state (optional)
|
|
15
|
+
* @param params.redirect_uri The redirect URI (optional)
|
|
16
|
+
* @param params.response_type The response type (default: code)
|
|
17
|
+
* @param client The Axios client instance
|
|
18
|
+
* @returns The URL to authorize a user
|
|
19
|
+
*/
|
|
20
|
+
static authorizeUrl({ response_type = "code", redirect_uri, client_id, state, scope }, client) {
|
|
21
|
+
(0, core_1.requireArgs)({ client_id });
|
|
22
|
+
const params = { response_type, client_id };
|
|
23
|
+
if (redirect_uri)
|
|
24
|
+
params["redirect_uri"] = redirect_uri;
|
|
25
|
+
if (state)
|
|
26
|
+
params["state"] = state;
|
|
27
|
+
if (scope)
|
|
28
|
+
params["scope"] = scope;
|
|
29
|
+
const url = "/oauth/authorize";
|
|
30
|
+
return client.getUri({ url, method: "GET", params });
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get an access token
|
|
34
|
+
* @param params The params for the request
|
|
35
|
+
* @param params.code The OAuth code
|
|
36
|
+
* @param params.client_id The OAuth client ID
|
|
37
|
+
* @param params.client_secret The OAuth client secret
|
|
38
|
+
* @param params.redirect_uri The redirect URI (optional)
|
|
39
|
+
* @param params.grant_type The grant type (default: "authorization_code")
|
|
40
|
+
* @param client The Axios client instance
|
|
41
|
+
* @returns An access token
|
|
42
|
+
*/
|
|
43
|
+
static accessToken({ grant_type = "authorization_code", client_secret, redirect_uri, client_id, code, }, client) {
|
|
44
|
+
(0, core_1.requireArgs)({ client_id, client_secret, code });
|
|
45
|
+
const path = "/oauth/access_token";
|
|
46
|
+
const data = { client_secret, redirect_uri, grant_type, client_id, code };
|
|
47
|
+
return client.post(path, data);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Revoke an access token
|
|
51
|
+
* @param params The params for the request
|
|
52
|
+
* @param params.client_id The OAuth client ID
|
|
53
|
+
* @param params.client_secret The OAuth client secret
|
|
54
|
+
* @param params.access_token The OAuth access token
|
|
55
|
+
* @param client The Axios client instance
|
|
56
|
+
* @returns The result of the revoke
|
|
57
|
+
*/
|
|
58
|
+
static revokeToken({ client_secret, access_token, client_id }, client) {
|
|
59
|
+
(0, core_1.requireArgs)({ client_id, client_secret, access_token });
|
|
60
|
+
const path = "/oauth/revoke_authorization";
|
|
61
|
+
const data = { client_secret, access_token, client_id };
|
|
62
|
+
return client.post(path, data);
|
|
63
|
+
}
|
|
30
64
|
}
|
|
31
|
-
exports.
|
|
32
|
-
/**
|
|
33
|
-
* Get an access token
|
|
34
|
-
* @param client The Webflow client
|
|
35
|
-
* @param params The params for the request
|
|
36
|
-
* @param params.code The OAuth code
|
|
37
|
-
* @param params.client_id The OAuth client ID
|
|
38
|
-
* @param params.client_secret The OAuth client secret
|
|
39
|
-
* @param params.redirect_uri The redirect URI (optional)
|
|
40
|
-
* @param params.grant_type The grant type (default: "authorization_code")
|
|
41
|
-
* @returns An access token
|
|
42
|
-
*/
|
|
43
|
-
function accessToken(client, { grant_type = "authorization_code", client_secret, redirect_uri, client_id, code, }) {
|
|
44
|
-
(0, core_1.requireArgs)({ client_id, client_secret, code });
|
|
45
|
-
const path = "/oauth/access_token";
|
|
46
|
-
const data = { client_secret, redirect_uri, grant_type, client_id, code };
|
|
47
|
-
return client.post(path, data);
|
|
48
|
-
}
|
|
49
|
-
exports.accessToken = accessToken;
|
|
50
|
-
/**
|
|
51
|
-
* Revoke an access token
|
|
52
|
-
* @param client The Webflow client
|
|
53
|
-
* @param params The params for the request
|
|
54
|
-
* @param params.client_id The OAuth client ID
|
|
55
|
-
* @param params.client_secret The OAuth client secret
|
|
56
|
-
* @param params.access_token The OAuth access token
|
|
57
|
-
* @returns The result of the revoke
|
|
58
|
-
*/
|
|
59
|
-
function revokeToken(client, { client_secret, access_token, client_id }) {
|
|
60
|
-
(0, core_1.requireArgs)({ client_id, client_secret, access_token });
|
|
61
|
-
const path = "/oauth/revoke_authorization";
|
|
62
|
-
const data = { client_secret, access_token, client_id };
|
|
63
|
-
return client.post(path, data);
|
|
64
|
-
}
|
|
65
|
-
exports.revokeToken = revokeToken;
|
|
65
|
+
exports.OAuth = OAuth;
|
package/dist/api/site.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import { Webhook, Collection, WebhookFilter } from ".";
|
|
3
|
+
import { WebflowRecord } from "../core";
|
|
2
4
|
/**************************************************************
|
|
3
5
|
* Interfaces
|
|
4
6
|
*************************************************************/
|
|
@@ -20,46 +22,119 @@ export interface IPublishSite {
|
|
|
20
22
|
queued: boolean;
|
|
21
23
|
}
|
|
22
24
|
/**************************************************************
|
|
23
|
-
*
|
|
25
|
+
* Class
|
|
24
26
|
**************************************************************/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
27
|
+
export declare class Site extends WebflowRecord<ISite> implements ISite {
|
|
28
|
+
lastPublished: string;
|
|
29
|
+
previewUrl: string;
|
|
30
|
+
createdOn: string;
|
|
31
|
+
shortName: string;
|
|
32
|
+
timezone: string;
|
|
33
|
+
database: string;
|
|
34
|
+
name: string;
|
|
35
|
+
_id: string;
|
|
36
|
+
/**
|
|
37
|
+
* Get a list of Sites
|
|
38
|
+
* @param client The Axios client instance
|
|
39
|
+
* @returns a list of Sites
|
|
40
|
+
*/
|
|
41
|
+
static list(client: AxiosInstance): Promise<import("axios").AxiosResponse<ISite[], any>>;
|
|
42
|
+
/**
|
|
43
|
+
* Get a single Site
|
|
44
|
+
* @param params The params for the request
|
|
45
|
+
* @param params.siteId The site ID
|
|
46
|
+
* @param params.params The query string parameters (optional)
|
|
47
|
+
* @param client The Axios client instance
|
|
48
|
+
* @returns A single Site
|
|
49
|
+
*/
|
|
50
|
+
static getOne({ siteId }: {
|
|
51
|
+
siteId: string;
|
|
52
|
+
}, client: AxiosInstance): Promise<import("axios").AxiosResponse<ISite, any>>;
|
|
53
|
+
/**
|
|
54
|
+
* Publish a site
|
|
55
|
+
* @param params The params for the request
|
|
56
|
+
* @param params.siteId The site ID
|
|
57
|
+
* @param params.domains The domains to publish to
|
|
58
|
+
* @param client The Axios client instance
|
|
59
|
+
* @returns The publish result
|
|
60
|
+
*/
|
|
61
|
+
static publish({ siteId, domains }: {
|
|
62
|
+
siteId: string;
|
|
63
|
+
domains: string[];
|
|
64
|
+
}, client: AxiosInstance): Promise<import("axios").AxiosResponse<IPublishSite, any>>;
|
|
65
|
+
/**
|
|
66
|
+
* Get a list of domains for a site
|
|
67
|
+
* @param params The params for the request
|
|
68
|
+
* @param params.siteId The site ID
|
|
69
|
+
* @param client The Axios client instance
|
|
70
|
+
* @returns A list of domains
|
|
71
|
+
*/
|
|
72
|
+
static domains({ siteId }: {
|
|
73
|
+
siteId: string;
|
|
74
|
+
}, client: AxiosInstance): Promise<import("axios").AxiosResponse<IDomain[], any>>;
|
|
75
|
+
/**************************************************************
|
|
76
|
+
* Instance Methods
|
|
77
|
+
**************************************************************/
|
|
78
|
+
/**
|
|
79
|
+
* Get a list of domains for a site
|
|
80
|
+
* @returns A list of domains
|
|
81
|
+
*/
|
|
82
|
+
domains(): Promise<IDomain[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Publish a site
|
|
85
|
+
* @param domains The domains to publish to
|
|
86
|
+
* @returns The publish result
|
|
87
|
+
*/
|
|
88
|
+
publishSite(domains: string[]): Promise<IPublishSite>;
|
|
89
|
+
/**
|
|
90
|
+
* Get a single Collection
|
|
91
|
+
* @param params The params for the request
|
|
92
|
+
* @param params.collectionId The collection ID
|
|
93
|
+
* @returns A single Collection
|
|
94
|
+
*/
|
|
95
|
+
collection({ collectionId }: {
|
|
96
|
+
collectionId: string;
|
|
97
|
+
}): Promise<Collection>;
|
|
98
|
+
/**
|
|
99
|
+
* Get a list of Collections
|
|
100
|
+
* @returns A list of Collections
|
|
101
|
+
*/
|
|
102
|
+
collections(): Promise<Collection[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Get a single Webhook
|
|
105
|
+
* @param params The params for the request
|
|
106
|
+
* @param params.webhookId The webhook ID
|
|
107
|
+
* @returns A single Webhook
|
|
108
|
+
*/
|
|
109
|
+
webhook({ webhookId }: {
|
|
110
|
+
webhookId: string;
|
|
111
|
+
}): Promise<Webhook>;
|
|
112
|
+
/**
|
|
113
|
+
* Get a list of Webhooks
|
|
114
|
+
* @returns A list of Webhooks
|
|
115
|
+
*/
|
|
116
|
+
webhooks(): Promise<Webhook[]>;
|
|
117
|
+
/**
|
|
118
|
+
* Remove a Webhook
|
|
119
|
+
* @param params The query string parameters (optional)
|
|
120
|
+
* @param params.webhookId The Webhook ID
|
|
121
|
+
* @returns The result of the removal
|
|
122
|
+
*/
|
|
123
|
+
removeWebhook({ webhookId }: {
|
|
124
|
+
webhookId: string;
|
|
125
|
+
}): Promise<import("./webhook").IRemoveResult>;
|
|
126
|
+
/**
|
|
127
|
+
* Create a new Webhook
|
|
128
|
+
* @param params The params for the request
|
|
129
|
+
* @param params.url The URL to send the webhook to
|
|
130
|
+
* @param params.triggerType The event to trigger the webhook
|
|
131
|
+
* @param params.filter The filter to apply to the webhook (optional: form_submission only)
|
|
132
|
+
* @returns The created webhook
|
|
133
|
+
*/
|
|
134
|
+
createWebhook({ triggerType, filter, url, }: {
|
|
135
|
+
url: string;
|
|
136
|
+
siteId: string;
|
|
137
|
+
triggerType: string;
|
|
138
|
+
filter?: WebhookFilter;
|
|
139
|
+
}): Promise<Webhook>;
|
|
140
|
+
}
|
package/dist/api/site.js
CHANGED
|
@@ -1,59 +1,137 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Site = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
4
5
|
const core_1 = require("../core");
|
|
5
6
|
/**************************************************************
|
|
6
|
-
*
|
|
7
|
+
* Class
|
|
7
8
|
**************************************************************/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
class Site extends core_1.WebflowRecord {
|
|
10
|
+
/**
|
|
11
|
+
* Get a list of Sites
|
|
12
|
+
* @param client The Axios client instance
|
|
13
|
+
* @returns a list of Sites
|
|
14
|
+
*/
|
|
15
|
+
static list(client) {
|
|
16
|
+
const path = "/sites";
|
|
17
|
+
return client.get(path);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get a single Site
|
|
21
|
+
* @param params The params for the request
|
|
22
|
+
* @param params.siteId The site ID
|
|
23
|
+
* @param params.params The query string parameters (optional)
|
|
24
|
+
* @param client The Axios client instance
|
|
25
|
+
* @returns A single Site
|
|
26
|
+
*/
|
|
27
|
+
static getOne({ siteId }, client) {
|
|
28
|
+
(0, core_1.requireArgs)({ siteId });
|
|
29
|
+
const path = `/sites/${siteId}`;
|
|
30
|
+
return client.get(path);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Publish a site
|
|
34
|
+
* @param params The params for the request
|
|
35
|
+
* @param params.siteId The site ID
|
|
36
|
+
* @param params.domains The domains to publish to
|
|
37
|
+
* @param client The Axios client instance
|
|
38
|
+
* @returns The publish result
|
|
39
|
+
*/
|
|
40
|
+
static publish({ siteId, domains }, client) {
|
|
41
|
+
(0, core_1.requireArgs)({ siteId, domains });
|
|
42
|
+
const path = `/sites/${siteId}/publish`;
|
|
43
|
+
return client.post(path, { domains });
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get a list of domains for a site
|
|
47
|
+
* @param params The params for the request
|
|
48
|
+
* @param params.siteId The site ID
|
|
49
|
+
* @param client The Axios client instance
|
|
50
|
+
* @returns A list of domains
|
|
51
|
+
*/
|
|
52
|
+
static domains({ siteId }, client) {
|
|
53
|
+
(0, core_1.requireArgs)({ siteId });
|
|
54
|
+
const path = `/sites/${siteId}/domains`;
|
|
55
|
+
return client.get(path);
|
|
56
|
+
}
|
|
57
|
+
/**************************************************************
|
|
58
|
+
* Instance Methods
|
|
59
|
+
**************************************************************/
|
|
60
|
+
/**
|
|
61
|
+
* Get a list of domains for a site
|
|
62
|
+
* @returns A list of domains
|
|
63
|
+
*/
|
|
64
|
+
async domains() {
|
|
65
|
+
const res = await Site.domains({ siteId: this._id }, this.client);
|
|
66
|
+
return res.data;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Publish a site
|
|
70
|
+
* @param domains The domains to publish to
|
|
71
|
+
* @returns The publish result
|
|
72
|
+
*/
|
|
73
|
+
async publishSite(domains) {
|
|
74
|
+
const res = await Site.publish({ siteId: this._id, domains }, this.client);
|
|
75
|
+
return res.data;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get a single Collection
|
|
79
|
+
* @param params The params for the request
|
|
80
|
+
* @param params.collectionId The collection ID
|
|
81
|
+
* @returns A single Collection
|
|
82
|
+
*/
|
|
83
|
+
async collection({ collectionId }) {
|
|
84
|
+
const res = await _1.Collection.getOne({ collectionId }, this.client);
|
|
85
|
+
return new _1.Collection(this.client, res);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get a list of Collections
|
|
89
|
+
* @returns A list of Collections
|
|
90
|
+
*/
|
|
91
|
+
async collections() {
|
|
92
|
+
const res = await _1.Collection.list({ siteId: this._id }, this.client);
|
|
93
|
+
return res.data.map((data) => new _1.Collection(this.client, { ...res, data }));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get a single Webhook
|
|
97
|
+
* @param params The params for the request
|
|
98
|
+
* @param params.webhookId The webhook ID
|
|
99
|
+
* @returns A single Webhook
|
|
100
|
+
*/
|
|
101
|
+
async webhook({ webhookId }) {
|
|
102
|
+
const res = await _1.Webhook.getOne({ siteId: this._id, webhookId }, this.client);
|
|
103
|
+
return new _1.Webhook(this.client, res);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get a list of Webhooks
|
|
107
|
+
* @returns A list of Webhooks
|
|
108
|
+
*/
|
|
109
|
+
async webhooks() {
|
|
110
|
+
const res = await _1.Webhook.list({ siteId: this._id }, this.client);
|
|
111
|
+
return res.data.map((data) => new _1.Webhook(this.client, { ...res, data }));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Remove a Webhook
|
|
115
|
+
* @param params The query string parameters (optional)
|
|
116
|
+
* @param params.webhookId The Webhook ID
|
|
117
|
+
* @returns The result of the removal
|
|
118
|
+
*/
|
|
119
|
+
async removeWebhook({ webhookId }) {
|
|
120
|
+
const res = await _1.Webhook.remove({ siteId: this._id, webhookId }, this.client);
|
|
121
|
+
return res.data;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Create a new Webhook
|
|
125
|
+
* @param params The params for the request
|
|
126
|
+
* @param params.url The URL to send the webhook to
|
|
127
|
+
* @param params.triggerType The event to trigger the webhook
|
|
128
|
+
* @param params.filter The filter to apply to the webhook (optional: form_submission only)
|
|
129
|
+
* @returns The created webhook
|
|
130
|
+
*/
|
|
131
|
+
async createWebhook({ triggerType, filter, url, }) {
|
|
132
|
+
const _params = { url, siteId: this._id, triggerType, filter };
|
|
133
|
+
const res = await _1.Webhook.create(_params, this.client);
|
|
134
|
+
return new _1.Webhook(this.client, res);
|
|
135
|
+
}
|
|
17
136
|
}
|
|
18
|
-
exports.
|
|
19
|
-
/**
|
|
20
|
-
* Get a single Site
|
|
21
|
-
* @param client The Webflow client
|
|
22
|
-
* @param params The params for the request
|
|
23
|
-
* @param params.siteId The site ID
|
|
24
|
-
* @param params.params The query string parameters (optional)
|
|
25
|
-
* @returns A single Site
|
|
26
|
-
*/
|
|
27
|
-
function getOne(client, { siteId, params }) {
|
|
28
|
-
(0, core_1.requireArgs)({ siteId });
|
|
29
|
-
const path = `/sites/${siteId}`;
|
|
30
|
-
return client.get(path, { params });
|
|
31
|
-
}
|
|
32
|
-
exports.getOne = getOne;
|
|
33
|
-
/**
|
|
34
|
-
* Publish a site
|
|
35
|
-
* @param client The Webflow client
|
|
36
|
-
* @param params The params for the request
|
|
37
|
-
* @param params.siteId The site ID
|
|
38
|
-
* @param params.domains The domains to publish to
|
|
39
|
-
* @returns The publish result
|
|
40
|
-
*/
|
|
41
|
-
function publish(client, { siteId, domains }) {
|
|
42
|
-
(0, core_1.requireArgs)({ siteId, domains });
|
|
43
|
-
const path = `/sites/${siteId}/publish`;
|
|
44
|
-
return client.post(path, { domains });
|
|
45
|
-
}
|
|
46
|
-
exports.publish = publish;
|
|
47
|
-
/**
|
|
48
|
-
* Get a list of domains for a site
|
|
49
|
-
* @param client The Webflow client
|
|
50
|
-
* @param params The params for the request
|
|
51
|
-
* @param params.siteId The site ID
|
|
52
|
-
* @returns A list of domains
|
|
53
|
-
*/
|
|
54
|
-
function domains(client, { siteId }) {
|
|
55
|
-
(0, core_1.requireArgs)({ siteId });
|
|
56
|
-
const path = `/sites/${siteId}/domains`;
|
|
57
|
-
return client.get(path);
|
|
58
|
-
}
|
|
59
|
-
exports.domains = domains;
|
|
137
|
+
exports.Site = Site;
|