Documentation ¶
Overview ¶
Package api 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 ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- 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 NewPublishNotificationRequest(server string, body PublishNotificationJSONRequestBody) (*http.Request, error)
- func NewPublishNotificationRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewSubscribeNotificationRequest(server string) (*http.Request, error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type BadRequestErrorResponse
- type ChiServerOptions
- type Client
- func (c *Client) PublishNotification(ctx context.Context, body PublishNotificationJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) PublishNotificationWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) SubscribeNotification(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) PublishNotificationWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*PublishNotificationResponse, error)
- func (c *ClientWithResponses) PublishNotificationWithResponse(ctx context.Context, body PublishNotificationJSONRequestBody, ...) (*PublishNotificationResponse, error)
- func (c *ClientWithResponses) SubscribeNotificationWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*SubscribeNotificationResponse, error)
- type ClientWithResponsesInterface
- type CloudEvent
- type Error
- type HttpRequestDoer
- type InvalidParamFormatError
- type MiddlewareFunc
- type NotificationPublishRequest
- type PublishNotificationJSONBody
- type PublishNotificationJSONRequestBody
- type PublishNotificationResponse
- type RequestEditorFn
- type RequiredHeaderError
- type RequiredParamError
- type ServerInterface
- type ServerInterfaceWrapper
- type SubscribeNotificationResponse
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type Unimplemented
- type UnmarshalingParamError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
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 NewPublishNotificationRequest ¶
func NewPublishNotificationRequest(server string, body PublishNotificationJSONRequestBody) (*http.Request, error)
NewPublishNotificationRequest calls the generic PublishNotification builder with application/json body
func NewPublishNotificationRequestWithBody ¶
func NewPublishNotificationRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewPublishNotificationRequestWithBody generates requests for PublishNotification with any type of body
func NewSubscribeNotificationRequest ¶
NewSubscribeNotificationRequest generates requests for SubscribeNotification
Types ¶
type BadRequestErrorResponse ¶
type BadRequestErrorResponse struct {
Errors []Error `json:"errors"`
}
BadRequestErrorResponse defines model for BadRequestErrorResponse.
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) PublishNotification ¶
func (c *Client) PublishNotification(ctx context.Context, body PublishNotificationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) PublishNotificationWithBody ¶
func (*Client) SubscribeNotification ¶
type ClientInterface ¶
type ClientInterface interface { // PublishNotificationWithBody request with any body PublishNotificationWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) PublishNotification(ctx context.Context, body PublishNotificationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // SubscribeNotification request SubscribeNotification(ctx context.Context, 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) PublishNotificationWithBodyWithResponse ¶
func (c *ClientWithResponses) PublishNotificationWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PublishNotificationResponse, error)
PublishNotificationWithBodyWithResponse request with arbitrary body returning *PublishNotificationResponse
func (*ClientWithResponses) PublishNotificationWithResponse ¶
func (c *ClientWithResponses) PublishNotificationWithResponse(ctx context.Context, body PublishNotificationJSONRequestBody, reqEditors ...RequestEditorFn) (*PublishNotificationResponse, error)
func (*ClientWithResponses) SubscribeNotificationWithResponse ¶
func (c *ClientWithResponses) SubscribeNotificationWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*SubscribeNotificationResponse, error)
SubscribeNotificationWithResponse request returning *SubscribeNotificationResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // PublishNotificationWithBodyWithResponse request with any body PublishNotificationWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PublishNotificationResponse, error) PublishNotificationWithResponse(ctx context.Context, body PublishNotificationJSONRequestBody, reqEditors ...RequestEditorFn) (*PublishNotificationResponse, error) // SubscribeNotificationWithResponse request SubscribeNotificationWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*SubscribeNotificationResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type CloudEvent ¶
type CloudEvent struct { // Data CloudEvent 'data' content. The event payload. The payload depends on the type // and the 'schemaurl'. It is encoded into a media format which is specified by the // 'contenttype' attribute (e.g. application/json). Data *map[string]interface{} `json:"data"` // Datacontenttype Type: String per RFC 2046 // Description: Content type of data value.This attribute enables data to carry any type of content, whereby format and encoding might differ from that of the chosen event format.For example, an event rendered using the JSON envelope format might carry an XML payload in data, and the consumer is informed by this attribute being set to "application/xml". The rules for how data content is rendered for different datacontenttype values are defined in the event format specifications; for example, the JSON event format defines the relationship in section 3.1. // // For some binary mode protocol bindings, this field is directly mapped to the respective protocol's content-type metadata property. Normative rules for the binary mode and the content-type metadata mapping can be found in the respective protocol // // In some event formats the datacontenttype attribute MAY be omitted.For example, if a JSON format event has no datacontenttype attribute, then it is implied that the data is a JSON value conforming to the "application/json" media type. In other words: a JSON-format event with no datacontenttype is exactly equivalent to one with datacontenttype = "application/json". // // // When translating an event message with no datacontenttype attribute to a different format or protocol binding, the target datacontenttype SHOULD be set explicitly to the implied datacontenttype of the source. // // // Constraints: // // OPTIONAL // If present, MUST adhere to the format specified in RFC 2046 // // For Media Type examples see IANA Media Types Datacontenttype *string `json:"datacontenttype"` // Dataschema Type: URI // Description: Identifies the schema that data adheres to.Incompatible changes to the schema SHOULD be reflected by a different URI.See Versioning of Attributes in the Primer for more information. // Constraints: // OPTIONAL // If present, MUST be a non-empty URI Dataschema *string `json:"dataschema"` // Id Identifies the event. Producers MUST ensure that source + id is unique for each distinct event. If a duplicate event is re-sent (e.g. due to a network error) it MAY have the same id. Consumers MAY assume that Events with identical source and id are duplicates. // Examples: // An event counter maintained by the producer // A UUID // Constraints: // REQUIRED // MUST be a non-empty string // MUST be unique within the scope of the producer Id string `json:"id"` // Source Identifies the context in which an event happened. Often this will include information such as the type of the event source, the organization publishing the event or the process that produced the event. The exact syntax and semantics behind the data encoded in the URI is defined by the event producer. // // Producers MUST ensure that source + id is unique for each distinct event. // // An application MAY assign a unique source to each distinct producer, which makes it easy to produce unique IDs since no other producer will have the same source. The application MAY use UUIDs, URNs, DNS authorities or an application-specific scheme to create unique source identifiers. // // A source MAY include more than one producer. In that case the producers MUST collaborate to ensure that source + id is unique for each distinct event. // // Constraints: // // REQUIRED // MUST be a non-empty URI-reference // An absolute URI is RECOMMENDED // // Examples // // Internet-wide unique URI with a DNS authority. // https://github.com/cloudevents // mailto:cncf-wg-serverless @lists.cncf.io // Universally-unique URN with a UUID: // urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66 // Application-specific identifiers // /cloudevents/spec/pull/123 // /sensors/tn-1234567/alerts // 1-555-123-4567 Source string `json:"source"` // Specversion CloudEvents 'specversion' attribute. The version of the CloudEvents // specification which the event uses. This enables the interpretation of the context. Specversion string `json:"specversion"` // Subject CloudEvents 'subject' attribute. This describes the subject of the event in the context // of the event producer (identified by source). In publish-subscribe scenarios, a subscriber // will typically subscribe to events emitted by a source, but the source identifier alone // might not be sufficient as a qualifier for any specific event if the source context has // internal sub-structure. Subject *string `json:"subject"` // Time CloudEvents 'time' attribute. Timestamp of when the event happened. Time *time.Time `json:"time"` // Type CloudEvents 'type' attribute. Type of occurrence which has happened. // Often this attribute is used for routing, observability, policy enforcement, etc. Type string `json:"type"` }
CloudEvent CloudEvent schema according to https://github.com/cloudevents/spec
type Error ¶
type Error struct {
Message *string `json:"message,omitempty"`
}
Error The error that occured while processing this request.
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type NotificationPublishRequest ¶
type NotificationPublishRequest struct { // Data CloudEvent schema according to https://github.com/cloudevents/spec Data CloudEvent `json:"data"` }
NotificationPublishRequest defines model for NotificationPublishRequest.
type PublishNotificationJSONBody ¶
type PublishNotificationJSONBody struct { // Data CloudEvent schema according to https://github.com/cloudevents/spec Data CloudEvent `json:"data"` }
PublishNotificationJSONBody defines parameters for PublishNotification.
type PublishNotificationJSONRequestBody ¶
type PublishNotificationJSONRequestBody PublishNotificationJSONBody
PublishNotificationJSONRequestBody defines body for PublishNotification for application/json ContentType.
type PublishNotificationResponse ¶
type PublishNotificationResponse struct { Body []byte HTTPResponse *http.Response JSON400 *BadRequestErrorResponse }
func ParsePublishNotificationResponse ¶
func ParsePublishNotificationResponse(rsp *http.Response) (*PublishNotificationResponse, error)
ParsePublishNotificationResponse parses an HTTP response from a PublishNotificationWithResponse call
func (PublishNotificationResponse) Status ¶
func (r PublishNotificationResponse) Status() string
Status returns HTTPResponse.Status
func (PublishNotificationResponse) StatusCode ¶
func (r PublishNotificationResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
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 { // Publish a notification // (POST /publish) PublishNotification(w http.ResponseWriter, r *http.Request) // Subscribe to notifications // (GET /subscribe) SubscribeNotification(w http.ResponseWriter, r *http.Request) }
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) PublishNotification ¶
func (siw *ServerInterfaceWrapper) PublishNotification(w http.ResponseWriter, r *http.Request)
PublishNotification operation middleware
func (*ServerInterfaceWrapper) SubscribeNotification ¶
func (siw *ServerInterfaceWrapper) SubscribeNotification(w http.ResponseWriter, r *http.Request)
SubscribeNotification operation middleware
type SubscribeNotificationResponse ¶
func ParseSubscribeNotificationResponse ¶
func ParseSubscribeNotificationResponse(rsp *http.Response) (*SubscribeNotificationResponse, error)
ParseSubscribeNotificationResponse parses an HTTP response from a SubscribeNotificationWithResponse call
func (SubscribeNotificationResponse) Status ¶
func (r SubscribeNotificationResponse) Status() string
Status returns HTTPResponse.Status
func (SubscribeNotificationResponse) StatusCode ¶
func (r SubscribeNotificationResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
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) PublishNotification ¶
func (_ Unimplemented) PublishNotification(w http.ResponseWriter, r *http.Request)
Publish a notification (POST /publish)
func (Unimplemented) SubscribeNotification ¶
func (_ Unimplemented) SubscribeNotification(w http.ResponseWriter, r *http.Request)
Subscribe to notifications (GET /subscribe)
type UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error