@gitbook/api 0.207.0 → 0.209.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
@@ -313,6 +313,11 @@ export declare enum SiteInsightsLinkPosition {
313
313
  Sidebar = "sidebar",
314
314
  Content = "content"
315
315
  }
316
+ export declare enum PageFeedbackRating {
317
+ Bad = "bad",
318
+ Ok = "ok",
319
+ Good = "good"
320
+ }
316
321
  /** How a page's markdown was requested. `page-action` means a reader used the site's page-actions menu — its copy or view-as-markdown action — rather than a client fetching the URL directly. */
317
322
  export declare enum SiteInsightsMarkdownSource {
318
323
  PageAction = "page-action"
@@ -341,6 +346,8 @@ export declare enum SiteSettingsScanTopics {
341
346
  * - `suggest-fixes` drafts fixes for approval and applies none.
342
347
  * - `fix-clear-matches` applies the clearest fixes and drafts the less certain ones for approval.
343
348
  * - `fix-close-matches` applies the clear and the close fixes.
349
+ * At every level, GitBook drafts change requests that fix broken links to other sites, and never
350
+ * merges them.
344
351
  */
345
352
  export declare enum SiteSettingsBrokenLinksAutonomyLevel {
346
353
  SuggestFixes = "suggest-fixes",
@@ -373,6 +380,13 @@ export declare enum SiteQuestionAnswerHelpfulness {
373
380
  Medium = "medium",
374
381
  High = "high"
375
382
  }
383
+ /** Size of a timeline bucket. Weeks start on Sunday, and every bucket is in UTC. */
384
+ export declare enum SiteQuestionTimelineInterval {
385
+ Hour = "hour",
386
+ Day = "day",
387
+ Week = "week",
388
+ Month = "month"
389
+ }
376
390
  /** Whether the response answered the question. */
377
391
  export declare enum SiteQuestionAnswerResolution {
378
392
  No = "no",
@@ -454,8 +468,8 @@ export declare enum SiteQuestionType {
454
468
  }
455
469
  /**
456
470
  * An action that moves a finding to another state. A finding's `actions` lists the ones it allows.
457
- * - `approve` makes the redirect GitBook drafted for a broken link live, which resolves the finding.
458
- * - `reject` deletes the redirect GitBook drafted for a broken link; the finding stays open and GitBook won't draft a fix for it again.
471
+ * - `approve` makes the redirect GitBook drafted for a broken link live, which resolves the finding. A change request GitBook drafted for an outbound link is approved by merging it.
472
+ * - `reject` deletes the redirect GitBook drafted for a broken link; the finding stays open and GitBook won't draft a fix for it again. For an outbound link, it archives the change request GitBook drafted (`awaitingChangeRequest`) and unlinks every link it fixes. They are open again, marked `undone`, and GitBook won't draft a fix for them again.
459
473
  * - `create-redirect` creates a redirect for a broken link's path with `createSiteRedirect`, prefilled with the suggestion; it resolves the finding.
460
474
  * - `mark-resolved` resolves it. A broken link resolved this way has no redirect: visitors still get a 404.
461
475
  * - `reopen` reopens a resolved finding. For a broken link, it deletes the live redirect at its path; for a fix GitBook applied, this undoes the fix and GitBook won't fix the link again.
@@ -488,7 +502,7 @@ export declare enum SiteTriageFilterQuestions {
488
502
  /**
489
503
  * Where a link finding stands, from its status and what GitBook did with it.
490
504
  * - `open` needs a fix.
491
- * - `awaiting-approval` has a redirect GitBook drafted at its path, waiting to be approved or rejected.
505
+ * - `awaiting-approval` has a fix GitBook drafted, waiting to be approved or rejected: a redirect at a `broken-link` finding's path, or an unmerged change request for an `outbound-link-error` finding (`awaitingChangeRequest`).
492
506
  * - `resolved` was fixed or closed: `servingRedirect` says whether a live redirect serves its path.
493
507
  * - `ignored` was dismissed.
494
508
  */
@@ -1035,11 +1049,6 @@ export declare enum SiteType {
1035
1049
  Ultimate = "ultimate",
1036
1050
  Sponsored = "sponsored"
1037
1051
  }
1038
- export declare enum PageFeedbackRating {
1039
- Bad = "bad",
1040
- Ok = "ok",
1041
- Good = "good"
1042
- }
1043
1052
  /** Describe whether all sites have been selected or there's a selection involved */
1044
1053
  export declare enum IntegrationInstallationSiteSelection {
1045
1054
  All = "all",
@@ -1155,11 +1164,13 @@ export declare enum IntegrationTarget {
1155
1164
  * "billing": The organization's plan has reached its maximum number of members.
1156
1165
  * "scim": The member was deactivated by the organization's identity provider.
1157
1166
  * "admin": An organization admin disabled the member.
1167
+ * "gitbook": GitBook blocked the organization.
1158
1168
  */
1159
1169
  export declare enum MemberDisabledReason {
1160
1170
  Billing = "billing",
1161
1171
  Scim = "scim",
1162
- Admin = "admin"
1172
+ Admin = "admin",
1173
+ Gitbook = "gitbook"
1163
1174
  }
1164
1175
  /** The core layout presets for a page. */
1165
1176
  export declare enum RevisionPageLayoutPreset {
@@ -1250,6 +1261,7 @@ export declare enum DocumentTextColor {
1250
1261
  Violet = "violet",
1251
1262
  Cyan = "cyan",
1252
1263
  Primary = "$primary",
1264
+ Secondary = "$secondary",
1253
1265
  Info = "$info",
1254
1266
  Success = "$success",
1255
1267
  Warning = "$warning",
@@ -1408,6 +1420,8 @@ export type FeatureUpgradeRequirement = {
1408
1420
  */
1409
1421
  url: string;
1410
1422
  };
1423
+ /** Any event that can be received from GitBook. */
1424
+ export type Event = InstallationSetupEvent | InstallationDeletedEvent | SpaceInstallationSetupEvent | SpaceInstallationDeletedEvent | SiteInstallationSetupEvent | SiteInstallationDeletedEvent | SiteViewEvent | SpaceContentUpdatedEvent | SpaceGitSyncCompletedEvent | SpaceGitSyncStartedEvent | SpaceVisibilityUpdatedEvent | TaskEvent | FetchEvent | FetchPublishedScriptEvent | FetchVisitorAuthenticationEvent | UIRenderEvent | ContentComputeDocumentEvent | ContentComputeRevisionEvent | PageFeedbackEvent;
1411
1425
  /** An absolute reference to content in GitBook. */
1412
1426
  export type ContentLocation = ContentLocationFile | ContentLocationURL | ContentLocationPage | ContentLocationUser | ContentLocationCollection | ContentLocationSpace | ContentLocationReusableContent | ContentLocationOpenAPI;
1413
1427
  export type PublishedContentRedirect = {
@@ -1447,8 +1461,6 @@ export type ContentKitRootElement = ContentKitBlock | ContentKitModal | ContentK
1447
1461
  export type ContentKitInlineElement = ContentKitText | ContentKitImage | ContentKitLink;
1448
1462
  /** Any element that can be used as children. */
1449
1463
  export type ContentKitDescendantElement = ContentKitButton | ContentKitTextInput | ContentKitHStack | ContentKitVStack | ContentKitBox | ContentKitDivider | ContentKitWebFrame | ContentKitCodeBlock | ContentKitMarkdown | ContentKitCard | ContentKitImage | ContentKitInput | ContentKitSelect | ContentKitSwitch | ContentKitCheckbox | ContentKitRadio | ContentKitText | ContentKitHint | ContentKitLink | ContentKitStepperStep;
1450
- /** Any event that can be received from GitBook. */
1451
- export type Event = InstallationSetupEvent | InstallationDeletedEvent | SpaceInstallationSetupEvent | SpaceInstallationDeletedEvent | SiteInstallationSetupEvent | SiteInstallationDeletedEvent | SiteViewEvent | SpaceContentUpdatedEvent | SpaceGitSyncCompletedEvent | SpaceGitSyncStartedEvent | SpaceVisibilityUpdatedEvent | TaskEvent | FetchEvent | FetchPublishedScriptEvent | FetchVisitorAuthenticationEvent | UIRenderEvent | ContentComputeDocumentEvent | ContentComputeRevisionEvent | PageFeedbackEvent;
1452
1464
  /** An outcome of a content change. */
1453
1465
  export type ChangeRequestContentUpdateChange = ({
1454
1466
  object: "created_page";
@@ -1475,7 +1487,19 @@ export type ChangeRequestContentChange = ({
1475
1487
  operation: "update_reusable_content";
1476
1488
  } & ChangeRequestContentChangeUpdateReusableContent) | ({
1477
1489
  operation: "delete_reusable_content";
1478
- } & ChangeRequestContentChangeDeleteReusableContent);
1490
+ } & ChangeRequestContentChangeDeleteReusableContent) | ({
1491
+ operation: "insert_variables";
1492
+ } & ChangeRequestContentChangeInsertVariables) | ({
1493
+ operation: "update_variable";
1494
+ } & ChangeRequestContentChangeUpdateVariable) | ({
1495
+ operation: "delete_variable";
1496
+ } & ChangeRequestContentChangeDeleteVariable) | ({
1497
+ operation: "insert_tags";
1498
+ } & ChangeRequestContentChangeInsertTags) | ({
1499
+ operation: "update_tag";
1500
+ } & ChangeRequestContentChangeUpdateTag) | ({
1501
+ operation: "delete_tag";
1502
+ } & ChangeRequestContentChangeDeleteTag);
1479
1503
  export type Revision = RevisionTypeEdits | RevisionTypeMerge | RevisionTypeRollback | RevisionTypeUpdate | RevisionTypeComputed;
1480
1504
  export type RevisionPage = RevisionPageDocument | RevisionPageGroup | RevisionPageLink | RevisionPageComputed;
1481
1505
  export interface ApiInformation {
@@ -1543,6 +1567,10 @@ export interface UserAPIToken {
1543
1567
  label: APITokenLabel;
1544
1568
  /** The API token creation date. */
1545
1569
  createdAt: Timestamp;
1570
+ /** Whether the API token can no longer be used to authenticate, because it was revoked or has expired. */
1571
+ revoked: boolean;
1572
+ /** When the API token stops authenticating. Absent for a token that never expires. */
1573
+ expiresAt?: Timestamp;
1546
1574
  }
1547
1575
  /** The API token details, including the token itself. */
1548
1576
  export type UserAPITokenExtended = UserAPIToken & {
@@ -3874,6 +3902,8 @@ export interface RevisionPageUpdate {
3874
3902
  noRobotsIndex?: boolean;
3875
3903
  /** Adaptive-content condition controlling whether the page is shown to a visitor. Set to an empty string to remove the condition. */
3876
3904
  condition?: string;
3905
+ /** Page variables, referenced in the page's content as `page.vars.<name>`. They are separate from space variables (`space.vars.<name>`). The object replaces all of the page's variables: set it to `{}` to remove them, or omit it to leave them unchanged. In a markdown document, the `vars` frontmatter sets them too. Names follow the same rules as space variables. Document pages only. */
3906
+ variables?: Variables;
3877
3907
  }
3878
3908
  /**
3879
3909
  * Update an existing page. Its document and/or its metadata (title, icon, description, visibility, adaptive-content condition) can be changed, and it can be moved to a new parent and/or position with `into`/`at`.
@@ -3934,7 +3964,10 @@ export interface ChangeRequestContentChangeRevertPage {
3934
3964
  operation: "revert_page";
3935
3965
  /** ID of the page to revert. */
3936
3966
  page: string;
3937
- /** ID of the revision to revert the page to. If omitted, the change request's base revision is used. */
3967
+ /**
3968
+ * ID of the revision to revert the page to. If omitted, the change request's base revision is used.
3969
+ * @pattern ^[a-zA-Z0-9_-]+$
3970
+ */
3938
3971
  revision?: string;
3939
3972
  /** Keys of the specific blocks to revert within the page's document, as they appear in the page's document. If omitted, the whole page is reverted. */
3940
3973
  block?: string[];
@@ -4042,6 +4075,108 @@ export interface ChangeRequestContentChangeDeleteReusableContent {
4042
4075
  /** ID of the reusable content to delete. */
4043
4076
  reusableContent: string;
4044
4077
  }
4078
+ /**
4079
+ * Name of a variable, referenced in content as `space.vars.<name>`. It starts with a letter, `_` or `$` and contains only letters, digits, `_` and `$`.
4080
+ * @minLength 1
4081
+ * @maxLength 64
4082
+ * @pattern ^[a-zA-Z_$][a-zA-Z0-9_$]*$
4083
+ */
4084
+ export type VariableName = string;
4085
+ /**
4086
+ * Create space variables in the change request (Git Sync's `.gitbook/vars.yaml`), or with `page`, variables of that page. Content references one as an expression, `<code class="expression">space.vars.<name></code>` (or `page.vars.<name>` on that page) in markdown, which renders the variable's value. To replace all of a page's variables at once, set the page's `variables` or its `vars` frontmatter instead.
4087
+ * @example {"operation":"insert_variables","variables":[{"name":"version","value":"2.0"}]}
4088
+ */
4089
+ export interface ChangeRequestContentChangeInsertVariables {
4090
+ operation: "insert_variables";
4091
+ /** ID of a document page to add the variables to, as its own variables (`page.vars.<name>`). Omit to add space variables. */
4092
+ page?: string;
4093
+ /**
4094
+ * @maxItems 50
4095
+ * @minItems 1
4096
+ */
4097
+ variables: {
4098
+ /** Name of a variable, referenced in content as `space.vars.<name>`. It starts with a letter, `_` or `$` and contains only letters, digits, `_` and `$`. */
4099
+ name: VariableName;
4100
+ /** Value of the variable. */
4101
+ value: VariableValue;
4102
+ }[];
4103
+ }
4104
+ /**
4105
+ * Change the value of an existing space variable, or with `page`, of one of that page's own variables without resending the others. Every expression referencing it shows the new value.
4106
+ * @example {"operation":"update_variable","variable":"version","value":"2.1"}
4107
+ */
4108
+ export interface ChangeRequestContentChangeUpdateVariable {
4109
+ operation: "update_variable";
4110
+ /** ID of a document page whose own variable (`page.vars.<name>`) to update. Omit to update a space variable. */
4111
+ page?: string;
4112
+ /** Name of the variable to update. */
4113
+ variable: VariableName;
4114
+ /** New value of the variable. */
4115
+ value: VariableValue;
4116
+ }
4117
+ /**
4118
+ * Delete an existing space variable from the change request, or with `page`, one of that page's own variables. Expressions referencing it are kept in pages, as in the editor.
4119
+ * @example {"operation":"delete_variable","variable":"version"}
4120
+ */
4121
+ export interface ChangeRequestContentChangeDeleteVariable {
4122
+ operation: "delete_variable";
4123
+ /** ID of a document page whose own variable (`page.vars.<name>`) to delete. Omit to delete a space variable. */
4124
+ page?: string;
4125
+ /** Name of the variable to delete. */
4126
+ variable: VariableName;
4127
+ }
4128
+ /**
4129
+ * Display label of a tag.
4130
+ * @minLength 1
4131
+ * @maxLength 50
4132
+ */
4133
+ export type RevisionTagLabel = string;
4134
+ /** Create flat tags in array order. The batch is rejected atomically if any tag is invalid. */
4135
+ export interface ChangeRequestContentChangeInsertTags {
4136
+ operation: "insert_tags";
4137
+ /**
4138
+ * @maxItems 50
4139
+ * @minItems 1
4140
+ */
4141
+ tags: {
4142
+ /**
4143
+ * Stable tag identifier; generated from the label when omitted.
4144
+ * @minLength 1
4145
+ */
4146
+ slug?: string;
4147
+ /** Display label of a tag. */
4148
+ label: RevisionTagLabel;
4149
+ /** Allowed color tokens for color marks (text and background; background reuses this enum). Named colors are fixed palette keys. `$*` tokens are semantic: resolved from the published sites customization when rendering; authors may still persist them in content when valid. */
4150
+ color?: DocumentTextColor;
4151
+ /** Name of the icon */
4152
+ icon?: Icon;
4153
+ /** Unicode codepoint or character of the emoji */
4154
+ emoji?: Emoji;
4155
+ }[];
4156
+ }
4157
+ /** Rename or restyle an existing tag. The slug is immutable. */
4158
+ export interface ChangeRequestContentChangeUpdateTag {
4159
+ operation: "update_tag";
4160
+ /**
4161
+ * Slug of the tag to update.
4162
+ * @minLength 1
4163
+ */
4164
+ tag: string;
4165
+ /** Display label of a tag. */
4166
+ label?: RevisionTagLabel;
4167
+ /** Allowed color tokens for color marks (text and background; background reuses this enum). Named colors are fixed palette keys. `$*` tokens are semantic: resolved from the published sites customization when rendering; authors may still persist them in content when valid. */
4168
+ color?: DocumentTextColor;
4169
+ /** Icon to set. Null removes the icon; omission preserves it. */
4170
+ icon?: Icon | null;
4171
+ /** Emoji to set. Null removes the emoji; omission preserves it. */
4172
+ emoji?: Emoji | null;
4173
+ }
4174
+ /** Delete an existing tag definition. Page and block references remain in content but stop resolving. */
4175
+ export interface ChangeRequestContentChangeDeleteTag {
4176
+ operation: "delete_tag";
4177
+ /** @minLength 1 */
4178
+ tag: string;
4179
+ }
4045
4180
  export interface ChangeRequestContentUpdatePageRef {
4046
4181
  /** Type of Object, always equals to "page". */
4047
4182
  object: "page";
@@ -4238,46 +4373,13 @@ export interface RevisionSemanticChangeTagDeleted {
4238
4373
  }
4239
4374
  export interface RevisionTagChangeAttributes {
4240
4375
  label?: ChangeAttributeString;
4241
- group?: ChangeAttributeString;
4242
- parent?: ChangeAttributeString;
4243
4376
  }
4244
4377
  export interface RevisionSemanticChangeTagEdited {
4245
4378
  type: "tag_edited";
4246
4379
  tag: ChangedRevisionTag;
4247
4380
  attributes: RevisionTagChangeAttributes;
4248
4381
  }
4249
- /** A space-scoped group of tags in this revision. Groups may contain other groups. */
4250
- export interface RevisionTagGroup {
4251
- /** Immutable group identifier, unique within the revision. */
4252
- slug: string;
4253
- /** Display name of the group. */
4254
- label: string;
4255
- /** Parent group slug. Omitted for root groups. */
4256
- parent?: string;
4257
- /** Lexicographic sibling sort key. Break ties using the slug. */
4258
- orderIndex: string;
4259
- }
4260
- export interface RevisionSemanticChangeTagGroupCreated {
4261
- type: "tag_group_created";
4262
- /** A space-scoped group of tags in this revision. Groups may contain other groups. */
4263
- tagGroup: RevisionTagGroup;
4264
- }
4265
- export interface RevisionSemanticChangeTagGroupEdited {
4266
- type: "tag_group_edited";
4267
- /** A space-scoped group of tags in this revision. Groups may contain other groups. */
4268
- tagGroup: RevisionTagGroup;
4269
- attributes: {
4270
- label?: ChangeAttributeString;
4271
- parent?: ChangeAttributeString;
4272
- orderIndex?: ChangeAttributeString;
4273
- };
4274
- }
4275
- export interface RevisionSemanticChangeTagGroupDeleted {
4276
- type: "tag_group_deleted";
4277
- /** A space-scoped group of tags in this revision. Groups may contain other groups. */
4278
- tagGroup: RevisionTagGroup;
4279
- }
4280
- export type RevisionSemanticChange = RevisionSemanticChangePageCreated | RevisionSemanticChangePageEdited | RevisionSemanticChangePageDeleted | RevisionSemanticChangePageMoved | RevisionSemanticChangeFileCreated | RevisionSemanticChangeFileEdited | RevisionSemanticChangeFileDeleted | RevisionSemanticChangeVariablesEdited | RevisionSemanticChangeReusableContentCreated | RevisionSemanticChangeReusableContentDeleted | RevisionSemanticChangeReusableContentEdited | RevisionSemanticChangeTagCreated | RevisionSemanticChangeTagDeleted | RevisionSemanticChangeTagEdited | RevisionSemanticChangeTagGroupCreated | RevisionSemanticChangeTagGroupEdited | RevisionSemanticChangeTagGroupDeleted;
4382
+ export type RevisionSemanticChange = RevisionSemanticChangePageCreated | RevisionSemanticChangePageEdited | RevisionSemanticChangePageDeleted | RevisionSemanticChangePageMoved | RevisionSemanticChangeFileCreated | RevisionSemanticChangeFileEdited | RevisionSemanticChangeFileDeleted | RevisionSemanticChangeVariablesEdited | RevisionSemanticChangeReusableContentCreated | RevisionSemanticChangeReusableContentDeleted | RevisionSemanticChangeReusableContentEdited | RevisionSemanticChangeTagCreated | RevisionSemanticChangeTagDeleted | RevisionSemanticChangeTagEdited;
4281
4383
  export interface RevisionSemanticChanges {
4282
4384
  /** The change request object that initiated the changes in the case of a merge revision. */
4283
4385
  mergedFrom?: ChangeRequest;
@@ -4567,6 +4669,7 @@ export type OrganizationSupportCost = {
4567
4669
  * @maxLength 255
4568
4670
  */
4569
4671
  export type BlockReason = string;
4672
+ /** Non-members of the organization only receive `object`, `id`, `title`, `sso`, `inviteLinks`, `urls`, `blocked` and `permissions`. */
4570
4673
  export interface Organization {
4571
4674
  /** Type of Object, always equals to "organization" */
4572
4675
  object: "organization";
@@ -4574,11 +4677,11 @@ export interface Organization {
4574
4677
  id: string;
4575
4678
  /** Name of the organization */
4576
4679
  title: OrganizationTitle;
4577
- createdAt: Timestamp;
4578
- emailDomains: OrganizationEmailDomains;
4680
+ createdAt?: Timestamp;
4681
+ emailDomains?: OrganizationEmailDomains;
4579
4682
  /** Default hostname for the organization's public content, e.g. <org-hostname>.gitbook.io */
4580
4683
  hostname?: OrganizationHostname;
4581
- type: OrganizationType;
4684
+ type?: OrganizationType;
4582
4685
  useCase?: OrganizationUseCase;
4583
4686
  communityType?: OrganizationCommunityType;
4584
4687
  /** The role of a member in an organization, null for guests */
@@ -4600,10 +4703,10 @@ export interface Organization {
4600
4703
  /** Whether audit logs can currently be accessed for this organization. */
4601
4704
  auditLogs?: boolean;
4602
4705
  /** Name of the product */
4603
- plan: BillingProduct;
4706
+ plan?: BillingProduct;
4604
4707
  /** Billing details, only available for org members. */
4605
4708
  billing?: OrganizationBilling;
4606
- mergeRules: MergeRulesStandaloneConfiguration;
4709
+ mergeRules?: MergeRulesStandaloneConfiguration;
4607
4710
  /** Support cost set by the organization, only available for org members. */
4608
4711
  supportCost?: OrganizationSupportCost;
4609
4712
  /** URLs associated with the object */
@@ -4621,7 +4724,7 @@ export interface Organization {
4621
4724
  /** URL of the logo of this organization, if defined. */
4622
4725
  logo?: URL;
4623
4726
  };
4624
- trial: {
4727
+ trial?: {
4625
4728
  /** - notapplicable, no trial can be started for this organization. - none, no trial has been started yet. - active, trial is active. - ended, the trial has ended and the user has choosen to stay on the free plan or has upgraded to a paid plan. - expired, the trial has ended but the user hasn't deciced yet what to do. */
4626
4729
  status: BillingTrialStatus;
4627
4730
  /** Number of trials the organization has consumed. */
@@ -4737,6 +4840,7 @@ export interface Integration {
4737
4840
  configurations?: IntegrationConfigurations;
4738
4841
  /** External urls configured by the developer of the integration */
4739
4842
  externalLinks: IntegrationExternalLinks;
4843
+ /** Non-members of the organization only receive `object`, `id`, `title`, `sso`, `inviteLinks`, `urls`, `blocked` and `permissions`. */
4740
4844
  owner: Organization;
4741
4845
  /** URLs associated with the object */
4742
4846
  urls: {
@@ -4883,7 +4987,7 @@ export interface PublishIntegration {
4883
4987
  */
4884
4988
  contentSecurityPolicy?: IntegrationContentSecurityPolicy;
4885
4989
  }
4886
- /** Configuration of the integration at the account level */
4990
+ /** Configuration of the integration. For user authentication, oauth_credentials is returned as a boolean indicating whether a connection is configured. When replacing the configuration, send true to preserve the existing connection, or omit the field to clear it. Only the integration or the matching installation can read or set the OAuth credentials. */
4887
4991
  export type IntegrationInstallationConfiguration = Record<string, any>;
4888
4992
  /**
4889
4993
  * External IDs assigned by the integration.
@@ -4909,7 +5013,7 @@ export interface IntegrationInstallation {
4909
5013
  site_selection: IntegrationInstallationSiteSelection;
4910
5014
  /** Count of spaces, the installation is managing */
4911
5015
  spaces: number;
4912
- /** Configuration of the integration at the account level */
5016
+ /** Configuration of the integration. For user authentication, oauth_credentials is returned as a boolean indicating whether a connection is configured. When replacing the configuration, send true to preserve the existing connection, or omit the field to clear it. Only the integration or the matching installation can read or set the OAuth credentials. */
4913
5017
  configuration: IntegrationInstallationConfiguration;
4914
5018
  createdAt: Timestamp;
4915
5019
  updatedAt: Timestamp;
@@ -4943,374 +5047,95 @@ export interface IntegrationInstallation {
4943
5047
  /** Network configuration for the installation */
4944
5048
  network?: IntegrationNetwork;
4945
5049
  }
4946
- /** Common properties for all events. */
4947
- export interface BaseEvent {
4948
- /** Unique identifier for the event. */
5050
+ /** Safe diagnostic metadata for an integration event. This is not the event delivered to the integration. Configuration snapshots, request bodies and headers, URLs, visitor data, task and UI payloads, provider responses and arbitrary custom fields are omitted. */
5051
+ export interface IntegrationEventDiagnosticPayload {
5052
+ /** Event type, or unknown for an unrecognized or malformed historical payload. */
5053
+ type: "installation_setup" | "installation_deleted" | "space_installation_setup" | "space_installation_deleted" | "site_installation_setup" | "site_installation_deleted" | "site_view" | "space_content_updated" | "space_gitsync_completed" | "space_gitsync_started" | "space_visibility_updated" | "task" | "fetch" | "fetch_published_script" | "fetch_visitor_authentication" | "ui_render" | "content_compute_document" | "content_compute_revision" | "page_feedback" | "unknown";
4949
5054
  eventId: string;
4950
- /** Type of the event. */
4951
- type: string;
5055
+ installationId?: string;
5056
+ siteId?: string;
5057
+ spaceId?: string;
5058
+ pageId?: string;
5059
+ revisionId?: string;
4952
5060
  }
4953
- /** Common properties for all events related to an installation */
4954
- export type InstallationEvent = BaseEvent & {
5061
+ /** Diagnostic metadata for a delivered event, including historical records. The payload is intentionally limited to event type and identifiers; it is not the full runtime event. Events and configuration delivered to the integration runtime are unaffected. */
5062
+ export interface IntegrationEvent {
5063
+ /** Unique ID of the event. */
5064
+ id: string;
5065
+ /** Unique ID of the integration. */
5066
+ integrationId: string;
5067
+ /** Unique ID of the integration installation. */
5068
+ installationId?: string;
5069
+ createdAt: Timestamp;
5070
+ /** Safe diagnostic metadata for an integration event. This is not the event delivered to the integration. Configuration snapshots, request bodies and headers, URLs, visitor data, task and UI payloads, provider responses and arbitrary custom fields are omitted. */
5071
+ payload: IntegrationEventDiagnosticPayload;
5072
+ /** Correlation ID of the integration execution. */
5073
+ rayId?: string;
5074
+ /**
5075
+ * HTTP status of the integration execution, when available.
5076
+ * @min 100
5077
+ * @max 599
5078
+ */
5079
+ statusCode?: number;
5080
+ /** Stable failure category. Raw error messages are never returned. */
5081
+ errorCategory?: "http_error" | "execution_error";
5082
+ /** Status of the event. */
5083
+ status: "success" | "failed";
5084
+ }
5085
+ export interface IntegrationEventLog {
5086
+ /** The message of the log entry. */
5087
+ message?: string;
5088
+ timestamp?: Timestamp;
5089
+ /** The level of the log entry. */
5090
+ level?: "debug" | "info" | "warn" | "error";
5091
+ }
5092
+ /** Safe execution metadata. Worker log and exception text are suppressed. */
5093
+ export interface IntegrationEventTrace {
5094
+ /** Always empty until a safe diagnostic log format is available. */
5095
+ logs: IntegrationEventLog[];
5096
+ /** Correlation ID of the integration execution. */
5097
+ rayId?: string;
5098
+ createdAt?: Timestamp;
5099
+ outcome?: "ok" | "exception" | "exceededCpu" | "exceededMemory" | "canceled" | "unknown";
5100
+ /**
5101
+ * @min 100
5102
+ * @max 599
5103
+ */
5104
+ statusCode?: number;
5105
+ }
5106
+ /** Base properties of an installation of an integration on a site or space. */
5107
+ export interface IntegrationContentInstallationBase {
5108
+ /** Unique name identifier of the integration */
5109
+ integration: string;
4955
5110
  /** ID of the integration installation */
4956
- installationId: string;
4957
- };
4958
- /** Event received when integration has been installed or updated. */
4959
- export type InstallationSetupEvent = InstallationEvent & {
4960
- type: "installation_setup";
4961
- status: IntegrationInstallationStatus;
4962
- /** The state of the installation at the account level before it was updated. */
4963
- previous?: {
4964
- status: IntegrationInstallationStatus;
4965
- /** The previous configuration of the installation at the account level. */
4966
- configuration?: object;
4967
- };
4968
- };
4969
- /** Event received when integration has been uninstalled from an organization. */
4970
- export type InstallationDeletedEvent = InstallationEvent & {
4971
- type: "installation_deleted";
4972
- /** The state of the installation before it was deleted. */
4973
- previous: {
4974
- /** The previous configuration of the installation. */
4975
- configuration?: object;
4976
- };
4977
- };
4978
- /** Common properties for all events related to a specific space. */
4979
- export type SpaceEvent = InstallationEvent & {
4980
- /** ID of the space */
4981
- spaceId: string;
4982
- };
4983
- /** Event received when integration has been installed or updated on a space. */
4984
- export type SpaceInstallationSetupEvent = SpaceEvent & {
4985
- type: "space_installation_setup";
4986
- status: IntegrationInstallationStatus;
4987
- /** The state of the Space installation before it was updated. */
4988
- previous?: {
4989
- status: IntegrationInstallationStatus;
4990
- /** The previous configuration of the Space installation. */
4991
- configuration?: object;
4992
- };
4993
- };
4994
- /** Event received when integration has been uninstalled from a space. */
4995
- export type SpaceInstallationDeletedEvent = SpaceEvent & {
4996
- type: "space_installation_deleted";
4997
- /** The state of the Space installation before it was deleted. */
4998
- previous: {
4999
- /** The previous configuration of the Space installation. */
5000
- configuration?: object;
5001
- };
5002
- };
5003
- /** Common properties for all events related to a specific site. */
5004
- export type SiteEvent = InstallationEvent & {
5005
- /** ID of the site */
5006
- siteId: string;
5007
- };
5008
- /** Event received when integration has been installed or updated on a site. */
5009
- export type SiteInstallationSetupEvent = SiteEvent & {
5010
- type: "site_installation_setup";
5111
+ installation: string;
5011
5112
  status: IntegrationInstallationStatus;
5012
- /** The state of the site installation before it was updated. */
5013
- previous?: {
5014
- status: IntegrationInstallationStatus;
5015
- /** The previous configuration of the site installation. */
5016
- configuration?: object;
5017
- };
5018
- };
5019
- /** Event received when integration has been uninstalled from a site. */
5020
- export type SiteInstallationDeletedEvent = SiteEvent & {
5021
- type: "site_installation_deleted";
5022
- /** The state of the site installation before it was deleted. */
5023
- previous: {
5024
- /** The previous configuration of the site installation. */
5025
- configuration?: object;
5113
+ /** Configuration for this site or space. For user authentication, oauth_credentials is returned as a boolean connection indicator. Send true when saving to preserve the connection, or omit the field to clear it. Only the integration or the matching installation can read or set OAuth credentials. */
5114
+ configuration: object;
5115
+ /** External IDs assigned by the integration. */
5116
+ externalIds: IntegrationInstallationExternalIds;
5117
+ /** URLs associated with the object */
5118
+ urls: {
5119
+ /**
5120
+ * URL of the integration's installation in the API
5121
+ * @format uri
5122
+ */
5123
+ location: string;
5124
+ /**
5125
+ * Public HTTP endpoint for the integration's installation
5126
+ * @format uri
5127
+ */
5128
+ publicEndpoint: string;
5129
+ /**
5130
+ * Public endpoint serving the integration's rendered content (e.g. WebFrames), isolated from the cookie-bearing publicEndpoint origin. Equals publicEndpoint when no separate content origin is configured.
5131
+ * @format uri
5132
+ */
5133
+ publicContentEndpoint: string;
5026
5134
  };
5027
- };
5028
- /** Analytics info on the GitBook's content visitor. */
5029
- export interface EventVisitor {
5030
- /** GitBook's unique identifier of the visitor. */
5031
- anonymousId: string;
5032
- /** The visitors cookies. */
5033
- cookies: Record<string, string>;
5034
- /** User-agent of the visitor. */
5035
- userAgent: string;
5036
- /** IP address of the visitor. */
5037
- ip: string;
5038
- /** Language of the visitor. */
5039
- language?: string;
5040
5135
  }
5041
- /** Event received when a page has been visited on a site. */
5042
- export type SiteViewEvent = SiteEvent & {
5043
- type: "site_view";
5044
- /**
5045
- * Unique identifier of the visited space in the site.
5046
- * @deprecated
5047
- */
5048
- spaceId?: string;
5049
- /** The site-space that was viewed */
5050
- siteSpaceId?: string;
5051
- /** Unique identifier of the visited page. */
5052
- pageId?: string;
5053
- /** Analytics info on the GitBook's content visitor. */
5054
- visitor: EventVisitor;
5055
- /** The GitBook content's URL visited (including URL params). */
5056
- url: string;
5057
- /** The URL of referrer that linked to the page. */
5058
- referrer: string;
5059
- };
5060
- /** Event when the primary content of a space has been updated. */
5061
- export type SpaceContentUpdatedEvent = SpaceEvent & {
5062
- type: "space_content_updated";
5063
- /** Unique identifier of the new content revision */
5064
- revisionId: string;
5065
- /** Users who updated the content */
5066
- updatedBy: User[];
5067
- };
5068
- /** Event when a GitSync operation has been completed. */
5069
- export type SpaceGitSyncCompletedEvent = SpaceEvent & {
5070
- type: "space_gitsync_completed";
5071
- state: "success" | "failure";
5072
- /** Unique identifier of the new content revision */
5073
- revisionId: string;
5074
- /** Unique identifier for the commit (sha) */
5075
- commitId: string;
5076
- };
5077
- /** Event when a GitSync operation has been started. */
5078
- export type SpaceGitSyncStartedEvent = SpaceEvent & {
5079
- type: "space_gitsync_started";
5080
- /** Unique identifier of the new content revision */
5081
- revisionId: string;
5082
- /** Unique identifier for the commit (sha) */
5083
- commitId: string;
5084
- };
5085
- /** Event when the visibility of the space has been changed. */
5086
- export type SpaceVisibilityUpdatedEvent = SpaceEvent & {
5087
- type: "space_visibility_updated";
5088
- /**
5089
- * * `public`: Anyone can access the content, and the content is indexed by search engines.
5090
- * * `unlisted`: Anyone can access the content, and the content is not indexed by search engines
5091
- * * `share-link`: Anyone with a secret token in the url can access the content.
5092
- * * `visitor-auth`: Anyone authenticated through a JWT token can access the content.
5093
- * * `in-collection`: Anyone who can access the parent collection can access the content.
5094
- * Only available for spaces in a collection.
5095
- * * `private`: Authorized members can access the content.
5096
- */
5097
- previousVisibility: ContentVisibility;
5098
- /**
5099
- * * `public`: Anyone can access the content, and the content is indexed by search engines.
5100
- * * `unlisted`: Anyone can access the content, and the content is not indexed by search engines
5101
- * * `share-link`: Anyone with a secret token in the url can access the content.
5102
- * * `visitor-auth`: Anyone authenticated through a JWT token can access the content.
5103
- * * `in-collection`: Anyone who can access the parent collection can access the content.
5104
- * Only available for spaces in a collection.
5105
- * * `private`: Authorized members can access the content.
5106
- */
5107
- visibility: ContentVisibility;
5108
- };
5109
- /** Event representing a background task trigger for an integration. */
5110
- export type TaskEvent = BaseEvent & {
5111
- type: "task";
5112
- /** Payload associated with the integration task. */
5113
- task: object;
5114
- };
5115
- export interface FetchRequest {
5116
- method: "post" | "get" | "put" | "delete";
5117
- url: string;
5118
- headers: Record<string, string>;
5119
- }
5120
- /** Event representing an incoming HTTP request. */
5121
- export type FetchEvent = BaseEvent & {
5122
- /** The space ID, if requests are specific to a single space */
5123
- spaceId?: string;
5124
- /** The site ID, if requests are specific to a single site */
5125
- siteId?: string;
5126
- /** The installation ID, if requests are specific to a single installation */
5127
- installationId?: string;
5128
- auth?: {
5129
- /** The user's ID. */
5130
- userId: string;
5131
- };
5132
- type: "fetch";
5133
- request: FetchRequest;
5134
- };
5135
- /** Common properties for all events related to fetching a published script from an installation */
5136
- export type FetchPublishedScriptEvent = SiteEvent & {
5137
- type: "fetch_published_script";
5138
- };
5139
- /** Common properties for all events related to authenticated access from an installation */
5140
- export type FetchVisitorAuthenticationEvent = SiteEvent & {
5141
- type: "fetch_visitor_authentication";
5142
- location?: string;
5143
- /** Whitelisted search parameters from the visitor authentication request. */
5144
- searchParams?: Record<string, string>;
5145
- /** Whitelisted cookies from the visitor authentication request. */
5146
- cookies?: Record<string, string>;
5147
- /** The visitor authentication action to resolve. If omitted, integrations resolve to the existing login redirect. */
5148
- action?: "logout";
5149
- };
5150
- /** Common properties for ContentKit context. */
5151
- export interface ContentKitContextBase {
5152
- theme: "dark" | "light";
5153
- }
5154
- /** Context while rendering in an account installation's configuration. */
5155
- export type ContentKitContextConfigurationAccount = ContentKitContextBase & {
5156
- type: "configuration_account";
5157
- /** ID of the organization the account installation configuration is in. */
5158
- organizationId: string;
5159
- };
5160
- /** Context while rendering in a space-installation's configuration. */
5161
- export type ContentKitContextConfigurationSpace = ContentKitContextBase & {
5162
- type: "configuration_space";
5163
- /** ID of the space the space-installation configuration is in. */
5164
- spaceId: string;
5165
- };
5166
- /** Context while rendering in a site-installation's configuration. */
5167
- export type ContentKitContextConfigurationSite = ContentKitContextBase & {
5168
- type: "configuration_site";
5169
- /** ID of the site the site-installation configuration is in. */
5170
- siteId: string;
5171
- };
5172
- /** Context while rendering the configuration flow of a content source. */
5173
- export type ContentKitContextConfigurationContentSource = ContentKitContextBase & {
5174
- type: "configuration_contentsource";
5175
- /** ID of the organization the content source installation configuration is in. */
5176
- organizationId: string;
5177
- /** Optional ID of the space the content source installation configuration is in. */
5178
- spaceId?: string;
5179
- };
5180
- /** Context while rendering in a document. */
5181
- export type ContentKitContextDocument = ContentKitContextBase & {
5182
- type: "document";
5183
- /** ID of the space content the document is in. */
5184
- spaceId: string;
5185
- editable: boolean;
5186
- };
5187
- /** Object representing the context in which a ContentKit component is rendered. */
5188
- export type ContentKitContext = ContentKitContextConfigurationAccount | ContentKitContextConfigurationSpace | ContentKitContextConfigurationSite | ContentKitContextConfigurationContentSource | ContentKitContextDocument;
5189
- /** Event generated when rendering a UI */
5190
- export type UIRenderEvent = (SpaceEvent | SiteEvent | InstallationEvent) & {
5191
- auth?: {
5192
- /** The user's ID. */
5193
- userId: string;
5194
- };
5195
- type: "ui_render";
5196
- componentId: string;
5197
- /** Properties to render the UI. */
5198
- props: object;
5199
- /** State of the UI. */
5200
- state?: object;
5201
- /** Object representing the context in which a ContentKit component is rendered. */
5202
- context: ContentKitContext;
5203
- action?: object;
5204
- };
5205
- /** Generic event when computing the content of a space */
5206
- export type ContentComputeEvent = SpaceEvent & {
5207
- sourceId: string;
5208
- /** Properties passed to the rendering. */
5209
- props: PlainObject;
5210
- /** Dependencies of the computation. */
5211
- dependencies: Record<string, ComputedContentDependencyResolved>;
5212
- };
5213
- /**
5214
- * Event generated when computing the document of a pages.
5215
- * The integration should respond with a `Document`.
5216
- */
5217
- export type ContentComputeDocumentEvent = ContentComputeEvent & {
5218
- type: "content_compute_document";
5219
- };
5220
- /**
5221
- * Event generated when computing revision in a content.
5222
- * The integration should respond with an array of pages and files.
5223
- */
5224
- export type ContentComputeRevisionEvent = ContentComputeEvent & {
5225
- type: "content_compute_revision";
5226
- };
5227
- /** Event received when feedback has been submitted on a page. */
5228
- export type PageFeedbackEvent = BaseEvent & {
5229
- type: "page_feedback";
5230
- /** ID of the integration installation */
5231
- installationId: string;
5232
- /**
5233
- * Unique identifier of the space in the site.
5234
- * @deprecated
5235
- */
5236
- spaceId?: string;
5237
- /** Unique identifier of the site. */
5238
- siteId: string;
5239
- /** Unique identifier of the page where feedback was submitted. */
5240
- pageId?: string;
5241
- /** The feedback data submitted by the visitor. */
5242
- feedback: {
5243
- rating: PageFeedbackRating;
5244
- /**
5245
- * Optional comment provided with the feedback.
5246
- * @minLength 1
5247
- * @maxLength 512
5248
- */
5249
- comment?: string;
5250
- };
5251
- /** Analytics info on the GitBook's content visitor. */
5252
- visitor: EventVisitor;
5253
- /** The GitBook content's URL where feedback was submitted. */
5254
- url: string;
5255
- /** The URL of referrer that linked to the page. */
5256
- referrer: string;
5257
- };
5258
- export interface IntegrationEvent {
5259
- /** Unique ID of the event. */
5260
- id: string;
5261
- /** Unique ID of the integration. */
5262
- integrationId: string;
5263
- /** Unique ID of the integration installation. */
5264
- installationId?: string;
5265
- createdAt: Timestamp;
5266
- /** Any event that can be received from GitBook. */
5267
- payload: Event;
5268
- /** Status of the event. */
5269
- status: "success" | "failed";
5270
- }
5271
- export interface IntegrationEventLog {
5272
- /** The message of the log entry. */
5273
- message?: string;
5274
- timestamp?: Timestamp;
5275
- /** The level of the log entry. */
5276
- level?: "debug" | "info" | "warn" | "error";
5277
- }
5278
- export interface IntegrationEventTrace {
5279
- logs: IntegrationEventLog[];
5280
- }
5281
- /** Base properties of an installation of an integration on a site or space. */
5282
- export interface IntegrationContentInstallationBase {
5283
- /** Unique name identifier of the integration */
5284
- integration: string;
5285
- /** ID of the integration installation */
5286
- installation: string;
5287
- status: IntegrationInstallationStatus;
5288
- /** Configuration of the integration for this site */
5289
- configuration: object;
5290
- /** External IDs assigned by the integration. */
5291
- externalIds: IntegrationInstallationExternalIds;
5292
- /** URLs associated with the object */
5293
- urls: {
5294
- /**
5295
- * URL of the integration's installation in the API
5296
- * @format uri
5297
- */
5298
- location: string;
5299
- /**
5300
- * Public HTTP endpoint for the integration's installation
5301
- * @format uri
5302
- */
5303
- publicEndpoint: string;
5304
- /**
5305
- * Public endpoint serving the integration's rendered content (e.g. WebFrames), isolated from the cookie-bearing publicEndpoint origin. Equals publicEndpoint when no separate content origin is configured.
5306
- * @format uri
5307
- */
5308
- publicContentEndpoint: string;
5309
- };
5310
- }
5311
- export type IntegrationSpaceInstallation = IntegrationContentInstallationBase & {
5312
- /** The space the integration is installed on. Using the string value is deprecated in favor of space.id */
5313
- space: string | Space;
5136
+ export type IntegrationSpaceInstallation = IntegrationContentInstallationBase & {
5137
+ /** The space the integration is installed on. Using the string value is deprecated in favor of space.id */
5138
+ space: string | Space;
5314
5139
  };
5315
5140
  /**
5316
5141
  * Title of the site
@@ -5811,6 +5636,45 @@ export interface ContentKitRenderOutputComplete {
5811
5636
  }
5812
5637
  /** Output of the integration when rendering a UI. */
5813
5638
  export type ContentKitRenderOutput = ContentKitRenderOutputElement | ContentKitRenderOutputComplete;
5639
+ /** Common properties for ContentKit context. */
5640
+ export interface ContentKitContextBase {
5641
+ theme: "dark" | "light";
5642
+ }
5643
+ /** Context while rendering in an account installation's configuration. */
5644
+ export type ContentKitContextConfigurationAccount = ContentKitContextBase & {
5645
+ type: "configuration_account";
5646
+ /** ID of the organization the account installation configuration is in. */
5647
+ organizationId: string;
5648
+ };
5649
+ /** Context while rendering in a space-installation's configuration. */
5650
+ export type ContentKitContextConfigurationSpace = ContentKitContextBase & {
5651
+ type: "configuration_space";
5652
+ /** ID of the space the space-installation configuration is in. */
5653
+ spaceId: string;
5654
+ };
5655
+ /** Context while rendering in a site-installation's configuration. */
5656
+ export type ContentKitContextConfigurationSite = ContentKitContextBase & {
5657
+ type: "configuration_site";
5658
+ /** ID of the site the site-installation configuration is in. */
5659
+ siteId: string;
5660
+ };
5661
+ /** Context while rendering the configuration flow of a content source. */
5662
+ export type ContentKitContextConfigurationContentSource = ContentKitContextBase & {
5663
+ type: "configuration_contentsource";
5664
+ /** ID of the organization the content source installation configuration is in. */
5665
+ organizationId: string;
5666
+ /** Optional ID of the space the content source installation configuration is in. */
5667
+ spaceId?: string;
5668
+ };
5669
+ /** Context while rendering in a document. */
5670
+ export type ContentKitContextDocument = ContentKitContextBase & {
5671
+ type: "document";
5672
+ /** ID of the space content the document is in. */
5673
+ spaceId: string;
5674
+ editable: boolean;
5675
+ };
5676
+ /** Object representing the context in which a ContentKit component is rendered. */
5677
+ export type ContentKitContext = ContentKitContextConfigurationAccount | ContentKitContextConfigurationSpace | ContentKitContextConfigurationSite | ContentKitContextConfigurationContentSource | ContentKitContextDocument;
5814
5678
  export interface RenderIntegrationUI {
5815
5679
  /** ID of the component to render in the integration. */
5816
5680
  componentId: string;
@@ -5826,24 +5690,83 @@ export interface RenderIntegrationUI {
5826
5690
  export interface UpdateIntegrationInstallation {
5827
5691
  /** External IDs assigned by the integration. */
5828
5692
  externalIds?: IntegrationInstallationExternalIds;
5829
- /** Configuration of the integration at the account level */
5693
+ /** Configuration of the integration. For user authentication, oauth_credentials is returned as a boolean indicating whether a connection is configured. When replacing the configuration, send true to preserve the existing connection, or omit the field to clear it. Only the integration or the matching installation can read or set the OAuth credentials. */
5830
5694
  configuration?: IntegrationInstallationConfiguration;
5831
5695
  /** Describe whether all spaces have been selected or there's a selection involved */
5832
5696
  space_selection?: IntegrationInstallationSpaceSelection;
5833
5697
  /** Describe whether all sites have been selected or there's a selection involved */
5834
5698
  site_selection?: IntegrationInstallationSiteSelection;
5699
+ /** ID of a consumed OAuth transaction for this exact target, authorizing a credential write. Single use. */
5700
+ oauthTransaction?: string;
5701
+ }
5702
+ /** At most one of `spaceId` and `siteId` can be set. */
5703
+ export interface CreateIntegrationOAuthTransaction {
5704
+ /** Connect this space installation instead of the installation. */
5705
+ spaceId?: string;
5706
+ /** Connect this site installation instead of the installation. */
5707
+ siteId?: string;
5708
+ }
5709
+ export interface IntegrationOAuthTransactionStart {
5710
+ object: "integration-oauth-transaction-start";
5711
+ /** Opaque ID of the transaction, sent as the OAuth `state`. */
5712
+ id: string;
5713
+ expiresAt: Timestamp;
5714
+ /**
5715
+ * URL to open in the browser completing the flow: the target's `/oauth` route with `gitbook_oauth_transaction` and `gitbook_oauth_code_challenge`. Holds no secret.
5716
+ * @format uri
5717
+ */
5718
+ startURL: string;
5719
+ }
5720
+ export interface ConsumeIntegrationOAuthTransaction {
5721
+ /** The exact `redirect_uri` sent to the provider's authorize and token endpoints. */
5722
+ redirectUri: string;
5723
+ /** The authorization code received on the callback. */
5724
+ code: string;
5725
+ }
5726
+ export interface IntegrationOAuthTransaction {
5727
+ object: "integration-oauth-transaction";
5728
+ id: string;
5729
+ /** ID of the organization of the installation. */
5730
+ organization: string;
5731
+ /** ID of the installation the credentials must be written to. */
5732
+ installation: string;
5733
+ /** ID of the space whose installation the credentials must be written to. */
5734
+ space?: string;
5735
+ /** ID of the site whose installation the credentials must be written to. */
5736
+ site?: string;
5737
+ /** PKCE code verifier, to send as `code_verifier` when exchanging the code. */
5738
+ codeVerifier: string;
5739
+ /** The validated redirect URI. */
5740
+ redirectUri: string;
5741
+ grantExpiresAt: Timestamp;
5742
+ }
5743
+ export interface ConfirmIntegrationOAuthTransaction {
5744
+ /** The one-time key from the confirm page's URL fragment. */
5745
+ key: string;
5746
+ }
5747
+ export interface IntegrationOAuthTransactionConfirmation {
5748
+ object: "integration-oauth-transaction-confirmation";
5749
+ /**
5750
+ * Callback URL to return the browser to, on the integrations host.
5751
+ * @format uri
5752
+ */
5753
+ callbackURL: string;
5835
5754
  }
5836
5755
  export interface UpdateIntegrationSpaceInstallation {
5837
5756
  /** External IDs assigned by the integration. */
5838
5757
  externalIds?: IntegrationInstallationExternalIds;
5839
- /** Configuration of the integration at the account level */
5758
+ /** Configuration of the integration. For user authentication, oauth_credentials is returned as a boolean indicating whether a connection is configured. When replacing the configuration, send true to preserve the existing connection, or omit the field to clear it. Only the integration or the matching installation can read or set the OAuth credentials. */
5840
5759
  configuration?: IntegrationInstallationConfiguration;
5760
+ /** ID of a consumed OAuth transaction for this exact target, authorizing a credential write. Single use. */
5761
+ oauthTransaction?: string;
5841
5762
  }
5842
5763
  export interface UpdateIntegrationSiteInstallation {
5843
5764
  /** External IDs assigned by the integration. */
5844
5765
  externalIds?: IntegrationInstallationExternalIds;
5845
- /** Configuration of the integration at the account level */
5766
+ /** Configuration of the integration. For user authentication, oauth_credentials is returned as a boolean indicating whether a connection is configured. When replacing the configuration, send true to preserve the existing connection, or omit the field to clear it. Only the integration or the matching installation can read or set the OAuth credentials. */
5846
5767
  configuration?: IntegrationInstallationConfiguration;
5768
+ /** ID of a consumed OAuth transaction for this exact target, authorizing a credential write. Single use. */
5769
+ oauthTransaction?: string;
5847
5770
  }
5848
5771
  /** Preferences collected from the user during site onboarding, used to tailor recommendations and to apply their initial setup choices. */
5849
5772
  export interface SiteOnboardingPreferences {
@@ -7557,6 +7480,8 @@ export interface SiteCustomizationSettingsBase {
7557
7480
  */
7558
7481
  theme: CustomizationTheme;
7559
7482
  primaryColor: CustomizationThemedColor;
7483
+ /** Secondary brand color, used for secondary buttons and for content colored with `$secondary`. When not set, these elements use the neutral colors of the site. */
7484
+ secondaryColor?: CustomizationThemedColor;
7560
7485
  tint?: CustomizationTint;
7561
7486
  infoColor: CustomizationThemedColor;
7562
7487
  successColor: CustomizationThemedColor;
@@ -8219,6 +8144,18 @@ export interface SiteFindingServingRedirect {
8219
8144
  /** Whether GitBook created the redirect on its own. */
8220
8145
  createdByAgent: boolean;
8221
8146
  }
8147
+ /**
8148
+ * Awaiting change request
8149
+ * The change request GitBook drafted to fix an `outbound-link-error` finding, waiting to be approved or rejected. Approving it means merging it. Reject it with `applySiteFindingAction`.
8150
+ */
8151
+ export interface SiteFindingAwaitingChangeRequest {
8152
+ /** ID of the space the change request is in. */
8153
+ space: string;
8154
+ /** ID of the change request. */
8155
+ changeRequest: string;
8156
+ /** Number of open outbound links on the site the change request fixes. */
8157
+ findings: number;
8158
+ }
8222
8159
  /**
8223
8160
  * Available action
8224
8161
  * An action a finding allows now, with the site permission it needs.
@@ -8226,8 +8163,8 @@ export interface SiteFindingServingRedirect {
8226
8163
  export interface SiteFindingAvailableAction {
8227
8164
  /**
8228
8165
  * An action that moves a finding to another state. A finding's `actions` lists the ones it allows.
8229
- * - `approve` makes the redirect GitBook drafted for a broken link live, which resolves the finding.
8230
- * - `reject` deletes the redirect GitBook drafted for a broken link; the finding stays open and GitBook won't draft a fix for it again.
8166
+ * - `approve` makes the redirect GitBook drafted for a broken link live, which resolves the finding. A change request GitBook drafted for an outbound link is approved by merging it.
8167
+ * - `reject` deletes the redirect GitBook drafted for a broken link; the finding stays open and GitBook won't draft a fix for it again. For an outbound link, it archives the change request GitBook drafted (`awaitingChangeRequest`) and unlinks every link it fixes. They are open again, marked `undone`, and GitBook won't draft a fix for them again.
8231
8168
  * - `create-redirect` creates a redirect for a broken link's path with `createSiteRedirect`, prefilled with the suggestion; it resolves the finding.
8232
8169
  * - `mark-resolved` resolves it. A broken link resolved this way has no redirect: visitors still get a 404.
8233
8170
  * - `reopen` reopens a resolved finding. For a broken link, it deletes the live redirect at its path; for a fix GitBook applied, this undoes the fix and GitBook won't fix the link again.
@@ -8323,13 +8260,15 @@ export interface SiteFinding {
8323
8260
  /**
8324
8261
  * Where a link finding stands, from its status and what GitBook did with it.
8325
8262
  * - `open` needs a fix.
8326
- * - `awaiting-approval` has a redirect GitBook drafted at its path, waiting to be approved or rejected.
8263
+ * - `awaiting-approval` has a fix GitBook drafted, waiting to be approved or rejected: a redirect at a `broken-link` finding's path, or an unmerged change request for an `outbound-link-error` finding (`awaitingChangeRequest`).
8327
8264
  * - `resolved` was fixed or closed: `servingRedirect` says whether a live redirect serves its path.
8328
8265
  * - `ignored` was dismissed.
8329
8266
  */
8330
8267
  state?: SiteFindingState;
8331
8268
  /** The live redirect serving a `broken-link` finding's path. */
8332
8269
  servingRedirect?: SiteFindingServingRedirect;
8270
+ /** The change request GitBook drafted to fix an `outbound-link-error` finding, waiting to be approved or rejected. Approving it means merging it. Reject it with `applySiteFindingAction`. */
8271
+ awaitingChangeRequest?: SiteFindingAwaitingChangeRequest;
8333
8272
  /** Actions the finding allows now, applied with `applySiteFindingAction`. */
8334
8273
  actions?: SiteFindingAvailableAction[];
8335
8274
  /** Suggested fix for a broken-link finding, shaped as the input for `createSiteRedirect` so it can be applied directly. Absent when the finding has no directly applicable redirect (for example, a suggestion to create a new page). The destination is absent when the audit judged the URL and found no page to redirect to: a redirect can still be created from the source with a destination of your choosing. */
@@ -8825,6 +8764,18 @@ export type SiteQuestionAnswerSourceRecord = SiteQuestionAnswerSourceBase & {
8825
8764
  /** Integration source */
8826
8765
  connector?: ContextConnector;
8827
8766
  };
8767
+ export interface SiteQuestionTimelineBucket {
8768
+ /** Start of the bucket. */
8769
+ time: Timestamp;
8770
+ /** Count of answers given during the bucket. */
8771
+ answers: number;
8772
+ /** Count of distinct visitors who received those answers. */
8773
+ visitors: number;
8774
+ }
8775
+ /** Ask AI answers counted per bucket, oldest first. */
8776
+ export interface SiteQuestionTimeline {
8777
+ items: SiteQuestionTimelineBucket[];
8778
+ }
8828
8779
  export interface SiteQuestionAnswer {
8829
8780
  object: "site-question-answer";
8830
8781
  /** The ID of the site question answer. */
@@ -9392,6 +9343,8 @@ export interface AIMessage {
9392
9343
  }
9393
9344
  export type SiteQuestionAnswerWithResponse = SiteQuestionAnswer & {
9394
9345
  response: AIMessage;
9346
+ /** Claims of the site visitor who asked, as recorded by site insights. Absent when the visitor sent no claims. */
9347
+ visitorClaims?: PlainObject;
9395
9348
  };
9396
9349
  export type SiteSpaceCustomizationSettings = SiteCustomizationSettings & {
9397
9350
  /** Indicates whether the site customization settings have been overridden. */
@@ -9629,6 +9582,8 @@ export interface SiteSettingsBrokenLinks {
9629
9582
  * - `suggest-fixes` drafts fixes for approval and applies none.
9630
9583
  * - `fix-clear-matches` applies the clearest fixes and drafts the less certain ones for approval.
9631
9584
  * - `fix-close-matches` applies the clear and the close fixes.
9585
+ * At every level, GitBook drafts change requests that fix broken links to other sites, and never
9586
+ * merges them.
9632
9587
  */
9633
9588
  autonomyLevel: SiteSettingsBrokenLinksAutonomyLevel;
9634
9589
  }
@@ -10648,6 +10603,22 @@ export interface SiteVisitorPayload {
10648
10603
  country?: string;
10649
10604
  unsignedClaims?: PlainObject;
10650
10605
  }
10606
+ /** JSON schema describing the expected attributes of an Adaptive site schema. */
10607
+ export interface SiteAdaptiveJSONSchema {
10608
+ $schema?: "http://json-schema.org/draft-07/schema#";
10609
+ type: "object";
10610
+ properties: {
10611
+ /** Unsigned claims of the site visitor. */
10612
+ unsigned?: {
10613
+ type: "object";
10614
+ description: "Unsigned claims of the site visitor.";
10615
+ properties: Record<string, SiteAdaptiveJSONSchemaClaimsProperties>;
10616
+ additionalProperties: false;
10617
+ };
10618
+ [key: string]: any;
10619
+ };
10620
+ additionalProperties: false;
10621
+ }
10651
10622
  /** GitHub repository that can be selected for Git Sync. */
10652
10623
  export interface GitSyncGitHubRepository {
10653
10624
  id: number;
@@ -10764,6 +10735,7 @@ export interface ContentLocationChangeRequestContext {
10764
10735
  }
10765
10736
  export interface ContentLocationFile {
10766
10737
  kind: "file";
10738
+ /** Non-members of the organization only receive `object`, `id`, `title`, `sso`, `inviteLinks`, `urls`, `blocked` and `permissions`. */
10767
10739
  organization: Organization;
10768
10740
  space: Space;
10769
10741
  versionContext?: ContentLocationRevisionContext | ContentLocationChangeRequestContext;
@@ -10785,6 +10757,7 @@ export interface ContentLocationPageNode {
10785
10757
  }
10786
10758
  export interface ContentLocationPage {
10787
10759
  kind: "page";
10760
+ /** Non-members of the organization only receive `object`, `id`, `title`, `sso`, `inviteLinks`, `urls`, `blocked` and `permissions`. */
10788
10761
  organization: Organization;
10789
10762
  page: RevisionPage;
10790
10763
  space: Space;
@@ -10797,16 +10770,19 @@ export interface ContentLocationUser {
10797
10770
  }
10798
10771
  export interface ContentLocationCollection {
10799
10772
  kind: "collection";
10773
+ /** Non-members of the organization only receive `object`, `id`, `title`, `sso`, `inviteLinks`, `urls`, `blocked` and `permissions`. */
10800
10774
  organization: Organization;
10801
10775
  collection: Collection;
10802
10776
  }
10803
10777
  export interface ContentLocationSpace {
10804
10778
  kind: "space";
10779
+ /** Non-members of the organization only receive `object`, `id`, `title`, `sso`, `inviteLinks`, `urls`, `blocked` and `permissions`. */
10805
10780
  organization: Organization;
10806
10781
  space: Space;
10807
10782
  }
10808
10783
  export interface ContentLocationReusableContent {
10809
10784
  kind: "reusable-content";
10785
+ /** Non-members of the organization only receive `object`, `id`, `title`, `sso`, `inviteLinks`, `urls`, `blocked` and `permissions`. */
10810
10786
  organization: Organization;
10811
10787
  space: Space;
10812
10788
  versionContext?: ContentLocationRevisionContext | ContentLocationChangeRequestContext;
@@ -10814,6 +10790,7 @@ export interface ContentLocationReusableContent {
10814
10790
  }
10815
10791
  export interface ContentLocationOpenAPI {
10816
10792
  kind: "openapi";
10793
+ /** Non-members of the organization only receive `object`, `id`, `title`, `sso`, `inviteLinks`, `urls`, `blocked` and `permissions`. */
10817
10794
  organization: Organization;
10818
10795
  openAPISpec: OpenAPISpec;
10819
10796
  }
@@ -11359,63 +11336,336 @@ export interface GitSyncSiteConfig {
11359
11336
  */
11360
11337
  structure: GitSyncSiteStructure;
11361
11338
  };
11362
- }
11363
- export type IntegrationEnvironmentSpaceInstallation = IntegrationContentInstallationBase & {
11364
- /** The space the integration is installed on. */
11365
- space: string;
11339
+ }
11340
+ export type IntegrationEnvironmentSpaceInstallation = IntegrationContentInstallationBase & {
11341
+ /** The space the integration is installed on. */
11342
+ space: string;
11343
+ };
11344
+ export type IntegrationEnvironmentSiteInstallation = IntegrationContentInstallationBase & {
11345
+ /** The site the integration is installed on. */
11346
+ site: string;
11347
+ };
11348
+ /** Runtime environment provided during the execution of integration's code. */
11349
+ export interface IntegrationEnvironment {
11350
+ /**
11351
+ * Authentication token to use with the HTTP API. Depending on the context, the token might be representing the installation or the integration.
11352
+ * @deprecated
11353
+ */
11354
+ authToken?: string;
11355
+ integration: Integration;
11356
+ /** Installation of an integration on an account */
11357
+ installation?: IntegrationInstallation;
11358
+ spaceInstallation?: IntegrationEnvironmentSpaceInstallation;
11359
+ siteInstallation?: IntegrationEnvironmentSiteInstallation;
11360
+ /** Secrets stored on the integration and passed at runtime. */
11361
+ secrets: IntegrationSecrets;
11362
+ /**
11363
+ * Secret that can be used to verify the authenticity of incoming HTTP requests to the integration.
11364
+ * @deprecated
11365
+ */
11366
+ signingSecret?: string;
11367
+ signingSecrets: {
11368
+ /** Secret that can be used to verify the authenticity of incoming HTTP requests to the integration. */
11369
+ integration: string;
11370
+ /** Secret that can be used to verify the authenticity of incoming HTTP requests to the installation. */
11371
+ installation?: string;
11372
+ /** Secret that can be used to verify the authenticity of incoming HTTP requests to the space installation. */
11373
+ spaceInstallation?: string;
11374
+ /** Secret that can be used to verify the authenticity of incoming HTTP requests to the site installation. */
11375
+ siteInstallation?: string;
11376
+ };
11377
+ /** URL of the HTTP API */
11378
+ apiEndpoint: string;
11379
+ apiTokens: {
11380
+ /** API authentication token representing the integration. */
11381
+ integration: string;
11382
+ /** API authentication token representing the current installation. */
11383
+ installation?: string;
11384
+ };
11385
+ /** Network configuration for the integration environment */
11386
+ network?: IntegrationNetwork;
11387
+ }
11388
+ export interface SpaceIntegrationScript {
11389
+ /** Script URL to load. */
11390
+ script: URL;
11391
+ /** Content Security Policy to secure the loading of this script. */
11392
+ contentSecurityPolicy?: string;
11393
+ /** If true, the script will potentially load use cookies and visitors should be aware. */
11394
+ cookies: boolean;
11395
+ }
11396
+ /** Common properties for all events. */
11397
+ export interface BaseEvent {
11398
+ /** Unique identifier for the event. */
11399
+ eventId: string;
11400
+ /** Type of the event. */
11401
+ type: string;
11402
+ }
11403
+ /** Common properties for all events related to an installation */
11404
+ export type InstallationEvent = BaseEvent & {
11405
+ /** ID of the integration installation */
11406
+ installationId: string;
11407
+ };
11408
+ /** Event received when integration has been installed or updated. */
11409
+ export type InstallationSetupEvent = InstallationEvent & {
11410
+ type: "installation_setup";
11411
+ status: IntegrationInstallationStatus;
11412
+ /** The state of the installation at the account level before it was updated. */
11413
+ previous?: {
11414
+ status: IntegrationInstallationStatus;
11415
+ /** The previous configuration of the installation at the account level. */
11416
+ configuration?: object;
11417
+ };
11418
+ };
11419
+ /** Event received when integration has been uninstalled from an organization. */
11420
+ export type InstallationDeletedEvent = InstallationEvent & {
11421
+ type: "installation_deleted";
11422
+ /** The state of the installation before it was deleted. */
11423
+ previous: {
11424
+ /** The previous configuration of the installation. */
11425
+ configuration?: object;
11426
+ };
11427
+ };
11428
+ /** Common properties for all events related to a specific space. */
11429
+ export type SpaceEvent = InstallationEvent & {
11430
+ /** ID of the space */
11431
+ spaceId: string;
11432
+ };
11433
+ /** Event received when integration has been installed or updated on a space. */
11434
+ export type SpaceInstallationSetupEvent = SpaceEvent & {
11435
+ type: "space_installation_setup";
11436
+ status: IntegrationInstallationStatus;
11437
+ /** The state of the Space installation before it was updated. */
11438
+ previous?: {
11439
+ status: IntegrationInstallationStatus;
11440
+ /** The previous configuration of the Space installation. */
11441
+ configuration?: object;
11442
+ };
11443
+ };
11444
+ /** Event received when integration has been uninstalled from a space. */
11445
+ export type SpaceInstallationDeletedEvent = SpaceEvent & {
11446
+ type: "space_installation_deleted";
11447
+ /** The state of the Space installation before it was deleted. */
11448
+ previous: {
11449
+ /** The previous configuration of the Space installation. */
11450
+ configuration?: object;
11451
+ };
11452
+ };
11453
+ /** Common properties for all events related to a specific site. */
11454
+ export type SiteEvent = InstallationEvent & {
11455
+ /** ID of the site */
11456
+ siteId: string;
11457
+ };
11458
+ /** Event received when integration has been installed or updated on a site. */
11459
+ export type SiteInstallationSetupEvent = SiteEvent & {
11460
+ type: "site_installation_setup";
11461
+ status: IntegrationInstallationStatus;
11462
+ /** The state of the site installation before it was updated. */
11463
+ previous?: {
11464
+ status: IntegrationInstallationStatus;
11465
+ /** The previous configuration of the site installation. */
11466
+ configuration?: object;
11467
+ };
11468
+ };
11469
+ /** Event received when integration has been uninstalled from a site. */
11470
+ export type SiteInstallationDeletedEvent = SiteEvent & {
11471
+ type: "site_installation_deleted";
11472
+ /** The state of the site installation before it was deleted. */
11473
+ previous: {
11474
+ /** The previous configuration of the site installation. */
11475
+ configuration?: object;
11476
+ };
11477
+ };
11478
+ /** Analytics info on the GitBook's content visitor. */
11479
+ export interface EventVisitor {
11480
+ /** GitBook's unique identifier of the visitor. */
11481
+ anonymousId: string;
11482
+ /** The visitors cookies. */
11483
+ cookies: Record<string, string>;
11484
+ /** User-agent of the visitor. */
11485
+ userAgent: string;
11486
+ /** IP address of the visitor. */
11487
+ ip: string;
11488
+ /** Language of the visitor. */
11489
+ language?: string;
11490
+ }
11491
+ /** Event received when a page has been visited on a site. */
11492
+ export type SiteViewEvent = SiteEvent & {
11493
+ type: "site_view";
11494
+ /**
11495
+ * Unique identifier of the visited space in the site.
11496
+ * @deprecated
11497
+ */
11498
+ spaceId?: string;
11499
+ /** The site-space that was viewed */
11500
+ siteSpaceId?: string;
11501
+ /** Unique identifier of the visited page. */
11502
+ pageId?: string;
11503
+ /** Analytics info on the GitBook's content visitor. */
11504
+ visitor: EventVisitor;
11505
+ /** The GitBook content's URL visited (including URL params). */
11506
+ url: string;
11507
+ /** The URL of referrer that linked to the page. */
11508
+ referrer: string;
11509
+ };
11510
+ /** Event when the primary content of a space has been updated. */
11511
+ export type SpaceContentUpdatedEvent = SpaceEvent & {
11512
+ type: "space_content_updated";
11513
+ /** Unique identifier of the new content revision */
11514
+ revisionId: string;
11515
+ /** Users who updated the content */
11516
+ updatedBy: User[];
11517
+ };
11518
+ /** Event when a GitSync operation has been completed. */
11519
+ export type SpaceGitSyncCompletedEvent = SpaceEvent & {
11520
+ type: "space_gitsync_completed";
11521
+ state: "success" | "failure";
11522
+ /** Unique identifier of the new content revision */
11523
+ revisionId: string;
11524
+ /** Unique identifier for the commit (sha) */
11525
+ commitId: string;
11526
+ };
11527
+ /** Event when a GitSync operation has been started. */
11528
+ export type SpaceGitSyncStartedEvent = SpaceEvent & {
11529
+ type: "space_gitsync_started";
11530
+ /** Unique identifier of the new content revision */
11531
+ revisionId: string;
11532
+ /** Unique identifier for the commit (sha) */
11533
+ commitId: string;
11534
+ };
11535
+ /** Event when the visibility of the space has been changed. */
11536
+ export type SpaceVisibilityUpdatedEvent = SpaceEvent & {
11537
+ type: "space_visibility_updated";
11538
+ /**
11539
+ * * `public`: Anyone can access the content, and the content is indexed by search engines.
11540
+ * * `unlisted`: Anyone can access the content, and the content is not indexed by search engines
11541
+ * * `share-link`: Anyone with a secret token in the url can access the content.
11542
+ * * `visitor-auth`: Anyone authenticated through a JWT token can access the content.
11543
+ * * `in-collection`: Anyone who can access the parent collection can access the content.
11544
+ * Only available for spaces in a collection.
11545
+ * * `private`: Authorized members can access the content.
11546
+ */
11547
+ previousVisibility: ContentVisibility;
11548
+ /**
11549
+ * * `public`: Anyone can access the content, and the content is indexed by search engines.
11550
+ * * `unlisted`: Anyone can access the content, and the content is not indexed by search engines
11551
+ * * `share-link`: Anyone with a secret token in the url can access the content.
11552
+ * * `visitor-auth`: Anyone authenticated through a JWT token can access the content.
11553
+ * * `in-collection`: Anyone who can access the parent collection can access the content.
11554
+ * Only available for spaces in a collection.
11555
+ * * `private`: Authorized members can access the content.
11556
+ */
11557
+ visibility: ContentVisibility;
11558
+ };
11559
+ /** Event representing a background task trigger for an integration. */
11560
+ export type TaskEvent = BaseEvent & {
11561
+ type: "task";
11562
+ /** Payload associated with the integration task. */
11563
+ task: object;
11564
+ };
11565
+ export interface FetchRequest {
11566
+ method: "post" | "get" | "put" | "delete";
11567
+ url: string;
11568
+ headers: Record<string, string>;
11569
+ }
11570
+ /** Event representing an incoming HTTP request. */
11571
+ export type FetchEvent = BaseEvent & {
11572
+ /** The space ID, if requests are specific to a single space */
11573
+ spaceId?: string;
11574
+ /** The site ID, if requests are specific to a single site */
11575
+ siteId?: string;
11576
+ /** The installation ID, if requests are specific to a single installation */
11577
+ installationId?: string;
11578
+ auth?: {
11579
+ /** The user's ID. */
11580
+ userId: string;
11581
+ };
11582
+ type: "fetch";
11583
+ request: FetchRequest;
11584
+ };
11585
+ /** Common properties for all events related to fetching a published script from an installation */
11586
+ export type FetchPublishedScriptEvent = SiteEvent & {
11587
+ type: "fetch_published_script";
11588
+ };
11589
+ /** Common properties for all events related to authenticated access from an installation */
11590
+ export type FetchVisitorAuthenticationEvent = SiteEvent & {
11591
+ type: "fetch_visitor_authentication";
11592
+ location?: string;
11593
+ /** Whitelisted search parameters from the visitor authentication request. */
11594
+ searchParams?: Record<string, string>;
11595
+ /** Whitelisted cookies from the visitor authentication request. */
11596
+ cookies?: Record<string, string>;
11597
+ /** The visitor authentication action to resolve. If omitted, integrations resolve to the existing login redirect. */
11598
+ action?: "logout";
11599
+ };
11600
+ /** Event generated when rendering a UI */
11601
+ export type UIRenderEvent = (SpaceEvent | SiteEvent | InstallationEvent) & {
11602
+ auth?: {
11603
+ /** The user's ID. */
11604
+ userId: string;
11605
+ };
11606
+ type: "ui_render";
11607
+ componentId: string;
11608
+ /** Properties to render the UI. */
11609
+ props: object;
11610
+ /** State of the UI. */
11611
+ state?: object;
11612
+ /** Object representing the context in which a ContentKit component is rendered. */
11613
+ context: ContentKitContext;
11614
+ action?: object;
11366
11615
  };
11367
- export type IntegrationEnvironmentSiteInstallation = IntegrationContentInstallationBase & {
11368
- /** The site the integration is installed on. */
11369
- site: string;
11616
+ /** Generic event when computing the content of a space */
11617
+ export type ContentComputeEvent = SpaceEvent & {
11618
+ sourceId: string;
11619
+ /** Properties passed to the rendering. */
11620
+ props: PlainObject;
11621
+ /** Dependencies of the computation. */
11622
+ dependencies: Record<string, ComputedContentDependencyResolved>;
11370
11623
  };
11371
- /** Runtime environment provided during the execution of integration's code. */
11372
- export interface IntegrationEnvironment {
11373
- /**
11374
- * Authentication token to use with the HTTP API. Depending on the context, the token might be representing the installation or the integration.
11375
- * @deprecated
11376
- */
11377
- authToken?: string;
11378
- integration: Integration;
11379
- /** Installation of an integration on an account */
11380
- installation?: IntegrationInstallation;
11381
- spaceInstallation?: IntegrationEnvironmentSpaceInstallation;
11382
- siteInstallation?: IntegrationEnvironmentSiteInstallation;
11383
- /** Secrets stored on the integration and passed at runtime. */
11384
- secrets: IntegrationSecrets;
11624
+ /**
11625
+ * Event generated when computing the document of a pages.
11626
+ * The integration should respond with a `Document`.
11627
+ */
11628
+ export type ContentComputeDocumentEvent = ContentComputeEvent & {
11629
+ type: "content_compute_document";
11630
+ };
11631
+ /**
11632
+ * Event generated when computing revision in a content.
11633
+ * The integration should respond with an array of pages and files.
11634
+ */
11635
+ export type ContentComputeRevisionEvent = ContentComputeEvent & {
11636
+ type: "content_compute_revision";
11637
+ };
11638
+ /** Event received when feedback has been submitted on a page. */
11639
+ export type PageFeedbackEvent = BaseEvent & {
11640
+ type: "page_feedback";
11641
+ /** ID of the integration installation */
11642
+ installationId: string;
11385
11643
  /**
11386
- * Secret that can be used to verify the authenticity of incoming HTTP requests to the integration.
11644
+ * Unique identifier of the space in the site.
11387
11645
  * @deprecated
11388
11646
  */
11389
- signingSecret?: string;
11390
- signingSecrets: {
11391
- /** Secret that can be used to verify the authenticity of incoming HTTP requests to the integration. */
11392
- integration: string;
11393
- /** Secret that can be used to verify the authenticity of incoming HTTP requests to the installation. */
11394
- installation?: string;
11395
- /** Secret that can be used to verify the authenticity of incoming HTTP requests to the space installation. */
11396
- spaceInstallation?: string;
11397
- /** Secret that can be used to verify the authenticity of incoming HTTP requests to the site installation. */
11398
- siteInstallation?: string;
11399
- };
11400
- /** URL of the HTTP API */
11401
- apiEndpoint: string;
11402
- apiTokens: {
11403
- /** API authentication token representing the integration. */
11404
- integration: string;
11405
- /** API authentication token representing the current installation. */
11406
- installation?: string;
11647
+ spaceId?: string;
11648
+ /** Unique identifier of the site. */
11649
+ siteId: string;
11650
+ /** Unique identifier of the page where feedback was submitted. */
11651
+ pageId?: string;
11652
+ /** The feedback data submitted by the visitor. */
11653
+ feedback: {
11654
+ rating: PageFeedbackRating;
11655
+ /**
11656
+ * Optional comment provided with the feedback.
11657
+ * @minLength 1
11658
+ * @maxLength 512
11659
+ */
11660
+ comment?: string;
11407
11661
  };
11408
- /** Network configuration for the integration environment */
11409
- network?: IntegrationNetwork;
11410
- }
11411
- export interface SpaceIntegrationScript {
11412
- /** Script URL to load. */
11413
- script: URL;
11414
- /** Content Security Policy to secure the loading of this script. */
11415
- contentSecurityPolicy?: string;
11416
- /** If true, the script will potentially load use cookies and visitors should be aware. */
11417
- cookies: boolean;
11418
- }
11662
+ /** Analytics info on the GitBook's content visitor. */
11663
+ visitor: EventVisitor;
11664
+ /** The GitBook content's URL where feedback was submitted. */
11665
+ url: string;
11666
+ /** The URL of referrer that linked to the page. */
11667
+ referrer: string;
11668
+ };
11419
11669
  /** Response expected for an event of type `content_compute_document`. */
11420
11670
  export interface ContentComputeDocumentEventResponse {
11421
11671
  document: Document;
@@ -11837,22 +12087,6 @@ export interface APIChannelMutationData {
11837
12087
  executionId: string;
11838
12088
  };
11839
12089
  }
11840
- /** JSON schema describing the expected attributes of an Adaptive site schema. */
11841
- export interface SiteAdaptiveJSONSchema {
11842
- $schema?: "http://json-schema.org/draft-07/schema#";
11843
- type: "object";
11844
- properties: {
11845
- /** Unsigned claims of the site visitor. */
11846
- unsigned?: {
11847
- type: "object";
11848
- description: "Unsigned claims of the site visitor.";
11849
- properties: Record<string, SiteAdaptiveJSONSchemaClaimsProperties>;
11850
- additionalProperties: false;
11851
- };
11852
- [key: string]: any;
11853
- };
11854
- additionalProperties: false;
11855
- }
11856
12090
  export type SiteAdaptiveDeterministicJSONSchemaClaimsProperties = SiteAdaptiveDeterministicJSONSchemaPrimitives | {
11857
12091
  type: "object";
11858
12092
  description: string;
@@ -12002,6 +12236,9 @@ export type RequestPublishIntegration = PublishIntegration;
12002
12236
  export type RequestUpdateIntegrationInstallation = UpdateIntegrationInstallation;
12003
12237
  export type RequestUpdateIntegrationSpaceInstallation = UpdateIntegrationSpaceInstallation;
12004
12238
  export type RequestUpdateIntegrationSiteInstallation = UpdateIntegrationSiteInstallation;
12239
+ export type RequestCreateIntegrationOAuthTransaction = CreateIntegrationOAuthTransaction;
12240
+ export type RequestConsumeIntegrationOAuthTransaction = ConsumeIntegrationOAuthTransaction;
12241
+ export type RequestConfirmIntegrationOAuthTransaction = ConfirmIntegrationOAuthTransaction;
12005
12242
  export type RequestUpgradeOrganizationBilling = UpgradeOrganizationBilling;
12006
12243
  export type RequestInviteUsersToOrganization = InviteUsersToOrganization;
12007
12244
  export type RequestImportGitRepository = ImportGitRepository;
@@ -13289,7 +13526,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
13289
13526
  computed?: boolean;
13290
13527
  }, params?: RequestParams) => Promise<HttpResponse<Revision, any>>;
13291
13528
  /**
13292
- * @description Applies an ordered array of content changes (up to 50) to the change request atomically, creating a single new revision. Changes are applied sequentially; if any single change is invalid the entire batch is rejected and no revision is created. Use this to create, update, rename, move, or delete pages within a change request before merging to live. This is the primary way to programmatically author content in a change request. **Renaming a page** — `update_page` can change a page's `title` and/or its `slug` (the path segment used to build its URL within its current parent). Both fields are independent: to rename only the title without changing the URL, set `title` and omit `slug`; to change the URL without changing the title, set `slug` and omit `title`. **Moving a page** — `update_page` can also change a page's parent and/or its position among siblings with `into`/`at`. Set `into` to the new parent's page ID, or `null` to move the page to the root of the tree; omit `into` to leave the parent unchanged. Set `at` to place the page at a specific zero-based index among its new siblings; omit it to leave the position unchanged (when the parent isn't changing) or append at the end (when it is). A page cannot be moved under itself or one of its own descendants. `insert_page`'s `into`/`at` remain the way to place a **new** page at creation time. To put an image or attachment in a page, upload it with an `insert_files` change. Give the file a `ref` and a page inserted in the same batch can reference it as `![Alt](./<ref>)` or `[File](./<ref>)`, which resolves to the file's ID at apply time regardless of operation order. Uploaded files are also listed as `insertedFiles` when `compat=false`, and a file already in the change request can be referenced directly as `/files/<fileId>`. Inline `data:` URIs in markdown are not ingested and large image blocks are dropped, so upload the bytes with `insert_files` instead. **Reusable content** (snippets shared by several pages, Git Sync's `.gitbook/includes/`) is created with `insert_reusable_contents`, changed with `update_reusable_content` and removed with `delete_reusable_content`. A page includes one in markdown as `{% include "/reusable-content/<reusableContentId>" %}`; give a new one a `ref` and a page in the same batch can include it as `{% include "./<ref>" %}`, regardless of operation order. Created reusable contents are listed as `insertedReusableContents` when `compat=false`. An update keeps the ID, so every page including it shows the change. Deleting one leaves the includes in pages unresolved, as in the editor: remove them from those pages too. Reusable content cannot include other reusable content, so an include in its document is dropped. Unlike a link, an include that matches no reusable content of the change request (or of the batch) rejects the batch, since dropping it would remove it from the page silently. **Publishing an OpenAPI spec** — an OpenAPI spec belongs to the organization (see `createOpenAPISpec`) and appears in a space only through a page that renders it. Insert that page with an `insert_computed_page` change: `{ "operation": "insert_computed_page", "title": "API reference", "computed": { "type": "builtin:openapi", "props": { "models": true }, "dependencies": { "spec": { "ref": { "kind": "openapi", "spec": "<spec slug>" } } } } }`. GitBook replaces that page, at its position, with the API reference: one page per tag (or per operation with `"grouping": "by-operation"` in `props`), plus a models page when `models` is true, regenerated whenever the spec changes. Use `into` to nest the reference under an existing page. Do not recreate a spec with `insert_page`: `openapi-operation` blocks in a document only render the operations they name. When page content is provided as markdown, links to other pages are resolved against the change request's current page tree. You can link a page by: - Page ID — `/pages/<pageId>` (also `/pages/<pageId>#anchor`). - Page slug path — `/pages/<slug>` for a top-level page, or `/pages/<parent-slug>/<slug>` for a nested page (e.g. `/pages/guides/getting-started`). - Markdown file path — the path the page would have in Git: `/pages/<slug>.md` for a page, or `/pages/<slug>/README.md` for a page that has child pages. The space's root page is `/pages/README.md`. - Relative markdown link — resolved against the page being edited, e.g. `./sibling.md`, `../other.md`, or `../README.md` (the parent page). Folder-style links without an extension (e.g. `./section`) resolve to that folder's page. External URLs (`https://…`) are kept as-is. A link that does not match any page in the change request is left as plain text rather than causing the request to fail. GitBook normalizes submitted content, so the stored page may differ from what was sent. To help callers reconcile local state with the stored result, the response can list each created and modified page with its resolved ID and a `urls.location` to fetch the page's persisted content. For change requests with frequent concurrent edits, consider `expectedRevision` to protect against overwriting changes made since your read. If the branch has changed since the supplied revision, the batch is rejected with HTTP 409 and none of the submitted changes are applied. **Response shape (`compat`)** — this endpoint is changing what it returns: - `compat=true` (current default) returns the updated change request, matching the endpoint's original behavior. - `compat=false` returns the updated change request **and** the list of affected pages (see the response schema). The default is `true` for now to preserve backwards compatibility, but **will switch to `false` in a future release**, at which point the affected-page list is always included. You should pass `compat=false` if you want the new behavior today and avoid unexpected errors when the default flips in the future.
13529
+ * @description Applies an ordered array of content changes (up to 50) to the change request atomically, creating a single new revision. Changes are applied sequentially; if any single change is invalid the entire batch is rejected and no revision is created. Use this to create, update, rename, move, or delete pages within a change request before merging to live. This is the primary way to programmatically author content in a change request. **Renaming a page** — `update_page` can change a page's `title` and/or its `slug` (the path segment used to build its URL within its current parent). Both fields are independent: to rename only the title without changing the URL, set `title` and omit `slug`; to change the URL without changing the title, set `slug` and omit `title`. **Moving a page** — `update_page` can also change a page's parent and/or its position among siblings with `into`/`at`. Set `into` to the new parent's page ID, or `null` to move the page to the root of the tree; omit `into` to leave the parent unchanged. Set `at` to place the page at a specific zero-based index among its new siblings; omit it to leave the position unchanged (when the parent isn't changing) or append at the end (when it is). A page cannot be moved under itself or one of its own descendants. `insert_page`'s `into`/`at` remain the way to place a **new** page at creation time. **Tags**: create flat tag definitions with `insert_tags` and a `tags` array of 1-50 entries, edit their label or appearance with `update_tag`, and remove definitions with `delete_tag`. Slugs are immutable and generated from the label when omitted on insertion. Operations apply in order, so later updates or deletions can target newly inserted tags. Set `icon` or `emoji` to `null` to clear that field; omission preserves it. A non-null icon takes precedence over a non-null emoji. Deleting a tag leaves references in content unresolved. For example: `{"changes":[{"operation":"insert_tags","tags":[{"label":"Beta"}]}, {"operation":"update_tag","tag":"beta","color":"blue"}]}`. To put an image or attachment in a page, upload it with an `insert_files` change. Give the file a `ref` and a page inserted in the same batch can reference it as `![Alt](./<ref>)` or `[File](./<ref>)`, which resolves to the file's ID at apply time regardless of operation order. Uploaded files are also listed as `insertedFiles` when `compat=false`, and a file already in the change request can be referenced directly as `/files/<fileId>`. Inline `data:` URIs in markdown are not ingested and large image blocks are dropped, so upload the bytes with `insert_files` instead. **Reusable content** (snippets shared by several pages, Git Sync's `.gitbook/includes/`) is created with `insert_reusable_contents`, changed with `update_reusable_content` and removed with `delete_reusable_content`. A page includes one in markdown as `{% include "/reusable-content/<reusableContentId>" %}`; give a new one a `ref` and a page in the same batch can include it as `{% include "./<ref>" %}`, regardless of operation order. Created reusable contents are listed as `insertedReusableContents` when `compat=false`. An update keeps the ID, so every page including it shows the change. Deleting one leaves the includes in pages unresolved, as in the editor: remove them from those pages too. Reusable content cannot include other reusable content, so an include in its document is dropped. Unlike a link, an include that matches no reusable content of the change request (or of the batch) rejects the batch, since dropping it would remove it from the page silently. **Variables** (space variables, Git Sync's `.gitbook/vars.yaml`) are created with `insert_variables`, changed with `update_variable` and removed with `delete_variable`. A variable is identified by its name, which content references as an expression: `<code class="expression">space.vars.<name></code>` in markdown. Inserting a name the change request already uses, or updating or deleting one it does not, rejects the batch. Deleting a variable keeps the expressions referencing it, as in the editor: remove them from those pages too. A page's own variables (`page.vars.<name>`) are set with `insert_page`/`update_page`'s `variables`, or the `vars` frontmatter of a markdown document, which replace all of that page's variables. To change one of them without resending the rest, give `insert_variables`, `update_variable` or `delete_variable` a `page`; the same rules apply to that page's variables. **Publishing an OpenAPI spec** — an OpenAPI spec belongs to the organization (see `createOpenAPISpec`) and appears in a space only through a page that renders it. Insert that page with an `insert_computed_page` change: `{ "operation": "insert_computed_page", "title": "API reference", "computed": { "type": "builtin:openapi", "props": { "models": true }, "dependencies": { "spec": { "ref": { "kind": "openapi", "spec": "<spec slug>" } } } } }`. GitBook replaces that page, at its position, with the API reference: one page per tag (or per operation with `"grouping": "by-operation"` in `props`), plus a models page when `models` is true, regenerated whenever the spec changes. Use `into` to nest the reference under an existing page. Do not recreate a spec with `insert_page`: `openapi-operation` blocks in a document only render the operations they name. When page content is provided as markdown, links to other pages are resolved against the change request's current page tree. You can link a page by: - Page ID — `/pages/<pageId>` (also `/pages/<pageId>#anchor`). - Page slug path — `/pages/<slug>` for a top-level page, or `/pages/<parent-slug>/<slug>` for a nested page (e.g. `/pages/guides/getting-started`). - Markdown file path — the path the page would have in Git: `/pages/<slug>.md` for a page, or `/pages/<slug>/README.md` for a page that has child pages. The space's root page is `/pages/README.md`. - Relative markdown link — resolved against the page being edited, e.g. `./sibling.md`, `../other.md`, or `../README.md` (the parent page). Folder-style links without an extension (e.g. `./section`) resolve to that folder's page. External URLs (`https://…`) are kept as-is. A link that does not match any page in the change request is left as plain text rather than causing the request to fail. GitBook normalizes submitted content, so the stored page may differ from what was sent. To help callers reconcile local state with the stored result, the response can list each created and modified page with its resolved ID and a `urls.location` to fetch the page's persisted content. For change requests with frequent concurrent edits, consider `expectedRevision` to protect against overwriting changes made since your read. If the branch has changed since the supplied revision, the batch is rejected with HTTP 409 and none of the submitted changes are applied. **Response shape (`compat`)** — this endpoint is changing what it returns: - `compat=true` (current default) returns the updated change request, matching the endpoint's original behavior. - `compat=false` returns the updated change request **and** the list of affected pages (see the response schema). The default is `true` for now to preserve backwards compatibility, but **will switch to `false` in a future release**, at which point the affected-page list is always included. You should pass `compat=false` if you want the new behavior today and avoid unexpected errors when the default flips in the future.
13293
13530
  *
13294
13531
  * @tags change-request-content
13295
13532
  * @name UpdateChangeRequestContent
@@ -14479,7 +14716,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
14479
14716
  };
14480
14717
  }>>;
14481
14718
  /**
14482
- * No description
14719
+ * @description Publishes integration code and configuration. GitBook-owned integrations in production require a controlled deployment and cannot be created, updated or transferred through this operation.
14483
14720
  *
14484
14721
  * @tags integrations
14485
14722
  * @name PublishIntegration
@@ -14488,6 +14725,12 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
14488
14725
  * @secure
14489
14726
  */
14490
14727
  publishIntegration: (integrationName: string, data: PublishIntegration, params?: RequestParams) => Promise<HttpResponse<Integration, {
14728
+ error: {
14729
+ /** @format int32 */
14730
+ code: 403;
14731
+ message: string;
14732
+ };
14733
+ } | {
14491
14734
  error: {
14492
14735
  /** @format int32 */
14493
14736
  code: 404;
@@ -14495,7 +14738,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
14495
14738
  };
14496
14739
  }>>;
14497
14740
  /**
14498
- * No description
14741
+ * @description Removes an integration. GitBook-owned production integrations require a controlled deployment and cannot be removed through this operation.
14499
14742
  *
14500
14743
  * @tags integrations
14501
14744
  * @name UnpublishIntegration
@@ -14503,7 +14746,13 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
14503
14746
  * @request DELETE:/integrations/{integrationName}
14504
14747
  * @secure
14505
14748
  */
14506
- unpublishIntegration: (integrationName: string, params?: RequestParams) => Promise<HttpResponse<void, any>>;
14749
+ unpublishIntegration: (integrationName: string, params?: RequestParams) => Promise<HttpResponse<void, {
14750
+ error: {
14751
+ /** @format int32 */
14752
+ code: 403;
14753
+ message: string;
14754
+ };
14755
+ }>>;
14507
14756
  /**
14508
14757
  * No description
14509
14758
  *
@@ -14574,7 +14823,9 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
14574
14823
  * @secure
14575
14824
  */
14576
14825
  getIntegrationEvent: (integrationName: string, eventId: string, params?: RequestParams) => Promise<HttpResponse<{
14826
+ /** Diagnostic metadata for a delivered event, including historical records. The payload is intentionally limited to event type and identifiers; it is not the full runtime event. Events and configuration delivered to the integration runtime are unaffected. */
14577
14827
  event: IntegrationEvent;
14828
+ /** Safe execution metadata. Worker log and exception text are suppressed. */
14578
14829
  trace?: IntegrationEventTrace;
14579
14830
  }, {
14580
14831
  error: {
@@ -14640,7 +14891,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
14640
14891
  items: IntegrationSiteInstallation[];
14641
14892
  }, any>>;
14642
14893
  /**
14643
- * No description
14894
+ * @description Enables a development tunnel. GitBook-owned production integrations cannot enable development mode; previously configured tunnels are ignored when dispatching their events.
14644
14895
  *
14645
14896
  * @tags integrations
14646
14897
  * @name SetIntegrationDevelopmentMode
@@ -14661,6 +14912,12 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
14661
14912
  */
14662
14913
  all?: boolean;
14663
14914
  }, params?: RequestParams) => Promise<HttpResponse<void, {
14915
+ error: {
14916
+ /** @format int32 */
14917
+ code: 403;
14918
+ message: string;
14919
+ };
14920
+ } | {
14664
14921
  error: {
14665
14922
  /** @format int32 */
14666
14923
  code: 404;
@@ -14726,7 +14983,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
14726
14983
  };
14727
14984
  }>>;
14728
14985
  /**
14729
- * @description Returns the organization-level installation of an integration, including its account configuration and how many spaces it manages. The configuration can contain credentials the integration stored for third-party services.
14986
+ * @description Returns the organization-level installation of an integration, including its account configuration and how many spaces it manages. For user authentication, saved OAuth credentials are replaced with a boolean connection indicator.
14730
14987
  *
14731
14988
  * @tags integrations
14732
14989
  * @name GetIntegrationInstallationById
@@ -14777,6 +15034,84 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
14777
15034
  message: string;
14778
15035
  };
14779
15036
  }>>;
15037
+ /**
15038
+ * @description Creates a short-lived, single-use transaction binding an OAuth authorization flow to the authenticated user, the installation and an optional space or site installation. Open the returned `startURL` in the browser that will complete the flow.
15039
+ *
15040
+ * @tags integrations
15041
+ * @name CreateIntegrationOAuthTransaction
15042
+ * @summary Start an OAuth connection for an integration installation
15043
+ * @request POST:/integrations/{integrationName}/installations/{installationId}/oauth-transactions
15044
+ * @secure
15045
+ */
15046
+ createIntegrationOAuthTransaction: (integrationName: string, installationId: string, data?: CreateIntegrationOAuthTransaction, params?: RequestParams) => Promise<HttpResponse<IntegrationOAuthTransactionStart, {
15047
+ error: {
15048
+ /** @format int32 */
15049
+ code: 400;
15050
+ message: string;
15051
+ };
15052
+ } | {
15053
+ error: {
15054
+ /** @format int32 */
15055
+ code: 403;
15056
+ message: string;
15057
+ };
15058
+ } | {
15059
+ error: {
15060
+ /** @format int32 */
15061
+ code: 404;
15062
+ message: string;
15063
+ };
15064
+ }>>;
15065
+ /**
15066
+ * @description Consumes the OAuth transaction whose ID was received as the `state` of an OAuth callback. A transaction can be consumed once, by the integration that it was created for, and only with the authorization code that the user who started the connection confirmed in GitBook. Returns the installation the credentials must be written to, the PKCE code verifier, and a single-use grant to pass as `oauthTransaction` when writing the credentials.
15067
+ *
15068
+ * @tags integrations
15069
+ * @name ConsumeIntegrationOAuthTransaction
15070
+ * @summary Consume an integration OAuth transaction
15071
+ * @request POST:/integrations/{integrationName}/oauth-transactions/{transactionId}/consume
15072
+ * @secure
15073
+ */
15074
+ consumeIntegrationOAuthTransaction: (integrationName: string, transactionId: string, data: ConsumeIntegrationOAuthTransaction, params?: RequestParams) => Promise<HttpResponse<IntegrationOAuthTransaction, {
15075
+ error: {
15076
+ /** @format int32 */
15077
+ code: 403;
15078
+ message: string;
15079
+ };
15080
+ } | {
15081
+ error: {
15082
+ /** @format int32 */
15083
+ code: 404;
15084
+ message: string;
15085
+ };
15086
+ }>>;
15087
+ /**
15088
+ * @description Confirms, as the user who created the transaction, the provider callback GitBook intercepted for it. Returns the callback URL to send the browser back to.
15089
+ *
15090
+ * @tags integrations
15091
+ * @name ConfirmIntegrationOAuthTransaction
15092
+ * @summary Confirm the callback of an integration OAuth transaction
15093
+ * @request POST:/integrations/{integrationName}/oauth-transactions/{transactionId}/confirm
15094
+ * @secure
15095
+ */
15096
+ confirmIntegrationOAuthTransaction: (integrationName: string, transactionId: string, data: ConfirmIntegrationOAuthTransaction, params?: RequestParams) => Promise<HttpResponse<IntegrationOAuthTransactionConfirmation, {
15097
+ error: {
15098
+ /** @format int32 */
15099
+ code: 403;
15100
+ message: string;
15101
+ };
15102
+ } | {
15103
+ error: {
15104
+ /** @format int32 */
15105
+ code: 404;
15106
+ message: string;
15107
+ };
15108
+ } | {
15109
+ error: {
15110
+ /** @format int32 */
15111
+ code: 409;
15112
+ message: string;
15113
+ };
15114
+ }>>;
14780
15115
  /**
14781
15116
  * @description Returns a paginated list of the spaces an installation is enabled on, with the configuration of the integration for each of them. Pass extended to get the full space object instead of its ID.
14782
15117
  *
@@ -14994,9 +15329,17 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
14994
15329
  * @max 1000
14995
15330
  */
14996
15331
  limit?: number;
15332
+ /** The property to sort the list by. With `lastSeenAt`, only the organizations the user has opened are returned, most recently opened first. It returns at most `limit` items with no next page, and cannot be combined with `page`, because the order changes every time the user opens an organization. */
15333
+ sort?: "lastSeenAt";
14997
15334
  }, params?: RequestParams) => Promise<HttpResponse<List & {
14998
15335
  items: Organization[];
14999
- }, any>>;
15336
+ }, {
15337
+ error: {
15338
+ /** @format int32 */
15339
+ code: 400;
15340
+ message: string;
15341
+ };
15342
+ }>>;
15000
15343
  /**
15001
15344
  * No description
15002
15345
  *
@@ -15129,7 +15472,23 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
15129
15472
  actor?: string;
15130
15473
  /** Filter by an exact stable target identifier. */
15131
15474
  target?: string;
15475
+ /** Include matching counts for action and actor options, excluding the option's own filter. */
15476
+ includeFacets?: boolean;
15477
+ /**
15478
+ * Include any of these action names. Combined with other filters using AND.
15479
+ * @maxItems 100
15480
+ */
15481
+ actions?: string[];
15482
+ /**
15483
+ * Include any of these stable actor identifiers, including system actors. Combined with other filters using AND.
15484
+ * @maxItems 100
15485
+ */
15486
+ actors?: string[];
15132
15487
  }, params?: RequestParams) => Promise<HttpResponse<List & {
15488
+ facets?: {
15489
+ actions: Record<string, number>;
15490
+ actors: Record<string, number>;
15491
+ };
15133
15492
  items: AuditEvent[];
15134
15493
  }, {
15135
15494
  error: {
@@ -15205,7 +15564,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
15205
15564
  */
15206
15565
  listStyleguideTemplates: (organizationId: EntityId, params?: RequestParams) => Promise<HttpResponse<StyleguideTemplates, any>>;
15207
15566
  /**
15208
- * No description
15567
+ * @description Lists the members of the organization. Guests can list members too, but the list they get leaves out every guest, themselves included, and filtering by the `guest` role returns no one.
15209
15568
  *
15210
15569
  * @tags organization-members
15211
15570
  * @name ListMembersInOrganizationById
@@ -15240,7 +15599,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
15240
15599
  items: OrganizationMember[];
15241
15600
  }, any>>;
15242
15601
  /**
15243
- * No description
15602
+ * @description Returns a member of the organization. Guests can get any member who isn't a guest, and themselves. Another guest is reported as not found.
15244
15603
  *
15245
15604
  * @tags organization-members, critical
15246
15605
  * @name GetMemberInOrganizationById
@@ -18023,26 +18382,6 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
18023
18382
  * @secure
18024
18383
  */
18025
18384
  getSiteFindingById: (organizationId: EntityId, siteId: string, siteFindingId: string, params?: RequestParams) => Promise<HttpResponse<SiteFinding, any>>;
18026
- /**
18027
- * @description Changes the status of a documentation issue found by GitBook's AI. Refuses `broken-link` findings, whose status follows the redirects at their path. Deprecated in favour of `applySiteFindingAction`, which applies one of the `actions` a finding lists: `mark-resolved`, `ignore`, `reopen` or `restore`.
18028
- *
18029
- * @tags site-context
18030
- * @name UpdateSiteFindingById
18031
- * @summary Resolve, dismiss, or reopen a documentation issue. (Deprecated) use applySiteFindingAction instead.
18032
- * @request PATCH:/orgs/{organizationId}/sites/{siteId}/findings/{siteFindingId}
18033
- * @deprecated
18034
- * @secure
18035
- */
18036
- updateSiteFindingById: (organizationId: EntityId, siteId: string, siteFindingId: string, data: {
18037
- /**
18038
- * Status of a site finding.
18039
- * - `candidate` is a finding that has been raised but not yet confirmed. Typically these are not shown to users.
18040
- * - `open` is a finding that has been surfaced to users and is still under investigation.
18041
- * - `done` is a finding that has been resolved and is no longer under investigation.
18042
- * - `canceled` is a finding that has been canceled and is no longer under investigation.
18043
- */
18044
- status: SiteFindingStatus;
18045
- }, params?: RequestParams) => Promise<HttpResponse<SiteFinding, any>>;
18046
18385
  /**
18047
18386
  * @description Lists the change requests created to fix a documentation issue. Use this to check whether an issue already has a pending or merged fix before triggering a new one.
18048
18387
  *
@@ -18138,7 +18477,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
18138
18477
  items: ContextRecord[];
18139
18478
  }, any>>;
18140
18479
  /**
18141
- * @description Applies one of the `actions` a finding lists, with the site permission it gives: resolve, dismiss or reopen it, or act on a broken link's redirect. Returns 409 when the finding doesn't allow the action now.
18480
+ * @description Applies one of the `actions` a finding lists, with the site permission it gives: resolve, dismiss or reopen it, act on a broken link's redirect, or reject the change request GitBook drafted for an outbound link. Returns 409 when the finding doesn't allow the action now.
18142
18481
  *
18143
18482
  * @tags site-context
18144
18483
  * @name ApplySiteFindingAction
@@ -18149,8 +18488,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
18149
18488
  applySiteFindingAction: (organizationId: EntityId, siteId: string, siteFindingId: string, data: {
18150
18489
  /**
18151
18490
  * An action that moves a finding to another state. A finding's `actions` lists the ones it allows.
18152
- * - `approve` makes the redirect GitBook drafted for a broken link live, which resolves the finding.
18153
- * - `reject` deletes the redirect GitBook drafted for a broken link; the finding stays open and GitBook won't draft a fix for it again.
18491
+ * - `approve` makes the redirect GitBook drafted for a broken link live, which resolves the finding. A change request GitBook drafted for an outbound link is approved by merging it.
18492
+ * - `reject` deletes the redirect GitBook drafted for a broken link; the finding stays open and GitBook won't draft a fix for it again. For an outbound link, it archives the change request GitBook drafted (`awaitingChangeRequest`) and unlinks every link it fixes. They are open again, marked `undone`, and GitBook won't draft a fix for them again.
18154
18493
  * - `create-redirect` creates a redirect for a broken link's path with `createSiteRedirect`, prefilled with the suggestion; it resolves the finding.
18155
18494
  * - `mark-resolved` resolves it. A broken link resolved this way has no redirect: visitors still get a 404.
18156
18495
  * - `reopen` reopens a resolved finding. For a broken link, it deletes the live redirect at its path; for a fix GitBook applied, this undoes the fix and GitBook won't fix the link again.
@@ -18322,6 +18661,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
18322
18661
  channelType?: SiteChannelType[];
18323
18662
  /** Filter by whether a person or an AI agent asked the question. */
18324
18663
  visitorType?: SiteQuestionVisitorType[];
18664
+ /** Filter to answers that cited one of these pages as a source, each given as `{spaceId}/{pageId}`. */
18665
+ citedPage?: string[];
18325
18666
  /** Filter stats by answer resolution. */
18326
18667
  answered?: SiteQuestionAnswerResolution[];
18327
18668
  }, params?: RequestParams) => Promise<HttpResponse<{
@@ -18381,6 +18722,10 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
18381
18722
  channelType?: SiteChannelType[];
18382
18723
  /** Filter by whether a person or an AI agent asked the question. */
18383
18724
  visitorType?: SiteQuestionVisitorType[];
18725
+ /** Filter to answers that cited one of these pages as a source, each given as `{spaceId}/{pageId}`. */
18726
+ citedPage?: string[];
18727
+ /** Filter questions whose text contains this value. */
18728
+ search?: string;
18384
18729
  /** Filter questions by answer resolution. */
18385
18730
  answered?: SiteQuestionAnswerResolution[];
18386
18731
  /** Filter questions by associated site topic IDs. */
@@ -18481,9 +18826,40 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
18481
18826
  channelType?: SiteChannelType[];
18482
18827
  /** Filter by whether a person or an AI agent asked the question. */
18483
18828
  visitorType?: SiteQuestionVisitorType[];
18829
+ /** Filter to answers that cited one of these pages as a source, each given as `{spaceId}/{pageId}`. */
18830
+ citedPage?: string[];
18484
18831
  /** Filter stats by answer resolution. */
18485
18832
  answered?: SiteQuestionAnswerResolution[];
18486
18833
  }, params?: RequestParams) => Promise<HttpResponse<SiteQuestionStats, any>>;
18834
+ /**
18835
+ * @description Returns how many answers the site's Ask AI assistant gave, and to how many visitors, in each UTC bucket of the interval between `from` and `to`, optionally filtered by topic, relevance, channel, visitor type or resolution. Buckets without answers are omitted.
18836
+ *
18837
+ * @tags site-questions
18838
+ * @name GetSiteQuestionTimeline
18839
+ * @summary Get Ask AI answers over time for a site
18840
+ * @request GET:/orgs/{organizationId}/sites/{siteId}/question-timeline
18841
+ * @secure
18842
+ */
18843
+ getSiteQuestionTimeline: (organizationId: EntityId, siteId: string, query: {
18844
+ /** Count answers created at or after this timestamp. */
18845
+ from: Timestamp;
18846
+ /** Count answers created at or before this timestamp. */
18847
+ to: Timestamp;
18848
+ /** Size of each bucket. An hourly timeline covers at most 31 days. */
18849
+ interval: SiteQuestionTimelineInterval;
18850
+ /** Filter answers by associated site topic IDs. */
18851
+ topic?: string[];
18852
+ /** Filter answers by question relevance. */
18853
+ relevance?: SiteQuestionAnswerRelevance[];
18854
+ /** Filter answers by channel type. */
18855
+ channelType?: SiteChannelType[];
18856
+ /** Filter by whether a person or an AI agent asked the question. */
18857
+ visitorType?: SiteQuestionVisitorType[];
18858
+ /** Filter to answers that cited one of these pages as a source, each given as `{spaceId}/{pageId}`. */
18859
+ citedPage?: string[];
18860
+ /** Filter answers by resolution. */
18861
+ answered?: SiteQuestionAnswerResolution[];
18862
+ }, params?: RequestParams) => Promise<HttpResponse<SiteQuestionTimeline, any>>;
18487
18863
  /**
18488
18864
  * @description Returns a paginated list of individual Ask AI answers generated for a site. Each is the assistant's response to a specific asked question, with the raw question text, channel, and feedback. Use it to review answer quality and what users asked across the site.
18489
18865
  *
@@ -18661,6 +19037,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
18661
19037
  theme?: CustomizationTheme | null;
18662
19038
  /** The primary color used for links and UI text. Set to null to reset the override. */
18663
19039
  primaryColor?: CustomizationThemedColor | null;
19040
+ /** The secondary brand color used for secondary buttons and content colored with `$secondary`. Set to null to reset the override. */
19041
+ secondaryColor?: CustomizationThemedColor | null;
18664
19042
  /** Used for informational messages and neutral alerts. Set to null to reset the override. */
18665
19043
  infoColor?: CustomizationThemedColor | null;
18666
19044
  /** Used for showing positive actions or achievements. Set to null to reset the override. */
@@ -18669,8 +19047,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
18669
19047
  warningColor?: CustomizationThemedColor | null;
18670
19048
  /** Used for destructive actions or raising attention to critical information. Set to null to reset the override. */
18671
19049
  dangerColor?: CustomizationThemedColor | null;
18672
- /** The tint will color the site’s UI beyond links and buttons, such as header, sidebar and background. By default, the tint colour is the same as your Primary colour, but you can set a custom one too. */
18673
- tint?: CustomizationTint | null;
19050
+ /** The tint will color the site’s UI beyond links and buttons, such as header, sidebar and background. By default, the tint colour is the same as your Primary colour, but you can set a custom one too. Set to false to remove the tint from this site space, or to null to reset the override. */
19051
+ tint?: CustomizationTint | false | null;
18674
19052
  /** The style of the corners to use. Set to null to reset the override. */
18675
19053
  corners?: CustomizationCorners | null;
18676
19054
  /** The depth of elements on the site. Set to null to reset the override. */