aboutsummaryrefslogtreecommitdiffhomepage
path: root/support
diff options
context:
space:
mode:
Diffstat (limited to 'support')
-rw-r--r--support/doc/api/openapi.yaml11
-rw-r--r--support/doc/api/quickstart.md10
-rw-r--r--support/doc/docker.md3
-rw-r--r--support/doc/production.md2
-rw-r--r--support/doc/tools.md32
-rw-r--r--support/openapi/go/README.mustache121
-rw-r--r--support/openapi/go/def.yaml3
-rw-r--r--support/openapi/kotlin/README.mustache97
-rw-r--r--support/openapi/kotlin/def.yaml6
-rw-r--r--support/openapi/python/README.mustache47
-rw-r--r--support/openapi/python/def.yaml5
11 files changed, 332 insertions, 5 deletions
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml
index f1cfb81a4..40f7e0cdd 100644
--- a/support/doc/api/openapi.yaml
+++ b/support/doc/api/openapi.yaml
@@ -13,6 +13,7 @@ info:
13 altText: PeerTube Project Homepage 13 altText: PeerTube Project Homepage
14 description: | 14 description: |
15 # Introduction 15 # Introduction
16
16 The PeerTube API is built on HTTP(S). Our API is RESTful. It has predictable 17 The PeerTube API is built on HTTP(S). Our API is RESTful. It has predictable
17 resource URLs. It returns HTTP response codes to indicate errors. It also 18 resource URLs. It returns HTTP response codes to indicate errors. It also
18 accepts and returns JSON in the HTTP body. You can use your favorite 19 accepts and returns JSON in the HTTP body. You can use your favorite
@@ -22,11 +23,13 @@ info:
22 which generates a client SDK in the language of your choice. 23 which generates a client SDK in the language of your choice.
23 24
24 # Authentication 25 # Authentication
26
25 When you sign up for an account, you are given the possibility to generate 27 When you sign up for an account, you are given the possibility to generate
26 sessions, and authenticate using this session token. One session token can 28 sessions, and authenticate using this session token. One session token can
27 currently be used at a time. 29 currently be used at a time.
28 30
29 # Errors 31 # Errors
32
30 The API uses standard HTTP status codes to indicate the success or failure 33 The API uses standard HTTP status codes to indicate the success or failure
31 of the API call. The body of the response will be JSON in the following 34 of the API call. The body of the response will be JSON in the following
32 format. 35 format.
@@ -977,6 +980,12 @@ paths:
977 application/json: 980 application/json:
978 schema: 981 schema:
979 $ref: '#/components/schemas/VideoUploadResponse' 982 $ref: '#/components/schemas/VideoUploadResponse'
983 '403':
984 description: 'The user video quota is exceeded with this video.'
985 '408':
986 description: 'Upload has timed out'
987 '422':
988 description: 'Invalid input file.'
980 requestBody: 989 requestBody:
981 content: 990 content:
982 multipart/form-data: 991 multipart/form-data:
@@ -2772,7 +2781,7 @@ components:
2772 description: 'The user username ' 2781 description: 'The user username '
2773 password: 2782 password:
2774 type: string 2783 type: string
2775 description: 'The user password ' 2784 description: 'The user password. If the smtp server is configured, you can leave empty and an email will be sent '
2776 email: 2785 email:
2777 type: string 2786 type: string
2778 description: 'The user email ' 2787 description: 'The user email '
diff --git a/support/doc/api/quickstart.md b/support/doc/api/quickstart.md
index 2222be741..677745969 100644
--- a/support/doc/api/quickstart.md
+++ b/support/doc/api/quickstart.md
@@ -52,3 +52,13 @@ $ curl -H 'Authorization: Bearer 90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0' https
52```bash 52```bash
53$ curl https://peertube.example.com/api/v1/videos 53$ curl https://peertube.example.com/api/v1/videos
54``` 54```
55
56## Libraries
57
58[Convenience libraries](https://framagit.org/framasoft/peertube/clients) are generated automatically from the [OpenAPI specification](https://github.com/Chocobozzz/PeerTube/blob/develop/support/doc/api/openapi.yaml) for the following languages:
59
60- [python](https://framagit.org/framasoft/peertube/clients/python)
61- [go](https://framagit.org/framasoft/peertube/clients/go)
62- [kotlin](https://framagit.org/framasoft/peertube/clients/kotlin)
63
64Other [languages supported by the OpenAPI generator](https://openapi-generator.tech/docs/generators/#client-generators) can be added to the generation, provided they make a common enough use case.
diff --git a/support/doc/docker.md b/support/doc/docker.md
index d7059d285..b251329d0 100644
--- a/support/doc/docker.md
+++ b/support/doc/docker.md
@@ -21,8 +21,7 @@ $ curl "https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/doc
21$ touch ./docker-volume/traefik/acme.json && chmod 600 ./docker-volume/traefik/acme.json 21$ touch ./docker-volume/traefik/acme.json && chmod 600 ./docker-volume/traefik/acme.json
22$ curl -s "https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/docker-compose.yml" -o docker-compose.yml "https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/docker/production/.env" -o .env 22$ curl -s "https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/docker-compose.yml" -o docker-compose.yml "https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/docker/production/.env" -o .env
23``` 23```
24View the source of the files you're about to download: [docker-compose.yml](https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/docker-compose.yml) and the [traefik.toml](https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/config/traefik.toml) and the [.env] 24View the source of the files you're about to download: [docker-compose.yml](https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/docker-compose.yml) and the [traefik.toml](https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/config/traefik.toml) and the [.env](https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/.env)
25(https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/.env)
26 25
27Update the reverse proxy configuration: 26Update the reverse proxy configuration:
28 27
diff --git a/support/doc/production.md b/support/doc/production.md
index 8f061f868..6febaba5d 100644
--- a/support/doc/production.md
+++ b/support/doc/production.md
@@ -39,7 +39,7 @@ Create the production database and a peertube user inside PostgreSQL:
39 39
40``` 40```
41$ sudo -u postgres createuser -P peertube 41$ sudo -u postgres createuser -P peertube
42$ sudo -u postgres createdb -O peertube peertube_prod 42$ sudo -u postgres createdb -O peertube -E UTF8 -T template0 peertube_prod
43``` 43```
44 44
45Then enable extensions PeerTube needs: 45Then enable extensions PeerTube needs:
diff --git a/support/doc/tools.md b/support/doc/tools.md
index d5427b5b7..1f1e52c36 100644
--- a/support/doc/tools.md
+++ b/support/doc/tools.md
@@ -12,6 +12,7 @@
12 - [peertube-upload.js](#peertube-uploadjs) 12 - [peertube-upload.js](#peertube-uploadjs)
13 - [peertube-watch.js](#peertube-watchjs) 13 - [peertube-watch.js](#peertube-watchjs)
14 - [peertube-plugins.js](#peertube-pluginsjs) 14 - [peertube-plugins.js](#peertube-pluginsjs)
15 - [peertube-redundancy.js](#peertube-redundancyjs)
15- [Server tools](#server-tools) 16- [Server tools](#server-tools)
16 - [parse-log](#parse-log) 17 - [parse-log](#parse-log)
17 - [create-transcoding-job.js](#create-transcoding-jobjs) 18 - [create-transcoding-job.js](#create-transcoding-jobjs)
@@ -77,7 +78,8 @@ You can access it as `peertube` via an alias in your `.bashrc` like `alias peert
77 import-videos|import import a video from a streaming platform 78 import-videos|import import a video from a streaming platform
78 watch|w watch a video in the terminal ✩°。⋆ 79 watch|w watch a video in the terminal ✩°。⋆
79 repl initiate a REPL to access internals 80 repl initiate a REPL to access internals
80 plugins|p [action] manag instance plugins 81 plugins|p [action] manage instance plugins
82 redundancy|r [action] manage video redundancies
81 help [cmd] display help for [cmd] 83 help [cmd] display help for [cmd]
82``` 84```
83 85
@@ -200,6 +202,34 @@ $ node dist/server/tools/peertube-plugins.js install --path /my/plugin/path
200$ node dist/server/tools/peertube-plugins.js install --npm-name peertube-theme-example 202$ node dist/server/tools/peertube-plugins.js install --npm-name peertube-theme-example
201``` 203```
202 204
205#### peertube-redundancy.js
206
207Manage (list/add/remove) video redundancies:
208
209To list your videos that are duplicated by remote instances:
210
211```
212$ node dist/server/tools/peertube.js redundancy list-remote-redundancies
213```
214
215To list remote videos that your instance duplicated:
216
217```
218$ node dist/server/tools/peertube.js redundancy list-my-redundancies
219```
220
221To duplicate a specific video in your redundancy system:
222
223```
224$ node dist/server/tools/peertube.js redundancy add --video 823
225```
226
227To remove a video redundancy:
228
229```
230$ node dist/server/tools/peertube.js redundancy remove --video 823
231```
232
203## Server tools 233## Server tools
204 234
205These scripts should be run on the server, in `peertube-latest` directory. 235These scripts should be run on the server, in `peertube-latest` directory.
diff --git a/support/openapi/go/README.mustache b/support/openapi/go/README.mustache
new file mode 100644
index 000000000..d0fc0fa33
--- /dev/null
+++ b/support/openapi/go/README.mustache
@@ -0,0 +1,121 @@
1# Go API client for {{appName}}
2
3This Python package is automatically generated from [PeerTube's REST API](https://docs.joinpeertube.org/api-rest-reference.html),
4using the [OpenAPI Generator](https://openapi-generator.tech) project:
5
6- API version: {{appVersion}}
7- Package version: {{packageVersion}}
8{{^hideGenerationTimestamp}}
9- Build date: {{generatedDate}}
10{{/hideGenerationTimestamp}}
11- Build package: {{generatorClass}}
12
13{{#infoUrl}}
14For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
15{{/infoUrl}}
16
17## Installation
18
19Install the following dependencies:
20
21```shell
22go get github.com/stretchr/testify/assert
23go get golang.org/x/oauth2
24go get golang.org/x/net/context
25go get github.com/antihax/optional
26```
27
28Put the package under your project folder and add the following in import:
29
30```golang
31import "./{{packageName}}"
32```
33
34## Documentation for API Endpoints
35
36All URIs are relative to *{{basePath}}*
37
38Class | Method | HTTP request | Description
39------------ | ------------- | ------------- | -------------
40{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
41{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
42
43## Documentation For Models
44
45{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
46{{/model}}{{/models}}
47
48## Documentation For Authorization
49
50{{^authMethods}} Endpoints do not require authorization.
51{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
52{{#authMethods}}
53
54## {{{name}}}
55
56{{#isApiKey}}- **Type**: API key
57
58Example
59
60```golang
61auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
62 Key: "APIKEY",
63 Prefix: "Bearer", // Omit if not necessary.
64})
65r, err := client.Service.Operation(auth, args)
66```
67
68{{/isApiKey}}
69{{#isBasic}}- **Type**: HTTP basic authentication
70
71Example
72
73```golang
74auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
75 UserName: "username",
76 Password: "password",
77})
78r, err := client.Service.Operation(auth, args)
79```
80
81{{/isBasic}}
82{{#isOAuth}}
83
84- **Type**: OAuth
85- **Flow**: {{{flow}}}
86- **Authorization URL**: {{{authorizationUrl}}}
87- **Scopes**: {{^scopes}}N/A{{/scopes}}
88{{#scopes}} - **{{{scope}}}**: {{{description}}}
89{{/scopes}}
90
91Example
92
93```golang
94auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
95r, err := client.Service.Operation(auth, args)
96```
97
98Or via OAuth2 module to automatically refresh tokens and perform user authentication.
99
100```golang
101import "golang.org/x/oauth2"
102
103/* Perform OAuth2 round trip request and obtain a token */
104
105tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
106auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
107r, err := client.Service.Operation(auth, args)
108```
109
110{{/isOAuth}}
111{{/authMethods}}
112
113## License
114
115Copyright (C) 2015-2020 PeerTube Contributors
116
117This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
118
119This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
120
121You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses.
diff --git a/support/openapi/go/def.yaml b/support/openapi/go/def.yaml
new file mode 100644
index 000000000..7136da912
--- /dev/null
+++ b/support/openapi/go/def.yaml
@@ -0,0 +1,3 @@
1# https://openapi-generator.tech/docs/generators/go
2
3packageName: peertube
diff --git a/support/openapi/kotlin/README.mustache b/support/openapi/kotlin/README.mustache
new file mode 100644
index 000000000..ac7fbdea9
--- /dev/null
+++ b/support/openapi/kotlin/README.mustache
@@ -0,0 +1,97 @@
1# Kotlin API client for {{appName}}
2
3## Requires
4
5{{#jvm}}
6* Kotlin 1.3.41
7* Gradle 4.9
8{{/jvm}}
9{{#multiplatform}}
10* Kotlin 1.3.50
11{{/multiplatform}}
12
13## Build
14
15{{#jvm}}
16First, create the gradle wrapper script:
17
18```
19gradle wrapper
20```
21
22Then, run:
23
24{{/jvm}}
25```
26./gradlew check assemble
27```
28
29This runs all tests and packages the library.
30
31## Features/Implementation Notes
32
33{{#generateApiDocs}}
34<a name="documentation-for-api-endpoints"></a>
35## Documentation for API Endpoints
36
37All URIs are relative to *{{{basePath}}}*. Change it when instanciating `ApiClient(basePath)`.
38
39Class | Method | HTTP request | Description
40------------ | ------------- | ------------- | -------------
41{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
42{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
43{{/generateApiDocs}}
44
45{{#generateModelDocs}}
46<a name="documentation-for-models"></a>
47## Documentation for Models
48
49{{#modelPackage}}
50{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
51{{/model}}{{/models}}
52{{/modelPackage}}
53{{^modelPackage}}
54No model defined in this package
55{{/modelPackage}}
56{{/generateModelDocs}}
57
58<a name="documentation-for-authorization"></a>{{! TODO: optional documentation for authorization? }}
59## Documentation for Authorization
60
61{{^authMethods}}
62All endpoints do not require authorization.
63{{/authMethods}}
64{{#authMethods}}
65{{#last}}
66Authentication schemes defined for the API:
67{{/last}}
68{{/authMethods}}
69{{#authMethods}}
70<a name="{{name}}"></a>
71### {{name}}
72
73{{#isApiKey}}- **Type**: API key
74- **API key parameter name**: {{keyParamName}}
75- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
76{{/isApiKey}}
77{{#isBasic}}- **Type**: HTTP basic authentication
78{{/isBasic}}
79{{#isOAuth}}- **Type**: OAuth
80- **Flow**: {{flow}}
81- **Authorization URL**: {{authorizationUrl}}
82- **Scopes**: {{^scopes}}N/A{{/scopes}}
83{{#scopes}} - {{scope}}: {{description}}
84{{/scopes}}
85{{/isOAuth}}
86
87{{/authMethods}}
88
89## License
90
91Copyright (C) 2015-2020 PeerTube Contributors
92
93This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
94
95This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
96
97You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses.
diff --git a/support/openapi/kotlin/def.yaml b/support/openapi/kotlin/def.yaml
new file mode 100644
index 000000000..7a01ae6e5
--- /dev/null
+++ b/support/openapi/kotlin/def.yaml
@@ -0,0 +1,6 @@
1# https://openapi-generator.tech/docs/generators/kotlin
2
3artifactId: peertube-api
4groupId: org.peertube
5packageName: org.peertube.client
6
diff --git a/support/openapi/python/README.mustache b/support/openapi/python/README.mustache
new file mode 100644
index 000000000..93dcd5ab6
--- /dev/null
+++ b/support/openapi/python/README.mustache
@@ -0,0 +1,47 @@
1# Python API client for {{appName}}
2
3This Python package is automatically generated from [PeerTube's REST API](https://docs.joinpeertube.org/api-rest-reference.html),
4using the [OpenAPI Generator](https://openapi-generator.tech) project:
5
6- API version: {{appVersion}}
7- Package version: {{packageVersion}}
8{{^hideGenerationTimestamp}}
9- Build date: {{generatedDate}}
10{{/hideGenerationTimestamp}}
11- Build package: {{generatorClass}}
12
13{{#infoUrl}}
14For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
15{{/infoUrl}}
16
17## Requirements.
18
19Python 2.7 and 3.4+
20
21## Installation & Usage
22
23```sh
24pip install git+https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git
25```
26(you may need to run `pip` with root permission: `sudo pip install git+https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git`)
27
28Then import the package:
29```python
30import {{{packageName}}}
31```
32
33## Getting Started
34
35Please follow the [installation procedure](#installation--usage) and then run the following:
36
37{{> common_README }}
38
39## License
40
41Copyright (C) 2015-2020 PeerTube Contributors
42
43This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
44
45This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
46
47You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses.
diff --git a/support/openapi/python/def.yaml b/support/openapi/python/def.yaml
new file mode 100644
index 000000000..819a466eb
--- /dev/null
+++ b/support/openapi/python/def.yaml
@@ -0,0 +1,5 @@
1# https://openapi-generator.tech/docs/generators/python
2
3packageName: peertube
4projectName: peertube
5