oauthauthcode

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package oauthauthcode 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

View Source
const (
	BasicAuthGenerateScopes = "BasicAuthGenerate.Scopes"
	BasicAuthRefreshScopes  = "BasicAuthRefresh.Scopes"
)

Variables

This section is empty.

Functions

func NewAuthorizeClientRequest

func NewAuthorizeClientRequest(server string, params *AuthorizeClientParams) (*http.Request, error)

NewAuthorizeClientRequest generates requests for AuthorizeClient

func NewGenerateTokenRequestWithBody

func NewGenerateTokenRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewGenerateTokenRequestWithBody generates requests for GenerateToken with any type of body

func NewGenerateTokenRequestWithFormdataBody

func NewGenerateTokenRequestWithFormdataBody(server string, body GenerateTokenFormdataRequestBody) (*http.Request, error)

NewGenerateTokenRequestWithFormdataBody calls the generic GenerateToken builder with application/x-www-form-urlencoded body

func NewRefreshTokenRequestWithBody

func NewRefreshTokenRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewRefreshTokenRequestWithBody generates requests for RefreshToken with any type of body

func NewRefreshTokenRequestWithFormdataBody

func NewRefreshTokenRequestWithFormdataBody(server string, body RefreshTokenFormdataRequestBody) (*http.Request, error)

NewRefreshTokenRequestWithFormdataBody calls the generic RefreshToken builder with application/x-www-form-urlencoded body

Types

type AuthorizeClientParams

type AuthorizeClientParams struct {
	// ClientId The public identifier for your application, obtained when you, the developer first registered the application.
	ClientId string `form:"client_id" json:"client_id"`

	// RedirectUri URL that tells the authorization server where to send the user back to after they approve the request.
	RedirectUri string `form:"redirect_uri" json:"redirect_uri"`

	// ResponseType Valid Values: code
	ResponseType string `form:"response_type" json:"response_type"`

	// State A random string generated by the application and included in the request to prevent CSRF attacks. The application checks that the same value is returned after the user authorizes the app.
	State *string `form:"state,omitempty" json:"state,omitempty"`

	// Scope One or more space-separated strings indicating which permissions the application is requesting.
	Scope *string `form:"scope,omitempty" json:"scope,omitempty"`

	// CodeChallenge Base64 URL-Encoded SHA256 value of Code Verifier that can be used to verify the code_verifier in the /token step.
	CodeChallenge *string `form:"code_challenge,omitempty" json:"code_challenge,omitempty"`
}

AuthorizeClientParams defines parameters for AuthorizeClient.

type AuthorizeClientResponse

type AuthorizeClientResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON400      *TokenErrorResponse
	JSON401      *TokenErrorResponse
	JSON403      *TokenErrorResponse
	JSON429      *TokenErrorResponse
}

func ParseAuthorizeClientResponse

func ParseAuthorizeClientResponse(rsp *http.Response) (*AuthorizeClientResponse, error)

ParseAuthorizeClientResponse parses an HTTP response from a AuthorizeClientWithResponse call

func (AuthorizeClientResponse) Status

func (r AuthorizeClientResponse) Status() string

Status returns HTTPResponse.Status

func (AuthorizeClientResponse) StatusCode

func (r AuthorizeClientResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

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) AuthorizeClient

func (c *Client) AuthorizeClient(ctx context.Context, params *AuthorizeClientParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GenerateTokenWithBody

func (c *Client) GenerateTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GenerateTokenWithFormdataBody

func (c *Client) GenerateTokenWithFormdataBody(ctx context.Context, body GenerateTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) RefreshTokenWithBody

func (c *Client) RefreshTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) RefreshTokenWithFormdataBody

func (c *Client) RefreshTokenWithFormdataBody(ctx context.Context, body RefreshTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// AuthorizeClient request
	AuthorizeClient(ctx context.Context, params *AuthorizeClientParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// RefreshTokenWithBody request with any body
	RefreshTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	RefreshTokenWithFormdataBody(ctx context.Context, body RefreshTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GenerateTokenWithBody request with any body
	GenerateTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	GenerateTokenWithFormdataBody(ctx context.Context, body GenerateTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

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) AuthorizeClientWithResponse

func (c *ClientWithResponses) AuthorizeClientWithResponse(ctx context.Context, params *AuthorizeClientParams, reqEditors ...RequestEditorFn) (*AuthorizeClientResponse, error)

AuthorizeClientWithResponse request returning *AuthorizeClientResponse

func (*ClientWithResponses) GenerateTokenWithBodyWithResponse

func (c *ClientWithResponses) GenerateTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*GenerateTokenResponse, error)

GenerateTokenWithBodyWithResponse request with arbitrary body returning *GenerateTokenResponse

func (*ClientWithResponses) GenerateTokenWithFormdataBodyWithResponse

func (c *ClientWithResponses) GenerateTokenWithFormdataBodyWithResponse(ctx context.Context, body GenerateTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*GenerateTokenResponse, error)

func (*ClientWithResponses) RefreshTokenWithBodyWithResponse

func (c *ClientWithResponses) RefreshTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RefreshTokenResponse, error)

RefreshTokenWithBodyWithResponse request with arbitrary body returning *RefreshTokenResponse

func (*ClientWithResponses) RefreshTokenWithFormdataBodyWithResponse

func (c *ClientWithResponses) RefreshTokenWithFormdataBodyWithResponse(ctx context.Context, body RefreshTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*RefreshTokenResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// AuthorizeClientWithResponse request
	AuthorizeClientWithResponse(ctx context.Context, params *AuthorizeClientParams, reqEditors ...RequestEditorFn) (*AuthorizeClientResponse, error)

	// RefreshTokenWithBodyWithResponse request with any body
	RefreshTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RefreshTokenResponse, error)

	RefreshTokenWithFormdataBodyWithResponse(ctx context.Context, body RefreshTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*RefreshTokenResponse, error)

	// GenerateTokenWithBodyWithResponse request with any body
	GenerateTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*GenerateTokenResponse, error)

	GenerateTokenWithFormdataBodyWithResponse(ctx context.Context, body GenerateTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*GenerateTokenResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type ErrorResponseWrapper

type ErrorResponseWrapper struct {
	Errors *[]Errors `json:"errors,omitempty"`
}

ErrorResponseWrapper defines model for errorResponseWrapper.

type Errors

type Errors struct {
	// Code Error code
	Code *string `json:"code,omitempty"`

	// Message Error message
	Message *string `json:"message,omitempty"`
}

Errors defines model for errors.

type GenerateTokenFormdataBody

type GenerateTokenFormdataBody struct {
	// ClientId **Only required for PKCE flow**. The public identifier for your application, obtained when you, the developer first registered the application.
	ClientId *string `form:"client_id,omitempty" json:"client_id,omitempty"`

	// Code Authorization code from the UPS login system.
	Code string `form:"code" json:"code"`

	// CodeVerifier **Only required for PKCE flow**. A randomly generated secret created by the calling application that can be verified by the authorization server.
	CodeVerifier *string `form:"code_verifier,omitempty" json:"code_verifier,omitempty"`

	// GrantType Valid values: authorization_code
	GrantType string `form:"grant_type" json:"grant_type"`

	// RedirectUri Callback URL for the requesting application.
	RedirectUri string `form:"redirect_uri" json:"redirect_uri"`
}

GenerateTokenFormdataBody defines parameters for GenerateToken.

type GenerateTokenFormdataRequestBody

type GenerateTokenFormdataRequestBody GenerateTokenFormdataBody

GenerateTokenFormdataRequestBody defines body for GenerateToken for application/x-www-form-urlencoded ContentType.

type GenerateTokenResponse

type GenerateTokenResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *GenerateTokenSuccessResponse
	JSON400      *TokenErrorResponse
	JSON401      *TokenErrorResponse
	JSON403      *TokenErrorResponse
	JSON429      *TokenErrorResponse
}

func ParseGenerateTokenResponse

func ParseGenerateTokenResponse(rsp *http.Response) (*GenerateTokenResponse, error)

ParseGenerateTokenResponse parses an HTTP response from a GenerateTokenWithResponse call

func (GenerateTokenResponse) Status

func (r GenerateTokenResponse) Status() string

Status returns HTTPResponse.Status

func (GenerateTokenResponse) StatusCode

func (r GenerateTokenResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GenerateTokenSuccessResponse

type GenerateTokenSuccessResponse struct {
	// AccessToken Token to be used in API requests.
	AccessToken *string `json:"access_token,omitempty"`

	// ClientId Client id for requested token.
	ClientId *string `json:"client_id,omitempty"`

	// ExpiresIn Expire time for requested token in seconds.
	ExpiresIn *string `json:"expires_in,omitempty"`

	// IssuedAt Issue time of requested token in milliseconds.
	IssuedAt *string `json:"issued_at,omitempty"`

	// RefreshCount Number of refreshes for requested token.
	RefreshCount *string `json:"refresh_count,omitempty"`

	// RefreshToken Refresh token to be used in refresh requests when obtaining new access token.
	RefreshToken *string `json:"refresh_token,omitempty"`

	// RefreshTokenExpiresIn Expiration time for requested refresh token in seconds.
	RefreshTokenExpiresIn *string `json:"refresh_token_expires_in,omitempty"`

	// RefreshTokenIssuedAt Time that refresh token was issued in milliseconds.
	RefreshTokenIssuedAt *string `json:"refresh_token_issued_at,omitempty"`

	// RefreshTokenStatus Status for requested refresh token.
	RefreshTokenStatus *string `json:"refresh_token_status,omitempty"`

	// Scope Scope for requested token.
	Scope *string `json:"scope,omitempty"`

	// Status Status for requested token.
	Status *string `json:"status,omitempty"`

	// TokenType Type of requested access token
	TokenType *string `json:"token_type,omitempty"`
}

GenerateTokenSuccessResponse defines model for generateTokenSuccessResponse.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type RefreshTokenFormdataBody

type RefreshTokenFormdataBody struct {
	// GrantType Valid values: refresh_token
	GrantType string `form:"grant_type" json:"grant_type"`

	// RefreshToken Refresh token from GenerateToken operation
	RefreshToken string `form:"refresh_token" json:"refresh_token"`
}

RefreshTokenFormdataBody defines parameters for RefreshToken.

type RefreshTokenFormdataRequestBody

type RefreshTokenFormdataRequestBody RefreshTokenFormdataBody

RefreshTokenFormdataRequestBody defines body for RefreshToken for application/x-www-form-urlencoded ContentType.

type RefreshTokenResponse

type RefreshTokenResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *RefreshTokenSuccessResponse
	JSON400      *TokenErrorResponse
	JSON401      *TokenErrorResponse
	JSON403      *TokenErrorResponse
	JSON429      *TokenErrorResponse
}

func ParseRefreshTokenResponse

func ParseRefreshTokenResponse(rsp *http.Response) (*RefreshTokenResponse, error)

ParseRefreshTokenResponse parses an HTTP response from a RefreshTokenWithResponse call

func (RefreshTokenResponse) Status

func (r RefreshTokenResponse) Status() string

Status returns HTTPResponse.Status

func (RefreshTokenResponse) StatusCode

func (r RefreshTokenResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RefreshTokenSuccessResponse

type RefreshTokenSuccessResponse struct {
	// AccessToken Token to be used in API requests.
	AccessToken *string `json:"access_token,omitempty"`

	// ClientId Client id for requested token.
	ClientId *string `json:"client_id,omitempty"`

	// ExpiresIn Expiration time for requested access token in seconds.
	ExpiresIn *string `json:"expires_in,omitempty"`

	// IssuedAt Issue time for requested token in milliseconds.
	IssuedAt *string `json:"issued_at,omitempty"`

	// RefreshCount Number of refreshes for requested token.
	RefreshCount *string `json:"refresh_count,omitempty"`

	// RefreshToken Token to be used in refresh requests.
	RefreshToken *string `json:"refresh_token,omitempty"`

	// RefreshTokenExpiresIn Expiration time for requested refresh token in seconds.
	RefreshTokenExpiresIn *string `json:"refresh_token_expires_in,omitempty"`

	// RefreshTokenIssuedAt Issue time for requested refresh token in milliseconds.
	RefreshTokenIssuedAt *string `json:"refresh_token_issued_at,omitempty"`

	// RefreshTokenStatus Status for requested refresh token.
	RefreshTokenStatus *string `json:"refresh_token_status,omitempty"`

	// Scope Scope for requested token.
	Scope *string `json:"scope,omitempty"`

	// Status Status for requested token.
	Status *string `json:"status,omitempty"`

	// TokenType Type for requested token.
	TokenType *string `json:"token_type,omitempty"`
}

RefreshTokenSuccessResponse defines model for refreshTokenSuccessResponse.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type TokenErrorResponse

type TokenErrorResponse struct {
	Response *ErrorResponseWrapper `json:"response,omitempty"`
}

TokenErrorResponse defines model for tokenErrorResponse.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL