api

package
v0.0.0-...-475b4fd Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version 2.4.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDownloadFontRequest

func NewDownloadFontRequest(server string, id string, subset DownloadFontParamsSubset, weight string, style DownloadFontParamsStyle) (*http.Request, error)

NewDownloadFontRequest generates requests for DownloadFont

func NewGetFontByIDRequest

func NewGetFontByIDRequest(server string, id string) (*http.Request, error)

NewGetFontByIDRequest generates requests for GetFontByID

func NewGetFontsRequest

func NewGetFontsRequest(server string) (*http.Request, error)

NewGetFontsRequest generates requests for GetFonts

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

func (c *Client) DownloadFont(ctx context.Context, id string, subset DownloadFontParamsSubset, weight string, style DownloadFontParamsStyle, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetFontByID

func (c *Client) GetFontByID(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetFonts

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

type ClientInterface

type ClientInterface interface {
	// DownloadFont request
	DownloadFont(ctx context.Context, id string, subset DownloadFontParamsSubset, weight string, style DownloadFontParamsStyle, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetFonts request
	GetFonts(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetFontByID request
	GetFontByID(ctx context.Context, id string, 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) DownloadFontWithResponse

func (c *ClientWithResponses) DownloadFontWithResponse(ctx context.Context, id string, subset DownloadFontParamsSubset, weight string, style DownloadFontParamsStyle, reqEditors ...RequestEditorFn) (*DownloadFontResponse, error)

DownloadFontWithResponse request returning *DownloadFontResponse

func (*ClientWithResponses) GetFontByIDWithResponse

func (c *ClientWithResponses) GetFontByIDWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetFontByIDResponse, error)

GetFontByIDWithResponse request returning *GetFontByIDResponse

func (*ClientWithResponses) GetFontsWithResponse

func (c *ClientWithResponses) GetFontsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetFontsResponse, error)

GetFontsWithResponse request returning *GetFontsResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// DownloadFontWithResponse request
	DownloadFontWithResponse(ctx context.Context, id string, subset DownloadFontParamsSubset, weight string, style DownloadFontParamsStyle, reqEditors ...RequestEditorFn) (*DownloadFontResponse, error)

	// GetFontsWithResponse request
	GetFontsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetFontsResponse, error)

	// GetFontByIDWithResponse request
	GetFontByIDWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetFontByIDResponse, error)
}

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

type DownloadFontParamsStyle

type DownloadFontParamsStyle string

DownloadFontParamsStyle defines parameters for DownloadFont.

const (
	Italic DownloadFontParamsStyle = "italic"
	Normal DownloadFontParamsStyle = "normal"
)

Defines values for DownloadFontParamsStyle.

type DownloadFontParamsSubset

type DownloadFontParamsSubset string

DownloadFontParamsSubset defines parameters for DownloadFont.

const (
	Latin      DownloadFontParamsSubset = "latin"
	LatinExt   DownloadFontParamsSubset = "latin-ext"
	Vietnamese DownloadFontParamsSubset = "vietnamese"
)

Defines values for DownloadFontParamsSubset.

type DownloadFontResponse

type DownloadFontResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseDownloadFontResponse

func ParseDownloadFontResponse(rsp *http.Response) (*DownloadFontResponse, error)

ParseDownloadFontResponse parses an HTTP response from a DownloadFontWithResponse call

func (DownloadFontResponse) Status

func (r DownloadFontResponse) Status() string

Status returns HTTPResponse.Status

func (DownloadFontResponse) StatusCode

func (r DownloadFontResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetFontByID200Styles

type GetFontByID200Styles string

type GetFontByID200Subsets

type GetFontByID200Subsets string

type GetFontByIDResponse

type GetFontByIDResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		// Id Unique identifier for the font family
		Id string `json:"id"`

		// Styles Available styles for the font family
		Styles []GetFontByID200Styles `json:"styles"`

		// Subsets Available subsets for the font family
		Subsets []GetFontByID200Subsets `json:"subsets"`

		// Weights Available font weights for the font family
		Weights []string `json:"weights"`
	}
}

func ParseGetFontByIDResponse

func ParseGetFontByIDResponse(rsp *http.Response) (*GetFontByIDResponse, error)

ParseGetFontByIDResponse parses an HTTP response from a GetFontByIDWithResponse call

func (GetFontByIDResponse) Status

func (r GetFontByIDResponse) Status() string

Status returns HTTPResponse.Status

func (GetFontByIDResponse) StatusCode

func (r GetFontByIDResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetFontsResponse

type GetFontsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *[]struct {
		// Designer Name(s) of the designer(s)
		Designer string `json:"designer"`

		// Id Unique identifier for the font family
		Id string `json:"id"`

		// Name Name of the font family
		Name string `json:"name"`
	}
}

func ParseGetFontsResponse

func ParseGetFontsResponse(rsp *http.Response) (*GetFontsResponse, error)

ParseGetFontsResponse parses an HTTP response from a GetFontsWithResponse call

func (GetFontsResponse) Status

func (r GetFontsResponse) Status() string

Status returns HTTPResponse.Status

func (GetFontsResponse) StatusCode

func (r GetFontsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

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

Jump to

Keyboard shortcuts

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