client

package
v0.0.0-...-c1d610b Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

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

Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDeleteSessionRequest

func NewDeleteSessionRequest(server string, sessionId string) (*http.Request, error)

NewDeleteSessionRequest generates requests for DeleteSession

func NewGetSessionRequest

func NewGetSessionRequest(server string, sessionId string) (*http.Request, error)

NewGetSessionRequest generates requests for GetSession

func NewSetSessionRequest

func NewSetSessionRequest(server string, body SetSessionJSONRequestBody) (*http.Request, error)

NewSetSessionRequest calls the generic SetSession builder with application/json body

func NewSetSessionRequestWithBody

func NewSetSessionRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewSetSessionRequestWithBody generates requests for SetSession with any type of 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) DeleteSession

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

func (*Client) GetSession

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

func (*Client) SetSession

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

func (*Client) SetSessionWithBody

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

type ClientInterface

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

	SetSession(ctx context.Context, body SetSessionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// DeleteSession request
	DeleteSession(ctx context.Context, sessionId string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetSession request
	GetSession(ctx context.Context, sessionId 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) DeleteSessionWithResponse

func (c *ClientWithResponses) DeleteSessionWithResponse(ctx context.Context, sessionId string, reqEditors ...RequestEditorFn) (*DeleteSessionResponse, error)

DeleteSessionWithResponse request returning *DeleteSessionResponse

func (*ClientWithResponses) GetSessionWithResponse

func (c *ClientWithResponses) GetSessionWithResponse(ctx context.Context, sessionId string, reqEditors ...RequestEditorFn) (*GetSessionResponse, error)

GetSessionWithResponse request returning *GetSessionResponse

func (*ClientWithResponses) SetSessionWithBodyWithResponse

func (c *ClientWithResponses) SetSessionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetSessionResponse, error)

SetSessionWithBodyWithResponse request with arbitrary body returning *SetSessionResponse

func (*ClientWithResponses) SetSessionWithResponse

func (c *ClientWithResponses) SetSessionWithResponse(ctx context.Context, body SetSessionJSONRequestBody, reqEditors ...RequestEditorFn) (*SetSessionResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// SetSession request with any body
	SetSessionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetSessionResponse, error)

	SetSessionWithResponse(ctx context.Context, body SetSessionJSONRequestBody, reqEditors ...RequestEditorFn) (*SetSessionResponse, error)

	// DeleteSession request
	DeleteSessionWithResponse(ctx context.Context, sessionId string, reqEditors ...RequestEditorFn) (*DeleteSessionResponse, error)

	// GetSession request
	GetSessionWithResponse(ctx context.Context, sessionId string, reqEditors ...RequestEditorFn) (*GetSessionResponse, error)
}

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

type DeleteSessionResponse

type DeleteSessionResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSONDefault  *Error
}

func ParseDeleteSessionResponse

func ParseDeleteSessionResponse(rsp *http.Response) (*DeleteSessionResponse, error)

ParseDeleteSessionResponse parses an HTTP response from a DeleteSessionWithResponse call

func (DeleteSessionResponse) Status

func (r DeleteSessionResponse) Status() string

Status returns HTTPResponse.Status

func (DeleteSessionResponse) StatusCode

func (r DeleteSessionResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Error

type Error struct {
	Message string `json:"message"`
}

Error defines model for Error.

type GetSession

type GetSession struct {
	Values *map[string]interface{} `json:"values,omitempty"`
}

GetSession defines model for GetSession.

type GetSessionResponse

type GetSessionResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *GetSession
	JSONDefault  *Error
}

func ParseGetSessionResponse

func ParseGetSessionResponse(rsp *http.Response) (*GetSessionResponse, error)

ParseGetSessionResponse parses an HTTP response from a GetSessionWithResponse call

func (GetSessionResponse) Status

func (r GetSessionResponse) Status() string

Status returns HTTPResponse.Status

func (GetSessionResponse) StatusCode

func (r GetSessionResponse) 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 PostSession

type PostSession struct {
	SessionKey   string                 `json:"sessionKey"`
	SessionValue map[string]interface{} `json:"sessionValue"`
}

PostSession defines model for PostSession.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type SetSessionJSONBody

type SetSessionJSONBody = PostSession

SetSessionJSONBody defines parameters for SetSession.

type SetSessionJSONRequestBody

type SetSessionJSONRequestBody = SetSessionJSONBody

SetSessionJSONRequestBody defines body for SetSession for application/json ContentType.

type SetSessionResponse

type SetSessionResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSONDefault  *Error
}

func ParseSetSessionResponse

func ParseSetSessionResponse(rsp *http.Response) (*SetSessionResponse, error)

ParseSetSessionResponse parses an HTTP response from a SetSessionWithResponse call

func (SetSessionResponse) Status

func (r SetSessionResponse) Status() string

Status returns HTTPResponse.Status

func (SetSessionResponse) StatusCode

func (r SetSessionResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

Jump to

Keyboard shortcuts

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