forked from loafle/openapi-generator-original
* Rewrite of Go Client * Revert to older version of context.Context * Clean and bulk up concurrency test. * Correct {{path}} to {{{path}}} * change custom date type to string. * Add APIKey authentication * Correct missing line from resolving conflicts. Correct missing line from resolving conflicts.
52 lines
1.4 KiB
Go
52 lines
1.4 KiB
Go
/*
|
|
* Swagger Petstore
|
|
*
|
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
|
*
|
|
* OpenAPI spec version: 1.0.0
|
|
* Contact: apiteam@swagger.io
|
|
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
*/
|
|
|
|
package petstore
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
const ContextOAuth2 int = 1
|
|
const ContextBasicAuth int = 2
|
|
const ContextAccessToken int = 3
|
|
const ContextAPIKey int = 4
|
|
|
|
type BasicAuth struct {
|
|
UserName string `json:"userName,omitempty"`
|
|
Password string `json:"password,omitempty"`
|
|
}
|
|
|
|
type APIKey struct {
|
|
Key string
|
|
Prefix string
|
|
}
|
|
|
|
type Configuration struct {
|
|
BasePath string `json:"basePath,omitempty"`
|
|
Host string `json:"host,omitempty"`
|
|
Scheme string `json:"scheme,omitempty"`
|
|
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
|
UserAgent string `json:"userAgent,omitempty"`
|
|
HTTPClient *http.Client
|
|
}
|
|
|
|
func NewConfiguration() *Configuration {
|
|
cfg := &Configuration{
|
|
BasePath: "http://petstore.swagger.io:80/v2",
|
|
DefaultHeader: make(map[string]string),
|
|
UserAgent: "Swagger-Codegen/1.0.0/go",
|
|
}
|
|
return cfg
|
|
}
|
|
|
|
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
|
c.DefaultHeader[key] = value
|
|
} |