diff options
Diffstat (limited to 'support/openapi')
-rw-r--r-- | support/openapi/go/README.mustache | 121 | ||||
-rw-r--r-- | support/openapi/go/def.yaml | 3 | ||||
-rw-r--r-- | support/openapi/kotlin/README.mustache | 97 | ||||
-rw-r--r-- | support/openapi/kotlin/def.yaml | 6 | ||||
-rw-r--r-- | support/openapi/python/README.mustache | 47 | ||||
-rw-r--r-- | support/openapi/python/def.yaml | 5 |
6 files changed, 279 insertions, 0 deletions
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 | |||
3 | This Python package is automatically generated from [PeerTube's REST API](https://docs.joinpeertube.org/api-rest-reference.html), | ||
4 | using 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}} | ||
14 | For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) | ||
15 | {{/infoUrl}} | ||
16 | |||
17 | ## Installation | ||
18 | |||
19 | Install the following dependencies: | ||
20 | |||
21 | ```shell | ||
22 | go get github.com/stretchr/testify/assert | ||
23 | go get golang.org/x/oauth2 | ||
24 | go get golang.org/x/net/context | ||
25 | go get github.com/antihax/optional | ||
26 | ``` | ||
27 | |||
28 | Put the package under your project folder and add the following in import: | ||
29 | |||
30 | ```golang | ||
31 | import "./{{packageName}}" | ||
32 | ``` | ||
33 | |||
34 | ## Documentation for API Endpoints | ||
35 | |||
36 | All URIs are relative to *{{basePath}}* | ||
37 | |||
38 | Class | 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 | |||
58 | Example | ||
59 | |||
60 | ```golang | ||
61 | auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ | ||
62 | Key: "APIKEY", | ||
63 | Prefix: "Bearer", // Omit if not necessary. | ||
64 | }) | ||
65 | r, err := client.Service.Operation(auth, args) | ||
66 | ``` | ||
67 | |||
68 | {{/isApiKey}} | ||
69 | {{#isBasic}}- **Type**: HTTP basic authentication | ||
70 | |||
71 | Example | ||
72 | |||
73 | ```golang | ||
74 | auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ | ||
75 | UserName: "username", | ||
76 | Password: "password", | ||
77 | }) | ||
78 | r, 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 | |||
91 | Example | ||
92 | |||
93 | ```golang | ||
94 | auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") | ||
95 | r, err := client.Service.Operation(auth, args) | ||
96 | ``` | ||
97 | |||
98 | Or via OAuth2 module to automatically refresh tokens and perform user authentication. | ||
99 | |||
100 | ```golang | ||
101 | import "golang.org/x/oauth2" | ||
102 | |||
103 | /* Perform OAuth2 round trip request and obtain a token */ | ||
104 | |||
105 | tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) | ||
106 | auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) | ||
107 | r, err := client.Service.Operation(auth, args) | ||
108 | ``` | ||
109 | |||
110 | {{/isOAuth}} | ||
111 | {{/authMethods}} | ||
112 | |||
113 | ## License | ||
114 | |||
115 | Copyright (C) 2015-2020 PeerTube Contributors | ||
116 | |||
117 | This 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 | |||
119 | This 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 | |||
121 | You 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 | |||
3 | packageName: 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}} | ||
16 | First, create the gradle wrapper script: | ||
17 | |||
18 | ``` | ||
19 | gradle wrapper | ||
20 | ``` | ||
21 | |||
22 | Then, run: | ||
23 | |||
24 | {{/jvm}} | ||
25 | ``` | ||
26 | ./gradlew check assemble | ||
27 | ``` | ||
28 | |||
29 | This 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 | |||
37 | All URIs are relative to *{{{basePath}}}*. Change it when instanciating `ApiClient(basePath)`. | ||
38 | |||
39 | Class | 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}} | ||
54 | No 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}} | ||
62 | All endpoints do not require authorization. | ||
63 | {{/authMethods}} | ||
64 | {{#authMethods}} | ||
65 | {{#last}} | ||
66 | Authentication 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 | |||
91 | Copyright (C) 2015-2020 PeerTube Contributors | ||
92 | |||
93 | This 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 | |||
95 | This 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 | |||
97 | You 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 | |||
3 | artifactId: peertube-api | ||
4 | groupId: org.peertube | ||
5 | packageName: 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 | |||
3 | This Python package is automatically generated from [PeerTube's REST API](https://docs.joinpeertube.org/api-rest-reference.html), | ||
4 | using 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}} | ||
14 | For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) | ||
15 | {{/infoUrl}} | ||
16 | |||
17 | ## Requirements. | ||
18 | |||
19 | Python 2.7 and 3.4+ | ||
20 | |||
21 | ## Installation & Usage | ||
22 | |||
23 | ```sh | ||
24 | pip 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 | |||
28 | Then import the package: | ||
29 | ```python | ||
30 | import {{{packageName}}} | ||
31 | ``` | ||
32 | |||
33 | ## Getting Started | ||
34 | |||
35 | Please follow the [installation procedure](#installation--usage) and then run the following: | ||
36 | |||
37 | {{> common_README }} | ||
38 | |||
39 | ## License | ||
40 | |||
41 | Copyright (C) 2015-2020 PeerTube Contributors | ||
42 | |||
43 | This 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 | |||
45 | This 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 | |||
47 | You 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 | |||
3 | packageName: peertube | ||
4 | projectName: peertube | ||
5 | |||