1 # Go API client for {{appName}}
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:
6 - API version: {{appVersion}}
7 - Package version: {{packageVersion}}
8 {{^hideGenerationTimestamp}}
9 - Build date: {{generatedDate}}
10 {{/hideGenerationTimestamp}}
11 - Build package: {{generatorClass}}
14 For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
19 Install the following dependencies:
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
28 Put the package under your project folder and add the following in import:
31 import "./{{packageName}}"
34 ## Documentation for API Endpoints
36 All URIs are relative to *{{basePath}}*
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}}
43 ## Documentation For Models
45 {{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
48 ## Documentation For Authorization
50 {{^authMethods}} Endpoints do not require authorization.
51 {{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
56 {{#isApiKey}}- **Type**: API key
61 auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
63 Prefix: "Bearer", // Omit if not necessary.
65 r, err := client.Service.Operation(auth, args)
69 {{#isBasic}}- **Type**: HTTP basic authentication
74 auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
78 r, err := client.Service.Operation(auth, args)
85 - **Flow**: {{{flow}}}
86 - **Authorization URL**: {{{authorizationUrl}}}
87 - **Scopes**: {{^scopes}}N/A{{/scopes}}
88 {{#scopes}} - **{{{scope}}}**: {{{description}}}
94 auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
95 r, err := client.Service.Operation(auth, args)
98 Or via OAuth2 module to automatically refresh tokens and perform user authentication.
101 import "golang.org/x/oauth2"
103 /* Perform OAuth2 round trip request and obtain a token */
105 tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
106 auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
107 r, err := client.Service.Operation(auth, args)
115 Copyright (C) 2015-2020 PeerTube Contributors
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.
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.
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.