@notionhq/client 5.10.0 → 5.11.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/build/package.json +1 -1
- package/build/src/Client.d.ts +17 -2
- package/build/src/Client.d.ts.map +1 -1
- package/build/src/Client.js +77 -0
- package/build/src/Client.js.map +1 -1
- package/build/src/api-endpoints.d.ts +80 -25
- package/build/src/api-endpoints.d.ts.map +1 -1
- package/build/src/api-endpoints.js +32 -11
- package/build/src/api-endpoints.js.map +1 -1
- package/build/src/utils.d.ts +12 -0
- package/build/src/utils.d.ts.map +1 -1
- package/build/src/utils.js +17 -0
- package/build/src/utils.js.map +1 -1
- package/package.json +1 -1
package/build/package.json
CHANGED
package/build/src/Client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Agent } from "node:http";
|
|
2
2
|
import { type Logger, LogLevel } from "./logging";
|
|
3
|
-
import { type GetBlockParameters, type GetBlockResponse, type UpdateBlockParameters, type UpdateBlockResponse, type DeleteBlockParameters, type DeleteBlockResponse, type AppendBlockChildrenParameters, type AppendBlockChildrenResponse, type ListBlockChildrenParameters, type ListBlockChildrenResponse, type QueryDataSourceParameters, type QueryDataSourceResponse, type CreateDataSourceParameters, type CreateDataSourceResponse, type UpdateDataSourceParameters, type UpdateDataSourceResponse, type GetDataSourceParameters, type GetDataSourceResponse, type CreatePageParameters, type CreatePageResponse, type GetPageParameters, type GetPageResponse, type UpdatePageParameters, type UpdatePageResponse, type MovePageParameters, type MovePageResponse, type GetUserParameters, type GetUserResponse, type ListUsersParameters, type ListUsersResponse, type SearchParameters, type SearchResponse, type GetSelfParameters, type GetSelfResponse, type GetPagePropertyParameters, type GetPagePropertyResponse, type CreateCommentParameters, type CreateCommentResponse, type ListCommentsParameters, type ListCommentsResponse, type GetCommentParameters, type GetCommentResponse, type OauthTokenResponse, type OauthTokenParameters, type OauthIntrospectResponse, type OauthIntrospectParameters, type OauthRevokeResponse, type OauthRevokeParameters, type CreateFileUploadParameters, type CreateFileUploadResponse, type GetFileUploadResponse, type GetFileUploadParameters, type SendFileUploadParameters, type SendFileUploadResponse, type CompleteFileUploadParameters, type CompleteFileUploadResponse, type ListFileUploadsParameters, type ListFileUploadsResponse, GetDatabaseParameters, GetDatabaseResponse, CreateDatabaseResponse, CreateDatabaseParameters, UpdateDatabaseParameters, UpdateDatabaseResponse, ListDataSourceTemplatesResponse, ListDataSourceTemplatesParameters } from "./api-endpoints";
|
|
3
|
+
import { type GetBlockParameters, type GetBlockResponse, type UpdateBlockParameters, type UpdateBlockResponse, type DeleteBlockParameters, type DeleteBlockResponse, type AppendBlockChildrenParameters, type AppendBlockChildrenResponse, type ListBlockChildrenParameters, type ListBlockChildrenResponse, type QueryDataSourceParameters, type QueryDataSourceResponse, type CreateDataSourceParameters, type CreateDataSourceResponse, type UpdateDataSourceParameters, type UpdateDataSourceResponse, type GetDataSourceParameters, type GetDataSourceResponse, type CreatePageParameters, type CreatePageResponse, type GetPageParameters, type GetPageResponse, type UpdatePageParameters, type UpdatePageResponse, type MovePageParameters, type MovePageResponse, type GetPageMarkdownParameters, type GetPageMarkdownResponse, type UpdatePageMarkdownParameters, type UpdatePageMarkdownResponse, type GetUserParameters, type GetUserResponse, type ListUsersParameters, type ListUsersResponse, type SearchParameters, type SearchResponse, type GetSelfParameters, type GetSelfResponse, type GetPagePropertyParameters, type GetPagePropertyResponse, type CreateCommentParameters, type CreateCommentResponse, type ListCommentsParameters, type ListCommentsResponse, type GetCommentParameters, type GetCommentResponse, type OauthTokenResponse, type OauthTokenParameters, type OauthIntrospectResponse, type OauthIntrospectParameters, type OauthRevokeResponse, type OauthRevokeParameters, type CreateFileUploadParameters, type CreateFileUploadResponse, type GetFileUploadResponse, type GetFileUploadParameters, type SendFileUploadParameters, type SendFileUploadResponse, type CompleteFileUploadParameters, type CompleteFileUploadResponse, type ListFileUploadsParameters, type ListFileUploadsResponse, GetDatabaseParameters, GetDatabaseResponse, CreateDatabaseResponse, CreateDatabaseParameters, UpdateDatabaseParameters, UpdateDatabaseResponse, ListDataSourceTemplatesResponse, ListDataSourceTemplatesParameters } from "./api-endpoints";
|
|
4
4
|
import type { SupportedFetch } from "./fetch-types";
|
|
5
5
|
export type RetryOptions = {
|
|
6
6
|
/**
|
|
@@ -199,6 +199,14 @@ export default class Client {
|
|
|
199
199
|
* Move a page
|
|
200
200
|
*/
|
|
201
201
|
move: (args: WithAuth<MovePageParameters>) => Promise<MovePageResponse>;
|
|
202
|
+
/**
|
|
203
|
+
* Retrieve a page as markdown
|
|
204
|
+
*/
|
|
205
|
+
retrieveMarkdown: (args: WithAuth<GetPageMarkdownParameters>) => Promise<GetPageMarkdownResponse>;
|
|
206
|
+
/**
|
|
207
|
+
* Update a page's content as markdown
|
|
208
|
+
*/
|
|
209
|
+
updateMarkdown: (args: WithAuth<UpdatePageMarkdownParameters>) => Promise<UpdatePageMarkdownResponse>;
|
|
202
210
|
properties: {
|
|
203
211
|
/**
|
|
204
212
|
* Retrieve page property
|
|
@@ -294,6 +302,13 @@ export default class Client {
|
|
|
294
302
|
client_secret: string;
|
|
295
303
|
}) => Promise<OauthRevokeResponse>;
|
|
296
304
|
};
|
|
305
|
+
/**
|
|
306
|
+
* Logs a warning when the caller passes parameters that are not recognized
|
|
307
|
+
* by the endpoint definition. This helps catch typos and renamed parameters
|
|
308
|
+
* (e.g. `archived` vs `in_trash` for `databases.update`) that would
|
|
309
|
+
* otherwise be silently dropped by `pick()`.
|
|
310
|
+
*/
|
|
311
|
+
private warnUnknownParams;
|
|
297
312
|
/**
|
|
298
313
|
* Emits a log message to the console.
|
|
299
314
|
*
|
|
@@ -313,7 +328,7 @@ export default class Client {
|
|
|
313
328
|
private authAsHeaders;
|
|
314
329
|
}
|
|
315
330
|
type Method = "get" | "post" | "patch" | "delete";
|
|
316
|
-
type QueryParams = Record<string, string | number | string[]> | URLSearchParams;
|
|
331
|
+
type QueryParams = Record<string, string | number | boolean | string[]> | URLSearchParams;
|
|
317
332
|
type WithAuth<P> = P & {
|
|
318
333
|
auth?: string;
|
|
319
334
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../src/Client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EACL,KAAK,MAAM,EACX,QAAQ,EAGT,MAAM,WAAW,CAAA;AAYlB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAErB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAExB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAExB,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EAEhC,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAE9B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAE5B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAE7B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAE7B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAE1B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAEpB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EAEvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAErB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAEpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAEtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEnB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAEpB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAE5B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAE1B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EAEzB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EAEvB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAEzB,KAAK,uBAAuB,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(args) => {
|
|
43
|
+
this.warnUnknownParams(args, api_endpoints_1.getBlock);
|
|
43
44
|
return this.request({
|
|
44
45
|
path: api_endpoints_1.getBlock.path(args),
|
|
45
46
|
method: api_endpoints_1.getBlock.method,
|
|
@@ -52,6 +53,7 @@ class Client {
|
|
|
52
53
|
* Update block
|
|
53
54
|
*/
|
|
54
55
|
update: (args) => {
|
|
56
|
+
this.warnUnknownParams(args, api_endpoints_1.updateBlock);
|
|
55
57
|
return this.request({
|
|
56
58
|
path: api_endpoints_1.updateBlock.path(args),
|
|
57
59
|
method: api_endpoints_1.updateBlock.method,
|
|
@@ -64,6 +66,7 @@ class Client {
|
|
|
64
66
|
* Delete block
|
|
65
67
|
*/
|
|
66
68
|
delete: (args) => {
|
|
69
|
+
this.warnUnknownParams(args, api_endpoints_1.deleteBlock);
|
|
67
70
|
return this.request({
|
|
68
71
|
path: api_endpoints_1.deleteBlock.path(args),
|
|
69
72
|
method: api_endpoints_1.deleteBlock.method,
|
|
@@ -77,6 +80,7 @@ class Client {
|
|
|
77
80
|
* Append block children
|
|
78
81
|
*/
|
|
79
82
|
append: (args) => {
|
|
83
|
+
this.warnUnknownParams(args, api_endpoints_1.appendBlockChildren);
|
|
80
84
|
return this.request({
|
|
81
85
|
path: api_endpoints_1.appendBlockChildren.path(args),
|
|
82
86
|
method: api_endpoints_1.appendBlockChildren.method,
|
|
@@ -89,6 +93,7 @@ class Client {
|
|
|
89
93
|
* Retrieve block children
|
|
90
94
|
*/
|
|
91
95
|
list: (args) => {
|
|
96
|
+
this.warnUnknownParams(args, api_endpoints_1.listBlockChildren);
|
|
92
97
|
return this.request({
|
|
93
98
|
path: api_endpoints_1.listBlockChildren.path(args),
|
|
94
99
|
method: api_endpoints_1.listBlockChildren.method,
|
|
@@ -104,6 +109,7 @@ class Client {
|
|
|
104
109
|
* Retrieve a database
|
|
105
110
|
*/
|
|
106
111
|
retrieve: (args) => {
|
|
112
|
+
this.warnUnknownParams(args, api_endpoints_1.getDatabase);
|
|
107
113
|
return this.request({
|
|
108
114
|
path: api_endpoints_1.getDatabase.path(args),
|
|
109
115
|
method: api_endpoints_1.getDatabase.method,
|
|
@@ -116,6 +122,7 @@ class Client {
|
|
|
116
122
|
* Create a database
|
|
117
123
|
*/
|
|
118
124
|
create: (args) => {
|
|
125
|
+
this.warnUnknownParams(args, api_endpoints_1.createDatabase);
|
|
119
126
|
return this.request({
|
|
120
127
|
path: api_endpoints_1.createDatabase.path(),
|
|
121
128
|
method: api_endpoints_1.createDatabase.method,
|
|
@@ -128,6 +135,7 @@ class Client {
|
|
|
128
135
|
* Update a database
|
|
129
136
|
*/
|
|
130
137
|
update: (args) => {
|
|
138
|
+
this.warnUnknownParams(args, api_endpoints_1.updateDatabase);
|
|
131
139
|
return this.request({
|
|
132
140
|
path: api_endpoints_1.updateDatabase.path(args),
|
|
133
141
|
method: api_endpoints_1.updateDatabase.method,
|
|
@@ -142,6 +150,7 @@ class Client {
|
|
|
142
150
|
* Retrieve a data source
|
|
143
151
|
*/
|
|
144
152
|
retrieve: (args) => {
|
|
153
|
+
this.warnUnknownParams(args, api_endpoints_1.getDataSource);
|
|
145
154
|
return this.request({
|
|
146
155
|
path: api_endpoints_1.getDataSource.path(args),
|
|
147
156
|
method: api_endpoints_1.getDataSource.method,
|
|
@@ -154,6 +163,7 @@ class Client {
|
|
|
154
163
|
* Query a data source
|
|
155
164
|
*/
|
|
156
165
|
query: (args) => {
|
|
166
|
+
this.warnUnknownParams(args, api_endpoints_1.queryDataSource);
|
|
157
167
|
return this.request({
|
|
158
168
|
path: api_endpoints_1.queryDataSource.path(args),
|
|
159
169
|
method: api_endpoints_1.queryDataSource.method,
|
|
@@ -166,6 +176,7 @@ class Client {
|
|
|
166
176
|
* Create a data source
|
|
167
177
|
*/
|
|
168
178
|
create: (args) => {
|
|
179
|
+
this.warnUnknownParams(args, api_endpoints_1.createDataSource);
|
|
169
180
|
return this.request({
|
|
170
181
|
path: api_endpoints_1.createDataSource.path(),
|
|
171
182
|
method: api_endpoints_1.createDataSource.method,
|
|
@@ -178,6 +189,7 @@ class Client {
|
|
|
178
189
|
* Update a data source
|
|
179
190
|
*/
|
|
180
191
|
update: (args) => {
|
|
192
|
+
this.warnUnknownParams(args, api_endpoints_1.updateDataSource);
|
|
181
193
|
return this.request({
|
|
182
194
|
path: api_endpoints_1.updateDataSource.path(args),
|
|
183
195
|
method: api_endpoints_1.updateDataSource.method,
|
|
@@ -190,6 +202,7 @@ class Client {
|
|
|
190
202
|
* List page templates that are available for a data source
|
|
191
203
|
*/
|
|
192
204
|
listTemplates: (args) => {
|
|
205
|
+
this.warnUnknownParams(args, api_endpoints_1.listDataSourceTemplates);
|
|
193
206
|
return this.request({
|
|
194
207
|
path: api_endpoints_1.listDataSourceTemplates.path(args),
|
|
195
208
|
method: api_endpoints_1.listDataSourceTemplates.method,
|
|
@@ -204,6 +217,7 @@ class Client {
|
|
|
204
217
|
* Create a page
|
|
205
218
|
*/
|
|
206
219
|
create: (args) => {
|
|
220
|
+
this.warnUnknownParams(args, api_endpoints_1.createPage);
|
|
207
221
|
return this.request({
|
|
208
222
|
path: api_endpoints_1.createPage.path(),
|
|
209
223
|
method: api_endpoints_1.createPage.method,
|
|
@@ -216,6 +230,7 @@ class Client {
|
|
|
216
230
|
* Retrieve a page
|
|
217
231
|
*/
|
|
218
232
|
retrieve: (args) => {
|
|
233
|
+
this.warnUnknownParams(args, api_endpoints_1.getPage);
|
|
219
234
|
return this.request({
|
|
220
235
|
path: api_endpoints_1.getPage.path(args),
|
|
221
236
|
method: api_endpoints_1.getPage.method,
|
|
@@ -228,6 +243,7 @@ class Client {
|
|
|
228
243
|
* Update page properties
|
|
229
244
|
*/
|
|
230
245
|
update: (args) => {
|
|
246
|
+
this.warnUnknownParams(args, api_endpoints_1.updatePage);
|
|
231
247
|
return this.request({
|
|
232
248
|
path: api_endpoints_1.updatePage.path(args),
|
|
233
249
|
method: api_endpoints_1.updatePage.method,
|
|
@@ -240,6 +256,7 @@ class Client {
|
|
|
240
256
|
* Move a page
|
|
241
257
|
*/
|
|
242
258
|
move: (args) => {
|
|
259
|
+
this.warnUnknownParams(args, api_endpoints_1.movePage);
|
|
243
260
|
return this.request({
|
|
244
261
|
path: api_endpoints_1.movePage.path(args),
|
|
245
262
|
method: api_endpoints_1.movePage.method,
|
|
@@ -248,11 +265,36 @@ class Client {
|
|
|
248
265
|
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
249
266
|
});
|
|
250
267
|
},
|
|
268
|
+
/**
|
|
269
|
+
* Retrieve a page as markdown
|
|
270
|
+
*/
|
|
271
|
+
retrieveMarkdown: (args) => {
|
|
272
|
+
return this.request({
|
|
273
|
+
path: api_endpoints_1.getPageMarkdown.path(args),
|
|
274
|
+
method: api_endpoints_1.getPageMarkdown.method,
|
|
275
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.getPageMarkdown.queryParams),
|
|
276
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.getPageMarkdown.bodyParams),
|
|
277
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
278
|
+
});
|
|
279
|
+
},
|
|
280
|
+
/**
|
|
281
|
+
* Update a page's content as markdown
|
|
282
|
+
*/
|
|
283
|
+
updateMarkdown: (args) => {
|
|
284
|
+
return this.request({
|
|
285
|
+
path: api_endpoints_1.updatePageMarkdown.path(args),
|
|
286
|
+
method: api_endpoints_1.updatePageMarkdown.method,
|
|
287
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.updatePageMarkdown.queryParams),
|
|
288
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.updatePageMarkdown.bodyParams),
|
|
289
|
+
auth: args === null || args === void 0 ? void 0 : args.auth,
|
|
290
|
+
});
|
|
291
|
+
},
|
|
251
292
|
properties: {
|
|
252
293
|
/**
|
|
253
294
|
* Retrieve page property
|
|
254
295
|
*/
|
|
255
296
|
retrieve: (args) => {
|
|
297
|
+
this.warnUnknownParams(args, api_endpoints_1.getPageProperty);
|
|
256
298
|
return this.request({
|
|
257
299
|
path: api_endpoints_1.getPageProperty.path(args),
|
|
258
300
|
method: api_endpoints_1.getPageProperty.method,
|
|
@@ -268,6 +310,7 @@ class Client {
|
|
|
268
310
|
* Retrieve a user
|
|
269
311
|
*/
|
|
270
312
|
retrieve: (args) => {
|
|
313
|
+
this.warnUnknownParams(args, api_endpoints_1.getUser);
|
|
271
314
|
return this.request({
|
|
272
315
|
path: api_endpoints_1.getUser.path(args),
|
|
273
316
|
method: api_endpoints_1.getUser.method,
|
|
@@ -280,6 +323,7 @@ class Client {
|
|
|
280
323
|
* List all users
|
|
281
324
|
*/
|
|
282
325
|
list: (args) => {
|
|
326
|
+
this.warnUnknownParams(args, api_endpoints_1.listUsers);
|
|
283
327
|
return this.request({
|
|
284
328
|
path: api_endpoints_1.listUsers.path(),
|
|
285
329
|
method: api_endpoints_1.listUsers.method,
|
|
@@ -292,6 +336,7 @@ class Client {
|
|
|
292
336
|
* Get details about bot
|
|
293
337
|
*/
|
|
294
338
|
me: (args) => {
|
|
339
|
+
this.warnUnknownParams(args, api_endpoints_1.getSelf);
|
|
295
340
|
return this.request({
|
|
296
341
|
path: api_endpoints_1.getSelf.path(),
|
|
297
342
|
method: api_endpoints_1.getSelf.method,
|
|
@@ -306,6 +351,7 @@ class Client {
|
|
|
306
351
|
* Create a comment
|
|
307
352
|
*/
|
|
308
353
|
create: (args) => {
|
|
354
|
+
this.warnUnknownParams(args, api_endpoints_1.createComment);
|
|
309
355
|
return this.request({
|
|
310
356
|
path: api_endpoints_1.createComment.path(),
|
|
311
357
|
method: api_endpoints_1.createComment.method,
|
|
@@ -318,6 +364,7 @@ class Client {
|
|
|
318
364
|
* List comments
|
|
319
365
|
*/
|
|
320
366
|
list: (args) => {
|
|
367
|
+
this.warnUnknownParams(args, api_endpoints_1.listComments);
|
|
321
368
|
return this.request({
|
|
322
369
|
path: api_endpoints_1.listComments.path(),
|
|
323
370
|
method: api_endpoints_1.listComments.method,
|
|
@@ -330,6 +377,7 @@ class Client {
|
|
|
330
377
|
* Retrieve a comment
|
|
331
378
|
*/
|
|
332
379
|
retrieve: (args) => {
|
|
380
|
+
this.warnUnknownParams(args, api_endpoints_1.getComment);
|
|
333
381
|
return this.request({
|
|
334
382
|
path: api_endpoints_1.getComment.path(args),
|
|
335
383
|
method: api_endpoints_1.getComment.method,
|
|
@@ -344,6 +392,7 @@ class Client {
|
|
|
344
392
|
* Create a file upload
|
|
345
393
|
*/
|
|
346
394
|
create: (args) => {
|
|
395
|
+
this.warnUnknownParams(args, api_endpoints_1.createFileUpload);
|
|
347
396
|
return this.request({
|
|
348
397
|
path: api_endpoints_1.createFileUpload.path(),
|
|
349
398
|
method: api_endpoints_1.createFileUpload.method,
|
|
@@ -356,6 +405,7 @@ class Client {
|
|
|
356
405
|
* Retrieve a file upload
|
|
357
406
|
*/
|
|
358
407
|
retrieve: (args) => {
|
|
408
|
+
this.warnUnknownParams(args, api_endpoints_1.getFileUpload);
|
|
359
409
|
return this.request({
|
|
360
410
|
path: api_endpoints_1.getFileUpload.path(args),
|
|
361
411
|
method: api_endpoints_1.getFileUpload.method,
|
|
@@ -367,6 +417,7 @@ class Client {
|
|
|
367
417
|
* List file uploads
|
|
368
418
|
*/
|
|
369
419
|
list: (args) => {
|
|
420
|
+
this.warnUnknownParams(args, api_endpoints_1.listFileUploads);
|
|
370
421
|
return this.request({
|
|
371
422
|
path: api_endpoints_1.listFileUploads.path(),
|
|
372
423
|
method: api_endpoints_1.listFileUploads.method,
|
|
@@ -389,6 +440,7 @@ class Client {
|
|
|
389
440
|
* This endpoint sends HTTP multipart/form-data instead of JSON parameters.
|
|
390
441
|
*/
|
|
391
442
|
send: (args) => {
|
|
443
|
+
this.warnUnknownParams(args, api_endpoints_1.sendFileUpload);
|
|
392
444
|
return this.request({
|
|
393
445
|
path: api_endpoints_1.sendFileUpload.path(args),
|
|
394
446
|
method: api_endpoints_1.sendFileUpload.method,
|
|
@@ -401,6 +453,7 @@ class Client {
|
|
|
401
453
|
* Complete a file upload
|
|
402
454
|
*/
|
|
403
455
|
complete: (args) => {
|
|
456
|
+
this.warnUnknownParams(args, api_endpoints_1.completeFileUpload);
|
|
404
457
|
return this.request({
|
|
405
458
|
path: api_endpoints_1.completeFileUpload.path(args),
|
|
406
459
|
method: api_endpoints_1.completeFileUpload.method,
|
|
@@ -413,6 +466,7 @@ class Client {
|
|
|
413
466
|
* Search
|
|
414
467
|
*/
|
|
415
468
|
this.search = (args) => {
|
|
469
|
+
this.warnUnknownParams(args, api_endpoints_1.search);
|
|
416
470
|
return this.request({
|
|
417
471
|
path: api_endpoints_1.search.path(),
|
|
418
472
|
method: api_endpoints_1.search.method,
|
|
@@ -754,6 +808,29 @@ class Client {
|
|
|
754
808
|
sleep(ms) {
|
|
755
809
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
756
810
|
}
|
|
811
|
+
/**
|
|
812
|
+
* Logs a warning when the caller passes parameters that are not recognized
|
|
813
|
+
* by the endpoint definition. This helps catch typos and renamed parameters
|
|
814
|
+
* (e.g. `archived` vs `in_trash` for `databases.update`) that would
|
|
815
|
+
* otherwise be silently dropped by `pick()`.
|
|
816
|
+
*/
|
|
817
|
+
warnUnknownParams(args, endpoint) {
|
|
818
|
+
var _a;
|
|
819
|
+
if (!args || typeof args !== "object")
|
|
820
|
+
return;
|
|
821
|
+
const unknownKeys = (0, utils_1.getUnknownParams)(args, endpoint);
|
|
822
|
+
if (unknownKeys.length > 0) {
|
|
823
|
+
this.log(logging_1.LogLevel.WARN, "unknown parameters were ignored", {
|
|
824
|
+
unknownParams: unknownKeys,
|
|
825
|
+
knownParams: [
|
|
826
|
+
...endpoint.pathParams,
|
|
827
|
+
...endpoint.queryParams,
|
|
828
|
+
...endpoint.bodyParams,
|
|
829
|
+
...((_a = endpoint.formDataParams) !== null && _a !== void 0 ? _a : []),
|
|
830
|
+
],
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
}
|
|
757
834
|
/**
|
|
758
835
|
* Emits a log message to the console.
|
|
759
836
|
*
|