@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,570 @@
1
+ openapi: 3.0.3
2
+ info:
3
+ title: GitBook API
4
+ description: The GitBook API
5
+ termsOfService: 'https://policies.gitbook.com'
6
+ contact:
7
+ name: API Support
8
+ url: 'https://gitbook.com/support'
9
+ email: support@gitbook.com
10
+ version: 0.0.1-beta
11
+ servers:
12
+ - url: '{host}/v1'
13
+ variables:
14
+ host:
15
+ default: 'https://api.gitbook.com'
16
+ security:
17
+ - PersonalAccessToken: []
18
+ components:
19
+ securitySchemes:
20
+ PersonalAccessToken:
21
+ type: http
22
+ scheme: bearer
23
+ parameters:
24
+ spaceId:
25
+ name: spaceId
26
+ in: path
27
+ required: true
28
+ description: The unique id of the space
29
+ schema:
30
+ type: string
31
+ integrationName:
32
+ name: integrationName
33
+ in: path
34
+ required: true
35
+ description: Name of the integration
36
+ schema:
37
+ type: string
38
+ installationId:
39
+ name: installationId
40
+ in: path
41
+ required: true
42
+ description: Identifier of the installation
43
+ schema:
44
+ type: string
45
+ schemas:
46
+ Error:
47
+ type: object
48
+ required:
49
+ - code
50
+ - message
51
+ properties:
52
+ code:
53
+ type: integer
54
+ format: int32
55
+ message:
56
+ type: string
57
+ RequestSpaceTrackPageView:
58
+ type: object
59
+ properties:
60
+ pageId:
61
+ type: string
62
+ description: Unique identifier of the page
63
+ visitorId:
64
+ type: string
65
+ description: Unique identifier of the visitor
66
+ required:
67
+ - pageId
68
+ - visitorId
69
+ RequestPublishIntegration:
70
+ type: object
71
+ properties:
72
+ icon:
73
+ type: string
74
+ description: Base64 content of the icon
75
+ title:
76
+ $ref: '#/components/schemas/Integration/properties/title'
77
+ description:
78
+ $ref: '#/components/schemas/Integration/properties/description'
79
+ summary:
80
+ $ref: '#/components/schemas/Integration/properties/summary'
81
+ visibility:
82
+ $ref: '#/components/schemas/IntegrationVisibility'
83
+ scopes:
84
+ $ref: '#/components/schemas/Integration/properties/scopes'
85
+ categories:
86
+ $ref: '#/components/schemas/Integration/properties/categories'
87
+ configurations:
88
+ $ref: '#/components/schemas/IntegrationConfigurations'
89
+ script:
90
+ type: string
91
+ description: Content of the script to use
92
+ secrets:
93
+ $ref: '#/components/schemas/IntegrationSecrets'
94
+ required:
95
+ - title
96
+ - description
97
+ - script
98
+ - scopes
99
+ RequestUpdateIntegrationInstallation:
100
+ type: object
101
+ properties:
102
+ status:
103
+ $ref: '#/components/schemas/IntegrationInstallationStatus'
104
+ configurations:
105
+ $ref: '#/components/schemas/IntegrationInstallation/properties/configurations'
106
+ User:
107
+ type: object
108
+ properties:
109
+ id:
110
+ type: string
111
+ displayName:
112
+ type: string
113
+ email:
114
+ type: string
115
+ required:
116
+ - id
117
+ - displayName
118
+ Space:
119
+ type: object
120
+ properties:
121
+ id:
122
+ type: string
123
+ description: Unique identifier for the space
124
+ title:
125
+ type: string
126
+ description: Title of the space
127
+ minLength: 0
128
+ maxLength: 100
129
+ required:
130
+ - id
131
+ - title
132
+ Integration:
133
+ type: object
134
+ properties:
135
+ name:
136
+ type: string
137
+ description: Unique named identifier for the integration
138
+ title:
139
+ type: string
140
+ description: Title of the integration
141
+ minLength: 2
142
+ maxLength: 30
143
+ description:
144
+ type: string
145
+ description: Title of the integration
146
+ maxLength: 100
147
+ summary:
148
+ type: string
149
+ description: Long form markdown summary of the integration
150
+ maxLength: 500
151
+ script:
152
+ type: string
153
+ description: Content of the script to run.
154
+ visibility:
155
+ $ref: '#/components/schemas/IntegrationVisibility'
156
+ scopes:
157
+ type: array
158
+ description: Permissions that should be granted to the integration
159
+ items:
160
+ $ref: '#/components/schemas/IntegrationScope'
161
+ categories:
162
+ type: array
163
+ description: Categories for which the integration is listed in the marketplace
164
+ items:
165
+ $ref: '#/components/schemas/IntegrationCategory'
166
+ configurations:
167
+ $ref: '#/components/schemas/IntegrationConfigurations'
168
+ required:
169
+ - name
170
+ - title
171
+ - scopes
172
+ - script
173
+ - categories
174
+ - visibility
175
+ IntegrationScope:
176
+ type: string
177
+ enum:
178
+ - 'space:views'
179
+ - 'space:content'
180
+ IntegrationCategory:
181
+ type: string
182
+ enum:
183
+ - analytics
184
+ - collaboration
185
+ - other
186
+ IntegrationConfigurations:
187
+ type: object
188
+ properties:
189
+ space:
190
+ $ref: '#/components/schemas/IntegrationConfiguration'
191
+ IntegrationConfiguration:
192
+ type: object
193
+ properties:
194
+ properties:
195
+ type: object
196
+ additionalProperties:
197
+ allOf:
198
+ - type: object
199
+ properties:
200
+ type:
201
+ type: string
202
+ title:
203
+ type: string
204
+ maxLength: 30
205
+ description:
206
+ type: string
207
+ maxLength: 100
208
+ - oneOf:
209
+ - type: object
210
+ properties:
211
+ type:
212
+ type: string
213
+ enum:
214
+ - string
215
+ default:
216
+ type: string
217
+ - type: object
218
+ properties:
219
+ type:
220
+ type: string
221
+ enum:
222
+ - number
223
+ default:
224
+ type: number
225
+ - type: object
226
+ properties:
227
+ type:
228
+ type: string
229
+ enum:
230
+ - boolean
231
+ default:
232
+ type: boolean
233
+ - type: object
234
+ properties:
235
+ type:
236
+ type: string
237
+ enum:
238
+ - button
239
+ callback_url:
240
+ type: string
241
+ button_text:
242
+ type: string
243
+ required:
244
+ - callback_url
245
+ - button_text
246
+ required:
247
+ - properties
248
+ IntegrationVisibility:
249
+ type: string
250
+ enum:
251
+ - public
252
+ - private
253
+ IntegrationInstallation:
254
+ type: object
255
+ properties:
256
+ id:
257
+ type: string
258
+ status:
259
+ $ref: '#/components/schemas/IntegrationInstallationStatus'
260
+ configurations:
261
+ type: object
262
+ properties:
263
+ space:
264
+ type: object
265
+ required:
266
+ - id
267
+ - status
268
+ IntegrationInstallationStatus:
269
+ type: string
270
+ enum:
271
+ - active
272
+ - pending
273
+ - paused
274
+ IntegrationSecrets:
275
+ type: object
276
+ description: Secrets stored on the integration and passed at runtime.
277
+ properties: {}
278
+ maxProperties: 20
279
+ additionalProperties:
280
+ type: string
281
+ IntegrationEnvironment:
282
+ type: object
283
+ description: Runtime environment provided during the execution of integration's code.
284
+ properties:
285
+ apiEndpoint:
286
+ type: string
287
+ description: URL of the HTTP API
288
+ authToken:
289
+ type: string
290
+ description: Authentication token to use with the HTTP API
291
+ integration:
292
+ $ref: '#/components/schemas/Integration'
293
+ installation:
294
+ $ref: '#/components/schemas/IntegrationInstallation'
295
+ secrets:
296
+ $ref: '#/components/schemas/IntegrationSecrets'
297
+ required:
298
+ - apiEndpoint
299
+ - authToken
300
+ - integration
301
+ - installation
302
+ - secrets
303
+ Event:
304
+ description: Any event that can be received from GitBook.
305
+ oneOf:
306
+ - $ref: '#/components/schemas/InstallationSetupEvent'
307
+ - $ref: '#/components/schemas/SpaceViewEvent'
308
+ - $ref: '#/components/schemas/SpaceContentUpdatedEvent'
309
+ - $ref: '#/components/schemas/FetchEvent'
310
+ discriminator:
311
+ propertyName: type
312
+ BaseEvent:
313
+ description: Common properties for all events.
314
+ type: object
315
+ properties:
316
+ eventId:
317
+ description: Unique identifier for the event.
318
+ type: string
319
+ type:
320
+ description: Type of the event.
321
+ type: string
322
+ required:
323
+ - eventId
324
+ - type
325
+ InstallationEvent:
326
+ allOf:
327
+ - $ref: '#/components/schemas/BaseEvent'
328
+ - type: object
329
+ description: Common properties for all events related to an installation
330
+ properties:
331
+ installationId:
332
+ type: string
333
+ description: ID of the integration installation
334
+ required:
335
+ - installationId
336
+ SpaceEvent:
337
+ allOf:
338
+ - $ref: '#/components/schemas/InstallationEvent'
339
+ - type: object
340
+ description: Common properties for all events related to a specific space.
341
+ properties:
342
+ spaceId:
343
+ type: string
344
+ description: ID of the space
345
+ required:
346
+ - spaceId
347
+ InstallationSetupEvent:
348
+ allOf:
349
+ - $ref: '#/components/schemas/SpaceEvent'
350
+ - type: object
351
+ description: Event received when integration has been installed.
352
+ properties:
353
+ type:
354
+ type: string
355
+ enum:
356
+ - 'installation:setup'
357
+ status:
358
+ $ref: '#/components/schemas/IntegrationInstallationStatus'
359
+ required:
360
+ - type
361
+ - status
362
+ SpaceViewEvent:
363
+ allOf:
364
+ - $ref: '#/components/schemas/SpaceEvent'
365
+ - type: object
366
+ description: Event received when a page has been visited.
367
+ properties:
368
+ type:
369
+ type: string
370
+ enum:
371
+ - 'space:view'
372
+ pageId:
373
+ type: string
374
+ description: Unique identifier of the visited page.
375
+ visitorId:
376
+ type: string
377
+ description: Unique identifier for the visitor session.
378
+ visitorIp:
379
+ type: string
380
+ description: IP address of the visitor.
381
+ visitorUserAgent:
382
+ type: string
383
+ description: User-agent of the visitor.
384
+ required:
385
+ - type
386
+ - visitorId
387
+ - visitorIp
388
+ - visitorUserAgent
389
+ SpaceContentUpdatedEvent:
390
+ allOf:
391
+ - $ref: '#/components/schemas/SpaceEvent'
392
+ - type: object
393
+ description: Event when the primary content of a space has been updated.
394
+ properties:
395
+ type:
396
+ type: string
397
+ enum:
398
+ - 'space:content:updated'
399
+ revisionId:
400
+ type: string
401
+ description: Unique identifier of the new content revision
402
+ required:
403
+ - type
404
+ - revisionId
405
+ FetchRequest:
406
+ type: object
407
+ properties:
408
+ method:
409
+ type: string
410
+ enum:
411
+ - post
412
+ - get
413
+ - put
414
+ - delete
415
+ url:
416
+ type: string
417
+ body:
418
+ type: string
419
+ headers:
420
+ type: object
421
+ additionalProperties:
422
+ type: string
423
+ required:
424
+ - method
425
+ - url
426
+ - headers
427
+ FetchResponse:
428
+ type: object
429
+ properties:
430
+ status:
431
+ type: number
432
+ body:
433
+ type: string
434
+ headers:
435
+ type: object
436
+ additionalProperties:
437
+ type: string
438
+ required:
439
+ - status
440
+ - body
441
+ - headers
442
+ FetchEvent:
443
+ allOf:
444
+ - $ref: '#/components/schemas/InstallationEvent'
445
+ - type: object
446
+ description: Event representing an incoming HTTP request.
447
+ properties:
448
+ type:
449
+ type: string
450
+ enum:
451
+ - fetch
452
+ request:
453
+ $ref: '#/components/schemas/FetchRequest'
454
+ required:
455
+ - type
456
+ - request
457
+ responses:
458
+ UnexpectedError:
459
+ description: unexpected error
460
+ content:
461
+ application/json:
462
+ schema:
463
+ $ref: '#/components/schemas/Error'
464
+ EmptyResponse:
465
+ description: unexpected error
466
+ content:
467
+ application/json:
468
+ schema:
469
+ type: object
470
+ properties: {}
471
+ paths:
472
+ /user:
473
+ get:
474
+ operationId: getAuthenticated
475
+ summary: Get profile of authenticated user
476
+ responses:
477
+ '200':
478
+ description: OK
479
+ content:
480
+ application/json:
481
+ schema:
482
+ $ref: '#/components/schemas/User'
483
+ default:
484
+ $ref: '#/components/responses/UnexpectedError'
485
+ '/spaces/{spaceId}':
486
+ get:
487
+ operationId: getSpace
488
+ summary: Get the details about a space
489
+ parameters:
490
+ - $ref: '#/components/parameters/spaceId'
491
+ responses:
492
+ '200':
493
+ description: OK
494
+ content:
495
+ application/json:
496
+ schema:
497
+ $ref: '#/components/schemas/Space'
498
+ default:
499
+ $ref: '#/components/responses/UnexpectedError'
500
+ '/spaces/{spaceId}/views':
501
+ post:
502
+ operationId: trackPageView
503
+ description: Track a page view on a space
504
+ parameters:
505
+ - $ref: '#/components/parameters/spaceId'
506
+ responses:
507
+ '200':
508
+ $ref: '#/components/responses/EmptyResponse'
509
+ default:
510
+ $ref: '#/components/responses/UnexpectedError'
511
+ requestBody:
512
+ required: true
513
+ content:
514
+ application/json:
515
+ schema:
516
+ $ref: '#/components/schemas/RequestSpaceTrackPageView'
517
+ '/integrations/{integrationName}':
518
+ post:
519
+ operationId: publish
520
+ summary: Publish an integration
521
+ parameters:
522
+ - $ref: '#/components/parameters/integrationName'
523
+ responses:
524
+ '200':
525
+ description: OK
526
+ content:
527
+ application/json:
528
+ schema:
529
+ $ref: '#/components/schemas/Integration'
530
+ default:
531
+ $ref: '#/components/responses/UnexpectedError'
532
+ requestBody:
533
+ required: true
534
+ content:
535
+ application/json:
536
+ schema:
537
+ $ref: '#/components/schemas/RequestPublishIntegration'
538
+ '/integrations/{integrationName}/installations/{installationId}':
539
+ get:
540
+ operationId: getInstallation
541
+ summary: Get the status and configurations of an integration's installation
542
+ parameters:
543
+ - $ref: '#/components/parameters/integrationName'
544
+ - $ref: '#/components/parameters/installationId'
545
+ responses:
546
+ '200':
547
+ description: OK
548
+ content:
549
+ application/json:
550
+ schema:
551
+ $ref: '#/components/schemas/IntegrationInstallation'
552
+ default:
553
+ $ref: '#/components/responses/UnexpectedError'
554
+ patch:
555
+ operationId: updateInstallation
556
+ summary: Update status and configurations of an integration's installation
557
+ parameters:
558
+ - $ref: '#/components/parameters/integrationName'
559
+ - $ref: '#/components/parameters/installationId'
560
+ responses:
561
+ '200':
562
+ $ref: '#/components/responses/EmptyResponse'
563
+ default:
564
+ $ref: '#/components/responses/UnexpectedError'
565
+ requestBody:
566
+ required: true
567
+ content:
568
+ application/json:
569
+ schema:
570
+ $ref: '#/components/schemas/RequestUpdateIntegrationInstallation'