Documentation ¶
Overview ¶
Package ports 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 ports 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 ports 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 Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- func NewCreateNoteRequest(server string, body CreateNoteJSONRequestBody) (*http.Request, error)
- func NewCreateNoteRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewDeleteNoteRequest(server string, noteUUID openapi_types.UUID) (*http.Request, error)
- func NewGetNoteRequest(server string, noteUUID openapi_types.UUID) (*http.Request, error)
- func NewGetNotesRequest(server string) (*http.Request, error)
- func NewUpdateNoteRequest(server string, noteUUID openapi_types.UUID, body UpdateNoteJSONRequestBody) (*http.Request, error)
- func NewUpdateNoteRequestWithBody(server string, noteUUID openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error)
- type ChiServerOptions
- type Client
- func (c *Client) CreateNote(ctx context.Context, body CreateNoteJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) CreateNoteWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) DeleteNote(ctx context.Context, noteUUID openapi_types.UUID, ...) (*http.Response, error)
- func (c *Client) GetNote(ctx context.Context, noteUUID openapi_types.UUID, ...) (*http.Response, error)
- func (c *Client) GetNotes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) UpdateNote(ctx context.Context, noteUUID openapi_types.UUID, ...) (*http.Response, error)
- func (c *Client) UpdateNoteWithBody(ctx context.Context, noteUUID openapi_types.UUID, contentType string, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) CreateNoteWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*CreateNoteResponse, error)
- func (c *ClientWithResponses) CreateNoteWithResponse(ctx context.Context, body CreateNoteJSONRequestBody, ...) (*CreateNoteResponse, error)
- func (c *ClientWithResponses) DeleteNoteWithResponse(ctx context.Context, noteUUID openapi_types.UUID, ...) (*DeleteNoteResponse, error)
- func (c *ClientWithResponses) GetNoteWithResponse(ctx context.Context, noteUUID openapi_types.UUID, ...) (*GetNoteResponse, error)
- func (c *ClientWithResponses) GetNotesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetNotesResponse, error)
- func (c *ClientWithResponses) UpdateNoteWithBodyWithResponse(ctx context.Context, noteUUID openapi_types.UUID, contentType string, ...) (*UpdateNoteResponse, error)
- func (c *ClientWithResponses) UpdateNoteWithResponse(ctx context.Context, noteUUID openapi_types.UUID, ...) (*UpdateNoteResponse, error)
- type ClientWithResponsesInterface
- type CreateNoteJSONRequestBody
- type CreateNoteResponse
- type DeleteNoteResponse
- type Error
- type GetNoteResponse
- type GetNotesResponse
- type HttpRequestDoer
- type HttpServer
- func (h HttpServer) CreateNote(w http.ResponseWriter, r *http.Request)
- func (h HttpServer) DeleteNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID)
- func (h HttpServer) GetNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID)
- func (h HttpServer) GetNotes(w http.ResponseWriter, r *http.Request)
- func (h HttpServer) UpdateNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID)
- type InvalidParamFormatError
- type MiddlewareFunc
- type Note
- type Notes
- type PostNote
- type RequestEditorFn
- type RequiredHeaderError
- type RequiredParamError
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) CreateNote(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeleteNote(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetNote(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetNotes(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) UpdateNote(w http.ResponseWriter, r *http.Request)
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type Unimplemented
- func (_ Unimplemented) CreateNote(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) DeleteNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID)
- func (_ Unimplemented) GetNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID)
- func (_ Unimplemented) GetNotes(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) UpdateNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID)
- type UnmarshalingParamError
- type UpdateNoteJSONRequestBody
- type UpdateNoteResponse
Constants ¶
const (
BearerAuthScopes = "bearerAuth.Scopes"
)
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerFromMuxWithBaseURL ¶
func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
func NewCreateNoteRequest ¶
func NewCreateNoteRequest(server string, body CreateNoteJSONRequestBody) (*http.Request, error)
NewCreateNoteRequest calls the generic CreateNote builder with application/json body
func NewCreateNoteRequestWithBody ¶
func NewCreateNoteRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewCreateNoteRequestWithBody generates requests for CreateNote with any type of body
func NewDeleteNoteRequest ¶
NewDeleteNoteRequest generates requests for DeleteNote
func NewGetNoteRequest ¶
NewGetNoteRequest generates requests for GetNote
func NewGetNotesRequest ¶
NewGetNotesRequest generates requests for GetNotes
func NewUpdateNoteRequest ¶
func NewUpdateNoteRequest(server string, noteUUID openapi_types.UUID, body UpdateNoteJSONRequestBody) (*http.Request, error)
NewUpdateNoteRequest calls the generic UpdateNote builder with application/json body
Types ¶
type ChiServerOptions ¶
type ChiServerOptions struct { BaseURL string BaseRouter chi.Router Middlewares []MiddlewareFunc ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
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) CreateNote ¶
func (c *Client) CreateNote(ctx context.Context, body CreateNoteJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) CreateNoteWithBody ¶
func (*Client) DeleteNote ¶
func (c *Client) DeleteNote(ctx context.Context, noteUUID openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) GetNote ¶
func (c *Client) GetNote(ctx context.Context, noteUUID openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) UpdateNote ¶
func (c *Client) UpdateNote(ctx context.Context, noteUUID openapi_types.UUID, body UpdateNoteJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) UpdateNoteWithBody ¶
type ClientInterface ¶
type ClientInterface interface { // GetNotes request GetNotes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // CreateNoteWithBody request with any body CreateNoteWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) CreateNote(ctx context.Context, body CreateNoteJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // DeleteNote request DeleteNote(ctx context.Context, noteUUID openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) // GetNote request GetNote(ctx context.Context, noteUUID openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) // UpdateNoteWithBody request with any body UpdateNoteWithBody(ctx context.Context, noteUUID openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) UpdateNote(ctx context.Context, noteUUID openapi_types.UUID, body UpdateNoteJSONRequestBody, 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) CreateNoteWithBodyWithResponse ¶
func (c *ClientWithResponses) CreateNoteWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateNoteResponse, error)
CreateNoteWithBodyWithResponse request with arbitrary body returning *CreateNoteResponse
func (*ClientWithResponses) CreateNoteWithResponse ¶
func (c *ClientWithResponses) CreateNoteWithResponse(ctx context.Context, body CreateNoteJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateNoteResponse, error)
func (*ClientWithResponses) DeleteNoteWithResponse ¶
func (c *ClientWithResponses) DeleteNoteWithResponse(ctx context.Context, noteUUID openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteNoteResponse, error)
DeleteNoteWithResponse request returning *DeleteNoteResponse
func (*ClientWithResponses) GetNoteWithResponse ¶
func (c *ClientWithResponses) GetNoteWithResponse(ctx context.Context, noteUUID openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetNoteResponse, error)
GetNoteWithResponse request returning *GetNoteResponse
func (*ClientWithResponses) GetNotesWithResponse ¶
func (c *ClientWithResponses) GetNotesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetNotesResponse, error)
GetNotesWithResponse request returning *GetNotesResponse
func (*ClientWithResponses) UpdateNoteWithBodyWithResponse ¶
func (c *ClientWithResponses) UpdateNoteWithBodyWithResponse(ctx context.Context, noteUUID openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateNoteResponse, error)
UpdateNoteWithBodyWithResponse request with arbitrary body returning *UpdateNoteResponse
func (*ClientWithResponses) UpdateNoteWithResponse ¶
func (c *ClientWithResponses) UpdateNoteWithResponse(ctx context.Context, noteUUID openapi_types.UUID, body UpdateNoteJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateNoteResponse, error)
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // GetNotesWithResponse request GetNotesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetNotesResponse, error) // CreateNoteWithBodyWithResponse request with any body CreateNoteWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateNoteResponse, error) CreateNoteWithResponse(ctx context.Context, body CreateNoteJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateNoteResponse, error) // DeleteNoteWithResponse request DeleteNoteWithResponse(ctx context.Context, noteUUID openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteNoteResponse, error) // GetNoteWithResponse request GetNoteWithResponse(ctx context.Context, noteUUID openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetNoteResponse, error) // UpdateNoteWithBodyWithResponse request with any body UpdateNoteWithBodyWithResponse(ctx context.Context, noteUUID openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateNoteResponse, error) UpdateNoteWithResponse(ctx context.Context, noteUUID openapi_types.UUID, body UpdateNoteJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateNoteResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type CreateNoteJSONRequestBody ¶
type CreateNoteJSONRequestBody = PostNote
CreateNoteJSONRequestBody defines body for CreateNote for application/json ContentType.
type CreateNoteResponse ¶
func ParseCreateNoteResponse ¶
func ParseCreateNoteResponse(rsp *http.Response) (*CreateNoteResponse, error)
ParseCreateNoteResponse parses an HTTP response from a CreateNoteWithResponse call
func (CreateNoteResponse) Status ¶
func (r CreateNoteResponse) Status() string
Status returns HTTPResponse.Status
func (CreateNoteResponse) StatusCode ¶
func (r CreateNoteResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type DeleteNoteResponse ¶
func ParseDeleteNoteResponse ¶
func ParseDeleteNoteResponse(rsp *http.Response) (*DeleteNoteResponse, error)
ParseDeleteNoteResponse parses an HTTP response from a DeleteNoteWithResponse call
func (DeleteNoteResponse) Status ¶
func (r DeleteNoteResponse) Status() string
Status returns HTTPResponse.Status
func (DeleteNoteResponse) StatusCode ¶
func (r DeleteNoteResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetNoteResponse ¶
type GetNoteResponse struct { Body []byte HTTPResponse *http.Response JSON200 *Note JSONDefault *Error }
func ParseGetNoteResponse ¶
func ParseGetNoteResponse(rsp *http.Response) (*GetNoteResponse, error)
ParseGetNoteResponse parses an HTTP response from a GetNoteWithResponse call
func (GetNoteResponse) Status ¶
func (r GetNoteResponse) Status() string
Status returns HTTPResponse.Status
func (GetNoteResponse) StatusCode ¶
func (r GetNoteResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetNotesResponse ¶
type GetNotesResponse struct { Body []byte HTTPResponse *http.Response JSON200 *Notes JSONDefault *Error }
func ParseGetNotesResponse ¶
func ParseGetNotesResponse(rsp *http.Response) (*GetNotesResponse, error)
ParseGetNotesResponse parses an HTTP response from a GetNotesWithResponse call
func (GetNotesResponse) Status ¶
func (r GetNotesResponse) Status() string
Status returns HTTPResponse.Status
func (GetNotesResponse) StatusCode ¶
func (r GetNotesResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type HttpServer ¶
type HttpServer struct {
// contains filtered or unexported fields
}
func NewHttpServer ¶
func NewHttpServer(noteRepository domain.NoteRepository) HttpServer
func (HttpServer) CreateNote ¶
func (h HttpServer) CreateNote(w http.ResponseWriter, r *http.Request)
func (HttpServer) DeleteNote ¶
func (h HttpServer) DeleteNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID)
func (HttpServer) GetNote ¶
func (h HttpServer) GetNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID)
func (HttpServer) GetNotes ¶
func (h HttpServer) GetNotes(w http.ResponseWriter, r *http.Request)
func (HttpServer) UpdateNote ¶
func (h HttpServer) UpdateNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID)
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type Note ¶
type Note struct { Description string `json:"description"` Time time.Time `json:"time"` Title string `json:"title"` Uuid openapi_types.UUID `json:"uuid"` }
Note defines model for Note.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type RequiredHeaderError ¶
func (*RequiredHeaderError) Error ¶
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶
type RequiredParamError struct {
ParamName string
}
func (*RequiredParamError) Error ¶
func (e *RequiredParamError) Error() string
type ServerInterface ¶
type ServerInterface interface { // (GET /notes) GetNotes(w http.ResponseWriter, r *http.Request) // (POST /notes) CreateNote(w http.ResponseWriter, r *http.Request) // (DELETE /notes/{noteUUID}) DeleteNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID) // (GET /notes/{noteUUID}) GetNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID) // (PUT /notes/{noteUUID}) UpdateNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID) }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct { Handler ServerInterface HandlerMiddlewares []MiddlewareFunc ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) CreateNote ¶
func (siw *ServerInterfaceWrapper) CreateNote(w http.ResponseWriter, r *http.Request)
CreateNote operation middleware
func (*ServerInterfaceWrapper) DeleteNote ¶
func (siw *ServerInterfaceWrapper) DeleteNote(w http.ResponseWriter, r *http.Request)
DeleteNote operation middleware
func (*ServerInterfaceWrapper) GetNote ¶
func (siw *ServerInterfaceWrapper) GetNote(w http.ResponseWriter, r *http.Request)
GetNote operation middleware
func (*ServerInterfaceWrapper) GetNotes ¶
func (siw *ServerInterfaceWrapper) GetNotes(w http.ResponseWriter, r *http.Request)
GetNotes operation middleware
func (*ServerInterfaceWrapper) UpdateNote ¶
func (siw *ServerInterfaceWrapper) UpdateNote(w http.ResponseWriter, r *http.Request)
UpdateNote operation middleware
type TooManyValuesForParamError ¶
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶
func (*UnescapedCookieParamError) Error ¶
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶
func (e *UnescapedCookieParamError) Unwrap() error
type Unimplemented ¶
type Unimplemented struct{}
func (Unimplemented) CreateNote ¶
func (_ Unimplemented) CreateNote(w http.ResponseWriter, r *http.Request)
(POST /notes)
func (Unimplemented) DeleteNote ¶
func (_ Unimplemented) DeleteNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID)
(DELETE /notes/{noteUUID})
func (Unimplemented) GetNote ¶
func (_ Unimplemented) GetNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID)
(GET /notes/{noteUUID})
func (Unimplemented) GetNotes ¶
func (_ Unimplemented) GetNotes(w http.ResponseWriter, r *http.Request)
(GET /notes)
func (Unimplemented) UpdateNote ¶
func (_ Unimplemented) UpdateNote(w http.ResponseWriter, r *http.Request, noteUUID openapi_types.UUID)
(PUT /notes/{noteUUID})
type UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error
type UpdateNoteJSONRequestBody ¶
type UpdateNoteJSONRequestBody = PostNote
UpdateNoteJSONRequestBody defines body for UpdateNote for application/json ContentType.
type UpdateNoteResponse ¶
func ParseUpdateNoteResponse ¶
func ParseUpdateNoteResponse(rsp *http.Response) (*UpdateNoteResponse, error)
ParseUpdateNoteResponse parses an HTTP response from a UpdateNoteWithResponse call
func (UpdateNoteResponse) Status ¶
func (r UpdateNoteResponse) Status() string
Status returns HTTPResponse.Status
func (UpdateNoteResponse) StatusCode ¶
func (r UpdateNoteResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode