oauthclientcredentials

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 oauthclientcredentials 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 (
	BasicAuthScopes = "BasicAuth.Scopes"
)

Variables

This section is empty.

Functions

func NewCreateTokenRequestWithBody

func NewCreateTokenRequestWithBody(server string, params *CreateTokenParams, contentType string, body io.Reader) (*http.Request, error)

NewCreateTokenRequestWithBody generates requests for CreateToken with any type of body

func NewCreateTokenRequestWithFormdataBody

func NewCreateTokenRequestWithFormdataBody(server string, params *CreateTokenParams, body CreateTokenFormdataRequestBody) (*http.Request, error)

NewCreateTokenRequestWithFormdataBody calls the generic CreateToken builder with application/x-www-form-urlencoded body

Types

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

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

func (*Client) CreateTokenWithFormdataBody

func (c *Client) CreateTokenWithFormdataBody(ctx context.Context, params *CreateTokenParams, body CreateTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// CreateTokenWithBody request with any body
	CreateTokenWithBody(ctx context.Context, params *CreateTokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	CreateTokenWithFormdataBody(ctx context.Context, params *CreateTokenParams, body CreateTokenFormdataRequestBody, 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) CreateTokenWithBodyWithResponse

func (c *ClientWithResponses) CreateTokenWithBodyWithResponse(ctx context.Context, params *CreateTokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateTokenResponse, error)

CreateTokenWithBodyWithResponse request with arbitrary body returning *CreateTokenResponse

func (*ClientWithResponses) CreateTokenWithFormdataBodyWithResponse

func (c *ClientWithResponses) CreateTokenWithFormdataBodyWithResponse(ctx context.Context, params *CreateTokenParams, body CreateTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*CreateTokenResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// CreateTokenWithBodyWithResponse request with any body
	CreateTokenWithBodyWithResponse(ctx context.Context, params *CreateTokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateTokenResponse, error)

	CreateTokenWithFormdataBodyWithResponse(ctx context.Context, params *CreateTokenParams, body CreateTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*CreateTokenResponse, error)
}

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

type CreateTokenFormdataBody

type CreateTokenFormdataBody struct {
	// GrantType Valid values: client_credentials
	GrantType string `form:"grant_type" json:"grant_type"`
}

CreateTokenFormdataBody defines parameters for CreateToken.

type CreateTokenFormdataRequestBody

type CreateTokenFormdataRequestBody CreateTokenFormdataBody

CreateTokenFormdataRequestBody defines body for CreateToken for application/x-www-form-urlencoded ContentType.

type CreateTokenParams

type CreateTokenParams struct {
	// XMerchantId 6-digit UPS account number.
	XMerchantId *string `json:"x-merchant-id,omitempty"`
}

CreateTokenParams defines parameters for CreateToken.

type CreateTokenResponse

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

func ParseCreateTokenResponse

func ParseCreateTokenResponse(rsp *http.Response) (*CreateTokenResponse, error)

ParseCreateTokenResponse parses an HTTP response from a CreateTokenWithResponse call

func (CreateTokenResponse) Status

func (r CreateTokenResponse) Status() string

Status returns HTTPResponse.Status

func (CreateTokenResponse) StatusCode

func (r CreateTokenResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

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 HttpRequestDoer

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

Doer performs HTTP requests.

The standard http.Client implements this interface.

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.

type TokenSuccessResponse

type TokenSuccessResponse 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.
	IssuedAt *string `json:"issued_at,omitempty"`

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

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

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

	// TokenType Container for token response.
	TokenType *string `json:"token_type,omitempty"`
}

TokenSuccessResponse defines model for tokenSuccessResponse.

Jump to

Keyboard shortcuts

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