Documentation
¶
Overview ¶
Package client contains the generated client for the parameter roundtrip test.
Index ¶
- Constants
- func GetOpenAPISpecJSON() ([]byte, error)
- func MarshalDeepObject(i any, paramName string) (string, error)
- func NewGetContentObjectRequest(server string, param string) (*http.Request, error)
- func NewGetCookieRequest(server string, params *GetCookieParams) (*http.Request, error)
- func NewGetDeepObjectRequest(server string, params *GetDeepObjectParams) (*http.Request, error)
- func NewGetHeaderRequest(server string, params *GetHeaderParams) (*http.Request, error)
- func NewGetLabelExplodeArrayRequest(server string, param []int32) (*http.Request, error)
- func NewGetLabelExplodeObjectRequest(server string, param Object) (*http.Request, error)
- func NewGetLabelExplodePrimitiveRequest(server string, param int32) (*http.Request, error)
- func NewGetLabelNoExplodeArrayRequest(server string, param []int32) (*http.Request, error)
- func NewGetLabelNoExplodeObjectRequest(server string, param Object) (*http.Request, error)
- func NewGetLabelPrimitiveRequest(server string, param int32) (*http.Request, error)
- func NewGetMatrixExplodeArrayRequest(server string, id []int32) (*http.Request, error)
- func NewGetMatrixExplodeObjectRequest(server string, id Object) (*http.Request, error)
- func NewGetMatrixExplodePrimitiveRequest(server string, id int32) (*http.Request, error)
- func NewGetMatrixNoExplodeArrayRequest(server string, id []int32) (*http.Request, error)
- func NewGetMatrixNoExplodeObjectRequest(server string, id Object) (*http.Request, error)
- func NewGetMatrixPrimitiveRequest(server string, id int32) (*http.Request, error)
- func NewGetPassThroughRequest(server string, param string) (*http.Request, error)
- func NewGetQueryFormRequest(server string, params *GetQueryFormParams) (*http.Request, error)
- func NewGetSimpleExplodeArrayRequest(server string, param []int32) (*http.Request, error)
- func NewGetSimpleExplodeObjectRequest(server string, param Object) (*http.Request, error)
- func NewGetSimpleExplodePrimitiveRequest(server string, param int32) (*http.Request, error)
- func NewGetSimpleNoExplodeArrayRequest(server string, param []int32) (*http.Request, error)
- func NewGetSimpleNoExplodeObjectRequest(server string, param Object) (*http.Request, error)
- func NewGetSimplePrimitiveRequest(server string, param int32) (*http.Request, error)
- func StyleParameter(paramName string, value any, opts ParameterOptions) (string, error)
- type Client
- func (c *Client) GetContentObject(ctx context.Context, param string, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetCookie(ctx context.Context, params *GetCookieParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetDeepObject(ctx context.Context, params *GetDeepObjectParams, ...) (*http.Response, error)
- func (c *Client) GetHeader(ctx context.Context, params *GetHeaderParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetLabelExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetLabelExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetLabelExplodePrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetLabelNoExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetLabelNoExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetLabelPrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetMatrixExplodeArray(ctx context.Context, id []int32, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetMatrixExplodeObject(ctx context.Context, id Object, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetMatrixExplodePrimitive(ctx context.Context, id int32, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetMatrixNoExplodeArray(ctx context.Context, id []int32, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetMatrixNoExplodeObject(ctx context.Context, id Object, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetMatrixPrimitive(ctx context.Context, id int32, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetPassThrough(ctx context.Context, param string, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetQueryForm(ctx context.Context, params *GetQueryFormParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetSimpleExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetSimpleExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetSimpleExplodePrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetSimpleNoExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetSimpleNoExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetSimplePrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ComplexObject
- type Date
- type GetCookieParams
- type GetDeepObjectParams
- type GetHeaderParams
- type GetQueryFormParams
- type HttpRequestDoer
- type Object
- type ParamLocation
- type ParameterOptions
- type RequestEditorFn
- type UUID
Constants ¶
const DateFormat = "2006-01-02"
Variables ¶
This section is empty.
Functions ¶
func GetOpenAPISpecJSON ¶
GetOpenAPISpecJSON returns the raw OpenAPI spec as JSON bytes.
func MarshalDeepObject ¶
MarshalDeepObject marshals an object to deepObject style query parameters.
func NewGetContentObjectRequest ¶
NewGetContentObjectRequest creates a GET request for /contentObject/{param}
func NewGetCookieRequest ¶
func NewGetCookieRequest(server string, params *GetCookieParams) (*http.Request, error)
NewGetCookieRequest creates a GET request for /cookie
func NewGetDeepObjectRequest ¶
func NewGetDeepObjectRequest(server string, params *GetDeepObjectParams) (*http.Request, error)
NewGetDeepObjectRequest creates a GET request for /queryDeepObject
func NewGetHeaderRequest ¶
func NewGetHeaderRequest(server string, params *GetHeaderParams) (*http.Request, error)
NewGetHeaderRequest creates a GET request for /header
func NewGetLabelExplodeArrayRequest ¶
NewGetLabelExplodeArrayRequest creates a GET request for /labelExplodeArray/{.param*}
func NewGetLabelExplodeObjectRequest ¶
NewGetLabelExplodeObjectRequest creates a GET request for /labelExplodeObject/{.param*}
func NewGetLabelExplodePrimitiveRequest ¶
NewGetLabelExplodePrimitiveRequest creates a GET request for /labelExplodePrimitive/{.param*}
func NewGetLabelNoExplodeArrayRequest ¶
NewGetLabelNoExplodeArrayRequest creates a GET request for /labelNoExplodeArray/{.param}
func NewGetLabelNoExplodeObjectRequest ¶
NewGetLabelNoExplodeObjectRequest creates a GET request for /labelNoExplodeObject/{.param}
func NewGetLabelPrimitiveRequest ¶
NewGetLabelPrimitiveRequest creates a GET request for /labelPrimitive/{.param}
func NewGetMatrixExplodeArrayRequest ¶
NewGetMatrixExplodeArrayRequest creates a GET request for /matrixExplodeArray/{.id*}
func NewGetMatrixExplodeObjectRequest ¶
NewGetMatrixExplodeObjectRequest creates a GET request for /matrixExplodeObject/{.id*}
func NewGetMatrixExplodePrimitiveRequest ¶
NewGetMatrixExplodePrimitiveRequest creates a GET request for /matrixExplodePrimitive/{;id*}
func NewGetMatrixNoExplodeArrayRequest ¶
NewGetMatrixNoExplodeArrayRequest creates a GET request for /matrixNoExplodeArray/{.id}
func NewGetMatrixNoExplodeObjectRequest ¶
NewGetMatrixNoExplodeObjectRequest creates a GET request for /matrixNoExplodeObject/{.id}
func NewGetMatrixPrimitiveRequest ¶
NewGetMatrixPrimitiveRequest creates a GET request for /matrixPrimitive/{;id}
func NewGetPassThroughRequest ¶
NewGetPassThroughRequest creates a GET request for /passThrough/{param}
func NewGetQueryFormRequest ¶
func NewGetQueryFormRequest(server string, params *GetQueryFormParams) (*http.Request, error)
NewGetQueryFormRequest creates a GET request for /queryForm
func NewGetSimpleExplodeArrayRequest ¶
NewGetSimpleExplodeArrayRequest creates a GET request for /simpleExplodeArray/{param*}
func NewGetSimpleExplodeObjectRequest ¶
NewGetSimpleExplodeObjectRequest creates a GET request for /simpleExplodeObject/{param*}
func NewGetSimpleExplodePrimitiveRequest ¶
NewGetSimpleExplodePrimitiveRequest creates a GET request for /simpleExplodePrimitive/{param}
func NewGetSimpleNoExplodeArrayRequest ¶
NewGetSimpleNoExplodeArrayRequest creates a GET request for /simpleNoExplodeArray/{param}
func NewGetSimpleNoExplodeObjectRequest ¶
NewGetSimpleNoExplodeObjectRequest creates a GET request for /simpleNoExplodeObject/{param}
func NewGetSimplePrimitiveRequest ¶
NewGetSimplePrimitiveRequest creates a GET request for /simplePrimitive/{param}
func StyleParameter ¶
func StyleParameter(paramName string, value any, opts ParameterOptions) (string, error)
StyleParameter serializes a Go value into an OpenAPI-styled parameter string. This is the entry point for client-side parameter serialization. The Style field in opts selects the serialization format. If Style is empty, "simple" is assumed.
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 OpenAPI 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)
NewClient creates a new Client with reasonable defaults.
func (*Client) GetContentObject ¶
func (*Client) GetCookie ¶
func (c *Client) GetCookie(ctx context.Context, params *GetCookieParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) GetDeepObject ¶
func (c *Client) GetDeepObject(ctx context.Context, params *GetDeepObjectParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) GetHeader ¶
func (c *Client) GetHeader(ctx context.Context, params *GetHeaderParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) GetLabelExplodeArray ¶
func (*Client) GetLabelExplodeObject ¶
func (*Client) GetLabelExplodePrimitive ¶
func (*Client) GetLabelNoExplodeArray ¶
func (*Client) GetLabelNoExplodeObject ¶
func (*Client) GetLabelPrimitive ¶
func (*Client) GetMatrixExplodeArray ¶
func (*Client) GetMatrixExplodeObject ¶
func (*Client) GetMatrixExplodePrimitive ¶
func (*Client) GetMatrixNoExplodeArray ¶
func (*Client) GetMatrixNoExplodeObject ¶
func (*Client) GetMatrixPrimitive ¶
func (*Client) GetPassThrough ¶
func (*Client) GetQueryForm ¶
func (c *Client) GetQueryForm(ctx context.Context, params *GetQueryFormParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) GetSimpleExplodeArray ¶
func (*Client) GetSimpleExplodeObject ¶
func (*Client) GetSimpleExplodePrimitive ¶
func (*Client) GetSimpleNoExplodeArray ¶
func (*Client) GetSimpleNoExplodeObject ¶
func (*Client) GetSimplePrimitive ¶
type ClientInterface ¶
type ClientInterface interface {
// GetContentObject makes a GET request to /contentObject/{param}
GetContentObject(ctx context.Context, param string, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetCookie makes a GET request to /cookie
GetCookie(ctx context.Context, params *GetCookieParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetHeader makes a GET request to /header
GetHeader(ctx context.Context, params *GetHeaderParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetLabelExplodeArray makes a GET request to /labelExplodeArray/{.param*}
GetLabelExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetLabelExplodeObject makes a GET request to /labelExplodeObject/{.param*}
GetLabelExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetLabelExplodePrimitive makes a GET request to /labelExplodePrimitive/{.param*}
GetLabelExplodePrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetLabelNoExplodeArray makes a GET request to /labelNoExplodeArray/{.param}
GetLabelNoExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetLabelNoExplodeObject makes a GET request to /labelNoExplodeObject/{.param}
GetLabelNoExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetLabelPrimitive makes a GET request to /labelPrimitive/{.param}
GetLabelPrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetMatrixExplodeArray makes a GET request to /matrixExplodeArray/{.id*}
GetMatrixExplodeArray(ctx context.Context, id []int32, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetMatrixExplodeObject makes a GET request to /matrixExplodeObject/{.id*}
GetMatrixExplodeObject(ctx context.Context, id Object, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetMatrixExplodePrimitive makes a GET request to /matrixExplodePrimitive/{;id*}
GetMatrixExplodePrimitive(ctx context.Context, id int32, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetMatrixNoExplodeArray makes a GET request to /matrixNoExplodeArray/{.id}
GetMatrixNoExplodeArray(ctx context.Context, id []int32, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetMatrixNoExplodeObject makes a GET request to /matrixNoExplodeObject/{.id}
GetMatrixNoExplodeObject(ctx context.Context, id Object, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetMatrixPrimitive makes a GET request to /matrixPrimitive/{;id}
GetMatrixPrimitive(ctx context.Context, id int32, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetPassThrough makes a GET request to /passThrough/{param}
GetPassThrough(ctx context.Context, param string, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetDeepObject makes a GET request to /queryDeepObject
GetDeepObject(ctx context.Context, params *GetDeepObjectParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetQueryForm makes a GET request to /queryForm
GetQueryForm(ctx context.Context, params *GetQueryFormParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetSimpleExplodeArray makes a GET request to /simpleExplodeArray/{param*}
GetSimpleExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetSimpleExplodeObject makes a GET request to /simpleExplodeObject/{param*}
GetSimpleExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetSimpleExplodePrimitive makes a GET request to /simpleExplodePrimitive/{param}
GetSimpleExplodePrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetSimpleNoExplodeArray makes a GET request to /simpleNoExplodeArray/{param}
GetSimpleNoExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetSimpleNoExplodeObject makes a GET request to /simpleNoExplodeObject/{param}
GetSimpleNoExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetSimplePrimitive makes a GET request to /simplePrimitive/{param}
GetSimplePrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error)
}
ClientInterface is the interface specification for the client.
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 ComplexObject ¶
type ComplexObject struct {
Object Object `form:"Object" json:"Object"`
ID int `form:"Id" json:"Id"`
IsAdmin bool `form:"IsAdmin" json:"IsAdmin"`
}
#/components/schemas/ComplexObject
func (*ComplexObject) ApplyDefaults ¶
func (s *ComplexObject) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type Date ¶
func (Date) MarshalJSON ¶
func (Date) MarshalText ¶
MarshalText implements encoding.TextMarshaler for Date.
func (*Date) UnmarshalJSON ¶
func (*Date) UnmarshalText ¶
type GetCookieParams ¶
type GetCookieParams struct {
// p (cookie)
P *int32
// ep (cookie)
Ep *int32
// ea (cookie)
Ea *[]int32
// a (cookie)
A *[]int32
// eo (cookie)
Eo *Object
// o (cookie)
O *Object
// co (cookie)
Co *string
}
GetCookieParams defines parameters for GetCookie.
type GetDeepObjectParams ¶
type GetDeepObjectParams struct {
// deepObj (required)
DeepObj ComplexObject `form:"deepObj" json:"deepObj"`
}
GetDeepObjectParams defines parameters for GetDeepObject.
type GetHeaderParams ¶
type GetHeaderParams struct {
// X-Primitive (header)
XPrimitive *int32
// X-Primitive-Exploded (header)
XPrimitiveExploded *int32
// X-Array-Exploded (header)
XArrayExploded *[]int32
// X-Array (header)
XArray *[]int32
// X-Object-Exploded (header)
XObjectExploded *Object
// X-Object (header)
XObject *Object
// X-Complex-Object (header)
XComplexObject *string
}
GetHeaderParams defines parameters for GetHeader.
type GetQueryFormParams ¶
type GetQueryFormParams struct {
// ea (optional)
Ea *[]int32 `form:"ea" json:"ea"`
// a (optional)
A *[]int32 `form:"a" json:"a"`
// eo (optional)
Eo *Object `form:"eo" json:"eo"`
// o (optional)
O *Object `form:"o" json:"o"`
// ep (optional)
Ep *int32 `form:"ep" json:"ep"`
// p (optional)
P *int32 `form:"p" json:"p"`
// ps (optional)
Ps *string `form:"ps" json:"ps"`
// co (optional)
Co *string `form:"co" json:"co"`
}
GetQueryFormParams defines parameters for GetQueryForm.
type HttpRequestDoer ¶
HttpRequestDoer performs HTTP requests. The standard http.Client implements this interface.
type Object ¶
type Object struct {
Role string `form:"role" json:"role"`
FirstName string `form:"firstName" json:"firstName"`
}
#/components/schemas/Object
func (*Object) ApplyDefaults ¶
func (s *Object) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type ParamLocation ¶
type ParamLocation int
ParamLocation indicates where a parameter is located in an HTTP request.
const ( ParamLocationUndefined ParamLocation = iota ParamLocationQuery ParamLocationPath ParamLocationHeader ParamLocationCookie )
type ParameterOptions ¶
type ParameterOptions struct {
Style string // OpenAPI style: "simple", "form", "label", "matrix", "deepObject", "pipeDelimited", "spaceDelimited"
ParamLocation ParamLocation // Where the parameter appears: query, path, header, cookie
Explode bool
Required bool
Type string // OpenAPI type: "string", "integer", "array", "object"
Format string // OpenAPI format: "int32", "date-time", etc.
AllowReserved bool // When true, reserved characters in query values are not percent-encoded
}
ParameterOptions carries OpenAPI parameter metadata to bind and style functions so they can handle style dispatch, explode, required, type-aware coercions, and location-aware escaping from a single uniform call site. All fields have sensible zero-value defaults.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function.