quickbase-js 2.4.0 → 2.4.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.
Files changed (46) hide show
  1. package/README.md +144 -76
  2. package/dist/quickbase.esm.js +3 -3
  3. package/dist/quickbase.min.js +3 -3
  4. package/dist/quickbase.min.js.map +1 -1
  5. package/package.json +13 -9
  6. package/src/auth/index.ts +55 -0
  7. package/src/auth/sso-token.ts +143 -0
  8. package/src/auth/temp-token.ts +160 -0
  9. package/src/auth/ticket.ts +329 -0
  10. package/src/auth/token-cache.ts +97 -0
  11. package/src/auth/types.ts +50 -0
  12. package/src/auth/user-token.ts +38 -0
  13. package/src/cli/schema.ts +512 -0
  14. package/src/client/index.ts +36 -0
  15. package/src/client/pagination.ts +337 -0
  16. package/src/client/request.ts +544 -0
  17. package/src/client/retry.ts +169 -0
  18. package/src/client/throttle.ts +105 -0
  19. package/src/core/config.ts +160 -0
  20. package/src/core/dates.ts +63 -0
  21. package/src/core/errors.ts +349 -0
  22. package/src/core/index.ts +50 -0
  23. package/src/core/logger.ts +113 -0
  24. package/src/core/schema.ts +213 -0
  25. package/src/core/transform.ts +295 -0
  26. package/src/core/types.ts +337 -0
  27. package/src/generated/client.ts +1785 -0
  28. package/src/generated/operations.json +672 -0
  29. package/src/generated/types.ts +4884 -0
  30. package/src/index.ts +259 -0
  31. package/src/xml/codepages.ts +119 -0
  32. package/src/xml/dbvars.ts +75 -0
  33. package/src/xml/errors.ts +133 -0
  34. package/src/xml/fields.ts +121 -0
  35. package/src/xml/groups.ts +560 -0
  36. package/src/xml/html.ts +152 -0
  37. package/src/xml/index.ts +1196 -0
  38. package/src/xml/metadata.ts +111 -0
  39. package/src/xml/records.ts +301 -0
  40. package/src/xml/request.ts +238 -0
  41. package/src/xml/roles.ts +321 -0
  42. package/src/xml/schema.ts +436 -0
  43. package/src/xml/transform.ts +381 -0
  44. package/src/xml/types.ts +602 -0
  45. package/src/xml/users.ts +221 -0
  46. package/src/xml/webhooks.ts +260 -0
@@ -0,0 +1,1785 @@
1
+ /**
2
+ * Auto-generated QuickBase API client implementation
3
+ * DO NOT EDIT - Regenerate with: npm run spec:generate
4
+ */
5
+
6
+ import { PaginatedRequest, createPaginatedRequest } from '../client/pagination.js';
7
+
8
+ import type {
9
+ QuickbaseAPI,
10
+ CreateAppRequest,
11
+ CreateAppResponse,
12
+ GetAppParams,
13
+ GetAppResponse,
14
+ UpdateAppParams,
15
+ UpdateAppRequest,
16
+ UpdateAppResponse,
17
+ DeleteAppParams,
18
+ DeleteAppRequest,
19
+ DeleteAppResponse,
20
+ GetAppEventsParams,
21
+ GetAppEventsResponse,
22
+ CopyAppParams,
23
+ CopyAppRequest,
24
+ CopyAppResponse,
25
+ GetRolesParams,
26
+ GetRolesResponse,
27
+ GetAppTablesParams,
28
+ GetAppTablesResponse,
29
+ CreateTableParams,
30
+ CreateTableRequest,
31
+ CreateTableResponse,
32
+ GetTableParams,
33
+ GetTableResponse,
34
+ UpdateTableParams,
35
+ UpdateTableRequest,
36
+ UpdateTableResponse,
37
+ DeleteTableParams,
38
+ DeleteTableResponse,
39
+ GetRelationshipsParams,
40
+ GetRelationshipsResponse,
41
+ CreateRelationshipParams,
42
+ CreateRelationshipRequest,
43
+ CreateRelationshipResponse,
44
+ UpdateRelationshipParams,
45
+ UpdateRelationshipRequest,
46
+ UpdateRelationshipResponse,
47
+ DeleteRelationshipParams,
48
+ DeleteRelationshipResponse,
49
+ GetTableReportsParams,
50
+ GetTableReportsResponse,
51
+ GetReportParams,
52
+ GetReportResponse,
53
+ RunReportParams,
54
+ RunReportResponse,
55
+ GetFieldsParams,
56
+ GetFieldsResponse,
57
+ CreateFieldParams,
58
+ CreateFieldRequest,
59
+ CreateFieldResponse,
60
+ DeleteFieldsParams,
61
+ DeleteFieldsRequest,
62
+ DeleteFieldsResponse,
63
+ GetFieldParams,
64
+ GetFieldResponse,
65
+ UpdateFieldParams,
66
+ UpdateFieldRequest,
67
+ UpdateFieldResponse,
68
+ GetFieldsUsageParams,
69
+ GetFieldsUsageResponse,
70
+ GetFieldUsageParams,
71
+ GetFieldUsageResponse,
72
+ RunFormulaRequest,
73
+ RunFormulaResponse,
74
+ UpsertRequest,
75
+ UpsertResponse,
76
+ DeleteRecordsRequest,
77
+ DeleteRecordsResponse,
78
+ RunQueryRequest,
79
+ RunQueryResponse,
80
+ RecordsModifiedSinceRequest,
81
+ RecordsModifiedSinceResponse,
82
+ GetTempTokenDBIDParams,
83
+ GetTempTokenDBIDResponse,
84
+ ExchangeSsoTokenRequest,
85
+ ExchangeSsoTokenResponse,
86
+ CloneUserTokenRequest,
87
+ CloneUserTokenResponse,
88
+ TransferUserTokenRequest,
89
+ TransferUserTokenResponse,
90
+ DeactivateUserTokenResponse,
91
+ DeleteUserTokenResponse,
92
+ DownloadFileParams,
93
+ DownloadFileResponse,
94
+ DeleteFileParams,
95
+ DeleteFileResponse,
96
+ GetUsersParams,
97
+ GetUsersRequest,
98
+ GetUsersResponse,
99
+ DenyUsersParams,
100
+ DenyUsersRequest,
101
+ DenyUsersResponse,
102
+ DenyUsersAndGroupsParams,
103
+ DenyUsersAndGroupsRequest,
104
+ DenyUsersAndGroupsResponse,
105
+ UndenyUsersParams,
106
+ UndenyUsersRequest,
107
+ UndenyUsersResponse,
108
+ GetUserAppsParams,
109
+ GetUserAppsResponse,
110
+ AddMembersToGroupParams,
111
+ AddMembersToGroupRequest,
112
+ AddMembersToGroupResponse,
113
+ RemoveMembersFromGroupParams,
114
+ RemoveMembersFromGroupRequest,
115
+ RemoveMembersFromGroupResponse,
116
+ AddManagersToGroupParams,
117
+ AddManagersToGroupRequest,
118
+ AddManagersToGroupResponse,
119
+ RemoveManagersFromGroupParams,
120
+ RemoveManagersFromGroupRequest,
121
+ RemoveManagersFromGroupResponse,
122
+ AddSubgroupsToGroupParams,
123
+ AddSubgroupsToGroupRequest,
124
+ AddSubgroupsToGroupResponse,
125
+ RemoveSubgroupsFromGroupParams,
126
+ RemoveSubgroupsFromGroupRequest,
127
+ RemoveSubgroupsFromGroupResponse,
128
+ AuditRequest,
129
+ AuditResponse,
130
+ PlatformAnalyticReadsParams,
131
+ PlatformAnalyticReadsResponse,
132
+ PlatformAnalyticEventSummariesParams,
133
+ PlatformAnalyticEventSummariesRequest,
134
+ PlatformAnalyticEventSummariesResponse,
135
+ GenerateDocumentParams,
136
+ GenerateDocumentResponse,
137
+ ExportSolutionParams,
138
+ ExportSolutionResponse,
139
+ UpdateSolutionParams,
140
+ UpdateSolutionRequest,
141
+ UpdateSolutionResponse,
142
+ CreateSolutionParams,
143
+ CreateSolutionRequest,
144
+ CreateSolutionResponse,
145
+ ExportSolutionToRecordParams,
146
+ ExportSolutionToRecordResponse,
147
+ CreateSolutionFromRecordParams,
148
+ CreateSolutionFromRecordResponse,
149
+ UpdateSolutionToRecordParams,
150
+ UpdateSolutionToRecordResponse,
151
+ ChangesetSolutionParams,
152
+ ChangesetSolutionRequest,
153
+ ChangesetSolutionResponse,
154
+ ChangesetSolutionFromRecordParams,
155
+ ChangesetSolutionFromRecordResponse,
156
+ GetSolutionPublicParams,
157
+ GetSolutionPublicResponse,
158
+ GetTrusteesParams,
159
+ GetTrusteesResponse,
160
+ AddTrusteesParams,
161
+ AddTrusteesRequest,
162
+ AddTrusteesResponse,
163
+ RemoveTrusteesParams,
164
+ RemoveTrusteesRequest,
165
+ RemoveTrusteesResponse,
166
+ UpdateTrusteesParams,
167
+ UpdateTrusteesRequest,
168
+ UpdateTrusteesResponse,
169
+ } from './types.js';
170
+
171
+ export type RequestFn = <T>(options: {
172
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
173
+ path: string;
174
+ body?: unknown;
175
+ bodyType?: string;
176
+ responseType?: 'json' | 'text';
177
+ query?: Record<string, string | number | boolean | undefined>;
178
+ }) => Promise<T>;
179
+
180
+ /**
181
+ * Create typed API methods from a request function
182
+ * @param request - The request executor function
183
+ * @param autoPaginate - Default auto-pagination behavior (default: false)
184
+ */
185
+ export function createApiMethods(request: RequestFn, autoPaginate: boolean = false): QuickbaseAPI {
186
+ return {
187
+ /**
188
+ * Create an app
189
+ *
190
+ * Creates an application in an account. You must have application creation rights in the respective account. Main properties and application variables can be set with this API.
191
+ *
192
+ * @param body - Request body
193
+ * @param body.assignToken - Set to true if you would like to assign the app to the user token you used to create the application. The default is false. (optional)
194
+ * @param body.variables - The app variables. A maximum of 10 variables can be inserted at a time. See [About Application Variables](https://help.quickbase.com/docs/creating-and-using-application-variables) (optional)
195
+ * @param body.name - The app name. You are allowed to create multiple apps with the same name, in the same realm, because they will have different dbid values. We urge you to be careful about doing this.
196
+ * @param body.securityProperties - Security properties of the application (optional)
197
+ * @param body.description - The description for the app. If this property is left out, the app description will be blank. (optional)
198
+ *
199
+ * @returns Success
200
+ *
201
+ * @see https://developer.quickbase.com/operation/createApp
202
+ */
203
+ createApp(body: CreateAppRequest): Promise<CreateAppResponse> {
204
+ return request<CreateAppResponse>({
205
+ method: 'POST',
206
+ path: '/apps',
207
+ body,
208
+ });
209
+ },
210
+
211
+ /**
212
+ * Get an app
213
+ *
214
+ * Returns the main properties of an application, including application variables.
215
+ *
216
+ * @param params.appId - The unique identifier of an app
217
+ *
218
+ * @returns Success
219
+ *
220
+ * @see https://developer.quickbase.com/operation/getApp
221
+ */
222
+ getApp(params: GetAppParams): Promise<GetAppResponse> {
223
+ return request<GetAppResponse>({
224
+ method: 'GET',
225
+ path: `/apps/${params.appId}`,
226
+ });
227
+ },
228
+
229
+ /**
230
+ * Update an app
231
+ *
232
+ * Updates the main properties and/or application variables for a specific application. Any properties of the app that you do not specify in the request body will remain unchanged.
233
+ *
234
+ * @param params.appId - The unique identifier of an app
235
+ *
236
+ * @param body - Request body (optional)
237
+ * @param body.variables - The app variables. A maximum of 10 variables can be inserted at a time. See [About Application Variables](https://help.quickbase.com/docs/creating-and-using-application-variables) (optional)
238
+ * @param body.name - The name for the app. (optional)
239
+ * @param body.securityProperties - Security properties of the application (optional)
240
+ * @param body.description - The description for the app. (optional)
241
+ *
242
+ * @returns Success
243
+ *
244
+ * @see https://developer.quickbase.com/operation/updateApp
245
+ */
246
+ updateApp(params: UpdateAppParams, body?: UpdateAppRequest): Promise<UpdateAppResponse> {
247
+ return request<UpdateAppResponse>({
248
+ method: 'POST',
249
+ path: `/apps/${params.appId}`,
250
+ body,
251
+ });
252
+ },
253
+
254
+ /**
255
+ * Delete an app
256
+ *
257
+ * Deletes an entire application, including all of the tables and data.
258
+ *
259
+ * @param params.appId - The unique identifier of an app
260
+ *
261
+ * @param body - Request body
262
+ * @param body.name - To confirm application deletion we ask for application name.
263
+ *
264
+ * @returns Success
265
+ *
266
+ * @see https://developer.quickbase.com/operation/deleteApp
267
+ */
268
+ deleteApp(params: DeleteAppParams, body: DeleteAppRequest): Promise<DeleteAppResponse> {
269
+ return request<DeleteAppResponse>({
270
+ method: 'DELETE',
271
+ path: `/apps/${params.appId}`,
272
+ body,
273
+ });
274
+ },
275
+
276
+ /**
277
+ * Get app events
278
+ *
279
+ * Get a list of events that can be triggered based on data or user actions in this application, includes: Email notification, Reminders, Subscriptions, QB Actions, Webhooks, record change triggered Automations (does not include scheduled).
280
+ *
281
+ * @param params.appId - The unique identifier of an app
282
+ *
283
+ * @returns Success
284
+ *
285
+ * @see https://developer.quickbase.com/operation/getAppEvents
286
+ */
287
+ getAppEvents(params: GetAppEventsParams): Promise<GetAppEventsResponse> {
288
+ return request<GetAppEventsResponse>({
289
+ method: 'GET',
290
+ path: `/apps/${params.appId}/events`,
291
+ });
292
+ },
293
+
294
+ /**
295
+ * Copy an app
296
+ *
297
+ * Copies the specified application. The new application will have the same schema as the original. See below for additional copy options.
298
+ *
299
+ * @param params.appId - The unique identifier of an app
300
+ *
301
+ * @param body - Request body
302
+ * @param body.name - The name of the newly copied app
303
+ * @param body.description - The description of the newly copied app (optional)
304
+ * @param body.properties - The configuration properties for performing the app copy (optional)
305
+ *
306
+ * @returns Success
307
+ *
308
+ * @see https://developer.quickbase.com/operation/copyApp
309
+ */
310
+ copyApp(params: CopyAppParams, body: CopyAppRequest): Promise<CopyAppResponse> {
311
+ return request<CopyAppResponse>({
312
+ method: 'POST',
313
+ path: `/apps/${params.appId}/copy`,
314
+ body,
315
+ });
316
+ },
317
+
318
+ /**
319
+ * Get app roles
320
+ *
321
+ * Retrieves all of the roles for an application. Requires admin access to an app.
322
+ *
323
+ * @param params.appId - The unique identifier of an app
324
+ *
325
+ * @returns Success
326
+ *
327
+ * @see https://developer.quickbase.com/operation/getRoles
328
+ */
329
+ getRoles(params: GetRolesParams): Promise<GetRolesResponse> {
330
+ return request<GetRolesResponse>({
331
+ method: 'GET',
332
+ path: `/apps/${params.appId}/roles`,
333
+ });
334
+ },
335
+
336
+ /**
337
+ * Get tables for an app
338
+ *
339
+ * Gets a list of all the tables that exist in a specific application. The properties for each table are the same as what is returned in Get table.
340
+ *
341
+ * @param params.appId - The unique identifier of an app
342
+ *
343
+ * @returns Success
344
+ *
345
+ * @see https://developer.quickbase.com/operation/getAppTables
346
+ */
347
+ getAppTables(params: GetAppTablesParams): Promise<GetAppTablesResponse> {
348
+ return request<GetAppTablesResponse>({
349
+ method: 'GET',
350
+ path: '/tables',
351
+ query: { appId: params.appId },
352
+ });
353
+ },
354
+
355
+ /**
356
+ * Create a table
357
+ *
358
+ * Creates a table in an application.
359
+ *
360
+ * @param params.appId - The unique identifier of an app
361
+ *
362
+ * @param body - Request body
363
+ * @param body.name - The name for the table.
364
+ * @param body.pluralRecordName - The plural noun for records in the table. If this value is not passed the default value is 'Records'. (optional)
365
+ * @param body.singleRecordName - The singular noun for records in the table. If this value is not passed the default value is 'Record'. (optional)
366
+ * @param body.description - The description for the table. If this value is not passed the default value is blank. (optional)
367
+ *
368
+ * @returns Success
369
+ *
370
+ * @see https://developer.quickbase.com/operation/createTable
371
+ */
372
+ createTable(params: CreateTableParams, body: CreateTableRequest): Promise<CreateTableResponse> {
373
+ return request<CreateTableResponse>({
374
+ method: 'POST',
375
+ path: '/tables',
376
+ query: { appId: params.appId },
377
+ body,
378
+ });
379
+ },
380
+
381
+ /**
382
+ * Get a table
383
+ *
384
+ * Gets the properties of an individual table that is part of an application.
385
+ *
386
+ * @param params.appId - The unique identifier of an app
387
+ * @param params.tableId - The unique identifier (dbid) of the table.
388
+ *
389
+ * @returns Success
390
+ *
391
+ * @see https://developer.quickbase.com/operation/getTable
392
+ */
393
+ getTable(params: GetTableParams): Promise<GetTableResponse> {
394
+ return request<GetTableResponse>({
395
+ method: 'GET',
396
+ path: `/tables/${params.tableId}`,
397
+ query: { appId: params.appId },
398
+ });
399
+ },
400
+
401
+ /**
402
+ * Update a table
403
+ *
404
+ * Updates the main properties of a specific table. Any properties of the table that you do not specify in the request body will remain unchanged.
405
+ *
406
+ * @param params.appId - The unique identifier of an app
407
+ * @param params.tableId - The unique identifier (dbid) of the table.
408
+ *
409
+ * @param body - Request body (optional)
410
+ * @param body.name - The name for the table. (optional)
411
+ * @param body.pluralRecordName - The plural noun for records in the table. If this value is not passed the default value is 'Records'. (optional)
412
+ * @param body.singleRecordName - The singular noun for records in the table. If this value is not passed the default value is 'Record'. (optional)
413
+ * @param body.description - The description for the table. If this value is not passed the default value is blank. (optional)
414
+ *
415
+ * @returns Success
416
+ *
417
+ * @see https://developer.quickbase.com/operation/updateTable
418
+ */
419
+ updateTable(params: UpdateTableParams, body?: UpdateTableRequest): Promise<UpdateTableResponse> {
420
+ return request<UpdateTableResponse>({
421
+ method: 'POST',
422
+ path: `/tables/${params.tableId}`,
423
+ query: { appId: params.appId },
424
+ body,
425
+ });
426
+ },
427
+
428
+ /**
429
+ * Delete a table
430
+ *
431
+ * Deletes a specific table in an application, including all of the data within it.
432
+ *
433
+ * @param params.appId - The unique identifier of an app
434
+ * @param params.tableId - The unique identifier (dbid) of the table.
435
+ *
436
+ * @returns Success
437
+ *
438
+ * @see https://developer.quickbase.com/operation/deleteTable
439
+ */
440
+ deleteTable(params: DeleteTableParams): Promise<DeleteTableResponse> {
441
+ return request<DeleteTableResponse>({
442
+ method: 'DELETE',
443
+ path: `/tables/${params.tableId}`,
444
+ query: { appId: params.appId },
445
+ });
446
+ },
447
+
448
+ /**
449
+ * Get all relationships
450
+ *
451
+ * Get a list of all relationships, and their definitions, for a specific table. Details are provided for the child side of relationships within a given application. Limited details are returned for cross-application relationships.
452
+ *
453
+ * @param params.skip - The number of relationships to skip. (optional)
454
+ * @param params.tableId - The unique identifier (dbid) of the child table.
455
+ *
456
+ * @returns Success
457
+ *
458
+ * @see https://developer.quickbase.com/operation/getRelationships
459
+ */
460
+ getRelationships(params: GetRelationshipsParams): PaginatedRequest<GetRelationshipsResponse> {
461
+ const executor = () => {
462
+ return request<GetRelationshipsResponse>({
463
+ method: 'GET',
464
+ path: `/tables/${params.tableId}/relationships`,
465
+ query: { skip: params.skip },
466
+ });
467
+ };
468
+ const paginatedExecutor = (paginationParams: { skip?: number; nextPageToken?: string; nextToken?: string }) => {
469
+ return request<GetRelationshipsResponse>({
470
+ method: 'GET',
471
+ path: `/tables/${params.tableId}/relationships`,
472
+ query: { skip: params.skip, ...paginationParams },
473
+ });
474
+ };
475
+ return createPaginatedRequest(executor, { paginatedExecutor, autoPaginate });
476
+ },
477
+
478
+ /**
479
+ * Create a relationship
480
+ *
481
+ * Creates a relationship in a table as well as lookup/summary fields. Relationships can only be created for tables within the same app.
482
+ *
483
+ * @param params.tableId - The unique identifier (dbid) of the child table.
484
+ *
485
+ * @param body - Request body
486
+ * @param body.parentTableId - The parent table id for the relationship.
487
+ * @param body.foreignKeyField - This property is optional. If it is not provided, the foreign key field will be created with the label 'Related <record>', where <record> is the name of a record in the parent table. (optional)
488
+ * @param body.summaryFields - An array of objects, each representing a configuration of one field from the child table, that will become summary fields on the parent table. When you specify the 'COUNT' accumulation type, you have to specify 0 as the summaryFid (or not set it in the request). 'DISTINCT-COUNT' requires that summaryFid be set to an actual fid. (optional)
489
+ * @param body.lookupFieldIds - An array of field IDs in the parent table that will become lookup fields in the child table. (optional)
490
+ *
491
+ * @returns Success
492
+ *
493
+ * @see https://developer.quickbase.com/operation/createRelationship
494
+ */
495
+ createRelationship(params: CreateRelationshipParams, body: CreateRelationshipRequest): Promise<CreateRelationshipResponse> {
496
+ return request<CreateRelationshipResponse>({
497
+ method: 'POST',
498
+ path: `/tables/${params.tableId}/relationship`,
499
+ body,
500
+ });
501
+ },
502
+
503
+ /**
504
+ * Update a relationship
505
+ *
506
+ * Use this endpoint to add lookup fields and summary fields to an existing relationship. Updating a relationship will not delete existing lookup/summary fields.
507
+ *
508
+ * @param params.tableId - The unique identifier (dbid) of the child table.
509
+ * @param params.relationshipId - The relationship id. This is the field id of the reference field on the child table.
510
+ *
511
+ * @param body - Request body (optional)
512
+ * @param body.summaryFields - An array of objects, each representing a configuration of one field from the child table, that will become summary fields on the parent table. When you specify the 'COUNT' accumulation type, you have to specify 0 as the summaryFid (or not set it in the request). 'DISTINCT-COUNT' requires that summaryFid be set to an actual fid. (optional)
513
+ * @param body.lookupFieldIds - An array of field IDs in the parent table that will become lookup fields in the child table. (optional)
514
+ *
515
+ * @returns Success
516
+ *
517
+ * @see https://developer.quickbase.com/operation/updateRelationship
518
+ */
519
+ updateRelationship(params: UpdateRelationshipParams, body?: UpdateRelationshipRequest): Promise<UpdateRelationshipResponse> {
520
+ return request<UpdateRelationshipResponse>({
521
+ method: 'POST',
522
+ path: `/tables/${params.tableId}/relationship/${params.relationshipId}`,
523
+ body,
524
+ });
525
+ },
526
+
527
+ /**
528
+ * Delete a relationship
529
+ *
530
+ * Use this endpoint to delete an entire relationship, including all lookup and summary fields. The reference field in the relationship will not be deleted.
531
+ *
532
+ * @param params.tableId - The unique identifier (dbid) of the child table.
533
+ * @param params.relationshipId - The relationship id. This is the field id of the reference field on the child table.
534
+ *
535
+ * @returns Success
536
+ *
537
+ * @see https://developer.quickbase.com/operation/deleteRelationship
538
+ */
539
+ deleteRelationship(params: DeleteRelationshipParams): Promise<DeleteRelationshipResponse> {
540
+ return request<DeleteRelationshipResponse>({
541
+ method: 'DELETE',
542
+ path: `/tables/${params.tableId}/relationship/${params.relationshipId}`,
543
+ });
544
+ },
545
+
546
+ /**
547
+ * Get reports for a table
548
+ *
549
+ * Get the schema (properties) of all reports for a table. If the user running the API is an application administrator, the API will also return all personal reports with owner's user id.
550
+ *
551
+ * @param params.tableId - The unique identifier (dbid) of the table.
552
+ *
553
+ * @returns Success
554
+ *
555
+ * @see https://developer.quickbase.com/operation/getTableReports
556
+ */
557
+ getTableReports(params: GetTableReportsParams): Promise<GetTableReportsResponse> {
558
+ return request<GetTableReportsResponse>({
559
+ method: 'GET',
560
+ path: '/reports',
561
+ query: { tableId: params.tableId },
562
+ });
563
+ },
564
+
565
+ /**
566
+ * Get a report
567
+ *
568
+ * Get the schema (properties) of an individual report.
569
+ *
570
+ * @param params.tableId - The unique identifier (dbid) of the table.
571
+ * @param params.reportId - The identifier of the report, unique to the table.
572
+ *
573
+ * @returns Success
574
+ *
575
+ * @see https://developer.quickbase.com/operation/getReport
576
+ */
577
+ getReport(params: GetReportParams): Promise<GetReportResponse> {
578
+ return request<GetReportResponse>({
579
+ method: 'GET',
580
+ path: `/reports/${params.reportId}`,
581
+ query: { tableId: params.tableId },
582
+ });
583
+ },
584
+
585
+ /**
586
+ * Run a report
587
+ *
588
+ * Runs a report, based on an ID and returns the underlying data associated with it. The format of the data will vary based on the report type. Reports that focus on record-level data (table, calendar, etc.) return the individual records. Aggregate reports (summary, chart) will return the summarized information as configured in the report. UI-specific elements are not returned, such as totals, averages and visualizations. Returns data with intelligent pagination based on the approximate size of each record. The metadata object will include the necessary information to iterate over the response and gather more data.
589
+ *
590
+ * @param params.tableId - The unique identifier (dbid) of the table.
591
+ * @param params.skip - The number of records to skip. You can set this value when paginating through a set of results. (optional)
592
+ * @param params.top - The maximum number of records to return. You can override the default Quickbase pagination to get more or fewer results. If your requested value here exceeds the dynamic maximums, we will return a subset of results and the rest can be gathered in subsequent API calls. (optional)
593
+ * @param params.reportId - The identifier of the report, unique to the table.
594
+ *
595
+ * @returns Success
596
+ *
597
+ * @see https://developer.quickbase.com/operation/runReport
598
+ */
599
+ runReport(params: RunReportParams): PaginatedRequest<RunReportResponse> {
600
+ const executor = () => {
601
+ return request<RunReportResponse>({
602
+ method: 'POST',
603
+ path: `/reports/${params.reportId}/run`,
604
+ query: { tableId: params.tableId, skip: params.skip, top: params.top },
605
+ });
606
+ };
607
+ const paginatedExecutor = (paginationParams: { skip?: number; nextPageToken?: string; nextToken?: string }) => {
608
+ return request<RunReportResponse>({
609
+ method: 'POST',
610
+ path: `/reports/${params.reportId}/run`,
611
+ query: { tableId: params.tableId, skip: params.skip, top: params.top, ...paginationParams },
612
+ });
613
+ };
614
+ return createPaginatedRequest(executor, { paginatedExecutor, autoPaginate });
615
+ },
616
+
617
+ /**
618
+ * Get fields for a table
619
+ *
620
+ * Gets the properties for all fields in a specific table. The properties for each field are the same as in Get field.
621
+ *
622
+ * @param params.tableId - The unique identifier (dbid) of the table.
623
+ * @param params.includeFieldPerms - Set to 'true' if you'd like to get back the custom permissions for the field(s). (optional)
624
+ *
625
+ * @returns Success
626
+ *
627
+ * @see https://developer.quickbase.com/operation/getFields
628
+ */
629
+ getFields(params: GetFieldsParams): Promise<GetFieldsResponse> {
630
+ return request<GetFieldsResponse>({
631
+ method: 'GET',
632
+ path: '/fields',
633
+ query: { tableId: params.tableId, includeFieldPerms: params.includeFieldPerms },
634
+ });
635
+ },
636
+
637
+ /**
638
+ * Create a field
639
+ *
640
+ * Creates a field within a table, including the custom permissions of that field.
641
+ *
642
+ * @param params.tableId - The unique identifier (dbid) of the table.
643
+ *
644
+ * @param body - Request body
645
+ * @param body.audited - Indicates if the field is being tracked as part of Quickbase Audit Logs. You can only set this property to "true" if the app has audit logs enabled. See Enable data change logs under [Quickbase Audit Logs](https://help.quickbase.com/docs/audit-logs). Defaults to false. (optional)
646
+ * @param body.fieldHelp - The configured help text shown to users within the product. (optional)
647
+ * @param body.bold - Indicates if the field is configured to display in bold in the product. Defaults to false. (optional)
648
+ * @param body.properties - Specific field properties. (optional)
649
+ * @param body.appearsByDefault - Indicates if the field is marked as a default in reports. Defaults to true. (optional)
650
+ * @param body.fieldType - The [field types](https://help.quickbase.com/docs/field-types), click on any of the field type links for more info.
651
+ * @param body.permissions - Field Permissions for different roles. (optional)
652
+ * @param body.addToForms - Whether the field you are adding should appear on forms. Defaults to false. (optional)
653
+ * @param body.label - The label (name) of the field.
654
+ * @param body.findEnabled - Indicates if the field is marked as searchable. Defaults to true. (optional)
655
+ * @param body.noWrap - Indicates if the field is configured to not wrap when displayed in the product. Defaults to false. (optional)
656
+ *
657
+ * @returns Success
658
+ *
659
+ * @see https://developer.quickbase.com/operation/createField
660
+ */
661
+ createField(params: CreateFieldParams, body: CreateFieldRequest): Promise<CreateFieldResponse> {
662
+ return request<CreateFieldResponse>({
663
+ method: 'POST',
664
+ path: '/fields',
665
+ query: { tableId: params.tableId },
666
+ body,
667
+ });
668
+ },
669
+
670
+ /**
671
+ * Delete field(s)
672
+ *
673
+ * Deletes one or many fields in a table, based on field id. This will also permanently delete any data or calculations in that field.
674
+ *
675
+ * @param params.tableId - The unique identifier (dbid) of the table.
676
+ *
677
+ * @param body - Request body
678
+ * @param body.fieldIds - List of field IDs to be deleted.
679
+ *
680
+ * @returns Success
681
+ *
682
+ * @see https://developer.quickbase.com/operation/deleteFields
683
+ */
684
+ deleteFields(params: DeleteFieldsParams, body: DeleteFieldsRequest): Promise<DeleteFieldsResponse> {
685
+ return request<DeleteFieldsResponse>({
686
+ method: 'DELETE',
687
+ path: '/fields',
688
+ query: { tableId: params.tableId },
689
+ body,
690
+ });
691
+ },
692
+
693
+ /**
694
+ * Get field
695
+ *
696
+ * Gets the properties of an individual field, based on field id.
697
+ Properties present on all field types are returned at the top level. Properties unique to a specific type of field are returned under the 'properties' attribute. Please see [Field types page](../fieldInfo) for more details on the properties for each field type.
698
+ *
699
+ * @param params.tableId - The unique identifier (dbid) of the table.
700
+ * @param params.includeFieldPerms - Set to 'true' if you'd like to get back the custom permissions for the field(s). (optional)
701
+ * @param params.fieldId - The unique identifier (fid) of the field.
702
+ *
703
+ * @returns Success
704
+ *
705
+ * @see https://developer.quickbase.com/operation/getField
706
+ */
707
+ getField(params: GetFieldParams): Promise<GetFieldResponse> {
708
+ return request<GetFieldResponse>({
709
+ method: 'GET',
710
+ path: `/fields/${params.fieldId}`,
711
+ query: { tableId: params.tableId, includeFieldPerms: params.includeFieldPerms },
712
+ });
713
+ },
714
+
715
+ /**
716
+ * Update a field
717
+ *
718
+ * Updates the properties and custom permissions of a field. The attempt to update certain properties might cause existing data to no longer obey the field's new properties and may be rejected. See the descriptions of required, unique, and choices, below, for specific situations. Any properties of the field that you do not specify in the request body will remain unchanged.
719
+ *
720
+ * @param params.tableId - The unique identifier (dbid) of the table.
721
+ * @param params.fieldId - The unique identifier (fid) of the field.
722
+ *
723
+ * @param body - Request body (optional)
724
+ * @param body.audited - Indicates if the field is being tracked as part of Quickbase Audit Logs. You can only set this property to "true" if the app has audit logs enabled. See Enable data change logs under [Quickbase Audit Logs](https://help.quickbase.com/user-assistance/audit_logs.html). (optional)
725
+ * @param body.fieldHelp - The configured help text shown to users within the product. (optional)
726
+ * @param body.bold - Indicates if the field is configured to display in bold in the product. (optional)
727
+ * @param body.required - Indicates if the field is required (i.e. if every record must have a non-null value in this field). If you attempt to change a field from not-required to required, and the table currently contains records that have null values in that field, you will get an error indicating that there are null values of the field. In this case you need to find and update those records with null values of the field before changing the field to required. (optional)
728
+ * @param body.properties - Specific field properties. (optional)
729
+ * @param body.appearsByDefault - Indicates if the field is marked as a default in reports. (optional)
730
+ * @param body.unique - Indicates if every record in the table must contain a unique value of this field. If you attempt to change a field from not-unique to unique, and the table currently contains records with the same value of this field, you will get an error. In this case you need to find and update those records with duplicate values of the field before changing the field to unique. (optional)
731
+ * @param body.permissions - Field Permissions for different roles. (optional)
732
+ * @param body.addToForms - Whether the field you are adding should appear on forms. (optional)
733
+ * @param body.label - The label (name) of the field. (optional)
734
+ * @param body.findEnabled - Indicates if the field is marked as searchable. (optional)
735
+ * @param body.noWrap - Indicates if the field is configured to not wrap when displayed in the product. (optional)
736
+ *
737
+ * @returns Success
738
+ *
739
+ * @see https://developer.quickbase.com/operation/updateField
740
+ */
741
+ updateField(params: UpdateFieldParams, body?: UpdateFieldRequest): Promise<UpdateFieldResponse> {
742
+ return request<UpdateFieldResponse>({
743
+ method: 'POST',
744
+ path: `/fields/${params.fieldId}`,
745
+ query: { tableId: params.tableId },
746
+ body,
747
+ });
748
+ },
749
+
750
+ /**
751
+ * Get usage for all fields
752
+ *
753
+ * Get all the field usage statistics for a table. This is a summary of the information that can be found in the usage table of field properties.
754
+ *
755
+ * @param params.tableId - The unique identifier (dbid) of the table.
756
+ * @param params.skip - The number of fields to skip from the list. (optional)
757
+ * @param params.top - The maximum number of fields to return. (optional)
758
+ *
759
+ * @returns Success
760
+ *
761
+ * @see https://developer.quickbase.com/operation/getFieldsUsage
762
+ */
763
+ getFieldsUsage(params: GetFieldsUsageParams): Promise<GetFieldsUsageResponse> {
764
+ return request<GetFieldsUsageResponse>({
765
+ method: 'GET',
766
+ path: '/fields/usage',
767
+ query: { tableId: params.tableId, skip: params.skip, top: params.top },
768
+ });
769
+ },
770
+
771
+ /**
772
+ * Get usage for a field
773
+ *
774
+ * Get a single fields usage statistics. This is a summary of the information that can be found in the usage table of field properties.
775
+ *
776
+ * @param params.tableId - The unique identifier (dbid) of the table.
777
+ * @param params.fieldId - The unique identifier (fid) of the field.
778
+ *
779
+ * @returns Success
780
+ *
781
+ * @see https://developer.quickbase.com/operation/getFieldUsage
782
+ */
783
+ getFieldUsage(params: GetFieldUsageParams): Promise<GetFieldUsageResponse> {
784
+ return request<GetFieldUsageResponse>({
785
+ method: 'GET',
786
+ path: `/fields/usage/${params.fieldId}`,
787
+ query: { tableId: params.tableId },
788
+ });
789
+ },
790
+
791
+ /**
792
+ * Run a formula
793
+ *
794
+ * Allows running a formula via an API call. Use this method in custom code to get the value back of a formula without a discrete field on a record.
795
+ *
796
+ * @param body - Request body
797
+ * @param body.formula - The formula to run. This must be a valid Quickbase formula.
798
+ * @param body.rid - The record ID to run the formula against. Only necessary for formulas that are run in the context of a record. For example, the formula User() does not need a record ID. (optional)
799
+ * @param body.from - The unique identifier (dbid) of the table.
800
+ *
801
+ * @returns Success
802
+ *
803
+ * @see https://developer.quickbase.com/operation/runFormula
804
+ */
805
+ runFormula(body: RunFormulaRequest): Promise<RunFormulaResponse> {
806
+ return request<RunFormulaResponse>({
807
+ method: 'POST',
808
+ path: '/formula/run',
809
+ body,
810
+ });
811
+ },
812
+
813
+ /**
814
+ * Insert/Update record(s)
815
+ *
816
+ * Insert and/or update record(s) in a table. In this single API call, inserts and updates can be submitted. Update can use the key field on the table, or any other supported unique field. Refer to the [Field types page](../fieldInfo) for more information about how each field type should be formatted. This operation allows for incremental processing of successful records, even when some of the records fail.
817
+ **Note:** This endpoint supports a maximum payload size of 40MB.
818
+ *
819
+ * @param body - Request body
820
+ * @param body.to - The unique identifier (dbid) of the table.
821
+ * @param body.data - Record data array, where each record contains key-value mappings of fields to be defined/updated and their values.
822
+ * @param body.mergeFieldId - The merge field id. (optional)
823
+ * @param body.fieldsToReturn - Specify an array of field IDs that will return data for any updates or added record. Record ID (FID 3) is always returned if any field ID is requested. (optional)
824
+ *
825
+ * @returns The response
826
+ *
827
+ * @see https://developer.quickbase.com/operation/upsert
828
+ */
829
+ upsert(body: UpsertRequest): PaginatedRequest<UpsertResponse> {
830
+ const executor = () => {
831
+ return request<UpsertResponse>({
832
+ method: 'POST',
833
+ path: '/records',
834
+ body,
835
+ });
836
+ };
837
+ const paginatedExecutor = (paginationParams: { skip?: number; nextPageToken?: string; nextToken?: string }) => {
838
+ const bodyRecord = body as unknown as Record<string, unknown> | undefined;
839
+ const paginatedBody = paginationParams.skip !== undefined || paginationParams.nextPageToken || paginationParams.nextToken
840
+ ? {
841
+ ...(bodyRecord || {}),
842
+ options: {
843
+ ...(bodyRecord?.options as Record<string, unknown> || {}),
844
+ ...(paginationParams.skip !== undefined ? { skip: paginationParams.skip } : {}),
845
+ },
846
+ ...(paginationParams.nextPageToken ? { nextPageToken: paginationParams.nextPageToken } : {}),
847
+ ...(paginationParams.nextToken ? { nextToken: paginationParams.nextToken } : {}),
848
+ }
849
+ : body;
850
+ return request<UpsertResponse>({
851
+ method: 'POST',
852
+ path: '/records',
853
+ body: paginatedBody,
854
+ });
855
+ };
856
+ return createPaginatedRequest(executor, { paginatedExecutor, autoPaginate });
857
+ },
858
+
859
+ /**
860
+ * Delete record(s)
861
+ *
862
+ * Deletes record(s) in a table based on a query. Alternatively, all records in the table can be deleted.
863
+ *
864
+ * @param body - Request body
865
+ * @param body.from - The unique identifier (dbid) of the table.
866
+ * @param body.where - The filter to delete records. To delete all records specify a filter that will include all records, for example {3.GT.0} where 3 is the ID of the Record ID field. Or supply a JSON array of Record IDs.
867
+ *
868
+ * @returns Successful delete records response.
869
+ *
870
+ * @see https://developer.quickbase.com/operation/deleteRecords
871
+ */
872
+ deleteRecords(body: DeleteRecordsRequest): Promise<DeleteRecordsResponse> {
873
+ return request<DeleteRecordsResponse>({
874
+ method: 'DELETE',
875
+ path: '/records',
876
+ body,
877
+ });
878
+ },
879
+
880
+ /**
881
+ * Query for data
882
+ *
883
+ * Pass in a query in the [Quickbase query language](https://help.quickbase.com/api-guide/componentsquery.html). Returns record data with [intelligent pagination](../pagination) based on the approximate size of each record. The metadata object will include the necessary information to iterate over the response and gather more data.
884
+ *
885
+ * @param body - Request body
886
+ * @param body.options - Additional query options. (optional)
887
+ * @param body.where - The filter, using the Quickbase query language, which determines the records to return. Or supply a JSON array of Record IDs. If this parameter is omitted, the query will return all records. (optional)
888
+ * @param body.groupBy - An array that contains the fields to group the records by. (optional)
889
+ * @param body.sortBy - The sortBy (optional)
890
+ * @param body.select - An array of field IDs for the fields that should be returned in the response. If empty, the default columns on the table will be returned. (optional)
891
+ * @param body.from - The unique identifier (dbid) of the table.
892
+ *
893
+ * @returns Success
894
+ *
895
+ * @see https://developer.quickbase.com/operation/runQuery
896
+ */
897
+ runQuery(body: RunQueryRequest): PaginatedRequest<RunQueryResponse> {
898
+ const executor = () => {
899
+ return request<RunQueryResponse>({
900
+ method: 'POST',
901
+ path: '/records/query',
902
+ body,
903
+ });
904
+ };
905
+ const paginatedExecutor = (paginationParams: { skip?: number; nextPageToken?: string; nextToken?: string }) => {
906
+ const bodyRecord = body as unknown as Record<string, unknown> | undefined;
907
+ const paginatedBody = paginationParams.skip !== undefined || paginationParams.nextPageToken || paginationParams.nextToken
908
+ ? {
909
+ ...(bodyRecord || {}),
910
+ options: {
911
+ ...(bodyRecord?.options as Record<string, unknown> || {}),
912
+ ...(paginationParams.skip !== undefined ? { skip: paginationParams.skip } : {}),
913
+ },
914
+ ...(paginationParams.nextPageToken ? { nextPageToken: paginationParams.nextPageToken } : {}),
915
+ ...(paginationParams.nextToken ? { nextToken: paginationParams.nextToken } : {}),
916
+ }
917
+ : body;
918
+ return request<RunQueryResponse>({
919
+ method: 'POST',
920
+ path: '/records/query',
921
+ body: paginatedBody,
922
+ });
923
+ };
924
+ return createPaginatedRequest(executor, { paginatedExecutor, autoPaginate });
925
+ },
926
+
927
+ /**
928
+ * Get records modified since
929
+ *
930
+ * Checks for record changes on the current table and crawls the record dependency graph based on a provided field list. This determines if records on the table changed after the provided timestamp, when factoring in their dependencies. This API requires app admin permissions and only reviews lookup and summary fields in [supported relationships](https://helpv2.quickbase.com/hc/en-us/articles/4570306993940-Limits-in-Quickbase#:~:text=on%20scalar%20fields-,Summary%20fields,-Text%20summary%20fields).
931
+ To return deleted records for the current table, 'Index record changes' must be enabled.
932
+ Dependent tables only evaluate current records, and deleted records are not supported.
933
+ *
934
+ * @param body - Request body (optional)
935
+ * @param body.after - A timestamp, formatted in ISO-8601 UTC, representing the date and time to search.
936
+ * @param body.fieldList - List of field IDs. Each field is crawled across the entire record dependency graph to find its source record's date modified. If one is not provided, only the current table will be referenced. (optional)
937
+ * @param body.includeDetails - When true, the individual record IDs and timestamps will be returned. If false, only the count of changes will be returned. (optional)
938
+ * @param body.from - The unique identifier (dbid) of the table.
939
+ *
940
+ * @returns Success
941
+ *
942
+ * @see https://developer.quickbase.com/operation/recordsModifiedSince
943
+ */
944
+ recordsModifiedSince(body?: RecordsModifiedSinceRequest): Promise<RecordsModifiedSinceResponse> {
945
+ return request<RecordsModifiedSinceResponse>({
946
+ method: 'POST',
947
+ path: '/records/modifiedSince',
948
+ body,
949
+ });
950
+ },
951
+
952
+ /**
953
+ * Get a temporary token for a dbid
954
+ *
955
+ * Use this endpoint to get a temporary authorization token, scoped to either an app or a table. It can only be used inside of code pages for client-side authentication because it relies on the browser session. Learn more about [extending Quickbase](https://helpv2.quickbase.com/hc/en-us/articles/4570341709844-Extending-Quickbase). You can then use this token to make other API calls (see [authorization](../auth)). This token expires in 5 minutes.
956
+ *
957
+ * @param params.dbid - The unique identifier of an app or table.
958
+ *
959
+ * @returns This token is used in the authorization header value (similar to the QB-USER-TOKEN), except it uses the QB-TEMP-TOKEN prefix header['Authorization'] = 'QB-TEMP-TOKEN {token}'
960
+ *
961
+ * @see https://developer.quickbase.com/operation/getTempTokenDBID
962
+ */
963
+ getTempTokenDBID(params: GetTempTokenDBIDParams): Promise<GetTempTokenDBIDResponse> {
964
+ return request<GetTempTokenDBIDResponse>({
965
+ method: 'GET',
966
+ path: `/auth/temporary/${params.dbid}`,
967
+ });
968
+ },
969
+
970
+ /**
971
+ * Exchange an SSO token
972
+ *
973
+ * Use this endpoint to exchange a SAML assertion for a Quickbase token following [RFC 8693](https://www.rfc-editor.org/rfc/rfc8693.html). Callers can choose to return a token compatible with SCIM, XML, or RESTful APIs. The token duration is determined by the [SAML timeout session time](https://helpv2.quickbase.com/hc/en-us/articles/4570410646420-SAML-assertion-example#:~:text=Setting%20SAML%20timeout%20session%20time). You must be able to create a SAML assertion in your code to use this endpoint. The SAML assertion is verified against the configuration on the realm. Learn more about about [SAML assertions](https://helpv2.quickbase.com/hc/en-us/articles/4570410646420-SAML-assertion-example).
974
+ *
975
+ * @param body - Request body
976
+ * @param body.grant_type - The value `urn:ietf:params:oauth:grant-type:token-exchange` indicates that a token exchange is being performed.
977
+ * @param body.requested_token_type - An identifier for the type of the requested security token. For the RESTful API, use `urn:quickbase:params:oauth:token-type:temp_token`. For the XML or SCIM APIs use `urn:quickbase:params:oauth:token-type:temp_ticket`.
978
+ * @param body.subject_token - A security token that represents the identity of the party on behalf of whom the request is being made. For SAML 2.0, the value should be a base64url-encoded SAML 2.0 assertion.
979
+ * @param body.subject_token_type - An identifier that indicates the type of the security token in the `subject_token` parameter.
980
+ *
981
+ * @returns Success
982
+ *
983
+ * @see https://developer.quickbase.com/operation/exchangeSsoToken
984
+ */
985
+ exchangeSsoToken(body: ExchangeSsoTokenRequest): Promise<ExchangeSsoTokenResponse> {
986
+ return request<ExchangeSsoTokenResponse>({
987
+ method: 'POST',
988
+ path: '/auth/oauth/token',
989
+ body,
990
+ });
991
+ },
992
+
993
+ /**
994
+ * Clone a user token
995
+ *
996
+ * Clones the authenticated user token. All applications associated with that token are automatically associated with the new token.
997
+ *
998
+ * @param body - Request body
999
+ * @param body.name - The new name for the cloned user token. (optional)
1000
+ * @param body.description - The description for the cloned user token. (optional)
1001
+ *
1002
+ * @returns The response
1003
+ *
1004
+ * @see https://developer.quickbase.com/operation/cloneUserToken
1005
+ */
1006
+ cloneUserToken(body: CloneUserTokenRequest): Promise<CloneUserTokenResponse> {
1007
+ return request<CloneUserTokenResponse>({
1008
+ method: 'POST',
1009
+ path: '/usertoken/clone',
1010
+ body,
1011
+ });
1012
+ },
1013
+
1014
+ /**
1015
+ * Transfer a user token
1016
+ *
1017
+ * Transfers the specified user token. Application associations will remain intact. For security, permissions must manually be reconciled. Only realm or account admins can use this API.
1018
+ *
1019
+ * @param body - Request body
1020
+ * @param body.id - The id of the user token to transfer
1021
+ * @param body.from - The id of the user to transfer the user token from
1022
+ * @param body.to - The id of the user to transfer the user token to
1023
+ *
1024
+ * @returns The response
1025
+ *
1026
+ * @see https://developer.quickbase.com/operation/transferUserToken
1027
+ */
1028
+ transferUserToken(body: TransferUserTokenRequest): Promise<TransferUserTokenResponse> {
1029
+ return request<TransferUserTokenResponse>({
1030
+ method: 'POST',
1031
+ path: '/usertoken/transfer',
1032
+ body,
1033
+ });
1034
+ },
1035
+
1036
+ /**
1037
+ * Deactivate a user token
1038
+ *
1039
+ * Deactivates the authenticated user token. Once this is done, the user token must be reactivated in the user interface.
1040
+ *
1041
+ * @returns The response
1042
+ *
1043
+ * @see https://developer.quickbase.com/operation/deactivateUserToken
1044
+ */
1045
+ deactivateUserToken(): Promise<DeactivateUserTokenResponse> {
1046
+ return request<DeactivateUserTokenResponse>({
1047
+ method: 'POST',
1048
+ path: '/usertoken/deactivate',
1049
+ });
1050
+ },
1051
+
1052
+ /**
1053
+ * Delete a user token
1054
+ *
1055
+ * Deletes the authenticated user token. This is not reversible.
1056
+ *
1057
+ * @returns The response
1058
+ *
1059
+ * @see https://developer.quickbase.com/operation/deleteUserToken
1060
+ */
1061
+ deleteUserToken(): Promise<DeleteUserTokenResponse> {
1062
+ return request<DeleteUserTokenResponse>({
1063
+ method: 'DELETE',
1064
+ path: '/usertoken',
1065
+ });
1066
+ },
1067
+
1068
+ /**
1069
+ * Download file
1070
+ *
1071
+ * Downloads the file attachment, with the file attachment content encoded in base64 format. The API response returns the file name in the `Content-Disposition` header. Meta-data about files can be retrieved from the /records and /reports endpoints, where applicable. Use those endpoints to get the necessary information to fetch files.
1072
+ *
1073
+ * @param params.tableId - The unique identifier (dbid) of the table.
1074
+ * @param params.recordId - The unique identifier of the record.
1075
+ * @param params.fieldId - The unique identifier (fid) of the field.
1076
+ * @param params.versionNumber - The file attachment version number.
1077
+ *
1078
+ * @returns Success
1079
+ *
1080
+ * @see https://developer.quickbase.com/operation/downloadFile
1081
+ */
1082
+ downloadFile(params: DownloadFileParams): Promise<DownloadFileResponse> {
1083
+ return request<DownloadFileResponse>({
1084
+ method: 'GET',
1085
+ path: `/files/${params.tableId}/${params.recordId}/${params.fieldId}/${params.versionNumber}`,
1086
+ responseType: 'text',
1087
+ });
1088
+ },
1089
+
1090
+ /**
1091
+ * Delete file
1092
+ *
1093
+ * Deletes one file attachment version. Meta-data about files can be retrieved from the /records and /reports endpoints, where applicable. Use those endpoints to get the necessary information to delete file versions.
1094
+ *
1095
+ * @param params.tableId - The unique identifier (dbid) of the table.
1096
+ * @param params.recordId - The unique identifier of the record.
1097
+ * @param params.fieldId - The unique identifier (fid) of the field.
1098
+ * @param params.versionNumber - The file attachment version number. Passing versionNumber 0 will delete the most recent version.
1099
+ *
1100
+ * @returns Successfully Deleted the File Attachment
1101
+ *
1102
+ * @see https://developer.quickbase.com/operation/deleteFile
1103
+ */
1104
+ deleteFile(params: DeleteFileParams): Promise<DeleteFileResponse> {
1105
+ return request<DeleteFileResponse>({
1106
+ method: 'DELETE',
1107
+ path: `/files/${params.tableId}/${params.recordId}/${params.fieldId}/${params.versionNumber}`,
1108
+ });
1109
+ },
1110
+
1111
+ /**
1112
+ * Get users
1113
+ *
1114
+ * Get all users in an account or narrowed down list of users filtered by email(s). The returned users may be paginated depending on the user count. The count of the returned users may vary. When `nextPageToken` value in the response is not empty, that indicates that there are more results to be returned, you can use this value to get the next result set ('page'). Only realm or account admins can use this API.
1115
+ *
1116
+ * @param params.accountId - The account id being used to get users. If no value is specified, the first account associated with the requesting user token is chosen. (optional)
1117
+ *
1118
+ * @param body - Request body (optional)
1119
+ * @param body.emails - When provided, the returned users will be narrowed down only to the users included in this list. (optional)
1120
+ * @param body.appIds - When provided, the returned users will be narrowed down only to the users assigned to the app id's provided in this list. The provided app id's should belong to the same account. (optional)
1121
+ * @param body.nextPageToken - Next page token used to get the next 'page' of results when available. When this field is empty, the first page is returned. (optional)
1122
+ *
1123
+ * @returns Success
1124
+ *
1125
+ * @see https://developer.quickbase.com/operation/getUsers
1126
+ */
1127
+ getUsers(params: GetUsersParams, body?: GetUsersRequest): PaginatedRequest<GetUsersResponse> {
1128
+ const executor = () => {
1129
+ return request<GetUsersResponse>({
1130
+ method: 'POST',
1131
+ path: '/users',
1132
+ query: { accountId: params.accountId },
1133
+ body,
1134
+ });
1135
+ };
1136
+ const paginatedExecutor = (paginationParams: { skip?: number; nextPageToken?: string; nextToken?: string }) => {
1137
+ const bodyRecord = body as unknown as Record<string, unknown> | undefined;
1138
+ const paginatedBody = paginationParams.skip !== undefined || paginationParams.nextPageToken || paginationParams.nextToken
1139
+ ? {
1140
+ ...(bodyRecord || {}),
1141
+ options: {
1142
+ ...(bodyRecord?.options as Record<string, unknown> || {}),
1143
+ ...(paginationParams.skip !== undefined ? { skip: paginationParams.skip } : {}),
1144
+ },
1145
+ ...(paginationParams.nextPageToken ? { nextPageToken: paginationParams.nextPageToken } : {}),
1146
+ ...(paginationParams.nextToken ? { nextToken: paginationParams.nextToken } : {}),
1147
+ }
1148
+ : body;
1149
+ return request<GetUsersResponse>({
1150
+ method: 'POST',
1151
+ path: '/users',
1152
+ query: { accountId: params.accountId },
1153
+ body: paginatedBody,
1154
+ });
1155
+ };
1156
+ return createPaginatedRequest(executor, { paginatedExecutor, autoPaginate });
1157
+ },
1158
+
1159
+ /**
1160
+ * Deny users
1161
+ *
1162
+ * Denies users access to the realm but leaves them listed in groups they have been added to. Only realm or account admins can use this API.
1163
+ *
1164
+ * @param params.accountId - The account id being used to deny users. If no value is specified, the first account associated with the requesting user token is chosen. (optional)
1165
+ *
1166
+ * @param body - A list of user IDs that need to be denied.
1167
+ *
1168
+ * @returns Success
1169
+ *
1170
+ * @see https://developer.quickbase.com/operation/denyUsers
1171
+ */
1172
+ denyUsers(paramsOrBody: DenyUsersParams | DenyUsersRequest, maybeBody?: DenyUsersRequest): Promise<DenyUsersResponse> {
1173
+ const [params, body] = maybeBody === undefined
1174
+ ? [{} as DenyUsersParams, paramsOrBody as DenyUsersRequest]
1175
+ : [paramsOrBody as DenyUsersParams, maybeBody];
1176
+ return request<DenyUsersResponse>({
1177
+ method: 'PUT',
1178
+ path: '/users/deny',
1179
+ query: { accountId: params.accountId },
1180
+ body,
1181
+ });
1182
+ },
1183
+
1184
+ /**
1185
+ * Deny and remove users from groups
1186
+ *
1187
+ * Denies users access to the realm and allows you to remove them from groups. Only realm or account admins can use this API.
1188
+ *
1189
+ * @param params.accountId - The account id being used to deny users. If no value is specified, the first account associated with the requesting user token is chosen. (optional)
1190
+ * @param params.shouldDeleteFromGroups - Specifies if the users should also be removed from all groups.
1191
+ *
1192
+ * @param body - A list of user IDs that need to be denied.
1193
+ *
1194
+ * @returns Success
1195
+ *
1196
+ * @see https://developer.quickbase.com/operation/denyUsersAndGroups
1197
+ */
1198
+ denyUsersAndGroups(params: DenyUsersAndGroupsParams, body: DenyUsersAndGroupsRequest): Promise<DenyUsersAndGroupsResponse> {
1199
+ return request<DenyUsersAndGroupsResponse>({
1200
+ method: 'PUT',
1201
+ path: `/users/deny/${params.shouldDeleteFromGroups}`,
1202
+ query: { accountId: params.accountId },
1203
+ body,
1204
+ });
1205
+ },
1206
+
1207
+ /**
1208
+ * Undeny users
1209
+ *
1210
+ * Grants users that have previously been denied access to the realm. Only realm or account admins can use this API.
1211
+ *
1212
+ * @param params.accountId - The account id being used to undeny users. If no value is specified, the first account associated with the requesting user token is chosen. (optional)
1213
+ *
1214
+ * @param body - A list of user IDs that need to be undenied.
1215
+ *
1216
+ * @returns Success
1217
+ *
1218
+ * @see https://developer.quickbase.com/operation/undenyUsers
1219
+ */
1220
+ undenyUsers(paramsOrBody: UndenyUsersParams | UndenyUsersRequest, maybeBody?: UndenyUsersRequest): Promise<UndenyUsersResponse> {
1221
+ const [params, body] = maybeBody === undefined
1222
+ ? [{} as UndenyUsersParams, paramsOrBody as UndenyUsersRequest]
1223
+ : [paramsOrBody as UndenyUsersParams, maybeBody];
1224
+ return request<UndenyUsersResponse>({
1225
+ method: 'PUT',
1226
+ path: '/users/undeny',
1227
+ query: { accountId: params.accountId },
1228
+ body,
1229
+ });
1230
+ },
1231
+
1232
+ /**
1233
+ * Get apps for a user
1234
+ *
1235
+ * Returns a list of applications that a specific user has access to within an account. Only account admins can use this API.
1236
+ *
1237
+ * @param params.userId - The unique identifier of the user, including the hashed value (for example, 59913288.d772).
1238
+ * @param params.accountId - The account id used to scope the request.
1239
+ *
1240
+ * @returns Success
1241
+ *
1242
+ * @see https://developer.quickbase.com/operation/getUserApps
1243
+ */
1244
+ getUserApps(params: GetUserAppsParams): Promise<GetUserAppsResponse> {
1245
+ return request<GetUserAppsResponse>({
1246
+ method: 'GET',
1247
+ path: `/users/${params.userId}/apps`,
1248
+ query: { accountId: params.accountId },
1249
+ });
1250
+ },
1251
+
1252
+ /**
1253
+ * Add members
1254
+ *
1255
+ * Adds a list of users to a given group as members.
1256
+ *
1257
+ * @param params.gid - This is the ID of the group being modified.
1258
+ *
1259
+ * @param body - A list of user IDs that will be added to a group.
1260
+ *
1261
+ * @returns Success
1262
+ *
1263
+ * @see https://developer.quickbase.com/operation/addMembersToGroup
1264
+ */
1265
+ addMembersToGroup(params: AddMembersToGroupParams, body: AddMembersToGroupRequest): Promise<AddMembersToGroupResponse> {
1266
+ return request<AddMembersToGroupResponse>({
1267
+ method: 'POST',
1268
+ path: `/groups/${params.gid}/members`,
1269
+ body,
1270
+ });
1271
+ },
1272
+
1273
+ /**
1274
+ * Remove members
1275
+ *
1276
+ * Removes a list of members from a given group.
1277
+ *
1278
+ * @param params.gid - This is the ID of the group being modified.
1279
+ *
1280
+ * @param body - A list of user IDs that will be removed from a group.
1281
+ *
1282
+ * @returns Success
1283
+ *
1284
+ * @see https://developer.quickbase.com/operation/removeMembersFromGroup
1285
+ */
1286
+ removeMembersFromGroup(params: RemoveMembersFromGroupParams, body: RemoveMembersFromGroupRequest): Promise<RemoveMembersFromGroupResponse> {
1287
+ return request<RemoveMembersFromGroupResponse>({
1288
+ method: 'DELETE',
1289
+ path: `/groups/${params.gid}/members`,
1290
+ body,
1291
+ });
1292
+ },
1293
+
1294
+ /**
1295
+ * Add managers
1296
+ *
1297
+ * Adds a list of users to a given group as managers.
1298
+ *
1299
+ * @param params.gid - This is the ID of the group being modified.
1300
+ *
1301
+ * @param body - A list of user IDs that will be added to a group.
1302
+ *
1303
+ * @returns Success
1304
+ *
1305
+ * @see https://developer.quickbase.com/operation/addManagersToGroup
1306
+ */
1307
+ addManagersToGroup(params: AddManagersToGroupParams, body: AddManagersToGroupRequest): Promise<AddManagersToGroupResponse> {
1308
+ return request<AddManagersToGroupResponse>({
1309
+ method: 'POST',
1310
+ path: `/groups/${params.gid}/managers`,
1311
+ body,
1312
+ });
1313
+ },
1314
+
1315
+ /**
1316
+ * Remove managers
1317
+ *
1318
+ * Removes a list of managers from a given group.
1319
+ *
1320
+ * @param params.gid - This is the ID of the group being modified.
1321
+ *
1322
+ * @param body - A list of user IDs that will be removed from a group.
1323
+ *
1324
+ * @returns Success
1325
+ *
1326
+ * @see https://developer.quickbase.com/operation/removeManagersFromGroup
1327
+ */
1328
+ removeManagersFromGroup(params: RemoveManagersFromGroupParams, body: RemoveManagersFromGroupRequest): Promise<RemoveManagersFromGroupResponse> {
1329
+ return request<RemoveManagersFromGroupResponse>({
1330
+ method: 'DELETE',
1331
+ path: `/groups/${params.gid}/managers`,
1332
+ body,
1333
+ });
1334
+ },
1335
+
1336
+ /**
1337
+ * Add child groups
1338
+ *
1339
+ * Adds a list of groups to a given group.
1340
+ *
1341
+ * @param params.gid - This is the ID of the group being modified.
1342
+ *
1343
+ * @param body - A list of group IDs that will be added to a group.
1344
+ *
1345
+ * @returns Success
1346
+ *
1347
+ * @see https://developer.quickbase.com/operation/addSubgroupsToGroup
1348
+ */
1349
+ addSubgroupsToGroup(params: AddSubgroupsToGroupParams, body: AddSubgroupsToGroupRequest): Promise<AddSubgroupsToGroupResponse> {
1350
+ return request<AddSubgroupsToGroupResponse>({
1351
+ method: 'POST',
1352
+ path: `/groups/${params.gid}/subgroups`,
1353
+ body,
1354
+ });
1355
+ },
1356
+
1357
+ /**
1358
+ * Remove child groups
1359
+ *
1360
+ * Removes a list of groups from a given group.
1361
+ *
1362
+ * @param params.gid - This is the ID of the group being modified.
1363
+ *
1364
+ * @param body - A list of group IDs that will be removed from a group.
1365
+ *
1366
+ * @returns Success
1367
+ *
1368
+ * @see https://developer.quickbase.com/operation/removeSubgroupsFromGroup
1369
+ */
1370
+ removeSubgroupsFromGroup(params: RemoveSubgroupsFromGroupParams, body: RemoveSubgroupsFromGroupRequest): Promise<RemoveSubgroupsFromGroupResponse> {
1371
+ return request<RemoveSubgroupsFromGroupResponse>({
1372
+ method: 'DELETE',
1373
+ path: `/groups/${params.gid}/subgroups`,
1374
+ body,
1375
+ });
1376
+ },
1377
+
1378
+ /**
1379
+ * Get audit logs
1380
+ *
1381
+ * Gathers the audit logs for a single day from a realm. By default, this API returns 10,000 entries. This can be changed with the numRows parameter. Integrators can iterate through batches to get an entire day's worth of logs. Each realm has a maximum entitlement of querying 1,000 days per year (allowing lookbacks for up to two years). Requests for paginated data do not count towards the annual limit. Transactional rate limits are 10 per 10 seconds.
1382
+ **Note:** This API is available for enterprise users only.
1383
+ *
1384
+ * @param body - Request body
1385
+ * @param body.nextToken - Token specifying start of page. For first page don't supply this. (optional)
1386
+ * @param body.numRows - Number of logs to return per page, default is 10000, minimum is 1000, max is 50000. (optional)
1387
+ * @param body.queryId - The query id of an audit log request. This id is needed to fetch subsequent paged results of a single query. (optional)
1388
+ * @param body.date - The date for which audit logs need to be fetched. This must be date-time only, as YYYY-MM-DD, and a valid date in the past. (optional)
1389
+ * @param body.topics - An array that may contain up to 20 [topics](https://resources.quickbase.com/nav/app/budurkasx/action/showpage/2b2941e4-f34d-4d41-9b0e-db790d20e9ab?pageIdV2=quickbase.com-DashboardGroup-15760d74-2243-4ce9-9495-7cc8790f12e7) to filter by. If empty, all topics are returned. (optional)
1390
+ *
1391
+ * @returns Query ran successfully and has returned the events for the given time period.
1392
+ *
1393
+ * @see https://developer.quickbase.com/operation/audit
1394
+ */
1395
+ audit(body: AuditRequest): Promise<AuditResponse> {
1396
+ return request<AuditResponse>({
1397
+ method: 'POST',
1398
+ path: '/audit',
1399
+ body,
1400
+ });
1401
+ },
1402
+
1403
+ /**
1404
+ * Get read summaries
1405
+ *
1406
+ * Get user read and integration read summaries for any day in the past.
1407
+ **Note:** This API is available for enterprise users only.
1408
+ *
1409
+ * @param params.day - The date for which read summaries need to be fetched. This must be date-time only, as YYYY-MM-DD, and a valid date in the past.
1410
+ *
1411
+ * @returns Summaries returned succesfully
1412
+ *
1413
+ * @see https://developer.quickbase.com/operation/platformAnalyticReads
1414
+ */
1415
+ platformAnalyticReads(params: PlatformAnalyticReadsParams): Promise<PlatformAnalyticReadsResponse> {
1416
+ return request<PlatformAnalyticReadsResponse>({
1417
+ method: 'GET',
1418
+ path: '/analytics/reads',
1419
+ query: { day: params.day },
1420
+ });
1421
+ },
1422
+
1423
+ /**
1424
+ * Get event summaries
1425
+ *
1426
+ * Get event summaries for any span of days up to one year and excluding future dates.
1427
+ **Note:** This API is available for enterprise users only. Data is updated hourly. To ensure accuracy, query dates should be at least one hour in the past. Transactional rate limits are 100 per hour.
1428
+ *
1429
+ * @param params.accountId - The ID of the account to query. If no value is specified, the first account matching the provided domain is chosen. (optional)
1430
+ *
1431
+ * @param body - Request body (optional)
1432
+ * @param body.start - Supply whole-hour timestamps (YYYY-MM-DDTHH:00:00Z) to ensure the boundary hour is included in results. Summary data is available in hourly chunks only. Timestamps are evaluated in UTC; if your timestamp includes a timezone offset, confirm which UTC hour it maps to. Example: A start of 2:00 PM UTC includes the 2:00 PM bucket. A sub-hour value like 2:15 PM UTC does not.
1433
+ * @param body.end - Supply whole-hour timestamps (YYYY-MM-DDTHH:00:00Z) to ensure results stop at your intended boundary. Summary data is available in hourly chunks only. Timestamps are evaluated in UTC; if your timestamp includes a timezone offset, confirm which UTC hour it maps to. Example: An end of 3:00 PM UTC returns data through the end of the 3:00 PM bucket. A sub-hour value like 2:33 PM UTC returns the full 2:00 PM bucket instead.
1434
+ * @param body.nextToken - A pagination token from a previous response made using the same parameters. Used to fetch the next page. (optional)
1435
+ * @param body.groupBy - How the events should be grouped.
1436
+ * @param body.where - A list of items to filter events by. Only events which match ALL criteria will be included in the results. (optional)
1437
+ *
1438
+ * @returns Event summaries returned succesfully
1439
+ *
1440
+ * @see https://developer.quickbase.com/operation/platformAnalyticEventSummaries
1441
+ */
1442
+ platformAnalyticEventSummaries(params: PlatformAnalyticEventSummariesParams, body?: PlatformAnalyticEventSummariesRequest): PaginatedRequest<PlatformAnalyticEventSummariesResponse> {
1443
+ const executor = () => {
1444
+ return request<PlatformAnalyticEventSummariesResponse>({
1445
+ method: 'POST',
1446
+ path: '/analytics/events/summaries',
1447
+ query: { accountId: params.accountId },
1448
+ body,
1449
+ });
1450
+ };
1451
+ const paginatedExecutor = (paginationParams: { skip?: number; nextPageToken?: string; nextToken?: string }) => {
1452
+ const bodyRecord = body as unknown as Record<string, unknown> | undefined;
1453
+ const paginatedBody = paginationParams.skip !== undefined || paginationParams.nextPageToken || paginationParams.nextToken
1454
+ ? {
1455
+ ...(bodyRecord || {}),
1456
+ options: {
1457
+ ...(bodyRecord?.options as Record<string, unknown> || {}),
1458
+ ...(paginationParams.skip !== undefined ? { skip: paginationParams.skip } : {}),
1459
+ },
1460
+ ...(paginationParams.nextPageToken ? { nextPageToken: paginationParams.nextPageToken } : {}),
1461
+ ...(paginationParams.nextToken ? { nextToken: paginationParams.nextToken } : {}),
1462
+ }
1463
+ : body;
1464
+ return request<PlatformAnalyticEventSummariesResponse>({
1465
+ method: 'POST',
1466
+ path: '/analytics/events/summaries',
1467
+ query: { accountId: params.accountId },
1468
+ body: paginatedBody,
1469
+ });
1470
+ };
1471
+ return createPaginatedRequest(executor, { paginatedExecutor, autoPaginate });
1472
+ },
1473
+
1474
+ /**
1475
+ * Generate a document
1476
+ *
1477
+ * Generates a document from a template. After changing a template, allow up to 15 minutes for documents generated via the API to reflect the changes. This feature is only available on business or enterprise plans.
1478
+ *
1479
+ * @param params.tableId - The unique identifier (dbid) of the table.
1480
+ * @param params.recordId - The ID of the record (optional)
1481
+ * @param params.filename - File name for the downloaded file (optional)
1482
+ * @param params.templateId - This is the ID of document template.
1483
+ * @param params.format - The format of the file that is returned. Default is "pdf". (optional)
1484
+ * @param params.margin - Margin formatted as top right bottom left, separated by spaces. Add to override the value set in the template builder. (optional)
1485
+ * @param params.unit - Unit of measurement for the margin. Default is "in". Add to override the value set in the template builder. (optional)
1486
+ * @param params.pageSize - Page size. Default is "A4". Add to override the value set in the template builder. (optional)
1487
+ * @param params.orientation - Page orientation. Default is "portrait". Add to override the value set in the template builder. (optional)
1488
+ * @param params.realm - Your Quickbase domain, for example demo.quickbase.com (optional)
1489
+ *
1490
+ * @returns Success
1491
+ *
1492
+ * @see https://developer.quickbase.com/operation/generateDocument
1493
+ */
1494
+ generateDocument(params: GenerateDocumentParams): Promise<GenerateDocumentResponse> {
1495
+ return request<GenerateDocumentResponse>({
1496
+ method: 'GET',
1497
+ path: `/docTemplates/${params.templateId}/generate`,
1498
+ query: { tableId: params.tableId, recordId: params.recordId, filename: params.filename, format: params.format, margin: params.margin, unit: params.unit, pageSize: params.pageSize, orientation: params.orientation, realm: params.realm },
1499
+ });
1500
+ },
1501
+
1502
+ /**
1503
+ * Export a solution
1504
+ *
1505
+ * Returns the QBL for the specified solution. Learn more about [QBL syntax](https://help.quickbase.com/docs/qbl-definition-structure-and-syntax).
1506
+ We are releasing schema coverage for QBL in stages. See [what's supported today](https://help.quickbase.com/docs/qbl-versions) in our QBL documentation.
1507
+ *
1508
+ * @param params.solutionId - The unique identifier (UUID) or the alias of the solution.
1509
+ *
1510
+ * @returns Success
1511
+ *
1512
+ * @see https://developer.quickbase.com/operation/exportSolution
1513
+ */
1514
+ exportSolution(params: ExportSolutionParams): Promise<ExportSolutionResponse> {
1515
+ return request<ExportSolutionResponse>({
1516
+ method: 'GET',
1517
+ path: `/solutions/${params.solutionId}`,
1518
+ responseType: 'text',
1519
+ });
1520
+ },
1521
+
1522
+ /**
1523
+ * Update a solution
1524
+ *
1525
+ * Updates the solution using the provided QBL. Learn more about [QBL syntax](https://help.quickbase.com/hc/en-us/articles/24845511223828-What-is-QBL).
1526
+ We are releasing schema coverage for QBL in stages. See [what's supported today](https://helpv2.quickbase.com/hc/en-us/sections/26699387198228-QBL-Versions) in our QBL documentation.
1527
+ *
1528
+ * @param params.solutionId - The unique identifier (UUID) or the alias of the solution.
1529
+ *
1530
+ * @param body - The QBL to be used for the update.
1531
+ *
1532
+ * @returns Success
1533
+ *
1534
+ * @see https://developer.quickbase.com/operation/updateSolution
1535
+ */
1536
+ updateSolution(params: UpdateSolutionParams, body: UpdateSolutionRequest): Promise<UpdateSolutionResponse> {
1537
+ return request<UpdateSolutionResponse>({
1538
+ method: 'PUT',
1539
+ path: `/solutions/${params.solutionId}`,
1540
+ body,
1541
+ bodyType: 'application/x-yaml',
1542
+ });
1543
+ },
1544
+
1545
+ /**
1546
+ * Create a solution
1547
+ *
1548
+ * Creates a solution using the provided QBL. Learn more about [QBL syntax](https://help.quickbase.com/hc/en-us/articles/24845511223828-What-is-QBL).
1549
+ We are releasing schema coverage for QBL in stages. See [what's supported today](https://helpv2.quickbase.com/hc/en-us/sections/26699387198228-QBL-Versions) in our QBL documentation.
1550
+ *
1551
+ * @param params.alias - An optional alias to identify the solution. This can be used instead of the UUID in subsequent API calls. (optional)
1552
+ *
1553
+ * @param body - The QBL to be used for the create.
1554
+ *
1555
+ * @returns Success
1556
+ *
1557
+ * @see https://developer.quickbase.com/operation/createSolution
1558
+ */
1559
+ createSolution(paramsOrBody: CreateSolutionParams | CreateSolutionRequest, maybeBody?: CreateSolutionRequest): Promise<CreateSolutionResponse> {
1560
+ const [params, body] = maybeBody === undefined
1561
+ ? [{} as CreateSolutionParams, paramsOrBody as CreateSolutionRequest]
1562
+ : [paramsOrBody as CreateSolutionParams, maybeBody];
1563
+ return request<CreateSolutionResponse>({
1564
+ method: 'POST',
1565
+ path: '/solutions',
1566
+ query: { alias: params.alias },
1567
+ body,
1568
+ bodyType: 'application/x-yaml',
1569
+ });
1570
+ },
1571
+
1572
+ /**
1573
+ * Export solution to record
1574
+ *
1575
+ * Exports the solution and outputs the resulting QBL in a new record in the specified table. The QBL will be saved to a file in the file attachment field that is specified. The table cannot have any required fields besides the file attachment field.
1576
+ We are releasing schema coverage for QBL in stages. See [what's supported today](https://helpv2.quickbase.com/hc/en-us/sections/26699387198228-QBL-Versions) in our QBL documentation.
1577
+ *
1578
+ * @param params.solutionId - The unique identifier (UUID) or the alias of the solution.
1579
+ * @param params.tableId - The unique identifier (dbid) of the table.
1580
+ * @param params.fieldId - The unique identifier (fid) of the field. It needs to be a file attachment field.
1581
+ *
1582
+ * @returns Success
1583
+ *
1584
+ * @see https://developer.quickbase.com/operation/exportSolutionToRecord
1585
+ */
1586
+ exportSolutionToRecord(params: ExportSolutionToRecordParams): Promise<ExportSolutionToRecordResponse> {
1587
+ return request<ExportSolutionToRecordResponse>({
1588
+ method: 'GET',
1589
+ path: `/solutions/${params.solutionId}/torecord`,
1590
+ query: { tableId: params.tableId, fieldId: params.fieldId },
1591
+ });
1592
+ },
1593
+
1594
+ /**
1595
+ * Create solution from record
1596
+ *
1597
+ * Creates a solution using the QBL from the specified record.
1598
+ We are releasing schema coverage for QBL in stages. See [what's supported today](https://helpv2.quickbase.com/hc/en-us/sections/26699387198228-QBL-Versions) in our QBL documentation.
1599
+ *
1600
+ * @param params.alias - An optional alias to identify the solution. This can be used instead of the UUID in subsequent API calls. (optional)
1601
+ * @param params.tableId - The unique identifier (dbid) of the table.
1602
+ * @param params.fieldId - The unique identifier (fid) of the field. It needs to be a file attachment field.
1603
+ * @param params.recordId - The unique identifier of the record.
1604
+ *
1605
+ * @returns Success
1606
+ *
1607
+ * @see https://developer.quickbase.com/operation/createSolutionFromRecord
1608
+ */
1609
+ createSolutionFromRecord(params: CreateSolutionFromRecordParams): Promise<CreateSolutionFromRecordResponse> {
1610
+ return request<CreateSolutionFromRecordResponse>({
1611
+ method: 'GET',
1612
+ path: '/solutions/fromrecord',
1613
+ query: { alias: params.alias, tableId: params.tableId, fieldId: params.fieldId, recordId: params.recordId },
1614
+ });
1615
+ },
1616
+
1617
+ /**
1618
+ * Update solution from record
1619
+ *
1620
+ * Updates a solution using the QBL from the specified record.
1621
+ We are releasing schema coverage for QBL in stages. See [what's supported today](https://helpv2.quickbase.com/hc/en-us/sections/26699387198228-QBL-Versions) in our QBL documentation.
1622
+ *
1623
+ * @param params.solutionId - The unique identifier (UUID) or the alias of the solution.
1624
+ * @param params.tableId - The unique identifier (dbid) of the table.
1625
+ * @param params.fieldId - The unique identifier (fid) of the field. It needs to be a file attachment field.
1626
+ * @param params.recordId - The unique identifier of the record.
1627
+ *
1628
+ * @returns Success
1629
+ *
1630
+ * @see https://developer.quickbase.com/operation/updateSolutionToRecord
1631
+ */
1632
+ updateSolutionToRecord(params: UpdateSolutionToRecordParams): Promise<UpdateSolutionToRecordResponse> {
1633
+ return request<UpdateSolutionToRecordResponse>({
1634
+ method: 'GET',
1635
+ path: `/solutions/${params.solutionId}/fromrecord`,
1636
+ query: { tableId: params.tableId, fieldId: params.fieldId, recordId: params.recordId },
1637
+ });
1638
+ },
1639
+
1640
+ /**
1641
+ * List solution changes
1642
+ *
1643
+ * Returns a list of changes that would occur if the provided QBL were to be applied to the solution, without actually making those changes. This is useful for validating changes or previewing the impact before updating a solution. Learn more about [QBL syntax](https://help.quickbase.com/hc/en-us/articles/24845511223828-What-is-QBL).
1644
+ We are releasing schema coverage for QBL in stages. See [what's supported today](https://helpv2.quickbase.com/hc/en-us/sections/26699387198228-QBL-Versions) in our QBL documentation.
1645
+ *
1646
+ * @param params.solutionId - The unique identifier (UUID) or the alias of the solution.
1647
+ *
1648
+ * @param body - The QBL to be used for the changeset.
1649
+ *
1650
+ * @returns Success
1651
+ *
1652
+ * @see https://developer.quickbase.com/operation/changesetSolution
1653
+ */
1654
+ changesetSolution(params: ChangesetSolutionParams, body: ChangesetSolutionRequest): Promise<ChangesetSolutionResponse> {
1655
+ return request<ChangesetSolutionResponse>({
1656
+ method: 'PUT',
1657
+ path: `/solutions/${params.solutionId}/changeset`,
1658
+ body,
1659
+ bodyType: 'application/x-yaml',
1660
+ });
1661
+ },
1662
+
1663
+ /**
1664
+ * List solution changes from record
1665
+ *
1666
+ * Returns a list of changes that would occur if the QBL from the provided record were to be applied.
1667
+ We are releasing schema coverage for QBL in stages. See [what's supported today](https://helpv2.quickbase.com/hc/en-us/sections/26699387198228-QBL-Versions) in our QBL documentation.
1668
+ *
1669
+ * @param params.solutionId - The unique identifier (UUID) or the alias of the solution.
1670
+ * @param params.tableId - The unique identifier (dbid) of the table.
1671
+ * @param params.fieldId - The unique identifier (fid) of the field. It needs to be a file attachment field.
1672
+ * @param params.recordId - The unique identifier of the record.
1673
+ *
1674
+ * @returns Success
1675
+ *
1676
+ * @see https://developer.quickbase.com/operation/changesetSolutionFromRecord
1677
+ */
1678
+ changesetSolutionFromRecord(params: ChangesetSolutionFromRecordParams): Promise<ChangesetSolutionFromRecordResponse> {
1679
+ return request<ChangesetSolutionFromRecordResponse>({
1680
+ method: 'GET',
1681
+ path: `/solutions/${params.solutionId}/changeset/fromrecord`,
1682
+ query: { tableId: params.tableId, fieldId: params.fieldId, recordId: params.recordId },
1683
+ });
1684
+ },
1685
+
1686
+ /**
1687
+ * Get solution information
1688
+ *
1689
+ * Returns the metadata and resource information for a solution, including both real and logical IDs of apps and pipelines contained within the solution. This endpoint provides programmatic access to solution structure information.
1690
+ *
1691
+ * @param params.solutionId - The unique identifier (UUID) or the alias of the solution.
1692
+ *
1693
+ * @returns Success
1694
+ *
1695
+ * @see https://developer.quickbase.com/operation/getSolutionPublic
1696
+ */
1697
+ getSolutionPublic(params: GetSolutionPublicParams): Promise<GetSolutionPublicResponse> {
1698
+ return request<GetSolutionPublicResponse>({
1699
+ method: 'GET',
1700
+ path: `/solutions/${params.solutionId}/resources`,
1701
+ });
1702
+ },
1703
+
1704
+ /**
1705
+ * Get trustees for an app
1706
+ *
1707
+ * Returns the list of trustees for a specific application. Trustees include users, groups and email domain groups.
1708
+ *
1709
+ * @param params.appId - The unique identifier of an app
1710
+ *
1711
+ * @returns Success
1712
+ *
1713
+ * @see https://developer.quickbase.com/operation/getTrustees
1714
+ */
1715
+ getTrustees(params: GetTrusteesParams): Promise<GetTrusteesResponse> {
1716
+ return request<GetTrusteesResponse>({
1717
+ method: 'GET',
1718
+ path: `/app/${params.appId}/trustees`,
1719
+ });
1720
+ },
1721
+
1722
+ /**
1723
+ * Add trustees to an app
1724
+ *
1725
+ * Add trustees to the specified application. Trustees include users, groups and email domain groups.
1726
+ *
1727
+ * @param params.appId - The unique identifier of an app
1728
+ *
1729
+ * @param body - Request body (optional)
1730
+ *
1731
+ * @returns Success
1732
+ *
1733
+ * @see https://developer.quickbase.com/operation/addTrustees
1734
+ */
1735
+ addTrustees(params: AddTrusteesParams, body?: AddTrusteesRequest): Promise<AddTrusteesResponse> {
1736
+ return request<AddTrusteesResponse>({
1737
+ method: 'POST',
1738
+ path: `/app/${params.appId}/trustees`,
1739
+ body,
1740
+ });
1741
+ },
1742
+
1743
+ /**
1744
+ * Remove trustees from an app
1745
+ *
1746
+ * Remove trustees from the specified application. Trustees include users, groups and email domain groups.
1747
+ *
1748
+ * @param params.appId - The unique identifier of an app
1749
+ *
1750
+ * @param body - Request body (optional)
1751
+ *
1752
+ * @returns Success
1753
+ *
1754
+ * @see https://developer.quickbase.com/operation/removeTrustees
1755
+ */
1756
+ removeTrustees(params: RemoveTrusteesParams, body?: RemoveTrusteesRequest): Promise<RemoveTrusteesResponse> {
1757
+ return request<RemoveTrusteesResponse>({
1758
+ method: 'DELETE',
1759
+ path: `/app/${params.appId}/trustees`,
1760
+ body,
1761
+ });
1762
+ },
1763
+
1764
+ /**
1765
+ * Update trustees of an app
1766
+ *
1767
+ * Update trustees for the specified application. Trustees include users, groups and email domain groups.
1768
+ *
1769
+ * @param params.appId - The unique identifier of an app
1770
+ *
1771
+ * @param body - Request body (optional)
1772
+ *
1773
+ * @returns Success
1774
+ *
1775
+ * @see https://developer.quickbase.com/operation/updateTrustees
1776
+ */
1777
+ updateTrustees(params: UpdateTrusteesParams, body?: UpdateTrusteesRequest): Promise<UpdateTrusteesResponse> {
1778
+ return request<UpdateTrusteesResponse>({
1779
+ method: 'PATCH',
1780
+ path: `/app/${params.appId}/trustees`,
1781
+ body,
1782
+ });
1783
+ },
1784
+ };
1785
+ }