Documentation
¶
Overview ¶
Package petstore provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
Index ¶
- func NewAddPetRequest(server string, body AddPetJSONRequestBody) (*http.Request, error)
- func NewAddPetRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewDeletePetRequest(server string, id int64) (*http.Request, error)
- func NewFindPetByIdRequest(server string, id int64) (*http.Request, error)
- func NewFindPetsRequest(server string, params *FindPetsParams) (*http.Request, error)
- type AddPetJSONBody
- type AddPetJSONRequestBody
- type AddPetResponse
- type Client
- func (c *Client) AddPet(ctx context.Context, body AddPetJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) AddPetWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) DeletePet(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) FindPetById(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) FindPets(ctx context.Context, params *FindPetsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) AddPetWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*AddPetResponse, error)
- func (c *ClientWithResponses) AddPetWithResponse(ctx context.Context, body AddPetJSONRequestBody, reqEditors ...RequestEditorFn) (*AddPetResponse, error)
- func (c *ClientWithResponses) DeletePetWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*DeletePetResponse, error)
- func (c *ClientWithResponses) FindPetByIdWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*FindPetByIdResponse, error)
- func (c *ClientWithResponses) FindPetsWithResponse(ctx context.Context, params *FindPetsParams, reqEditors ...RequestEditorFn) (*FindPetsResponse, error)
- type ClientWithResponsesInterface
- type DeletePetResponse
- type Error
- type FindPetByIdResponse
- type FindPetsParams
- type FindPetsResponse
- type HttpRequestDoer
- type NewPet
- type Pet
- type RequestEditorFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAddPetRequest ¶
func NewAddPetRequest(server string, body AddPetJSONRequestBody) (*http.Request, error)
NewAddPetRequest calls the generic AddPet builder with application/json body
func NewAddPetRequestWithBody ¶
func NewAddPetRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewAddPetRequestWithBody generates requests for AddPet with any type of body
func NewDeletePetRequest ¶
NewDeletePetRequest generates requests for DeletePet
func NewFindPetByIdRequest ¶
NewFindPetByIdRequest generates requests for FindPetById
func NewFindPetsRequest ¶
func NewFindPetsRequest(server string, params *FindPetsParams) (*http.Request, error)
NewFindPetsRequest generates requests for FindPets
Types ¶
type AddPetJSONBody ¶ added in v1.3.4
type AddPetJSONBody NewPet
AddPetJSONBody defines parameters for AddPet.
type AddPetJSONRequestBody ¶
type AddPetJSONRequestBody AddPetJSONBody
AddPetJSONRequestBody defines body for AddPet for application/json ContentType.
type AddPetResponse ¶ added in v1.3.8
type AddPetResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *Pet
JSONDefault *Error
}
func ParseAddPetResponse ¶ added in v1.3.4
func ParseAddPetResponse(rsp *http.Response) (*AddPetResponse, error)
ParseAddPetResponse parses an HTTP response from a AddPetWithResponse call
func (AddPetResponse) Status ¶ added in v1.3.8
func (r AddPetResponse) Status() string
Status returns HTTPResponse.Status
func (AddPetResponse) StatusCode ¶ added in v1.3.8
func (r AddPetResponse) 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 ¶ added in v1.3.1
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) AddPet ¶
func (c *Client) AddPet(ctx context.Context, body AddPetJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) AddPetWithBody ¶
func (*Client) FindPetById ¶
func (*Client) FindPets ¶
func (c *Client) FindPets(ctx context.Context, params *FindPetsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientInterface ¶
type ClientInterface interface {
// FindPets request
FindPets(ctx context.Context, params *FindPetsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// AddPet request with any body
AddPetWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
AddPet(ctx context.Context, body AddPetJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// DeletePet request
DeletePet(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)
// FindPetById request
FindPetById(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
type ClientOption ¶ added in v1.3.1
ClientOption allows setting custom parameters during construction
func WithBaseURL ¶ added in v1.3.1
func WithBaseURL(baseURL string) ClientOption
WithBaseURL overrides the baseURL.
func WithHTTPClient ¶ added in v1.3.1
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 ¶ added in v1.3.1
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) AddPetWithBodyWithResponse ¶
func (c *ClientWithResponses) AddPetWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddPetResponse, error)
AddPetWithBodyWithResponse request with arbitrary body returning *AddPetResponse
func (*ClientWithResponses) AddPetWithResponse ¶
func (c *ClientWithResponses) AddPetWithResponse(ctx context.Context, body AddPetJSONRequestBody, reqEditors ...RequestEditorFn) (*AddPetResponse, error)
func (*ClientWithResponses) DeletePetWithResponse ¶
func (c *ClientWithResponses) DeletePetWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*DeletePetResponse, error)
DeletePetWithResponse request returning *DeletePetResponse
func (*ClientWithResponses) FindPetByIdWithResponse ¶
func (c *ClientWithResponses) FindPetByIdWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*FindPetByIdResponse, error)
FindPetByIdWithResponse request returning *FindPetByIdResponse
func (*ClientWithResponses) FindPetsWithResponse ¶
func (c *ClientWithResponses) FindPetsWithResponse(ctx context.Context, params *FindPetsParams, reqEditors ...RequestEditorFn) (*FindPetsResponse, error)
FindPetsWithResponse request returning *FindPetsResponse
type ClientWithResponsesInterface ¶ added in v1.3.8
type ClientWithResponsesInterface interface {
// FindPets request
FindPetsWithResponse(ctx context.Context, params *FindPetsParams, reqEditors ...RequestEditorFn) (*FindPetsResponse, error)
// AddPet request with any body
AddPetWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddPetResponse, error)
AddPetWithResponse(ctx context.Context, body AddPetJSONRequestBody, reqEditors ...RequestEditorFn) (*AddPetResponse, error)
// DeletePet request
DeletePetWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*DeletePetResponse, error)
// FindPetById request
FindPetByIdWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*FindPetByIdResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type DeletePetResponse ¶ added in v1.3.8
func ParseDeletePetResponse ¶ added in v1.3.4
func ParseDeletePetResponse(rsp *http.Response) (*DeletePetResponse, error)
ParseDeletePetResponse parses an HTTP response from a DeletePetWithResponse call
func (DeletePetResponse) Status ¶ added in v1.3.8
func (r DeletePetResponse) Status() string
Status returns HTTPResponse.Status
func (DeletePetResponse) StatusCode ¶ added in v1.3.8
func (r DeletePetResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type Error ¶
type Error struct {
// Error code
Code int32 `json:"code"`
// Error message
Message string `json:"message"`
}
Error defines model for Error.
type FindPetByIdResponse ¶ added in v1.3.8
type FindPetByIdResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *Pet
JSONDefault *Error
}
func ParseFindPetByIdResponse ¶ added in v1.3.4
func ParseFindPetByIdResponse(rsp *http.Response) (*FindPetByIdResponse, error)
ParseFindPetByIdResponse parses an HTTP response from a FindPetByIdWithResponse call
func (FindPetByIdResponse) Status ¶ added in v1.3.8
func (r FindPetByIdResponse) Status() string
Status returns HTTPResponse.Status
func (FindPetByIdResponse) StatusCode ¶ added in v1.3.8
func (r FindPetByIdResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type FindPetsParams ¶
type FindPetsParams struct {
// tags to filter by
Tags *[]string `json:"tags,omitempty"`
// maximum number of results to return
Limit *int32 `json:"limit,omitempty"`
}
FindPetsParams defines parameters for FindPets.
type FindPetsResponse ¶ added in v1.3.8
type FindPetsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *[]Pet
JSONDefault *Error
}
func ParseFindPetsResponse ¶ added in v1.3.4
func ParseFindPetsResponse(rsp *http.Response) (*FindPetsResponse, error)
ParseFindPetsResponse parses an HTTP response from a FindPetsWithResponse call
func (FindPetsResponse) Status ¶ added in v1.3.8
func (r FindPetsResponse) Status() string
Status returns HTTPResponse.Status
func (FindPetsResponse) StatusCode ¶ added in v1.3.8
func (r FindPetsResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶ added in v1.3.2
Doer performs HTTP requests.
The standard http.Client implements this interface.
type NewPet ¶
type NewPet struct {
// Name of the pet
Name string `json:"name"`
// Type of the pet
Tag *string `json:"tag,omitempty"`
}
NewPet defines model for NewPet.
Directories
¶
| Path | Synopsis |
|---|---|
|
api
Package api provides primitives to interact with the openapi HTTP API.
|
Package api provides primitives to interact with the openapi HTTP API. |
|
This is an example of implementing the Pet Store from the OpenAPI documentation found at: https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml The code under api/petstore/ has been generated from that specification.
|
This is an example of implementing the Pet Store from the OpenAPI documentation found at: https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml The code under api/petstore/ has been generated from that specification. |
|
api
Package api provides primitives to interact with the openapi HTTP API.
|
Package api provides primitives to interact with the openapi HTTP API. |