Documentation
¶
Overview ¶
Package oauth2 provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.0 DO NOT EDIT.
Index ¶
- Constants
- func NewGetCodeRequest(server string, params *GetCodeParams) (*http.Request, error)
- func NewPostRevokeRequest(server string, body PostRevokeJSONRequestBody) (*http.Request, error)
- func NewPostRevokeRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewPostRevokeRequestWithFormdataBody(server string, body PostRevokeFormdataRequestBody) (*http.Request, error)
- func NewPostTokenRequest(server string, body PostTokenJSONRequestBody) (*http.Request, error)
- func NewPostTokenRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewPostTokenRequestWithFormdataBody(server string, body PostTokenFormdataRequestBody) (*http.Request, error)
- type AuthorizationCodeCredentials
- type AuthorizationCodeCredentialsGrantType
- type Client
- func (c *Client) GetCode(ctx context.Context, params *GetCodeParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) PostRevoke(ctx context.Context, body PostRevokeJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) PostRevokeWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) PostRevokeWithFormdataBody(ctx context.Context, body PostRevokeFormdataRequestBody, ...) (*http.Response, error)
- func (c *Client) PostToken(ctx context.Context, body PostTokenJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) PostTokenWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) PostTokenWithFormdataBody(ctx context.Context, body PostTokenFormdataRequestBody, ...) (*http.Response, error)
- type ClientApplicationTokenResponse
- type ClientApplicationTokenResponseStatus
- type ClientApplicationTokenResponseTokenType
- type ClientCredentials
- func (t ClientCredentials) AsAuthorizationCodeCredentials() (AuthorizationCodeCredentials, error)
- func (t ClientCredentials) AsClientCredentials() (ClientCredentials, error)
- func (t ClientCredentials) AsRefreshTokenCredentials() (RefreshTokenCredentials, error)
- func (t *ClientCredentials) FromAuthorizationCodeCredentials(v AuthorizationCodeCredentials) error
- func (t *ClientCredentials) FromClientCredentials(v ClientCredentials) error
- func (t *ClientCredentials) FromRefreshTokenCredentials(v RefreshTokenCredentials) error
- func (t ClientCredentials) MarshalJSON() ([]byte, error)
- func (t *ClientCredentials) MergeAuthorizationCodeCredentials(v AuthorizationCodeCredentials) error
- func (t *ClientCredentials) MergeClientCredentials(v ClientCredentials) error
- func (t *ClientCredentials) MergeRefreshTokenCredentials(v RefreshTokenCredentials) error
- func (t *ClientCredentials) UnmarshalJSON(b []byte) error
- type ClientCredentialsGrantType
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) GetCodeWithResponse(ctx context.Context, params *GetCodeParams, reqEditors ...RequestEditorFn) (*GetCodeResponse, error)
- func (c *ClientWithResponses) PostRevokeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*PostRevokeResponse, error)
- func (c *ClientWithResponses) PostRevokeWithFormdataBodyWithResponse(ctx context.Context, body PostRevokeFormdataRequestBody, ...) (*PostRevokeResponse, error)
- func (c *ClientWithResponses) PostRevokeWithResponse(ctx context.Context, body PostRevokeJSONRequestBody, ...) (*PostRevokeResponse, error)
- func (c *ClientWithResponses) PostTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*PostTokenResponse, error)
- func (c *ClientWithResponses) PostTokenWithFormdataBodyWithResponse(ctx context.Context, body PostTokenFormdataRequestBody, ...) (*PostTokenResponse, error)
- func (c *ClientWithResponses) PostTokenWithResponse(ctx context.Context, body PostTokenJSONRequestBody, ...) (*PostTokenResponse, error)
- type ClientWithResponsesInterface
- type GetCodeParams
- type GetCodeParamsResponseType
- type GetCodeResponse
- type HttpRequestDoer
- type PostRevokeFormdataRequestBody
- type PostRevokeJSONRequestBody
- type PostRevokeResponse
- type PostTokenFormdataBody
- type PostTokenFormdataRequestBody
- type PostTokenJSONBody
- type PostTokenJSONRequestBody
- type PostTokenResponse
- type RefreshTokenCredentials
- type RefreshTokenCredentialsGrantType
- type RequestEditorFn
- type ResourceOwnerTokenResponse
- type ResourceOwnerTokenResponseRefreshTokenStatus
- type ResourceOwnerTokenResponseStatus
- type ResourceOwnerTokenResponseTokenType
- type StandardErrorResponse
- type StandardErrorResponseError
- type TokenRequest
- func (t TokenRequest) AsAuthorizationCodeCredentials() (AuthorizationCodeCredentials, error)
- func (t TokenRequest) AsClientCredentials() (ClientCredentials, error)
- func (t TokenRequest) AsRefreshTokenCredentials() (RefreshTokenCredentials, error)
- func (t *TokenRequest) FromAuthorizationCodeCredentials(v AuthorizationCodeCredentials) error
- func (t *TokenRequest) FromClientCredentials(v ClientCredentials) error
- func (t *TokenRequest) FromRefreshTokenCredentials(v RefreshTokenCredentials) error
- func (a TokenRequest) Get(fieldName string) (value interface{}, found bool)
- func (a TokenRequest) MarshalJSON() ([]byte, error)
- func (t *TokenRequest) MergeAuthorizationCodeCredentials(v AuthorizationCodeCredentials) error
- func (t *TokenRequest) MergeClientCredentials(v ClientCredentials) error
- func (t *TokenRequest) MergeRefreshTokenCredentials(v RefreshTokenCredentials) error
- func (a *TokenRequest) Set(fieldName string, value interface{})
- func (a *TokenRequest) UnmarshalJSON(b []byte) error
- type TokenRequestGrantType
- type TokenRevokeRequest
- type TokenRevokeRequestTokenTypeHint
Constants ¶
const ( BasicAuthScopes = "BasicAuth.Scopes" BearerTokenAuthScopes = "BearerTokenAuth.Scopes" BearerAuthScopes = "bearerAuth.Scopes" )
Variables ¶
This section is empty.
Functions ¶
func NewGetCodeRequest ¶
func NewGetCodeRequest(server string, params *GetCodeParams) (*http.Request, error)
NewGetCodeRequest generates requests for GetCode
func NewPostRevokeRequest ¶
func NewPostRevokeRequest(server string, body PostRevokeJSONRequestBody) (*http.Request, error)
NewPostRevokeRequest calls the generic PostRevoke builder with application/json body
func NewPostRevokeRequestWithBody ¶
func NewPostRevokeRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewPostRevokeRequestWithBody generates requests for PostRevoke with any type of body
func NewPostRevokeRequestWithFormdataBody ¶
func NewPostRevokeRequestWithFormdataBody(server string, body PostRevokeFormdataRequestBody) (*http.Request, error)
NewPostRevokeRequestWithFormdataBody calls the generic PostRevoke builder with application/x-www-form-urlencoded body
func NewPostTokenRequest ¶
func NewPostTokenRequest(server string, body PostTokenJSONRequestBody) (*http.Request, error)
NewPostTokenRequest calls the generic PostToken builder with application/json body
func NewPostTokenRequestWithBody ¶
func NewPostTokenRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewPostTokenRequestWithBody generates requests for PostToken with any type of body
func NewPostTokenRequestWithFormdataBody ¶
func NewPostTokenRequestWithFormdataBody(server string, body PostTokenFormdataRequestBody) (*http.Request, error)
NewPostTokenRequestWithFormdataBody calls the generic PostToken builder with application/x-www-form-urlencoded body
Types ¶
type AuthorizationCodeCredentials ¶
type AuthorizationCodeCredentials struct {
// ClientId The unique identifier issued to the client application making the request. Used for authenticating the client application.
//
// You will need to add an app to get a client Id and secret. These are the Consumer Key and Consumer Secret values respectfully in the API developer portal.
ClientId *string `json:"client_id,omitempty"`
// ClientSecret The shared secret issued to the client application making the request. Used for authenticating the client application.
//
// You will need to add an app to get a client Id and secret. These are the Consumer Key and Consumer Secret values respectfully in the API developer portal.
ClientSecret *string `json:"client_secret,omitempty"`
// Code The authorization code previously received by the client application.
Code *string `json:"code,omitempty"`
// GrantType The OAuth standard flow being requested by the client application.
GrantType AuthorizationCodeCredentialsGrantType `json:"grant_type"`
// RedirectUri The authorization code redirect Uniform Resource Identifier (URI) for the third-party application to receive the authorization code. This is used to verify the identify of the requester. The request will not be redirected to this URI.
RedirectUri *string `json:"redirect_uri,omitempty"`
// Scope The OAuth2 scope being requested. A client application may request a subset of scope that has already been configured during registration.
//
// The default scope registered for the client application is used as default when the scope is omitted.
//
// **Only specify the scope in the request when the client application requires less scope, i.e. less access to APIs, than the default.**
Scope *string `json:"scope,omitempty"`
}
AuthorizationCodeCredentials defines model for AuthorizationCodeCredentials.
type AuthorizationCodeCredentialsGrantType ¶
type AuthorizationCodeCredentialsGrantType string
AuthorizationCodeCredentialsGrantType The OAuth standard flow being requested by the client application.
const ( AuthorizationCodeCredentialsGrantTypeAuthorizationCode AuthorizationCodeCredentialsGrantType = "authorization_code" AuthorizationCodeCredentialsGrantTypeClientCredentials AuthorizationCodeCredentialsGrantType = "client_credentials" AuthorizationCodeCredentialsGrantTypeRefreshToken AuthorizationCodeCredentialsGrantType = "refresh_token" )
Defines values for AuthorizationCodeCredentialsGrantType.
type Client ¶
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) GetCode ¶
func (c *Client) GetCode(ctx context.Context, params *GetCodeParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) PostRevoke ¶
func (c *Client) PostRevoke(ctx context.Context, body PostRevokeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) PostRevokeWithBody ¶
func (*Client) PostRevokeWithFormdataBody ¶
func (c *Client) PostRevokeWithFormdataBody(ctx context.Context, body PostRevokeFormdataRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) PostToken ¶
func (c *Client) PostToken(ctx context.Context, body PostTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) PostTokenWithBody ¶
func (*Client) PostTokenWithFormdataBody ¶
func (c *Client) PostTokenWithFormdataBody(ctx context.Context, body PostTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientApplicationTokenResponse ¶
type ClientApplicationTokenResponse struct {
// AccessToken The access token issued to use to acess protected resources.
AccessToken string `json:"access_token"`
// ApiProducts The list of API products approved for use by the client application.
ApiProducts *string `json:"api_products,omitempty"`
// ApplicationName The name of the client application.
ApplicationName *string `json:"application_name,omitempty"`
// ClientId The unique identifier for the client application.
ClientId *string `json:"client_id,omitempty"`
// ExpiresIn The expiration time of the issued access token, in seconds.
ExpiresIn int `json:"expires_in"`
// IssuedAt The date and time the access token was issued, expressed in Unix epoch time in milliseconds.
// You may use [The Unix Epoch Time Converter](https://www.epochconverter.com/) to convert access token issued at values to human readable formats.
IssuedAt *int64 `json:"issued_at,omitempty"`
// Issuer The authority that issued the token(s).
Issuer *string `json:"issuer,omitempty"`
// PublicKey The base64-encoded public cryptographic key used to validate the signature of the access token. Validation ensures that the access token has not been tampered with and it originated from a known, trusted source.
PublicKey *[]byte `json:"public_key,omitempty"`
// Scope The OAuth scope being requested by the client application, specified as a list of space-delimited, case-sensitive strings. If ommitted from the token request then the default scope configured for the client application is used.
Scope *string `json:"scope,omitempty"`
// Status The status of the access token.
Status *ClientApplicationTokenResponseStatus `json:"status,omitempty"`
// TokenType The access token type provides the client with the information required to successfully utilize the access token to make a protected resource request (along with type-specific attributes). The client MUST NOT use an access token if it does not understand the token type.
TokenType ClientApplicationTokenResponseTokenType `json:"token_type"`
}
ClientApplicationTokenResponse The OAuth token response for third-party client applications to use to access USPS APIs. The access token is returned in the response. You may use [The Unix Epoch Time Converter](https://www.epochconverter.com/) to convert access token issued at values to human readable formats. Use the public key provided in the response to verify the access token signature.
type ClientApplicationTokenResponseStatus ¶
type ClientApplicationTokenResponseStatus string
ClientApplicationTokenResponseStatus The status of the access token.
const ( ClientApplicationTokenResponseStatusApproved ClientApplicationTokenResponseStatus = "approved" ClientApplicationTokenResponseStatusRevoked ClientApplicationTokenResponseStatus = "revoked" )
Defines values for ClientApplicationTokenResponseStatus.
type ClientApplicationTokenResponseTokenType ¶
type ClientApplicationTokenResponseTokenType string
ClientApplicationTokenResponseTokenType The access token type provides the client with the information required to successfully utilize the access token to make a protected resource request (along with type-specific attributes). The client MUST NOT use an access token if it does not understand the token type.
const (
ClientApplicationTokenResponseTokenTypeBearer ClientApplicationTokenResponseTokenType = "Bearer"
)
Defines values for ClientApplicationTokenResponseTokenType.
type ClientCredentials ¶
type ClientCredentials struct {
// ClientId The unique identifier issued to the client application making the request. Used for authenticating the client application.
//
// You will need to add an app to get a client Id and secret. These are the Consumer Key and Consumer Secret values respectfully in the API developer portal.
ClientId *string `json:"client_id,omitempty"`
// ClientSecret The shared secret issued to the client application making the request. Used for authenticating the client application.
//
// You will need to add an app to get a client Id and secret. These are the Consumer Key and Consumer Secret values respectfully in the API developer portal.
ClientSecret *string `json:"client_secret,omitempty"`
// GrantType The OAuth standard flow being requested by the client application.
GrantType ClientCredentialsGrantType `json:"grant_type"`
// Scope The OAuth2 scope being requested. A client application may request a subset of scope that has already been configured during registration.
//
// The default scope registered for the client application is used as default when the scope is omitted.
//
// **Only specify the scope in the request when the client application requires less scope, i.e. less access to APIs, than the default.**
Scope *string `json:"scope,omitempty"`
// contains filtered or unexported fields
}
ClientCredentials defines model for ClientCredentials.
func (ClientCredentials) AsAuthorizationCodeCredentials ¶
func (t ClientCredentials) AsAuthorizationCodeCredentials() (AuthorizationCodeCredentials, error)
AsAuthorizationCodeCredentials returns the union data inside the ClientCredentials as a AuthorizationCodeCredentials
func (ClientCredentials) AsClientCredentials ¶
func (t ClientCredentials) AsClientCredentials() (ClientCredentials, error)
AsClientCredentials returns the union data inside the ClientCredentials as a ClientCredentials
func (ClientCredentials) AsRefreshTokenCredentials ¶
func (t ClientCredentials) AsRefreshTokenCredentials() (RefreshTokenCredentials, error)
AsRefreshTokenCredentials returns the union data inside the ClientCredentials as a RefreshTokenCredentials
func (*ClientCredentials) FromAuthorizationCodeCredentials ¶
func (t *ClientCredentials) FromAuthorizationCodeCredentials(v AuthorizationCodeCredentials) error
FromAuthorizationCodeCredentials overwrites any union data inside the ClientCredentials as the provided AuthorizationCodeCredentials
func (*ClientCredentials) FromClientCredentials ¶
func (t *ClientCredentials) FromClientCredentials(v ClientCredentials) error
FromClientCredentials overwrites any union data inside the ClientCredentials as the provided ClientCredentials
func (*ClientCredentials) FromRefreshTokenCredentials ¶
func (t *ClientCredentials) FromRefreshTokenCredentials(v RefreshTokenCredentials) error
FromRefreshTokenCredentials overwrites any union data inside the ClientCredentials as the provided RefreshTokenCredentials
func (ClientCredentials) MarshalJSON ¶
func (t ClientCredentials) MarshalJSON() ([]byte, error)
func (*ClientCredentials) MergeAuthorizationCodeCredentials ¶
func (t *ClientCredentials) MergeAuthorizationCodeCredentials(v AuthorizationCodeCredentials) error
MergeAuthorizationCodeCredentials performs a merge with any union data inside the ClientCredentials, using the provided AuthorizationCodeCredentials
func (*ClientCredentials) MergeClientCredentials ¶
func (t *ClientCredentials) MergeClientCredentials(v ClientCredentials) error
MergeClientCredentials performs a merge with any union data inside the ClientCredentials, using the provided ClientCredentials
func (*ClientCredentials) MergeRefreshTokenCredentials ¶
func (t *ClientCredentials) MergeRefreshTokenCredentials(v RefreshTokenCredentials) error
MergeRefreshTokenCredentials performs a merge with any union data inside the ClientCredentials, using the provided RefreshTokenCredentials
func (*ClientCredentials) UnmarshalJSON ¶
func (t *ClientCredentials) UnmarshalJSON(b []byte) error
type ClientCredentialsGrantType ¶
type ClientCredentialsGrantType string
ClientCredentialsGrantType The OAuth standard flow being requested by the client application.
const ( ClientCredentialsGrantTypeAuthorizationCode ClientCredentialsGrantType = "authorization_code" ClientCredentialsGrantTypeClientCredentials ClientCredentialsGrantType = "client_credentials" ClientCredentialsGrantTypeRefreshToken ClientCredentialsGrantType = "refresh_token" )
Defines values for ClientCredentialsGrantType.
type ClientInterface ¶
type ClientInterface interface {
// GetCode request
GetCode(ctx context.Context, params *GetCodeParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// PostRevokeWithBody request with any body
PostRevokeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostRevoke(ctx context.Context, body PostRevokeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
PostRevokeWithFormdataBody(ctx context.Context, body PostRevokeFormdataRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// PostTokenWithBody request with any body
PostTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostToken(ctx context.Context, body PostTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
PostTokenWithFormdataBody(ctx context.Context, body PostTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) GetCodeWithResponse ¶
func (c *ClientWithResponses) GetCodeWithResponse(ctx context.Context, params *GetCodeParams, reqEditors ...RequestEditorFn) (*GetCodeResponse, error)
GetCodeWithResponse request returning *GetCodeResponse
func (*ClientWithResponses) PostRevokeWithBodyWithResponse ¶
func (c *ClientWithResponses) PostRevokeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostRevokeResponse, error)
PostRevokeWithBodyWithResponse request with arbitrary body returning *PostRevokeResponse
func (*ClientWithResponses) PostRevokeWithFormdataBodyWithResponse ¶
func (c *ClientWithResponses) PostRevokeWithFormdataBodyWithResponse(ctx context.Context, body PostRevokeFormdataRequestBody, reqEditors ...RequestEditorFn) (*PostRevokeResponse, error)
func (*ClientWithResponses) PostRevokeWithResponse ¶
func (c *ClientWithResponses) PostRevokeWithResponse(ctx context.Context, body PostRevokeJSONRequestBody, reqEditors ...RequestEditorFn) (*PostRevokeResponse, error)
func (*ClientWithResponses) PostTokenWithBodyWithResponse ¶
func (c *ClientWithResponses) PostTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostTokenResponse, error)
PostTokenWithBodyWithResponse request with arbitrary body returning *PostTokenResponse
func (*ClientWithResponses) PostTokenWithFormdataBodyWithResponse ¶
func (c *ClientWithResponses) PostTokenWithFormdataBodyWithResponse(ctx context.Context, body PostTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*PostTokenResponse, error)
func (*ClientWithResponses) PostTokenWithResponse ¶
func (c *ClientWithResponses) PostTokenWithResponse(ctx context.Context, body PostTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*PostTokenResponse, error)
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// GetCodeWithResponse request
GetCodeWithResponse(ctx context.Context, params *GetCodeParams, reqEditors ...RequestEditorFn) (*GetCodeResponse, error)
// PostRevokeWithBodyWithResponse request with any body
PostRevokeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostRevokeResponse, error)
PostRevokeWithResponse(ctx context.Context, body PostRevokeJSONRequestBody, reqEditors ...RequestEditorFn) (*PostRevokeResponse, error)
PostRevokeWithFormdataBodyWithResponse(ctx context.Context, body PostRevokeFormdataRequestBody, reqEditors ...RequestEditorFn) (*PostRevokeResponse, error)
// PostTokenWithBodyWithResponse request with any body
PostTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostTokenResponse, error)
PostTokenWithResponse(ctx context.Context, body PostTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*PostTokenResponse, error)
PostTokenWithFormdataBodyWithResponse(ctx context.Context, body PostTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*PostTokenResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type GetCodeParams ¶
type GetCodeParams struct {
// ResponseType The type of response being requested, 'code' in this case.
ResponseType GetCodeParamsResponseType `form:"response_type" json:"response_type"`
// ClientId The unique identifier of the client application making the request.
ClientId string `form:"client_id" json:"client_id"`
// RedirectUri The redirection Uniform Resource Identifier (URI) that has been previously registered for the third-party client application. This input must be an exact match with the one(s) previously registered. The URI must use a encrypted connection, preventing attackers from intercepting and reading autorization code responses. The redirect_uri must use the https:// scheme for security reasons.
//
// See [Best Current Practice for OAuth 2.0 Security](https://datatracker.ietf.org/doc/html/rfc9700#name-client-as-open-redirector) for further security awareness.
RedirectUri string `form:"redirect_uri" json:"redirect_uri"`
// Scope The OAuth2 scope being requested. A client application may request a subset of scope that has already been configured during client application registration.
//
// The scope registered for the client application is used as default when the scope is omitted.
//
// **Only specify the scope in the request when the client application requires less scope, i.e. less access to APIs, than the default.**
Scope *string `form:"scope,omitempty" json:"scope,omitempty"`
// State The state value passed in the authorization code request is returned in authorization code response. It is recommended that the value for the state is a Base64 encoded, stringified JSON object and its value should be sufficient to correlate the code response to an authorization code request and user.
//
// A nonce value should be included in this JSON object for additional security. Effectively using the state parameter mitigates Cross-Site Request Forgery (CSRF). See [Best Current Practice for OAuth 2.0 Security](https://datatracker.ietf.org/doc/html/rfc9700#name-nonce) for further security awareness.
//
// The following is a normative example:
//
// “`
// {
// "redirect_to": "/dashboard",
// "user_id": "abcd1234",
// "nonce": "553393870385"
// }
// “`
//
// The result of converting to a string and Base64 encoding is:
//
// “`
// IntcInJlZGlyZWN0X3RvXCI6IFwiL2Rhc2hib2FyZFwiLFwidXNlcl9pZFwiOiBcImFiY2QxMjM0XCIsXCJub25jZVwiOiBcIjU1MzM5Mzg3MDM4NVwifSI=
// “`
State *string `form:"state,omitempty" json:"state,omitempty"`
// UserId The unique subject identifier of the user's account.
UserId string `form:"user_id" json:"user_id"`
}
GetCodeParams defines parameters for GetCode.
type GetCodeParamsResponseType ¶
type GetCodeParamsResponseType string
GetCodeParamsResponseType defines parameters for GetCode.
const (
Code GetCodeParamsResponseType = "code"
)
Defines values for GetCodeParamsResponseType.
type GetCodeResponse ¶
type GetCodeResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *StandardErrorResponse
JSON401 *StandardErrorResponse
JSON403 *StandardErrorResponse
JSON429 *StandardErrorResponse
JSON503 *StandardErrorResponse
}
func ParseGetCodeResponse ¶
func ParseGetCodeResponse(rsp *http.Response) (*GetCodeResponse, error)
ParseGetCodeResponse parses an HTTP response from a GetCodeWithResponse call
func (GetCodeResponse) Status ¶
func (r GetCodeResponse) Status() string
Status returns HTTPResponse.Status
func (GetCodeResponse) StatusCode ¶
func (r GetCodeResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type PostRevokeFormdataRequestBody ¶
type PostRevokeFormdataRequestBody = TokenRevokeRequest
PostRevokeFormdataRequestBody defines body for PostRevoke for application/x-www-form-urlencoded ContentType.
type PostRevokeJSONRequestBody ¶
type PostRevokeJSONRequestBody = TokenRevokeRequest
PostRevokeJSONRequestBody defines body for PostRevoke for application/json ContentType.
type PostRevokeResponse ¶
type PostRevokeResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *StandardErrorResponse
JSON401 *StandardErrorResponse
JSON429 *StandardErrorResponse
JSON503 *StandardErrorResponse
}
func ParsePostRevokeResponse ¶
func ParsePostRevokeResponse(rsp *http.Response) (*PostRevokeResponse, error)
ParsePostRevokeResponse parses an HTTP response from a PostRevokeWithResponse call
func (PostRevokeResponse) Status ¶
func (r PostRevokeResponse) Status() string
Status returns HTTPResponse.Status
func (PostRevokeResponse) StatusCode ¶
func (r PostRevokeResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type PostTokenFormdataBody ¶
type PostTokenFormdataBody struct {
// contains filtered or unexported fields
}
PostTokenFormdataBody defines parameters for PostToken.
type PostTokenFormdataRequestBody ¶
type PostTokenFormdataRequestBody PostTokenFormdataBody
PostTokenFormdataRequestBody defines body for PostToken for application/x-www-form-urlencoded ContentType.
type PostTokenJSONBody ¶
type PostTokenJSONBody struct {
// contains filtered or unexported fields
}
PostTokenJSONBody defines parameters for PostToken.
type PostTokenJSONRequestBody ¶
type PostTokenJSONRequestBody PostTokenJSONBody
PostTokenJSONRequestBody defines body for PostToken for application/json ContentType.
type PostTokenResponse ¶
type PostTokenResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
// contains filtered or unexported fields
}
JSON400 *StandardErrorResponse
JSON401 *StandardErrorResponse
JSON429 *StandardErrorResponse
JSON503 *StandardErrorResponse
}
func ParsePostTokenResponse ¶
func ParsePostTokenResponse(rsp *http.Response) (*PostTokenResponse, error)
ParsePostTokenResponse parses an HTTP response from a PostTokenWithResponse call
func (PostTokenResponse) Status ¶
func (r PostTokenResponse) Status() string
Status returns HTTPResponse.Status
func (PostTokenResponse) StatusCode ¶
func (r PostTokenResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type RefreshTokenCredentials ¶
type RefreshTokenCredentials struct {
// ClientId The unique identifier issued to the client application making the request. Used for authenticating the client application.
//
// You will need to add an app to get a client Id and secret. These are the Consumer Key and Consumer Secret values respectfully in the API developer portal.
ClientId *string `json:"client_id,omitempty"`
// ClientSecret The shared secret issued to the client application making the request. Used for authenticating the client application.
//
// You will need to add an app to get a client Id and secret. These are the Consumer Key and Consumer Secret values respectfully in the API developer portal.
ClientSecret *string `json:"client_secret,omitempty"`
// GrantType The OAuth standard flow being requested by the client application.
GrantType RefreshTokenCredentialsGrantType `json:"grant_type"`
// RefreshToken The refresh token value to be used to issue a new access token.
RefreshToken *string `json:"refresh_token,omitempty"`
// Scope The OAuth2 scope being requested. A client application may request a subset of scope that has already been configured during registration.
//
// The default scope registered for the client application is used as default when the scope is omitted.
//
// **Only specify the scope in the request when the client application requires less scope, i.e. less access to APIs, than the default.**
Scope *string `json:"scope,omitempty"`
}
RefreshTokenCredentials defines model for RefreshTokenCredentials.
type RefreshTokenCredentialsGrantType ¶
type RefreshTokenCredentialsGrantType string
RefreshTokenCredentialsGrantType The OAuth standard flow being requested by the client application.
const ( RefreshTokenCredentialsGrantTypeAuthorizationCode RefreshTokenCredentialsGrantType = "authorization_code" RefreshTokenCredentialsGrantTypeClientCredentials RefreshTokenCredentialsGrantType = "client_credentials" RefreshTokenCredentialsGrantTypeRefreshToken RefreshTokenCredentialsGrantType = "refresh_token" )
Defines values for RefreshTokenCredentialsGrantType.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type ResourceOwnerTokenResponse ¶
type ResourceOwnerTokenResponse struct {
// AccessToken The access token issued to use to acess protected resources.
AccessToken string `json:"access_token"`
// ApiProducts The list of API products approved for use by the client application.
ApiProducts *string `json:"api_products,omitempty"`
// ApplicationName The name of the client application.
ApplicationName *string `json:"application_name,omitempty"`
// ClientId The unique identifier for the client application.
ClientId *string `json:"client_id,omitempty"`
// ExpiresIn The expiration time of the issued access token, in seconds.
ExpiresIn int `json:"expires_in"`
// IssuedAt The date and time the access token was issued, expressed in Unix epoch time in milliseconds.
// You may use [The Unix Epoch Time Converter](https://www.epochconverter.com/) to convert access token issued at values to human readable formats.
IssuedAt *int64 `json:"issued_at,omitempty"`
// Issuer The authority that issued the token(s).
Issuer *string `json:"issuer,omitempty"`
// PublicKey The base64-encoded public cryptographic key used to validate the signature of the access token. Validation ensures that the access token has not been tampered with and it originated from a known, trusted source.
PublicKey *[]byte `json:"public_key,omitempty"`
// RefreshCount The number of times the refresh token operation has been used.
RefreshCount *int `json:"refresh_count,omitempty"`
// RefreshToken The refresh token.
RefreshToken string `json:"refresh_token"`
// RefreshTokenExpiresIn The refresh token expiration, in seconds.
RefreshTokenExpiresIn int `json:"refresh_token_expires_in"`
// RefreshTokenIssuedAt The date and time the refresh token was issued expressed in Unix epoch time in milliseconds.
// You may use [The Unix Epoch Time Converter](https://www.epochconverter.com/) to convert refresh token issued at values to human readable formats.
RefreshTokenIssuedAt *int64 `json:"refresh_token_issued_at,omitempty"`
// RefreshTokenStatus The current state of the refresh token.
RefreshTokenStatus *ResourceOwnerTokenResponseRefreshTokenStatus `json:"refresh_token_status,omitempty"`
// Scope The OAuth scope being requested by the client application, specified as a list of space-delimited, case-sensitive strings. If ommitted from the token request then the default scope configured for the client application is used.
Scope *string `json:"scope,omitempty"`
// Status The status of the access token.
Status *ResourceOwnerTokenResponseStatus `json:"status,omitempty"`
// TokenType The access token type provides the client with the information required to successfully utilize the access token to make a protected resource request (along with type-specific attributes). The client MUST NOT use an access token if it does not understand the token type.
TokenType ResourceOwnerTokenResponseTokenType `json:"token_type"`
}
ResourceOwnerTokenResponse The OAuth token response for third-party client applications to use to access USPS APIs on behalf of USPS customers. Both access and refresh tokens are returned in the response. You may use [The Unix Epoch Time Converter](https://www.epochconverter.com/) to convert access token issued at values to human readable formats. Use the public key provided in the response to verify the access token signature.
type ResourceOwnerTokenResponseRefreshTokenStatus ¶
type ResourceOwnerTokenResponseRefreshTokenStatus string
ResourceOwnerTokenResponseRefreshTokenStatus The current state of the refresh token.
const ( ResourceOwnerTokenResponseRefreshTokenStatusApproved ResourceOwnerTokenResponseRefreshTokenStatus = "approved" ResourceOwnerTokenResponseRefreshTokenStatusRevoked ResourceOwnerTokenResponseRefreshTokenStatus = "revoked" )
Defines values for ResourceOwnerTokenResponseRefreshTokenStatus.
type ResourceOwnerTokenResponseStatus ¶
type ResourceOwnerTokenResponseStatus string
ResourceOwnerTokenResponseStatus The status of the access token.
const ( Approved ResourceOwnerTokenResponseStatus = "approved" Revoked ResourceOwnerTokenResponseStatus = "revoked" )
Defines values for ResourceOwnerTokenResponseStatus.
type ResourceOwnerTokenResponseTokenType ¶
type ResourceOwnerTokenResponseTokenType string
ResourceOwnerTokenResponseTokenType The access token type provides the client with the information required to successfully utilize the access token to make a protected resource request (along with type-specific attributes). The client MUST NOT use an access token if it does not understand the token type.
const (
ResourceOwnerTokenResponseTokenTypeBearer ResourceOwnerTokenResponseTokenType = "Bearer"
)
Defines values for ResourceOwnerTokenResponseTokenType.
type StandardErrorResponse ¶
type StandardErrorResponse struct {
// Error See [The OAuth 2.0 Authorization Framework, Section 5.2](https://datatracker.ietf.org/doc/html/rfc6749#section-5.2), for information about the specific error codes.
Error *StandardErrorResponseError `json:"error,omitempty"`
// ErrorDescription A human-readable text providing additional information, used to assist the client developer in understanding the error that occurred.
ErrorDescription *string `json:"error_description,omitempty"`
// ErrorUri A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.
ErrorUri *string `json:"error_uri,omitempty"`
AdditionalProperties map[string]interface{} `json:"-"`
}
StandardErrorResponse The authorization server responds with an HTTP 400 (Bad Request) status code (unless specified otherwise) and includes the following parameters with the response.
func (StandardErrorResponse) Get ¶
func (a StandardErrorResponse) Get(fieldName string) (value interface{}, found bool)
Getter for additional properties for StandardErrorResponse. Returns the specified element and whether it was found
func (StandardErrorResponse) MarshalJSON ¶
func (a StandardErrorResponse) MarshalJSON() ([]byte, error)
Override default JSON handling for StandardErrorResponse to handle AdditionalProperties
func (*StandardErrorResponse) Set ¶
func (a *StandardErrorResponse) Set(fieldName string, value interface{})
Setter for additional properties for StandardErrorResponse
func (*StandardErrorResponse) UnmarshalJSON ¶
func (a *StandardErrorResponse) UnmarshalJSON(b []byte) error
Override default JSON handling for StandardErrorResponse to handle AdditionalProperties
type StandardErrorResponseError ¶
type StandardErrorResponseError string
StandardErrorResponseError See [The OAuth 2.0 Authorization Framework, Section 5.2](https://datatracker.ietf.org/doc/html/rfc6749#section-5.2), for information about the specific error codes.
const ( InvalidClient StandardErrorResponseError = "invalid_client" InvalidGrant StandardErrorResponseError = "invalid_grant" InvalidRequest StandardErrorResponseError = "invalid_request" InvalidScope StandardErrorResponseError = "invalid_scope" UnsupportedGrantType StandardErrorResponseError = "unsupported_grant_type" )
Defines values for StandardErrorResponseError.
type TokenRequest ¶
type TokenRequest struct {
// GrantType The OAuth standard flow being requested by the client application.
GrantType TokenRequestGrantType `json:"grant_type"`
// Scope The OAuth2 scope being requested. A client application may request a subset of scope that has already been configured during registration.
//
// The default scope registered for the client application is used as default when the scope is omitted.
//
// **Only specify the scope in the request when the client application requires less scope, i.e. less access to APIs, than the default.**
Scope *string `json:"scope,omitempty"`
AdditionalProperties map[string]interface{} `json:"-"`
// contains filtered or unexported fields
}
TokenRequest The base object for an OAuth token request, in accordance with OAuth industry standards.
func (TokenRequest) AsAuthorizationCodeCredentials ¶
func (t TokenRequest) AsAuthorizationCodeCredentials() (AuthorizationCodeCredentials, error)
AsAuthorizationCodeCredentials returns the union data inside the TokenRequest as a AuthorizationCodeCredentials
func (TokenRequest) AsClientCredentials ¶
func (t TokenRequest) AsClientCredentials() (ClientCredentials, error)
AsClientCredentials returns the union data inside the TokenRequest as a ClientCredentials
func (TokenRequest) AsRefreshTokenCredentials ¶
func (t TokenRequest) AsRefreshTokenCredentials() (RefreshTokenCredentials, error)
AsRefreshTokenCredentials returns the union data inside the TokenRequest as a RefreshTokenCredentials
func (*TokenRequest) FromAuthorizationCodeCredentials ¶
func (t *TokenRequest) FromAuthorizationCodeCredentials(v AuthorizationCodeCredentials) error
FromAuthorizationCodeCredentials overwrites any union data inside the TokenRequest as the provided AuthorizationCodeCredentials
func (*TokenRequest) FromClientCredentials ¶
func (t *TokenRequest) FromClientCredentials(v ClientCredentials) error
FromClientCredentials overwrites any union data inside the TokenRequest as the provided ClientCredentials
func (*TokenRequest) FromRefreshTokenCredentials ¶
func (t *TokenRequest) FromRefreshTokenCredentials(v RefreshTokenCredentials) error
FromRefreshTokenCredentials overwrites any union data inside the TokenRequest as the provided RefreshTokenCredentials
func (TokenRequest) Get ¶
func (a TokenRequest) Get(fieldName string) (value interface{}, found bool)
Getter for additional properties for TokenRequest. Returns the specified element and whether it was found
func (TokenRequest) MarshalJSON ¶
func (a TokenRequest) MarshalJSON() ([]byte, error)
Override default JSON handling for TokenRequest to handle AdditionalProperties and union
func (*TokenRequest) MergeAuthorizationCodeCredentials ¶
func (t *TokenRequest) MergeAuthorizationCodeCredentials(v AuthorizationCodeCredentials) error
MergeAuthorizationCodeCredentials performs a merge with any union data inside the TokenRequest, using the provided AuthorizationCodeCredentials
func (*TokenRequest) MergeClientCredentials ¶
func (t *TokenRequest) MergeClientCredentials(v ClientCredentials) error
MergeClientCredentials performs a merge with any union data inside the TokenRequest, using the provided ClientCredentials
func (*TokenRequest) MergeRefreshTokenCredentials ¶
func (t *TokenRequest) MergeRefreshTokenCredentials(v RefreshTokenCredentials) error
MergeRefreshTokenCredentials performs a merge with any union data inside the TokenRequest, using the provided RefreshTokenCredentials
func (*TokenRequest) Set ¶
func (a *TokenRequest) Set(fieldName string, value interface{})
Setter for additional properties for TokenRequest
func (*TokenRequest) UnmarshalJSON ¶
func (a *TokenRequest) UnmarshalJSON(b []byte) error
Override default JSON handling for TokenRequest to handle AdditionalProperties and union
type TokenRequestGrantType ¶
type TokenRequestGrantType string
TokenRequestGrantType The OAuth standard flow being requested by the client application.
const ( TokenRequestGrantTypeAuthorizationCode TokenRequestGrantType = "authorization_code" TokenRequestGrantTypeClientCredentials TokenRequestGrantType = "client_credentials" TokenRequestGrantTypeRefreshToken TokenRequestGrantType = "refresh_token" )
Defines values for TokenRequestGrantType.
type TokenRevokeRequest ¶
type TokenRevokeRequest struct {
// Token The token (a hash value).
Token string `json:"token"`
// TokenTypeHint A hint to the type of the given token. See OAuth Token Types Hint registry, https://www.rfc-editor.org/rfc/rfc7009#section-4.1.2.1
TokenTypeHint *TokenRevokeRequestTokenTypeHint `json:"token_type_hint,omitempty"`
}
TokenRevokeRequest The token revocation request.
type TokenRevokeRequestTokenTypeHint ¶
type TokenRevokeRequestTokenTypeHint string
TokenRevokeRequestTokenTypeHint A hint to the type of the given token. See OAuth Token Types Hint registry, https://www.rfc-editor.org/rfc/rfc7009#section-4.1.2.1
const ( AccessToken TokenRevokeRequestTokenTypeHint = "access_token" RefreshToken TokenRevokeRequestTokenTypeHint = "refresh_token" )
Defines values for TokenRevokeRequestTokenTypeHint.