@gitbook/api 0.25.0 → 0.26.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
@@ -17,11 +17,11 @@ export interface List {
17
17
  export declare type URL = string;
18
18
  /** @pattern ^#(?:[0-9a-fA-F]{3}){1,2}$ */
19
19
  export declare type Color = string;
20
- /** @format date */
21
- export declare type Date = string;
20
+ /** @format date-time */
21
+ export declare type Timestamp = string;
22
22
  /**
23
23
  * Unicode codepoint or character of the emoji
24
- * @maxLength 20
24
+ * @maxLength 50
25
25
  * @example "🎉"
26
26
  */
27
27
  export declare type Emoji = string;
@@ -34,7 +34,7 @@ export interface EmojiReaction {
34
34
  /** The users who reacted with this emoji */
35
35
  users: {
36
36
  user: User;
37
- reactedAt: Date;
37
+ reactedAt: Timestamp;
38
38
  }[];
39
39
  }
40
40
  export declare type EmojiReactions = EmojiReaction[];
@@ -151,6 +151,8 @@ export interface RequestImportGitRepository {
151
151
  repoCommitURL?: string;
152
152
  /** Path to a root directory for the project in the repository. */
153
153
  repoProjectDirectory?: string;
154
+ /** The timestamp of the event that triggered this import. It ensures that Git sync import and export operations are executed in the same order on GitBook and on the remote repository. */
155
+ timestamp?: Timestamp;
154
156
  force?: boolean;
155
157
  /** If true, the import will generate a revision without updating the space primary content. */
156
158
  standalone?: boolean;
@@ -172,6 +174,8 @@ export interface RequestExportToGitRepository {
172
174
  repoCommitURL?: string;
173
175
  /** Path to a root directory for the project in the repository. */
174
176
  repoProjectDirectory?: string;
177
+ /** The timestamp of the event that triggered this export. It ensures that Git sync import and export operations are executed in the same order on GitBook and on the remote repository. */
178
+ timestamp?: Timestamp;
175
179
  force?: boolean;
176
180
  /** Optional metadata to store on the space about the Git provider */
177
181
  gitInfo?: RequestUpdateSpaceGitInfo;
@@ -282,7 +286,7 @@ export interface UserAPIToken {
282
286
  /** The API token name. */
283
287
  label: string;
284
288
  /** The API token creation date. */
285
- createdAt: Date;
289
+ createdAt: Timestamp;
286
290
  }
287
291
  /** The API token details, including the token itself. */
288
292
  export declare type UserAPITokenExtended = UserAPIToken & {
@@ -314,7 +318,7 @@ export declare enum ContentVisibility {
314
318
  }
315
319
  /** Contributor towards content. */
316
320
  export interface UserContributor {
317
- updatedAt: Date;
321
+ updatedAt: Timestamp;
318
322
  count: number;
319
323
  user: User;
320
324
  }
@@ -357,9 +361,9 @@ export declare type Comment = {
357
361
  /** The user who posted the comment. */
358
362
  postedBy: User;
359
363
  /** When the comment was posted. */
360
- postedAt: Date;
364
+ postedAt: Timestamp;
361
365
  /** Date when the comment was edited, if it has been edited. */
362
- editedAt?: Date;
366
+ editedAt?: Timestamp;
363
367
  /** Any emoji reactions to the comment. */
364
368
  reactions: EmojiReactions;
365
369
  /** The number of replies to this comment. */
@@ -401,7 +405,7 @@ export declare type Comment = {
401
405
  /** Status of the comment. */
402
406
  status: 'resolved';
403
407
  /** If the comment has been resolved, the date at which it was resolved. If this field is not defined, the comment is not resolved. */
404
- resolvedAt: Date;
408
+ resolvedAt: Timestamp;
405
409
  /** If the comment has been resolved, the user who resolved it. If this field is not defined, the comment is not resolved. */
406
410
  resolvedBy: User;
407
411
  } | {
@@ -414,9 +418,9 @@ export interface CommentReply {
414
418
  /** Unique identifier for the reply. */
415
419
  id: string;
416
420
  postedBy: User;
417
- postedAt: Date;
421
+ postedAt: Timestamp;
418
422
  /** Date when the reply was edited, if it has been edited. */
419
- editedAt?: Date;
423
+ editedAt?: Timestamp;
420
424
  reactions: EmojiReactions;
421
425
  body: Document;
422
426
  /** URLs associated with the object */
@@ -938,7 +942,7 @@ export interface DocumentBlockDivider {
938
942
  isVoid: true;
939
943
  data: object;
940
944
  }
941
- export declare type ContentRef = ContentRefFile | ContentRefURL | ContentRefPage | ContentRefAnchor | ContentRefUser | ContentRefCollection | ContentRefSpace;
945
+ export declare type ContentRef = ContentRefFile | ContentRefURL | ContentRefPage | ContentRefAnchor | ContentRefUser | ContentRefCollection | ContentRefSpace | ContentRefSnippet;
942
946
  export interface ContentRefURL {
943
947
  kind: 'url';
944
948
  url: string;
@@ -973,17 +977,18 @@ export interface ContentRefSpace {
973
977
  kind: 'space';
974
978
  space: string;
975
979
  }
980
+ export interface ContentRefSnippet {
981
+ kind: 'snippet';
982
+ snippet: string;
983
+ organization: string;
984
+ }
976
985
  export interface Space {
977
986
  /** Type of Object, always equals to "space" */
978
987
  object: 'space';
979
988
  /** Unique identifier for the space */
980
989
  id: string;
981
- /**
982
- * Title of the space
983
- * @minLength 0
984
- * @maxLength 100
985
- */
986
- title: string;
990
+ /** Title of the space */
991
+ title: SpaceTitle;
987
992
  /** An emoji for this space. It'll match the emoji shown in the GitBook app. */
988
993
  emoji: Emoji;
989
994
  /**
@@ -996,9 +1001,15 @@ export interface Space {
996
1001
  * * `private`: Authorized members can access the content.
997
1002
  */
998
1003
  visibility: ContentVisibility;
999
- createdAt: Date;
1000
- updatedAt: Date;
1001
- deletedAt?: Date;
1004
+ createdAt: Timestamp;
1005
+ updatedAt: Timestamp;
1006
+ deletedAt?: Timestamp;
1007
+ /**
1008
+ * Determines how a Space can be edited.
1009
+ * * `live`: Users can directly edit the space
1010
+ * * `locked`: All edits are locked for this space.
1011
+ */
1012
+ editMode?: SpaceEditMode;
1002
1013
  /** URLs associated with the object */
1003
1014
  urls: {
1004
1015
  /**
@@ -1033,6 +1044,21 @@ export interface Space {
1033
1044
  parent?: string;
1034
1045
  gitSync?: GitSyncState;
1035
1046
  }
1047
+ /**
1048
+ * Determines how a Space can be edited.
1049
+ * * `live`: Users can directly edit the space
1050
+ * * `locked`: All edits are locked for this space.
1051
+ */
1052
+ export declare enum SpaceEditMode {
1053
+ Live = "live",
1054
+ Locked = "locked"
1055
+ }
1056
+ /**
1057
+ * Title of the space
1058
+ * @minLength 1
1059
+ * @maxLength 50
1060
+ */
1061
+ export declare type SpaceTitle = string;
1036
1062
  export interface RevisionBase {
1037
1063
  /** Type of Object, always equals to "revision" */
1038
1064
  object: 'revision';
@@ -1042,6 +1068,8 @@ export interface RevisionBase {
1042
1068
  parents: string[];
1043
1069
  pages: RevisionPage[];
1044
1070
  files: RevisionFile[];
1071
+ /** When the revision was created. */
1072
+ createdAt: Timestamp;
1045
1073
  /** Metadata about a potential associated git commit. */
1046
1074
  git?: GitSyncCommit;
1047
1075
  urls: {
@@ -1092,9 +1120,9 @@ export interface RevisionPageBase {
1092
1120
  /** Emoji of the page, if one has been set. */
1093
1121
  emoji?: Emoji;
1094
1122
  /** When the page was first created. Only present if page has been edited at least once. */
1095
- createdAt?: Date;
1123
+ createdAt?: Timestamp;
1096
1124
  /** When the page was last edited. Only present if page has been edited at least once. */
1097
- updatedAt?: Date;
1125
+ updatedAt?: Timestamp;
1098
1126
  }
1099
1127
  export declare type RevisionPageDocument = RevisionPageBase & Document & {
1100
1128
  /** @deprecated */
@@ -1333,7 +1361,7 @@ export interface GitSyncState {
1333
1361
  /** The URL to the repository tree, used when rendering public content. */
1334
1362
  url?: string;
1335
1363
  /** When the Git provider details were last updated */
1336
- updatedAt?: Date;
1364
+ updatedAt?: Timestamp;
1337
1365
  }
1338
1366
  export interface GitSyncOperation {
1339
1367
  /**
@@ -1342,9 +1370,9 @@ export interface GitSyncOperation {
1342
1370
  * * `success`: The operation was successful
1343
1371
  */
1344
1372
  state: GitSyncOperationState;
1345
- startedAt: Date;
1373
+ startedAt?: Timestamp;
1346
1374
  /** Date when the operation was successful (when state is `success`) */
1347
- completedAt?: Date;
1375
+ completedAt?: Timestamp;
1348
1376
  /** Error details, defined if state is `failure`. */
1349
1377
  error?: string;
1350
1378
  }
@@ -1471,9 +1499,9 @@ export interface OrganizationMember {
1471
1499
  /** Whatever the membership of this user is disabled and prevent them from accessing content. */
1472
1500
  disabled: boolean;
1473
1501
  /** Date at which the user joined the organization. */
1474
- joinedAt: Date;
1502
+ joinedAt: Timestamp;
1475
1503
  /** Date at which the user was last seen active in the organization. */
1476
- lastSeenAt?: Date;
1504
+ lastSeenAt?: Timestamp;
1477
1505
  /** Whether the user can login with SSO. */
1478
1506
  sso: boolean;
1479
1507
  spaces: number;
@@ -1491,7 +1519,7 @@ export interface OrganizationTeam {
1491
1519
  /** Count of spaces this team has access to. */
1492
1520
  spaces: number;
1493
1521
  /** Date at which the team was created. */
1494
- createdAt: Date;
1522
+ createdAt: Timestamp;
1495
1523
  }
1496
1524
  /**
1497
1525
  * Title of the team
@@ -1635,6 +1663,8 @@ export interface UpdateCaptureSchema {
1635
1663
  export declare type Snippet = Document & {
1636
1664
  /** Unique identifier for the snippet */
1637
1665
  id: string;
1666
+ /** ID of the organization owning this snippet */
1667
+ organization: string;
1638
1668
  /** @format date-time */
1639
1669
  createdAt: string;
1640
1670
  /**
@@ -1691,7 +1721,7 @@ export interface ContentAuditRelation {
1691
1721
  /** The status of the relation */
1692
1722
  status: ContentAuditRelationStatus;
1693
1723
  /** The date at which the relation was created */
1694
- createdAt: Date;
1724
+ createdAt: Timestamp;
1695
1725
  }
1696
1726
  /** The type of the relation between the sources */
1697
1727
  export declare enum ContentAuditRelationType {
@@ -1730,8 +1760,8 @@ export interface ChangeRequest {
1730
1760
  */
1731
1761
  subject: string;
1732
1762
  createdBy: User;
1733
- createdAt: Date;
1734
- updatedAt: Date;
1763
+ createdAt: Timestamp;
1764
+ updatedAt: Timestamp;
1735
1765
  /** URLs associated with the object */
1736
1766
  urls: {
1737
1767
  /**
@@ -1761,8 +1791,8 @@ export interface ChangeRequestReview {
1761
1791
  /** The status of the review. */
1762
1792
  status: ChangeRequestReviewStatus;
1763
1793
  comment?: Comment;
1764
- createdAt: Date;
1765
- updatedAt: Date;
1794
+ createdAt: Timestamp;
1795
+ updatedAt: Timestamp;
1766
1796
  }
1767
1797
  /** Status of a change request review. */
1768
1798
  export declare enum ChangeRequestReviewStatus {
@@ -1776,7 +1806,7 @@ export declare type ChangeRequestRequestedReviewer = {
1776
1806
  revision: string;
1777
1807
  /** The user who made the request. */
1778
1808
  requestedBy: User;
1779
- createdAt: Date;
1809
+ createdAt: Timestamp;
1780
1810
  } & ({
1781
1811
  kind: 'user';
1782
1812
  /** The user who was requested to review. */
@@ -2155,7 +2185,8 @@ export declare enum IntegrationScope {
2155
2185
  SpaceMetadataWrite = "space:metadata:write",
2156
2186
  SpaceScriptInject = "space:script:inject",
2157
2187
  SpaceScriptCookies = "space:script:cookies",
2158
- SpaceGitSync = "space:git:sync"
2188
+ SpaceGitSync = "space:git:sync",
2189
+ SpaceVisitorAuth = "space:visitor:auth"
2159
2190
  }
2160
2191
  /** Categories for which the integration is listed in the marketplace */
2161
2192
  export declare type IntegrationCategories = IntegrationCategory[];
@@ -2205,7 +2236,7 @@ export interface IntegrationEvent {
2205
2236
  integrationId: string;
2206
2237
  /** Unique ID of the integration installation. */
2207
2238
  installationId?: string;
2208
- createdAt: Date;
2239
+ createdAt: Timestamp;
2209
2240
  /** Any event that can be received from GitBook. */
2210
2241
  payload: Event;
2211
2242
  /** Status of the event. */
@@ -2214,7 +2245,7 @@ export interface IntegrationEvent {
2214
2245
  export interface IntegrationEventLog {
2215
2246
  /** The message of the log entry. */
2216
2247
  message?: string;
2217
- timestamp?: Date;
2248
+ timestamp?: Timestamp;
2218
2249
  /** The level of the log entry. */
2219
2250
  level?: 'debug' | 'info' | 'warn' | 'error';
2220
2251
  }
@@ -2284,8 +2315,8 @@ export interface IntegrationInstallation {
2284
2315
  spaces: number;
2285
2316
  /** Configuration of the integration at the account level */
2286
2317
  configuration: IntegrationInstallationConfiguration;
2287
- createdAt: Date;
2288
- updatedAt: Date;
2318
+ createdAt: Timestamp;
2319
+ updatedAt: Timestamp;
2289
2320
  /** URLs associated with the object */
2290
2321
  urls: {
2291
2322
  /**
@@ -2539,7 +2570,7 @@ export declare type EntityPropertySchema = {
2539
2570
  };
2540
2571
  });
2541
2572
  /** Any event that can be received from GitBook. */
2542
- export declare type Event = InstallationSetupEvent | SpaceInstallationSetupEvent | SpaceInstallationDeletedEvent | SpaceViewEvent | SpaceContentUpdatedEvent | SpaceGitSyncCompletedEvent | SpaceGitSyncStartedEvent | SpaceVisibilityUpdatedEvent | FetchEvent | FetchPublishedScriptEvent | UIRenderEvent;
2573
+ export declare type Event = InstallationSetupEvent | SpaceInstallationSetupEvent | SpaceInstallationDeletedEvent | SpaceViewEvent | SpaceContentUpdatedEvent | SpaceGitSyncCompletedEvent | SpaceGitSyncStartedEvent | SpaceVisibilityUpdatedEvent | FetchEvent | FetchPublishedScriptEvent | FetchVisitorAuthenticationEvent | UIRenderEvent;
2543
2574
  /** Common properties for all events. */
2544
2575
  export interface BaseEvent {
2545
2576
  /** Unique identifier for the event. */
@@ -2680,6 +2711,11 @@ export declare type FetchEvent = BaseEvent & {
2680
2711
  export declare type FetchPublishedScriptEvent = SpaceEvent & {
2681
2712
  type: 'fetch_published_script';
2682
2713
  };
2714
+ /** Common properties for all events related to visitor authentication from an installation */
2715
+ export declare type FetchVisitorAuthenticationEvent = SpaceEvent & {
2716
+ type: 'fetch_visitor_authentication';
2717
+ location?: string;
2718
+ };
2683
2719
  /** Event generated when rendering a UI */
2684
2720
  export declare type UIRenderEvent = (SpaceEvent | InstallationEvent) & {
2685
2721
  auth?: {
@@ -2741,8 +2777,8 @@ export interface BillingInvoicePreview {
2741
2777
  lines: {
2742
2778
  description: string;
2743
2779
  amount: number;
2744
- periodStart: Date;
2745
- periodEnd: Date;
2780
+ periodStart: Timestamp;
2781
+ periodEnd: Timestamp;
2746
2782
  }[];
2747
2783
  }
2748
2784
  export declare enum APIIntegrationScope {
@@ -2848,7 +2884,7 @@ export interface UserImpersonationInfo {
2848
2884
  }
2849
2885
  /** All the permissions of a user */
2850
2886
  export interface UserPermissions {
2851
- updatedAt: Date;
2887
+ updatedAt: Timestamp;
2852
2888
  searchKey: string;
2853
2889
  organizations: Record<string, {
2854
2890
  /** The role of a member in an organization, null for guests */
@@ -3441,8 +3477,8 @@ export interface CustomField {
3441
3477
  type: CustomFieldType;
3442
3478
  placeholder: CustomFieldPlaceholder;
3443
3479
  options?: CustomFieldOptions;
3444
- createdAt: Date;
3445
- updatedAt: Date;
3480
+ createdAt: Timestamp;
3481
+ updatedAt: Timestamp;
3446
3482
  /** URLs associated with the object */
3447
3483
  urls: {
3448
3484
  /**
@@ -3629,7 +3665,7 @@ export interface PageFeedback {
3629
3665
  object: 'page-feedback';
3630
3666
  visitorId: string;
3631
3667
  rating: PageFeedbackRating;
3632
- createdAt: Date;
3668
+ createdAt: Timestamp;
3633
3669
  /** ID of the revision when the rating was created */
3634
3670
  revision: string;
3635
3671
  /** URLs associated with the object */
@@ -3837,6 +3873,14 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
3837
3873
  * @secure
3838
3874
  */
3839
3875
  updateSpaceById: (spaceId: string, data: {
3876
+ /**
3877
+ * Determines how a Space can be edited.
3878
+ * * `live`: Users can directly edit the space
3879
+ * * `locked`: All edits are locked for this space.
3880
+ */
3881
+ editMode?: SpaceEditMode;
3882
+ /** Title of the space */
3883
+ title?: SpaceTitle;
3840
3884
  /**
3841
3885
  * * `public`: Anyone can access the content, and the content is indexed by search engines.
3842
3886
  * * `unlisted`: Anyone can access the content, and the content is not indexed by search engines
@@ -6386,6 +6430,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
6386
6430
  spaceId?: string;
6387
6431
  /** If specified, only locations under the given pageId will be returned. You must specify a spaceId too. If pageId is not specified, GitBook will suggest pages at the top level. */
6388
6432
  pageId?: string;
6433
+ /** If specified, only locations matching the search query will be returned. */
6434
+ search?: string;
6389
6435
  }, params?: RequestParams) => Promise<HttpResponse<List & {
6390
6436
  items: {
6391
6437
  /** If defined and true, this location was suggested by GitBook AI. */
package/dist/index.cjs CHANGED
@@ -63,6 +63,7 @@ __export(src_exports, {
63
63
  RevisionPageLayoutPreset: () => RevisionPageLayoutPreset,
64
64
  RevisionPageType: () => RevisionPageType,
65
65
  RevisionSemanticChangeType: () => RevisionSemanticChangeType,
66
+ SpaceEditMode: () => SpaceEditMode,
66
67
  TeamMemberRole: () => TeamMemberRole
67
68
  });
68
69
  module.exports = __toCommonJS(src_exports);
@@ -77,6 +78,11 @@ var ContentVisibility = /* @__PURE__ */ ((ContentVisibility2) => {
77
78
  ContentVisibility2["Private"] = "private";
78
79
  return ContentVisibility2;
79
80
  })(ContentVisibility || {});
81
+ var SpaceEditMode = /* @__PURE__ */ ((SpaceEditMode2) => {
82
+ SpaceEditMode2["Live"] = "live";
83
+ SpaceEditMode2["Locked"] = "locked";
84
+ return SpaceEditMode2;
85
+ })(SpaceEditMode || {});
80
86
  var RevisionPageLayoutOptionsCoverSize = /* @__PURE__ */ ((RevisionPageLayoutOptionsCoverSize2) => {
81
87
  RevisionPageLayoutOptionsCoverSize2["Hero"] = "hero";
82
88
  RevisionPageLayoutOptionsCoverSize2["Full"] = "full";
@@ -206,6 +212,7 @@ var IntegrationScope = /* @__PURE__ */ ((IntegrationScope2) => {
206
212
  IntegrationScope2["SpaceScriptInject"] = "space:script:inject";
207
213
  IntegrationScope2["SpaceScriptCookies"] = "space:script:cookies";
208
214
  IntegrationScope2["SpaceGitSync"] = "space:git:sync";
215
+ IntegrationScope2["SpaceVisitorAuth"] = "space:visitor:auth";
209
216
  return IntegrationScope2;
210
217
  })(IntegrationScope || {});
211
218
  var IntegrationInstallationSpaceSelection = /* @__PURE__ */ ((IntegrationInstallationSpaceSelection2) => {
@@ -2177,5 +2184,6 @@ var GitBookAPI = class extends Api {
2177
2184
  RevisionPageLayoutPreset,
2178
2185
  RevisionPageType,
2179
2186
  RevisionSemanticChangeType,
2187
+ SpaceEditMode,
2180
2188
  TeamMemberRole
2181
2189
  });
package/dist/index.js CHANGED
@@ -8,6 +8,11 @@ var ContentVisibility = /* @__PURE__ */ ((ContentVisibility2) => {
8
8
  ContentVisibility2["Private"] = "private";
9
9
  return ContentVisibility2;
10
10
  })(ContentVisibility || {});
11
+ var SpaceEditMode = /* @__PURE__ */ ((SpaceEditMode2) => {
12
+ SpaceEditMode2["Live"] = "live";
13
+ SpaceEditMode2["Locked"] = "locked";
14
+ return SpaceEditMode2;
15
+ })(SpaceEditMode || {});
11
16
  var RevisionPageLayoutOptionsCoverSize = /* @__PURE__ */ ((RevisionPageLayoutOptionsCoverSize2) => {
12
17
  RevisionPageLayoutOptionsCoverSize2["Hero"] = "hero";
13
18
  RevisionPageLayoutOptionsCoverSize2["Full"] = "full";
@@ -137,6 +142,7 @@ var IntegrationScope = /* @__PURE__ */ ((IntegrationScope2) => {
137
142
  IntegrationScope2["SpaceScriptInject"] = "space:script:inject";
138
143
  IntegrationScope2["SpaceScriptCookies"] = "space:script:cookies";
139
144
  IntegrationScope2["SpaceGitSync"] = "space:git:sync";
145
+ IntegrationScope2["SpaceVisitorAuth"] = "space:visitor:auth";
140
146
  return IntegrationScope2;
141
147
  })(IntegrationScope || {});
142
148
  var IntegrationInstallationSpaceSelection = /* @__PURE__ */ ((IntegrationInstallationSpaceSelection2) => {
@@ -2107,5 +2113,6 @@ export {
2107
2113
  RevisionPageLayoutPreset,
2108
2114
  RevisionPageType,
2109
2115
  RevisionSemanticChangeType,
2116
+ SpaceEditMode,
2110
2117
  TeamMemberRole
2111
2118
  };
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.25.0",
7
+ "version": "0.26.0",
8
8
  "sideEffects": false,
9
9
  "files": [
10
10
  "README.md",