This repository has been archived by the owner on Jul 26, 2020. It is now read-only.
forked from Chocobozzz/PeerTube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
2215 lines (2196 loc) · 58.5 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
title: PeerTube
version: 1.3.1
contact:
name: PeerTube Community
url: 'https://joinpeertube.org'
license:
name: AGPLv3.0
url: 'https://github.com/Chocobozzz/PeerTube/blob/master/LICENSE'
x-logo:
url: 'https://joinpeertube.org/img/brand.png'
altText: PeerTube Project Homepage
description: |
# Introduction
The PeerTube API is built on HTTP(S). Our API is RESTful. It has predictable
resource URLs. It returns HTTP response codes to indicate errors. It also
accepts and returns JSON in the HTTP body. You can use your favorite
HTTP/REST library for your programming language to use PeerTube. No official
SDK is currently provided, but the spec API is fully compatible with
[openapi-generator](https://github.com/OpenAPITools/openapi-generator/wiki/API-client-generator-HOWTO)
which generates a client SDK in the language of your choice.
# Authentication
When you sign up for an account, you are given the possibility to generate
sessions, and authenticate using this session token. One session token can
currently be used at a time.
# Errors
The API uses standard HTTP status codes to indicate the success or failure
of the API call. The body of the response will be JSON in the following
format.
```
{
"code": "unauthorized_request", // example inner error code
"error": "Token is invalid." // example exposed error message
}
```
externalDocs:
url: https://docs.joinpeertube.org/api.html
tags:
- name: Accounts
description: >
Using some features of PeerTube require authentication, for which Accounts
provide different levels of permission as well as associated user
information. Accounts also encompass remote accounts discovered across the federation.
- name: Config
description: >
Each server exposes public information regarding supported videos and
options.
- name: Feeds
description: |
Feeds of videos and feeds of comments allow to see updates and get them in
an aggregator or script of your choice.
- name: Job
description: >
Jobs are long-running tasks enqueued and processed by the instance
itself. No additional worker registration is currently available.
- name: Server Following
description: >
Managing servers which the instance interacts with is crucial to the
concept of federation in PeerTube and external video indexation. The PeerTube
server then deals with inter-server ActivityPub operations and propagates
information across its social graph by posting activities to actors' inbox
endpoints.
- name: Video Abuse
description: |
Video abuses deal with reports of local or remote videos alike.
- name: Video
description: |
Operations dealing with listing, uploading, fetching or modifying videos.
- name: Search
description: |
The search helps to find _videos_ from within the instance and beyond.
Videos from other instances federated by the instance (that is, instances
followed by the instance) can be found via keywords and other criteria of
the advanced search.
- name: Video Comment
description: >
Operations dealing with comments to a video. Comments are organized in
threads.
- name: Video Channel
description: >
Operations dealing with creation, modification and video listing of a
user's channels.
- name: Video Blacklist
description: >
Operations dealing with blacklisting videos (removing them from view and
preventing interactions).
- name: Video Rate
description: >
Voting for a video.
x-tagGroups:
- name: Accounts
tags:
- Accounts
- User
- name: Videos
tags:
- Video
- Video Channel
- Video Comment
- Video Following
- Video Rate
- name: Moderation
tags:
- Video Abuse
- Video Blacklist
- name: Instance Configuration
tags:
- Config
- Server Following
- name: Notifications
tags:
- Feeds
- name: Jobs
tags:
- Job
- name: Search
tags:
- Search
paths:
'/accounts/{name}':
get:
tags:
- Accounts
summary: Get the account by name
parameters:
- $ref: '#/components/parameters/name'
- $ref: '#/components/parameters/start'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Account'
'/accounts/{name}/videos':
get:
tags:
- Accounts
- Video
summary: 'Get videos for an account, provided the name of that account'
parameters:
- $ref: '#/components/parameters/name'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Video'
x-code-samples:
- lang: JavaScript
source: |
fetch('https://peertube2.cpy.re/api/v1/accounts/{name}/videos')
.then(function(response) {
return response.json()
}).then(function(data) {
console.log(data)
})
- lang: Shell
source: |
# pip install httpie
http -b GET https://peertube2.cpy.re/api/v1/accounts/{name}/videos
- lang: Ruby
source: |
require 'uri'
require 'net/http'
url = URI("https://peertube2.cpy.re/api/v1/accounts/{name}/videos")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
response = http.request(request)
puts response.read_body
- lang: Python
source: |
import http.client
conn = http.client.HTTPSConnection("https://peertube2.cpy.re/api/v1")
headers = {
'content-type': "application/json"
}
conn.request("POST", "/accounts/{name}/videos", None, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
/accounts:
get:
tags:
- Accounts
summary: Get all accounts
responses:
'200':
description: successful operation
content:
'application/json':
schema:
type: array
items:
$ref: '#/components/schemas/Account'
/config:
get:
tags:
- Config
summary: Get the public configuration of the server
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/ServerConfig'
/config/about:
get:
summary: Get the instance about page content
tags:
- Config
responses:
'200':
description: successful operation
/config/custom:
get:
summary: Get the runtime configuration of the server
tags:
- Config
security:
- OAuth2:
- admin
responses:
'200':
description: successful operation
put:
summary: Set the runtime configuration of the server
tags:
- Config
security:
- OAuth2:
- admin
responses:
'200':
description: successful operation
delete:
summary: Delete the runtime configuration of the server
tags:
- Config
security:
- OAuth2:
- admin
responses:
'200':
description: successful operation
'/feeds/videos.{format}':
get:
summary: >-
Get the feed of videos for the server, with optional filter by account
name or id
tags:
- Feeds
parameters:
- name: format
in: path
required: true
description: >-
The format expected (xml defaults to RSS 2.0, atom to ATOM 1.0 and
json to JSON FEED 1.0
schema:
type: string
enum:
- xml
- atom
- json
default: xml
- name: accountId
in: query
required: false
description: >-
The id of the local account to filter to (beware, users IDs and not
actors IDs which will return empty feeds
schema:
type: number
- name: accountName
in: query
required: false
description: The name of the local account to filter to
schema:
type: string
responses:
'200':
description: successful operation
/jobs/{state}:
get:
summary: Get list of jobs
security:
- OAuth2:
- admin
tags:
- Job
parameters:
- name: state
in: path
required: true
description: The state of the job
schema:
type: string
enum:
- active
- completed
- failed
- waiting
- delayed
- $ref: '#/components/parameters/start'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Job'
'/server/following/{host}':
delete:
security:
- OAuth2:
- admin
tags:
- Server Following
summary: Unfollow a server by hostname
parameters:
- name: host
in: path
required: true
description: 'The host to unfollow '
schema:
type: string
responses:
'201':
description: successful operation
/server/followers:
get:
tags:
- Server Following
summary: Get followers of the server
parameters:
- $ref: '#/components/parameters/start'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Follow'
/server/following:
get:
tags:
- Server Following
summary: Get servers followed by the server
parameters:
- $ref: '#/components/parameters/start'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Follow'
post:
security:
- OAuth2:
- admin
tags:
- Server Following
summary: Follow a server
responses:
'204':
$ref: '#/paths/~1users~1me/put/responses/204'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Follow'
/users:
post:
summary: Creates user
security:
- OAuth2:
- admin
tags:
- User
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/AddUserResponse'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AddUser'
description: User to create
required: true
get:
summary: Get a list of users
security:
- OAuth2: []
tags:
- User
parameters:
- $ref: '#/components/parameters/start'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/usersSort'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
'/users/{id}':
delete:
summary: Delete a user by its id
security:
- OAuth2:
- admin
tags:
- User
parameters:
- $ref: '#/components/parameters/id'
responses:
'204':
$ref: '#/paths/~1users~1me/put/responses/204'
get:
summary: Get user by its id
security:
- OAuth2: []
tags:
- User
parameters:
- $ref: '#/components/parameters/id'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/User'
put:
summary: Update user profile by its id
security:
- OAuth2: []
tags:
- User
parameters:
- $ref: '#/components/parameters/id'
responses:
'204':
$ref: '#/paths/~1users~1me/put/responses/204'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateUser'
required: true
/users/me:
get:
summary: Get current user information
security:
- OAuth2:
- user
tags:
- User
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
put:
summary: Update current user information
security:
- OAuth2:
- user
tags:
- User
responses:
'204':
description: Successful operation
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateMe'
required: true
/users/me/video-quota-used:
get:
summary: Get current user used quota
security:
- OAuth2:
- user
tags:
- User
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: number
'/users/me/videos/{videoId}/rating':
get:
summary: 'Get rating of video by its id, among those of the current user'
security:
- OAuth2: []
tags:
- User
parameters:
- name: videoId
in: path
required: true
description: 'The video id '
schema:
type: string
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/GetMeVideoRating'
/users/me/videos:
get:
summary: Get videos of the current user
security:
- OAuth2:
- user
tags:
- User
parameters:
- $ref: '#/components/parameters/start'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Video'
/users/me/subscriptions:
get:
summary: Get subscriptions of the current user
security:
- OAuth2:
- user
tags:
- User
parameters:
- $ref: '#/components/parameters/start'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
responses:
'200':
description: successful operation
post:
summary: Add subscription to the current user
security:
- OAuth2:
- user
tags:
- User
responses:
'200':
description: successful operation
/users/me/subscriptions/exist:
get:
summary: Get if subscriptions exist for the current user
security:
- OAuth2:
- user
tags:
- User
parameters:
- $ref: '#/components/parameters/subscriptionsUris'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
/users/me/subscriptions/videos:
get:
summary: Get videos of subscriptions of the current user
security:
- OAuth2:
- user
tags:
- User
parameters:
- $ref: '#/components/parameters/start'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Video'
'/users/me/subscriptions/{uri}':
get:
summary: Get subscription of the current user for a given uri
security:
- OAuth2:
- user
tags:
- User
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/VideoChannel'
delete:
summary: Delete subscription of the current user for a given uri
security:
- OAuth2:
- user
tags:
- User
responses:
'200':
description: successful operation
/users/register:
post:
summary: Register a user
tags:
- User
responses:
'204':
$ref: '#/paths/~1users~1me/put/responses/204'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RegisterUser'
required: true
/users/me/avatar/pick:
post:
summary: Update current user avatar
security:
- OAuth2: []
tags:
- User
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Avatar'
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
avatarfile:
description: The file to upload.
type: string
format: binary
encoding:
profileImage:
# only accept png/jpeg
contentType: image/png, image/jpeg
/videos:
get:
summary: Get list of videos
tags:
- Video
parameters:
- $ref: '#/components/parameters/categoryOneOf'
- $ref: '#/components/parameters/tagsOneOf'
- $ref: '#/components/parameters/tagsAllOf'
- $ref: '#/components/parameters/licenceOneOf'
- $ref: '#/components/parameters/languageOneOf'
- $ref: '#/components/parameters/nsfw'
- $ref: '#/components/parameters/filter'
- $ref: '#/components/parameters/start'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/videosSort'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Video'
/videos/categories:
get:
summary: Get list of video licences known by the server
tags:
- Video
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
type: string
/videos/licences:
get:
summary: Get list of video licences known by the server
tags:
- Video
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
type: string
/videos/languages:
get:
summary: Get list of languages known by the server
tags:
- Video
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
type: string
/videos/privacies:
get:
summary: Get list of privacy policies supported by the server
tags:
- Video
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
type: string
'/videos/{id}':
put:
summary: Update metadata for a video by its id
security:
- OAuth2: []
tags:
- Video
parameters:
- $ref: '#/components/parameters/id2'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Video'
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
thumbnailfile:
description: Video thumbnail file
type: string
previewfile:
description: Video preview file
type: string
category:
description: Video category
type: string
licence:
description: Video licence
type: string
language:
description: Video language
type: string
description:
description: Video description
type: string
waitTranscoding:
description: Whether or not we wait transcoding before publish the video
type: string
support:
description: Text describing how to support the video uploader
type: string
nsfw:
description: Whether or not this video contains sensitive content
type: string
name:
description: Video name
type: string
tags:
description: Video tags (maximum 5 tags each between 2 and 30 characters)
type: array
items:
type: string
commentsEnabled:
description: Enable or disable comments for this video
type: string
scheduleUpdate: &ref_0
type: object
properties:
privacy:
type: string
enum:
- Public
- Unlisted
description: Video privacy target
updateAt:
type: string
format: date
description: When to update the video
required:
- updateAt
get:
summary: Get a video by its id
tags:
- Video
parameters:
- $ref: '#/components/parameters/id2'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Video'
delete:
summary: Delete a video by its id
security:
- OAuth2: []
tags:
- Video
parameters:
- $ref: '#/components/parameters/id2'
responses:
'204':
$ref: '#/paths/~1users~1me/put/responses/204'
'/videos/{id}/description':
get:
summary: Get a video description by its id
tags:
- Video
parameters:
- $ref: '#/components/parameters/id2'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: string
'/videos/{id}/views':
post:
summary: Add a view to the video by its id
tags:
- Video
parameters:
- $ref: '#/components/parameters/id2'
responses:
'204':
$ref: '#/paths/~1users~1me/put/responses/204'
'/videos/{id}/watching':
put:
summary: Set watching progress of a video by its id for a user
tags:
- Video
security:
- OAuth2: []
parameters:
- $ref: '#/components/parameters/id2'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UserWatchingVideo'
required: true
responses:
'204':
$ref: '#/paths/~1users~1me/put/responses/204'
/videos/ownership:
get:
summary: Get list of video ownership changes requests
tags:
- Video
security:
- OAuth2: []
parameters:
- $ref: '#/components/parameters/id2'
responses:
'200':
description: successful operation
'/videos/ownership/{id}/accept':
post:
summary: Refuse ownership change request for video by its id
tags:
- Video
security:
- OAuth2: []
parameters:
- $ref: '#/components/parameters/id2'
responses:
'204':
$ref: '#/paths/~1users~1me/put/responses/204'
'/videos/ownership/{id}/refuse':
post:
summary: Accept ownership change request for video by its id
tags:
- Video
security:
- OAuth2: []
parameters:
- $ref: '#/components/parameters/id2'
responses:
'204':
$ref: '#/paths/~1users~1me/put/responses/204'
'/videos/{id}/give-ownership':
post:
summary: Request change of ownership for a video you own, by its id
tags:
- Video
security:
- OAuth2: []
parameters:
- $ref: '#/components/parameters/id2'
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
username:
type: string
required:
- username
responses:
'204':
$ref: '#/paths/~1users~1me/put/responses/204'
'400':
description: 'Changing video ownership to a remote account is not supported yet'
/videos/upload:
post:
summary: Upload a video file with its metadata
security:
- OAuth2: []
tags:
- Video