|
@@ -0,0 +1,2254 @@
|
|
|
+// Package message_bus provides primitives to interact with the openapi HTTP API.
|
|
|
+//
|
|
|
+// Code generated by github.com/deepmap/oapi-codegen version v1.12.4 DO NOT EDIT.
|
|
|
+package message_bus
|
|
|
+
|
|
|
+import (
|
|
|
+ "bytes"
|
|
|
+ "context"
|
|
|
+ "encoding/json"
|
|
|
+ "fmt"
|
|
|
+ "io"
|
|
|
+ "net/http"
|
|
|
+ "net/url"
|
|
|
+ "strings"
|
|
|
+ "time"
|
|
|
+
|
|
|
+ "github.com/deepmap/oapi-codegen/pkg/runtime"
|
|
|
+)
|
|
|
+
|
|
|
+const (
|
|
|
+ Access_tokenScopes = "access_token.Scopes"
|
|
|
+)
|
|
|
+
|
|
|
+// Action defines model for Action.
|
|
|
+type Action struct {
|
|
|
+ // Name action name
|
|
|
+ Name string `json:"name"`
|
|
|
+
|
|
|
+ // Properties event properties
|
|
|
+ Properties map[string]string `json:"properties"`
|
|
|
+
|
|
|
+ // SourceID associated source id
|
|
|
+ SourceID string `json:"sourceID"`
|
|
|
+
|
|
|
+ // Timestamp timestamp this action took place
|
|
|
+ Timestamp *time.Time `json:"timestamp,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+// ActionType defines model for ActionType.
|
|
|
+type ActionType struct {
|
|
|
+ // Name action name
|
|
|
+ //
|
|
|
+ // (there is no naming convention for action names, but it is recommended to name each as structural and descriptive as possible)
|
|
|
+ Name string `json:"name"`
|
|
|
+ PropertyTypeList []PropertyType `json:"propertyTypeList"`
|
|
|
+
|
|
|
+ // SourceID action source id to identify where the action will take
|
|
|
+ SourceID string `json:"sourceID"`
|
|
|
+}
|
|
|
+
|
|
|
+// BaseResponse defines model for BaseResponse.
|
|
|
+type BaseResponse struct {
|
|
|
+ // Message message returned by server side if there is any
|
|
|
+ Message *string `json:"message,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+// Event defines model for Event.
|
|
|
+type Event struct {
|
|
|
+ // Name event name
|
|
|
+ Name string `json:"name"`
|
|
|
+
|
|
|
+ // Properties event properties
|
|
|
+ Properties map[string]string `json:"properties"`
|
|
|
+
|
|
|
+ // SourceID associated source id
|
|
|
+ SourceID string `json:"sourceID"`
|
|
|
+
|
|
|
+ // Timestamp timestamp this event took place
|
|
|
+ Timestamp *time.Time `json:"timestamp,omitempty"`
|
|
|
+
|
|
|
+ // Uuid event uuid
|
|
|
+ Uuid *string `json:"uuid,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+// EventType defines model for EventType.
|
|
|
+type EventType struct {
|
|
|
+ // Name event name
|
|
|
+ //
|
|
|
+ // (there is no naming convention for event names, but it is recommended to name each as structural and descriptive as possible)
|
|
|
+ Name string `json:"name"`
|
|
|
+ PropertyTypeList []PropertyType `json:"propertyTypeList"`
|
|
|
+
|
|
|
+ // SourceID event source id to identify where the event comes from
|
|
|
+ SourceID string `json:"sourceID"`
|
|
|
+}
|
|
|
+
|
|
|
+// PropertyType defines model for PropertyType.
|
|
|
+type PropertyType struct {
|
|
|
+ Description *string `json:"description,omitempty"`
|
|
|
+ Example *string `json:"example,omitempty"`
|
|
|
+
|
|
|
+ // Name property name
|
|
|
+ //
|
|
|
+ // > It is recommended for a property name to be as descriptive as possible. One option is to prefix with a namespace.
|
|
|
+ // > - If the property is source specific, prefix with source ID. For example, `local-storage:vendor`
|
|
|
+ // > - Otherwise, prefix with `common:`. For example, `common:email`
|
|
|
+ // >
|
|
|
+ // > Some bad examples are `id`, `avail`, `blk`...which can be ambiguous and confusing.
|
|
|
+ Name string `json:"name"`
|
|
|
+}
|
|
|
+
|
|
|
+// ActionName defines model for ActionName.
|
|
|
+type ActionName = string
|
|
|
+
|
|
|
+// ActionNames defines model for ActionNames.
|
|
|
+type ActionNames = []string
|
|
|
+
|
|
|
+// EventName defines model for EventName.
|
|
|
+type EventName = string
|
|
|
+
|
|
|
+// EventNames defines model for EventNames.
|
|
|
+type EventNames = []string
|
|
|
+
|
|
|
+// SourceID defines model for SourceID.
|
|
|
+type SourceID = string
|
|
|
+
|
|
|
+// GetActionTypeOK defines model for GetActionTypeOK.
|
|
|
+type GetActionTypeOK = ActionType
|
|
|
+
|
|
|
+// GetActionTypesOK defines model for GetActionTypesOK.
|
|
|
+type GetActionTypesOK = []ActionType
|
|
|
+
|
|
|
+// GetEventTypeOK defines model for GetEventTypeOK.
|
|
|
+type GetEventTypeOK = EventType
|
|
|
+
|
|
|
+// GetEventTypesOK defines model for GetEventTypesOK.
|
|
|
+type GetEventTypesOK = []EventType
|
|
|
+
|
|
|
+// PublishEventOK defines model for PublishEventOK.
|
|
|
+type PublishEventOK = Event
|
|
|
+
|
|
|
+// ResponseBadRequest defines model for ResponseBadRequest.
|
|
|
+type ResponseBadRequest = BaseResponse
|
|
|
+
|
|
|
+// ResponseConflict defines model for ResponseConflict.
|
|
|
+type ResponseConflict = BaseResponse
|
|
|
+
|
|
|
+// ResponseInternalServerError defines model for ResponseInternalServerError.
|
|
|
+type ResponseInternalServerError = BaseResponse
|
|
|
+
|
|
|
+// ResponseNotFound defines model for ResponseNotFound.
|
|
|
+type ResponseNotFound = BaseResponse
|
|
|
+
|
|
|
+// ResponseOK defines model for ResponseOK.
|
|
|
+type ResponseOK = BaseResponse
|
|
|
+
|
|
|
+// TriggerActionOK defines model for TriggerActionOK.
|
|
|
+type TriggerActionOK = Action
|
|
|
+
|
|
|
+// PublishEvent event properties
|
|
|
+type PublishEvent map[string]string
|
|
|
+
|
|
|
+// RegisterActionTypes defines model for RegisterActionTypes.
|
|
|
+type RegisterActionTypes = []ActionType
|
|
|
+
|
|
|
+// RegisterEventTypes defines model for RegisterEventTypes.
|
|
|
+type RegisterEventTypes = []EventType
|
|
|
+
|
|
|
+// TriggerAction action properties
|
|
|
+type TriggerAction map[string]string
|
|
|
+
|
|
|
+// SubscribeActionWSParams defines parameters for SubscribeActionWS.
|
|
|
+type SubscribeActionWSParams struct {
|
|
|
+ Names *ActionNames `form:"names,omitempty" json:"names,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+// TriggerActionJSONBody defines parameters for TriggerAction.
|
|
|
+type TriggerActionJSONBody map[string]string
|
|
|
+
|
|
|
+// RegisterActionTypesJSONBody defines parameters for RegisterActionTypes.
|
|
|
+type RegisterActionTypesJSONBody = []ActionType
|
|
|
+
|
|
|
+// SubscribeEventWSParams defines parameters for SubscribeEventWS.
|
|
|
+type SubscribeEventWSParams struct {
|
|
|
+ Names *EventNames `form:"names,omitempty" json:"names,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+// PublishEventJSONBody defines parameters for PublishEvent.
|
|
|
+type PublishEventJSONBody map[string]string
|
|
|
+
|
|
|
+// RegisterEventTypesJSONBody defines parameters for RegisterEventTypes.
|
|
|
+type RegisterEventTypesJSONBody = []EventType
|
|
|
+
|
|
|
+// TriggerActionJSONRequestBody defines body for TriggerAction for application/json ContentType.
|
|
|
+type TriggerActionJSONRequestBody TriggerActionJSONBody
|
|
|
+
|
|
|
+// RegisterActionTypesJSONRequestBody defines body for RegisterActionTypes for application/json ContentType.
|
|
|
+type RegisterActionTypesJSONRequestBody = RegisterActionTypesJSONBody
|
|
|
+
|
|
|
+// PublishEventJSONRequestBody defines body for PublishEvent for application/json ContentType.
|
|
|
+type PublishEventJSONRequestBody PublishEventJSONBody
|
|
|
+
|
|
|
+// RegisterEventTypesJSONRequestBody defines body for RegisterEventTypes for application/json ContentType.
|
|
|
+type RegisterEventTypesJSONRequestBody = RegisterEventTypesJSONBody
|
|
|
+
|
|
|
+// RequestEditorFn is the function signature for the RequestEditor callback function
|
|
|
+type RequestEditorFn func(ctx context.Context, req *http.Request) error
|
|
|
+
|
|
|
+// Doer performs HTTP requests.
|
|
|
+//
|
|
|
+// The standard http.Client implements this interface.
|
|
|
+type HttpRequestDoer interface {
|
|
|
+ Do(req *http.Request) (*http.Response, error)
|
|
|
+}
|
|
|
+
|
|
|
+// Client which conforms to the OpenAPI3 specification for this service.
|
|
|
+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
|
|
|
+}
|
|
|
+
|
|
|
+// ClientOption allows setting custom parameters during construction
|
|
|
+type ClientOption func(*Client) error
|
|
|
+
|
|
|
+// Creates a new Client, with reasonable defaults
|
|
|
+func NewClient(server string, opts ...ClientOption) (*Client, error) {
|
|
|
+ // create a client with sane default values
|
|
|
+ client := Client{
|
|
|
+ Server: server,
|
|
|
+ }
|
|
|
+ // mutate client and add all optional params
|
|
|
+ for _, o := range opts {
|
|
|
+ if err := o(&client); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // ensure the server URL always has a trailing slash
|
|
|
+ if !strings.HasSuffix(client.Server, "/") {
|
|
|
+ client.Server += "/"
|
|
|
+ }
|
|
|
+ // create httpClient, if not already present
|
|
|
+ if client.Client == nil {
|
|
|
+ client.Client = &http.Client{}
|
|
|
+ }
|
|
|
+ return &client, nil
|
|
|
+}
|
|
|
+
|
|
|
+// WithHTTPClient allows overriding the default Doer, which is
|
|
|
+// automatically created using http.Client. This is useful for tests.
|
|
|
+func WithHTTPClient(doer HttpRequestDoer) ClientOption {
|
|
|
+ return func(c *Client) error {
|
|
|
+ c.Client = doer
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 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 WithRequestEditorFn(fn RequestEditorFn) ClientOption {
|
|
|
+ return func(c *Client) error {
|
|
|
+ c.RequestEditors = append(c.RequestEditors, fn)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// The interface specification for the client above.
|
|
|
+type ClientInterface interface {
|
|
|
+ // SubscribeActionWS request
|
|
|
+ SubscribeActionWS(ctx context.Context, sourceId SourceID, params *SubscribeActionWSParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // TriggerAction request with any body
|
|
|
+ TriggerActionWithBody(ctx context.Context, sourceId SourceID, name ActionName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ TriggerAction(ctx context.Context, sourceId SourceID, name ActionName, body TriggerActionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // GetActionTypes request
|
|
|
+ GetActionTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // RegisterActionTypes request with any body
|
|
|
+ RegisterActionTypesWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ RegisterActionTypes(ctx context.Context, body RegisterActionTypesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // GetActionTypesBySourceID request
|
|
|
+ GetActionTypesBySourceID(ctx context.Context, sourceId SourceID, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // GetActionType request
|
|
|
+ GetActionType(ctx context.Context, sourceId SourceID, name ActionName, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // SubscribeEventWS request
|
|
|
+ SubscribeEventWS(ctx context.Context, sourceId SourceID, params *SubscribeEventWSParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // PublishEvent request with any body
|
|
|
+ PublishEventWithBody(ctx context.Context, sourceId SourceID, name EventName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ PublishEvent(ctx context.Context, sourceId SourceID, name EventName, body PublishEventJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // GetEventTypes request
|
|
|
+ GetEventTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // RegisterEventTypes request with any body
|
|
|
+ RegisterEventTypesWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ RegisterEventTypes(ctx context.Context, body RegisterEventTypesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // GetEventTypesBySourceID request
|
|
|
+ GetEventTypesBySourceID(ctx context.Context, sourceId SourceID, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // GetEventType request
|
|
|
+ GetEventType(ctx context.Context, sourceId SourceID, name EventName, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // SubscribeSIO request
|
|
|
+ SubscribeSIO(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // PollSIO request
|
|
|
+ PollSIO(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // SubscribeSIO2 request
|
|
|
+ SubscribeSIO2(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+
|
|
|
+ // PollSIO2 request
|
|
|
+ PollSIO2(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) SubscribeActionWS(ctx context.Context, sourceId SourceID, params *SubscribeActionWSParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewSubscribeActionWSRequest(c.Server, sourceId, params)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) TriggerActionWithBody(ctx context.Context, sourceId SourceID, name ActionName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewTriggerActionRequestWithBody(c.Server, sourceId, name, contentType, body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) TriggerAction(ctx context.Context, sourceId SourceID, name ActionName, body TriggerActionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewTriggerActionRequest(c.Server, sourceId, name, body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) GetActionTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewGetActionTypesRequest(c.Server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) RegisterActionTypesWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewRegisterActionTypesRequestWithBody(c.Server, contentType, body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) RegisterActionTypes(ctx context.Context, body RegisterActionTypesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewRegisterActionTypesRequest(c.Server, body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) GetActionTypesBySourceID(ctx context.Context, sourceId SourceID, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewGetActionTypesBySourceIDRequest(c.Server, sourceId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) GetActionType(ctx context.Context, sourceId SourceID, name ActionName, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewGetActionTypeRequest(c.Server, sourceId, name)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) SubscribeEventWS(ctx context.Context, sourceId SourceID, params *SubscribeEventWSParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewSubscribeEventWSRequest(c.Server, sourceId, params)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) PublishEventWithBody(ctx context.Context, sourceId SourceID, name EventName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewPublishEventRequestWithBody(c.Server, sourceId, name, contentType, body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) PublishEvent(ctx context.Context, sourceId SourceID, name EventName, body PublishEventJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewPublishEventRequest(c.Server, sourceId, name, body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) GetEventTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewGetEventTypesRequest(c.Server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) RegisterEventTypesWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewRegisterEventTypesRequestWithBody(c.Server, contentType, body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) RegisterEventTypes(ctx context.Context, body RegisterEventTypesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewRegisterEventTypesRequest(c.Server, body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) GetEventTypesBySourceID(ctx context.Context, sourceId SourceID, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewGetEventTypesBySourceIDRequest(c.Server, sourceId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) GetEventType(ctx context.Context, sourceId SourceID, name EventName, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewGetEventTypeRequest(c.Server, sourceId, name)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) SubscribeSIO(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewSubscribeSIORequest(c.Server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) PollSIO(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewPollSIORequest(c.Server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) SubscribeSIO2(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewSubscribeSIO2Request(c.Server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) PollSIO2(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|
|
+ req, err := NewPollSIO2Request(c.Server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ req = req.WithContext(ctx)
|
|
|
+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return c.Client.Do(req)
|
|
|
+}
|
|
|
+
|
|
|
+// NewSubscribeActionWSRequest generates requests for SubscribeActionWS
|
|
|
+func NewSubscribeActionWSRequest(server string, sourceId SourceID, params *SubscribeActionWSParams) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ var pathParam0 string
|
|
|
+
|
|
|
+ pathParam0, err = runtime.StyleParamWithLocation("simple", false, "source_id", runtime.ParamLocationPath, sourceId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/action/%s", pathParam0)
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ queryValues := queryURL.Query()
|
|
|
+
|
|
|
+ if params.Names != nil {
|
|
|
+
|
|
|
+ if queryFrag, err := runtime.StyleParamWithLocation("form", true, "names", runtime.ParamLocationQuery, *params.Names); err != nil {
|
|
|
+ return nil, err
|
|
|
+ } else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|
|
+ return nil, err
|
|
|
+ } else {
|
|
|
+ for k, v := range parsed {
|
|
|
+ for _, v2 := range v {
|
|
|
+ queryValues.Add(k, v2)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL.RawQuery = queryValues.Encode()
|
|
|
+
|
|
|
+ req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewTriggerActionRequest calls the generic TriggerAction builder with application/json body
|
|
|
+func NewTriggerActionRequest(server string, sourceId SourceID, name ActionName, body TriggerActionJSONRequestBody) (*http.Request, error) {
|
|
|
+ var bodyReader io.Reader
|
|
|
+ buf, err := json.Marshal(body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ bodyReader = bytes.NewReader(buf)
|
|
|
+ return NewTriggerActionRequestWithBody(server, sourceId, name, "application/json", bodyReader)
|
|
|
+}
|
|
|
+
|
|
|
+// NewTriggerActionRequestWithBody generates requests for TriggerAction with any type of body
|
|
|
+func NewTriggerActionRequestWithBody(server string, sourceId SourceID, name ActionName, contentType string, body io.Reader) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ var pathParam0 string
|
|
|
+
|
|
|
+ pathParam0, err = runtime.StyleParamWithLocation("simple", false, "source_id", runtime.ParamLocationPath, sourceId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ var pathParam1 string
|
|
|
+
|
|
|
+ pathParam1, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/action/%s/%s", pathParam0, pathParam1)
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("POST", queryURL.String(), body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req.Header.Add("Content-Type", contentType)
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewGetActionTypesRequest generates requests for GetActionTypes
|
|
|
+func NewGetActionTypesRequest(server string) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/action_type")
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewRegisterActionTypesRequest calls the generic RegisterActionTypes builder with application/json body
|
|
|
+func NewRegisterActionTypesRequest(server string, body RegisterActionTypesJSONRequestBody) (*http.Request, error) {
|
|
|
+ var bodyReader io.Reader
|
|
|
+ buf, err := json.Marshal(body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ bodyReader = bytes.NewReader(buf)
|
|
|
+ return NewRegisterActionTypesRequestWithBody(server, "application/json", bodyReader)
|
|
|
+}
|
|
|
+
|
|
|
+// NewRegisterActionTypesRequestWithBody generates requests for RegisterActionTypes with any type of body
|
|
|
+func NewRegisterActionTypesRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/action_type")
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("POST", queryURL.String(), body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req.Header.Add("Content-Type", contentType)
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewGetActionTypesBySourceIDRequest generates requests for GetActionTypesBySourceID
|
|
|
+func NewGetActionTypesBySourceIDRequest(server string, sourceId SourceID) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ var pathParam0 string
|
|
|
+
|
|
|
+ pathParam0, err = runtime.StyleParamWithLocation("simple", false, "source_id", runtime.ParamLocationPath, sourceId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/action_type/%s", pathParam0)
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewGetActionTypeRequest generates requests for GetActionType
|
|
|
+func NewGetActionTypeRequest(server string, sourceId SourceID, name ActionName) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ var pathParam0 string
|
|
|
+
|
|
|
+ pathParam0, err = runtime.StyleParamWithLocation("simple", false, "source_id", runtime.ParamLocationPath, sourceId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ var pathParam1 string
|
|
|
+
|
|
|
+ pathParam1, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/action_type/%s/%s", pathParam0, pathParam1)
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewSubscribeEventWSRequest generates requests for SubscribeEventWS
|
|
|
+func NewSubscribeEventWSRequest(server string, sourceId SourceID, params *SubscribeEventWSParams) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ var pathParam0 string
|
|
|
+
|
|
|
+ pathParam0, err = runtime.StyleParamWithLocation("simple", false, "source_id", runtime.ParamLocationPath, sourceId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/event/%s", pathParam0)
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ queryValues := queryURL.Query()
|
|
|
+
|
|
|
+ if params.Names != nil {
|
|
|
+
|
|
|
+ if queryFrag, err := runtime.StyleParamWithLocation("form", true, "names", runtime.ParamLocationQuery, *params.Names); err != nil {
|
|
|
+ return nil, err
|
|
|
+ } else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|
|
+ return nil, err
|
|
|
+ } else {
|
|
|
+ for k, v := range parsed {
|
|
|
+ for _, v2 := range v {
|
|
|
+ queryValues.Add(k, v2)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL.RawQuery = queryValues.Encode()
|
|
|
+
|
|
|
+ req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewPublishEventRequest calls the generic PublishEvent builder with application/json body
|
|
|
+func NewPublishEventRequest(server string, sourceId SourceID, name EventName, body PublishEventJSONRequestBody) (*http.Request, error) {
|
|
|
+ var bodyReader io.Reader
|
|
|
+ buf, err := json.Marshal(body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ bodyReader = bytes.NewReader(buf)
|
|
|
+ return NewPublishEventRequestWithBody(server, sourceId, name, "application/json", bodyReader)
|
|
|
+}
|
|
|
+
|
|
|
+// NewPublishEventRequestWithBody generates requests for PublishEvent with any type of body
|
|
|
+func NewPublishEventRequestWithBody(server string, sourceId SourceID, name EventName, contentType string, body io.Reader) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ var pathParam0 string
|
|
|
+
|
|
|
+ pathParam0, err = runtime.StyleParamWithLocation("simple", false, "source_id", runtime.ParamLocationPath, sourceId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ var pathParam1 string
|
|
|
+
|
|
|
+ pathParam1, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/event/%s/%s", pathParam0, pathParam1)
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("POST", queryURL.String(), body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req.Header.Add("Content-Type", contentType)
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewGetEventTypesRequest generates requests for GetEventTypes
|
|
|
+func NewGetEventTypesRequest(server string) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/event_type")
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewRegisterEventTypesRequest calls the generic RegisterEventTypes builder with application/json body
|
|
|
+func NewRegisterEventTypesRequest(server string, body RegisterEventTypesJSONRequestBody) (*http.Request, error) {
|
|
|
+ var bodyReader io.Reader
|
|
|
+ buf, err := json.Marshal(body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ bodyReader = bytes.NewReader(buf)
|
|
|
+ return NewRegisterEventTypesRequestWithBody(server, "application/json", bodyReader)
|
|
|
+}
|
|
|
+
|
|
|
+// NewRegisterEventTypesRequestWithBody generates requests for RegisterEventTypes with any type of body
|
|
|
+func NewRegisterEventTypesRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/event_type")
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("POST", queryURL.String(), body)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req.Header.Add("Content-Type", contentType)
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewGetEventTypesBySourceIDRequest generates requests for GetEventTypesBySourceID
|
|
|
+func NewGetEventTypesBySourceIDRequest(server string, sourceId SourceID) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ var pathParam0 string
|
|
|
+
|
|
|
+ pathParam0, err = runtime.StyleParamWithLocation("simple", false, "source_id", runtime.ParamLocationPath, sourceId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/event_type/%s", pathParam0)
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewGetEventTypeRequest generates requests for GetEventType
|
|
|
+func NewGetEventTypeRequest(server string, sourceId SourceID, name EventName) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ var pathParam0 string
|
|
|
+
|
|
|
+ pathParam0, err = runtime.StyleParamWithLocation("simple", false, "source_id", runtime.ParamLocationPath, sourceId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ var pathParam1 string
|
|
|
+
|
|
|
+ pathParam1, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/event_type/%s/%s", pathParam0, pathParam1)
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewSubscribeSIORequest generates requests for SubscribeSIO
|
|
|
+func NewSubscribeSIORequest(server string) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/socket.io")
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewPollSIORequest generates requests for PollSIO
|
|
|
+func NewPollSIORequest(server string) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/socket.io")
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("POST", queryURL.String(), nil)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewSubscribeSIO2Request generates requests for SubscribeSIO2
|
|
|
+func NewSubscribeSIO2Request(server string) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/socket.io/")
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewPollSIO2Request generates requests for PollSIO2
|
|
|
+func NewPollSIO2Request(server string) (*http.Request, error) {
|
|
|
+ var err error
|
|
|
+
|
|
|
+ serverURL, err := url.Parse(server)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ operationPath := fmt.Sprintf("/socket.io/")
|
|
|
+ if operationPath[0] == '/' {
|
|
|
+ operationPath = "." + operationPath
|
|
|
+ }
|
|
|
+
|
|
|
+ queryURL, err := serverURL.Parse(operationPath)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ req, err := http.NewRequest("POST", queryURL.String(), nil)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return req, nil
|
|
|
+}
|
|
|
+
|
|
|
+func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error {
|
|
|
+ for _, r := range c.RequestEditors {
|
|
|
+ if err := r(ctx, req); err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for _, r := range additionalEditors {
|
|
|
+ if err := r(ctx, req); err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClientWithResponses builds on ClientInterface to offer response payloads
|
|
|
+type ClientWithResponses struct {
|
|
|
+ ClientInterface
|
|
|
+}
|
|
|
+
|
|
|
+// NewClientWithResponses creates a new ClientWithResponses, which wraps
|
|
|
+// Client with return type handling
|
|
|
+func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) {
|
|
|
+ client, err := NewClient(server, opts...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return &ClientWithResponses{client}, nil
|
|
|
+}
|
|
|
+
|
|
|
+// WithBaseURL overrides the baseURL.
|
|
|
+func WithBaseURL(baseURL string) ClientOption {
|
|
|
+ return func(c *Client) error {
|
|
|
+ newBaseURL, err := url.Parse(baseURL)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ c.Server = newBaseURL.String()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// ClientWithResponsesInterface is the interface specification for the client with responses above.
|
|
|
+type ClientWithResponsesInterface interface {
|
|
|
+ // SubscribeActionWS request
|
|
|
+ SubscribeActionWSWithResponse(ctx context.Context, sourceId SourceID, params *SubscribeActionWSParams, reqEditors ...RequestEditorFn) (*SubscribeActionWSResponse, error)
|
|
|
+
|
|
|
+ // TriggerAction request with any body
|
|
|
+ TriggerActionWithBodyWithResponse(ctx context.Context, sourceId SourceID, name ActionName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TriggerActionResponse, error)
|
|
|
+
|
|
|
+ TriggerActionWithResponse(ctx context.Context, sourceId SourceID, name ActionName, body TriggerActionJSONRequestBody, reqEditors ...RequestEditorFn) (*TriggerActionResponse, error)
|
|
|
+
|
|
|
+ // GetActionTypes request
|
|
|
+ GetActionTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetActionTypesResponse, error)
|
|
|
+
|
|
|
+ // RegisterActionTypes request with any body
|
|
|
+ RegisterActionTypesWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterActionTypesResponse, error)
|
|
|
+
|
|
|
+ RegisterActionTypesWithResponse(ctx context.Context, body RegisterActionTypesJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterActionTypesResponse, error)
|
|
|
+
|
|
|
+ // GetActionTypesBySourceID request
|
|
|
+ GetActionTypesBySourceIDWithResponse(ctx context.Context, sourceId SourceID, reqEditors ...RequestEditorFn) (*GetActionTypesBySourceIDResponse, error)
|
|
|
+
|
|
|
+ // GetActionType request
|
|
|
+ GetActionTypeWithResponse(ctx context.Context, sourceId SourceID, name ActionName, reqEditors ...RequestEditorFn) (*GetActionTypeResponse, error)
|
|
|
+
|
|
|
+ // SubscribeEventWS request
|
|
|
+ SubscribeEventWSWithResponse(ctx context.Context, sourceId SourceID, params *SubscribeEventWSParams, reqEditors ...RequestEditorFn) (*SubscribeEventWSResponse, error)
|
|
|
+
|
|
|
+ // PublishEvent request with any body
|
|
|
+ PublishEventWithBodyWithResponse(ctx context.Context, sourceId SourceID, name EventName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PublishEventResponse, error)
|
|
|
+
|
|
|
+ PublishEventWithResponse(ctx context.Context, sourceId SourceID, name EventName, body PublishEventJSONRequestBody, reqEditors ...RequestEditorFn) (*PublishEventResponse, error)
|
|
|
+
|
|
|
+ // GetEventTypes request
|
|
|
+ GetEventTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetEventTypesResponse, error)
|
|
|
+
|
|
|
+ // RegisterEventTypes request with any body
|
|
|
+ RegisterEventTypesWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterEventTypesResponse, error)
|
|
|
+
|
|
|
+ RegisterEventTypesWithResponse(ctx context.Context, body RegisterEventTypesJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterEventTypesResponse, error)
|
|
|
+
|
|
|
+ // GetEventTypesBySourceID request
|
|
|
+ GetEventTypesBySourceIDWithResponse(ctx context.Context, sourceId SourceID, reqEditors ...RequestEditorFn) (*GetEventTypesBySourceIDResponse, error)
|
|
|
+
|
|
|
+ // GetEventType request
|
|
|
+ GetEventTypeWithResponse(ctx context.Context, sourceId SourceID, name EventName, reqEditors ...RequestEditorFn) (*GetEventTypeResponse, error)
|
|
|
+
|
|
|
+ // SubscribeSIO request
|
|
|
+ SubscribeSIOWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*SubscribeSIOResponse, error)
|
|
|
+
|
|
|
+ // PollSIO request
|
|
|
+ PollSIOWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PollSIOResponse, error)
|
|
|
+
|
|
|
+ // SubscribeSIO2 request
|
|
|
+ SubscribeSIO2WithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*SubscribeSIO2Response, error)
|
|
|
+
|
|
|
+ // PollSIO2 request
|
|
|
+ PollSIO2WithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PollSIO2Response, error)
|
|
|
+}
|
|
|
+
|
|
|
+type SubscribeActionWSResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r SubscribeActionWSResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r SubscribeActionWSResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type TriggerActionResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+ JSON200 *Action
|
|
|
+ JSON400 *BaseResponse
|
|
|
+ JSON404 *BaseResponse
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r TriggerActionResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r TriggerActionResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type GetActionTypesResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+ JSON200 *[]ActionType
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r GetActionTypesResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r GetActionTypesResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type RegisterActionTypesResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+ JSON200 *BaseResponse
|
|
|
+ JSON400 *BaseResponse
|
|
|
+ JSON409 *BaseResponse
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r RegisterActionTypesResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r RegisterActionTypesResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type GetActionTypesBySourceIDResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+ JSON200 *[]ActionType
|
|
|
+ JSON404 *BaseResponse
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r GetActionTypesBySourceIDResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r GetActionTypesBySourceIDResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type GetActionTypeResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+ JSON200 *ActionType
|
|
|
+ JSON404 *BaseResponse
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r GetActionTypeResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r GetActionTypeResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type SubscribeEventWSResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r SubscribeEventWSResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r SubscribeEventWSResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type PublishEventResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+ JSON200 *Event
|
|
|
+ JSON400 *BaseResponse
|
|
|
+ JSON404 *BaseResponse
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r PublishEventResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r PublishEventResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type GetEventTypesResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+ JSON200 *[]EventType
|
|
|
+ JSON500 *BaseResponse
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r GetEventTypesResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r GetEventTypesResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type RegisterEventTypesResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+ JSON200 *BaseResponse
|
|
|
+ JSON400 *BaseResponse
|
|
|
+ JSON409 *BaseResponse
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r RegisterEventTypesResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r RegisterEventTypesResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type GetEventTypesBySourceIDResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+ JSON200 *[]EventType
|
|
|
+ JSON404 *BaseResponse
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r GetEventTypesBySourceIDResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r GetEventTypesBySourceIDResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type GetEventTypeResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+ JSON200 *EventType
|
|
|
+ JSON404 *BaseResponse
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r GetEventTypeResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r GetEventTypeResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type SubscribeSIOResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r SubscribeSIOResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r SubscribeSIOResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type PollSIOResponse struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r PollSIOResponse) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r PollSIOResponse) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type SubscribeSIO2Response struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r SubscribeSIO2Response) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r SubscribeSIO2Response) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+type PollSIO2Response struct {
|
|
|
+ Body []byte
|
|
|
+ HTTPResponse *http.Response
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns HTTPResponse.Status
|
|
|
+func (r PollSIO2Response) Status() string {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.Status
|
|
|
+ }
|
|
|
+ return http.StatusText(0)
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCode returns HTTPResponse.StatusCode
|
|
|
+func (r PollSIO2Response) StatusCode() int {
|
|
|
+ if r.HTTPResponse != nil {
|
|
|
+ return r.HTTPResponse.StatusCode
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+// SubscribeActionWSWithResponse request returning *SubscribeActionWSResponse
|
|
|
+func (c *ClientWithResponses) SubscribeActionWSWithResponse(ctx context.Context, sourceId SourceID, params *SubscribeActionWSParams, reqEditors ...RequestEditorFn) (*SubscribeActionWSResponse, error) {
|
|
|
+ rsp, err := c.SubscribeActionWS(ctx, sourceId, params, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseSubscribeActionWSResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// TriggerActionWithBodyWithResponse request with arbitrary body returning *TriggerActionResponse
|
|
|
+func (c *ClientWithResponses) TriggerActionWithBodyWithResponse(ctx context.Context, sourceId SourceID, name ActionName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TriggerActionResponse, error) {
|
|
|
+ rsp, err := c.TriggerActionWithBody(ctx, sourceId, name, contentType, body, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseTriggerActionResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *ClientWithResponses) TriggerActionWithResponse(ctx context.Context, sourceId SourceID, name ActionName, body TriggerActionJSONRequestBody, reqEditors ...RequestEditorFn) (*TriggerActionResponse, error) {
|
|
|
+ rsp, err := c.TriggerAction(ctx, sourceId, name, body, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseTriggerActionResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// GetActionTypesWithResponse request returning *GetActionTypesResponse
|
|
|
+func (c *ClientWithResponses) GetActionTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetActionTypesResponse, error) {
|
|
|
+ rsp, err := c.GetActionTypes(ctx, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseGetActionTypesResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// RegisterActionTypesWithBodyWithResponse request with arbitrary body returning *RegisterActionTypesResponse
|
|
|
+func (c *ClientWithResponses) RegisterActionTypesWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterActionTypesResponse, error) {
|
|
|
+ rsp, err := c.RegisterActionTypesWithBody(ctx, contentType, body, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseRegisterActionTypesResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *ClientWithResponses) RegisterActionTypesWithResponse(ctx context.Context, body RegisterActionTypesJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterActionTypesResponse, error) {
|
|
|
+ rsp, err := c.RegisterActionTypes(ctx, body, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseRegisterActionTypesResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// GetActionTypesBySourceIDWithResponse request returning *GetActionTypesBySourceIDResponse
|
|
|
+func (c *ClientWithResponses) GetActionTypesBySourceIDWithResponse(ctx context.Context, sourceId SourceID, reqEditors ...RequestEditorFn) (*GetActionTypesBySourceIDResponse, error) {
|
|
|
+ rsp, err := c.GetActionTypesBySourceID(ctx, sourceId, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseGetActionTypesBySourceIDResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// GetActionTypeWithResponse request returning *GetActionTypeResponse
|
|
|
+func (c *ClientWithResponses) GetActionTypeWithResponse(ctx context.Context, sourceId SourceID, name ActionName, reqEditors ...RequestEditorFn) (*GetActionTypeResponse, error) {
|
|
|
+ rsp, err := c.GetActionType(ctx, sourceId, name, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseGetActionTypeResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// SubscribeEventWSWithResponse request returning *SubscribeEventWSResponse
|
|
|
+func (c *ClientWithResponses) SubscribeEventWSWithResponse(ctx context.Context, sourceId SourceID, params *SubscribeEventWSParams, reqEditors ...RequestEditorFn) (*SubscribeEventWSResponse, error) {
|
|
|
+ rsp, err := c.SubscribeEventWS(ctx, sourceId, params, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseSubscribeEventWSResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// PublishEventWithBodyWithResponse request with arbitrary body returning *PublishEventResponse
|
|
|
+func (c *ClientWithResponses) PublishEventWithBodyWithResponse(ctx context.Context, sourceId SourceID, name EventName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PublishEventResponse, error) {
|
|
|
+ rsp, err := c.PublishEventWithBody(ctx, sourceId, name, contentType, body, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParsePublishEventResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *ClientWithResponses) PublishEventWithResponse(ctx context.Context, sourceId SourceID, name EventName, body PublishEventJSONRequestBody, reqEditors ...RequestEditorFn) (*PublishEventResponse, error) {
|
|
|
+ rsp, err := c.PublishEvent(ctx, sourceId, name, body, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParsePublishEventResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// GetEventTypesWithResponse request returning *GetEventTypesResponse
|
|
|
+func (c *ClientWithResponses) GetEventTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetEventTypesResponse, error) {
|
|
|
+ rsp, err := c.GetEventTypes(ctx, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseGetEventTypesResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// RegisterEventTypesWithBodyWithResponse request with arbitrary body returning *RegisterEventTypesResponse
|
|
|
+func (c *ClientWithResponses) RegisterEventTypesWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterEventTypesResponse, error) {
|
|
|
+ rsp, err := c.RegisterEventTypesWithBody(ctx, contentType, body, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseRegisterEventTypesResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+func (c *ClientWithResponses) RegisterEventTypesWithResponse(ctx context.Context, body RegisterEventTypesJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterEventTypesResponse, error) {
|
|
|
+ rsp, err := c.RegisterEventTypes(ctx, body, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseRegisterEventTypesResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// GetEventTypesBySourceIDWithResponse request returning *GetEventTypesBySourceIDResponse
|
|
|
+func (c *ClientWithResponses) GetEventTypesBySourceIDWithResponse(ctx context.Context, sourceId SourceID, reqEditors ...RequestEditorFn) (*GetEventTypesBySourceIDResponse, error) {
|
|
|
+ rsp, err := c.GetEventTypesBySourceID(ctx, sourceId, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseGetEventTypesBySourceIDResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// GetEventTypeWithResponse request returning *GetEventTypeResponse
|
|
|
+func (c *ClientWithResponses) GetEventTypeWithResponse(ctx context.Context, sourceId SourceID, name EventName, reqEditors ...RequestEditorFn) (*GetEventTypeResponse, error) {
|
|
|
+ rsp, err := c.GetEventType(ctx, sourceId, name, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseGetEventTypeResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// SubscribeSIOWithResponse request returning *SubscribeSIOResponse
|
|
|
+func (c *ClientWithResponses) SubscribeSIOWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*SubscribeSIOResponse, error) {
|
|
|
+ rsp, err := c.SubscribeSIO(ctx, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseSubscribeSIOResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// PollSIOWithResponse request returning *PollSIOResponse
|
|
|
+func (c *ClientWithResponses) PollSIOWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PollSIOResponse, error) {
|
|
|
+ rsp, err := c.PollSIO(ctx, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParsePollSIOResponse(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// SubscribeSIO2WithResponse request returning *SubscribeSIO2Response
|
|
|
+func (c *ClientWithResponses) SubscribeSIO2WithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*SubscribeSIO2Response, error) {
|
|
|
+ rsp, err := c.SubscribeSIO2(ctx, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParseSubscribeSIO2Response(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// PollSIO2WithResponse request returning *PollSIO2Response
|
|
|
+func (c *ClientWithResponses) PollSIO2WithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PollSIO2Response, error) {
|
|
|
+ rsp, err := c.PollSIO2(ctx, reqEditors...)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return ParsePollSIO2Response(rsp)
|
|
|
+}
|
|
|
+
|
|
|
+// ParseSubscribeActionWSResponse parses an HTTP response from a SubscribeActionWSWithResponse call
|
|
|
+func ParseSubscribeActionWSResponse(rsp *http.Response) (*SubscribeActionWSResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &SubscribeActionWSResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParseTriggerActionResponse parses an HTTP response from a TriggerActionWithResponse call
|
|
|
+func ParseTriggerActionResponse(rsp *http.Response) (*TriggerActionResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &TriggerActionResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ switch {
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|
|
+ var dest Action
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON200 = &dest
|
|
|
+
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON400 = &dest
|
|
|
+
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON404 = &dest
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParseGetActionTypesResponse parses an HTTP response from a GetActionTypesWithResponse call
|
|
|
+func ParseGetActionTypesResponse(rsp *http.Response) (*GetActionTypesResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &GetActionTypesResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ switch {
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|
|
+ var dest []ActionType
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON200 = &dest
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParseRegisterActionTypesResponse parses an HTTP response from a RegisterActionTypesWithResponse call
|
|
|
+func ParseRegisterActionTypesResponse(rsp *http.Response) (*RegisterActionTypesResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &RegisterActionTypesResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ switch {
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON200 = &dest
|
|
|
+
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON400 = &dest
|
|
|
+
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON409 = &dest
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParseGetActionTypesBySourceIDResponse parses an HTTP response from a GetActionTypesBySourceIDWithResponse call
|
|
|
+func ParseGetActionTypesBySourceIDResponse(rsp *http.Response) (*GetActionTypesBySourceIDResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &GetActionTypesBySourceIDResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ switch {
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|
|
+ var dest []ActionType
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON200 = &dest
|
|
|
+
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON404 = &dest
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParseGetActionTypeResponse parses an HTTP response from a GetActionTypeWithResponse call
|
|
|
+func ParseGetActionTypeResponse(rsp *http.Response) (*GetActionTypeResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &GetActionTypeResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ switch {
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|
|
+ var dest ActionType
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON200 = &dest
|
|
|
+
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON404 = &dest
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParseSubscribeEventWSResponse parses an HTTP response from a SubscribeEventWSWithResponse call
|
|
|
+func ParseSubscribeEventWSResponse(rsp *http.Response) (*SubscribeEventWSResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &SubscribeEventWSResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParsePublishEventResponse parses an HTTP response from a PublishEventWithResponse call
|
|
|
+func ParsePublishEventResponse(rsp *http.Response) (*PublishEventResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &PublishEventResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ switch {
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|
|
+ var dest Event
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON200 = &dest
|
|
|
+
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON400 = &dest
|
|
|
+
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON404 = &dest
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParseGetEventTypesResponse parses an HTTP response from a GetEventTypesWithResponse call
|
|
|
+func ParseGetEventTypesResponse(rsp *http.Response) (*GetEventTypesResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &GetEventTypesResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ switch {
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|
|
+ var dest []EventType
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON200 = &dest
|
|
|
+
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON500 = &dest
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParseRegisterEventTypesResponse parses an HTTP response from a RegisterEventTypesWithResponse call
|
|
|
+func ParseRegisterEventTypesResponse(rsp *http.Response) (*RegisterEventTypesResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &RegisterEventTypesResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ switch {
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON200 = &dest
|
|
|
+
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON400 = &dest
|
|
|
+
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON409 = &dest
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParseGetEventTypesBySourceIDResponse parses an HTTP response from a GetEventTypesBySourceIDWithResponse call
|
|
|
+func ParseGetEventTypesBySourceIDResponse(rsp *http.Response) (*GetEventTypesBySourceIDResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &GetEventTypesBySourceIDResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ switch {
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|
|
+ var dest []EventType
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON200 = &dest
|
|
|
+
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON404 = &dest
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParseGetEventTypeResponse parses an HTTP response from a GetEventTypeWithResponse call
|
|
|
+func ParseGetEventTypeResponse(rsp *http.Response) (*GetEventTypeResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &GetEventTypeResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ switch {
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|
|
+ var dest EventType
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON200 = &dest
|
|
|
+
|
|
|
+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
|
|
|
+ var dest BaseResponse
|
|
|
+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ response.JSON404 = &dest
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParseSubscribeSIOResponse parses an HTTP response from a SubscribeSIOWithResponse call
|
|
|
+func ParseSubscribeSIOResponse(rsp *http.Response) (*SubscribeSIOResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &SubscribeSIOResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParsePollSIOResponse parses an HTTP response from a PollSIOWithResponse call
|
|
|
+func ParsePollSIOResponse(rsp *http.Response) (*PollSIOResponse, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &PollSIOResponse{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParseSubscribeSIO2Response parses an HTTP response from a SubscribeSIO2WithResponse call
|
|
|
+func ParseSubscribeSIO2Response(rsp *http.Response) (*SubscribeSIO2Response, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &SubscribeSIO2Response{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ParsePollSIO2Response parses an HTTP response from a PollSIO2WithResponse call
|
|
|
+func ParsePollSIO2Response(rsp *http.Response) (*PollSIO2Response, error) {
|
|
|
+ bodyBytes, err := io.ReadAll(rsp.Body)
|
|
|
+ defer func() { _ = rsp.Body.Close() }()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ response := &PollSIO2Response{
|
|
|
+ Body: bodyBytes,
|
|
|
+ HTTPResponse: rsp,
|
|
|
+ }
|
|
|
+
|
|
|
+ return response, nil
|
|
|
+}
|