diff --git a/.gitignore b/.gitignore index b87d9ac..eab1ba0 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ github.com .all-contributorsrc dist CasaOS +/codegen # System Files .DS_Store diff --git a/codegen/casaos_api.go b/codegen/casaos_api.go deleted file mode 100644 index 81e8c09..0000000 --- a/codegen/casaos_api.go +++ /dev/null @@ -1,326 +0,0 @@ -// Package codegen 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 codegen - -import ( - "bytes" - "compress/gzip" - "encoding/base64" - "fmt" - "net/http" - "net/url" - "path" - "strings" - - "github.com/deepmap/oapi-codegen/pkg/runtime" - "github.com/getkin/kin-openapi/openapi3" - "github.com/labstack/echo/v4" -) - -const ( - Access_tokenScopes = "access_token.Scopes" -) - -// Defines values for SetZerotierNetworkStatusJSONBodyStatus. -const ( - Offline SetZerotierNetworkStatusJSONBodyStatus = "offline" - Online SetZerotierNetworkStatusJSONBodyStatus = "online" -) - -// BaseResponse defines model for BaseResponse. -type BaseResponse struct { - // Message message returned by server side if there is any - Message *string `json:"message,omitempty"` -} - -// HealthPorts defines model for HealthPorts. -type HealthPorts struct { - TCP *[]int `json:"tcp,omitempty"` - UDP *[]int `json:"udp,omitempty"` -} - -// HealthServices defines model for HealthServices. -type HealthServices struct { - NotRunning *[]string `json:"not_running,omitempty"` - Running *[]string `json:"running,omitempty"` -} - -// ZTInfo defines model for ZTInfo. -type ZTInfo struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Status *string `json:"status,omitempty"` -} - -// GetHealthPortsOK defines model for GetHealthPortsOK. -type GetHealthPortsOK struct { - Data *HealthPorts `json:"data,omitempty"` - - // Message message returned by server side if there is any - Message *string `json:"message,omitempty"` -} - -// GetHealthServicesOK defines model for GetHealthServicesOK. -type GetHealthServicesOK struct { - Data *HealthServices `json:"data,omitempty"` - - // Message message returned by server side if there is any - Message *string `json:"message,omitempty"` -} - -// GetZTInfoOK defines model for GetZTInfoOK. -type GetZTInfoOK = ZTInfo - -// ResponseInternalServerError defines model for ResponseInternalServerError. -type ResponseInternalServerError = BaseResponse - -// ResponseOK defines model for ResponseOK. -type ResponseOK = BaseResponse - -// SetZerotierNetworkStatusJSONBody defines parameters for SetZerotierNetworkStatus. -type SetZerotierNetworkStatusJSONBody struct { - Status *SetZerotierNetworkStatusJSONBodyStatus `json:"status,omitempty"` -} - -// SetZerotierNetworkStatusJSONBodyStatus defines parameters for SetZerotierNetworkStatus. -type SetZerotierNetworkStatusJSONBodyStatus string - -// SetZerotierNetworkStatusJSONRequestBody defines body for SetZerotierNetworkStatus for application/json ContentType. -type SetZerotierNetworkStatusJSONRequestBody SetZerotierNetworkStatusJSONBody - -// ServerInterface represents all server handlers. -type ServerInterface interface { - // Test file methods - // (GET /file/test) - GetFileTest(ctx echo.Context) error - // Get log - // (GET /health/logs) - GetHealthlogs(ctx echo.Context) error - // Get port in use - // (GET /health/ports) - GetHealthPorts(ctx echo.Context) error - // Get service status - // (GET /health/services) - GetHealthServices(ctx echo.Context) error - // Get Zerotier info - // (GET /zt/info) - GetZerotierInfo(ctx echo.Context) error - // Set Zerotier network status - // (PUT /zt/{network_id}/status) - SetZerotierNetworkStatus(ctx echo.Context, networkId string) error -} - -// ServerInterfaceWrapper converts echo contexts to parameters. -type ServerInterfaceWrapper struct { - Handler ServerInterface -} - -// GetFileTest converts echo context to params. -func (w *ServerInterfaceWrapper) GetFileTest(ctx echo.Context) error { - var err error - - ctx.Set(Access_tokenScopes, []string{""}) - - // Invoke the callback with all the unmarshalled arguments - err = w.Handler.GetFileTest(ctx) - return err -} - -// GetHealthlogs converts echo context to params. -func (w *ServerInterfaceWrapper) GetHealthlogs(ctx echo.Context) error { - var err error - - ctx.Set(Access_tokenScopes, []string{""}) - - // Invoke the callback with all the unmarshalled arguments - err = w.Handler.GetHealthlogs(ctx) - return err -} - -// GetHealthPorts converts echo context to params. -func (w *ServerInterfaceWrapper) GetHealthPorts(ctx echo.Context) error { - var err error - - ctx.Set(Access_tokenScopes, []string{""}) - - // Invoke the callback with all the unmarshalled arguments - err = w.Handler.GetHealthPorts(ctx) - return err -} - -// GetHealthServices converts echo context to params. -func (w *ServerInterfaceWrapper) GetHealthServices(ctx echo.Context) error { - var err error - - ctx.Set(Access_tokenScopes, []string{""}) - - // Invoke the callback with all the unmarshalled arguments - err = w.Handler.GetHealthServices(ctx) - return err -} - -// GetZerotierInfo converts echo context to params. -func (w *ServerInterfaceWrapper) GetZerotierInfo(ctx echo.Context) error { - var err error - - ctx.Set(Access_tokenScopes, []string{""}) - - // Invoke the callback with all the unmarshalled arguments - err = w.Handler.GetZerotierInfo(ctx) - return err -} - -// SetZerotierNetworkStatus converts echo context to params. -func (w *ServerInterfaceWrapper) SetZerotierNetworkStatus(ctx echo.Context) error { - var err error - // ------------- Path parameter "network_id" ------------- - var networkId string - - err = runtime.BindStyledParameterWithLocation("simple", false, "network_id", runtime.ParamLocationPath, ctx.Param("network_id"), &networkId) - if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter network_id: %s", err)) - } - - ctx.Set(Access_tokenScopes, []string{""}) - - // Invoke the callback with all the unmarshalled arguments - err = w.Handler.SetZerotierNetworkStatus(ctx, networkId) - return err -} - -// This is a simple interface which specifies echo.Route addition functions which -// are present on both echo.Echo and echo.Group, since we want to allow using -// either of them for path registration -type EchoRouter interface { - CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route - DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route - GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route - HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route - OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route - PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route - POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route - PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route - TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route -} - -// RegisterHandlers adds each server route to the EchoRouter. -func RegisterHandlers(router EchoRouter, si ServerInterface) { - RegisterHandlersWithBaseURL(router, si, "") -} - -// Registers handlers, and prepends BaseURL to the paths, so that the paths -// can be served under a prefix. -func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) { - - wrapper := ServerInterfaceWrapper{ - Handler: si, - } - - router.GET(baseURL+"/file/test", wrapper.GetFileTest) - router.GET(baseURL+"/health/logs", wrapper.GetHealthlogs) - router.GET(baseURL+"/health/ports", wrapper.GetHealthPorts) - router.GET(baseURL+"/health/services", wrapper.GetHealthServices) - router.GET(baseURL+"/zt/info", wrapper.GetZerotierInfo) - router.PUT(baseURL+"/zt/:network_id/status", wrapper.SetZerotierNetworkStatus) - -} - -// Base64 encoded, gzipped, json marshaled Swagger object -var swaggerSpec = []string{ - - "H4sIAAAAAAAC/8xX72/bNhD9VwhuH5pBsbxk3ToB/dAfaxoUW4Ilw4bGhktLZ4mNRKp3pyRuoP99oCjb", - "sq386pqhn2xRp7v3Hnnk47WMbVFaA4ZJRtcSgUprCJqHA+C3oHLOji0yHb1zY7E1DIbdX1WWuY4Va2vC", - "j2SNG6M4g0I1b/P8aCajs2v5PcJMRvK7cFUq9HEUvlQEf7Y1ZR1cyxJtCcjaI0gUN8luS9GBKOu6Htd1", - "HcgEKEZdOmwykkfvZB2s6JwAXugYvnFGC5R3knp/emhm9oFkbqvvE8obay7oHRoGNCp3SAF/Q7T41TCs", - "y7iNZFFb+OLCV++A+4p63IXFqVIHbbJmlte+iDbXQAFEKm1erCdqXwgErtBAIqZzQZ4f6QSEngnOAEFo", - "EsrMZSDhShVlDjKSMpAIKjky+VxGjBUEkuele0OM2qQeeLdZtnBxXLofzVA0z8vkz4bLZNowpNAo3Y4o", - "ROWgXO2mdteowo2dvjp2EVVyQ8Kn+w9M+Nfr4y6BZW9scTCWJ1gZ4xj3lpaxImVpQD6F3JJpA0cdyPvk", - "200Vw6Wa3z+vY9N22hYLnazX+HFv/6enP//y7NdhX16vUTf+lSJ1dNIXS6y42mBgTa5ND+IGIkFcoeb5", - "iVvdHp2KYyCasD2Hpou0W7sZqARQLtDIFxVnFvXnpuFWuVWp30HLXrfc15tgVA2H+3GpY64QmgcYGSGE", - "8C/IVhiDKCDR6vlIPikRZoC0G9vc4m7TgxCJROH5zkgKwpiAn49kxlxSFIaoLgep5qyaVgTYbg+D2Bbh", - "YQx/ZyqHU4izMLepDQulTeint/2ZTJUxgBOXfmJ0mvHk2XBYXg1Kk47kl4LNXaJHRMuXuikxmeYV3A5Y", - "F6lQuYPgl5AH9f8j8mjCjVUwMh6VeHF8KEq0FzoBEoWmGPJcGbAViQI4swmJmUWR6NkMEAwLisEo1JYG", - "Lssbi0ITVeC20UQkmuKKSFtDgShzUATiQpNmt9uKswPNb6upQCgtabY4Hz9ZqOGV2KbvYe4Ii+Kj1Uac", - "2QrFa02xxWT1deIHBmkanptPL6bTl1P4Z2cwatpFc6eTHWEZyAtA8k1yseea2ZZgVKllJPcHw8G+DGSp", - "OGt6NJzpHEIGas6+FHi70U6BWLiwhWYD2aTEpmUPExk5d/FGO07EzfnSMYd7w+FN5+YyLuwcxnUgnz7k", - "kz5z0exHVVEonPfhd7KplGR0Jt90h8fuuzBrTg63MqkjyRZff8A0Uf2Mb7AUNmbgXWIEVaxbi5nFQrGM", - "5FQbh7z3YO7zWV9ZrwNgkdu0o5Ln2q9TufAItwvlrcSXrI2t28XjMHY8hDaiIrgnc+qYi97GcWlbTyD8", - "eSrsTICKM/GhdQM/fBBtmt6m2nAx/0m+zm3mcRRsibRU7xLxM4eLc/1G8d4DWtaAwkX2CrSIaOzRF8qz", - "vBc9jixrJDqqLMe3dLk2wJcWzyc6qcOVESurHplOuhXa79oZ2BbsZCXYHz70ZDFXpUJVAANSc3NdL7LI", - "qxMZeBfnzo+Vh1vhbebgU6URksXtYrXBbW5nYx8MxC9tMn/QNWzdBnfMqqkKJ+7SqtrZrPk3Du5jZJcj", - "dvoRYm6t7be2qm6Z8zvWV8enN9O87tDPxm5K/EXSL4MKcxnJ8GKv9WXSBbQFNhfJk9Oj10c7q0Wx0fV1", - "cNcHa2exK3S1yyo9QFuVvl4b9/vWKb61wYzrfwMAAP//9tkexLESAAA=", -} - -// GetSwagger returns the content of the embedded swagger specification file -// or error if failed to decode -func decodeSpec() ([]byte, error) { - zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, "")) - if err != nil { - return nil, fmt.Errorf("error base64 decoding spec: %s", err) - } - zr, err := gzip.NewReader(bytes.NewReader(zipped)) - if err != nil { - return nil, fmt.Errorf("error decompressing spec: %s", err) - } - var buf bytes.Buffer - _, err = buf.ReadFrom(zr) - if err != nil { - return nil, fmt.Errorf("error decompressing spec: %s", err) - } - - return buf.Bytes(), nil -} - -var rawSpec = decodeSpecCached() - -// a naive cached of a decoded swagger spec -func decodeSpecCached() func() ([]byte, error) { - data, err := decodeSpec() - return func() ([]byte, error) { - return data, err - } -} - -// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. -func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { - var res = make(map[string]func() ([]byte, error)) - if len(pathToFile) > 0 { - res[pathToFile] = rawSpec - } - - return res -} - -// 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 GetSwagger() (swagger *openapi3.T, err error) { - var resolvePath = PathToRawSpec("") - - loader := openapi3.NewLoader() - loader.IsExternalRefsAllowed = true - loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { - var pathToFile = url.String() - pathToFile = path.Clean(pathToFile) - getSpec, ok := resolvePath[pathToFile] - if !ok { - err1 := fmt.Errorf("path not found: %s", pathToFile) - return nil, err1 - } - return getSpec() - } - var specData []byte - specData, err = rawSpec() - if err != nil { - return - } - swagger, err = loader.LoadFromData(specData) - if err != nil { - return - } - return -} diff --git a/codegen/message_bus/api.go b/codegen/message_bus/api.go deleted file mode 100644 index a115aab..0000000 --- a/codegen/message_bus/api.go +++ /dev/null @@ -1,2254 +0,0 @@ -// 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 -} diff --git a/go.mod b/go.mod index 058c67c..ac06ebe 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d - github.com/IceWhaleTech/CasaOS-Common v0.4.8-alpha1 + github.com/IceWhaleTech/CasaOS-Common v0.4.8-alpha2 github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf github.com/deckarep/golang-set/v2 v2.3.0 github.com/deepmap/oapi-codegen v1.12.4 diff --git a/go.sum b/go.sum index aed42cf..20e5d13 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,7 @@ github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d h1:62lEBImTxZ83pgzywgDNIrPPuQ+j4ep9QjqrWBn1hrU= github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d/go.mod h1:lW9x+yEjqKdPbE3+cf2fGPJXCw/hChX3Omi9QHTLFsQ= -github.com/IceWhaleTech/CasaOS-Common v0.4.8-alpha1 h1:if22fxs6DMKEVxjOaDFOiMc5o92bBk86U5sZYlsPJgc= +github.com/IceWhaleTech/CasaOS-Common v0.4.8-alpha2 h1:8PuukQvQIlkw9mkK4THKTbSDMio9I6kbXulDTBxG2d0= +github.com/IceWhaleTech/CasaOS-Common v0.4.8-alpha2/go.mod h1:2IuYyy5qW1BE6jqC6M+tOU+WtUec1K565rLATBJ9p/0= github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= @@ -12,6 +13,7 @@ github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= +github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= @@ -52,17 +54,22 @@ github.com/dsoprea/go-utility/v2 v2.0.0-20221003172846-a3e1774ef349/go.mod h1:4G github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= +github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/geoffgarside/ber v1.1.0 h1:qTmFG4jJbwiSzSXoNJeHcOprVzZ8Ulde2Rrrifu5U9w= github.com/geoffgarside/ber v1.1.0/go.mod h1:jVPKeCbj6MvQZhwLYsGwaGI52oUorHoHKNecGT85ZCc= github.com/getkin/kin-openapi v0.117.0 h1:QT2DyGujAL09F4NrKDHJGsUoIprlIcFVHWDVDcUFE8A= +github.com/getkin/kin-openapi v0.117.0/go.mod h1:l5e9PaFUo9fyLJCPGQeXI2ML8c3P8BHOEV2VaAVf/pc= github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4= github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= +github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= github.com/glebarez/go-sqlite v1.21.1 h1:7MZyUPh2XTrHS7xNEHQbrhfMZuPSzhkm2A1qgg0y5NY= +github.com/glebarez/go-sqlite v1.21.1/go.mod h1:ISs8MF6yk5cL4n/43rSOmVMGJJjHYr7L2MbZZ5Q4E2E= github.com/glebarez/sqlite v1.8.0 h1:02X12E2I/4C1n+v90yTqrjRa8yuo7c3KeHI3FRznCvc= +github.com/glebarez/sqlite v1.8.0/go.mod h1:bpET16h1za2KOOMb8+jCp6UBP/iahDpfPQqSaYLTLx8= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= github.com/go-errors/errors v1.1.1/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= @@ -88,6 +95,7 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= +github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY= github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= @@ -127,6 +135,7 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v36 v36.0.0 h1:ndCzM616/oijwufI7nBRa+5eZHLldT+4yIB68ib5ogs= github.com/google/go-github/v36 v36.0.0/go.mod h1:LFlKC047IOqiglRGNqNb9s/iAPTnnjtlshm+bxp+kwk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= @@ -186,6 +195,7 @@ github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8 github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= +github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/lufia/plan9stats v0.0.0-20230110061619-bbe2e5e100de h1:V53FWzU6KAZVi1tPp5UIsMoUWJ2/PNwYIDXnu7QuBCE= github.com/lufia/plan9stats v0.0.0-20230110061619-bbe2e5e100de/go.mod h1:JKx41uQRwqlTZabZc+kILPrO/3jlKnQ2Z8b7YiVw5cE= @@ -201,6 +211,7 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mholt/archiver/v3 v3.5.1 h1:rDjOBX9JSF5BvoJGvjqK479aL70qh9DIpZCl+k7Clwo= github.com/mholt/archiver/v3 v3.5.1/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssnDhppzS1L4= github.com/mileusna/useragent v1.2.1 h1:p3RJWhi3LfuI6BHdddojREyK3p6qX67vIfOVMnUIVr0= @@ -223,6 +234,7 @@ github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaR github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= +github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= github.com/perimeterx/marshmallow v1.1.4 h1:pZLDH9RjlLGGorbXhcaQLhfuV0pFMNfPO55FuFkxqLw= github.com/perimeterx/marshmallow v1.1.4/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/pierrec/lz4/v4 v4.1.2/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= @@ -245,6 +257,7 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM= github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= @@ -266,6 +279,7 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= @@ -315,7 +329,9 @@ golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9 h1:yZNXmy+j/JpX19vZkVktWqAo7Gny4PBWYYK3zskGpx4= +golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.6.0 h1:bR8b5okrPI3g/gyZakLZHeWxAR8Dn5CyxXv1hLH5g/4= golang.org/x/image v0.6.0/go.mod h1:MXLdDR43H7cDJq5GEGXEVeeNhPgi+YYEQ2pC1byI1x0= @@ -337,6 +353,7 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.6.0 h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw= golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= @@ -345,6 +362,7 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -371,6 +389,7 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -383,6 +402,7 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -421,6 +441,7 @@ gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/gorm v1.25.0 h1:+KtYtb2roDz14EQe4bla8CbQlmb9dN3VejSai3lprfU= +gorm.io/gorm v1.25.0/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= modernc.org/libc v1.22.3 h1:D/g6O5ftAfavceqlLOFwaZuA5KYafKwmr30A6iSqoyY= @@ -430,4 +451,5 @@ modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6 modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds= modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= modernc.org/sqlite v1.21.1 h1:GyDFqNnESLOhwwDRaHGdp2jKLDzpyT/rNLglX3ZkMSU= +modernc.org/sqlite v1.21.1/go.mod h1:XwQ0wZPIh1iKb5mkvCJ3szzbhk+tykC8ZWqTRTgYRwI= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=