@gitbook/api 0.2.2 → 0.4.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/dist/index.cjs ADDED
@@ -0,0 +1,1770 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/index.ts
20
+ var src_exports = {};
21
+ __export(src_exports, {
22
+ APIIntegrationScope: () => APIIntegrationScope,
23
+ AnalyticsSearchPeriod: () => AnalyticsSearchPeriod,
24
+ AnalyticsTrafficInterval: () => AnalyticsTrafficInterval,
25
+ Api: () => Api,
26
+ BillingInterval: () => BillingInterval,
27
+ BillingProduct: () => BillingProduct,
28
+ ChangeRequestReviewStatus: () => ChangeRequestReviewStatus,
29
+ ChangeRequestStatus: () => ChangeRequestStatus,
30
+ CloudflareHostnameStatus: () => CloudflareHostnameStatus,
31
+ CloudflareHostnameTLSStatus: () => CloudflareHostnameTLSStatus,
32
+ CloudflareHostnameTLSValidationMethod: () => CloudflareHostnameTLSValidationMethod,
33
+ ContentKitIcon: () => ContentKitIcon,
34
+ ContentType: () => ContentType,
35
+ ContentVisibility: () => ContentVisibility,
36
+ CustomFieldType: () => CustomFieldType,
37
+ GITBOOK_DEFAULT_ENDPOINT: () => GITBOOK_DEFAULT_ENDPOINT,
38
+ GitBookAPI: () => GitBookAPI,
39
+ GitSyncOperationState: () => GitSyncOperationState,
40
+ HttpClient: () => HttpClient,
41
+ ImportContentSource: () => ImportContentSource,
42
+ IntegrationCategory: () => IntegrationCategory,
43
+ IntegrationInstallationSpaceSelection: () => IntegrationInstallationSpaceSelection,
44
+ IntegrationInstallationStatus: () => IntegrationInstallationStatus,
45
+ IntegrationScope: () => IntegrationScope,
46
+ IntegrationVisibility: () => IntegrationVisibility,
47
+ MemberRole: () => MemberRole,
48
+ OrganizationCommunityType: () => OrganizationCommunityType,
49
+ OrganizationType: () => OrganizationType,
50
+ OrganizationUseCase: () => OrganizationUseCase,
51
+ PurgeCDNCacheContextType: () => PurgeCDNCacheContextType,
52
+ SpaceRelationType: () => SpaceRelationType,
53
+ SpaceType: () => SpaceType,
54
+ TeamMemberRole: () => TeamMemberRole
55
+ });
56
+ module.exports = __toCommonJS(src_exports);
57
+
58
+ // src/client.ts
59
+ var ContentVisibility = /* @__PURE__ */ ((ContentVisibility2) => {
60
+ ContentVisibility2["Public"] = "public";
61
+ ContentVisibility2["Unlisted"] = "unlisted";
62
+ ContentVisibility2["ShareLink"] = "share-link";
63
+ ContentVisibility2["VisitorAuth"] = "visitor-auth";
64
+ ContentVisibility2["InCollection"] = "in-collection";
65
+ ContentVisibility2["Private"] = "private";
66
+ return ContentVisibility2;
67
+ })(ContentVisibility || {});
68
+ var SpaceType = /* @__PURE__ */ ((SpaceType2) => {
69
+ SpaceType2["Application"] = "application";
70
+ SpaceType2["Website"] = "website";
71
+ SpaceType2["Service"] = "service";
72
+ SpaceType2["Library"] = "library";
73
+ SpaceType2["CloudResource"] = "cloud-resource";
74
+ SpaceType2["Database"] = "database";
75
+ SpaceType2["Other"] = "other";
76
+ return SpaceType2;
77
+ })(SpaceType || {});
78
+ var SpaceRelationType = /* @__PURE__ */ ((SpaceRelationType2) => {
79
+ SpaceRelationType2["DependsOn"] = "dependsOn";
80
+ SpaceRelationType2["DependencyOf"] = "dependencyOf";
81
+ SpaceRelationType2["PartOf"] = "partOf";
82
+ SpaceRelationType2["HasPart"] = "hasPart";
83
+ return SpaceRelationType2;
84
+ })(SpaceRelationType || {});
85
+ var ImportContentSource = /* @__PURE__ */ ((ImportContentSource2) => {
86
+ ImportContentSource2["Website"] = "website";
87
+ ImportContentSource2["Docx"] = "docx";
88
+ ImportContentSource2["Markdown"] = "markdown";
89
+ ImportContentSource2["Html"] = "html";
90
+ ImportContentSource2["Zip"] = "zip";
91
+ ImportContentSource2["Confluence"] = "confluence";
92
+ ImportContentSource2["GithubWiki"] = "github-wiki";
93
+ ImportContentSource2["DropboxPaper"] = "dropbox-paper";
94
+ ImportContentSource2["Notion"] = "notion";
95
+ ImportContentSource2["Quip"] = "quip";
96
+ ImportContentSource2["GoogleDocs"] = "google-docs";
97
+ ImportContentSource2["OpenApi"] = "open-api";
98
+ return ImportContentSource2;
99
+ })(ImportContentSource || {});
100
+ var GitSyncOperationState = /* @__PURE__ */ ((GitSyncOperationState2) => {
101
+ GitSyncOperationState2["Running"] = "running";
102
+ GitSyncOperationState2["Failure"] = "failure";
103
+ GitSyncOperationState2["Success"] = "success";
104
+ return GitSyncOperationState2;
105
+ })(GitSyncOperationState || {});
106
+ var OrganizationType = /* @__PURE__ */ ((OrganizationType2) => {
107
+ OrganizationType2["Business"] = "business";
108
+ OrganizationType2["Community"] = "community";
109
+ return OrganizationType2;
110
+ })(OrganizationType || {});
111
+ var OrganizationUseCase = /* @__PURE__ */ ((OrganizationUseCase2) => {
112
+ OrganizationUseCase2["ProductDocs"] = "productDocs";
113
+ OrganizationUseCase2["TeamKnowledgeBase"] = "teamKnowledgeBase";
114
+ OrganizationUseCase2["DesignSystem"] = "designSystem";
115
+ OrganizationUseCase2["OpenSourceDocs"] = "openSourceDocs";
116
+ OrganizationUseCase2["Notes"] = "notes";
117
+ OrganizationUseCase2["Other"] = "other";
118
+ return OrganizationUseCase2;
119
+ })(OrganizationUseCase || {});
120
+ var OrganizationCommunityType = /* @__PURE__ */ ((OrganizationCommunityType2) => {
121
+ OrganizationCommunityType2["NonProfit"] = "nonProfit";
122
+ OrganizationCommunityType2["OpenSource"] = "openSource";
123
+ OrganizationCommunityType2["Education"] = "education";
124
+ return OrganizationCommunityType2;
125
+ })(OrganizationCommunityType || {});
126
+ var MemberRole = /* @__PURE__ */ ((MemberRole2) => {
127
+ MemberRole2["Admin"] = "admin";
128
+ MemberRole2["Create"] = "create";
129
+ MemberRole2["Edit"] = "edit";
130
+ MemberRole2["Review"] = "review";
131
+ MemberRole2["Comment"] = "comment";
132
+ MemberRole2["Read"] = "read";
133
+ return MemberRole2;
134
+ })(MemberRole || {});
135
+ var TeamMemberRole = /* @__PURE__ */ ((TeamMemberRole2) => {
136
+ TeamMemberRole2["Admin"] = "admin";
137
+ TeamMemberRole2["Participant"] = "participant";
138
+ return TeamMemberRole2;
139
+ })(TeamMemberRole || {});
140
+ var ChangeRequestStatus = /* @__PURE__ */ ((ChangeRequestStatus2) => {
141
+ ChangeRequestStatus2["Draft"] = "draft";
142
+ ChangeRequestStatus2["Open"] = "open";
143
+ ChangeRequestStatus2["Archived"] = "archived";
144
+ ChangeRequestStatus2["Merged"] = "merged";
145
+ return ChangeRequestStatus2;
146
+ })(ChangeRequestStatus || {});
147
+ var ChangeRequestReviewStatus = /* @__PURE__ */ ((ChangeRequestReviewStatus2) => {
148
+ ChangeRequestReviewStatus2["ChangesRequested"] = "changes-requested";
149
+ ChangeRequestReviewStatus2["Approved"] = "approved";
150
+ return ChangeRequestReviewStatus2;
151
+ })(ChangeRequestReviewStatus || {});
152
+ var AnalyticsSearchPeriod = /* @__PURE__ */ ((AnalyticsSearchPeriod2) => {
153
+ AnalyticsSearchPeriod2["LastMonth"] = "last_month";
154
+ AnalyticsSearchPeriod2["LastWeek"] = "last_week";
155
+ AnalyticsSearchPeriod2["LastYear"] = "last_year";
156
+ return AnalyticsSearchPeriod2;
157
+ })(AnalyticsSearchPeriod || {});
158
+ var AnalyticsTrafficInterval = /* @__PURE__ */ ((AnalyticsTrafficInterval2) => {
159
+ AnalyticsTrafficInterval2["Daily"] = "daily";
160
+ AnalyticsTrafficInterval2["Weekly"] = "weekly";
161
+ AnalyticsTrafficInterval2["Monthly"] = "monthly";
162
+ return AnalyticsTrafficInterval2;
163
+ })(AnalyticsTrafficInterval || {});
164
+ var IntegrationScope = /* @__PURE__ */ ((IntegrationScope2) => {
165
+ IntegrationScope2["OrganizationEntitiesWrite"] = "organization:entities:write";
166
+ IntegrationScope2["SpaceViewsRead"] = "space:views:read";
167
+ IntegrationScope2["SpaceContentRead"] = "space:content:read";
168
+ IntegrationScope2["SpaceContentWrite"] = "space:content:write";
169
+ IntegrationScope2["SpaceMetadataRead"] = "space:metadata:read";
170
+ IntegrationScope2["SpaceMetadataWrite"] = "space:metadata:write";
171
+ IntegrationScope2["SpaceScriptInject"] = "space:script:inject";
172
+ IntegrationScope2["SpaceScriptCookies"] = "space:script:cookies";
173
+ return IntegrationScope2;
174
+ })(IntegrationScope || {});
175
+ var IntegrationInstallationSpaceSelection = /* @__PURE__ */ ((IntegrationInstallationSpaceSelection2) => {
176
+ IntegrationInstallationSpaceSelection2["All"] = "all";
177
+ IntegrationInstallationSpaceSelection2["Selected"] = "selected";
178
+ return IntegrationInstallationSpaceSelection2;
179
+ })(IntegrationInstallationSpaceSelection || {});
180
+ var IntegrationCategory = /* @__PURE__ */ ((IntegrationCategory2) => {
181
+ IntegrationCategory2["Analytics"] = "analytics";
182
+ IntegrationCategory2["Collaboration"] = "collaboration";
183
+ IntegrationCategory2["Marketing"] = "marketing";
184
+ IntegrationCategory2["Content"] = "content";
185
+ IntegrationCategory2["Other"] = "other";
186
+ return IntegrationCategory2;
187
+ })(IntegrationCategory || {});
188
+ var IntegrationVisibility = /* @__PURE__ */ ((IntegrationVisibility2) => {
189
+ IntegrationVisibility2["Public"] = "public";
190
+ IntegrationVisibility2["Private"] = "private";
191
+ IntegrationVisibility2["Unlisted"] = "unlisted";
192
+ return IntegrationVisibility2;
193
+ })(IntegrationVisibility || {});
194
+ var IntegrationInstallationStatus = /* @__PURE__ */ ((IntegrationInstallationStatus2) => {
195
+ IntegrationInstallationStatus2["Active"] = "active";
196
+ IntegrationInstallationStatus2["Pending"] = "pending";
197
+ IntegrationInstallationStatus2["Paused"] = "paused";
198
+ return IntegrationInstallationStatus2;
199
+ })(IntegrationInstallationStatus || {});
200
+ var BillingInterval = /* @__PURE__ */ ((BillingInterval2) => {
201
+ BillingInterval2["Monthly"] = "monthly";
202
+ BillingInterval2["Yearly"] = "yearly";
203
+ return BillingInterval2;
204
+ })(BillingInterval || {});
205
+ var BillingProduct = /* @__PURE__ */ ((BillingProduct2) => {
206
+ BillingProduct2["Free"] = "free";
207
+ BillingProduct2["Plus"] = "plus";
208
+ BillingProduct2["Pro"] = "pro";
209
+ BillingProduct2["Team"] = "team";
210
+ BillingProduct2["Business"] = "business";
211
+ BillingProduct2["Legacy"] = "legacy";
212
+ BillingProduct2["Startup"] = "startup";
213
+ BillingProduct2["Enterprise"] = "enterprise";
214
+ return BillingProduct2;
215
+ })(BillingProduct || {});
216
+ var APIIntegrationScope = /* @__PURE__ */ ((APIIntegrationScope2) => {
217
+ APIIntegrationScope2["IntegrationRead"] = "integration:read";
218
+ APIIntegrationScope2["IntegrationUpdate"] = "integration:update";
219
+ APIIntegrationScope2["IntegrationInstallationRead"] = "integration:installation:read";
220
+ APIIntegrationScope2["IntegrationInstallationUpdate"] = "integration:installation:update";
221
+ return APIIntegrationScope2;
222
+ })(APIIntegrationScope || {});
223
+ var CloudflareHostnameStatus = /* @__PURE__ */ ((CloudflareHostnameStatus2) => {
224
+ CloudflareHostnameStatus2["Pending"] = "pending";
225
+ CloudflareHostnameStatus2["Active"] = "active";
226
+ CloudflareHostnameStatus2["Blocked"] = "blocked";
227
+ CloudflareHostnameStatus2["Moved"] = "moved";
228
+ CloudflareHostnameStatus2["Deleted"] = "deleted";
229
+ return CloudflareHostnameStatus2;
230
+ })(CloudflareHostnameStatus || {});
231
+ var CloudflareHostnameTLSStatus = /* @__PURE__ */ ((CloudflareHostnameTLSStatus2) => {
232
+ CloudflareHostnameTLSStatus2["Initializing"] = "initializing";
233
+ CloudflareHostnameTLSStatus2["PendingValidation"] = "pending_validation";
234
+ CloudflareHostnameTLSStatus2["PendingIssuance"] = "pending_issuance";
235
+ CloudflareHostnameTLSStatus2["PendingDeployment"] = "pending_deployment";
236
+ CloudflareHostnameTLSStatus2["Active"] = "active";
237
+ CloudflareHostnameTLSStatus2["PendingDeletion"] = "pending_deletion";
238
+ CloudflareHostnameTLSStatus2["PendingCleanup"] = "pending_cleanup";
239
+ CloudflareHostnameTLSStatus2["Deleted"] = "deleted";
240
+ return CloudflareHostnameTLSStatus2;
241
+ })(CloudflareHostnameTLSStatus || {});
242
+ var CloudflareHostnameTLSValidationMethod = /* @__PURE__ */ ((CloudflareHostnameTLSValidationMethod2) => {
243
+ CloudflareHostnameTLSValidationMethod2["Http"] = "http";
244
+ CloudflareHostnameTLSValidationMethod2["Txt"] = "txt";
245
+ CloudflareHostnameTLSValidationMethod2["Email"] = "email";
246
+ return CloudflareHostnameTLSValidationMethod2;
247
+ })(CloudflareHostnameTLSValidationMethod || {});
248
+ var PurgeCDNCacheContextType = /* @__PURE__ */ ((PurgeCDNCacheContextType2) => {
249
+ PurgeCDNCacheContextType2["Tags"] = "tags";
250
+ PurgeCDNCacheContextType2["Hosts"] = "hosts";
251
+ return PurgeCDNCacheContextType2;
252
+ })(PurgeCDNCacheContextType || {});
253
+ var ContentKitIcon = /* @__PURE__ */ ((ContentKitIcon2) => {
254
+ ContentKitIcon2["Close"] = "close";
255
+ ContentKitIcon2["Edit"] = "edit";
256
+ ContentKitIcon2["Github"] = "github";
257
+ ContentKitIcon2["Maximize"] = "maximize";
258
+ ContentKitIcon2["Email"] = "email";
259
+ ContentKitIcon2["Settings"] = "settings";
260
+ ContentKitIcon2["Search"] = "search";
261
+ ContentKitIcon2["Delete"] = "delete";
262
+ ContentKitIcon2["Star"] = "star";
263
+ ContentKitIcon2["Warning"] = "warning";
264
+ ContentKitIcon2["Link"] = "link";
265
+ ContentKitIcon2["LinkExternal"] = "link-external";
266
+ return ContentKitIcon2;
267
+ })(ContentKitIcon || {});
268
+ var CustomFieldType = /* @__PURE__ */ ((CustomFieldType2) => {
269
+ CustomFieldType2["Text"] = "text";
270
+ CustomFieldType2["Number"] = "number";
271
+ CustomFieldType2["Boolean"] = "boolean";
272
+ return CustomFieldType2;
273
+ })(CustomFieldType || {});
274
+ var ContentType = /* @__PURE__ */ ((ContentType2) => {
275
+ ContentType2["Json"] = "application/json";
276
+ ContentType2["FormData"] = "multipart/form-data";
277
+ ContentType2["UrlEncoded"] = "application/x-www-form-urlencoded";
278
+ return ContentType2;
279
+ })(ContentType || {});
280
+ var HttpClient = class {
281
+ constructor(apiConfig = {}) {
282
+ this.baseUrl = "{host}/v1";
283
+ this.securityData = null;
284
+ this.abortControllers = /* @__PURE__ */ new Map();
285
+ this.customFetch = (...fetchParams) => fetch(...fetchParams);
286
+ this.baseApiParams = {
287
+ credentials: "same-origin",
288
+ headers: {},
289
+ redirect: "follow",
290
+ referrerPolicy: "no-referrer"
291
+ };
292
+ this.setSecurityData = (data) => {
293
+ this.securityData = data;
294
+ };
295
+ this.contentFormatters = {
296
+ ["application/json" /* Json */]: (input) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
297
+ ["multipart/form-data" /* FormData */]: (input) => Object.keys(input || {}).reduce((formData, key) => {
298
+ const property = input[key];
299
+ formData.append(
300
+ key,
301
+ property instanceof Blob ? property : typeof property === "object" && property !== null ? JSON.stringify(property) : `${property}`
302
+ );
303
+ return formData;
304
+ }, new FormData()),
305
+ ["application/x-www-form-urlencoded" /* UrlEncoded */]: (input) => this.toQueryString(input)
306
+ };
307
+ this.createAbortSignal = (cancelToken) => {
308
+ if (this.abortControllers.has(cancelToken)) {
309
+ const abortController2 = this.abortControllers.get(cancelToken);
310
+ if (abortController2) {
311
+ return abortController2.signal;
312
+ }
313
+ return void 0;
314
+ }
315
+ const abortController = new AbortController();
316
+ this.abortControllers.set(cancelToken, abortController);
317
+ return abortController.signal;
318
+ };
319
+ this.abortRequest = (cancelToken) => {
320
+ const abortController = this.abortControllers.get(cancelToken);
321
+ if (abortController) {
322
+ abortController.abort();
323
+ this.abortControllers.delete(cancelToken);
324
+ }
325
+ };
326
+ this.request = async ({
327
+ body,
328
+ secure,
329
+ path,
330
+ type,
331
+ query,
332
+ format,
333
+ baseUrl,
334
+ cancelToken,
335
+ ...params
336
+ }) => {
337
+ const secureParams = (typeof secure === "boolean" ? secure : this.baseApiParams.secure) && this.securityWorker && await this.securityWorker(this.securityData) || {};
338
+ const requestParams = this.mergeRequestParams(params, secureParams);
339
+ const queryString = query && this.toQueryString(query);
340
+ const payloadFormatter = this.contentFormatters[type || "application/json" /* Json */];
341
+ const responseFormat = format || requestParams.format;
342
+ return this.customFetch(
343
+ `${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`,
344
+ {
345
+ ...requestParams,
346
+ headers: {
347
+ ...type && type !== "multipart/form-data" /* FormData */ ? { "Content-Type": type } : {},
348
+ ...requestParams.headers || {}
349
+ },
350
+ signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
351
+ body: typeof body === "undefined" || body === null ? null : payloadFormatter(body)
352
+ }
353
+ ).then(async (response) => {
354
+ const r = response;
355
+ r.data = null;
356
+ r.error = null;
357
+ const data = !responseFormat ? r : await response[responseFormat]().then((data2) => {
358
+ if (r.ok) {
359
+ r.data = data2;
360
+ } else {
361
+ r.error = data2;
362
+ }
363
+ return r;
364
+ }).catch((e) => {
365
+ r.error = e;
366
+ return r;
367
+ });
368
+ if (cancelToken) {
369
+ this.abortControllers.delete(cancelToken);
370
+ }
371
+ if (!response.ok)
372
+ throw data;
373
+ return data;
374
+ });
375
+ };
376
+ Object.assign(this, apiConfig);
377
+ }
378
+ encodeQueryParam(key, value) {
379
+ const encodedKey = encodeURIComponent(key);
380
+ return `${encodedKey}=${encodeURIComponent(
381
+ typeof value === "number" ? value : `${value}`
382
+ )}`;
383
+ }
384
+ addQueryParam(query, key) {
385
+ return this.encodeQueryParam(key, query[key]);
386
+ }
387
+ addArrayQueryParam(query, key) {
388
+ const value = query[key];
389
+ return value.map((v) => this.encodeQueryParam(key, v)).join("&");
390
+ }
391
+ toQueryString(rawQuery) {
392
+ const query = rawQuery || {};
393
+ const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
394
+ return keys.map(
395
+ (key) => Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)
396
+ ).join("&");
397
+ }
398
+ addQueryParams(rawQuery) {
399
+ const queryString = this.toQueryString(rawQuery);
400
+ return queryString ? `?${queryString}` : "";
401
+ }
402
+ mergeRequestParams(params1, params2) {
403
+ return {
404
+ ...this.baseApiParams,
405
+ ...params1,
406
+ ...params2 || {},
407
+ headers: {
408
+ ...this.baseApiParams.headers || {},
409
+ ...params1.headers || {},
410
+ ...params2 && params2.headers || {}
411
+ }
412
+ };
413
+ }
414
+ };
415
+ var Api = class extends HttpClient {
416
+ constructor() {
417
+ super(...arguments);
418
+ this.getApiInformation = (params = {}) => this.request({
419
+ path: `/`,
420
+ method: "GET",
421
+ secure: true,
422
+ format: "json",
423
+ ...params
424
+ });
425
+ this.search = {
426
+ searchContent: (query, params = {}) => this.request({
427
+ path: `/search`,
428
+ method: "GET",
429
+ query,
430
+ secure: true,
431
+ format: "json",
432
+ ...params
433
+ }),
434
+ askQueryWithGet: (query, params = {}) => this.request({
435
+ path: `/search/ask`,
436
+ method: "GET",
437
+ query,
438
+ secure: true,
439
+ format: "json",
440
+ ...params
441
+ }),
442
+ askQuery: (data, params = {}) => this.request({
443
+ path: `/search/ask`,
444
+ method: "POST",
445
+ body: data,
446
+ secure: true,
447
+ type: "application/json" /* Json */,
448
+ format: "json",
449
+ ...params
450
+ }),
451
+ getRecommendedQuestions: (data, params = {}) => this.request({
452
+ path: `/search/questions`,
453
+ method: "POST",
454
+ body: data,
455
+ secure: true,
456
+ type: "application/json" /* Json */,
457
+ format: "json",
458
+ ...params
459
+ })
460
+ };
461
+ this.user = {
462
+ getAuthenticatedUser: (params = {}) => this.request({
463
+ path: `/user`,
464
+ method: "GET",
465
+ secure: true,
466
+ format: "json",
467
+ ...params
468
+ }),
469
+ listSpacesForAuthenticatedUser: (query, params = {}) => this.request({
470
+ path: `/user/spaces`,
471
+ method: "GET",
472
+ query,
473
+ secure: true,
474
+ format: "json",
475
+ ...params
476
+ })
477
+ };
478
+ this.users = {
479
+ getUserById: (userId, params = {}) => this.request({
480
+ path: `/users/${userId}`,
481
+ method: "GET",
482
+ secure: true,
483
+ format: "json",
484
+ ...params
485
+ })
486
+ };
487
+ this.spaces = {
488
+ getSpaceById: (spaceId, params = {}) => this.request({
489
+ path: `/spaces/${spaceId}`,
490
+ method: "GET",
491
+ secure: true,
492
+ format: "json",
493
+ ...params
494
+ }),
495
+ updateSpaceById: (spaceId, data, params = {}) => this.request({
496
+ path: `/spaces/${spaceId}`,
497
+ method: "PATCH",
498
+ body: data,
499
+ secure: true,
500
+ type: "application/json" /* Json */,
501
+ format: "json",
502
+ ...params
503
+ }),
504
+ generateSpaceHiveReadAccessToken: (spaceId, params = {}) => this.request({
505
+ path: `/spaces/${spaceId}/hive/token`,
506
+ method: "POST",
507
+ secure: true,
508
+ format: "json",
509
+ ...params
510
+ }),
511
+ duplicateSpace: (spaceId, params = {}) => this.request({
512
+ path: `/spaces/${spaceId}/duplicate`,
513
+ method: "POST",
514
+ secure: true,
515
+ format: "json",
516
+ ...params
517
+ }),
518
+ searchSpaceContent: (spaceId, query, params = {}) => this.request({
519
+ path: `/spaces/${spaceId}/search`,
520
+ method: "GET",
521
+ query,
522
+ secure: true,
523
+ format: "json",
524
+ ...params
525
+ }),
526
+ askQueryInSpaceWithGet: (spaceId, query, params = {}) => this.request({
527
+ path: `/spaces/${spaceId}/search/ask`,
528
+ method: "GET",
529
+ query,
530
+ secure: true,
531
+ format: "json",
532
+ ...params
533
+ }),
534
+ askQueryInSpace: (spaceId, data, params = {}) => this.request({
535
+ path: `/spaces/${spaceId}/search/ask`,
536
+ method: "POST",
537
+ body: data,
538
+ secure: true,
539
+ type: "application/json" /* Json */,
540
+ format: "json",
541
+ ...params
542
+ }),
543
+ getRecommendedQuestionsInSpace: (spaceId, params = {}) => this.request({
544
+ path: `/spaces/${spaceId}/search/questions`,
545
+ method: "GET",
546
+ secure: true,
547
+ format: "json",
548
+ ...params
549
+ }),
550
+ importGitRepository: (spaceId, data, params = {}) => this.request({
551
+ path: `/spaces/${spaceId}/git/import`,
552
+ method: "POST",
553
+ body: data,
554
+ secure: true,
555
+ type: "application/json" /* Json */,
556
+ ...params
557
+ }),
558
+ exportToGitRepository: (spaceId, data, params = {}) => this.request({
559
+ path: `/spaces/${spaceId}/git/export`,
560
+ method: "POST",
561
+ body: data,
562
+ secure: true,
563
+ type: "application/json" /* Json */,
564
+ ...params
565
+ }),
566
+ getContentAnalyticsForSpaceById: (spaceId, params = {}) => this.request({
567
+ path: `/spaces/${spaceId}/insights/content`,
568
+ method: "GET",
569
+ secure: true,
570
+ format: "json",
571
+ ...params
572
+ }),
573
+ getSearchAnalyticsForSpaceById: (spaceId, query, params = {}) => this.request({
574
+ path: `/spaces/${spaceId}/insights/search`,
575
+ method: "GET",
576
+ query,
577
+ secure: true,
578
+ format: "json",
579
+ ...params
580
+ }),
581
+ getTrafficAnalyticsForSpaceById: (spaceId, query, params = {}) => this.request({
582
+ path: `/spaces/${spaceId}/insights/traffic`,
583
+ method: "GET",
584
+ query,
585
+ secure: true,
586
+ format: "json",
587
+ ...params
588
+ }),
589
+ trackViewInSpaceById: (spaceId, data, params = {}) => this.request({
590
+ path: `/spaces/${spaceId}/insights/track_view`,
591
+ method: "POST",
592
+ body: data,
593
+ secure: true,
594
+ type: "application/json" /* Json */,
595
+ ...params
596
+ }),
597
+ getCurrentRevision: (spaceId, params = {}) => this.request({
598
+ path: `/spaces/${spaceId}/content`,
599
+ method: "GET",
600
+ secure: true,
601
+ format: "json",
602
+ ...params
603
+ }),
604
+ importContent: (spaceId, data, params = {}) => this.request({
605
+ path: `/spaces/${spaceId}/content/import`,
606
+ method: "POST",
607
+ body: data,
608
+ secure: true,
609
+ type: "application/json" /* Json */,
610
+ format: "json",
611
+ ...params
612
+ }),
613
+ listFiles: (spaceId, query, params = {}) => this.request({
614
+ path: `/spaces/${spaceId}/content/files`,
615
+ method: "GET",
616
+ query,
617
+ secure: true,
618
+ ...params
619
+ }),
620
+ getPageById: (spaceId, pageId, query, params = {}) => this.request({
621
+ path: `/spaces/${spaceId}/content/page/${pageId}`,
622
+ method: "GET",
623
+ query,
624
+ secure: true,
625
+ format: "json",
626
+ ...params
627
+ }),
628
+ importContentInPageById: (spaceId, pageId, data, params = {}) => this.request({
629
+ path: `/spaces/${spaceId}/content/page/${pageId}/import`,
630
+ method: "POST",
631
+ body: data,
632
+ secure: true,
633
+ type: "application/json" /* Json */,
634
+ format: "json",
635
+ ...params
636
+ }),
637
+ getPageByPath: (spaceId, pagePath, query, params = {}) => this.request({
638
+ path: `/spaces/${spaceId}/content/path/${pagePath}`,
639
+ method: "GET",
640
+ query,
641
+ secure: true,
642
+ format: "json",
643
+ ...params
644
+ }),
645
+ createChangeRequest: (spaceId, data, params = {}) => this.request({
646
+ path: `/spaces/${spaceId}/change-requests`,
647
+ method: "POST",
648
+ body: data,
649
+ secure: true,
650
+ type: "application/json" /* Json */,
651
+ format: "json",
652
+ ...params
653
+ }),
654
+ listChangeRequestsForSpace: (spaceId, query, params = {}) => this.request({
655
+ path: `/spaces/${spaceId}/change-requests`,
656
+ method: "GET",
657
+ query,
658
+ secure: true,
659
+ format: "json",
660
+ ...params
661
+ }),
662
+ getChangeRequestById: (spaceId, changeRequestId, params = {}) => this.request({
663
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}`,
664
+ method: "GET",
665
+ secure: true,
666
+ format: "json",
667
+ ...params
668
+ }),
669
+ mergeChangeRequest: (spaceId, changeRequestId, params = {}) => this.request({
670
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/merge`,
671
+ method: "POST",
672
+ secure: true,
673
+ format: "json",
674
+ ...params
675
+ }),
676
+ updateChangeRequest: (spaceId, changeRequestId, params = {}) => this.request({
677
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/update`,
678
+ method: "POST",
679
+ secure: true,
680
+ format: "json",
681
+ ...params
682
+ }),
683
+ getReviewsByChangeRequestId: (spaceId, changeRequestId, query, params = {}) => this.request({
684
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/reviews`,
685
+ method: "GET",
686
+ query,
687
+ secure: true,
688
+ format: "json",
689
+ ...params
690
+ }),
691
+ submitChangeRequestReview: (spaceId, changeRequestId, data, params = {}) => this.request({
692
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/reviews`,
693
+ method: "POST",
694
+ body: data,
695
+ secure: true,
696
+ type: "application/json" /* Json */,
697
+ format: "json",
698
+ ...params
699
+ }),
700
+ getRequestedReviewersByChangeRequestId: (spaceId, changeRequestId, query, params = {}) => this.request({
701
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/requested-reviewers`,
702
+ method: "GET",
703
+ query,
704
+ secure: true,
705
+ format: "json",
706
+ ...params
707
+ }),
708
+ requestReviewersForChangeRequest: (spaceId, changeRequestId, data, params = {}) => this.request({
709
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/requested-reviewers`,
710
+ method: "POST",
711
+ body: data,
712
+ secure: true,
713
+ type: "application/json" /* Json */,
714
+ format: "json",
715
+ ...params
716
+ }),
717
+ listCommentsInChangeRequest: (spaceId, changeRequestId, query, params = {}) => this.request({
718
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/comments`,
719
+ method: "GET",
720
+ query,
721
+ secure: true,
722
+ format: "json",
723
+ ...params
724
+ }),
725
+ postCommentInChangeRequest: (spaceId, changeRequestId, data, params = {}) => this.request({
726
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/comments`,
727
+ method: "POST",
728
+ body: data,
729
+ secure: true,
730
+ type: "application/json" /* Json */,
731
+ format: "json",
732
+ ...params
733
+ }),
734
+ getCommentInChangeRequest: (spaceId, changeRequestId, commentId, query, params = {}) => this.request({
735
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/comments/${commentId}`,
736
+ method: "GET",
737
+ query,
738
+ secure: true,
739
+ format: "json",
740
+ ...params
741
+ }),
742
+ deleteCommentInChangeRequest: (spaceId, changeRequestId, commentId, params = {}) => this.request({
743
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/comments/${commentId}`,
744
+ method: "DELETE",
745
+ secure: true,
746
+ ...params
747
+ }),
748
+ updateCommentInChangeRequest: (spaceId, changeRequestId, commentId, data, params = {}) => this.request({
749
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/comments/${commentId}`,
750
+ method: "PUT",
751
+ body: data,
752
+ secure: true,
753
+ type: "application/json" /* Json */,
754
+ format: "json",
755
+ ...params
756
+ }),
757
+ listCommentRepliesInChangeRequest: (spaceId, changeRequestId, commentId, query, params = {}) => this.request({
758
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/comments/${commentId}/replies`,
759
+ method: "GET",
760
+ query,
761
+ secure: true,
762
+ format: "json",
763
+ ...params
764
+ }),
765
+ postCommentReplyInChangeRequest: (spaceId, changeRequestId, commentId, data, query, params = {}) => this.request({
766
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/comments/${commentId}/replies`,
767
+ method: "POST",
768
+ query,
769
+ body: data,
770
+ secure: true,
771
+ type: "application/json" /* Json */,
772
+ format: "json",
773
+ ...params
774
+ }),
775
+ getCommentReplyInChangeRequest: (spaceId, changeRequestId, commentId, commentReplyId, query, params = {}) => this.request({
776
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/comments/${commentId}/replies/${commentReplyId}`,
777
+ method: "GET",
778
+ query,
779
+ secure: true,
780
+ format: "json",
781
+ ...params
782
+ }),
783
+ updateCommentReplyInChangeRequest: (spaceId, changeRequestId, commentId, commentReplyId, data, params = {}) => this.request({
784
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/comments/${commentId}/replies/${commentReplyId}`,
785
+ method: "PUT",
786
+ body: data,
787
+ secure: true,
788
+ type: "application/json" /* Json */,
789
+ format: "json",
790
+ ...params
791
+ }),
792
+ deleteCommentReplyInChangeRequest: (spaceId, changeRequestId, commentId, commentReplyId, params = {}) => this.request({
793
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/comments/${commentId}/replies/${commentReplyId}`,
794
+ method: "DELETE",
795
+ secure: true,
796
+ ...params
797
+ }),
798
+ getContributorsByChangeRequestId: (spaceId, changeRequestId, params = {}) => this.request({
799
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/contributors`,
800
+ method: "GET",
801
+ secure: true,
802
+ format: "json",
803
+ ...params
804
+ }),
805
+ getRevisionOfChangeRequestById: (spaceId, changeRequestId, params = {}) => this.request({
806
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/content`,
807
+ method: "GET",
808
+ secure: true,
809
+ format: "json",
810
+ ...params
811
+ }),
812
+ importContentInChangeRequest: (spaceId, changeRequestId, data, params = {}) => this.request({
813
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/content/import`,
814
+ method: "POST",
815
+ body: data,
816
+ secure: true,
817
+ type: "application/json" /* Json */,
818
+ format: "json",
819
+ ...params
820
+ }),
821
+ listFilesInChangeRequestById: (spaceId, changeRequestId, query, params = {}) => this.request({
822
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/content/files`,
823
+ method: "GET",
824
+ query,
825
+ secure: true,
826
+ ...params
827
+ }),
828
+ getPageInChangeRequestById: (spaceId, changeRequestId, pageId, query, params = {}) => this.request({
829
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/content/page/${pageId}`,
830
+ method: "GET",
831
+ query,
832
+ secure: true,
833
+ format: "json",
834
+ ...params
835
+ }),
836
+ importContentInChangeRequestPageById: (spaceId, changeRequestId, pageId, data, params = {}) => this.request({
837
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/content/page/${pageId}/import`,
838
+ method: "POST",
839
+ body: data,
840
+ secure: true,
841
+ type: "application/json" /* Json */,
842
+ format: "json",
843
+ ...params
844
+ }),
845
+ getPageInChangeRequestByPath: (spaceId, changeRequestId, pagePath, query, params = {}) => this.request({
846
+ path: `/spaces/${spaceId}/change-requests/${changeRequestId}/content/path/${pagePath}`,
847
+ method: "GET",
848
+ query,
849
+ secure: true,
850
+ format: "json",
851
+ ...params
852
+ }),
853
+ getRevisionById: (spaceId, revisionId, params = {}) => this.request({
854
+ path: `/spaces/${spaceId}/revisions/${revisionId}`,
855
+ method: "GET",
856
+ secure: true,
857
+ format: "json",
858
+ ...params
859
+ }),
860
+ listFilesInRevisionById: (spaceId, revisionId, query, params = {}) => this.request({
861
+ path: `/spaces/${spaceId}/revisions/${revisionId}/files`,
862
+ method: "GET",
863
+ query,
864
+ secure: true,
865
+ ...params
866
+ }),
867
+ getPageInRevisionById: (spaceId, revisionId, pageId, query, params = {}) => this.request({
868
+ path: `/spaces/${spaceId}/revisions/${revisionId}/page/${pageId}`,
869
+ method: "GET",
870
+ query,
871
+ secure: true,
872
+ format: "json",
873
+ ...params
874
+ }),
875
+ getPageInRevisionByPath: (spaceId, revisionId, pagePath, query, params = {}) => this.request({
876
+ path: `/spaces/${spaceId}/revisions/${revisionId}/path/${pagePath}`,
877
+ method: "GET",
878
+ query,
879
+ secure: true,
880
+ format: "json",
881
+ ...params
882
+ }),
883
+ listCommentsInSpace: (spaceId, query, params = {}) => this.request({
884
+ path: `/spaces/${spaceId}/comments`,
885
+ method: "GET",
886
+ query,
887
+ secure: true,
888
+ format: "json",
889
+ ...params
890
+ }),
891
+ postCommentInSpace: (spaceId, data, params = {}) => this.request({
892
+ path: `/spaces/${spaceId}/comments`,
893
+ method: "POST",
894
+ body: data,
895
+ secure: true,
896
+ type: "application/json" /* Json */,
897
+ format: "json",
898
+ ...params
899
+ }),
900
+ getCommentInSpace: (spaceId, commentId, query, params = {}) => this.request({
901
+ path: `/spaces/${spaceId}/comments/${commentId}`,
902
+ method: "GET",
903
+ query,
904
+ secure: true,
905
+ format: "json",
906
+ ...params
907
+ }),
908
+ deleteCommentInSpace: (spaceId, commentId, params = {}) => this.request({
909
+ path: `/spaces/${spaceId}/comments/${commentId}`,
910
+ method: "DELETE",
911
+ secure: true,
912
+ ...params
913
+ }),
914
+ updateCommentInSpace: (spaceId, commentId, data, params = {}) => this.request({
915
+ path: `/spaces/${spaceId}/comments/${commentId}`,
916
+ method: "PUT",
917
+ body: data,
918
+ secure: true,
919
+ type: "application/json" /* Json */,
920
+ format: "json",
921
+ ...params
922
+ }),
923
+ listCommentRepliesInSpace: (spaceId, commentId, query, params = {}) => this.request({
924
+ path: `/spaces/${spaceId}/comments/${commentId}/replies`,
925
+ method: "GET",
926
+ query,
927
+ secure: true,
928
+ format: "json",
929
+ ...params
930
+ }),
931
+ postCommentReplyInSpace: (spaceId, commentId, data, params = {}) => this.request({
932
+ path: `/spaces/${spaceId}/comments/${commentId}/replies`,
933
+ method: "POST",
934
+ body: data,
935
+ secure: true,
936
+ type: "application/json" /* Json */,
937
+ format: "json",
938
+ ...params
939
+ }),
940
+ getCommentReplyInSpace: (spaceId, commentId, commentReplyId, query, params = {}) => this.request({
941
+ path: `/spaces/${spaceId}/comments/${commentId}/replies/${commentReplyId}`,
942
+ method: "GET",
943
+ query,
944
+ secure: true,
945
+ format: "json",
946
+ ...params
947
+ }),
948
+ updateCommentReplyInSpace: (spaceId, commentId, commentReplyId, data, params = {}) => this.request({
949
+ path: `/spaces/${spaceId}/comments/${commentId}/replies/${commentReplyId}`,
950
+ method: "PUT",
951
+ body: data,
952
+ secure: true,
953
+ type: "application/json" /* Json */,
954
+ format: "json",
955
+ ...params
956
+ }),
957
+ deleteCommentReplyInSpace: (spaceId, commentId, commentReplyId, params = {}) => this.request({
958
+ path: `/spaces/${spaceId}/comments/${commentId}/replies/${commentReplyId}`,
959
+ method: "DELETE",
960
+ secure: true,
961
+ ...params
962
+ }),
963
+ listPermissionsAggregateInSpace: (spaceId, query, params = {}) => this.request({
964
+ path: `/spaces/${spaceId}/permissions/aggregate`,
965
+ method: "GET",
966
+ query,
967
+ secure: true,
968
+ format: "json",
969
+ ...params
970
+ }),
971
+ getSpacePublishingAuthById: (spaceId, params = {}) => this.request({
972
+ path: `/spaces/${spaceId}/publishing/auth`,
973
+ method: "GET",
974
+ secure: true,
975
+ format: "json",
976
+ ...params
977
+ }),
978
+ updateSpacePublishingAuthById: (spaceId, data, params = {}) => this.request({
979
+ path: `/spaces/${spaceId}/publishing/auth`,
980
+ method: "POST",
981
+ body: data,
982
+ secure: true,
983
+ type: "application/json" /* Json */,
984
+ format: "json",
985
+ ...params
986
+ }),
987
+ listSpaceIntegrationsBlocks: (spaceId, params = {}) => this.request(
988
+ {
989
+ path: `/spaces/${spaceId}/integration-blocks`,
990
+ method: "GET",
991
+ secure: true,
992
+ format: "json",
993
+ ...params
994
+ }
995
+ ),
996
+ listSpaceRelations: (spaceId, query, params = {}) => this.request({
997
+ path: `/spaces/${spaceId}/relations`,
998
+ method: "GET",
999
+ query,
1000
+ secure: true,
1001
+ format: "json",
1002
+ ...params
1003
+ }),
1004
+ createSpaceRelation: (spaceId, data, params = {}) => this.request({
1005
+ path: `/spaces/${spaceId}/relations`,
1006
+ method: "POST",
1007
+ body: data,
1008
+ secure: true,
1009
+ type: "application/json" /* Json */,
1010
+ format: "json",
1011
+ ...params
1012
+ }),
1013
+ getSpaceRelation: (spaceId, targetSpaceId, params = {}) => this.request({
1014
+ path: `/spaces/${spaceId}/relations/${targetSpaceId}`,
1015
+ method: "GET",
1016
+ secure: true,
1017
+ format: "json",
1018
+ ...params
1019
+ }),
1020
+ deleteSpaceRelation: (spaceId, targetSpaceId, params = {}) => this.request({
1021
+ path: `/spaces/${spaceId}/relations/${targetSpaceId}`,
1022
+ method: "DELETE",
1023
+ secure: true,
1024
+ ...params
1025
+ }),
1026
+ getSpaceCustomFields: (spaceId, params = {}) => this.request({
1027
+ path: `/spaces/${spaceId}/custom-fields`,
1028
+ method: "GET",
1029
+ secure: true,
1030
+ format: "json",
1031
+ ...params
1032
+ }),
1033
+ updateSpaceCustomFields: (spaceId, data, params = {}) => this.request({
1034
+ path: `/spaces/${spaceId}/custom-fields`,
1035
+ method: "PATCH",
1036
+ body: data,
1037
+ secure: true,
1038
+ type: "application/json" /* Json */,
1039
+ ...params
1040
+ }),
1041
+ listSpaceEntities: (spaceId, query, params = {}) => this.request({
1042
+ path: `/spaces/${spaceId}/entities`,
1043
+ method: "GET",
1044
+ query,
1045
+ secure: true,
1046
+ format: "json",
1047
+ ...params
1048
+ }),
1049
+ addSpaceEntities: (spaceId, data, params = {}) => this.request({
1050
+ path: `/spaces/${spaceId}/entities`,
1051
+ method: "POST",
1052
+ body: data,
1053
+ secure: true,
1054
+ type: "application/json" /* Json */,
1055
+ ...params
1056
+ }),
1057
+ getSpaceEntity: (spaceId, integrationName, entityId, params = {}) => this.request({
1058
+ path: `/spaces/${spaceId}/entities/${integrationName}/${entityId}`,
1059
+ method: "GET",
1060
+ secure: true,
1061
+ format: "json",
1062
+ ...params
1063
+ }),
1064
+ updateSpaceEntity: (spaceId, integrationName, entityId, data, params = {}) => this.request({
1065
+ path: `/spaces/${spaceId}/entities/${integrationName}/${entityId}`,
1066
+ method: "PATCH",
1067
+ body: data,
1068
+ secure: true,
1069
+ type: "application/json" /* Json */,
1070
+ ...params
1071
+ }),
1072
+ deleteSpaceEntity: (spaceId, integrationName, entityId, params = {}) => this.request({
1073
+ path: `/spaces/${spaceId}/entities/${integrationName}/${entityId}`,
1074
+ method: "DELETE",
1075
+ secure: true,
1076
+ ...params
1077
+ })
1078
+ };
1079
+ this.collections = {
1080
+ getCollectionById: (collectionId, params = {}) => this.request({
1081
+ path: `/collections/${collectionId}`,
1082
+ method: "GET",
1083
+ secure: true,
1084
+ format: "json",
1085
+ ...params
1086
+ }),
1087
+ updateCollectionById: (collectionId, data, params = {}) => this.request({
1088
+ path: `/collections/${collectionId}`,
1089
+ method: "PATCH",
1090
+ body: data,
1091
+ secure: true,
1092
+ type: "application/json" /* Json */,
1093
+ format: "json",
1094
+ ...params
1095
+ }),
1096
+ listSpacesInCollectionById: (collectionId, query, params = {}) => this.request({
1097
+ path: `/collections/${collectionId}/spaces`,
1098
+ method: "GET",
1099
+ query,
1100
+ secure: true,
1101
+ format: "json",
1102
+ ...params
1103
+ }),
1104
+ listPermissionsAggregateInCollection: (collectionId, query, params = {}) => this.request({
1105
+ path: `/collections/${collectionId}/permissions/aggregate`,
1106
+ method: "GET",
1107
+ query,
1108
+ secure: true,
1109
+ format: "json",
1110
+ ...params
1111
+ }),
1112
+ getCollectionPublishingAuthById: (collectionId, params = {}) => this.request({
1113
+ path: `/collections/${collectionId}/publishing/auth`,
1114
+ method: "GET",
1115
+ secure: true,
1116
+ format: "json",
1117
+ ...params
1118
+ }),
1119
+ updateCollectionPublishingAuthById: (collectionId, data, params = {}) => this.request({
1120
+ path: `/collections/${collectionId}/publishing/auth`,
1121
+ method: "POST",
1122
+ body: data,
1123
+ secure: true,
1124
+ type: "application/json" /* Json */,
1125
+ format: "json",
1126
+ ...params
1127
+ })
1128
+ };
1129
+ this.integrations = {
1130
+ listIntegrations: (query, params = {}) => this.request({
1131
+ path: `/integrations`,
1132
+ method: "GET",
1133
+ query,
1134
+ secure: true,
1135
+ format: "json",
1136
+ ...params
1137
+ }),
1138
+ getIntegrationByName: (integrationName, params = {}) => this.request({
1139
+ path: `/integrations/${integrationName}`,
1140
+ method: "GET",
1141
+ secure: true,
1142
+ format: "json",
1143
+ ...params
1144
+ }),
1145
+ publishIntegration: (integrationName, data, params = {}) => this.request({
1146
+ path: `/integrations/${integrationName}`,
1147
+ method: "POST",
1148
+ body: data,
1149
+ secure: true,
1150
+ type: "application/json" /* Json */,
1151
+ format: "json",
1152
+ ...params
1153
+ }),
1154
+ unpublishIntegration: (integrationName, params = {}) => this.request({
1155
+ path: `/integrations/${integrationName}`,
1156
+ method: "DELETE",
1157
+ secure: true,
1158
+ ...params
1159
+ }),
1160
+ listIntegrationInstallations: (integrationName, query, params = {}) => this.request({
1161
+ path: `/integrations/${integrationName}/installations`,
1162
+ method: "GET",
1163
+ query,
1164
+ secure: true,
1165
+ format: "json",
1166
+ ...params
1167
+ }),
1168
+ installIntegration: (integrationName, data, params = {}) => this.request({
1169
+ path: `/integrations/${integrationName}/installations`,
1170
+ method: "POST",
1171
+ body: data,
1172
+ secure: true,
1173
+ type: "application/json" /* Json */,
1174
+ format: "json",
1175
+ ...params
1176
+ }),
1177
+ listIntegrationEvents: (integrationName, query, params = {}) => this.request({
1178
+ path: `/integrations/${integrationName}/events`,
1179
+ method: "GET",
1180
+ query,
1181
+ secure: true,
1182
+ format: "json",
1183
+ ...params
1184
+ }),
1185
+ getIntegrationEvent: (integrationName, eventId, params = {}) => this.request({
1186
+ path: `/integrations/${integrationName}/events/${eventId}`,
1187
+ method: "GET",
1188
+ secure: true,
1189
+ format: "json",
1190
+ ...params
1191
+ }),
1192
+ listIntegrationSpaceInstallations: (integrationName, query, params = {}) => this.request({
1193
+ path: `/integrations/${integrationName}/spaces`,
1194
+ method: "GET",
1195
+ query,
1196
+ secure: true,
1197
+ format: "json",
1198
+ ...params
1199
+ }),
1200
+ updateIntegrationDevSpace: (integrationName, spaceId, data, params = {}) => this.request({
1201
+ path: `/integrations/${integrationName}/spaces/${spaceId}/dev`,
1202
+ method: "PUT",
1203
+ body: data,
1204
+ secure: true,
1205
+ type: "application/json" /* Json */,
1206
+ ...params
1207
+ }),
1208
+ removeIntegrationDevSpace: (integrationName, spaceId, params = {}) => this.request({
1209
+ path: `/integrations/${integrationName}/spaces/${spaceId}/dev`,
1210
+ method: "DELETE",
1211
+ secure: true,
1212
+ ...params
1213
+ }),
1214
+ renderIntegrationUiWithGet: (integrationName, query, params = {}) => this.request({
1215
+ path: `/integrations/${integrationName}/render`,
1216
+ method: "GET",
1217
+ query,
1218
+ secure: true,
1219
+ format: "json",
1220
+ ...params
1221
+ }),
1222
+ renderIntegrationUiWithPost: (integrationName, data, params = {}) => this.request({
1223
+ path: `/integrations/${integrationName}/render`,
1224
+ method: "POST",
1225
+ body: data,
1226
+ secure: true,
1227
+ type: "application/json" /* Json */,
1228
+ format: "json",
1229
+ ...params
1230
+ }),
1231
+ updateIntegrationInstallation: (integrationName, installationId, data, params = {}) => this.request({
1232
+ path: `/integrations/${integrationName}/installations/${installationId}`,
1233
+ method: "PATCH",
1234
+ body: data,
1235
+ secure: true,
1236
+ type: "application/json" /* Json */,
1237
+ format: "json",
1238
+ ...params
1239
+ }),
1240
+ uninstallIntegration: (integrationName, installationId, params = {}) => this.request({
1241
+ path: `/integrations/${integrationName}/installations/${installationId}`,
1242
+ method: "DELETE",
1243
+ secure: true,
1244
+ ...params
1245
+ }),
1246
+ createIntegrationInstallationToken: (integrationName, installationId, params = {}) => this.request({
1247
+ path: `/integrations/${integrationName}/installations/${installationId}/tokens`,
1248
+ method: "POST",
1249
+ secure: true,
1250
+ format: "json",
1251
+ ...params
1252
+ }),
1253
+ installIntegrationOnSpace: (integrationName, installationId, data, params = {}) => this.request({
1254
+ path: `/integrations/${integrationName}/installations/${installationId}/spaces`,
1255
+ method: "POST",
1256
+ body: data,
1257
+ secure: true,
1258
+ type: "application/json" /* Json */,
1259
+ format: "json",
1260
+ ...params
1261
+ }),
1262
+ updateIntegrationSpaceInstallation: (integrationName, installationId, spaceId, data, params = {}) => this.request({
1263
+ path: `/integrations/${integrationName}/installations/${installationId}/spaces/${spaceId}`,
1264
+ method: "PATCH",
1265
+ body: data,
1266
+ secure: true,
1267
+ type: "application/json" /* Json */,
1268
+ format: "json",
1269
+ ...params
1270
+ }),
1271
+ uninstallIntegrationFromSpace: (integrationName, installationId, spaceId, params = {}) => this.request({
1272
+ path: `/integrations/${integrationName}/installations/${installationId}/spaces/${spaceId}`,
1273
+ method: "DELETE",
1274
+ secure: true,
1275
+ ...params
1276
+ }),
1277
+ getIntegrationEntities: (integrationName, installationId, params = {}) => this.request({
1278
+ path: `/integrations/${integrationName}/installations/${installationId}/entities`,
1279
+ method: "GET",
1280
+ secure: true,
1281
+ format: "json",
1282
+ ...params
1283
+ }),
1284
+ syncIntegrationEntities: (integrationName, installationId, data, params = {}) => this.request({
1285
+ path: `/integrations/${integrationName}/installations/${installationId}/entities`,
1286
+ method: "POST",
1287
+ body: data,
1288
+ secure: true,
1289
+ type: "application/json" /* Json */,
1290
+ ...params
1291
+ })
1292
+ };
1293
+ this.orgs = {
1294
+ listOrganizationsForAuthenticatedUser: (query, params = {}) => this.request({
1295
+ path: `/orgs`,
1296
+ method: "GET",
1297
+ query,
1298
+ secure: true,
1299
+ format: "json",
1300
+ ...params
1301
+ }),
1302
+ createOrganization: (data, params = {}) => this.request({
1303
+ path: `/orgs`,
1304
+ method: "POST",
1305
+ body: data,
1306
+ secure: true,
1307
+ type: "application/json" /* Json */,
1308
+ format: "json",
1309
+ ...params
1310
+ }),
1311
+ getOrganizationById: (organizationId, params = {}) => this.request({
1312
+ path: `/orgs/${organizationId}`,
1313
+ method: "GET",
1314
+ secure: true,
1315
+ format: "json",
1316
+ ...params
1317
+ }),
1318
+ listMembersInOrganizationById: (organizationId, query, params = {}) => this.request({
1319
+ path: `/orgs/${organizationId}/members`,
1320
+ method: "GET",
1321
+ query,
1322
+ secure: true,
1323
+ format: "json",
1324
+ ...params
1325
+ }),
1326
+ getMemberInOrganizationById: (organizationId, userId, params = {}) => this.request({
1327
+ path: `/orgs/${organizationId}/members/${userId}`,
1328
+ method: "GET",
1329
+ secure: true,
1330
+ format: "json",
1331
+ ...params
1332
+ }),
1333
+ updateMemberInOrganizationById: (organizationId, userId, data, params = {}) => this.request({
1334
+ path: `/orgs/${organizationId}/members/${userId}`,
1335
+ method: "PATCH",
1336
+ body: data,
1337
+ secure: true,
1338
+ type: "application/json" /* Json */,
1339
+ format: "json",
1340
+ ...params
1341
+ }),
1342
+ removeMemberFromOrganizationById: (organizationId, userId, params = {}) => this.request({
1343
+ path: `/orgs/${organizationId}/members/${userId}`,
1344
+ method: "DELETE",
1345
+ secure: true,
1346
+ ...params
1347
+ }),
1348
+ updateOrganizationMemberLastSeenAt: (organizationId, params = {}) => this.request({
1349
+ path: `/orgs/${organizationId}/ping`,
1350
+ method: "POST",
1351
+ secure: true,
1352
+ ...params
1353
+ }),
1354
+ setUserAsSsoMemberForOrganization: (organizationId, userId, params = {}) => this.request({
1355
+ path: `/orgs/${organizationId}/members/${userId}/sso`,
1356
+ method: "POST",
1357
+ secure: true,
1358
+ format: "json",
1359
+ ...params
1360
+ }),
1361
+ listSpacesForOrganizationMember: (organizationId, userId, query, params = {}) => this.request({
1362
+ path: `/orgs/${organizationId}/members/${userId}/spaces`,
1363
+ method: "GET",
1364
+ query,
1365
+ secure: true,
1366
+ format: "json",
1367
+ ...params
1368
+ }),
1369
+ listTeamsForOrganizationMember: (organizationId, userId, query, params = {}) => this.request(
1370
+ {
1371
+ path: `/orgs/${organizationId}/members/${userId}/teams`,
1372
+ method: "GET",
1373
+ query,
1374
+ secure: true,
1375
+ format: "json",
1376
+ ...params
1377
+ }
1378
+ ),
1379
+ listTeamsInOrganizationById: (organizationId, query, params = {}) => this.request({
1380
+ path: `/orgs/${organizationId}/teams`,
1381
+ method: "GET",
1382
+ query,
1383
+ secure: true,
1384
+ format: "json",
1385
+ ...params
1386
+ }),
1387
+ createOrganizationTeam: (organizationId, data, params = {}) => this.request({
1388
+ path: `/orgs/${organizationId}/teams`,
1389
+ method: "PUT",
1390
+ body: data,
1391
+ secure: true,
1392
+ type: "application/json" /* Json */,
1393
+ format: "json",
1394
+ ...params
1395
+ }),
1396
+ getTeamInOrganizationById: (organizationId, teamId, params = {}) => this.request({
1397
+ path: `/orgs/${organizationId}/teams/${teamId}`,
1398
+ method: "GET",
1399
+ secure: true,
1400
+ format: "json",
1401
+ ...params
1402
+ }),
1403
+ updateTeamInOrganizationById: (organizationId, teamId, data, params = {}) => this.request({
1404
+ path: `/orgs/${organizationId}/teams/${teamId}`,
1405
+ method: "PATCH",
1406
+ body: data,
1407
+ secure: true,
1408
+ type: "application/json" /* Json */,
1409
+ format: "json",
1410
+ ...params
1411
+ }),
1412
+ removeTeamFromOrganizationById: (organizationId, teamId, params = {}) => this.request({
1413
+ path: `/orgs/${organizationId}/teams/${teamId}`,
1414
+ method: "DELETE",
1415
+ secure: true,
1416
+ ...params
1417
+ }),
1418
+ updateMembersInOrganizationTeam: (organizationId, teamId, data, params = {}) => this.request({
1419
+ path: `/orgs/${organizationId}/teams/${teamId}/members`,
1420
+ method: "PUT",
1421
+ body: data,
1422
+ secure: true,
1423
+ type: "application/json" /* Json */,
1424
+ ...params
1425
+ }),
1426
+ listTeamMembersInOrganizationById: (organizationId, teamId, query, params = {}) => this.request({
1427
+ path: `/orgs/${organizationId}/teams/${teamId}/members`,
1428
+ method: "GET",
1429
+ query,
1430
+ secure: true,
1431
+ format: "json",
1432
+ ...params
1433
+ }),
1434
+ addMemberToOrganizationTeamById: (organizationId, teamId, userId, data, params = {}) => this.request({
1435
+ path: `/orgs/${organizationId}/teams/${teamId}/members/${userId}`,
1436
+ method: "PUT",
1437
+ body: data,
1438
+ secure: true,
1439
+ type: "application/json" /* Json */,
1440
+ ...params
1441
+ }),
1442
+ deleteMemberFromOrganizationTeamById: (organizationId, teamId, userId, params = {}) => this.request({
1443
+ path: `/orgs/${organizationId}/teams/${teamId}/members/${userId}`,
1444
+ method: "DELETE",
1445
+ secure: true,
1446
+ ...params
1447
+ }),
1448
+ inviteUsersToOrganization: (organizationId, data, params = {}) => this.request({
1449
+ path: `/orgs/${organizationId}/invites`,
1450
+ method: "POST",
1451
+ body: data,
1452
+ secure: true,
1453
+ type: "application/json" /* Json */,
1454
+ format: "json",
1455
+ ...params
1456
+ }),
1457
+ joinOrganizationWithInvite: (organizationId, inviteId, params = {}) => this.request({
1458
+ path: `/orgs/${organizationId}/invites/${inviteId}`,
1459
+ method: "POST",
1460
+ secure: true,
1461
+ format: "json",
1462
+ ...params
1463
+ }),
1464
+ upgradeOrganizationPlan: (organizationId, data, params = {}) => this.request({
1465
+ path: `/orgs/${organizationId}/billing`,
1466
+ method: "POST",
1467
+ body: data,
1468
+ secure: true,
1469
+ type: "application/json" /* Json */,
1470
+ format: "json",
1471
+ ...params
1472
+ }),
1473
+ getOrganizationBillingPortal: (organizationId, params = {}) => this.request({
1474
+ path: `/orgs/${organizationId}/billing`,
1475
+ method: "GET",
1476
+ secure: true,
1477
+ format: "json",
1478
+ ...params
1479
+ }),
1480
+ requestOrganizationUpgrade: (organizationId, params = {}) => this.request({
1481
+ path: `/orgs/${organizationId}/request_upgrade`,
1482
+ method: "POST",
1483
+ secure: true,
1484
+ format: "json",
1485
+ ...params
1486
+ }),
1487
+ transferOrganization: (organizationId, data, params = {}) => this.request({
1488
+ path: `/orgs/${organizationId}/transfer`,
1489
+ method: "POST",
1490
+ body: data,
1491
+ secure: true,
1492
+ type: "application/json" /* Json */,
1493
+ format: "json",
1494
+ ...params
1495
+ }),
1496
+ searchOrganizationContent: (organizationId, query, params = {}) => this.request({
1497
+ path: `/orgs/${organizationId}/search`,
1498
+ method: "GET",
1499
+ query,
1500
+ secure: true,
1501
+ format: "json",
1502
+ ...params
1503
+ }),
1504
+ listSpacesInOrganizationById: (organizationId, query, params = {}) => this.request({
1505
+ path: `/orgs/${organizationId}/spaces`,
1506
+ method: "GET",
1507
+ query,
1508
+ secure: true,
1509
+ format: "json",
1510
+ ...params
1511
+ }),
1512
+ createSpace: (organizationId, data, params = {}) => this.request({
1513
+ path: `/orgs/${organizationId}/spaces`,
1514
+ method: "POST",
1515
+ body: data,
1516
+ secure: true,
1517
+ type: "application/json" /* Json */,
1518
+ format: "json",
1519
+ ...params
1520
+ }),
1521
+ listSpacesWithGitSyncInOrganizationById: (organizationId, query, params = {}) => this.request({
1522
+ path: `/orgs/${organizationId}/spaces/gitsync`,
1523
+ method: "GET",
1524
+ query,
1525
+ secure: true,
1526
+ format: "json",
1527
+ ...params
1528
+ }),
1529
+ listCollectionsInOrganizationById: (organizationId, query, params = {}) => this.request({
1530
+ path: `/orgs/${organizationId}/collections`,
1531
+ method: "GET",
1532
+ query,
1533
+ secure: true,
1534
+ format: "json",
1535
+ ...params
1536
+ }),
1537
+ setupDirectorySync: (organizationId, params = {}) => this.request({
1538
+ path: `/orgs/${organizationId}/dsync`,
1539
+ method: "POST",
1540
+ secure: true,
1541
+ format: "json",
1542
+ ...params
1543
+ }),
1544
+ listDirectorySyncGroups: (organizationId, params = {}) => this.request({
1545
+ path: `/orgs/${organizationId}/dsync/groups`,
1546
+ method: "GET",
1547
+ secure: true,
1548
+ format: "json",
1549
+ ...params
1550
+ }),
1551
+ syncDirectorySyncGroupsToTeams: (organizationId, data, params = {}) => this.request({
1552
+ path: `/orgs/${organizationId}/dsync/teams`,
1553
+ method: "POST",
1554
+ body: data,
1555
+ secure: true,
1556
+ type: "application/json" /* Json */,
1557
+ format: "json",
1558
+ ...params
1559
+ }),
1560
+ listOrganizationCustomFields: (organizationId, query, params = {}) => this.request({
1561
+ path: `/orgs/${organizationId}/custom-fields`,
1562
+ method: "GET",
1563
+ query,
1564
+ secure: true,
1565
+ format: "json",
1566
+ ...params
1567
+ }),
1568
+ createOrganizationCustomField: (organizationId, data, params = {}) => this.request({
1569
+ path: `/orgs/${organizationId}/custom-fields`,
1570
+ method: "POST",
1571
+ body: data,
1572
+ secure: true,
1573
+ type: "application/json" /* Json */,
1574
+ format: "json",
1575
+ ...params
1576
+ }),
1577
+ getOrganizationCustomFieldByName: (organizationId, fieldName, params = {}) => this.request({
1578
+ path: `/orgs/${organizationId}/custom-fields/${fieldName}`,
1579
+ method: "GET",
1580
+ secure: true,
1581
+ format: "json",
1582
+ ...params
1583
+ }),
1584
+ updateOrganizationCustomField: (organizationId, fieldName, data, params = {}) => this.request({
1585
+ path: `/orgs/${organizationId}/custom-fields/${fieldName}`,
1586
+ method: "PATCH",
1587
+ body: data,
1588
+ secure: true,
1589
+ type: "application/json" /* Json */,
1590
+ format: "json",
1591
+ ...params
1592
+ }),
1593
+ deleteOrganizationCustomField: (organizationId, fieldName, params = {}) => this.request({
1594
+ path: `/orgs/${organizationId}/custom-fields/${fieldName}`,
1595
+ method: "DELETE",
1596
+ secure: true,
1597
+ ...params
1598
+ }),
1599
+ listSpaceRelationsInOrganization: (organizationId, query, params = {}) => this.request({
1600
+ path: `/orgs/${organizationId}/space-relations`,
1601
+ method: "GET",
1602
+ query,
1603
+ secure: true,
1604
+ format: "json",
1605
+ ...params
1606
+ }),
1607
+ listEntitiesInOrganization: (organizationId, query, params = {}) => this.request({
1608
+ path: `/orgs/${organizationId}/entities`,
1609
+ method: "GET",
1610
+ query,
1611
+ secure: true,
1612
+ format: "json",
1613
+ ...params
1614
+ }),
1615
+ listEnvironments: (organizationId, query, params = {}) => this.request({
1616
+ path: `/orgs/${organizationId}/environments`,
1617
+ method: "GET",
1618
+ query,
1619
+ secure: true,
1620
+ format: "json",
1621
+ ...params
1622
+ }),
1623
+ createEnvironment: (organizationId, data, params = {}) => this.request({
1624
+ path: `/orgs/${organizationId}/environments`,
1625
+ method: "POST",
1626
+ body: data,
1627
+ secure: true,
1628
+ type: "application/json" /* Json */,
1629
+ format: "json",
1630
+ ...params
1631
+ }),
1632
+ getEnvironmentByName: (organizationId, environmentName, params = {}) => this.request({
1633
+ path: `/orgs/${organizationId}/environments/${environmentName}`,
1634
+ method: "GET",
1635
+ secure: true,
1636
+ format: "json",
1637
+ ...params
1638
+ }),
1639
+ updateEnvironment: (organizationId, environmentName, data, params = {}) => this.request({
1640
+ path: `/orgs/${organizationId}/environments/${environmentName}`,
1641
+ method: "PATCH",
1642
+ body: data,
1643
+ secure: true,
1644
+ type: "application/json" /* Json */,
1645
+ format: "json",
1646
+ ...params
1647
+ }),
1648
+ deleteEnvironment: (organizationId, environmentName, params = {}) => this.request({
1649
+ path: `/orgs/${organizationId}/environments/${environmentName}`,
1650
+ method: "DELETE",
1651
+ secure: true,
1652
+ ...params
1653
+ })
1654
+ };
1655
+ this.internal = {
1656
+ generateHiveAccessToken: (data, params = {}) => this.request({
1657
+ path: `/internal/hive/token`,
1658
+ method: "POST",
1659
+ body: data,
1660
+ secure: true,
1661
+ type: "application/json" /* Json */,
1662
+ format: "json",
1663
+ ...params
1664
+ })
1665
+ };
1666
+ this.urls = {
1667
+ getContentByUrl: (query, params = {}) => this.request({
1668
+ path: `/urls/content`,
1669
+ method: "GET",
1670
+ query,
1671
+ secure: true,
1672
+ format: "json",
1673
+ ...params
1674
+ })
1675
+ };
1676
+ }
1677
+ };
1678
+
1679
+ // src/index.ts
1680
+ var GITBOOK_DEFAULT_ENDPOINT = "https://api.gitbook.com";
1681
+ var GitBookAPI = class extends Api {
1682
+ constructor(options = {}) {
1683
+ const { endpoint = GITBOOK_DEFAULT_ENDPOINT, authToken } = options;
1684
+ super({
1685
+ baseUrl: `${endpoint}/v1`,
1686
+ securityWorker: (securityData) => {
1687
+ if (securityData.authToken) {
1688
+ return {
1689
+ headers: {
1690
+ Authorization: `Bearer ${securityData.authToken}`
1691
+ }
1692
+ };
1693
+ }
1694
+ return {};
1695
+ },
1696
+ customFetch: async (input, init) => {
1697
+ if ("credentials" in init) {
1698
+ delete init.credentials;
1699
+ }
1700
+ if ("referrerPolicy" in init) {
1701
+ delete init.referrerPolicy;
1702
+ }
1703
+ const response = await fetch(input, init);
1704
+ if (!response.ok) {
1705
+ let error = response.statusText;
1706
+ try {
1707
+ const body = await response.json();
1708
+ error = body?.error?.message || error;
1709
+ } catch (err) {
1710
+ response.headers.forEach((value, key) => {
1711
+ error += `${key}:${value} `;
1712
+ });
1713
+ }
1714
+ throw new Error(
1715
+ `GitBook API failed with [${response.status}] ${response.url}: ${error}`
1716
+ );
1717
+ }
1718
+ return response;
1719
+ }
1720
+ });
1721
+ this.endpoint = endpoint;
1722
+ this.setSecurityData({ authToken });
1723
+ }
1724
+ async createInstallationClient(integrationName, installationId) {
1725
+ const { data: installationToken } = await this.integrations.createIntegrationInstallationToken(
1726
+ integrationName,
1727
+ installationId
1728
+ );
1729
+ return new GitBookAPI({
1730
+ endpoint: this.endpoint,
1731
+ authToken: installationToken.token
1732
+ });
1733
+ }
1734
+ };
1735
+ // Annotate the CommonJS export names for ESM import in node:
1736
+ 0 && (module.exports = {
1737
+ APIIntegrationScope,
1738
+ AnalyticsSearchPeriod,
1739
+ AnalyticsTrafficInterval,
1740
+ Api,
1741
+ BillingInterval,
1742
+ BillingProduct,
1743
+ ChangeRequestReviewStatus,
1744
+ ChangeRequestStatus,
1745
+ CloudflareHostnameStatus,
1746
+ CloudflareHostnameTLSStatus,
1747
+ CloudflareHostnameTLSValidationMethod,
1748
+ ContentKitIcon,
1749
+ ContentType,
1750
+ ContentVisibility,
1751
+ CustomFieldType,
1752
+ GITBOOK_DEFAULT_ENDPOINT,
1753
+ GitBookAPI,
1754
+ GitSyncOperationState,
1755
+ HttpClient,
1756
+ ImportContentSource,
1757
+ IntegrationCategory,
1758
+ IntegrationInstallationSpaceSelection,
1759
+ IntegrationInstallationStatus,
1760
+ IntegrationScope,
1761
+ IntegrationVisibility,
1762
+ MemberRole,
1763
+ OrganizationCommunityType,
1764
+ OrganizationType,
1765
+ OrganizationUseCase,
1766
+ PurgeCDNCacheContextType,
1767
+ SpaceRelationType,
1768
+ SpaceType,
1769
+ TeamMemberRole
1770
+ });