@gitbook/api 0.82.0 → 0.84.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
@@ -1250,11 +1250,16 @@ export interface SpaceTrackPageView {
1250
1250
  /** The URL of referrer that linked to the page. */
1251
1251
  referrer: string;
1252
1252
  }
1253
- export interface InviteEmailsUsersTeamsToSpace {
1253
+ export type InviteUsersAndTeams = ({
1254
+ /** @minItems 1 */
1254
1255
  teams: string[];
1255
- /** Role to set on the team. */
1256
+ } | {
1257
+ /** @minItems 1 */
1258
+ users: string[];
1259
+ }) & {
1260
+ /** Role to set. */
1256
1261
  role: MemberRoleOrGuest;
1257
- }
1262
+ };
1258
1263
  export type RevisionPageGroup = RevisionPageBase & {
1259
1264
  /** @deprecated */
1260
1265
  kind: 'group';
@@ -2927,7 +2932,7 @@ export type SiteViewEvent = SiteEvent & {
2927
2932
  * Unique identifier of the visited space in the site.
2928
2933
  * @deprecated
2929
2934
  */
2930
- spaceId: string;
2935
+ spaceId?: string;
2931
2936
  /** The site-space that was viewed */
2932
2937
  siteSpaceId?: string;
2933
2938
  /** Unique identifier of the visited page. */
@@ -3538,6 +3543,7 @@ export declare enum SiteType {
3538
3543
  export type SiteTitle = string;
3539
3544
  /**
3540
3545
  * Custom hostname for the site, for e.g. docs.mycompany.com
3546
+ * @maxLength 512
3541
3547
  * @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
3548
  */
3543
3549
  export type SiteHostname = string;
@@ -3547,6 +3553,12 @@ export type SiteHostname = string;
3547
3553
  * @maxLength 100
3548
3554
  */
3549
3555
  export type SiteBasename = string;
3556
+ /**
3557
+ * Proxy URL for the site, for e.g. company.com/docs or www.company.com/developer/docs etc.
3558
+ * @maxLength 512
3559
+ * @pattern ^([\w-]+\.)*[\w-]+\.[a-zA-Z]{2,}(\/[\w-]+)+$
3560
+ */
3561
+ export type SiteProxy = string;
3550
3562
  /**
3551
3563
  * The visibility setting of the site determines the audience of the site.
3552
3564
  * * `public`: Anyone can access the site, and the site is indexed by search engines.
@@ -3598,6 +3610,8 @@ export interface Site {
3598
3610
  hostname?: SiteHostname;
3599
3611
  /** Basename for the site. For e.g. api */
3600
3612
  basename?: SiteBasename;
3613
+ /** Proxy URL for the site, for e.g. company.com/docs or www.company.com/developer/docs etc. */
3614
+ proxy?: SiteProxy;
3601
3615
  /**
3602
3616
  * The visibility setting of the site determines the audience of the site.
3603
3617
  * * `public`: Anyone can access the site, and the site is indexed by search engines.
@@ -4489,6 +4503,91 @@ export type SiteTrackPageView = {
4489
4503
  /** The site-space that was viewed */
4490
4504
  siteSpaceId: string;
4491
4505
  });
4506
+ /** Analytics info on the GitBook's site session. */
4507
+ export interface SiteInsightsEventSession {
4508
+ /** GitBook's unique identifier of the visitor. */
4509
+ visitorId: string;
4510
+ /** GitBook's unique identifier of the visitor's session. */
4511
+ sessionId: string;
4512
+ /** The visitors cookies. */
4513
+ cookies: Record<string, string>;
4514
+ /**
4515
+ * IP address of the visitor.
4516
+ * If not defined, it'll default to the IP executing the request.
4517
+ */
4518
+ ip?: string;
4519
+ /**
4520
+ * User-agent of the visitor.
4521
+ * https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent
4522
+ */
4523
+ userAgent: string;
4524
+ /**
4525
+ * Language of the visitor.
4526
+ * https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language
4527
+ */
4528
+ language: string | null;
4529
+ /** Referrer of the sesion */
4530
+ referrer: null | URL;
4531
+ }
4532
+ /** Location of the event. */
4533
+ export interface SiteInsightsEventLocation {
4534
+ /** URL of the location. */
4535
+ url: URL;
4536
+ /** ID of the concerned site section. */
4537
+ siteSection: string | null;
4538
+ /** ID of the concerned site space. */
4539
+ siteSpace: string | null;
4540
+ /** ID of the concerned site share key. */
4541
+ siteShareKey: string | null;
4542
+ /** ID of the concerned space. */
4543
+ space: string | null;
4544
+ /** ID of the concerned revision. */
4545
+ revision: string | null;
4546
+ /** ID of the concerned page. */
4547
+ page: string | null;
4548
+ }
4549
+ export interface SiteInsightsEventBase {
4550
+ /** Analytics info on the GitBook's site session. */
4551
+ session: SiteInsightsEventSession;
4552
+ /** Location of the event. */
4553
+ location: SiteInsightsEventLocation;
4554
+ /** Optional timestamp of the event. If not provided, the current timestamp will be used. */
4555
+ timestamp?: Timestamp;
4556
+ }
4557
+ export type SiteInsightsEventPageView = SiteInsightsEventBase & {
4558
+ type: 'page_view';
4559
+ };
4560
+ export type SiteInsightsEventSearchOpen = SiteInsightsEventBase & {
4561
+ type: 'search_open';
4562
+ };
4563
+ export type SiteInsightsEventSearchTypeQuery = SiteInsightsEventBase & {
4564
+ type: 'search_type_query';
4565
+ /** Query of the search. */
4566
+ query: string;
4567
+ };
4568
+ export type SiteInsightsEventSearchOpenResult = SiteInsightsEventBase & {
4569
+ type: 'search_open_result';
4570
+ /** Query of the search. */
4571
+ query: string;
4572
+ result: {
4573
+ /** ID of the concerned space. */
4574
+ spaceId: string;
4575
+ /** ID of the concerned page. */
4576
+ pageId: string;
4577
+ };
4578
+ };
4579
+ export type SiteInsightsEventPagePostFeedback = SiteInsightsEventBase & {
4580
+ type: 'page_post_feedback';
4581
+ feedback: {
4582
+ rating: PageFeedbackRating;
4583
+ };
4584
+ };
4585
+ export type SiteInsightsEventAskQuestion = SiteInsightsEventBase & {
4586
+ type: 'ask_question';
4587
+ /** Question being asked. */
4588
+ query: string;
4589
+ };
4590
+ export type SiteInsightsEvent = SiteInsightsEventPageView | SiteInsightsEventSearchOpen | SiteInsightsEventSearchTypeQuery | SiteInsightsEventSearchOpenResult | SiteInsightsEventPagePostFeedback | SiteInsightsEventAskQuestion;
4492
4591
  /**
4493
4592
  * The interval for grouping the results
4494
4593
  * @default "week"
@@ -5938,11 +6037,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5938
6037
  *
5939
6038
  * @tags spaces
5940
6039
  * @name InviteToSpace
5941
- * @summary Invite to a space (only teams supported for now)
6040
+ * @summary Invite to a space
5942
6041
  * @request POST:/spaces/{spaceId}/permissions
5943
6042
  * @secure
5944
6043
  */
5945
- inviteToSpace: (spaceId: string, data: InviteEmailsUsersTeamsToSpace, params?: RequestParams) => Promise<HttpResponse<void, Error | {
6044
+ inviteToSpace: (spaceId: string, data: InviteUsersAndTeams, params?: RequestParams) => Promise<HttpResponse<void, Error | {
5946
6045
  error: {
5947
6046
  /** @format int32 */
5948
6047
  code: 404;
@@ -7569,6 +7668,22 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
7569
7668
  message: string;
7570
7669
  };
7571
7670
  }>>;
7671
+ /**
7672
+ * No description
7673
+ *
7674
+ * @tags collections
7675
+ * @name InviteToCollection
7676
+ * @summary Invite to a collection
7677
+ * @request POST:/collections/{collectionId}/permissions
7678
+ * @secure
7679
+ */
7680
+ inviteToCollection: (collectionId: string, data: InviteUsersAndTeams, params?: RequestParams) => Promise<HttpResponse<void, Error | {
7681
+ error: {
7682
+ /** @format int32 */
7683
+ code: 404;
7684
+ message: string;
7685
+ };
7686
+ }>>;
7572
7687
  /**
7573
7688
  * No description
7574
7689
  *
@@ -8292,7 +8407,10 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8292
8407
  * @request POST:/orgs/{organizationId}/ping
8293
8408
  * @secure
8294
8409
  */
8295
- updateOrganizationMemberLastSeenAt: (organizationId: string, params?: RequestParams) => Promise<HttpResponse<void, Error>>;
8410
+ updateOrganizationMemberLastSeenAt: (organizationId: string, params?: RequestParams) => Promise<HttpResponse<{
8411
+ /** A JTW token containing the claims to attach to this user. */
8412
+ gitbookVisitorClaims?: string;
8413
+ }, Error>>;
8296
8414
  /**
8297
8415
  * No description
8298
8416
  *
@@ -9497,6 +9615,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9497
9615
  defaultSiteSpace?: string;
9498
9616
  /** ID of the site-section to be used as the default. */
9499
9617
  defaultSiteSection?: string;
9618
+ /**
9619
+ * 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`.
9620
+ * Use `null` to remove the proxy.
9621
+ */
9622
+ proxy?: SiteProxy | null;
9500
9623
  }, params?: RequestParams) => Promise<HttpResponse<Site, Error>>;
9501
9624
  /**
9502
9625
  * No description
@@ -10298,9 +10421,22 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
10298
10421
  * @name TrackViewInSiteById
10299
10422
  * @summary Track a page view in a site
10300
10423
  * @request POST:/orgs/{organizationId}/sites/{siteId}/insights/track_view
10424
+ * @deprecated
10301
10425
  * @secure
10302
10426
  */
10303
10427
  trackViewInSiteById: (organizationId: string, siteId: string, data: SiteTrackPageView, params?: RequestParams) => Promise<HttpResponse<void, Error>>;
10428
+ /**
10429
+ * @description Track events in a site.
10430
+ *
10431
+ * @tags sites
10432
+ * @name TrackEventsInSiteById
10433
+ * @summary Track events in a site.
10434
+ * @request POST:/orgs/{organizationId}/sites/{siteId}/insights/events
10435
+ * @secure
10436
+ */
10437
+ trackEventsInSiteById: (organizationId: string, siteId: string, data: {
10438
+ events: SiteInsightsEvent[];
10439
+ }, params?: RequestParams) => Promise<HttpResponse<void, Error>>;
10304
10440
  /**
10305
10441
  * No description
10306
10442
  *
@@ -10645,6 +10781,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
10645
10781
  url: URL;
10646
10782
  /** JWT token generated for a visitor auth session */
10647
10783
  visitorAuthToken?: string;
10784
+ /**
10785
+ * When true redirects the user to the authentication/fallback URL if the visitor auth token is invalid
10786
+ * @default false
10787
+ */
10788
+ redirectOnError?: boolean;
10648
10789
  }, params?: RequestParams) => Promise<HttpResponse<PublishedSiteContentLookup, Error | {
10649
10790
  error: {
10650
10791
  /** @format int32 */
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.82.0";
256
+ var version = "0.84.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.82.0";
175
+ var version = "0.84.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.82.0",
7
+ "version": "0.84.0",
8
8
  "sideEffects": false,
9
9
  "files": [
10
10
  "README.md",