grouping tags by main category in the spec

This commit is contained in:
Rigel Kent 2018-11-16 14:33:48 +01:00
parent 6441981bc6
commit 5776f78e3b
No known key found for this signature in database
GPG Key ID: EA12971B0E438F36
1 changed files with 114 additions and 45 deletions

View File

@ -10,29 +10,41 @@ info:
url: 'https://github.com/Chocobozzz/PeerTube/blob/master/LICENSE' url: 'https://github.com/Chocobozzz/PeerTube/blob/master/LICENSE'
x-logo: x-logo:
url: 'https://joinpeertube.org/img/brand.png' url: 'https://joinpeertube.org/img/brand.png'
altText: PeerTube Project Homepage
description: | description: |
# Introduction # Introduction
The PeerTube API is built on HTTP(S). Our API is RESTful. It has predictable 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 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 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 HTTP/REST library for your programming language to use PeerTube. No official
SDK is currently provided. 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 # Authentication
When you sign up for an account, you are given the possibility to generate 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 sessions, and authenticate using this session token. One session token can
currently be used at a time. 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: externalDocs:
url: https://docs.joinpeertube.org/api.html url: https://docs.joinpeertube.org/api.html
tags: tags:
- name: Accounts - name: Accounts
description: > description: >
Using some features of PeerTube require authentication, for which Accounts Using some features of PeerTube require authentication, for which Accounts
provide different levels of permission as well as associated user provide different levels of permission as well as associated user
information. information. Accounts also encompass remote accounts discovered across the federation.
Accounts also encompass remote accounts discovered across the federation.
- name: Config - name: Config
description: > description: >
Each server exposes public information regarding supported videos and Each server exposes public information regarding supported videos and
@ -44,23 +56,15 @@ tags:
- name: Job - name: Job
description: > description: >
Jobs are long-running tasks enqueued and processed by the instance Jobs are long-running tasks enqueued and processed by the instance
itself. itself. No additional worker registration is currently available.
- name: Server Following
No additional worker registration is currently available.
- name: ServerFollowing
description: > description: >
Managing servers which the instance interacts with is crucial to the Managing servers which the instance interacts with is crucial to the
concept concept of federation in PeerTube and external video indexation. The PeerTube
server then deals with inter-server ActivityPub operations and propagates
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 information across its social graph by posting activities to actors' inbox
endpoints. endpoints.
- name: VideoAbuse - name: Video Abuse
description: | description: |
Video abuses deal with reports of local or remote videos alike. Video abuses deal with reports of local or remote videos alike.
- name: Video - name: Video
@ -72,16 +76,50 @@ tags:
Videos from other instances federated by the instance (that is, instances Videos from other instances federated by the instance (that is, instances
followed by the instance) can be found via keywords and other criteria of followed by the instance) can be found via keywords and other criteria of
the advanced search. the advanced search.
- name: VideoComment - name: Video Comment
description: > description: >
Operations dealing with comments to a video. Comments are organized in Operations dealing with comments to a video. Comments are organized in
threads. threads.
- name: VideoChannel - name: Video Channel
description: > description: >
Operations dealing with creation, modification and video listing of a Operations dealing with creation, modification and video listing of a
user's user's channels.
- name: Video Blacklist
channels. 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 Abuse
- Video Following
- Video Rate
- name: Moderation
tags:
- Video Blacklist
- name: Public Instance Information
tags:
- Config
- Server Following
- name: Notifications
tags:
- Feeds
- name: Jobs
tags:
- Job
- name: Search
tags:
- Search
paths: paths:
'/accounts/{name}': '/accounts/{name}':
get: get:
@ -128,6 +166,37 @@ paths:
source: | source: |
# pip install httpie # pip install httpie
http -b GET https://peertube2.cpy.re/api/v1/accounts/{name}/videos 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: /accounts:
get: get:
tags: tags:
@ -264,7 +333,7 @@ paths:
- OAuth2: - OAuth2:
- admin - admin
tags: tags:
- ServerFollowing - Server Following
summary: Unfollow a server by hostname summary: Unfollow a server by hostname
parameters: parameters:
- name: host - name: host
@ -279,7 +348,7 @@ paths:
/server/followers: /server/followers:
get: get:
tags: tags:
- ServerFollowing - Server Following
summary: Get followers of the server summary: Get followers of the server
parameters: parameters:
- $ref: '#/components/parameters/start' - $ref: '#/components/parameters/start'
@ -297,7 +366,7 @@ paths:
/server/following: /server/following:
get: get:
tags: tags:
- ServerFollowing - Server Following
summary: Get servers followed by the server summary: Get servers followed by the server
parameters: parameters:
- $ref: '#/components/parameters/start' - $ref: '#/components/parameters/start'
@ -317,7 +386,7 @@ paths:
- OAuth2: - OAuth2:
- admin - admin
tags: tags:
- ServerFollowing - Server Following
summary: Follow a server summary: Follow a server
responses: responses:
'204': '204':
@ -923,7 +992,7 @@ paths:
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
- VideoAbuse - Video Abuse
parameters: parameters:
- $ref: '#/components/parameters/start' - $ref: '#/components/parameters/start'
- $ref: '#/components/parameters/count' - $ref: '#/components/parameters/count'
@ -943,7 +1012,7 @@ paths:
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
- VideoAbuse - Video Abuse
parameters: parameters:
- $ref: '#/components/parameters/id2' - $ref: '#/components/parameters/id2'
responses: responses:
@ -957,7 +1026,7 @@ paths:
- admin - admin
- moderator - moderator
tags: tags:
- VideoBlacklist - Video Blacklist
parameters: parameters:
- $ref: '#/components/parameters/id2' - $ref: '#/components/parameters/id2'
responses: responses:
@ -970,7 +1039,7 @@ paths:
- admin - admin
- moderator - moderator
tags: tags:
- VideoBlacklist - Video Blacklist
parameters: parameters:
- $ref: '#/components/parameters/id2' - $ref: '#/components/parameters/id2'
responses: responses:
@ -984,7 +1053,7 @@ paths:
- admin - admin
- moderator - moderator
tags: tags:
- VideoBlacklist - Video Blacklist
parameters: parameters:
- $ref: '#/components/parameters/start' - $ref: '#/components/parameters/start'
- $ref: '#/components/parameters/count' - $ref: '#/components/parameters/count'
@ -1002,7 +1071,7 @@ paths:
get: get:
summary: Get list of video channels summary: Get list of video channels
tags: tags:
- VideoChannel - Video Channel
parameters: parameters:
- $ref: '#/components/parameters/start' - $ref: '#/components/parameters/start'
- $ref: '#/components/parameters/count' - $ref: '#/components/parameters/count'
@ -1021,7 +1090,7 @@ paths:
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
- VideoChannel - Video Channel
responses: responses:
'204': '204':
$ref: '#/paths/~1users~1me/put/responses/204' $ref: '#/paths/~1users~1me/put/responses/204'
@ -1031,7 +1100,7 @@ paths:
get: get:
summary: Get a video channel by its id summary: Get a video channel by its id
tags: tags:
- VideoChannel - Video Channel
parameters: parameters:
- $ref: '#/components/parameters/id3' - $ref: '#/components/parameters/id3'
responses: responses:
@ -1046,7 +1115,7 @@ paths:
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
- VideoChannel - Video Channel
parameters: parameters:
- $ref: '#/components/parameters/id3' - $ref: '#/components/parameters/id3'
responses: responses:
@ -1059,7 +1128,7 @@ paths:
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
- VideoChannel - Video Channel
parameters: parameters:
- $ref: '#/components/parameters/id3' - $ref: '#/components/parameters/id3'
responses: responses:
@ -1069,7 +1138,7 @@ paths:
get: get:
summary: Get videos of a video channel by its id summary: Get videos of a video channel by its id
tags: tags:
- VideoChannel - Video Channel
parameters: parameters:
- $ref: '#/components/parameters/id3' - $ref: '#/components/parameters/id3'
responses: responses:
@ -1083,7 +1152,7 @@ paths:
get: get:
summary: Get video channels of an account by its name summary: Get video channels of an account by its name
tags: tags:
- VideoChannel - Video Channel
parameters: parameters:
- $ref: '#/components/parameters/name' - $ref: '#/components/parameters/name'
responses: responses:
@ -1099,7 +1168,7 @@ paths:
get: get:
summary: Get the comment threads of a video by its id summary: Get the comment threads of a video by its id
tags: tags:
- VideoComment - Video Comment
parameters: parameters:
- $ref: '#/components/parameters/id2' - $ref: '#/components/parameters/id2'
- $ref: '#/components/parameters/start' - $ref: '#/components/parameters/start'
@ -1117,7 +1186,7 @@ paths:
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
- VideoComment - Video Comment
parameters: parameters:
- $ref: '#/components/parameters/id2' - $ref: '#/components/parameters/id2'
responses: responses:
@ -1131,7 +1200,7 @@ paths:
get: get:
summary: 'Get the comment thread by its id, of a video by its id' summary: 'Get the comment thread by its id, of a video by its id'
tags: tags:
- VideoComment - Video Comment
parameters: parameters:
- $ref: '#/components/parameters/id2' - $ref: '#/components/parameters/id2'
- name: threadId - name: threadId
@ -1153,7 +1222,7 @@ paths:
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
- VideoComment - Video Comment
parameters: parameters:
- $ref: '#/components/parameters/id2' - $ref: '#/components/parameters/id2'
- $ref: '#/components/parameters/commentId' - $ref: '#/components/parameters/commentId'
@ -1169,7 +1238,7 @@ paths:
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
- VideoComment - Video Comment
parameters: parameters:
- $ref: '#/components/parameters/id2' - $ref: '#/components/parameters/id2'
- $ref: '#/components/parameters/commentId' - $ref: '#/components/parameters/commentId'
@ -1182,7 +1251,7 @@ paths:
security: security:
- OAuth2: [] - OAuth2: []
tags: tags:
- VideoRate - Video Rate
parameters: parameters:
- $ref: '#/components/parameters/id2' - $ref: '#/components/parameters/id2'
responses: responses: