This repository has been archived on 2023-05-07. You can view files and clone it, but cannot push or open issues or pull requests.
go-sdk/configuration.go

74 lines
2.5 KiB
Go
Raw Permalink Normal View History

2019-10-19 20:53:41 +00:00
/*
* Vikunja API
*
* This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. <!-- ReDoc-Inject: <security-definitions> --> # Authorization **JWT-Auth:** Main authorization method, used for most of the requests. Needs `Authorization: Bearer <jwt-token>`-header to authenticate successfully. **BasicAuth:** Only used when requesting tasks via caldav. <!-- ReDoc-Inject: <security-definitions> -->
*
* API version: 0.8+21-854fde1e4c
* Contact: hello@vikunja.io
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package swagger
import (
"net/http"
)
// contextKeys are used to identify the type of value in the context.
// Since these are string, it is possible to get a short description of the
// context key for logging and debugging using key.String().
type contextKey string
func (c contextKey) String() string {
return "auth " + string(c)
}
var (
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
2019-10-19 21:30:03 +00:00
ContextOAuth2 = contextKey("token")
2019-10-19 20:53:41 +00:00
// ContextBasicAuth takes BasicAuth as authentication for the request.
2019-10-19 21:30:03 +00:00
ContextBasicAuth = contextKey("basic")
2019-10-19 20:53:41 +00:00
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
2019-10-19 21:30:03 +00:00
ContextAccessToken = contextKey("accesstoken")
2019-10-19 20:53:41 +00:00
// ContextAPIKey takes an APIKey as authentication for the request
2019-10-19 21:30:03 +00:00
ContextAPIKey = contextKey("apikey")
2019-10-19 20:53:41 +00:00
)
2019-10-19 21:30:03 +00:00
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
2019-10-19 20:53:41 +00:00
type BasicAuth struct {
2019-10-19 21:30:03 +00:00
UserName string `json:"userName,omitempty"`
Password string `json:"password,omitempty"`
2019-10-19 20:53:41 +00:00
}
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIKey struct {
2019-10-19 21:30:03 +00:00
Key string
Prefix string
2019-10-19 20:53:41 +00:00
}
type Configuration struct {
2019-10-19 21:30:03 +00:00
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
2019-10-19 20:53:41 +00:00
}
func NewConfiguration() *Configuration {
cfg := &Configuration{
BasePath: "https://localhost/api/v1",
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
2019-10-19 21:30:03 +00:00
}