Documentation ¶
Overview ¶
Package omdb provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.
Package omdb provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.
Index ¶
- Constants
- func NewGetIdRequest(server string, params *GetIdParams) (*http.Request, error)
- func NewGetTitleRequest(server string, params *GetTitleParams) (*http.Request, error)
- func NewTitleSearchRequest(server string, params *TitleSearchParams) (*http.Request, error)
- func ParseBody(b []byte) (map[string]interface{}, error)
- type Client
- func (c *Client) GetId(ctx context.Context, params *GetIdParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetTitle(ctx context.Context, params *GetTitleParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) TitleSearch(ctx context.Context, params *TitleSearchParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) GetIdWithResponse(ctx context.Context, params *GetIdParams, reqEditors ...RequestEditorFn) (*GetIdResponse, error)
- func (c *ClientWithResponses) GetTitleWithResponse(ctx context.Context, params *GetTitleParams, reqEditors ...RequestEditorFn) (*GetTitleResponse, error)
- func (c *ClientWithResponses) TitleSearchWithResponse(ctx context.Context, params *TitleSearchParams, reqEditors ...RequestEditorFn) (*TitleSearchResponse, error)
- type ClientWithResponsesInterface
- type GetIdParams
- type GetIdParamsPlot
- type GetIdParamsR
- type GetIdResponse
- type GetTitleParams
- type GetTitleParamsPlot
- type GetTitleParamsR
- type GetTitleParamsType
- type GetTitleResponse
- type HttpRequestDoer
- type RequestEditorFn
- type Response
- type TitleSearchParams
- type TitleSearchParamsR
- type TitleSearchParamsType
- type TitleSearchResponse
Constants ¶
const (
APIKeyQueryParamScopes = "APIKeyQueryParam.Scopes"
)
const DefaultServerBaseURL = "https://www.omdbapi.com/"
DefaultServerBaseURL is the default OMDB API base URL.
Variables ¶
This section is empty.
Functions ¶
func NewGetIdRequest ¶
func NewGetIdRequest(server string, params *GetIdParams) (*http.Request, error)
NewGetIdRequest generates requests for GetId
func NewGetTitleRequest ¶
func NewGetTitleRequest(server string, params *GetTitleParams) (*http.Request, error)
NewGetTitleRequest generates requests for GetTitle
func NewTitleSearchRequest ¶
func NewTitleSearchRequest(server string, params *TitleSearchParams) (*http.Request, error)
NewTitleSearchRequest generates requests for TitleSearch
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 NewDefaultClient ¶
func NewDefaultClient(token string, opts ...ClientOption) (*Client, error)
NewDefaultClient creates a new Client with the DefaultServerBaseURL base URL and a WithToken ClientOption.
func (*Client) GetId ¶
func (c *Client) GetId(ctx context.Context, params *GetIdParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) GetTitle ¶
func (c *Client) GetTitle(ctx context.Context, params *GetTitleParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) TitleSearch ¶
func (c *Client) TitleSearch(ctx context.Context, params *TitleSearchParams, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientInterface ¶
type ClientInterface interface { // GetId request GetId(ctx context.Context, params *GetIdParams, reqEditors ...RequestEditorFn) (*http.Response, error) // TitleSearch request TitleSearch(ctx context.Context, params *TitleSearchParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetTitle request GetTitle(ctx context.Context, params *GetTitleParams, 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.
func WithToken ¶
func WithToken(token string) ClientOption
WithToken authenticates the client's requests with an `apikey` query parameter.
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) GetIdWithResponse ¶
func (c *ClientWithResponses) GetIdWithResponse(ctx context.Context, params *GetIdParams, reqEditors ...RequestEditorFn) (*GetIdResponse, error)
GetIdWithResponse request returning *GetIdResponse
func (*ClientWithResponses) GetTitleWithResponse ¶
func (c *ClientWithResponses) GetTitleWithResponse(ctx context.Context, params *GetTitleParams, reqEditors ...RequestEditorFn) (*GetTitleResponse, error)
GetTitleWithResponse request returning *GetTitleResponse
func (*ClientWithResponses) TitleSearchWithResponse ¶
func (c *ClientWithResponses) TitleSearchWithResponse(ctx context.Context, params *TitleSearchParams, reqEditors ...RequestEditorFn) (*TitleSearchResponse, error)
TitleSearchWithResponse request returning *TitleSearchResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // GetIdWithResponse request GetIdWithResponse(ctx context.Context, params *GetIdParams, reqEditors ...RequestEditorFn) (*GetIdResponse, error) // TitleSearchWithResponse request TitleSearchWithResponse(ctx context.Context, params *TitleSearchParams, reqEditors ...RequestEditorFn) (*TitleSearchResponse, error) // GetTitleWithResponse request GetTitleWithResponse(ctx context.Context, params *GetTitleParams, reqEditors ...RequestEditorFn) (*GetTitleResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type GetIdParams ¶
type GetIdParams struct { // I A valid IMDb ID (e.g. tt0000001) I string `form:"i" json:"i"` // Plot Return short or full plot Plot *GetIdParamsPlot `form:"plot,omitempty" json:"plot,omitempty"` // R The response type to return R *GetIdParamsR `form:"r,omitempty" json:"r,omitempty"` // Callback JSONP callback name Callback *string `form:"callback,omitempty" json:"callback,omitempty"` }
GetIdParams defines parameters for GetId.
type GetIdParamsPlot ¶
type GetIdParamsPlot string
GetIdParamsPlot defines parameters for GetId.
const ( GetIdParamsPlotFull GetIdParamsPlot = "full" GetIdParamsPlotShort GetIdParamsPlot = "short" )
Defines values for GetIdParamsPlot.
type GetIdParamsR ¶
type GetIdParamsR string
GetIdParamsR defines parameters for GetId.
const ( GetIdParamsRJson GetIdParamsR = "json" GetIdParamsRXml GetIdParamsR = "xml" )
Defines values for GetIdParamsR.
type GetIdResponse ¶
func ParseGetIdResponse ¶
func ParseGetIdResponse(rsp *http.Response) (*GetIdResponse, error)
ParseGetIdResponse parses an HTTP response from a GetIdWithResponse call
func (GetIdResponse) Status ¶
func (r GetIdResponse) Status() string
Status returns HTTPResponse.Status
func (GetIdResponse) StatusCode ¶
func (r GetIdResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetTitleParams ¶
type GetTitleParams struct { // T Title of movie or series T string `form:"t" json:"t"` // Y Year of release Y *int `form:"y,omitempty" json:"y,omitempty"` // Type Return movie or series Type *GetTitleParamsType `form:"type,omitempty" json:"type,omitempty"` // Plot Return short or full plot Plot *GetTitleParamsPlot `form:"plot,omitempty" json:"plot,omitempty"` // R The response type to return R *GetTitleParamsR `form:"r,omitempty" json:"r,omitempty"` // Callback JSONP callback name Callback *string `form:"callback,omitempty" json:"callback,omitempty"` }
GetTitleParams defines parameters for GetTitle.
type GetTitleParamsPlot ¶
type GetTitleParamsPlot string
GetTitleParamsPlot defines parameters for GetTitle.
const ( GetTitleParamsPlotFull GetTitleParamsPlot = "full" GetTitleParamsPlotShort GetTitleParamsPlot = "short" )
Defines values for GetTitleParamsPlot.
type GetTitleParamsR ¶
type GetTitleParamsR string
GetTitleParamsR defines parameters for GetTitle.
const ( Json GetTitleParamsR = "json" Xml GetTitleParamsR = "xml" )
Defines values for GetTitleParamsR.
type GetTitleParamsType ¶
type GetTitleParamsType string
GetTitleParamsType defines parameters for GetTitle.
const ( GetTitleParamsTypeMovie GetTitleParamsType = "movie" GetTitleParamsTypeSeries GetTitleParamsType = "series" )
Defines values for GetTitleParamsType.
type GetTitleResponse ¶
func ParseGetTitleResponse ¶
func ParseGetTitleResponse(rsp *http.Response) (*GetTitleResponse, error)
ParseGetTitleResponse parses an HTTP response from a GetTitleWithResponse call
func (GetTitleResponse) Status ¶
func (r GetTitleResponse) Status() string
Status returns HTTPResponse.Status
func (GetTitleResponse) StatusCode ¶
func (r GetTitleResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type Response ¶
type Response interface { // Status returns the status text. Status() string // StatusCode returns the status code. StatusCode() int }
Response is an abstraction of a typed http.Response wrapper.
type TitleSearchParams ¶
type TitleSearchParams struct { // S Title of movie or series S string `form:"s" json:"s"` // Y Year of release Y *int `form:"y,omitempty" json:"y,omitempty"` // Type Return movie or series Type *TitleSearchParamsType `form:"type,omitempty" json:"type,omitempty"` // R The response type to return R *TitleSearchParamsR `form:"r,omitempty" json:"r,omitempty"` // Page Page number to return Page *int `form:"page,omitempty" json:"page,omitempty"` // Callback JSONP callback name Callback *string `form:"callback,omitempty" json:"callback,omitempty"` }
TitleSearchParams defines parameters for TitleSearch.
type TitleSearchParamsR ¶
type TitleSearchParamsR string
TitleSearchParamsR defines parameters for TitleSearch.
const ( TitleSearchParamsRJson TitleSearchParamsR = "json" TitleSearchParamsRXml TitleSearchParamsR = "xml" )
Defines values for TitleSearchParamsR.
type TitleSearchParamsType ¶
type TitleSearchParamsType string
TitleSearchParamsType defines parameters for TitleSearch.
const ( TitleSearchParamsTypeMovie TitleSearchParamsType = "movie" TitleSearchParamsTypeSeries TitleSearchParamsType = "series" )
Defines values for TitleSearchParamsType.
type TitleSearchResponse ¶
func ParseTitleSearchResponse ¶
func ParseTitleSearchResponse(rsp *http.Response) (*TitleSearchResponse, error)
ParseTitleSearchResponse parses an HTTP response from a TitleSearchWithResponse call
func (TitleSearchResponse) Status ¶
func (r TitleSearchResponse) Status() string
Status returns HTTPResponse.Status
func (TitleSearchResponse) StatusCode ¶
func (r TitleSearchResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode