@gitbook/api 0.83.0 → 0.85.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/client.d.ts CHANGED
@@ -592,16 +592,19 @@ export interface DocumentBlockTabs {
592
592
  isVoid?: false;
593
593
  data?: object;
594
594
  }
595
- export interface DocumentBlockSwagger {
595
+ /** Pointer to an operation in the OpenAPI spec. */
596
+ export interface OpenAPIOperationPointer {
597
+ /** Path of the operation in the OpenAPI spec. */
598
+ path: string;
599
+ /** HTTP method of the operation in the OpenAPI spec. */
600
+ method: string;
601
+ }
602
+ export interface DocumentBlockOpenAPI {
596
603
  object: 'block';
597
604
  type: 'swagger';
598
605
  key?: string;
599
- data: {
606
+ data: OpenAPIOperationPointer & {
600
607
  ref: ContentRefFile;
601
- /** Path of the operation in the OpenAPI spec. */
602
- path?: string;
603
- /** HTTP method of the operation in the OpenAPI spec. */
604
- method?: string;
605
608
  /** If true, the block is opened by default. */
606
609
  expanded?: boolean;
607
610
  fullWidth?: boolean;
@@ -639,7 +642,7 @@ export interface DocumentBlockStepper {
639
642
  isVoid?: false;
640
643
  data?: object;
641
644
  }
642
- export type DocumentBlocksTopLevels = DocumentBlocksEssentials | DocumentBlockQuote | DocumentBlockHint | DocumentBlockImages | DocumentBlockFile | DocumentBlockDrawing | DocumentBlockEmbed | DocumentBlockCode | DocumentBlockMath | DocumentBlockExpandable | DocumentBlockTabs | DocumentBlockTable | DocumentBlockSwagger | DocumentBlockContentRef | DocumentBlockIntegration | DocumentBlockReusableContent | DocumentBlockStepper;
645
+ export type DocumentBlocksTopLevels = DocumentBlocksEssentials | DocumentBlockQuote | DocumentBlockHint | DocumentBlockImages | DocumentBlockFile | DocumentBlockDrawing | DocumentBlockEmbed | DocumentBlockCode | DocumentBlockMath | DocumentBlockExpandable | DocumentBlockTabs | DocumentBlockTable | DocumentBlockOpenAPI | DocumentBlockContentRef | DocumentBlockIntegration | DocumentBlockReusableContent | DocumentBlockStepper;
643
646
  export interface JSONDocument {
644
647
  object: 'document';
645
648
  data: {
@@ -1250,11 +1253,16 @@ export interface SpaceTrackPageView {
1250
1253
  /** The URL of referrer that linked to the page. */
1251
1254
  referrer: string;
1252
1255
  }
1253
- export interface InviteEmailsUsersTeamsToSpace {
1256
+ export type InviteUsersAndTeams = ({
1257
+ /** @minItems 1 */
1254
1258
  teams: string[];
1255
- /** Role to set on the team. */
1259
+ } | {
1260
+ /** @minItems 1 */
1261
+ users: string[];
1262
+ }) & {
1263
+ /** Role to set. */
1256
1264
  role: MemberRoleOrGuest;
1257
- }
1265
+ };
1258
1266
  export type RevisionPageGroup = RevisionPageBase & {
1259
1267
  /** @deprecated */
1260
1268
  kind: 'group';
@@ -2927,7 +2935,7 @@ export type SiteViewEvent = SiteEvent & {
2927
2935
  * Unique identifier of the visited space in the site.
2928
2936
  * @deprecated
2929
2937
  */
2930
- spaceId: string;
2938
+ spaceId?: string;
2931
2939
  /** The site-space that was viewed */
2932
2940
  siteSpaceId?: string;
2933
2941
  /** Unique identifier of the visited page. */
@@ -3538,6 +3546,7 @@ export declare enum SiteType {
3538
3546
  export type SiteTitle = string;
3539
3547
  /**
3540
3548
  * Custom hostname for the site, for e.g. docs.mycompany.com
3549
+ * @maxLength 512
3541
3550
  * @pattern ^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?[.]){2,}[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$
3542
3551
  */
3543
3552
  export type SiteHostname = string;
@@ -3547,6 +3556,12 @@ export type SiteHostname = string;
3547
3556
  * @maxLength 100
3548
3557
  */
3549
3558
  export type SiteBasename = string;
3559
+ /**
3560
+ * Proxy URL for the site, for e.g. company.com/docs or www.company.com/developer/docs etc.
3561
+ * @maxLength 512
3562
+ * @pattern ^([\w-]+\.)*[\w-]+\.[a-zA-Z]{2,}(\/[\w-]+)+$
3563
+ */
3564
+ export type SiteProxy = string;
3550
3565
  /**
3551
3566
  * The visibility setting of the site determines the audience of the site.
3552
3567
  * * `public`: Anyone can access the site, and the site is indexed by search engines.
@@ -3598,6 +3613,8 @@ export interface Site {
3598
3613
  hostname?: SiteHostname;
3599
3614
  /** Basename for the site. For e.g. api */
3600
3615
  basename?: SiteBasename;
3616
+ /** Proxy URL for the site, for e.g. company.com/docs or www.company.com/developer/docs etc. */
3617
+ proxy?: SiteProxy;
3601
3618
  /**
3602
3619
  * The visibility setting of the site determines the audience of the site.
3603
3620
  * * `public`: Anyone can access the site, and the site is indexed by search engines.
@@ -4489,6 +4506,114 @@ export type SiteTrackPageView = {
4489
4506
  /** The site-space that was viewed */
4490
4507
  siteSpaceId: string;
4491
4508
  });
4509
+ /** Analytics info on the GitBook's site session. */
4510
+ export interface SiteInsightsEventSession {
4511
+ /** GitBook's unique identifier of the visitor. */
4512
+ visitorId: string;
4513
+ /** GitBook's unique identifier of the visitor's session. */
4514
+ sessionId: string;
4515
+ /** The visitors cookies. */
4516
+ cookies: Record<string, string>;
4517
+ /**
4518
+ * IP address of the visitor.
4519
+ * If not defined, it'll default to the IP executing the request.
4520
+ */
4521
+ ip?: string;
4522
+ /**
4523
+ * User-agent of the visitor.
4524
+ * https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent
4525
+ */
4526
+ userAgent: string;
4527
+ /**
4528
+ * Language of the visitor.
4529
+ * https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language
4530
+ */
4531
+ language: string | null;
4532
+ /** Referrer of the session */
4533
+ referrer: '' | null | URL;
4534
+ /**
4535
+ * Authentication token of the visitor.
4536
+ * This is used to identify the visitor with adaptive content.
4537
+ */
4538
+ visitorAuthToken?: string | null;
4539
+ }
4540
+ /** Location of the event. */
4541
+ export interface SiteInsightsEventLocation {
4542
+ /** URL of the location. */
4543
+ url: URL;
4544
+ /** ID of the concerned site section. */
4545
+ siteSection: string | null;
4546
+ /** ID of the concerned site space. */
4547
+ siteSpace: string | null;
4548
+ /** ID of the concerned site share key. */
4549
+ siteShareKey: string | null;
4550
+ /** ID of the concerned space. */
4551
+ space: string | null;
4552
+ /** ID of the concerned revision. */
4553
+ revision: string | null;
4554
+ /** ID of the concerned page. */
4555
+ page: string | null;
4556
+ }
4557
+ export interface SiteInsightsEventBase {
4558
+ /** Analytics info on the GitBook's site session. */
4559
+ session: SiteInsightsEventSession;
4560
+ /** Location of the event. */
4561
+ location: SiteInsightsEventLocation;
4562
+ /** Optional timestamp of the event. If not provided, the current timestamp will be used. */
4563
+ timestamp?: Timestamp;
4564
+ }
4565
+ export type SiteInsightsEventPageView = SiteInsightsEventBase & {
4566
+ type: 'page_view';
4567
+ };
4568
+ export type SiteInsightsEventSearchOpen = SiteInsightsEventBase & {
4569
+ type: 'search_open';
4570
+ };
4571
+ export type SiteInsightsEventSearchTypeQuery = SiteInsightsEventBase & {
4572
+ type: 'search_type_query';
4573
+ /** Query of the search. */
4574
+ query: string;
4575
+ };
4576
+ export type SiteInsightsEventSearchOpenResult = SiteInsightsEventBase & {
4577
+ type: 'search_open_result';
4578
+ /** Query of the search. */
4579
+ query: string;
4580
+ result: {
4581
+ /** ID of the concerned space. */
4582
+ spaceId: string;
4583
+ /** ID of the concerned page. */
4584
+ pageId: string;
4585
+ };
4586
+ };
4587
+ export type SiteInsightsEventPagePostFeedback = SiteInsightsEventBase & {
4588
+ type: 'page_post_feedback';
4589
+ feedback: {
4590
+ rating: PageFeedbackRating;
4591
+ };
4592
+ };
4593
+ export type SiteInsightsEventAskQuestion = SiteInsightsEventBase & {
4594
+ type: 'ask_question';
4595
+ /** Question being asked. */
4596
+ query: string;
4597
+ };
4598
+ export type SiteInsightsEventLinkClick = SiteInsightsEventBase & {
4599
+ type: 'link_click';
4600
+ link: {
4601
+ /** A relative reference to content in GitBook. */
4602
+ target: ContentRef;
4603
+ position: 'header' | 'footer' | 'sidebar' | 'content';
4604
+ };
4605
+ };
4606
+ export type SiteInsightsEventAPIClientOpen = SiteInsightsEventBase & {
4607
+ type: 'api_client_open';
4608
+ /** Pointer to an operation in the OpenAPI spec. */
4609
+ operation: OpenAPIOperationPointer;
4610
+ };
4611
+ export type SiteInsightsEventAPIClientRequest = SiteInsightsEventBase & {
4612
+ type: 'api_client_request';
4613
+ /** Pointer to an operation in the OpenAPI spec. */
4614
+ operation: OpenAPIOperationPointer;
4615
+ };
4616
+ export type SiteInsightsEvent = SiteInsightsEventPageView | SiteInsightsEventSearchOpen | SiteInsightsEventSearchTypeQuery | SiteInsightsEventSearchOpenResult | SiteInsightsEventPagePostFeedback | SiteInsightsEventAskQuestion | SiteInsightsEventLinkClick | SiteInsightsEventAPIClientOpen | SiteInsightsEventAPIClientRequest;
4492
4617
  /**
4493
4618
  * The interval for grouping the results
4494
4619
  * @default "week"
@@ -4836,7 +4961,7 @@ export interface ContentPublishingAuth {
4836
4961
  */
4837
4962
  fallbackURL?: string;
4838
4963
  }
4839
- export type DocumentBlock = DocumentBlockParagraph | DocumentBlockHeading | DocumentBlockListOrdered | DocumentBlockListUnordered | DocumentBlockListTasks | DocumentBlockListItem | DocumentBlockDivider | DocumentBlockQuote | DocumentBlockHint | DocumentBlockImages | DocumentBlockImage | DocumentBlockFile | DocumentBlockDrawing | DocumentBlockEmbed | DocumentBlockCode | DocumentBlockCodeLine | DocumentBlockMath | DocumentBlockExpandable | DocumentBlockTabs | DocumentBlockTabsItem | DocumentBlockTable | DocumentBlockSwagger | DocumentBlockContentRef | DocumentBlockIntegration | DocumentBlockReusableContent | DocumentBlockStepper | DocumentBlockStepperStep;
4964
+ export type DocumentBlock = DocumentBlockParagraph | DocumentBlockHeading | DocumentBlockListOrdered | DocumentBlockListUnordered | DocumentBlockListTasks | DocumentBlockListItem | DocumentBlockDivider | DocumentBlockQuote | DocumentBlockHint | DocumentBlockImages | DocumentBlockImage | DocumentBlockFile | DocumentBlockDrawing | DocumentBlockEmbed | DocumentBlockCode | DocumentBlockCodeLine | DocumentBlockMath | DocumentBlockExpandable | DocumentBlockTabs | DocumentBlockTabsItem | DocumentBlockTable | DocumentBlockOpenAPI | DocumentBlockContentRef | DocumentBlockIntegration | DocumentBlockReusableContent | DocumentBlockStepper | DocumentBlockStepperStep;
4840
4965
  export type InputPageBase = {
4841
4966
  /**
4842
4967
  * Optional unique identifier for the page.
@@ -5938,11 +6063,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5938
6063
  *
5939
6064
  * @tags spaces
5940
6065
  * @name InviteToSpace
5941
- * @summary Invite to a space (only teams supported for now)
6066
+ * @summary Invite to a space
5942
6067
  * @request POST:/spaces/{spaceId}/permissions
5943
6068
  * @secure
5944
6069
  */
5945
- inviteToSpace: (spaceId: string, data: InviteEmailsUsersTeamsToSpace, params?: RequestParams) => Promise<HttpResponse<void, Error | {
6070
+ inviteToSpace: (spaceId: string, data: InviteUsersAndTeams, params?: RequestParams) => Promise<HttpResponse<void, Error | {
5946
6071
  error: {
5947
6072
  /** @format int32 */
5948
6073
  code: 404;
@@ -7569,6 +7694,22 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
7569
7694
  message: string;
7570
7695
  };
7571
7696
  }>>;
7697
+ /**
7698
+ * No description
7699
+ *
7700
+ * @tags collections
7701
+ * @name InviteToCollection
7702
+ * @summary Invite to a collection
7703
+ * @request POST:/collections/{collectionId}/permissions
7704
+ * @secure
7705
+ */
7706
+ inviteToCollection: (collectionId: string, data: InviteUsersAndTeams, params?: RequestParams) => Promise<HttpResponse<void, Error | {
7707
+ error: {
7708
+ /** @format int32 */
7709
+ code: 404;
7710
+ message: string;
7711
+ };
7712
+ }>>;
7572
7713
  /**
7573
7714
  * No description
7574
7715
  *
@@ -8292,7 +8433,10 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8292
8433
  * @request POST:/orgs/{organizationId}/ping
8293
8434
  * @secure
8294
8435
  */
8295
- updateOrganizationMemberLastSeenAt: (organizationId: string, params?: RequestParams) => Promise<HttpResponse<void, Error>>;
8436
+ updateOrganizationMemberLastSeenAt: (organizationId: string, params?: RequestParams) => Promise<HttpResponse<{
8437
+ /** A JTW token containing the claims to attach to this user. */
8438
+ gitbookVisitorClaims?: string;
8439
+ }, Error>>;
8296
8440
  /**
8297
8441
  * No description
8298
8442
  *
@@ -9497,6 +9641,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9497
9641
  defaultSiteSpace?: string;
9498
9642
  /** ID of the site-section to be used as the default. */
9499
9643
  defaultSiteSection?: string;
9644
+ /**
9645
+ * Configure a proxy URL for a site. For example, you can use it to host the site on a subdirectory of your domain like `https://company.com/docs`.
9646
+ * Use `null` to remove the proxy.
9647
+ */
9648
+ proxy?: SiteProxy | null;
9500
9649
  }, params?: RequestParams) => Promise<HttpResponse<Site, Error>>;
9501
9650
  /**
9502
9651
  * No description
@@ -10298,9 +10447,22 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
10298
10447
  * @name TrackViewInSiteById
10299
10448
  * @summary Track a page view in a site
10300
10449
  * @request POST:/orgs/{organizationId}/sites/{siteId}/insights/track_view
10450
+ * @deprecated
10301
10451
  * @secure
10302
10452
  */
10303
10453
  trackViewInSiteById: (organizationId: string, siteId: string, data: SiteTrackPageView, params?: RequestParams) => Promise<HttpResponse<void, Error>>;
10454
+ /**
10455
+ * @description Track events in a site.
10456
+ *
10457
+ * @tags sites
10458
+ * @name TrackEventsInSiteById
10459
+ * @summary Track events in a site.
10460
+ * @request POST:/orgs/{organizationId}/sites/{siteId}/insights/events
10461
+ * @secure
10462
+ */
10463
+ trackEventsInSiteById: (organizationId: string, siteId: string, data: {
10464
+ events: SiteInsightsEvent[];
10465
+ }, params?: RequestParams) => Promise<HttpResponse<void, Error>>;
10304
10466
  /**
10305
10467
  * No description
10306
10468
  *
package/dist/index.cjs CHANGED
@@ -253,7 +253,7 @@ module.exports = __toCommonJS(src_exports);
253
253
 
254
254
  // package.json
255
255
  var name = "@gitbook/api";
256
- var version = "0.83.0";
256
+ var version = "0.85.0";
257
257
 
258
258
  // src/client.ts
259
259
  var import_event_iterator = __toESM(require_node(), 1);
@@ -2014,6 +2014,14 @@ var Api = class extends HttpClient {
2014
2014
  format: "json",
2015
2015
  ...params
2016
2016
  }),
2017
+ inviteToCollection: (collectionId, data, params = {}) => this.request({
2018
+ path: `/collections/${collectionId}/permissions`,
2019
+ method: "POST",
2020
+ body: data,
2021
+ secure: true,
2022
+ type: "application/json" /* Json */,
2023
+ ...params
2024
+ }),
2017
2025
  listPermissionsAggregateInCollection: (collectionId, query, params = {}) => this.request({
2018
2026
  path: `/collections/${collectionId}/permissions/aggregate`,
2019
2027
  method: "GET",
@@ -2328,6 +2336,7 @@ var Api = class extends HttpClient {
2328
2336
  path: `/orgs/${organizationId}/ping`,
2329
2337
  method: "POST",
2330
2338
  secure: true,
2339
+ format: "json",
2331
2340
  ...params
2332
2341
  }),
2333
2342
  setUserAsSsoMemberForOrganization: (organizationId, userId, params = {}) => this.request({
@@ -3216,6 +3225,14 @@ var Api = class extends HttpClient {
3216
3225
  type: "application/json" /* Json */,
3217
3226
  ...params
3218
3227
  }),
3228
+ trackEventsInSiteById: (organizationId, siteId, data, params = {}) => this.request({
3229
+ path: `/orgs/${organizationId}/sites/${siteId}/insights/events`,
3230
+ method: "POST",
3231
+ body: data,
3232
+ secure: true,
3233
+ type: "application/json" /* Json */,
3234
+ ...params
3235
+ }),
3219
3236
  getAdsInsightsForSiteById: (organizationId, siteId, query, params = {}) => this.request({
3220
3237
  path: `/orgs/${organizationId}/sites/${siteId}/insights/ads`,
3221
3238
  method: "GET",
package/dist/index.js CHANGED
@@ -172,7 +172,7 @@ var require_node = __commonJS({
172
172
 
173
173
  // package.json
174
174
  var name = "@gitbook/api";
175
- var version = "0.83.0";
175
+ var version = "0.85.0";
176
176
 
177
177
  // src/client.ts
178
178
  var import_event_iterator = __toESM(require_node(), 1);
@@ -1933,6 +1933,14 @@ var Api = class extends HttpClient {
1933
1933
  format: "json",
1934
1934
  ...params
1935
1935
  }),
1936
+ inviteToCollection: (collectionId, data, params = {}) => this.request({
1937
+ path: `/collections/${collectionId}/permissions`,
1938
+ method: "POST",
1939
+ body: data,
1940
+ secure: true,
1941
+ type: "application/json" /* Json */,
1942
+ ...params
1943
+ }),
1936
1944
  listPermissionsAggregateInCollection: (collectionId, query, params = {}) => this.request({
1937
1945
  path: `/collections/${collectionId}/permissions/aggregate`,
1938
1946
  method: "GET",
@@ -2247,6 +2255,7 @@ var Api = class extends HttpClient {
2247
2255
  path: `/orgs/${organizationId}/ping`,
2248
2256
  method: "POST",
2249
2257
  secure: true,
2258
+ format: "json",
2250
2259
  ...params
2251
2260
  }),
2252
2261
  setUserAsSsoMemberForOrganization: (organizationId, userId, params = {}) => this.request({
@@ -3135,6 +3144,14 @@ var Api = class extends HttpClient {
3135
3144
  type: "application/json" /* Json */,
3136
3145
  ...params
3137
3146
  }),
3147
+ trackEventsInSiteById: (organizationId, siteId, data, params = {}) => this.request({
3148
+ path: `/orgs/${organizationId}/sites/${siteId}/insights/events`,
3149
+ method: "POST",
3150
+ body: data,
3151
+ secure: true,
3152
+ type: "application/json" /* Json */,
3153
+ ...params
3154
+ }),
3138
3155
  getAdsInsightsForSiteById: (organizationId, siteId, query, params = {}) => this.request({
3139
3156
  path: `/orgs/${organizationId}/sites/${siteId}/insights/ads`,
3140
3157
  method: "GET",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
- "version": "0.83.0",
7
+ "version": "0.85.0",
8
8
  "sideEffects": false,
9
9
  "files": [
10
10
  "README.md",