Documentation
¶
Index ¶
- Constants
- Variables
- func IsOTPRequired(err error) bool
- func IsRequestFailedError(err error) bool
- func NewRequestFailedError(res *http.Response, req *APIRequest) error
- type APIConfig
- type APIError
- type APIRequest
- type APITokenGenerator
- type AdddonTokenExchanger
- type AddonTokenGenerator
- type BadRequestError
- type Client
- type ClientConfig
- type ForbiddenError
- type NotFoundError
- type PaymentRequiredError
- type RequestFailedError
- type Statuses
- type TokenGenerator
- type TokensService
- type UnprocessableEntity
Constants ¶
View Source
const ( AuthAPI = "AUTHENTICATION_API" ScalingoAPI = "SCALINGO_API" DBAPI = "DATABASES_API" )
Variables ¶
View Source
var ErrOTPRequired = errors.New("OTP Required")
Functions ¶
func IsOTPRequired ¶
IsOTPRequired tests if the authentication backend return an OTP Required error
func IsRequestFailedError ¶
func NewRequestFailedError ¶
func NewRequestFailedError(res *http.Response, req *APIRequest) error
Types ¶
type APIRequest ¶
type APIRequest struct {
NoAuth bool
URL string
Method string
Endpoint string
Expected Statuses
Params interface{}
HTTPRequest *http.Request
Token string // Directly use a Bearer token
Username string // Username for the OAuth generator (nil if you use a token)
Password string // Password for the OAuth generator
OTP string // OTP value
}
func (*APIRequest) BuildQueryFromParams ¶
func (req *APIRequest) BuildQueryFromParams() (url.Values, error)
type APITokenGenerator ¶
type APITokenGenerator struct {
APIToken string
TokensService TokensService
// contains filtered or unexported fields
}
func NewAPITokenGenerator ¶
func NewAPITokenGenerator(tokensService TokensService, apiToken string) *APITokenGenerator
func (*APITokenGenerator) GetAccessToken ¶
func (t *APITokenGenerator) GetAccessToken() (string, error)
type AdddonTokenExchanger ¶
type AddonTokenGenerator ¶
type AddonTokenGenerator struct {
// contains filtered or unexported fields
}
func (*AddonTokenGenerator) GetAccessToken ¶
func (c *AddonTokenGenerator) GetAccessToken() (string, error)
type BadRequestError ¶
func (BadRequestError) Error ¶
func (err BadRequestError) Error() string
type Client ¶
type Client interface {
ResourceList(resource string, payload, data interface{}) error
ResourceAdd(resource string, payload, data interface{}) error
ResourceGet(resource, resourceID string, payload, data interface{}) error
ResourceUpdate(resource, resourceID string, payload, data interface{}) error
ResourceDelete(resource, resourceID string) error
SubresourceList(resource, resourceID, subresource string, payload, data interface{}) error
SubresourceAdd(resource, resourceID, subresource string, payload, data interface{}) error
SubresourceGet(resource, resourceID, subresource, id string, payload, data interface{}) error
SubresourceUpdate(resource, resourceID, subresource, id string, payload, data interface{}) error
SubresourceDelete(resource, resourceID, subresource, id string) error
DoRequest(req *APIRequest, data interface{}) error
Do(req *APIRequest) (*http.Response, error)
TokenGenerator() TokenGenerator
IsAuthenticatedClient() bool
BaseURL() string
HTTPClient() *http.Client
}
func NewClient ¶
func NewClient(api string, cfg ClientConfig) Client
type ClientConfig ¶
type ForbiddenError ¶
func (ForbiddenError) Error ¶
func (err ForbiddenError) Error() string
type NotFoundError ¶
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type PaymentRequiredError ¶
type PaymentRequiredError struct {
Name string `json:"name"`
ErrMessage string `json:"error"`
URL string `json:"url"`
}
func (PaymentRequiredError) Error ¶
func (err PaymentRequiredError) Error() string
type RequestFailedError ¶
type RequestFailedError struct {
Code int
APIError error
Req *APIRequest
Message string
}
func (*RequestFailedError) Error ¶
func (err *RequestFailedError) Error() string
func (*RequestFailedError) String ¶
func (err *RequestFailedError) String() string
type TokenGenerator ¶
func NewAddonTokenGenerator ¶
func NewAddonTokenGenerator(app, addon string, exchanger AdddonTokenExchanger) TokenGenerator
type TokensService ¶
type UnprocessableEntity ¶
func (UnprocessableEntity) Error ¶
func (err UnprocessableEntity) Error() string
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package httpmock is a generated GoMock package.
|
Package httpmock is a generated GoMock package. |
|
Package tokensservicemock is a generated GoMock package.
|
Package tokensservicemock is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.