Documentation
¶
Overview ¶
Package client provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT.
Index ¶
- func NewGetErrorRequest(server string) (*http.Request, error)
- func NewGreetingRequest(server string, name string) (*http.Request, error)
- func NewPostReviewRequest(server string, body PostReviewJSONRequestBody) (*http.Request, error)
- func NewPostReviewRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- type Client
- func (c *Client) GetError(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) Greeting(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) PostReview(ctx context.Context, body PostReviewJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) PostReviewWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) GetErrorWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetErrorResponse, error)
- func (c *ClientWithResponses) GreetingWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*GreetingResponse, error)
- func (c *ClientWithResponses) PostReviewWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*PostReviewResponse, error)
- func (c *ClientWithResponses) PostReviewWithResponse(ctx context.Context, body PostReviewJSONRequestBody, ...) (*PostReviewResponse, error)
- type ClientWithResponsesInterface
- type ErrorDetail
- type ErrorModel
- type GetErrorResponse
- type GetGreetingOutputBody
- type GreetingResponse
- type HttpRequestDoer
- type PostReviewInputBody
- type PostReviewJSONRequestBody
- type PostReviewResponse
- type RequestEditorFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGetErrorRequest ¶
NewGetErrorRequest generates requests for GetError
func NewGreetingRequest ¶
NewGreetingRequest generates requests for Greeting
func NewPostReviewRequest ¶
func NewPostReviewRequest(server string, body PostReviewJSONRequestBody) (*http.Request, error)
NewPostReviewRequest calls the generic PostReview builder with application/json 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) PostReview ¶
func (c *Client) PostReview(ctx context.Context, body PostReviewJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientInterface ¶
type ClientInterface interface {
// GetError request
GetError(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// Greeting request
Greeting(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error)
// PostReviewWithBody request with any body
PostReviewWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostReview(ctx context.Context, body PostReviewJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
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 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) GetErrorWithResponse ¶
func (c *ClientWithResponses) GetErrorWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetErrorResponse, error)
GetErrorWithResponse request returning *GetErrorResponse
func (*ClientWithResponses) GreetingWithResponse ¶
func (c *ClientWithResponses) GreetingWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*GreetingResponse, error)
GreetingWithResponse request returning *GreetingResponse
func (*ClientWithResponses) PostReviewWithBodyWithResponse ¶
func (c *ClientWithResponses) PostReviewWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostReviewResponse, error)
PostReviewWithBodyWithResponse request with arbitrary body returning *PostReviewResponse
func (*ClientWithResponses) PostReviewWithResponse ¶
func (c *ClientWithResponses) PostReviewWithResponse(ctx context.Context, body PostReviewJSONRequestBody, reqEditors ...RequestEditorFn) (*PostReviewResponse, error)
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// GetErrorWithResponse request
GetErrorWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetErrorResponse, error)
// GreetingWithResponse request
GreetingWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*GreetingResponse, error)
// PostReviewWithBodyWithResponse request with any body
PostReviewWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostReviewResponse, error)
PostReviewWithResponse(ctx context.Context, body PostReviewJSONRequestBody, reqEditors ...RequestEditorFn) (*PostReviewResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type ErrorDetail ¶
type ErrorDetail struct {
// Location Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'
Location *string `json:"location,omitempty"`
// Message Error message text
Message *string `json:"message,omitempty"`
// Value The value at the given location
Value *interface{} `json:"value,omitempty"`
}
ErrorDetail defines model for ErrorDetail.
type ErrorModel ¶
type ErrorModel struct {
// Schema A URL to the JSON Schema for this object.
Schema *string `json:"$schema,omitempty"`
// Detail A human-readable explanation specific to this occurrence of the problem.
Detail *string `json:"detail,omitempty"`
// Errors Optional list of individual error details
Errors *[]ErrorDetail `json:"errors"`
// Instance A URI reference that identifies the specific occurrence of the problem.
Instance *string `json:"instance,omitempty"`
// Status HTTP status code
Status *int64 `json:"status,omitempty"`
// Title A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
Title *string `json:"title,omitempty"`
// Type A URI reference to human-readable documentation for the error.
Type *string `json:"type,omitempty"`
}
ErrorModel defines model for ErrorModel.
type GetErrorResponse ¶
type GetErrorResponse struct {
Body []byte
HTTPResponse *http.Response
ApplicationproblemJSONDefault *ErrorModel
}
func ParseGetErrorResponse ¶
func ParseGetErrorResponse(rsp *http.Response) (*GetErrorResponse, error)
ParseGetErrorResponse parses an HTTP response from a GetErrorWithResponse call
func (GetErrorResponse) Status ¶
func (r GetErrorResponse) Status() string
Status returns HTTPResponse.Status
func (GetErrorResponse) StatusCode ¶
func (r GetErrorResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetGreetingOutputBody ¶
type GetGreetingOutputBody struct {
// Schema A URL to the JSON Schema for this object.
Schema *string `json:"$schema,omitempty"`
// Message Greeting message
Message string `json:"message"`
}
GetGreetingOutputBody defines model for GetGreetingOutputBody.
type GreetingResponse ¶
type GreetingResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *GetGreetingOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
func ParseGreetingResponse ¶
func ParseGreetingResponse(rsp *http.Response) (*GreetingResponse, error)
ParseGreetingResponse parses an HTTP response from a GreetingWithResponse call
func (GreetingResponse) Status ¶
func (r GreetingResponse) Status() string
Status returns HTTPResponse.Status
func (GreetingResponse) StatusCode ¶
func (r GreetingResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type PostReviewInputBody ¶
type PostReviewInputBody struct {
// Schema A URL to the JSON Schema for this object.
Schema *string `json:"$schema,omitempty"`
// Author Author of the review
Author string `json:"author"`
// Message Review message
Message *string `json:"message,omitempty"`
// Rating Rating from 1 to 5
Rating int64 `json:"rating"`
}
PostReviewInputBody defines model for PostReviewInputBody.
type PostReviewJSONRequestBody ¶
type PostReviewJSONRequestBody = PostReviewInputBody
PostReviewJSONRequestBody defines body for PostReview for application/json ContentType.
type PostReviewResponse ¶
type PostReviewResponse struct {
Body []byte
HTTPResponse *http.Response
ApplicationproblemJSONDefault *ErrorModel
}
func ParsePostReviewResponse ¶
func ParsePostReviewResponse(rsp *http.Response) (*PostReviewResponse, error)
ParsePostReviewResponse parses an HTTP response from a PostReviewWithResponse call
func (PostReviewResponse) Status ¶
func (r PostReviewResponse) Status() string
Status returns HTTPResponse.Status
func (PostReviewResponse) StatusCode ¶
func (r PostReviewResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode