ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.mustache 3.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # Go API client for {{appName}}
  2. This Python package is automatically generated from [PeerTube's REST API](https://docs.joinpeertube.org/api-rest-reference.html),
  3. using the [OpenAPI Generator](https://openapi-generator.tech) project:
  4. - API version: {{appVersion}}
  5. - Package version: {{packageVersion}}
  6. {{^hideGenerationTimestamp}}
  7. - Build date: {{generatedDate}}
  8. {{/hideGenerationTimestamp}}
  9. - Build package: {{generatorClass}}
  10. {{#infoUrl}}
  11. For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
  12. {{/infoUrl}}
  13. ## Installation
  14. Install the following dependencies:
  15. ```shell
  16. go get github.com/stretchr/testify/assert
  17. go get golang.org/x/oauth2
  18. go get golang.org/x/net/context
  19. go get github.com/antihax/optional
  20. ```
  21. Put the package under your project folder and add the following in import:
  22. ```golang
  23. import "./{{packageName}}"
  24. ```
  25. ## Documentation for API Endpoints
  26. All URIs are relative to *{{basePath}}*
  27. Class | Method | HTTP request | Description
  28. ------------ | ------------- | ------------- | -------------
  29. {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
  30. {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
  31. ## Documentation For Models
  32. {{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
  33. {{/model}}{{/models}}
  34. ## Documentation For Authorization
  35. {{^authMethods}} Endpoints do not require authorization.
  36. {{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
  37. {{#authMethods}}
  38. ## {{{name}}}
  39. {{#isApiKey}}- **Type**: API key
  40. Example
  41. ```golang
  42. auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
  43. Key: "APIKEY",
  44. Prefix: "Bearer", // Omit if not necessary.
  45. })
  46. r, err := client.Service.Operation(auth, args)
  47. ```
  48. {{/isApiKey}}
  49. {{#isBasic}}- **Type**: HTTP basic authentication
  50. Example
  51. ```golang
  52. auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
  53. UserName: "username",
  54. Password: "password",
  55. })
  56. r, err := client.Service.Operation(auth, args)
  57. ```
  58. {{/isBasic}}
  59. {{#isOAuth}}
  60. - **Type**: OAuth
  61. - **Flow**: {{{flow}}}
  62. - **Authorization URL**: {{{authorizationUrl}}}
  63. - **Scopes**: {{^scopes}}N/A{{/scopes}}
  64. {{#scopes}} - **{{{scope}}}**: {{{description}}}
  65. {{/scopes}}
  66. Example
  67. ```golang
  68. auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
  69. r, err := client.Service.Operation(auth, args)
  70. ```
  71. Or via OAuth2 module to automatically refresh tokens and perform user authentication.
  72. ```golang
  73. import "golang.org/x/oauth2"
  74. /* Perform OAuth2 round trip request and obtain a token */
  75. tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
  76. auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
  77. r, err := client.Service.Operation(auth, args)
  78. ```
  79. {{/isOAuth}}
  80. {{/authMethods}}
  81. ## License
  82. Copyright (C) 2015-2020 PeerTube Contributors
  83. 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.
  84. 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.
  85. 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.