package
2.3.1+incompatible
Repository: https://github.com/yongs2/openapi-generator.git
Documentation: pkg.go.dev
# README
Go API client for swagger
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \ *_/ ' " =end --
Overview
This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you can easily generate an API client.
- API version: 1.0.0 *_/ ' " =end -- \r\n \n \r
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.GoClientCodegen
Installation
Put the package under your project folder and add the following in import:
"./swagger"
Documentation for API Endpoints
All URIs are relative to *https://petstore.swagger.io / ' " =end -- \r\n \n \r/v2 */ ' " =end -- \r\n \n \r
Class | Method | HTTP request | Description |
---|---|---|---|
FakeApi | TestCodeInjectEndRnNR | Put /fake | To test code injection *_/ ' " =end -- \r\n \n \r |
Documentation For Models
Documentation For Authorization
api_key
- Type: API key
Example
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
petstore_auth
- Type: OAuth
- Flow: implicit
- Authorization URL: http://petstore.swagger.io/api/oauth/dialog
- Scopes:
- write:pets: modify pets in your account *_/ ' " =end -- \r\n \n \r
- read:pets: read your pets *_/ ' " =end -- \r\n \n \r
Example
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
Or via OAuth2 module to automaticly refresh tokens and perform user authentication.
import "golang.org/x/oauth2"
/ .. Perform OAuth2 round trip request and obtain a token .. //
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
Author
[email protected] *_/ ' " =end -- \r\n \n \r
# Functions
CacheExpires helper function to determine remaining time before repeating a request.
NewAPIClient creates a new API client.
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAPIKey takes an APIKey as authentication for the request.
ContextBasicAuth takes BasicAuth as authentication for the request.
ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
# Structs
APIClient manages communication with the Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r API v1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r In most cases there should be only one, shared, APIClient.
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
No description provided by the author
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth .
No description provided by the author
Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r.
# Type aliases
No description provided by the author