@notionhq/client 5.26.0 → 5.27.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/README.md +130 -129
- package/build/package.json +4 -3
- package/build/src/Client.d.ts +1869 -130
- package/build/src/Client.d.ts.map +1 -1
- package/build/src/Client.js +86 -571
- package/build/src/Client.js.map +1 -1
- package/build/src/api-endpoint-methods.d.ts +920 -0
- package/build/src/api-endpoint-methods.d.ts.map +1 -0
- package/build/src/api-endpoint-methods.js +171 -0
- package/build/src/api-endpoint-methods.js.map +1 -0
- package/build/src/api-endpoints/agent-skills.d.ts +68 -0
- package/build/src/api-endpoints/agent-skills.d.ts.map +1 -0
- package/build/src/api-endpoints/agent-skills.js +36 -0
- package/build/src/api-endpoints/agent-skills.js.map +1 -0
- package/build/src/api-endpoints/agents.d.ts +173 -146
- package/build/src/api-endpoints/agents.d.ts.map +1 -1
- package/build/src/api-endpoints/agents.js.map +1 -1
- package/build/src/api-endpoints/data-sources.d.ts +1 -0
- package/build/src/api-endpoints/data-sources.d.ts.map +1 -1
- package/build/src/api-endpoints/data-sources.js.map +1 -1
- package/build/src/api-endpoints/databases.d.ts +3 -1
- package/build/src/api-endpoints/databases.d.ts.map +1 -1
- package/build/src/api-endpoints/databases.js +1 -0
- package/build/src/api-endpoints/databases.js.map +1 -1
- package/build/src/api-endpoints/file-uploads.d.ts.map +1 -1
- package/build/src/api-endpoints/file-uploads.js.map +1 -1
- package/build/src/api-endpoints/pages.d.ts.map +1 -1
- package/build/src/api-endpoints/pages.js.map +1 -1
- package/build/src/api-endpoints/users.d.ts.map +1 -1
- package/build/src/api-endpoints/users.js.map +1 -1
- package/build/src/api-endpoints.d.ts +1 -0
- package/build/src/api-endpoints.d.ts.map +1 -1
- package/build/src/api-endpoints.js +1 -0
- package/build/src/api-endpoints.js.map +1 -1
- package/build/src/errors.d.ts +11 -0
- package/build/src/errors.d.ts.map +1 -1
- package/build/src/errors.js +20 -1
- package/build/src/errors.js.map +1 -1
- package/build/src/helpers.d.ts +4 -4
- package/build/src/helpers.d.ts.map +1 -1
- package/build/src/helpers.js.map +1 -1
- package/build/src/index.d.ts +2 -2
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +2 -1
- package/build/src/index.js.map +1 -1
- package/build/src/webhooks.d.ts +12 -19
- package/build/src/webhooks.d.ts.map +1 -1
- package/build/src/webhooks.js +27 -35
- package/build/src/webhooks.js.map +1 -1
- package/package.json +4 -3
package/build/src/Client.js
CHANGED
|
@@ -10,8 +10,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _Client_auth, _Client_logLevel, _Client_logger, _Client_prefixUrl, _Client_timeoutMs, _Client_notionVersion, _Client_fetch, _Client_agent, _Client_userAgent, _Client_maxRetries, _Client_initialRetryDelayMs, _Client_maxRetryDelayMs;
|
|
13
|
+
var _Client_endpointMethods, _Client_auth, _Client_logLevel, _Client_logger, _Client_prefixUrl, _Client_timeoutMs, _Client_notionVersion, _Client_fetch, _Client_agent, _Client_userAgent, _Client_maxRetries, _Client_initialRetryDelayMs, _Client_maxRetryDelayMs, _Client_dangerouslyAllowBrowser;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const api_endpoint_methods_1 = require("./api-endpoint-methods");
|
|
15
16
|
const logging_1 = require("./logging");
|
|
16
17
|
const errors_1 = require("./errors");
|
|
17
18
|
const utils_1 = require("./utils");
|
|
@@ -20,9 +21,27 @@ const api_endpoints_1 = require("./api-endpoints");
|
|
|
20
21
|
const meeting_notes_1 = require("./api-endpoints/meeting-notes");
|
|
21
22
|
const package_json_1 = require("../package.json");
|
|
22
23
|
const START_CURSOR_PARAM_NAME = "start_cursor";
|
|
24
|
+
/**
|
|
25
|
+
* True inside a browser page, web worker, or service worker: the places where
|
|
26
|
+
* every visitor downloads the script, so a token in it is public. Node, Bun,
|
|
27
|
+
* Deno, and edge runtimes have neither `window.document` nor
|
|
28
|
+
* `WorkerGlobalScope`. Test runners that emulate a browser, such as jsdom,
|
|
29
|
+
* also count as a browser here.
|
|
30
|
+
*/
|
|
31
|
+
function isBrowserEnvironment() {
|
|
32
|
+
const maybeWindow = globalThis.window;
|
|
33
|
+
if (maybeWindow !== undefined && maybeWindow.document !== undefined) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return "WorkerGlobalScope" in globalThis;
|
|
37
|
+
}
|
|
23
38
|
class Client {
|
|
24
39
|
constructor(options) {
|
|
25
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
41
|
+
_Client_endpointMethods.set(this, (0, api_endpoint_methods_1.createEndpointMethods)({
|
|
42
|
+
request: args => this.request(args),
|
|
43
|
+
warnUnknownParams: (args, endpoint) => this.warnUnknownParams(args, endpoint),
|
|
44
|
+
}));
|
|
26
45
|
_Client_auth.set(this, void 0);
|
|
27
46
|
_Client_logLevel.set(this, void 0);
|
|
28
47
|
_Client_logger.set(this, void 0);
|
|
@@ -35,129 +54,29 @@ class Client {
|
|
|
35
54
|
_Client_maxRetries.set(this, void 0);
|
|
36
55
|
_Client_initialRetryDelayMs.set(this, void 0);
|
|
37
56
|
_Client_maxRetryDelayMs.set(this, void 0);
|
|
57
|
+
_Client_dangerouslyAllowBrowser.set(this, void 0);
|
|
38
58
|
/*
|
|
39
59
|
* Notion API endpoints
|
|
40
60
|
*/
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
path: api_endpoints_1.getAgent.path(args),
|
|
49
|
-
method: api_endpoints_1.getAgent.method,
|
|
50
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.getAgent.queryParams),
|
|
51
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.getAgent.bodyParams),
|
|
52
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
/**
|
|
56
|
-
* Query agents
|
|
57
|
-
*/
|
|
58
|
-
query: (args) => {
|
|
59
|
-
this.warnUnknownParams(args, api_endpoints_1.queryAgents);
|
|
60
|
-
return this.request({
|
|
61
|
-
path: api_endpoints_1.queryAgents.path(),
|
|
62
|
-
method: api_endpoints_1.queryAgents.method,
|
|
63
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.queryAgents.queryParams),
|
|
64
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.queryAgents.bodyParams),
|
|
65
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
/**
|
|
69
|
-
* Retrieve agent insights
|
|
70
|
-
*/
|
|
71
|
-
retrieveInsights: (args) => {
|
|
72
|
-
this.warnUnknownParams(args, api_endpoints_1.getInsights);
|
|
73
|
-
return this.request({
|
|
74
|
-
path: api_endpoints_1.getInsights.path(args),
|
|
75
|
-
method: api_endpoints_1.getInsights.method,
|
|
76
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.getInsights.queryParams),
|
|
77
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.getInsights.bodyParams),
|
|
78
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
/**
|
|
82
|
-
* Update an agent's credit limit
|
|
83
|
-
*/
|
|
84
|
-
updateCreditLimit: (args) => {
|
|
85
|
-
this.warnUnknownParams(args, api_endpoints_1.updateAgentCreditLimit);
|
|
86
|
-
return this.request({
|
|
87
|
-
path: api_endpoints_1.updateAgentCreditLimit.path(args),
|
|
88
|
-
method: api_endpoints_1.updateAgentCreditLimit.method,
|
|
89
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.updateAgentCreditLimit.queryParams),
|
|
90
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.updateAgentCreditLimit.bodyParams),
|
|
91
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
|
-
/**
|
|
95
|
-
* Update an agent's status
|
|
96
|
-
*/
|
|
97
|
-
updateStatus: (args) => {
|
|
98
|
-
this.warnUnknownParams(args, api_endpoints_1.updateAgentStatus);
|
|
99
|
-
return this.request({
|
|
100
|
-
path: api_endpoints_1.updateAgentStatus.path(args),
|
|
101
|
-
method: api_endpoints_1.updateAgentStatus.method,
|
|
102
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.updateAgentStatus.queryParams),
|
|
103
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.updateAgentStatus.bodyParams),
|
|
104
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
105
|
-
});
|
|
106
|
-
},
|
|
107
|
-
/**
|
|
108
|
-
* Delete an agent
|
|
109
|
-
*/
|
|
110
|
-
delete: (args) => {
|
|
111
|
-
this.warnUnknownParams(args, api_endpoints_1.deleteAgent);
|
|
112
|
-
return this.request({
|
|
113
|
-
path: api_endpoints_1.deleteAgent.path(args),
|
|
114
|
-
method: api_endpoints_1.deleteAgent.method,
|
|
115
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.deleteAgent.queryParams),
|
|
116
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.deleteAgent.bodyParams),
|
|
117
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
118
|
-
});
|
|
119
|
-
},
|
|
120
|
-
/**
|
|
121
|
-
* Apply many agent operations
|
|
122
|
-
*/
|
|
123
|
-
batch: (args) => {
|
|
124
|
-
this.warnUnknownParams(args, api_endpoints_1.agentBatch);
|
|
125
|
-
return this.request({
|
|
126
|
-
path: api_endpoints_1.agentBatch.path(),
|
|
127
|
-
method: api_endpoints_1.agentBatch.method,
|
|
128
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.agentBatch.queryParams),
|
|
129
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.agentBatch.bodyParams),
|
|
130
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
131
|
-
});
|
|
132
|
-
},
|
|
61
|
+
this.plugins = {
|
|
62
|
+
list: __classPrivateFieldGet(this, _Client_endpointMethods, "f").plugins.list,
|
|
63
|
+
retrieve: (args) => __classPrivateFieldGet(this, _Client_endpointMethods, "f").plugins.retrieve({
|
|
64
|
+
...args,
|
|
65
|
+
// Plugin IDs can be tag IDs containing URL delimiters, not just UUIDs.
|
|
66
|
+
id: encodeURIComponent(args.id),
|
|
67
|
+
}),
|
|
133
68
|
};
|
|
69
|
+
this.skills = __classPrivateFieldGet(this, _Client_endpointMethods, "f").skills;
|
|
70
|
+
this.agents = __classPrivateFieldGet(this, _Client_endpointMethods, "f").agents;
|
|
134
71
|
this.sessions = {
|
|
135
72
|
/**
|
|
136
73
|
* Retrieve a session
|
|
137
74
|
*/
|
|
138
|
-
retrieve: (
|
|
139
|
-
this.warnUnknownParams(args, api_endpoints_1.retrieveSession);
|
|
140
|
-
return this.request({
|
|
141
|
-
path: api_endpoints_1.retrieveSession.path(args),
|
|
142
|
-
method: api_endpoints_1.retrieveSession.method,
|
|
143
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.retrieveSession.queryParams),
|
|
144
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.retrieveSession.bodyParams),
|
|
145
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
146
|
-
});
|
|
147
|
-
},
|
|
75
|
+
retrieve: __classPrivateFieldGet(this, _Client_endpointMethods, "f").sessions.retrieve,
|
|
148
76
|
/**
|
|
149
77
|
* Update a session
|
|
150
78
|
*/
|
|
151
|
-
update: (
|
|
152
|
-
this.warnUnknownParams(args, api_endpoints_1.updateSession);
|
|
153
|
-
return this.request({
|
|
154
|
-
path: api_endpoints_1.updateSession.path(),
|
|
155
|
-
method: api_endpoints_1.updateSession.method,
|
|
156
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.updateSession.queryParams),
|
|
157
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.updateSession.bodyParams),
|
|
158
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
159
|
-
});
|
|
160
|
-
},
|
|
79
|
+
update: __classPrivateFieldGet(this, _Client_endpointMethods, "f").sessions.update,
|
|
161
80
|
/**
|
|
162
81
|
* Open a session stream
|
|
163
82
|
*/
|
|
@@ -175,140 +94,36 @@ class Client {
|
|
|
175
94
|
/**
|
|
176
95
|
* Cancel a session
|
|
177
96
|
*/
|
|
178
|
-
cancel: (
|
|
179
|
-
this.warnUnknownParams(args, api_endpoints_1.cancelSession);
|
|
180
|
-
return this.request({
|
|
181
|
-
path: api_endpoints_1.cancelSession.path(args),
|
|
182
|
-
method: api_endpoints_1.cancelSession.method,
|
|
183
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.cancelSession.queryParams),
|
|
184
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.cancelSession.bodyParams),
|
|
185
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
186
|
-
});
|
|
187
|
-
},
|
|
97
|
+
cancel: __classPrivateFieldGet(this, _Client_endpointMethods, "f").sessions.cancel,
|
|
188
98
|
/**
|
|
189
99
|
* Query sessions
|
|
190
100
|
*/
|
|
191
|
-
query: (
|
|
192
|
-
this.warnUnknownParams(args, api_endpoints_1.querySessions);
|
|
193
|
-
return this.request({
|
|
194
|
-
path: api_endpoints_1.querySessions.path(),
|
|
195
|
-
method: api_endpoints_1.querySessions.method,
|
|
196
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.querySessions.queryParams),
|
|
197
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.querySessions.bodyParams),
|
|
198
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
199
|
-
});
|
|
200
|
-
},
|
|
101
|
+
query: __classPrivateFieldGet(this, _Client_endpointMethods, "f").sessions.query,
|
|
201
102
|
/**
|
|
202
103
|
* Query session events
|
|
203
104
|
*/
|
|
204
|
-
queryEvents: (
|
|
205
|
-
this.warnUnknownParams(args, api_endpoints_1.querySessionEvents);
|
|
206
|
-
return this.request({
|
|
207
|
-
path: api_endpoints_1.querySessionEvents.path(args),
|
|
208
|
-
method: api_endpoints_1.querySessionEvents.method,
|
|
209
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.querySessionEvents.queryParams),
|
|
210
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.querySessionEvents.bodyParams),
|
|
211
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
212
|
-
});
|
|
213
|
-
},
|
|
214
|
-
};
|
|
215
|
-
this.asyncTasks = {
|
|
216
|
-
/**
|
|
217
|
-
* Retrieve an async task
|
|
218
|
-
*/
|
|
219
|
-
retrieve: (args) => {
|
|
220
|
-
this.warnUnknownParams(args, api_endpoints_1.getAsyncTask);
|
|
221
|
-
return this.request({
|
|
222
|
-
path: api_endpoints_1.getAsyncTask.path(args),
|
|
223
|
-
method: api_endpoints_1.getAsyncTask.method,
|
|
224
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.getAsyncTask.queryParams),
|
|
225
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.getAsyncTask.bodyParams),
|
|
226
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
227
|
-
});
|
|
228
|
-
},
|
|
105
|
+
queryEvents: __classPrivateFieldGet(this, _Client_endpointMethods, "f").sessions.queryEvents,
|
|
229
106
|
};
|
|
107
|
+
this.asyncTasks = __classPrivateFieldGet(this, _Client_endpointMethods, "f").asyncTasks;
|
|
230
108
|
this.blocks = {
|
|
231
109
|
/**
|
|
232
110
|
* Retrieve block
|
|
233
111
|
*/
|
|
234
|
-
retrieve: (
|
|
235
|
-
this.warnUnknownParams(args, api_endpoints_1.getBlock);
|
|
236
|
-
return this.request({
|
|
237
|
-
path: api_endpoints_1.getBlock.path(args),
|
|
238
|
-
method: api_endpoints_1.getBlock.method,
|
|
239
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.getBlock.queryParams),
|
|
240
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.getBlock.bodyParams),
|
|
241
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
242
|
-
});
|
|
243
|
-
},
|
|
112
|
+
retrieve: __classPrivateFieldGet(this, _Client_endpointMethods, "f").blocks.retrieve,
|
|
244
113
|
/**
|
|
245
114
|
* Update block
|
|
246
115
|
*/
|
|
247
|
-
update: (
|
|
248
|
-
this.warnUnknownParams(args, api_endpoints_1.updateBlock);
|
|
249
|
-
return this.request({
|
|
250
|
-
path: api_endpoints_1.updateBlock.path(args),
|
|
251
|
-
method: api_endpoints_1.updateBlock.method,
|
|
252
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.updateBlock.queryParams),
|
|
253
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.updateBlock.bodyParams),
|
|
254
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
255
|
-
});
|
|
256
|
-
},
|
|
116
|
+
update: __classPrivateFieldGet(this, _Client_endpointMethods, "f").blocks.update,
|
|
257
117
|
/**
|
|
258
118
|
* Delete block
|
|
259
119
|
*/
|
|
260
|
-
delete: (
|
|
261
|
-
|
|
262
|
-
return this.request({
|
|
263
|
-
path: api_endpoints_1.deleteBlock.path(args),
|
|
264
|
-
method: api_endpoints_1.deleteBlock.method,
|
|
265
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.deleteBlock.queryParams),
|
|
266
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.deleteBlock.bodyParams),
|
|
267
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
268
|
-
});
|
|
269
|
-
},
|
|
270
|
-
children: {
|
|
271
|
-
/**
|
|
272
|
-
* Append block children
|
|
273
|
-
*/
|
|
274
|
-
append: (args) => {
|
|
275
|
-
this.warnUnknownParams(args, api_endpoints_1.appendBlockChildren);
|
|
276
|
-
return this.request({
|
|
277
|
-
path: api_endpoints_1.appendBlockChildren.path(args),
|
|
278
|
-
method: api_endpoints_1.appendBlockChildren.method,
|
|
279
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.appendBlockChildren.queryParams),
|
|
280
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.appendBlockChildren.bodyParams),
|
|
281
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
282
|
-
});
|
|
283
|
-
},
|
|
284
|
-
/**
|
|
285
|
-
* Retrieve block children
|
|
286
|
-
*/
|
|
287
|
-
list: (args) => {
|
|
288
|
-
this.warnUnknownParams(args, api_endpoints_1.listBlockChildren);
|
|
289
|
-
return this.request({
|
|
290
|
-
path: api_endpoints_1.listBlockChildren.path(args),
|
|
291
|
-
method: api_endpoints_1.listBlockChildren.method,
|
|
292
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.listBlockChildren.queryParams),
|
|
293
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.listBlockChildren.bodyParams),
|
|
294
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
295
|
-
});
|
|
296
|
-
},
|
|
297
|
-
},
|
|
120
|
+
delete: __classPrivateFieldGet(this, _Client_endpointMethods, "f").blocks.delete,
|
|
121
|
+
children: __classPrivateFieldGet(this, _Client_endpointMethods, "f").blocks.children,
|
|
298
122
|
meetingNotes: {
|
|
299
123
|
/**
|
|
300
124
|
* Create a meeting note
|
|
301
125
|
*/
|
|
302
|
-
create: (
|
|
303
|
-
this.warnUnknownParams(args, meeting_notes_1.createMeetingNote);
|
|
304
|
-
return this.request({
|
|
305
|
-
path: meeting_notes_1.createMeetingNote.path(),
|
|
306
|
-
method: meeting_notes_1.createMeetingNote.method,
|
|
307
|
-
query: (0, utils_1.pick)(args, meeting_notes_1.createMeetingNote.queryParams),
|
|
308
|
-
body: (0, utils_1.pick)(args, meeting_notes_1.createMeetingNote.bodyParams),
|
|
309
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
310
|
-
});
|
|
311
|
-
},
|
|
126
|
+
create: __classPrivateFieldGet(this, _Client_endpointMethods, "f").blocks.meetingNotes.create,
|
|
312
127
|
/**
|
|
313
128
|
* Query meeting notes
|
|
314
129
|
*/
|
|
@@ -323,167 +138,25 @@ class Client {
|
|
|
323
138
|
},
|
|
324
139
|
},
|
|
325
140
|
};
|
|
326
|
-
this.databases =
|
|
327
|
-
|
|
328
|
-
* Retrieve a database
|
|
329
|
-
*/
|
|
330
|
-
retrieve: (args) => {
|
|
331
|
-
this.warnUnknownParams(args, api_endpoints_1.getDatabase);
|
|
332
|
-
return this.request({
|
|
333
|
-
path: api_endpoints_1.getDatabase.path(args),
|
|
334
|
-
method: api_endpoints_1.getDatabase.method,
|
|
335
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.getDatabase.queryParams),
|
|
336
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.getDatabase.bodyParams),
|
|
337
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
338
|
-
});
|
|
339
|
-
},
|
|
340
|
-
/**
|
|
341
|
-
* Create a database
|
|
342
|
-
*/
|
|
343
|
-
create: (args) => {
|
|
344
|
-
this.warnUnknownParams(args, api_endpoints_1.createDatabase);
|
|
345
|
-
return this.request({
|
|
346
|
-
path: api_endpoints_1.createDatabase.path(),
|
|
347
|
-
method: api_endpoints_1.createDatabase.method,
|
|
348
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.createDatabase.queryParams),
|
|
349
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.createDatabase.bodyParams),
|
|
350
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
351
|
-
});
|
|
352
|
-
},
|
|
353
|
-
/**
|
|
354
|
-
* Update a database
|
|
355
|
-
*/
|
|
356
|
-
update: (args) => {
|
|
357
|
-
this.warnUnknownParams(args, api_endpoints_1.updateDatabase);
|
|
358
|
-
return this.request({
|
|
359
|
-
path: api_endpoints_1.updateDatabase.path(args),
|
|
360
|
-
method: api_endpoints_1.updateDatabase.method,
|
|
361
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.updateDatabase.queryParams),
|
|
362
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.updateDatabase.bodyParams),
|
|
363
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
364
|
-
});
|
|
365
|
-
},
|
|
366
|
-
};
|
|
367
|
-
this.dataSources = {
|
|
368
|
-
/**
|
|
369
|
-
* Retrieve a data source
|
|
370
|
-
*/
|
|
371
|
-
retrieve: (args) => {
|
|
372
|
-
this.warnUnknownParams(args, api_endpoints_1.getDataSource);
|
|
373
|
-
return this.request({
|
|
374
|
-
path: api_endpoints_1.getDataSource.path(args),
|
|
375
|
-
method: api_endpoints_1.getDataSource.method,
|
|
376
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.getDataSource.queryParams),
|
|
377
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.getDataSource.bodyParams),
|
|
378
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
379
|
-
});
|
|
380
|
-
},
|
|
381
|
-
/**
|
|
382
|
-
* Query a data source
|
|
383
|
-
*/
|
|
384
|
-
query: (args) => {
|
|
385
|
-
this.warnUnknownParams(args, api_endpoints_1.queryDataSource);
|
|
386
|
-
return this.request({
|
|
387
|
-
path: api_endpoints_1.queryDataSource.path(args),
|
|
388
|
-
method: api_endpoints_1.queryDataSource.method,
|
|
389
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.queryDataSource.queryParams),
|
|
390
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.queryDataSource.bodyParams),
|
|
391
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
392
|
-
});
|
|
393
|
-
},
|
|
394
|
-
/**
|
|
395
|
-
* Create a data source
|
|
396
|
-
*/
|
|
397
|
-
create: (args) => {
|
|
398
|
-
this.warnUnknownParams(args, api_endpoints_1.createDataSource);
|
|
399
|
-
return this.request({
|
|
400
|
-
path: api_endpoints_1.createDataSource.path(),
|
|
401
|
-
method: api_endpoints_1.createDataSource.method,
|
|
402
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.createDataSource.queryParams),
|
|
403
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.createDataSource.bodyParams),
|
|
404
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
405
|
-
});
|
|
406
|
-
},
|
|
407
|
-
/**
|
|
408
|
-
* Update a data source
|
|
409
|
-
*/
|
|
410
|
-
update: (args) => {
|
|
411
|
-
this.warnUnknownParams(args, api_endpoints_1.updateDataSource);
|
|
412
|
-
return this.request({
|
|
413
|
-
path: api_endpoints_1.updateDataSource.path(args),
|
|
414
|
-
method: api_endpoints_1.updateDataSource.method,
|
|
415
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.updateDataSource.queryParams),
|
|
416
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.updateDataSource.bodyParams),
|
|
417
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
418
|
-
});
|
|
419
|
-
},
|
|
420
|
-
/**
|
|
421
|
-
* List page templates that are available for a data source
|
|
422
|
-
*/
|
|
423
|
-
listTemplates: (args) => {
|
|
424
|
-
this.warnUnknownParams(args, api_endpoints_1.listDataSourceTemplates);
|
|
425
|
-
return this.request({
|
|
426
|
-
path: api_endpoints_1.listDataSourceTemplates.path(args),
|
|
427
|
-
method: api_endpoints_1.listDataSourceTemplates.method,
|
|
428
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.listDataSourceTemplates.queryParams),
|
|
429
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.listDataSourceTemplates.bodyParams),
|
|
430
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
431
|
-
});
|
|
432
|
-
},
|
|
433
|
-
};
|
|
141
|
+
this.databases = __classPrivateFieldGet(this, _Client_endpointMethods, "f").databases;
|
|
142
|
+
this.dataSources = __classPrivateFieldGet(this, _Client_endpointMethods, "f").dataSources;
|
|
434
143
|
this.pages = {
|
|
435
144
|
/**
|
|
436
145
|
* Create a page
|
|
437
146
|
*/
|
|
438
|
-
create: (
|
|
439
|
-
this.warnUnknownParams(args, api_endpoints_1.createPage);
|
|
440
|
-
return this.request({
|
|
441
|
-
path: api_endpoints_1.createPage.path(),
|
|
442
|
-
method: api_endpoints_1.createPage.method,
|
|
443
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.createPage.queryParams),
|
|
444
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.createPage.bodyParams),
|
|
445
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
446
|
-
});
|
|
447
|
-
},
|
|
147
|
+
create: __classPrivateFieldGet(this, _Client_endpointMethods, "f").pages.create,
|
|
448
148
|
/**
|
|
449
149
|
* Retrieve a page
|
|
450
150
|
*/
|
|
451
|
-
retrieve: (
|
|
452
|
-
this.warnUnknownParams(args, api_endpoints_1.getPage);
|
|
453
|
-
return this.request({
|
|
454
|
-
path: api_endpoints_1.getPage.path(args),
|
|
455
|
-
method: api_endpoints_1.getPage.method,
|
|
456
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.getPage.queryParams),
|
|
457
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.getPage.bodyParams),
|
|
458
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
459
|
-
});
|
|
460
|
-
},
|
|
151
|
+
retrieve: __classPrivateFieldGet(this, _Client_endpointMethods, "f").pages.retrieve,
|
|
461
152
|
/**
|
|
462
153
|
* Update page properties
|
|
463
154
|
*/
|
|
464
|
-
update: (
|
|
465
|
-
this.warnUnknownParams(args, api_endpoints_1.updatePage);
|
|
466
|
-
return this.request({
|
|
467
|
-
path: api_endpoints_1.updatePage.path(args),
|
|
468
|
-
method: api_endpoints_1.updatePage.method,
|
|
469
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.updatePage.queryParams),
|
|
470
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.updatePage.bodyParams),
|
|
471
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
472
|
-
});
|
|
473
|
-
},
|
|
155
|
+
update: __classPrivateFieldGet(this, _Client_endpointMethods, "f").pages.update,
|
|
474
156
|
/**
|
|
475
157
|
* Move a page
|
|
476
158
|
*/
|
|
477
|
-
move: (
|
|
478
|
-
this.warnUnknownParams(args, api_endpoints_1.movePage);
|
|
479
|
-
return this.request({
|
|
480
|
-
path: api_endpoints_1.movePage.path(args),
|
|
481
|
-
method: api_endpoints_1.movePage.method,
|
|
482
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.movePage.queryParams),
|
|
483
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.movePage.bodyParams),
|
|
484
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
485
|
-
});
|
|
486
|
-
},
|
|
159
|
+
move: __classPrivateFieldGet(this, _Client_endpointMethods, "f").pages.move,
|
|
487
160
|
/**
|
|
488
161
|
* Retrieve a page as markdown
|
|
489
162
|
*/
|
|
@@ -508,63 +181,9 @@ class Client {
|
|
|
508
181
|
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
509
182
|
});
|
|
510
183
|
},
|
|
511
|
-
properties:
|
|
512
|
-
/**
|
|
513
|
-
* Retrieve page property
|
|
514
|
-
*/
|
|
515
|
-
retrieve: (args) => {
|
|
516
|
-
this.warnUnknownParams(args, api_endpoints_1.getPageProperty);
|
|
517
|
-
return this.request({
|
|
518
|
-
path: api_endpoints_1.getPageProperty.path(args),
|
|
519
|
-
method: api_endpoints_1.getPageProperty.method,
|
|
520
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.getPageProperty.queryParams),
|
|
521
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.getPageProperty.bodyParams),
|
|
522
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
523
|
-
});
|
|
524
|
-
},
|
|
525
|
-
},
|
|
526
|
-
};
|
|
527
|
-
this.users = {
|
|
528
|
-
/**
|
|
529
|
-
* Retrieve a user
|
|
530
|
-
*/
|
|
531
|
-
retrieve: (args) => {
|
|
532
|
-
this.warnUnknownParams(args, api_endpoints_1.getUser);
|
|
533
|
-
return this.request({
|
|
534
|
-
path: api_endpoints_1.getUser.path(args),
|
|
535
|
-
method: api_endpoints_1.getUser.method,
|
|
536
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.getUser.queryParams),
|
|
537
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.getUser.bodyParams),
|
|
538
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
539
|
-
});
|
|
540
|
-
},
|
|
541
|
-
/**
|
|
542
|
-
* List all users
|
|
543
|
-
*/
|
|
544
|
-
list: (args) => {
|
|
545
|
-
this.warnUnknownParams(args, api_endpoints_1.listUsers);
|
|
546
|
-
return this.request({
|
|
547
|
-
path: api_endpoints_1.listUsers.path(),
|
|
548
|
-
method: api_endpoints_1.listUsers.method,
|
|
549
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.listUsers.queryParams),
|
|
550
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.listUsers.bodyParams),
|
|
551
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
552
|
-
});
|
|
553
|
-
},
|
|
554
|
-
/**
|
|
555
|
-
* Get details about bot
|
|
556
|
-
*/
|
|
557
|
-
me: (args) => {
|
|
558
|
-
this.warnUnknownParams(args, api_endpoints_1.getSelf);
|
|
559
|
-
return this.request({
|
|
560
|
-
path: api_endpoints_1.getSelf.path(),
|
|
561
|
-
method: api_endpoints_1.getSelf.method,
|
|
562
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.getSelf.queryParams),
|
|
563
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.getSelf.bodyParams),
|
|
564
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
565
|
-
});
|
|
566
|
-
},
|
|
184
|
+
properties: __classPrivateFieldGet(this, _Client_endpointMethods, "f").pages.properties,
|
|
567
185
|
};
|
|
186
|
+
this.users = __classPrivateFieldGet(this, _Client_endpointMethods, "f").users;
|
|
568
187
|
this.customEmojis = {
|
|
569
188
|
/**
|
|
570
189
|
* List custom emojis
|
|
@@ -580,87 +199,12 @@ class Client {
|
|
|
580
199
|
});
|
|
581
200
|
},
|
|
582
201
|
};
|
|
583
|
-
this.comments =
|
|
584
|
-
/**
|
|
585
|
-
* Create a comment
|
|
586
|
-
*/
|
|
587
|
-
create: (args) => {
|
|
588
|
-
this.warnUnknownParams(args, api_endpoints_1.createComment);
|
|
589
|
-
return this.request({
|
|
590
|
-
path: api_endpoints_1.createComment.path(),
|
|
591
|
-
method: api_endpoints_1.createComment.method,
|
|
592
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.createComment.queryParams),
|
|
593
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.createComment.bodyParams),
|
|
594
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
595
|
-
});
|
|
596
|
-
},
|
|
597
|
-
/**
|
|
598
|
-
* List comments
|
|
599
|
-
*/
|
|
600
|
-
list: (args) => {
|
|
601
|
-
this.warnUnknownParams(args, api_endpoints_1.listComments);
|
|
602
|
-
return this.request({
|
|
603
|
-
path: api_endpoints_1.listComments.path(),
|
|
604
|
-
method: api_endpoints_1.listComments.method,
|
|
605
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.listComments.queryParams),
|
|
606
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.listComments.bodyParams),
|
|
607
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
608
|
-
});
|
|
609
|
-
},
|
|
610
|
-
/**
|
|
611
|
-
* Retrieve a comment
|
|
612
|
-
*/
|
|
613
|
-
retrieve: (args) => {
|
|
614
|
-
this.warnUnknownParams(args, api_endpoints_1.getComment);
|
|
615
|
-
return this.request({
|
|
616
|
-
path: api_endpoints_1.getComment.path(args),
|
|
617
|
-
method: api_endpoints_1.getComment.method,
|
|
618
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.getComment.queryParams),
|
|
619
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.getComment.bodyParams),
|
|
620
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
621
|
-
});
|
|
622
|
-
},
|
|
623
|
-
/**
|
|
624
|
-
* Update a comment
|
|
625
|
-
*/
|
|
626
|
-
update: (args) => {
|
|
627
|
-
this.warnUnknownParams(args, api_endpoints_1.updateComment);
|
|
628
|
-
return this.request({
|
|
629
|
-
path: api_endpoints_1.updateComment.path(args),
|
|
630
|
-
method: api_endpoints_1.updateComment.method,
|
|
631
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.updateComment.queryParams),
|
|
632
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.updateComment.bodyParams),
|
|
633
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
634
|
-
});
|
|
635
|
-
},
|
|
636
|
-
/**
|
|
637
|
-
* Delete a comment
|
|
638
|
-
*/
|
|
639
|
-
delete: (args) => {
|
|
640
|
-
this.warnUnknownParams(args, api_endpoints_1.deleteComment);
|
|
641
|
-
return this.request({
|
|
642
|
-
path: api_endpoints_1.deleteComment.path(args),
|
|
643
|
-
method: api_endpoints_1.deleteComment.method,
|
|
644
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.deleteComment.queryParams),
|
|
645
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.deleteComment.bodyParams),
|
|
646
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
647
|
-
});
|
|
648
|
-
},
|
|
649
|
-
};
|
|
202
|
+
this.comments = __classPrivateFieldGet(this, _Client_endpointMethods, "f").comments;
|
|
650
203
|
this.fileUploads = {
|
|
651
204
|
/**
|
|
652
205
|
* Create a file upload
|
|
653
206
|
*/
|
|
654
|
-
create: (
|
|
655
|
-
this.warnUnknownParams(args, api_endpoints_1.createFileUpload);
|
|
656
|
-
return this.request({
|
|
657
|
-
path: api_endpoints_1.createFileUpload.path(),
|
|
658
|
-
method: api_endpoints_1.createFileUpload.method,
|
|
659
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.createFileUpload.queryParams),
|
|
660
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.createFileUpload.bodyParams),
|
|
661
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
662
|
-
});
|
|
663
|
-
},
|
|
207
|
+
create: __classPrivateFieldGet(this, _Client_endpointMethods, "f").fileUploads.create,
|
|
664
208
|
/**
|
|
665
209
|
* Retrieve a file upload
|
|
666
210
|
*/
|
|
@@ -751,16 +295,7 @@ class Client {
|
|
|
751
295
|
/**
|
|
752
296
|
* Retrieve a view
|
|
753
297
|
*/
|
|
754
|
-
retrieve: (
|
|
755
|
-
this.warnUnknownParams(args, api_endpoints_1.getView);
|
|
756
|
-
return this.request({
|
|
757
|
-
path: api_endpoints_1.getView.path(args),
|
|
758
|
-
method: api_endpoints_1.getView.method,
|
|
759
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.getView.queryParams),
|
|
760
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.getView.bodyParams),
|
|
761
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
762
|
-
});
|
|
763
|
-
},
|
|
298
|
+
retrieve: __classPrivateFieldGet(this, _Client_endpointMethods, "f").views.retrieve,
|
|
764
299
|
/**
|
|
765
300
|
* Update a view
|
|
766
301
|
*/
|
|
@@ -782,29 +317,11 @@ class Client {
|
|
|
782
317
|
/**
|
|
783
318
|
* Delete a view
|
|
784
319
|
*/
|
|
785
|
-
delete: (
|
|
786
|
-
this.warnUnknownParams(args, api_endpoints_1.deleteView);
|
|
787
|
-
return this.request({
|
|
788
|
-
path: api_endpoints_1.deleteView.path(args),
|
|
789
|
-
method: api_endpoints_1.deleteView.method,
|
|
790
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.deleteView.queryParams),
|
|
791
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.deleteView.bodyParams),
|
|
792
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
793
|
-
});
|
|
794
|
-
},
|
|
320
|
+
delete: __classPrivateFieldGet(this, _Client_endpointMethods, "f").views.delete,
|
|
795
321
|
/**
|
|
796
322
|
* List views for a database
|
|
797
323
|
*/
|
|
798
|
-
list: (
|
|
799
|
-
this.warnUnknownParams(args, api_endpoints_1.listDatabaseViews);
|
|
800
|
-
return this.request({
|
|
801
|
-
path: api_endpoints_1.listDatabaseViews.path(),
|
|
802
|
-
method: api_endpoints_1.listDatabaseViews.method,
|
|
803
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.listDatabaseViews.queryParams),
|
|
804
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.listDatabaseViews.bodyParams),
|
|
805
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
806
|
-
});
|
|
807
|
-
},
|
|
324
|
+
list: __classPrivateFieldGet(this, _Client_endpointMethods, "f").views.list,
|
|
808
325
|
queries: {
|
|
809
326
|
/**
|
|
810
327
|
* Create a view query
|
|
@@ -821,44 +338,17 @@ class Client {
|
|
|
821
338
|
/**
|
|
822
339
|
* Get view query results
|
|
823
340
|
*/
|
|
824
|
-
results: (
|
|
825
|
-
this.warnUnknownParams(args, api_endpoints_1.getViewQueryResults);
|
|
826
|
-
return this.request({
|
|
827
|
-
path: api_endpoints_1.getViewQueryResults.path(args),
|
|
828
|
-
method: api_endpoints_1.getViewQueryResults.method,
|
|
829
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.getViewQueryResults.queryParams),
|
|
830
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.getViewQueryResults.bodyParams),
|
|
831
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
832
|
-
});
|
|
833
|
-
},
|
|
341
|
+
results: __classPrivateFieldGet(this, _Client_endpointMethods, "f").views.queries.results,
|
|
834
342
|
/**
|
|
835
343
|
* Delete a view query
|
|
836
344
|
*/
|
|
837
|
-
delete: (
|
|
838
|
-
this.warnUnknownParams(args, api_endpoints_1.deleteViewQuery);
|
|
839
|
-
return this.request({
|
|
840
|
-
path: api_endpoints_1.deleteViewQuery.path(args),
|
|
841
|
-
method: api_endpoints_1.deleteViewQuery.method,
|
|
842
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.deleteViewQuery.queryParams),
|
|
843
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.deleteViewQuery.bodyParams),
|
|
844
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
845
|
-
});
|
|
846
|
-
},
|
|
345
|
+
delete: __classPrivateFieldGet(this, _Client_endpointMethods, "f").views.queries.delete,
|
|
847
346
|
},
|
|
848
347
|
};
|
|
849
348
|
/**
|
|
850
349
|
* Search
|
|
851
350
|
*/
|
|
852
|
-
this.search = (
|
|
853
|
-
this.warnUnknownParams(args, api_endpoints_1.search);
|
|
854
|
-
return this.request({
|
|
855
|
-
path: api_endpoints_1.search.path(),
|
|
856
|
-
method: api_endpoints_1.search.method,
|
|
857
|
-
query: (0, utils_1.pick)(args, api_endpoints_1.search.queryParams),
|
|
858
|
-
body: (0, utils_1.pick)(args, api_endpoints_1.search.bodyParams),
|
|
859
|
-
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
860
|
-
});
|
|
861
|
-
};
|
|
351
|
+
this.search = __classPrivateFieldGet(this, _Client_endpointMethods, "f").search;
|
|
862
352
|
this.oauth = {
|
|
863
353
|
/**
|
|
864
354
|
* Get token
|
|
@@ -925,6 +415,10 @@ class Client {
|
|
|
925
415
|
__classPrivateFieldSet(this, _Client_initialRetryDelayMs, (_k = (_j = options === null || options === void 0 ? void 0 : options.retry) === null || _j === void 0 ? void 0 : _j.initialRetryDelayMs) !== null && _k !== void 0 ? _k : constants_1.DEFAULT_INITIAL_RETRY_DELAY_MS, "f");
|
|
926
416
|
__classPrivateFieldSet(this, _Client_maxRetryDelayMs, (_m = (_l = options === null || options === void 0 ? void 0 : options.retry) === null || _l === void 0 ? void 0 : _l.maxRetryDelayMs) !== null && _m !== void 0 ? _m : constants_1.DEFAULT_MAX_RETRY_DELAY_MS, "f");
|
|
927
417
|
}
|
|
418
|
+
__classPrivateFieldSet(this, _Client_dangerouslyAllowBrowser, (_o = options === null || options === void 0 ? void 0 : options.dangerouslyAllowBrowser) !== null && _o !== void 0 ? _o : false, "f");
|
|
419
|
+
if ((options === null || options === void 0 ? void 0 : options.auth) !== undefined) {
|
|
420
|
+
this.assertTokenAllowedHere();
|
|
421
|
+
}
|
|
928
422
|
}
|
|
929
423
|
/**
|
|
930
424
|
* Sends a request.
|
|
@@ -1064,8 +558,12 @@ class Client {
|
|
|
1064
558
|
...customHeaders,
|
|
1065
559
|
...authorizationHeader,
|
|
1066
560
|
"Notion-Version": __classPrivateFieldGet(this, _Client_notionVersion, "f"),
|
|
1067
|
-
"user-agent": __classPrivateFieldGet(this, _Client_userAgent, "f"),
|
|
1068
561
|
};
|
|
562
|
+
// Firefox and Safari send a custom user-agent, which the API's CORS
|
|
563
|
+
// preflight does not allow, so every browser request would fail.
|
|
564
|
+
if (!isBrowserEnvironment()) {
|
|
565
|
+
headers["user-agent"] = __classPrivateFieldGet(this, _Client_userAgent, "f");
|
|
566
|
+
}
|
|
1069
567
|
if (bodyAsJsonString !== undefined) {
|
|
1070
568
|
headers["content-type"] = "application/json";
|
|
1071
569
|
}
|
|
@@ -1075,6 +573,9 @@ class Client {
|
|
|
1075
573
|
* Builds the authorization header based on auth type.
|
|
1076
574
|
*/
|
|
1077
575
|
buildAuthHeader(auth) {
|
|
576
|
+
if (auth !== undefined) {
|
|
577
|
+
this.assertTokenAllowedHere();
|
|
578
|
+
}
|
|
1078
579
|
if (typeof auth === "object") {
|
|
1079
580
|
const unencodedCredential = `${auth.client_id}:${auth.client_secret}`;
|
|
1080
581
|
const encodedCredential = Buffer.from(unencodedCredential).toString("base64");
|
|
@@ -1285,8 +786,9 @@ class Client {
|
|
|
1285
786
|
*/
|
|
1286
787
|
warnUnknownParams(args, endpoint) {
|
|
1287
788
|
var _a;
|
|
1288
|
-
if (!args || typeof args !== "object")
|
|
789
|
+
if (!args || typeof args !== "object") {
|
|
1289
790
|
return;
|
|
791
|
+
}
|
|
1290
792
|
const unknownKeys = (0, utils_1.getUnknownParams)(args, endpoint);
|
|
1291
793
|
if (unknownKeys.length > 0) {
|
|
1292
794
|
this.log(logging_1.LogLevel.WARN, "unknown parameters were ignored", {
|
|
@@ -1311,6 +813,19 @@ class Client {
|
|
|
1311
813
|
__classPrivateFieldGet(this, _Client_logger, "f").call(this, level, message, extraInfo);
|
|
1312
814
|
}
|
|
1313
815
|
}
|
|
816
|
+
/**
|
|
817
|
+
* Blocks a token or client secret inside a browser unless the caller opted
|
|
818
|
+
* in. Covers both the constructor `auth` and per-request `auth`, since a
|
|
819
|
+
* page that asks the visitor to type a token usually uses the latter. A
|
|
820
|
+
* client without a token stays usable, for example behind a proxy that
|
|
821
|
+
* adds the token on a server.
|
|
822
|
+
*/
|
|
823
|
+
assertTokenAllowedHere() {
|
|
824
|
+
if (__classPrivateFieldGet(this, _Client_dangerouslyAllowBrowser, "f") || !isBrowserEnvironment()) {
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
throw new errors_1.BrowserTokenNotAllowedError();
|
|
828
|
+
}
|
|
1314
829
|
/**
|
|
1315
830
|
* Transforms an API key or access token into a headers object suitable for an HTTP request.
|
|
1316
831
|
*
|
|
@@ -1329,7 +844,7 @@ class Client {
|
|
|
1329
844
|
return headers;
|
|
1330
845
|
}
|
|
1331
846
|
}
|
|
1332
|
-
_Client_auth = new WeakMap(), _Client_logLevel = new WeakMap(), _Client_logger = new WeakMap(), _Client_prefixUrl = new WeakMap(), _Client_timeoutMs = new WeakMap(), _Client_notionVersion = new WeakMap(), _Client_fetch = new WeakMap(), _Client_agent = new WeakMap(), _Client_userAgent = new WeakMap(), _Client_maxRetries = new WeakMap(), _Client_initialRetryDelayMs = new WeakMap(), _Client_maxRetryDelayMs = new WeakMap();
|
|
847
|
+
_Client_endpointMethods = new WeakMap(), _Client_auth = new WeakMap(), _Client_logLevel = new WeakMap(), _Client_logger = new WeakMap(), _Client_prefixUrl = new WeakMap(), _Client_timeoutMs = new WeakMap(), _Client_notionVersion = new WeakMap(), _Client_fetch = new WeakMap(), _Client_agent = new WeakMap(), _Client_userAgent = new WeakMap(), _Client_maxRetries = new WeakMap(), _Client_initialRetryDelayMs = new WeakMap(), _Client_maxRetryDelayMs = new WeakMap(), _Client_dangerouslyAllowBrowser = new WeakMap();
|
|
1333
848
|
Client.defaultNotionVersion = "2025-09-03";
|
|
1334
849
|
exports.default = Client;
|
|
1335
850
|
const sessionStreamEventTypes = new Set([
|