@gitbook/api 0.15.0 → 0.17.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/GitBookAPIError.d.ts +18 -0
- package/dist/client.d.ts +210 -10
- package/dist/index.cjs +136 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.js +133 -6
- package/package.json +1 -1
- package/spec/openapi.json +900 -71
- package/spec/openapi.yaml +516 -38
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when the GitBook API returns an error.
|
|
3
|
+
*/
|
|
4
|
+
export declare class GitBookAPIError extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* The response that caused the error.
|
|
7
|
+
*/
|
|
8
|
+
readonly response: Response;
|
|
9
|
+
/**
|
|
10
|
+
* Name of the error type.
|
|
11
|
+
*/
|
|
12
|
+
readonly name = "GitBookAPIError";
|
|
13
|
+
/**
|
|
14
|
+
* The HTTP status code of the response.
|
|
15
|
+
*/
|
|
16
|
+
readonly code: number;
|
|
17
|
+
constructor(errorMessage: string, response: Response);
|
|
18
|
+
}
|
package/dist/client.d.ts
CHANGED
|
@@ -983,6 +983,7 @@ export declare type RevisionPageDocument = RevisionPageBase & Document & {
|
|
|
983
983
|
slug: string;
|
|
984
984
|
path: string;
|
|
985
985
|
description?: string;
|
|
986
|
+
documentId?: string;
|
|
986
987
|
pages: (RevisionPageDocument | RevisionPageLink)[];
|
|
987
988
|
git?: GitSyncBlob;
|
|
988
989
|
};
|
|
@@ -1443,7 +1444,7 @@ export interface Capture {
|
|
|
1443
1444
|
*/
|
|
1444
1445
|
export declare type CaptureTitle = string;
|
|
1445
1446
|
export declare type CaptureEvent = CaptureTerminalCommandEvent | CaptureSpeechEvent | CaptureThreadMessageEvent | CaptureFileAddedEvent | CaptureFileChangedEvent | CaptureFileRemovedEvent;
|
|
1446
|
-
export declare type CaptureContext = '
|
|
1447
|
+
export declare type CaptureContext = 'thread' | 'walkthrough' | 'document';
|
|
1447
1448
|
export interface BaseCaptureEvent {
|
|
1448
1449
|
/** The type of event */
|
|
1449
1450
|
type: string;
|
|
@@ -1497,6 +1498,29 @@ export interface UpdateCaptureSchema {
|
|
|
1497
1498
|
/** Content of the capture. */
|
|
1498
1499
|
body?: Document;
|
|
1499
1500
|
}
|
|
1501
|
+
export declare type Snippet = Document & {
|
|
1502
|
+
id: string;
|
|
1503
|
+
createdAt: string;
|
|
1504
|
+
editedAt?: string;
|
|
1505
|
+
title?: string;
|
|
1506
|
+
source: {
|
|
1507
|
+
sourceId: string;
|
|
1508
|
+
name: string;
|
|
1509
|
+
externalId?: string;
|
|
1510
|
+
externalUrl?: URL;
|
|
1511
|
+
};
|
|
1512
|
+
contributors: (Integration | User)[];
|
|
1513
|
+
urls: {
|
|
1514
|
+
location: URL;
|
|
1515
|
+
app: URL;
|
|
1516
|
+
};
|
|
1517
|
+
};
|
|
1518
|
+
export interface UpdateSnippetSchema {
|
|
1519
|
+
/** A new title for the snippet. */
|
|
1520
|
+
title?: string;
|
|
1521
|
+
/** Content of the snippet. */
|
|
1522
|
+
body?: Document;
|
|
1523
|
+
}
|
|
1500
1524
|
/**
|
|
1501
1525
|
* Content audit relation
|
|
1502
1526
|
*/
|
|
@@ -1516,11 +1540,17 @@ export interface ContentAuditRelation {
|
|
|
1516
1540
|
/**
|
|
1517
1541
|
* The type of the relation between the sources
|
|
1518
1542
|
*/
|
|
1519
|
-
export declare
|
|
1543
|
+
export declare enum ContentAuditRelationType {
|
|
1544
|
+
Contradiction = "contradiction",
|
|
1545
|
+
Duplicate = "duplicate"
|
|
1546
|
+
}
|
|
1520
1547
|
/**
|
|
1521
1548
|
* Status of the audit relation to filter on
|
|
1522
1549
|
*/
|
|
1523
|
-
export declare
|
|
1550
|
+
export declare enum ContentAuditRelationStatus {
|
|
1551
|
+
Pending = "pending",
|
|
1552
|
+
Rejected = "rejected"
|
|
1553
|
+
}
|
|
1524
1554
|
export interface ContentAuditRelationStatusUpdate {
|
|
1525
1555
|
/** Status of the audit relation to filter on */
|
|
1526
1556
|
status: ContentAuditRelationStatus;
|
|
@@ -1897,6 +1927,7 @@ export declare type IntegrationSummary = string;
|
|
|
1897
1927
|
export declare type IntegrationScopes = IntegrationScope[];
|
|
1898
1928
|
export declare enum IntegrationScope {
|
|
1899
1929
|
EntitiesWrite = "entities:write",
|
|
1930
|
+
SnippetsRead = "snippets:read",
|
|
1900
1931
|
CaptureWrite = "capture:write",
|
|
1901
1932
|
SpaceViewsRead = "space:views:read",
|
|
1902
1933
|
SpaceContentRead = "space:content:read",
|
|
@@ -3696,11 +3727,22 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
3696
3727
|
* @secure
|
|
3697
3728
|
*/
|
|
3698
3729
|
importContent: (spaceId: string, data: RequestImportContent, params?: RequestParams) => Promise<HttpResponse<ImportContentResult, Error>>;
|
|
3730
|
+
/**
|
|
3731
|
+
* No description
|
|
3732
|
+
*
|
|
3733
|
+
* @name ListPages
|
|
3734
|
+
* @summary List all pages for the main revision content of a space
|
|
3735
|
+
* @request GET:/spaces/{spaceId}/content/pages
|
|
3736
|
+
* @secure
|
|
3737
|
+
*/
|
|
3738
|
+
listPages: (spaceId: string, params?: RequestParams) => Promise<HttpResponse<{
|
|
3739
|
+
pages: RevisionPage[];
|
|
3740
|
+
}, Error>>;
|
|
3699
3741
|
/**
|
|
3700
3742
|
* No description
|
|
3701
3743
|
*
|
|
3702
3744
|
* @name ListFiles
|
|
3703
|
-
* @summary List all files for the
|
|
3745
|
+
* @summary List all files for the main revision content of a space
|
|
3704
3746
|
* @request GET:/spaces/{spaceId}/content/files
|
|
3705
3747
|
* @secure
|
|
3706
3748
|
*/
|
|
@@ -3710,6 +3752,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
3710
3752
|
}, params?: RequestParams) => Promise<HttpResponse<List & {
|
|
3711
3753
|
items: RevisionFile[];
|
|
3712
3754
|
}, Error>>;
|
|
3755
|
+
/**
|
|
3756
|
+
* No description
|
|
3757
|
+
*
|
|
3758
|
+
* @name GetFileById
|
|
3759
|
+
* @summary Get a file by its ID in the main revision of a space
|
|
3760
|
+
* @request GET:/spaces/{spaceId}/content/files/{fileId}
|
|
3761
|
+
* @secure
|
|
3762
|
+
*/
|
|
3763
|
+
getFileById: (spaceId: string, fileId: string, params?: RequestParams) => Promise<HttpResponse<RevisionFile, Error>>;
|
|
3713
3764
|
/**
|
|
3714
3765
|
* No description
|
|
3715
3766
|
*
|
|
@@ -3741,6 +3792,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
3741
3792
|
getPageByPath: (spaceId: string, pagePath: string, query?: {
|
|
3742
3793
|
format?: 'document' | 'markdown';
|
|
3743
3794
|
}, params?: RequestParams) => Promise<HttpResponse<RevisionPageDocument | RevisionPageGroup, Error>>;
|
|
3795
|
+
/**
|
|
3796
|
+
* No description
|
|
3797
|
+
*
|
|
3798
|
+
* @name GetDocumentById
|
|
3799
|
+
* @summary Get a document by its ID in a space.
|
|
3800
|
+
* @request GET:/spaces/{spaceId}/documents/{documentId}
|
|
3801
|
+
* @secure
|
|
3802
|
+
*/
|
|
3803
|
+
getDocumentById: (spaceId: string, documentId: string, params?: RequestParams) => Promise<HttpResponse<JSONDocument, Error>>;
|
|
3744
3804
|
/**
|
|
3745
3805
|
* No description
|
|
3746
3806
|
*
|
|
@@ -4028,11 +4088,22 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
4028
4088
|
* @secure
|
|
4029
4089
|
*/
|
|
4030
4090
|
importContentInChangeRequest: (spaceId: string, changeRequestId: string | number, data: RequestImportContent, params?: RequestParams) => Promise<HttpResponse<ImportContentResult, Error>>;
|
|
4091
|
+
/**
|
|
4092
|
+
* No description
|
|
4093
|
+
*
|
|
4094
|
+
* @name ListPagesInChangeRequest
|
|
4095
|
+
* @summary List all pages in the content of a change request
|
|
4096
|
+
* @request GET:/spaces/{spaceId}/change-requests/{changeRequestId}/content/pages
|
|
4097
|
+
* @secure
|
|
4098
|
+
*/
|
|
4099
|
+
listPagesInChangeRequest: (spaceId: string, changeRequestId: string | number, params?: RequestParams) => Promise<HttpResponse<{
|
|
4100
|
+
pages: RevisionPage[];
|
|
4101
|
+
}, Error>>;
|
|
4031
4102
|
/**
|
|
4032
4103
|
* No description
|
|
4033
4104
|
*
|
|
4034
4105
|
* @name ListFilesInChangeRequestById
|
|
4035
|
-
* @summary List all files in
|
|
4106
|
+
* @summary List all files in a change request content
|
|
4036
4107
|
* @request GET:/spaces/{spaceId}/change-requests/{changeRequestId}/content/files
|
|
4037
4108
|
* @secure
|
|
4038
4109
|
*/
|
|
@@ -4042,6 +4113,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
4042
4113
|
}, params?: RequestParams) => Promise<HttpResponse<List & {
|
|
4043
4114
|
items: RevisionFile[];
|
|
4044
4115
|
}, Error>>;
|
|
4116
|
+
/**
|
|
4117
|
+
* No description
|
|
4118
|
+
*
|
|
4119
|
+
* @name GetFileInChangeRequestById
|
|
4120
|
+
* @summary Get a file by its ID in the content of a change request
|
|
4121
|
+
* @request GET:/spaces/{spaceId}/change-requests/{changeRequestId}/content/files/{fileId}
|
|
4122
|
+
* @secure
|
|
4123
|
+
*/
|
|
4124
|
+
getFileInChangeRequestById: (spaceId: string, changeRequestId: string | number, fileId: string, params?: RequestParams) => Promise<HttpResponse<RevisionFile, Error>>;
|
|
4045
4125
|
/**
|
|
4046
4126
|
* No description
|
|
4047
4127
|
*
|
|
@@ -4097,6 +4177,17 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
4097
4177
|
changes: RevisionSemanticChange[];
|
|
4098
4178
|
more?: number;
|
|
4099
4179
|
}, Error>>;
|
|
4180
|
+
/**
|
|
4181
|
+
* No description
|
|
4182
|
+
*
|
|
4183
|
+
* @name ListPagesInRevisionById
|
|
4184
|
+
* @summary List all pages in a revision
|
|
4185
|
+
* @request GET:/spaces/{spaceId}/revisions/{revisionId}/pages
|
|
4186
|
+
* @secure
|
|
4187
|
+
*/
|
|
4188
|
+
listPagesInRevisionById: (spaceId: string, revisionId: string, params?: RequestParams) => Promise<HttpResponse<{
|
|
4189
|
+
pages: RevisionPage[];
|
|
4190
|
+
}, Error>>;
|
|
4100
4191
|
/**
|
|
4101
4192
|
* No description
|
|
4102
4193
|
*
|
|
@@ -4111,6 +4202,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
4111
4202
|
}, params?: RequestParams) => Promise<HttpResponse<List & {
|
|
4112
4203
|
items: RevisionFile[];
|
|
4113
4204
|
}, Error>>;
|
|
4205
|
+
/**
|
|
4206
|
+
* No description
|
|
4207
|
+
*
|
|
4208
|
+
* @name GetFileInRevisionById
|
|
4209
|
+
* @summary Get a file in a revision by its ID
|
|
4210
|
+
* @request GET:/spaces/{spaceId}/revisions/{revisionId}/files/{fileId}
|
|
4211
|
+
* @secure
|
|
4212
|
+
*/
|
|
4213
|
+
getFileInRevisionById: (spaceId: string, revisionId: string, fileId: string, params?: RequestParams) => Promise<HttpResponse<RevisionFile, Error>>;
|
|
4114
4214
|
/**
|
|
4115
4215
|
* No description
|
|
4116
4216
|
*
|
|
@@ -4956,6 +5056,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
4956
5056
|
listTeamsInOrganizationById: (organizationId: string, query?: {
|
|
4957
5057
|
page?: string;
|
|
4958
5058
|
limit?: number;
|
|
5059
|
+
owner?: string;
|
|
4959
5060
|
title?: string;
|
|
4960
5061
|
}, params?: RequestParams) => Promise<HttpResponse<List & {
|
|
4961
5062
|
items: OrganizationTeam[];
|
|
@@ -5349,6 +5450,23 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
5349
5450
|
}, params?: RequestParams) => Promise<HttpResponse<List & {
|
|
5350
5451
|
items: Integration[];
|
|
5351
5452
|
}, Error>>;
|
|
5453
|
+
/**
|
|
5454
|
+
* No description
|
|
5455
|
+
*
|
|
5456
|
+
* @tags integrations
|
|
5457
|
+
* @name GetOrganizationIntegrationStatus
|
|
5458
|
+
* @summary Get the status of an integration installation in an organization
|
|
5459
|
+
* @request GET:/orgs/{organizationId}/integrations/{integrationName}/installation_status
|
|
5460
|
+
* @secure
|
|
5461
|
+
*/
|
|
5462
|
+
getOrganizationIntegrationStatus: (organizationId: string, integrationName: string, params?: RequestParams) => Promise<HttpResponse<{
|
|
5463
|
+
status: IntegrationInstallationStatus;
|
|
5464
|
+
}, Error | {
|
|
5465
|
+
error: {
|
|
5466
|
+
code: 404;
|
|
5467
|
+
message: string;
|
|
5468
|
+
};
|
|
5469
|
+
}>>;
|
|
5352
5470
|
/**
|
|
5353
5471
|
* No description
|
|
5354
5472
|
*
|
|
@@ -5456,8 +5574,9 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
5456
5574
|
*
|
|
5457
5575
|
* @tags organizations
|
|
5458
5576
|
* @name ListCaptures
|
|
5459
|
-
* @summary List captures
|
|
5577
|
+
* @summary List captures. Deprecated, use listSnippets instead.
|
|
5460
5578
|
* @request GET:/orgs/{organizationId}/captures
|
|
5579
|
+
* @deprecated
|
|
5461
5580
|
* @secure
|
|
5462
5581
|
*/
|
|
5463
5582
|
listCaptures: (organizationId: string, query?: {
|
|
@@ -5488,8 +5607,9 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
5488
5607
|
*
|
|
5489
5608
|
* @tags organizations
|
|
5490
5609
|
* @name GetCapture
|
|
5491
|
-
* @summary Get a capture by its ID
|
|
5610
|
+
* @summary Get a capture by its ID. Deprecated, use getSnippet instead.
|
|
5492
5611
|
* @request GET:/orgs/{organizationId}/captures/{captureId}
|
|
5612
|
+
* @deprecated
|
|
5493
5613
|
* @secure
|
|
5494
5614
|
*/
|
|
5495
5615
|
getCapture: (organizationId: string, captureId: string, query?: {
|
|
@@ -5500,8 +5620,9 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
5500
5620
|
*
|
|
5501
5621
|
* @tags organizations
|
|
5502
5622
|
* @name DeleteCapture
|
|
5503
|
-
* @summary Delete a capture by its ID
|
|
5623
|
+
* @summary Delete a capture by its ID. Deprecated, use deleteSnippet.
|
|
5504
5624
|
* @request DELETE:/orgs/{organizationId}/captures/{captureId}
|
|
5625
|
+
* @deprecated
|
|
5505
5626
|
* @secure
|
|
5506
5627
|
*/
|
|
5507
5628
|
deleteCapture: (organizationId: string, captureId: string, params?: RequestParams) => Promise<HttpResponse<void, Error>>;
|
|
@@ -5510,8 +5631,9 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
5510
5631
|
*
|
|
5511
5632
|
* @tags organizations
|
|
5512
5633
|
* @name UpdateCapture
|
|
5513
|
-
* @summary Update an existing capture
|
|
5634
|
+
* @summary Update an existing capture. Deprecated, use updateSnippet.
|
|
5514
5635
|
* @request PUT:/orgs/{organizationId}/captures/{captureId}
|
|
5636
|
+
* @deprecated
|
|
5515
5637
|
* @secure
|
|
5516
5638
|
*/
|
|
5517
5639
|
updateCapture: (organizationId: string, captureId: string, data: UpdateCaptureSchema, params?: RequestParams) => Promise<HttpResponse<Capture, Error>>;
|
|
@@ -5542,6 +5664,65 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
5542
5664
|
capture: Capture;
|
|
5543
5665
|
followupQuestions?: string[];
|
|
5544
5666
|
}, Error>>;
|
|
5667
|
+
/**
|
|
5668
|
+
* @description List snippets in an organization, newest first.
|
|
5669
|
+
*
|
|
5670
|
+
* @tags organizations
|
|
5671
|
+
* @name ListSnippets
|
|
5672
|
+
* @summary Lists snippets.
|
|
5673
|
+
* @request GET:/orgs/{organizationId}/snippets
|
|
5674
|
+
* @secure
|
|
5675
|
+
*/
|
|
5676
|
+
listSnippets: (organizationId: string, query?: {
|
|
5677
|
+
format?: 'document' | 'markdown';
|
|
5678
|
+
page?: string;
|
|
5679
|
+
limit?: number;
|
|
5680
|
+
source?: string;
|
|
5681
|
+
}, params?: RequestParams) => Promise<HttpResponse<List & {
|
|
5682
|
+
items: Snippet[];
|
|
5683
|
+
}, Error>>;
|
|
5684
|
+
/**
|
|
5685
|
+
* No description
|
|
5686
|
+
*
|
|
5687
|
+
* @tags organizations
|
|
5688
|
+
* @name CreateSnippet
|
|
5689
|
+
* @summary Create a new snippet
|
|
5690
|
+
* @request POST:/orgs/{organizationId}/snippets
|
|
5691
|
+
* @secure
|
|
5692
|
+
*/
|
|
5693
|
+
createSnippet: (organizationId: string, data: object, params?: RequestParams) => Promise<HttpResponse<Snippet, Error>>;
|
|
5694
|
+
/**
|
|
5695
|
+
* No description
|
|
5696
|
+
*
|
|
5697
|
+
* @tags organizations
|
|
5698
|
+
* @name GetSnippet
|
|
5699
|
+
* @summary Get a snippet by its ID
|
|
5700
|
+
* @request GET:/orgs/{organizationId}/snippets/{snippetId}
|
|
5701
|
+
* @secure
|
|
5702
|
+
*/
|
|
5703
|
+
getSnippet: (organizationId: string, snippetId: string, query?: {
|
|
5704
|
+
format?: 'document' | 'markdown';
|
|
5705
|
+
}, params?: RequestParams) => Promise<HttpResponse<Snippet, Error>>;
|
|
5706
|
+
/**
|
|
5707
|
+
* No description
|
|
5708
|
+
*
|
|
5709
|
+
* @tags organizations
|
|
5710
|
+
* @name DeleteSnippet
|
|
5711
|
+
* @summary Delete a snippet by its ID.
|
|
5712
|
+
* @request DELETE:/orgs/{organizationId}/snippets/{snippetId}
|
|
5713
|
+
* @secure
|
|
5714
|
+
*/
|
|
5715
|
+
deleteSnippet: (organizationId: string, snippetId: string, params?: RequestParams) => Promise<HttpResponse<void, Error>>;
|
|
5716
|
+
/**
|
|
5717
|
+
* No description
|
|
5718
|
+
*
|
|
5719
|
+
* @tags organizations
|
|
5720
|
+
* @name UpdateSnippet
|
|
5721
|
+
* @summary Update an existing snippet.
|
|
5722
|
+
* @request PUT:/orgs/{organizationId}/snippets/{snippetId}
|
|
5723
|
+
* @secure
|
|
5724
|
+
*/
|
|
5725
|
+
updateSnippet: (organizationId: string, snippetId: string, data: UpdateSnippetSchema, params?: RequestParams) => Promise<HttpResponse<Snippet, Error>>;
|
|
5545
5726
|
/**
|
|
5546
5727
|
* No description
|
|
5547
5728
|
*
|
|
@@ -5565,7 +5746,9 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
5565
5746
|
listContentAuditRelations: (organizationId: string, query?: {
|
|
5566
5747
|
page?: string;
|
|
5567
5748
|
limit?: number;
|
|
5568
|
-
status?: ContentAuditRelationStatus;
|
|
5749
|
+
status?: ContentAuditRelationStatus | 'all';
|
|
5750
|
+
space?: string;
|
|
5751
|
+
type?: ContentAuditRelationType | 'all';
|
|
5569
5752
|
}, params?: RequestParams) => Promise<HttpResponse<List & {
|
|
5570
5753
|
items: ContentAuditRelation[];
|
|
5571
5754
|
}, Error>>;
|
|
@@ -5584,6 +5767,23 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
5584
5767
|
message: string;
|
|
5585
5768
|
};
|
|
5586
5769
|
}>>;
|
|
5770
|
+
/**
|
|
5771
|
+
* No description
|
|
5772
|
+
*
|
|
5773
|
+
* @tags organizations
|
|
5774
|
+
* @name GetContentAuditSourceContentById
|
|
5775
|
+
* @summary Get the content of an audit source
|
|
5776
|
+
* @request GET:/orgs/{organizationId}/insights/audit-sources/{sourceId}/content
|
|
5777
|
+
* @secure
|
|
5778
|
+
*/
|
|
5779
|
+
getContentAuditSourceContentById: (organizationId: string, sourceId: string, query?: {
|
|
5780
|
+
format?: 'document' | 'markdown';
|
|
5781
|
+
}, params?: RequestParams) => Promise<HttpResponse<Document, Error | {
|
|
5782
|
+
error: {
|
|
5783
|
+
code: 404;
|
|
5784
|
+
message: string;
|
|
5785
|
+
};
|
|
5786
|
+
}>>;
|
|
5587
5787
|
};
|
|
5588
5788
|
internal: {
|
|
5589
5789
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,8 @@ __export(src_exports, {
|
|
|
30
30
|
CloudflareHostnameStatus: () => CloudflareHostnameStatus,
|
|
31
31
|
CloudflareHostnameTLSStatus: () => CloudflareHostnameTLSStatus,
|
|
32
32
|
CloudflareHostnameTLSValidationMethod: () => CloudflareHostnameTLSValidationMethod,
|
|
33
|
+
ContentAuditRelationStatus: () => ContentAuditRelationStatus,
|
|
34
|
+
ContentAuditRelationType: () => ContentAuditRelationType,
|
|
33
35
|
ContentKitIcon: () => ContentKitIcon,
|
|
34
36
|
ContentType: () => ContentType,
|
|
35
37
|
ContentVisibility: () => ContentVisibility,
|
|
@@ -41,6 +43,7 @@ __export(src_exports, {
|
|
|
41
43
|
CustomizationThemeMode: () => CustomizationThemeMode,
|
|
42
44
|
GITBOOK_DEFAULT_ENDPOINT: () => GITBOOK_DEFAULT_ENDPOINT,
|
|
43
45
|
GitBookAPI: () => GitBookAPI,
|
|
46
|
+
GitBookAPIError: () => GitBookAPIError,
|
|
44
47
|
GitSyncOperationState: () => GitSyncOperationState,
|
|
45
48
|
HttpClient: () => HttpClient,
|
|
46
49
|
ImportContentSource: () => ImportContentSource,
|
|
@@ -156,6 +159,16 @@ var TeamMemberRole = /* @__PURE__ */ ((TeamMemberRole2) => {
|
|
|
156
159
|
TeamMemberRole2["Member"] = "member";
|
|
157
160
|
return TeamMemberRole2;
|
|
158
161
|
})(TeamMemberRole || {});
|
|
162
|
+
var ContentAuditRelationType = /* @__PURE__ */ ((ContentAuditRelationType2) => {
|
|
163
|
+
ContentAuditRelationType2["Contradiction"] = "contradiction";
|
|
164
|
+
ContentAuditRelationType2["Duplicate"] = "duplicate";
|
|
165
|
+
return ContentAuditRelationType2;
|
|
166
|
+
})(ContentAuditRelationType || {});
|
|
167
|
+
var ContentAuditRelationStatus = /* @__PURE__ */ ((ContentAuditRelationStatus2) => {
|
|
168
|
+
ContentAuditRelationStatus2["Pending"] = "pending";
|
|
169
|
+
ContentAuditRelationStatus2["Rejected"] = "rejected";
|
|
170
|
+
return ContentAuditRelationStatus2;
|
|
171
|
+
})(ContentAuditRelationStatus || {});
|
|
159
172
|
var ChangeRequestStatus = /* @__PURE__ */ ((ChangeRequestStatus2) => {
|
|
160
173
|
ChangeRequestStatus2["Draft"] = "draft";
|
|
161
174
|
ChangeRequestStatus2["Open"] = "open";
|
|
@@ -182,6 +195,7 @@ var AnalyticsTrafficInterval = /* @__PURE__ */ ((AnalyticsTrafficInterval2) => {
|
|
|
182
195
|
})(AnalyticsTrafficInterval || {});
|
|
183
196
|
var IntegrationScope = /* @__PURE__ */ ((IntegrationScope2) => {
|
|
184
197
|
IntegrationScope2["EntitiesWrite"] = "entities:write";
|
|
198
|
+
IntegrationScope2["SnippetsRead"] = "snippets:read";
|
|
185
199
|
IntegrationScope2["CaptureWrite"] = "capture:write";
|
|
186
200
|
IntegrationScope2["SpaceViewsRead"] = "space:views:read";
|
|
187
201
|
IntegrationScope2["SpaceContentRead"] = "space:content:read";
|
|
@@ -686,11 +700,26 @@ var Api = class extends HttpClient {
|
|
|
686
700
|
format: "json",
|
|
687
701
|
...params
|
|
688
702
|
}),
|
|
703
|
+
listPages: (spaceId, params = {}) => this.request({
|
|
704
|
+
path: `/spaces/${spaceId}/content/pages`,
|
|
705
|
+
method: "GET",
|
|
706
|
+
secure: true,
|
|
707
|
+
format: "json",
|
|
708
|
+
...params
|
|
709
|
+
}),
|
|
689
710
|
listFiles: (spaceId, query, params = {}) => this.request({
|
|
690
711
|
path: `/spaces/${spaceId}/content/files`,
|
|
691
712
|
method: "GET",
|
|
692
713
|
query,
|
|
693
714
|
secure: true,
|
|
715
|
+
format: "json",
|
|
716
|
+
...params
|
|
717
|
+
}),
|
|
718
|
+
getFileById: (spaceId, fileId, params = {}) => this.request({
|
|
719
|
+
path: `/spaces/${spaceId}/content/files/${fileId}`,
|
|
720
|
+
method: "GET",
|
|
721
|
+
secure: true,
|
|
722
|
+
format: "json",
|
|
694
723
|
...params
|
|
695
724
|
}),
|
|
696
725
|
getPageById: (spaceId, pageId, query, params = {}) => this.request({
|
|
@@ -718,6 +747,13 @@ var Api = class extends HttpClient {
|
|
|
718
747
|
format: "json",
|
|
719
748
|
...params
|
|
720
749
|
}),
|
|
750
|
+
getDocumentById: (spaceId, documentId, params = {}) => this.request({
|
|
751
|
+
path: `/spaces/${spaceId}/documents/${documentId}`,
|
|
752
|
+
method: "GET",
|
|
753
|
+
secure: true,
|
|
754
|
+
format: "json",
|
|
755
|
+
...params
|
|
756
|
+
}),
|
|
721
757
|
createChangeRequest: (spaceId, data, params = {}) => this.request({
|
|
722
758
|
path: `/spaces/${spaceId}/change-requests`,
|
|
723
759
|
method: "POST",
|
|
@@ -894,11 +930,26 @@ var Api = class extends HttpClient {
|
|
|
894
930
|
format: "json",
|
|
895
931
|
...params
|
|
896
932
|
}),
|
|
933
|
+
listPagesInChangeRequest: (spaceId, changeRequestId, params = {}) => this.request({
|
|
934
|
+
path: `/spaces/${spaceId}/change-requests/${changeRequestId}/content/pages`,
|
|
935
|
+
method: "GET",
|
|
936
|
+
secure: true,
|
|
937
|
+
format: "json",
|
|
938
|
+
...params
|
|
939
|
+
}),
|
|
897
940
|
listFilesInChangeRequestById: (spaceId, changeRequestId, query, params = {}) => this.request({
|
|
898
941
|
path: `/spaces/${spaceId}/change-requests/${changeRequestId}/content/files`,
|
|
899
942
|
method: "GET",
|
|
900
943
|
query,
|
|
901
944
|
secure: true,
|
|
945
|
+
format: "json",
|
|
946
|
+
...params
|
|
947
|
+
}),
|
|
948
|
+
getFileInChangeRequestById: (spaceId, changeRequestId, fileId, params = {}) => this.request({
|
|
949
|
+
path: `/spaces/${spaceId}/change-requests/${changeRequestId}/content/files/${fileId}`,
|
|
950
|
+
method: "GET",
|
|
951
|
+
secure: true,
|
|
952
|
+
format: "json",
|
|
902
953
|
...params
|
|
903
954
|
}),
|
|
904
955
|
getPageInChangeRequestById: (spaceId, changeRequestId, pageId, query, params = {}) => this.request({
|
|
@@ -941,11 +992,26 @@ var Api = class extends HttpClient {
|
|
|
941
992
|
format: "json",
|
|
942
993
|
...params
|
|
943
994
|
}),
|
|
995
|
+
listPagesInRevisionById: (spaceId, revisionId, params = {}) => this.request({
|
|
996
|
+
path: `/spaces/${spaceId}/revisions/${revisionId}/pages`,
|
|
997
|
+
method: "GET",
|
|
998
|
+
secure: true,
|
|
999
|
+
format: "json",
|
|
1000
|
+
...params
|
|
1001
|
+
}),
|
|
944
1002
|
listFilesInRevisionById: (spaceId, revisionId, query, params = {}) => this.request({
|
|
945
1003
|
path: `/spaces/${spaceId}/revisions/${revisionId}/files`,
|
|
946
1004
|
method: "GET",
|
|
947
1005
|
query,
|
|
948
1006
|
secure: true,
|
|
1007
|
+
format: "json",
|
|
1008
|
+
...params
|
|
1009
|
+
}),
|
|
1010
|
+
getFileInRevisionById: (spaceId, revisionId, fileId, params = {}) => this.request({
|
|
1011
|
+
path: `/spaces/${spaceId}/revisions/${revisionId}/files/${fileId}`,
|
|
1012
|
+
method: "GET",
|
|
1013
|
+
secure: true,
|
|
1014
|
+
format: "json",
|
|
949
1015
|
...params
|
|
950
1016
|
}),
|
|
951
1017
|
getPageInRevisionById: (spaceId, revisionId, pageId, query, params = {}) => this.request({
|
|
@@ -1677,6 +1743,13 @@ var Api = class extends HttpClient {
|
|
|
1677
1743
|
format: "json",
|
|
1678
1744
|
...params
|
|
1679
1745
|
}),
|
|
1746
|
+
getOrganizationIntegrationStatus: (organizationId, integrationName, params = {}) => this.request({
|
|
1747
|
+
path: `/orgs/${organizationId}/integrations/${integrationName}/installation_status`,
|
|
1748
|
+
method: "GET",
|
|
1749
|
+
secure: true,
|
|
1750
|
+
format: "json",
|
|
1751
|
+
...params
|
|
1752
|
+
}),
|
|
1680
1753
|
listOrganizationInstallations: (organizationId, query, params = {}) => this.request({
|
|
1681
1754
|
path: `/orgs/${organizationId}/installations`,
|
|
1682
1755
|
method: "GET",
|
|
@@ -1795,6 +1868,46 @@ var Api = class extends HttpClient {
|
|
|
1795
1868
|
format: "json",
|
|
1796
1869
|
...params
|
|
1797
1870
|
}),
|
|
1871
|
+
listSnippets: (organizationId, query, params = {}) => this.request({
|
|
1872
|
+
path: `/orgs/${organizationId}/snippets`,
|
|
1873
|
+
method: "GET",
|
|
1874
|
+
query,
|
|
1875
|
+
secure: true,
|
|
1876
|
+
format: "json",
|
|
1877
|
+
...params
|
|
1878
|
+
}),
|
|
1879
|
+
createSnippet: (organizationId, data, params = {}) => this.request({
|
|
1880
|
+
path: `/orgs/${organizationId}/snippets`,
|
|
1881
|
+
method: "POST",
|
|
1882
|
+
body: data,
|
|
1883
|
+
secure: true,
|
|
1884
|
+
type: "application/json" /* Json */,
|
|
1885
|
+
format: "json",
|
|
1886
|
+
...params
|
|
1887
|
+
}),
|
|
1888
|
+
getSnippet: (organizationId, snippetId, query, params = {}) => this.request({
|
|
1889
|
+
path: `/orgs/${organizationId}/snippets/${snippetId}`,
|
|
1890
|
+
method: "GET",
|
|
1891
|
+
query,
|
|
1892
|
+
secure: true,
|
|
1893
|
+
format: "json",
|
|
1894
|
+
...params
|
|
1895
|
+
}),
|
|
1896
|
+
deleteSnippet: (organizationId, snippetId, params = {}) => this.request({
|
|
1897
|
+
path: `/orgs/${organizationId}/snippets/${snippetId}`,
|
|
1898
|
+
method: "DELETE",
|
|
1899
|
+
secure: true,
|
|
1900
|
+
...params
|
|
1901
|
+
}),
|
|
1902
|
+
updateSnippet: (organizationId, snippetId, data, params = {}) => this.request({
|
|
1903
|
+
path: `/orgs/${organizationId}/snippets/${snippetId}`,
|
|
1904
|
+
method: "PUT",
|
|
1905
|
+
body: data,
|
|
1906
|
+
secure: true,
|
|
1907
|
+
type: "application/json" /* Json */,
|
|
1908
|
+
format: "json",
|
|
1909
|
+
...params
|
|
1910
|
+
}),
|
|
1798
1911
|
askInOrganization: (organizationId, data, params = {}) => this.request({
|
|
1799
1912
|
path: `/orgs/${organizationId}/ask`,
|
|
1800
1913
|
method: "POST",
|
|
@@ -1820,6 +1933,14 @@ var Api = class extends HttpClient {
|
|
|
1820
1933
|
type: "application/json" /* Json */,
|
|
1821
1934
|
format: "json",
|
|
1822
1935
|
...params
|
|
1936
|
+
}),
|
|
1937
|
+
getContentAuditSourceContentById: (organizationId, sourceId, query, params = {}) => this.request({
|
|
1938
|
+
path: `/orgs/${organizationId}/insights/audit-sources/${sourceId}/content`,
|
|
1939
|
+
method: "GET",
|
|
1940
|
+
query,
|
|
1941
|
+
secure: true,
|
|
1942
|
+
format: "json",
|
|
1943
|
+
...params
|
|
1823
1944
|
})
|
|
1824
1945
|
};
|
|
1825
1946
|
this.internal = {
|
|
@@ -1862,6 +1983,17 @@ var Api = class extends HttpClient {
|
|
|
1862
1983
|
}
|
|
1863
1984
|
};
|
|
1864
1985
|
|
|
1986
|
+
// src/GitBookAPIError.ts
|
|
1987
|
+
var GitBookAPIError = class extends Error {
|
|
1988
|
+
constructor(errorMessage, response) {
|
|
1989
|
+
const message = `GitBook API failed with [${response.status}] ${response.url}: ${errorMessage}`;
|
|
1990
|
+
super(message);
|
|
1991
|
+
this.name = "GitBookAPIError";
|
|
1992
|
+
this.response = response;
|
|
1993
|
+
this.code = response.status;
|
|
1994
|
+
}
|
|
1995
|
+
};
|
|
1996
|
+
|
|
1865
1997
|
// src/index.ts
|
|
1866
1998
|
var GITBOOK_DEFAULT_ENDPOINT = "https://api.gitbook.com";
|
|
1867
1999
|
var GitBookAPI = class extends Api {
|
|
@@ -1893,13 +2025,8 @@ var GitBookAPI = class extends Api {
|
|
|
1893
2025
|
const body = await response.json();
|
|
1894
2026
|
error = body?.error?.message || error;
|
|
1895
2027
|
} catch (err) {
|
|
1896
|
-
response.headers.forEach((value, key) => {
|
|
1897
|
-
error += `${key}:${value} `;
|
|
1898
|
-
});
|
|
1899
2028
|
}
|
|
1900
|
-
throw new
|
|
1901
|
-
`GitBook API failed with [${response.status}] ${response.url}: ${error}`
|
|
1902
|
-
);
|
|
2029
|
+
throw new GitBookAPIError(error, response);
|
|
1903
2030
|
}
|
|
1904
2031
|
return response;
|
|
1905
2032
|
}
|
|
@@ -1931,6 +2058,8 @@ var GitBookAPI = class extends Api {
|
|
|
1931
2058
|
CloudflareHostnameStatus,
|
|
1932
2059
|
CloudflareHostnameTLSStatus,
|
|
1933
2060
|
CloudflareHostnameTLSValidationMethod,
|
|
2061
|
+
ContentAuditRelationStatus,
|
|
2062
|
+
ContentAuditRelationType,
|
|
1934
2063
|
ContentKitIcon,
|
|
1935
2064
|
ContentType,
|
|
1936
2065
|
ContentVisibility,
|
|
@@ -1942,6 +2071,7 @@ var GitBookAPI = class extends Api {
|
|
|
1942
2071
|
CustomizationThemeMode,
|
|
1943
2072
|
GITBOOK_DEFAULT_ENDPOINT,
|
|
1944
2073
|
GitBookAPI,
|
|
2074
|
+
GitBookAPIError,
|
|
1945
2075
|
GitSyncOperationState,
|
|
1946
2076
|
HttpClient,
|
|
1947
2077
|
ImportContentSource,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Api } from './client';
|
|
2
|
+
import { GitBookAPIError } from './GitBookAPIError';
|
|
2
3
|
export * from './client';
|
|
4
|
+
export { GitBookAPIError };
|
|
3
5
|
export declare const GITBOOK_DEFAULT_ENDPOINT = "https://api.gitbook.com";
|
|
4
6
|
export declare class GitBookAPI extends Api<{
|
|
5
7
|
authToken?: string;
|