@gitbook/api 0.0.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.
@@ -0,0 +1,894 @@
1
+ {
2
+ "openapi": "3.0.3",
3
+ "info": {
4
+ "title": "GitBook API",
5
+ "description": "The GitBook API",
6
+ "termsOfService": "https://policies.gitbook.com",
7
+ "contact": {
8
+ "name": "API Support",
9
+ "url": "https://gitbook.com/support",
10
+ "email": "support@gitbook.com"
11
+ },
12
+ "version": "0.0.1-beta"
13
+ },
14
+ "servers": [
15
+ {
16
+ "url": "{host}/v1",
17
+ "variables": {
18
+ "host": {
19
+ "default": "https://api.gitbook.com"
20
+ }
21
+ }
22
+ }
23
+ ],
24
+ "security": [
25
+ {
26
+ "PersonalAccessToken": []
27
+ }
28
+ ],
29
+ "components": {
30
+ "securitySchemes": {
31
+ "PersonalAccessToken": {
32
+ "type": "http",
33
+ "scheme": "bearer"
34
+ }
35
+ },
36
+ "parameters": {
37
+ "spaceId": {
38
+ "name": "spaceId",
39
+ "in": "path",
40
+ "required": true,
41
+ "description": "The unique id of the space",
42
+ "schema": {
43
+ "type": "string"
44
+ }
45
+ },
46
+ "integrationName": {
47
+ "name": "integrationName",
48
+ "in": "path",
49
+ "required": true,
50
+ "description": "Name of the integration",
51
+ "schema": {
52
+ "type": "string"
53
+ }
54
+ },
55
+ "installationId": {
56
+ "name": "installationId",
57
+ "in": "path",
58
+ "required": true,
59
+ "description": "Identifier of the installation",
60
+ "schema": {
61
+ "type": "string"
62
+ }
63
+ }
64
+ },
65
+ "schemas": {
66
+ "Error": {
67
+ "type": "object",
68
+ "required": [
69
+ "code",
70
+ "message"
71
+ ],
72
+ "properties": {
73
+ "code": {
74
+ "type": "integer",
75
+ "format": "int32"
76
+ },
77
+ "message": {
78
+ "type": "string"
79
+ }
80
+ }
81
+ },
82
+ "RequestSpaceTrackPageView": {
83
+ "type": "object",
84
+ "properties": {
85
+ "pageId": {
86
+ "type": "string",
87
+ "description": "Unique identifier of the page"
88
+ },
89
+ "visitorId": {
90
+ "type": "string",
91
+ "description": "Unique identifier of the visitor"
92
+ }
93
+ },
94
+ "required": [
95
+ "pageId",
96
+ "visitorId"
97
+ ]
98
+ },
99
+ "RequestPublishIntegration": {
100
+ "type": "object",
101
+ "properties": {
102
+ "icon": {
103
+ "type": "string",
104
+ "description": "Base64 content of the icon"
105
+ },
106
+ "title": {
107
+ "$ref": "#/components/schemas/Integration/properties/title"
108
+ },
109
+ "description": {
110
+ "$ref": "#/components/schemas/Integration/properties/description"
111
+ },
112
+ "summary": {
113
+ "$ref": "#/components/schemas/Integration/properties/summary"
114
+ },
115
+ "visibility": {
116
+ "$ref": "#/components/schemas/IntegrationVisibility"
117
+ },
118
+ "scopes": {
119
+ "$ref": "#/components/schemas/Integration/properties/scopes"
120
+ },
121
+ "categories": {
122
+ "$ref": "#/components/schemas/Integration/properties/categories"
123
+ },
124
+ "configurations": {
125
+ "$ref": "#/components/schemas/IntegrationConfigurations"
126
+ },
127
+ "script": {
128
+ "type": "string",
129
+ "description": "Content of the script to use"
130
+ },
131
+ "secrets": {
132
+ "$ref": "#/components/schemas/IntegrationSecrets"
133
+ }
134
+ },
135
+ "required": [
136
+ "title",
137
+ "description",
138
+ "script",
139
+ "scopes"
140
+ ]
141
+ },
142
+ "RequestUpdateIntegrationInstallation": {
143
+ "type": "object",
144
+ "properties": {
145
+ "status": {
146
+ "$ref": "#/components/schemas/IntegrationInstallationStatus"
147
+ },
148
+ "configurations": {
149
+ "$ref": "#/components/schemas/IntegrationInstallation/properties/configurations"
150
+ }
151
+ }
152
+ },
153
+ "User": {
154
+ "type": "object",
155
+ "properties": {
156
+ "id": {
157
+ "type": "string"
158
+ },
159
+ "displayName": {
160
+ "type": "string"
161
+ },
162
+ "email": {
163
+ "type": "string"
164
+ }
165
+ },
166
+ "required": [
167
+ "id",
168
+ "displayName"
169
+ ]
170
+ },
171
+ "Space": {
172
+ "type": "object",
173
+ "properties": {
174
+ "id": {
175
+ "type": "string",
176
+ "description": "Unique identifier for the space"
177
+ },
178
+ "title": {
179
+ "type": "string",
180
+ "description": "Title of the space",
181
+ "minLength": 0,
182
+ "maxLength": 100
183
+ }
184
+ },
185
+ "required": [
186
+ "id",
187
+ "title"
188
+ ]
189
+ },
190
+ "Integration": {
191
+ "type": "object",
192
+ "properties": {
193
+ "name": {
194
+ "type": "string",
195
+ "description": "Unique named identifier for the integration"
196
+ },
197
+ "title": {
198
+ "type": "string",
199
+ "description": "Title of the integration",
200
+ "minLength": 2,
201
+ "maxLength": 30
202
+ },
203
+ "description": {
204
+ "type": "string",
205
+ "description": "Title of the integration",
206
+ "maxLength": 100
207
+ },
208
+ "summary": {
209
+ "type": "string",
210
+ "description": "Long form markdown summary of the integration",
211
+ "maxLength": 500
212
+ },
213
+ "script": {
214
+ "type": "string",
215
+ "description": "Content of the script to run."
216
+ },
217
+ "visibility": {
218
+ "$ref": "#/components/schemas/IntegrationVisibility"
219
+ },
220
+ "scopes": {
221
+ "type": "array",
222
+ "description": "Permissions that should be granted to the integration",
223
+ "items": {
224
+ "$ref": "#/components/schemas/IntegrationScope"
225
+ }
226
+ },
227
+ "categories": {
228
+ "type": "array",
229
+ "description": "Categories for which the integration is listed in the marketplace",
230
+ "items": {
231
+ "$ref": "#/components/schemas/IntegrationCategory"
232
+ }
233
+ },
234
+ "configurations": {
235
+ "$ref": "#/components/schemas/IntegrationConfigurations"
236
+ }
237
+ },
238
+ "required": [
239
+ "name",
240
+ "title",
241
+ "scopes",
242
+ "script",
243
+ "categories",
244
+ "visibility"
245
+ ]
246
+ },
247
+ "IntegrationScope": {
248
+ "type": "string",
249
+ "enum": [
250
+ "space:views",
251
+ "space:content"
252
+ ]
253
+ },
254
+ "IntegrationCategory": {
255
+ "type": "string",
256
+ "enum": [
257
+ "analytics",
258
+ "collaboration",
259
+ "other"
260
+ ]
261
+ },
262
+ "IntegrationConfigurations": {
263
+ "type": "object",
264
+ "properties": {
265
+ "space": {
266
+ "$ref": "#/components/schemas/IntegrationConfiguration"
267
+ }
268
+ }
269
+ },
270
+ "IntegrationConfiguration": {
271
+ "type": "object",
272
+ "properties": {
273
+ "properties": {
274
+ "type": "object",
275
+ "additionalProperties": {
276
+ "allOf": [
277
+ {
278
+ "type": "object",
279
+ "properties": {
280
+ "type": {
281
+ "type": "string"
282
+ },
283
+ "title": {
284
+ "type": "string",
285
+ "maxLength": 30
286
+ },
287
+ "description": {
288
+ "type": "string",
289
+ "maxLength": 100
290
+ }
291
+ }
292
+ },
293
+ {
294
+ "oneOf": [
295
+ {
296
+ "type": "object",
297
+ "properties": {
298
+ "type": {
299
+ "type": "string",
300
+ "enum": [
301
+ "string"
302
+ ]
303
+ },
304
+ "default": {
305
+ "type": "string"
306
+ }
307
+ }
308
+ },
309
+ {
310
+ "type": "object",
311
+ "properties": {
312
+ "type": {
313
+ "type": "string",
314
+ "enum": [
315
+ "number"
316
+ ]
317
+ },
318
+ "default": {
319
+ "type": "number"
320
+ }
321
+ }
322
+ },
323
+ {
324
+ "type": "object",
325
+ "properties": {
326
+ "type": {
327
+ "type": "string",
328
+ "enum": [
329
+ "boolean"
330
+ ]
331
+ },
332
+ "default": {
333
+ "type": "boolean"
334
+ }
335
+ }
336
+ },
337
+ {
338
+ "type": "object",
339
+ "properties": {
340
+ "type": {
341
+ "type": "string",
342
+ "enum": [
343
+ "button"
344
+ ]
345
+ },
346
+ "callback_url": {
347
+ "type": "string"
348
+ },
349
+ "button_text": {
350
+ "type": "string"
351
+ }
352
+ },
353
+ "required": [
354
+ "callback_url",
355
+ "button_text"
356
+ ]
357
+ }
358
+ ]
359
+ }
360
+ ]
361
+ }
362
+ }
363
+ },
364
+ "required": [
365
+ "properties"
366
+ ]
367
+ },
368
+ "IntegrationVisibility": {
369
+ "type": "string",
370
+ "enum": [
371
+ "public",
372
+ "private"
373
+ ]
374
+ },
375
+ "IntegrationInstallation": {
376
+ "type": "object",
377
+ "properties": {
378
+ "id": {
379
+ "type": "string"
380
+ },
381
+ "status": {
382
+ "$ref": "#/components/schemas/IntegrationInstallationStatus"
383
+ },
384
+ "configurations": {
385
+ "type": "object",
386
+ "properties": {
387
+ "space": {
388
+ "type": "object"
389
+ }
390
+ }
391
+ }
392
+ },
393
+ "required": [
394
+ "id",
395
+ "status"
396
+ ]
397
+ },
398
+ "IntegrationInstallationStatus": {
399
+ "type": "string",
400
+ "enum": [
401
+ "active",
402
+ "pending",
403
+ "paused"
404
+ ]
405
+ },
406
+ "IntegrationSecrets": {
407
+ "type": "object",
408
+ "description": "Secrets stored on the integration and passed at runtime.",
409
+ "properties": {},
410
+ "maxProperties": 20,
411
+ "additionalProperties": {
412
+ "type": "string"
413
+ }
414
+ },
415
+ "IntegrationEnvironment": {
416
+ "type": "object",
417
+ "description": "Runtime environment provided during the execution of integration's code.",
418
+ "properties": {
419
+ "apiEndpoint": {
420
+ "type": "string",
421
+ "description": "URL of the HTTP API"
422
+ },
423
+ "authToken": {
424
+ "type": "string",
425
+ "description": "Authentication token to use with the HTTP API"
426
+ },
427
+ "integration": {
428
+ "$ref": "#/components/schemas/Integration"
429
+ },
430
+ "installation": {
431
+ "$ref": "#/components/schemas/IntegrationInstallation"
432
+ },
433
+ "secrets": {
434
+ "$ref": "#/components/schemas/IntegrationSecrets"
435
+ }
436
+ },
437
+ "required": [
438
+ "apiEndpoint",
439
+ "authToken",
440
+ "integration",
441
+ "installation",
442
+ "secrets"
443
+ ]
444
+ },
445
+ "Event": {
446
+ "description": "Any event that can be received from GitBook.",
447
+ "oneOf": [
448
+ {
449
+ "$ref": "#/components/schemas/InstallationSetupEvent"
450
+ },
451
+ {
452
+ "$ref": "#/components/schemas/SpaceViewEvent"
453
+ },
454
+ {
455
+ "$ref": "#/components/schemas/SpaceContentUpdatedEvent"
456
+ },
457
+ {
458
+ "$ref": "#/components/schemas/FetchEvent"
459
+ }
460
+ ],
461
+ "discriminator": {
462
+ "propertyName": "type"
463
+ }
464
+ },
465
+ "BaseEvent": {
466
+ "description": "Common properties for all events.",
467
+ "type": "object",
468
+ "properties": {
469
+ "eventId": {
470
+ "description": "Unique identifier for the event.",
471
+ "type": "string"
472
+ },
473
+ "type": {
474
+ "description": "Type of the event.",
475
+ "type": "string"
476
+ }
477
+ },
478
+ "required": [
479
+ "eventId",
480
+ "type"
481
+ ]
482
+ },
483
+ "InstallationEvent": {
484
+ "allOf": [
485
+ {
486
+ "$ref": "#/components/schemas/BaseEvent"
487
+ },
488
+ {
489
+ "type": "object",
490
+ "description": "Common properties for all events related to an installation",
491
+ "properties": {
492
+ "installationId": {
493
+ "type": "string",
494
+ "description": "ID of the integration installation"
495
+ }
496
+ },
497
+ "required": [
498
+ "installationId"
499
+ ]
500
+ }
501
+ ]
502
+ },
503
+ "SpaceEvent": {
504
+ "allOf": [
505
+ {
506
+ "$ref": "#/components/schemas/InstallationEvent"
507
+ },
508
+ {
509
+ "type": "object",
510
+ "description": "Common properties for all events related to a specific space.",
511
+ "properties": {
512
+ "spaceId": {
513
+ "type": "string",
514
+ "description": "ID of the space"
515
+ }
516
+ },
517
+ "required": [
518
+ "spaceId"
519
+ ]
520
+ }
521
+ ]
522
+ },
523
+ "InstallationSetupEvent": {
524
+ "allOf": [
525
+ {
526
+ "$ref": "#/components/schemas/SpaceEvent"
527
+ },
528
+ {
529
+ "type": "object",
530
+ "description": "Event received when integration has been installed.",
531
+ "properties": {
532
+ "type": {
533
+ "type": "string",
534
+ "enum": [
535
+ "installation:setup"
536
+ ]
537
+ },
538
+ "status": {
539
+ "$ref": "#/components/schemas/IntegrationInstallationStatus"
540
+ }
541
+ },
542
+ "required": [
543
+ "type",
544
+ "status"
545
+ ]
546
+ }
547
+ ]
548
+ },
549
+ "SpaceViewEvent": {
550
+ "allOf": [
551
+ {
552
+ "$ref": "#/components/schemas/SpaceEvent"
553
+ },
554
+ {
555
+ "type": "object",
556
+ "description": "Event received when a page has been visited.",
557
+ "properties": {
558
+ "type": {
559
+ "type": "string",
560
+ "enum": [
561
+ "space:view"
562
+ ]
563
+ },
564
+ "pageId": {
565
+ "type": "string",
566
+ "description": "Unique identifier of the visited page."
567
+ },
568
+ "visitorId": {
569
+ "type": "string",
570
+ "description": "Unique identifier for the visitor session."
571
+ },
572
+ "visitorIp": {
573
+ "type": "string",
574
+ "description": "IP address of the visitor."
575
+ },
576
+ "visitorUserAgent": {
577
+ "type": "string",
578
+ "description": "User-agent of the visitor."
579
+ }
580
+ },
581
+ "required": [
582
+ "type",
583
+ "visitorId",
584
+ "visitorIp",
585
+ "visitorUserAgent"
586
+ ]
587
+ }
588
+ ]
589
+ },
590
+ "SpaceContentUpdatedEvent": {
591
+ "allOf": [
592
+ {
593
+ "$ref": "#/components/schemas/SpaceEvent"
594
+ },
595
+ {
596
+ "type": "object",
597
+ "description": "Event when the primary content of a space has been updated.",
598
+ "properties": {
599
+ "type": {
600
+ "type": "string",
601
+ "enum": [
602
+ "space:content:updated"
603
+ ]
604
+ },
605
+ "revisionId": {
606
+ "type": "string",
607
+ "description": "Unique identifier of the new content revision"
608
+ }
609
+ },
610
+ "required": [
611
+ "type",
612
+ "revisionId"
613
+ ]
614
+ }
615
+ ]
616
+ },
617
+ "FetchRequest": {
618
+ "type": "object",
619
+ "properties": {
620
+ "method": {
621
+ "type": "string",
622
+ "enum": [
623
+ "post",
624
+ "get",
625
+ "put",
626
+ "delete"
627
+ ]
628
+ },
629
+ "url": {
630
+ "type": "string"
631
+ },
632
+ "body": {
633
+ "type": "string"
634
+ },
635
+ "headers": {
636
+ "type": "object",
637
+ "additionalProperties": {
638
+ "type": "string"
639
+ }
640
+ }
641
+ },
642
+ "required": [
643
+ "method",
644
+ "url",
645
+ "headers"
646
+ ]
647
+ },
648
+ "FetchResponse": {
649
+ "type": "object",
650
+ "properties": {
651
+ "status": {
652
+ "type": "number"
653
+ },
654
+ "body": {
655
+ "type": "string"
656
+ },
657
+ "headers": {
658
+ "type": "object",
659
+ "additionalProperties": {
660
+ "type": "string"
661
+ }
662
+ }
663
+ },
664
+ "required": [
665
+ "status",
666
+ "body",
667
+ "headers"
668
+ ]
669
+ },
670
+ "FetchEvent": {
671
+ "allOf": [
672
+ {
673
+ "$ref": "#/components/schemas/InstallationEvent"
674
+ },
675
+ {
676
+ "type": "object",
677
+ "description": "Event representing an incoming HTTP request.",
678
+ "properties": {
679
+ "type": {
680
+ "type": "string",
681
+ "enum": [
682
+ "fetch"
683
+ ]
684
+ },
685
+ "request": {
686
+ "$ref": "#/components/schemas/FetchRequest"
687
+ }
688
+ },
689
+ "required": [
690
+ "type",
691
+ "request"
692
+ ]
693
+ }
694
+ ]
695
+ }
696
+ },
697
+ "responses": {
698
+ "UnexpectedError": {
699
+ "description": "unexpected error",
700
+ "content": {
701
+ "application/json": {
702
+ "schema": {
703
+ "$ref": "#/components/schemas/Error"
704
+ }
705
+ }
706
+ }
707
+ },
708
+ "EmptyResponse": {
709
+ "description": "unexpected error",
710
+ "content": {
711
+ "application/json": {
712
+ "schema": {
713
+ "type": "object",
714
+ "properties": {}
715
+ }
716
+ }
717
+ }
718
+ }
719
+ }
720
+ },
721
+ "paths": {
722
+ "/user": {
723
+ "get": {
724
+ "operationId": "getAuthenticated",
725
+ "summary": "Get profile of authenticated user",
726
+ "responses": {
727
+ "200": {
728
+ "description": "OK",
729
+ "content": {
730
+ "application/json": {
731
+ "schema": {
732
+ "$ref": "#/components/schemas/User"
733
+ }
734
+ }
735
+ }
736
+ },
737
+ "default": {
738
+ "$ref": "#/components/responses/UnexpectedError"
739
+ }
740
+ }
741
+ }
742
+ },
743
+ "/spaces/{spaceId}": {
744
+ "get": {
745
+ "operationId": "getSpace",
746
+ "summary": "Get the details about a space",
747
+ "parameters": [
748
+ {
749
+ "$ref": "#/components/parameters/spaceId"
750
+ }
751
+ ],
752
+ "responses": {
753
+ "200": {
754
+ "description": "OK",
755
+ "content": {
756
+ "application/json": {
757
+ "schema": {
758
+ "$ref": "#/components/schemas/Space"
759
+ }
760
+ }
761
+ }
762
+ },
763
+ "default": {
764
+ "$ref": "#/components/responses/UnexpectedError"
765
+ }
766
+ }
767
+ }
768
+ },
769
+ "/spaces/{spaceId}/views": {
770
+ "post": {
771
+ "operationId": "trackPageView",
772
+ "description": "Track a page view on a space",
773
+ "parameters": [
774
+ {
775
+ "$ref": "#/components/parameters/spaceId"
776
+ }
777
+ ],
778
+ "responses": {
779
+ "200": {
780
+ "$ref": "#/components/responses/EmptyResponse"
781
+ },
782
+ "default": {
783
+ "$ref": "#/components/responses/UnexpectedError"
784
+ }
785
+ },
786
+ "requestBody": {
787
+ "required": true,
788
+ "content": {
789
+ "application/json": {
790
+ "schema": {
791
+ "$ref": "#/components/schemas/RequestSpaceTrackPageView"
792
+ }
793
+ }
794
+ }
795
+ }
796
+ }
797
+ },
798
+ "/integrations/{integrationName}": {
799
+ "post": {
800
+ "operationId": "publish",
801
+ "summary": "Publish an integration",
802
+ "parameters": [
803
+ {
804
+ "$ref": "#/components/parameters/integrationName"
805
+ }
806
+ ],
807
+ "responses": {
808
+ "200": {
809
+ "description": "OK",
810
+ "content": {
811
+ "application/json": {
812
+ "schema": {
813
+ "$ref": "#/components/schemas/Integration"
814
+ }
815
+ }
816
+ }
817
+ },
818
+ "default": {
819
+ "$ref": "#/components/responses/UnexpectedError"
820
+ }
821
+ },
822
+ "requestBody": {
823
+ "required": true,
824
+ "content": {
825
+ "application/json": {
826
+ "schema": {
827
+ "$ref": "#/components/schemas/RequestPublishIntegration"
828
+ }
829
+ }
830
+ }
831
+ }
832
+ }
833
+ },
834
+ "/integrations/{integrationName}/installations/{installationId}": {
835
+ "get": {
836
+ "operationId": "getInstallation",
837
+ "summary": "Get the status and configurations of an integration's installation",
838
+ "parameters": [
839
+ {
840
+ "$ref": "#/components/parameters/integrationName"
841
+ },
842
+ {
843
+ "$ref": "#/components/parameters/installationId"
844
+ }
845
+ ],
846
+ "responses": {
847
+ "200": {
848
+ "description": "OK",
849
+ "content": {
850
+ "application/json": {
851
+ "schema": {
852
+ "$ref": "#/components/schemas/IntegrationInstallation"
853
+ }
854
+ }
855
+ }
856
+ },
857
+ "default": {
858
+ "$ref": "#/components/responses/UnexpectedError"
859
+ }
860
+ }
861
+ },
862
+ "patch": {
863
+ "operationId": "updateInstallation",
864
+ "summary": "Update status and configurations of an integration's installation",
865
+ "parameters": [
866
+ {
867
+ "$ref": "#/components/parameters/integrationName"
868
+ },
869
+ {
870
+ "$ref": "#/components/parameters/installationId"
871
+ }
872
+ ],
873
+ "responses": {
874
+ "200": {
875
+ "$ref": "#/components/responses/EmptyResponse"
876
+ },
877
+ "default": {
878
+ "$ref": "#/components/responses/UnexpectedError"
879
+ }
880
+ },
881
+ "requestBody": {
882
+ "required": true,
883
+ "content": {
884
+ "application/json": {
885
+ "schema": {
886
+ "$ref": "#/components/schemas/RequestUpdateIntegrationInstallation"
887
+ }
888
+ }
889
+ }
890
+ }
891
+ }
892
+ }
893
+ }
894
+ }