@gitbook/api 0.96.1 → 0.98.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 CHANGED
@@ -180,8 +180,6 @@ var require_node = __commonJS({
180
180
  var src_exports = {};
181
181
  __export(src_exports, {
182
182
  APIIntegrationScope: () => APIIntegrationScope,
183
- AnalyticsSearchPeriod: () => AnalyticsSearchPeriod,
184
- AnalyticsTrafficInterval: () => AnalyticsTrafficInterval,
185
183
  Api: () => Api,
186
184
  BillingInterval: () => BillingInterval,
187
185
  BillingProduct: () => BillingProduct,
@@ -206,11 +204,12 @@ __export(src_exports, {
206
204
  CustomHostnameSslStatus: () => CustomHostnameSslStatus,
207
205
  CustomizationBackground: () => CustomizationBackground,
208
206
  CustomizationCorners: () => CustomizationCorners,
209
- CustomizationFont: () => CustomizationFont,
207
+ CustomizationDefaultFont: () => CustomizationDefaultFont,
210
208
  CustomizationHeaderPreset: () => CustomizationHeaderPreset,
211
209
  CustomizationIconsStyle: () => CustomizationIconsStyle,
212
210
  CustomizationLinksStyle: () => CustomizationLinksStyle,
213
211
  CustomizationLocale: () => CustomizationLocale,
212
+ CustomizationSearchStyle: () => CustomizationSearchStyle,
214
213
  CustomizationSidebarBackgroundStyle: () => CustomizationSidebarBackgroundStyle,
215
214
  CustomizationSidebarListStyle: () => CustomizationSidebarListStyle,
216
215
  CustomizationTheme: () => CustomizationTheme,
@@ -224,7 +223,6 @@ __export(src_exports, {
224
223
  GitSyncProvider: () => GitSyncProvider,
225
224
  HttpClient: () => HttpClient,
226
225
  ImportContentSource: () => ImportContentSource,
227
- InsightsInterval: () => InsightsInterval,
228
226
  IntegrationCategory: () => IntegrationCategory,
229
227
  IntegrationInstallationSiteSelection: () => IntegrationInstallationSiteSelection,
230
228
  IntegrationInstallationSpaceSelection: () => IntegrationInstallationSpaceSelection,
@@ -240,13 +238,13 @@ __export(src_exports, {
240
238
  OrganizationType: () => OrganizationType,
241
239
  OrganizationUseCase: () => OrganizationUseCase,
242
240
  PageFeedbackRating: () => PageFeedbackRating,
243
- PurgeCDNCacheContextType: () => PurgeCDNCacheContextType,
244
241
  RevisionPageLayoutOptionsCoverSize: () => RevisionPageLayoutOptionsCoverSize,
245
242
  RevisionPageLayoutPreset: () => RevisionPageLayoutPreset,
246
243
  RevisionPageType: () => RevisionPageType,
247
244
  RevisionSemanticChangeType: () => RevisionSemanticChangeType,
248
245
  SiteAdsStatus: () => SiteAdsStatus,
249
246
  SiteAdsTopic: () => SiteAdsTopic,
247
+ SiteCustomizationFeature: () => SiteCustomizationFeature,
250
248
  SiteInsightsAdPlacement: () => SiteInsightsAdPlacement,
251
249
  SiteInsightsEventType: () => SiteInsightsEventType,
252
250
  SiteInsightsLinkPosition: () => SiteInsightsLinkPosition,
@@ -257,7 +255,6 @@ __export(src_exports, {
257
255
  SiteInsightsVisitorBrowser: () => SiteInsightsVisitorBrowser,
258
256
  SiteInsightsVisitorDevice: () => SiteInsightsVisitorDevice,
259
257
  SiteInsightsVisitorOS: () => SiteInsightsVisitorOS,
260
- SiteToMigrateFeature: () => SiteToMigrateFeature,
261
258
  SiteType: () => SiteType,
262
259
  SiteVisibility: () => SiteVisibility,
263
260
  SpaceEditMode: () => SpaceEditMode,
@@ -268,7 +265,7 @@ module.exports = __toCommonJS(src_exports);
268
265
 
269
266
  // package.json
270
267
  var name = "@gitbook/api";
271
- var version = "0.96.1";
268
+ var version = "0.98.0";
272
269
 
273
270
  // src/client.ts
274
271
  var import_event_iterator = __toESM(require_node(), 1);
@@ -402,18 +399,6 @@ var RevisionPageLayoutOptionsCoverSize = /* @__PURE__ */ ((RevisionPageLayoutOpt
402
399
  RevisionPageLayoutOptionsCoverSize2["Full"] = "full";
403
400
  return RevisionPageLayoutOptionsCoverSize2;
404
401
  })(RevisionPageLayoutOptionsCoverSize || {});
405
- var AnalyticsSearchPeriod = /* @__PURE__ */ ((AnalyticsSearchPeriod2) => {
406
- AnalyticsSearchPeriod2["LastMonth"] = "last_month";
407
- AnalyticsSearchPeriod2["LastWeek"] = "last_week";
408
- AnalyticsSearchPeriod2["LastYear"] = "last_year";
409
- return AnalyticsSearchPeriod2;
410
- })(AnalyticsSearchPeriod || {});
411
- var AnalyticsTrafficInterval = /* @__PURE__ */ ((AnalyticsTrafficInterval2) => {
412
- AnalyticsTrafficInterval2["Daily"] = "daily";
413
- AnalyticsTrafficInterval2["Weekly"] = "weekly";
414
- AnalyticsTrafficInterval2["Monthly"] = "monthly";
415
- return AnalyticsTrafficInterval2;
416
- })(AnalyticsTrafficInterval || {});
417
402
  var ChangeRequestStatus = /* @__PURE__ */ ((ChangeRequestStatus2) => {
418
403
  ChangeRequestStatus2["Draft"] = "draft";
419
404
  ChangeRequestStatus2["Open"] = "open";
@@ -557,59 +542,6 @@ var RevisionPageLayoutPreset = /* @__PURE__ */ ((RevisionPageLayoutPreset2) => {
557
542
  RevisionPageLayoutPreset2["Landing"] = "landing";
558
543
  return RevisionPageLayoutPreset2;
559
544
  })(RevisionPageLayoutPreset || {});
560
- var CustomizationCorners = /* @__PURE__ */ ((CustomizationCorners2) => {
561
- CustomizationCorners2["Straight"] = "straight";
562
- CustomizationCorners2["Rounded"] = "rounded";
563
- return CustomizationCorners2;
564
- })(CustomizationCorners || {});
565
- var CustomizationFont = /* @__PURE__ */ ((CustomizationFont2) => {
566
- CustomizationFont2["ABCFavorit"] = "ABCFavorit";
567
- CustomizationFont2["Inter"] = "Inter";
568
- CustomizationFont2["Roboto"] = "Roboto";
569
- CustomizationFont2["RobotoSlab"] = "RobotoSlab";
570
- CustomizationFont2["OpenSans"] = "OpenSans";
571
- CustomizationFont2["SourceSansPro"] = "SourceSansPro";
572
- CustomizationFont2["Lato"] = "Lato";
573
- CustomizationFont2["Ubuntu"] = "Ubuntu";
574
- CustomizationFont2["Raleway"] = "Raleway";
575
- CustomizationFont2["Merriweather"] = "Merriweather";
576
- CustomizationFont2["Overpass"] = "Overpass";
577
- CustomizationFont2["NotoSans"] = "NotoSans";
578
- CustomizationFont2["IBMPlexSerif"] = "IBMPlexSerif";
579
- CustomizationFont2["Poppins"] = "Poppins";
580
- CustomizationFont2["FiraSans"] = "FiraSans";
581
- return CustomizationFont2;
582
- })(CustomizationFont || {});
583
- var CustomizationBackground = /* @__PURE__ */ ((CustomizationBackground2) => {
584
- CustomizationBackground2["Plain"] = "plain";
585
- CustomizationBackground2["Match"] = "match";
586
- return CustomizationBackground2;
587
- })(CustomizationBackground || {});
588
- var CustomizationLocale = /* @__PURE__ */ ((CustomizationLocale2) => {
589
- CustomizationLocale2["En"] = "en";
590
- CustomizationLocale2["Fr"] = "fr";
591
- CustomizationLocale2["Es"] = "es";
592
- CustomizationLocale2["Zh"] = "zh";
593
- CustomizationLocale2["Ja"] = "ja";
594
- CustomizationLocale2["De"] = "de";
595
- CustomizationLocale2["Nl"] = "nl";
596
- CustomizationLocale2["No"] = "no";
597
- CustomizationLocale2["PtBr"] = "pt-br";
598
- return CustomizationLocale2;
599
- })(CustomizationLocale || {});
600
- var CustomizationHeaderPreset = /* @__PURE__ */ ((CustomizationHeaderPreset2) => {
601
- CustomizationHeaderPreset2["Default"] = "default";
602
- CustomizationHeaderPreset2["Bold"] = "bold";
603
- CustomizationHeaderPreset2["Contrast"] = "contrast";
604
- CustomizationHeaderPreset2["Custom"] = "custom";
605
- CustomizationHeaderPreset2["None"] = "none";
606
- return CustomizationHeaderPreset2;
607
- })(CustomizationHeaderPreset || {});
608
- var CustomizationThemeMode = /* @__PURE__ */ ((CustomizationThemeMode2) => {
609
- CustomizationThemeMode2["Light"] = "light";
610
- CustomizationThemeMode2["Dark"] = "dark";
611
- return CustomizationThemeMode2;
612
- })(CustomizationThemeMode || {});
613
545
  var IntegrationTarget = /* @__PURE__ */ ((IntegrationTarget2) => {
614
546
  IntegrationTarget2["All"] = "all";
615
547
  IntegrationTarget2["Site"] = "site";
@@ -661,12 +593,6 @@ var CustomFieldType = /* @__PURE__ */ ((CustomFieldType2) => {
661
593
  CustomFieldType2["SelectSingle"] = "select:single";
662
594
  return CustomFieldType2;
663
595
  })(CustomFieldType || {});
664
- var PageFeedbackRating = /* @__PURE__ */ ((PageFeedbackRating2) => {
665
- PageFeedbackRating2["Bad"] = "bad";
666
- PageFeedbackRating2["Ok"] = "ok";
667
- PageFeedbackRating2["Good"] = "good";
668
- return PageFeedbackRating2;
669
- })(PageFeedbackRating || {});
670
596
  var IntegrationInstallationStatus = /* @__PURE__ */ ((IntegrationInstallationStatus2) => {
671
597
  IntegrationInstallationStatus2["Active"] = "active";
672
598
  IntegrationInstallationStatus2["Pending"] = "pending";
@@ -722,6 +648,17 @@ var SiteAdsTopic = /* @__PURE__ */ ((SiteAdsTopic2) => {
722
648
  SiteAdsTopic2["Crypto"] = "crypto";
723
649
  return SiteAdsTopic2;
724
650
  })(SiteAdsTopic || {});
651
+ var SiteCustomizationFeature = /* @__PURE__ */ ((SiteCustomizationFeature2) => {
652
+ SiteCustomizationFeature2["HeaderLogo"] = "header-logo";
653
+ SiteCustomizationFeature2["ThemePreset"] = "theme-preset";
654
+ SiteCustomizationFeature2["CustomFonts"] = "custom-fonts";
655
+ SiteCustomizationFeature2["CustomIcons"] = "custom-icons";
656
+ SiteCustomizationFeature2["FooterLogo"] = "footer-logo";
657
+ SiteCustomizationFeature2["FooterLinks"] = "footer-links";
658
+ SiteCustomizationFeature2["FooterCopyright"] = "footer-copyright";
659
+ SiteCustomizationFeature2["SemanticColors"] = "semantic-colors";
660
+ return SiteCustomizationFeature2;
661
+ })(SiteCustomizationFeature || {});
725
662
  var TeamMemberRole = /* @__PURE__ */ ((TeamMemberRole2) => {
726
663
  TeamMemberRole2["Owner"] = "owner";
727
664
  TeamMemberRole2["Member"] = "member";
@@ -732,25 +669,6 @@ var BillingInterval = /* @__PURE__ */ ((BillingInterval2) => {
732
669
  BillingInterval2["Yearly"] = "yearly";
733
670
  return BillingInterval2;
734
671
  })(BillingInterval || {});
735
- var SiteToMigrateFeature = /* @__PURE__ */ ((SiteToMigrateFeature2) => {
736
- SiteToMigrateFeature2["Sections"] = "sections";
737
- SiteToMigrateFeature2["VisitorAuth"] = "visitor-auth";
738
- SiteToMigrateFeature2["Redirects"] = "redirects";
739
- SiteToMigrateFeature2["CustomHostname"] = "custom-hostname";
740
- SiteToMigrateFeature2["AISearch"] = "AI-search";
741
- SiteToMigrateFeature2["PDFExport"] = "PDF-export";
742
- SiteToMigrateFeature2["PageRatings"] = "page-ratings";
743
- SiteToMigrateFeature2["CustomLogo"] = "custom-logo";
744
- SiteToMigrateFeature2["CustomThemePreset"] = "custom-theme-preset";
745
- SiteToMigrateFeature2["CustomFonts"] = "custom-fonts";
746
- SiteToMigrateFeature2["CustomIcons"] = "custom-icons";
747
- SiteToMigrateFeature2["CustomFooterLogo"] = "custom-footer-logo";
748
- SiteToMigrateFeature2["CustomFooterCopyright"] = "custom-footer-copyright";
749
- SiteToMigrateFeature2["CustomFooterLinks"] = "custom-footer-links";
750
- SiteToMigrateFeature2["Unlisted"] = "unlisted";
751
- SiteToMigrateFeature2["ShareLinks"] = "share-links";
752
- return SiteToMigrateFeature2;
753
- })(SiteToMigrateFeature || {});
754
672
  var CustomizationTheme = /* @__PURE__ */ ((CustomizationTheme2) => {
755
673
  CustomizationTheme2["Clean"] = "clean";
756
674
  CustomizationTheme2["Muted"] = "muted";
@@ -758,11 +676,39 @@ var CustomizationTheme = /* @__PURE__ */ ((CustomizationTheme2) => {
758
676
  CustomizationTheme2["Gradient"] = "gradient";
759
677
  return CustomizationTheme2;
760
678
  })(CustomizationTheme || {});
679
+ var CustomizationCorners = /* @__PURE__ */ ((CustomizationCorners2) => {
680
+ CustomizationCorners2["Straight"] = "straight";
681
+ CustomizationCorners2["Rounded"] = "rounded";
682
+ return CustomizationCorners2;
683
+ })(CustomizationCorners || {});
761
684
  var CustomizationLinksStyle = /* @__PURE__ */ ((CustomizationLinksStyle2) => {
762
685
  CustomizationLinksStyle2["Default"] = "default";
763
686
  CustomizationLinksStyle2["Accent"] = "accent";
764
687
  return CustomizationLinksStyle2;
765
688
  })(CustomizationLinksStyle || {});
689
+ var CustomizationDefaultFont = /* @__PURE__ */ ((CustomizationDefaultFont2) => {
690
+ CustomizationDefaultFont2["ABCFavorit"] = "ABCFavorit";
691
+ CustomizationDefaultFont2["Inter"] = "Inter";
692
+ CustomizationDefaultFont2["Roboto"] = "Roboto";
693
+ CustomizationDefaultFont2["RobotoSlab"] = "RobotoSlab";
694
+ CustomizationDefaultFont2["OpenSans"] = "OpenSans";
695
+ CustomizationDefaultFont2["SourceSansPro"] = "SourceSansPro";
696
+ CustomizationDefaultFont2["Lato"] = "Lato";
697
+ CustomizationDefaultFont2["Ubuntu"] = "Ubuntu";
698
+ CustomizationDefaultFont2["Raleway"] = "Raleway";
699
+ CustomizationDefaultFont2["Merriweather"] = "Merriweather";
700
+ CustomizationDefaultFont2["Overpass"] = "Overpass";
701
+ CustomizationDefaultFont2["NotoSans"] = "NotoSans";
702
+ CustomizationDefaultFont2["IBMPlexSerif"] = "IBMPlexSerif";
703
+ CustomizationDefaultFont2["Poppins"] = "Poppins";
704
+ CustomizationDefaultFont2["FiraSans"] = "FiraSans";
705
+ return CustomizationDefaultFont2;
706
+ })(CustomizationDefaultFont || {});
707
+ var CustomizationBackground = /* @__PURE__ */ ((CustomizationBackground2) => {
708
+ CustomizationBackground2["Plain"] = "plain";
709
+ CustomizationBackground2["Match"] = "match";
710
+ return CustomizationBackground2;
711
+ })(CustomizationBackground || {});
766
712
  var CustomizationIconsStyle = /* @__PURE__ */ ((CustomizationIconsStyle2) => {
767
713
  CustomizationIconsStyle2["Regular"] = "regular";
768
714
  CustomizationIconsStyle2["Solid"] = "solid";
@@ -782,6 +728,42 @@ var CustomizationSidebarListStyle = /* @__PURE__ */ ((CustomizationSidebarListSt
782
728
  CustomizationSidebarListStyle2["Line"] = "line";
783
729
  return CustomizationSidebarListStyle2;
784
730
  })(CustomizationSidebarListStyle || {});
731
+ var CustomizationSearchStyle = /* @__PURE__ */ ((CustomizationSearchStyle2) => {
732
+ CustomizationSearchStyle2["Prominent"] = "prominent";
733
+ CustomizationSearchStyle2["Subtle"] = "subtle";
734
+ return CustomizationSearchStyle2;
735
+ })(CustomizationSearchStyle || {});
736
+ var CustomizationLocale = /* @__PURE__ */ ((CustomizationLocale2) => {
737
+ CustomizationLocale2["En"] = "en";
738
+ CustomizationLocale2["Fr"] = "fr";
739
+ CustomizationLocale2["Es"] = "es";
740
+ CustomizationLocale2["Zh"] = "zh";
741
+ CustomizationLocale2["Ja"] = "ja";
742
+ CustomizationLocale2["De"] = "de";
743
+ CustomizationLocale2["Nl"] = "nl";
744
+ CustomizationLocale2["No"] = "no";
745
+ CustomizationLocale2["PtBr"] = "pt-br";
746
+ return CustomizationLocale2;
747
+ })(CustomizationLocale || {});
748
+ var CustomizationHeaderPreset = /* @__PURE__ */ ((CustomizationHeaderPreset2) => {
749
+ CustomizationHeaderPreset2["Default"] = "default";
750
+ CustomizationHeaderPreset2["Bold"] = "bold";
751
+ CustomizationHeaderPreset2["Contrast"] = "contrast";
752
+ CustomizationHeaderPreset2["Custom"] = "custom";
753
+ CustomizationHeaderPreset2["None"] = "none";
754
+ return CustomizationHeaderPreset2;
755
+ })(CustomizationHeaderPreset || {});
756
+ var CustomizationThemeMode = /* @__PURE__ */ ((CustomizationThemeMode2) => {
757
+ CustomizationThemeMode2["Light"] = "light";
758
+ CustomizationThemeMode2["Dark"] = "dark";
759
+ return CustomizationThemeMode2;
760
+ })(CustomizationThemeMode || {});
761
+ var PageFeedbackRating = /* @__PURE__ */ ((PageFeedbackRating2) => {
762
+ PageFeedbackRating2["Bad"] = "bad";
763
+ PageFeedbackRating2["Ok"] = "ok";
764
+ PageFeedbackRating2["Good"] = "good";
765
+ return PageFeedbackRating2;
766
+ })(PageFeedbackRating || {});
785
767
  var SiteInsightsLinkPosition = /* @__PURE__ */ ((SiteInsightsLinkPosition2) => {
786
768
  SiteInsightsLinkPosition2["Header"] = "header";
787
769
  SiteInsightsLinkPosition2["Footer"] = "footer";
@@ -870,13 +852,6 @@ var SiteInsightsQueryRange = /* @__PURE__ */ ((SiteInsightsQueryRange2) => {
870
852
  SiteInsightsQueryRange2["Last24Hours"] = "last24Hours";
871
853
  return SiteInsightsQueryRange2;
872
854
  })(SiteInsightsQueryRange || {});
873
- var InsightsInterval = /* @__PURE__ */ ((InsightsInterval2) => {
874
- InsightsInterval2["Day"] = "day";
875
- InsightsInterval2["Week"] = "week";
876
- InsightsInterval2["Month"] = "month";
877
- InsightsInterval2["Year"] = "year";
878
- return InsightsInterval2;
879
- })(InsightsInterval || {});
880
855
  var StorageUploadKind = /* @__PURE__ */ ((StorageUploadKind2) => {
881
856
  StorageUploadKind2["CustomizationFont"] = "customization_font";
882
857
  return StorageUploadKind2;
@@ -902,11 +877,6 @@ var CustomHostnameErrorStatus = /* @__PURE__ */ ((CustomHostnameErrorStatus2) =>
902
877
  CustomHostnameErrorStatus2["InternalError"] = "internal_error";
903
878
  return CustomHostnameErrorStatus2;
904
879
  })(CustomHostnameErrorStatus || {});
905
- var PurgeCDNCacheContextType = /* @__PURE__ */ ((PurgeCDNCacheContextType2) => {
906
- PurgeCDNCacheContextType2["Tags"] = "tags";
907
- PurgeCDNCacheContextType2["Hosts"] = "hosts";
908
- return PurgeCDNCacheContextType2;
909
- })(PurgeCDNCacheContextType || {});
910
880
  var CloudflareHostnameStatus = /* @__PURE__ */ ((CloudflareHostnameStatus2) => {
911
881
  CloudflareHostnameStatus2["Pending"] = "pending";
912
882
  CloudflareHostnameStatus2["Active"] = "active";
@@ -1196,43 +1166,6 @@ var Api = class extends HttpClient {
1196
1166
  format: "json",
1197
1167
  ...params
1198
1168
  });
1199
- search = {
1200
- searchContent: (query, params = {}) => this.request({
1201
- path: `/search`,
1202
- method: "GET",
1203
- query,
1204
- secure: true,
1205
- format: "json",
1206
- ...params
1207
- }),
1208
- askQueryWithGet: (query, params = {}) => this.request({
1209
- path: `/search/ask`,
1210
- method: "GET",
1211
- query,
1212
- secure: true,
1213
- format: "json",
1214
- ...params
1215
- }),
1216
- askQuery: (data, query, params = {}) => this.request({
1217
- path: `/search/ask`,
1218
- method: "POST",
1219
- query,
1220
- body: data,
1221
- secure: true,
1222
- type: "application/json" /* Json */,
1223
- format: "json",
1224
- ...params
1225
- }),
1226
- getRecommendedQuestions: (data, params = {}) => this.request({
1227
- path: `/search/questions`,
1228
- method: "POST",
1229
- body: data,
1230
- secure: true,
1231
- type: "application/json" /* Json */,
1232
- format: "json",
1233
- ...params
1234
- })
1235
- };
1236
1169
  user = {
1237
1170
  getAuthenticatedUser: (params = {}) => this.request({
1238
1171
  path: `/user`,
@@ -1323,44 +1256,6 @@ var Api = class extends HttpClient {
1323
1256
  format: "json",
1324
1257
  ...params
1325
1258
  }),
1326
- askQueryInSpaceWithGet: (spaceId, query, params = {}) => this.request({
1327
- path: `/spaces/${spaceId}/search/ask`,
1328
- method: "GET",
1329
- query,
1330
- secure: true,
1331
- format: "json",
1332
- ...params
1333
- }),
1334
- askQueryInSpace: (spaceId, data, query, params = {}) => this.request({
1335
- path: `/spaces/${spaceId}/search/ask`,
1336
- method: "POST",
1337
- query,
1338
- body: data,
1339
- secure: true,
1340
- type: "application/json" /* Json */,
1341
- format: "json",
1342
- ...params
1343
- }),
1344
- streamAskInSpace: (spaceId, query, params = {}) => this.streamRequest({
1345
- path: `/spaces/${spaceId}/search/ask/stream`,
1346
- method: "GET",
1347
- query,
1348
- secure: true,
1349
- ...params
1350
- }),
1351
- getRecommendedQuestionsInSpace: (spaceId, params = {}) => this.request({
1352
- path: `/spaces/${spaceId}/search/questions`,
1353
- method: "GET",
1354
- secure: true,
1355
- format: "json",
1356
- ...params
1357
- }),
1358
- streamRecommendedQuestionsInSpace: (spaceId, params = {}) => this.streamRequest({
1359
- path: `/spaces/${spaceId}/search/questions/stream`,
1360
- method: "GET",
1361
- secure: true,
1362
- ...params
1363
- }),
1364
1259
  importGitRepository: (spaceId, data, params = {}) => this.request({
1365
1260
  path: `/spaces/${spaceId}/git/import`,
1366
1261
  method: "POST",
@@ -1384,37 +1279,6 @@ var Api = class extends HttpClient {
1384
1279
  format: "json",
1385
1280
  ...params
1386
1281
  }),
1387
- getContentAnalyticsForSpaceById: (spaceId, params = {}) => this.request({
1388
- path: `/spaces/${spaceId}/insights/content`,
1389
- method: "GET",
1390
- secure: true,
1391
- format: "json",
1392
- ...params
1393
- }),
1394
- getSearchAnalyticsForSpaceById: (spaceId, query, params = {}) => this.request({
1395
- path: `/spaces/${spaceId}/insights/search`,
1396
- method: "GET",
1397
- query,
1398
- secure: true,
1399
- format: "json",
1400
- ...params
1401
- }),
1402
- getTrafficAnalyticsForSpaceById: (spaceId, query, params = {}) => this.request({
1403
- path: `/spaces/${spaceId}/insights/traffic`,
1404
- method: "GET",
1405
- query,
1406
- secure: true,
1407
- format: "json",
1408
- ...params
1409
- }),
1410
- trackViewInSpaceById: (spaceId, data, params = {}) => this.request({
1411
- path: `/spaces/${spaceId}/insights/track_view`,
1412
- method: "POST",
1413
- body: data,
1414
- secure: true,
1415
- type: "application/json" /* Json */,
1416
- ...params
1417
- }),
1418
1282
  inviteToSpace: (spaceId, data, params = {}) => this.request({
1419
1283
  path: `/spaces/${spaceId}/permissions`,
1420
1284
  method: "POST",
@@ -2043,22 +1907,6 @@ var Api = class extends HttpClient {
2043
1907
  format: "json",
2044
1908
  ...params
2045
1909
  }),
2046
- getSpacePublishingCustomizationById: (spaceId, params = {}) => this.request({
2047
- path: `/spaces/${spaceId}/publishing/customization`,
2048
- method: "GET",
2049
- secure: true,
2050
- format: "json",
2051
- ...params
2052
- }),
2053
- updateSpacePublishingCustomizationById: (spaceId, data, params = {}) => this.request({
2054
- path: `/spaces/${spaceId}/publishing/customization`,
2055
- method: "PUT",
2056
- body: data,
2057
- secure: true,
2058
- type: "application/json" /* Json */,
2059
- format: "json",
2060
- ...params
2061
- }),
2062
1910
  listSpaceIntegrations: (spaceId, query, params = {}) => this.request({
2063
1911
  path: `/spaces/${spaceId}/integrations`,
2064
1912
  method: "GET",
@@ -2096,22 +1944,6 @@ var Api = class extends HttpClient {
2096
1944
  type: "application/json" /* Json */,
2097
1945
  ...params
2098
1946
  }),
2099
- getPageFeedback: (spaceId, pageId, visitorId, params = {}) => this.request({
2100
- path: `/spaces/${spaceId}/pages/${pageId}/feedbacks/${visitorId}`,
2101
- method: "GET",
2102
- secure: true,
2103
- format: "json",
2104
- ...params
2105
- }),
2106
- createPageFeedback: (spaceId, pageId, visitorId, data, params = {}) => this.request({
2107
- path: `/spaces/${spaceId}/pages/${pageId}/feedbacks/${visitorId}`,
2108
- method: "PUT",
2109
- body: data,
2110
- secure: true,
2111
- type: "application/json" /* Json */,
2112
- format: "json",
2113
- ...params
2114
- }),
2115
1947
  getSpacePdf: (spaceId, query, params = {}) => this.request({
2116
1948
  path: `/spaces/${spaceId}/pdf`,
2117
1949
  method: "GET",
@@ -3176,23 +3008,6 @@ var Api = class extends HttpClient {
3176
3008
  secure: true,
3177
3009
  ...params
3178
3010
  }),
3179
- getContentAnalyticsForSiteSpaceById: (organizationId, siteId, siteSpaceId, query, params = {}) => this.request({
3180
- path: `/orgs/${organizationId}/sites/${siteId}/site-spaces/${siteSpaceId}/insights/content`,
3181
- method: "GET",
3182
- query,
3183
- secure: true,
3184
- format: "json",
3185
- ...params
3186
- }),
3187
- createSitesPageFeedback: (organizationId, siteId, siteSpaceId, pageId, visitorId, data, params = {}) => this.request({
3188
- path: `/orgs/${organizationId}/sites/${siteId}/site-spaces/${siteSpaceId}/insights/pages/${pageId}/feedbacks/${visitorId}`,
3189
- method: "PUT",
3190
- body: data,
3191
- secure: true,
3192
- type: "application/json" /* Json */,
3193
- format: "json",
3194
- ...params
3195
- }),
3196
3011
  moveSiteSectionGroup: (organizationId, siteId, siteSectionGroupId, data, params = {}) => this.request({
3197
3012
  path: `/orgs/${organizationId}/sites/${siteId}/section-groups/${siteSectionGroupId}/move`,
3198
3013
  method: "POST",
@@ -3228,14 +3043,6 @@ var Api = class extends HttpClient {
3228
3043
  format: "json",
3229
3044
  ...params
3230
3045
  }),
3231
- trackViewInSiteById: (organizationId, siteId, data, params = {}) => this.request({
3232
- path: `/orgs/${organizationId}/sites/${siteId}/insights/track_view`,
3233
- method: "POST",
3234
- body: data,
3235
- secure: true,
3236
- type: "application/json" /* Json */,
3237
- ...params
3238
- }),
3239
3046
  trackEventsInSiteById: (organizationId, siteId, data, params = {}) => this.request({
3240
3047
  path: `/orgs/${organizationId}/sites/${siteId}/insights/events`,
3241
3048
  method: "POST",
@@ -3260,14 +3067,6 @@ var Api = class extends HttpClient {
3260
3067
  format: "json",
3261
3068
  ...params
3262
3069
  }),
3263
- getSearchAnalyticsForSiteById: (organizationId, siteId, query, params = {}) => this.request({
3264
- path: `/orgs/${organizationId}/sites/${siteId}/insights/search`,
3265
- method: "GET",
3266
- query,
3267
- secure: true,
3268
- format: "json",
3269
- ...params
3270
- }),
3271
3070
  updateSiteAdsById: (organizationId, siteId, data, params = {}) => this.request({
3272
3071
  path: `/orgs/${organizationId}/sites/${siteId}/ads`,
3273
3072
  method: "POST",
@@ -3480,14 +3279,17 @@ var GitBookAPI = class extends Api {
3480
3279
  endpoint;
3481
3280
  authToken;
3482
3281
  userAgent;
3282
+ serviceBinding;
3483
3283
  constructor(options = {}) {
3484
3284
  const {
3485
3285
  endpoint = GITBOOK_DEFAULT_ENDPOINT,
3486
3286
  authToken,
3487
- userAgent = `${name}/${version}`
3287
+ userAgent = `${name}/${version}`,
3288
+ serviceBinding
3488
3289
  } = options;
3290
+ const normalizedEndpoint = endpoint.endsWith("/") ? endpoint.slice(0, -1) : endpoint;
3489
3291
  super({
3490
- baseUrl: `${endpoint}/v1`,
3292
+ baseUrl: `${normalizedEndpoint}/v1`,
3491
3293
  securityWorker: (securityData) => {
3492
3294
  if (securityData && securityData.authToken) {
3493
3295
  return {
@@ -3506,7 +3308,7 @@ var GitBookAPI = class extends Api {
3506
3308
  if (init && "referrerPolicy" in init) {
3507
3309
  delete init.referrerPolicy;
3508
3310
  }
3509
- const response = await fetch(input, init);
3311
+ const response = await (this.serviceBinding ? this.serviceBinding.fetch(input, init) : fetch(input, init));
3510
3312
  if (!response.ok) {
3511
3313
  let error = response.statusText;
3512
3314
  try {
@@ -3519,9 +3321,10 @@ var GitBookAPI = class extends Api {
3519
3321
  return response;
3520
3322
  }
3521
3323
  });
3522
- this.endpoint = endpoint;
3324
+ this.endpoint = normalizedEndpoint;
3523
3325
  this.userAgent = userAgent;
3524
3326
  this.authToken = authToken;
3327
+ this.serviceBinding = serviceBinding;
3525
3328
  this.setSecurityData({ authToken });
3526
3329
  }
3527
3330
  async createInstallationClient(integrationName, installationId) {
@@ -3532,15 +3335,14 @@ var GitBookAPI = class extends Api {
3532
3335
  return new GitBookAPI({
3533
3336
  endpoint: this.endpoint,
3534
3337
  userAgent: this.userAgent,
3535
- authToken: installationToken.token
3338
+ authToken: installationToken.token,
3339
+ serviceBinding: this.serviceBinding
3536
3340
  });
3537
3341
  }
3538
3342
  };
3539
3343
  // Annotate the CommonJS export names for ESM import in node:
3540
3344
  0 && (module.exports = {
3541
3345
  APIIntegrationScope,
3542
- AnalyticsSearchPeriod,
3543
- AnalyticsTrafficInterval,
3544
3346
  Api,
3545
3347
  BillingInterval,
3546
3348
  BillingProduct,
@@ -3565,11 +3367,12 @@ var GitBookAPI = class extends Api {
3565
3367
  CustomHostnameSslStatus,
3566
3368
  CustomizationBackground,
3567
3369
  CustomizationCorners,
3568
- CustomizationFont,
3370
+ CustomizationDefaultFont,
3569
3371
  CustomizationHeaderPreset,
3570
3372
  CustomizationIconsStyle,
3571
3373
  CustomizationLinksStyle,
3572
3374
  CustomizationLocale,
3375
+ CustomizationSearchStyle,
3573
3376
  CustomizationSidebarBackgroundStyle,
3574
3377
  CustomizationSidebarListStyle,
3575
3378
  CustomizationTheme,
@@ -3583,7 +3386,6 @@ var GitBookAPI = class extends Api {
3583
3386
  GitSyncProvider,
3584
3387
  HttpClient,
3585
3388
  ImportContentSource,
3586
- InsightsInterval,
3587
3389
  IntegrationCategory,
3588
3390
  IntegrationInstallationSiteSelection,
3589
3391
  IntegrationInstallationSpaceSelection,
@@ -3599,13 +3401,13 @@ var GitBookAPI = class extends Api {
3599
3401
  OrganizationType,
3600
3402
  OrganizationUseCase,
3601
3403
  PageFeedbackRating,
3602
- PurgeCDNCacheContextType,
3603
3404
  RevisionPageLayoutOptionsCoverSize,
3604
3405
  RevisionPageLayoutPreset,
3605
3406
  RevisionPageType,
3606
3407
  RevisionSemanticChangeType,
3607
3408
  SiteAdsStatus,
3608
3409
  SiteAdsTopic,
3410
+ SiteCustomizationFeature,
3609
3411
  SiteInsightsAdPlacement,
3610
3412
  SiteInsightsEventType,
3611
3413
  SiteInsightsLinkPosition,
@@ -3616,7 +3418,6 @@ var GitBookAPI = class extends Api {
3616
3418
  SiteInsightsVisitorBrowser,
3617
3419
  SiteInsightsVisitorDevice,
3618
3420
  SiteInsightsVisitorOS,
3619
- SiteToMigrateFeature,
3620
3421
  SiteType,
3621
3422
  SiteVisibility,
3622
3423
  SpaceEditMode,
package/dist/index.d.ts CHANGED
@@ -3,6 +3,9 @@ import { GitBookAPIError } from './GitBookAPIError';
3
3
  export * from './client';
4
4
  export { GitBookAPIError };
5
5
  export declare const GITBOOK_DEFAULT_ENDPOINT = "https://api.gitbook.com";
6
+ export interface GitBookAPIServiceBinding {
7
+ fetch: typeof fetch;
8
+ }
6
9
  export declare class GitBookAPI extends Api<{
7
10
  authToken?: string;
8
11
  }> {
@@ -18,6 +21,10 @@ export declare class GitBookAPI extends Api<{
18
21
  * User agent used by the API client.
19
22
  */
20
23
  readonly userAgent: string;
24
+ /**
25
+ * Service binding used to request the API.
26
+ */
27
+ readonly serviceBinding: GitBookAPIServiceBinding | undefined;
21
28
  constructor(options?: {
22
29
  /**
23
30
  * API endpoint to use.
@@ -26,13 +33,18 @@ export declare class GitBookAPI extends Api<{
26
33
  endpoint?: string;
27
34
  /**
28
35
  * User agent to use.
29
- * It'll default to the package name and version.
36
+ * It defaults to the package name and version.
30
37
  */
31
38
  userAgent?: string;
32
39
  /**
33
40
  * Authentication token to use.
34
41
  */
35
42
  authToken?: string;
43
+ /**
44
+ * Service binding used to request the API.
45
+ * It defaults to the HTTP fetch.
46
+ */
47
+ serviceBinding?: GitBookAPIServiceBinding;
36
48
  });
37
49
  /**
38
50
  * Create a new API client, authenticated as an installation.