diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_client.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_client.go new file mode 100644 index 0000000..5913394 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_client.go @@ -0,0 +1,1863 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new application service API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new application service API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new application service API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for application service API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ApplicationServiceCreate(params *ApplicationServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateOK, error) + + ApplicationServiceCreateAwsSnsIntegration(params *ApplicationServiceCreateAwsSnsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateAwsSnsIntegrationOK, error) + + ApplicationServiceCreateAzureServiceBusIntegration(params *ApplicationServiceCreateAzureServiceBusIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateAzureServiceBusIntegrationOK, error) + + ApplicationServiceCreateGcpPubSubIntegration(params *ApplicationServiceCreateGcpPubSubIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateGcpPubSubIntegrationOK, error) + + ApplicationServiceCreateHTTPIntegration(params *ApplicationServiceCreateHTTPIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateHTTPIntegrationOK, error) + + ApplicationServiceCreateIftttIntegration(params *ApplicationServiceCreateIftttIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateIftttIntegrationOK, error) + + ApplicationServiceCreateInfluxDbIntegration(params *ApplicationServiceCreateInfluxDbIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateInfluxDbIntegrationOK, error) + + ApplicationServiceCreateMyDevicesIntegration(params *ApplicationServiceCreateMyDevicesIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateMyDevicesIntegrationOK, error) + + ApplicationServiceCreatePilotThingsIntegration(params *ApplicationServiceCreatePilotThingsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreatePilotThingsIntegrationOK, error) + + ApplicationServiceCreateThingsBoardIntegration(params *ApplicationServiceCreateThingsBoardIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateThingsBoardIntegrationOK, error) + + ApplicationServiceDelete(params *ApplicationServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteOK, error) + + ApplicationServiceDeleteAwsSnsIntegration(params *ApplicationServiceDeleteAwsSnsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteAwsSnsIntegrationOK, error) + + ApplicationServiceDeleteAzureServiceBusIntegration(params *ApplicationServiceDeleteAzureServiceBusIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteAzureServiceBusIntegrationOK, error) + + ApplicationServiceDeleteGcpPubSubIntegration(params *ApplicationServiceDeleteGcpPubSubIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteGcpPubSubIntegrationOK, error) + + ApplicationServiceDeleteHTTPIntegration(params *ApplicationServiceDeleteHTTPIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteHTTPIntegrationOK, error) + + ApplicationServiceDeleteIftttIntegration(params *ApplicationServiceDeleteIftttIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteIftttIntegrationOK, error) + + ApplicationServiceDeleteInfluxDbIntegration(params *ApplicationServiceDeleteInfluxDbIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteInfluxDbIntegrationOK, error) + + ApplicationServiceDeleteMyDevicesIntegration(params *ApplicationServiceDeleteMyDevicesIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteMyDevicesIntegrationOK, error) + + ApplicationServiceDeletePilotThingsIntegration(params *ApplicationServiceDeletePilotThingsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeletePilotThingsIntegrationOK, error) + + ApplicationServiceDeleteThingsBoardIntegration(params *ApplicationServiceDeleteThingsBoardIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteThingsBoardIntegrationOK, error) + + ApplicationServiceGenerateMqttIntegrationClientCertificate(params *ApplicationServiceGenerateMqttIntegrationClientCertificateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGenerateMqttIntegrationClientCertificateOK, error) + + ApplicationServiceGet(params *ApplicationServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetOK, error) + + ApplicationServiceGetAwsSnsIntegration(params *ApplicationServiceGetAwsSnsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetAwsSnsIntegrationOK, error) + + ApplicationServiceGetAzureServiceBusIntegration(params *ApplicationServiceGetAzureServiceBusIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetAzureServiceBusIntegrationOK, error) + + ApplicationServiceGetGcpPubSubIntegration(params *ApplicationServiceGetGcpPubSubIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetGcpPubSubIntegrationOK, error) + + ApplicationServiceGetHTTPIntegration(params *ApplicationServiceGetHTTPIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetHTTPIntegrationOK, error) + + ApplicationServiceGetIftttIntegration(params *ApplicationServiceGetIftttIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetIftttIntegrationOK, error) + + ApplicationServiceGetInfluxDbIntegration(params *ApplicationServiceGetInfluxDbIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetInfluxDbIntegrationOK, error) + + ApplicationServiceGetMyDevicesIntegration(params *ApplicationServiceGetMyDevicesIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetMyDevicesIntegrationOK, error) + + ApplicationServiceGetPilotThingsIntegration(params *ApplicationServiceGetPilotThingsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetPilotThingsIntegrationOK, error) + + ApplicationServiceGetThingsBoardIntegration(params *ApplicationServiceGetThingsBoardIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetThingsBoardIntegrationOK, error) + + ApplicationServiceList(params *ApplicationServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceListOK, error) + + ApplicationServiceListDeviceProfiles(params *ApplicationServiceListDeviceProfilesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceListDeviceProfilesOK, error) + + ApplicationServiceListDeviceTags(params *ApplicationServiceListDeviceTagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceListDeviceTagsOK, error) + + ApplicationServiceListIntegrations(params *ApplicationServiceListIntegrationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceListIntegrationsOK, error) + + ApplicationServiceUpdate(params *ApplicationServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateOK, error) + + ApplicationServiceUpdateAwsSnsIntegration(params *ApplicationServiceUpdateAwsSnsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateAwsSnsIntegrationOK, error) + + ApplicationServiceUpdateAzureServiceBusIntegration(params *ApplicationServiceUpdateAzureServiceBusIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateAzureServiceBusIntegrationOK, error) + + ApplicationServiceUpdateGcpPubSubIntegration(params *ApplicationServiceUpdateGcpPubSubIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateGcpPubSubIntegrationOK, error) + + ApplicationServiceUpdateHTTPIntegration(params *ApplicationServiceUpdateHTTPIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateHTTPIntegrationOK, error) + + ApplicationServiceUpdateIftttIntegration(params *ApplicationServiceUpdateIftttIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateIftttIntegrationOK, error) + + ApplicationServiceUpdateInfluxDbIntegration(params *ApplicationServiceUpdateInfluxDbIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateInfluxDbIntegrationOK, error) + + ApplicationServiceUpdateMyDevicesIntegration(params *ApplicationServiceUpdateMyDevicesIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateMyDevicesIntegrationOK, error) + + ApplicationServiceUpdatePilotThingsIntegration(params *ApplicationServiceUpdatePilotThingsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdatePilotThingsIntegrationOK, error) + + ApplicationServiceUpdateThingsBoardIntegration(params *ApplicationServiceUpdateThingsBoardIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateThingsBoardIntegrationOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +ApplicationServiceCreate creates creates the given application +*/ +func (a *Client) ApplicationServiceCreate(params *ApplicationServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceCreateParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_Create", + Method: "POST", + PathPattern: "/api/applications", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceCreateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceCreateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceCreateAwsSnsIntegration creates a w s s n s integration +*/ +func (a *Client) ApplicationServiceCreateAwsSnsIntegration(params *ApplicationServiceCreateAwsSnsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateAwsSnsIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceCreateAwsSnsIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_CreateAwsSnsIntegration", + Method: "POST", + PathPattern: "/api/applications/{integration.applicationId}/integrations/aws-sns", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceCreateAwsSnsIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceCreateAwsSnsIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceCreateAwsSnsIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceCreateAzureServiceBusIntegration creates azure service bus integration +*/ +func (a *Client) ApplicationServiceCreateAzureServiceBusIntegration(params *ApplicationServiceCreateAzureServiceBusIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateAzureServiceBusIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceCreateAzureServiceBusIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_CreateAzureServiceBusIntegration", + Method: "POST", + PathPattern: "/api/applications/{integration.applicationId}/integrations/azure-service-bus", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceCreateAzureServiceBusIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceCreateAzureServiceBusIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceCreateAzureServiceBusIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceCreateGcpPubSubIntegration creates g c p pub sub integration +*/ +func (a *Client) ApplicationServiceCreateGcpPubSubIntegration(params *ApplicationServiceCreateGcpPubSubIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateGcpPubSubIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceCreateGcpPubSubIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_CreateGcpPubSubIntegration", + Method: "POST", + PathPattern: "/api/applications/{integration.applicationId}/integrations/gcp-pub-sub", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceCreateGcpPubSubIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceCreateGcpPubSubIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceCreateGcpPubSubIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceCreateHTTPIntegration creates HTTP integration +*/ +func (a *Client) ApplicationServiceCreateHTTPIntegration(params *ApplicationServiceCreateHTTPIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateHTTPIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceCreateHTTPIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_CreateHttpIntegration", + Method: "POST", + PathPattern: "/api/applications/{integration.applicationId}/integrations/http", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceCreateHTTPIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceCreateHTTPIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceCreateHTTPIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceCreateIftttIntegration creates i f t t t integration +*/ +func (a *Client) ApplicationServiceCreateIftttIntegration(params *ApplicationServiceCreateIftttIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateIftttIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceCreateIftttIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_CreateIftttIntegration", + Method: "POST", + PathPattern: "/api/applications/{integration.applicationId}/integrations/ifttt", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceCreateIftttIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceCreateIftttIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceCreateIftttIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceCreateInfluxDbIntegration creates influx db integration +*/ +func (a *Client) ApplicationServiceCreateInfluxDbIntegration(params *ApplicationServiceCreateInfluxDbIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateInfluxDbIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceCreateInfluxDbIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_CreateInfluxDbIntegration", + Method: "POST", + PathPattern: "/api/applications/{integration.applicationId}/integrations/influxdb", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceCreateInfluxDbIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceCreateInfluxDbIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceCreateInfluxDbIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceCreateMyDevicesIntegration creates my devices integration +*/ +func (a *Client) ApplicationServiceCreateMyDevicesIntegration(params *ApplicationServiceCreateMyDevicesIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateMyDevicesIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceCreateMyDevicesIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_CreateMyDevicesIntegration", + Method: "POST", + PathPattern: "/api/applications/{integration.applicationId}/integrations/mydevices", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceCreateMyDevicesIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceCreateMyDevicesIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceCreateMyDevicesIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceCreatePilotThingsIntegration creates pilot things integration +*/ +func (a *Client) ApplicationServiceCreatePilotThingsIntegration(params *ApplicationServiceCreatePilotThingsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreatePilotThingsIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceCreatePilotThingsIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_CreatePilotThingsIntegration", + Method: "POST", + PathPattern: "/api/applications/{integration.applicationId}/integrations/pilot-things", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceCreatePilotThingsIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceCreatePilotThingsIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceCreatePilotThingsIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceCreateThingsBoardIntegration creates things board integration +*/ +func (a *Client) ApplicationServiceCreateThingsBoardIntegration(params *ApplicationServiceCreateThingsBoardIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceCreateThingsBoardIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceCreateThingsBoardIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_CreateThingsBoardIntegration", + Method: "POST", + PathPattern: "/api/applications/{integration.applicationId}/integrations/thingsboard", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceCreateThingsBoardIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceCreateThingsBoardIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceCreateThingsBoardIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceDelete deletes the application for the given ID +*/ +func (a *Client) ApplicationServiceDelete(params *ApplicationServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_Delete", + Method: "DELETE", + PathPattern: "/api/applications/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceDeleteOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceDeleteDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceDeleteAwsSnsIntegration deletes a w s s n s integration +*/ +func (a *Client) ApplicationServiceDeleteAwsSnsIntegration(params *ApplicationServiceDeleteAwsSnsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteAwsSnsIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceDeleteAwsSnsIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_DeleteAwsSnsIntegration", + Method: "DELETE", + PathPattern: "/api/applications/{applicationId}/integrations/aws-sns", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceDeleteAwsSnsIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceDeleteAwsSnsIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceDeleteAwsSnsIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceDeleteAzureServiceBusIntegration deletes azure service bus integration +*/ +func (a *Client) ApplicationServiceDeleteAzureServiceBusIntegration(params *ApplicationServiceDeleteAzureServiceBusIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteAzureServiceBusIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceDeleteAzureServiceBusIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_DeleteAzureServiceBusIntegration", + Method: "DELETE", + PathPattern: "/api/applications/{applicationId}/integrations/azure-service-bus", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceDeleteAzureServiceBusIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceDeleteAzureServiceBusIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceDeleteAzureServiceBusIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceDeleteGcpPubSubIntegration deletes g c p pub sub integration +*/ +func (a *Client) ApplicationServiceDeleteGcpPubSubIntegration(params *ApplicationServiceDeleteGcpPubSubIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteGcpPubSubIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceDeleteGcpPubSubIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_DeleteGcpPubSubIntegration", + Method: "DELETE", + PathPattern: "/api/applications/{applicationId}/integrations/gcp-pub-sub", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceDeleteGcpPubSubIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceDeleteGcpPubSubIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceDeleteGcpPubSubIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceDeleteHTTPIntegration deletes the HTTP integration +*/ +func (a *Client) ApplicationServiceDeleteHTTPIntegration(params *ApplicationServiceDeleteHTTPIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteHTTPIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceDeleteHTTPIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_DeleteHttpIntegration", + Method: "DELETE", + PathPattern: "/api/applications/{applicationId}/integrations/http", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceDeleteHTTPIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceDeleteHTTPIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceDeleteHTTPIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceDeleteIftttIntegration deletes i f t t t integration +*/ +func (a *Client) ApplicationServiceDeleteIftttIntegration(params *ApplicationServiceDeleteIftttIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteIftttIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceDeleteIftttIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_DeleteIftttIntegration", + Method: "DELETE", + PathPattern: "/api/applications/{applicationId}/integrations/ifttt", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceDeleteIftttIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceDeleteIftttIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceDeleteIftttIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceDeleteInfluxDbIntegration deletes influx db integration +*/ +func (a *Client) ApplicationServiceDeleteInfluxDbIntegration(params *ApplicationServiceDeleteInfluxDbIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteInfluxDbIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceDeleteInfluxDbIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_DeleteInfluxDbIntegration", + Method: "DELETE", + PathPattern: "/api/applications/{applicationId}/integrations/influxdb", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceDeleteInfluxDbIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceDeleteInfluxDbIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceDeleteInfluxDbIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceDeleteMyDevicesIntegration deletes my devices integration +*/ +func (a *Client) ApplicationServiceDeleteMyDevicesIntegration(params *ApplicationServiceDeleteMyDevicesIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteMyDevicesIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceDeleteMyDevicesIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_DeleteMyDevicesIntegration", + Method: "DELETE", + PathPattern: "/api/applications/{applicationId}/integrations/mydevices", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceDeleteMyDevicesIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceDeleteMyDevicesIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceDeleteMyDevicesIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceDeletePilotThingsIntegration deletes pilot things integration +*/ +func (a *Client) ApplicationServiceDeletePilotThingsIntegration(params *ApplicationServiceDeletePilotThingsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeletePilotThingsIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceDeletePilotThingsIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_DeletePilotThingsIntegration", + Method: "DELETE", + PathPattern: "/api/applications/{applicationId}/integrations/pilot-things", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceDeletePilotThingsIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceDeletePilotThingsIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceDeletePilotThingsIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceDeleteThingsBoardIntegration deletes things board integration +*/ +func (a *Client) ApplicationServiceDeleteThingsBoardIntegration(params *ApplicationServiceDeleteThingsBoardIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceDeleteThingsBoardIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceDeleteThingsBoardIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_DeleteThingsBoardIntegration", + Method: "DELETE", + PathPattern: "/api/applications/{applicationId}/integrations/thingsboard", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceDeleteThingsBoardIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceDeleteThingsBoardIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceDeleteThingsBoardIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceGenerateMqttIntegrationClientCertificate generates application ID specific client certificate +*/ +func (a *Client) ApplicationServiceGenerateMqttIntegrationClientCertificate(params *ApplicationServiceGenerateMqttIntegrationClientCertificateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGenerateMqttIntegrationClientCertificateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceGenerateMqttIntegrationClientCertificateParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_GenerateMqttIntegrationClientCertificate", + Method: "POST", + PathPattern: "/api/applications/{applicationId}/integrations/mqtt/certificate", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceGenerateMqttIntegrationClientCertificateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceGenerateMqttIntegrationClientCertificateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceGet gets the application for the given ID +*/ +func (a *Client) ApplicationServiceGet(params *ApplicationServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceGetParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_Get", + Method: "GET", + PathPattern: "/api/applications/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceGetOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceGetDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceGetAwsSnsIntegration gets a w s s n s integration +*/ +func (a *Client) ApplicationServiceGetAwsSnsIntegration(params *ApplicationServiceGetAwsSnsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetAwsSnsIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceGetAwsSnsIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_GetAwsSnsIntegration", + Method: "GET", + PathPattern: "/api/applications/{applicationId}/integrations/aws-sns", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceGetAwsSnsIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceGetAwsSnsIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceGetAwsSnsIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceGetAzureServiceBusIntegration gets azure service bus integration +*/ +func (a *Client) ApplicationServiceGetAzureServiceBusIntegration(params *ApplicationServiceGetAzureServiceBusIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetAzureServiceBusIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceGetAzureServiceBusIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_GetAzureServiceBusIntegration", + Method: "GET", + PathPattern: "/api/applications/{applicationId}/integrations/azure-service-bus", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceGetAzureServiceBusIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceGetAzureServiceBusIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceGetAzureServiceBusIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceGetGcpPubSubIntegration gets g c p pub sub integration +*/ +func (a *Client) ApplicationServiceGetGcpPubSubIntegration(params *ApplicationServiceGetGcpPubSubIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetGcpPubSubIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceGetGcpPubSubIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_GetGcpPubSubIntegration", + Method: "GET", + PathPattern: "/api/applications/{applicationId}/integrations/gcp-pub-sub", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceGetGcpPubSubIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceGetGcpPubSubIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceGetGcpPubSubIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceGetHTTPIntegration gets the configured HTTP integration +*/ +func (a *Client) ApplicationServiceGetHTTPIntegration(params *ApplicationServiceGetHTTPIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetHTTPIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceGetHTTPIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_GetHttpIntegration", + Method: "GET", + PathPattern: "/api/applications/{applicationId}/integrations/http", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceGetHTTPIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceGetHTTPIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceGetHTTPIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceGetIftttIntegration gets i f t t t integration +*/ +func (a *Client) ApplicationServiceGetIftttIntegration(params *ApplicationServiceGetIftttIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetIftttIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceGetIftttIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_GetIftttIntegration", + Method: "GET", + PathPattern: "/api/applications/{applicationId}/integrations/ifttt", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceGetIftttIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceGetIftttIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceGetIftttIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceGetInfluxDbIntegration gets influx db integration +*/ +func (a *Client) ApplicationServiceGetInfluxDbIntegration(params *ApplicationServiceGetInfluxDbIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetInfluxDbIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceGetInfluxDbIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_GetInfluxDbIntegration", + Method: "GET", + PathPattern: "/api/applications/{applicationId}/integrations/influxdb", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceGetInfluxDbIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceGetInfluxDbIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceGetInfluxDbIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceGetMyDevicesIntegration gets my devices integration +*/ +func (a *Client) ApplicationServiceGetMyDevicesIntegration(params *ApplicationServiceGetMyDevicesIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetMyDevicesIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceGetMyDevicesIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_GetMyDevicesIntegration", + Method: "GET", + PathPattern: "/api/applications/{applicationId}/integrations/mydevices", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceGetMyDevicesIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceGetMyDevicesIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceGetMyDevicesIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceGetPilotThingsIntegration gets pilot things integration +*/ +func (a *Client) ApplicationServiceGetPilotThingsIntegration(params *ApplicationServiceGetPilotThingsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetPilotThingsIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceGetPilotThingsIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_GetPilotThingsIntegration", + Method: "GET", + PathPattern: "/api/applications/{applicationId}/integrations/pilot-things", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceGetPilotThingsIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceGetPilotThingsIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceGetPilotThingsIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceGetThingsBoardIntegration gets things board integration +*/ +func (a *Client) ApplicationServiceGetThingsBoardIntegration(params *ApplicationServiceGetThingsBoardIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceGetThingsBoardIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceGetThingsBoardIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_GetThingsBoardIntegration", + Method: "GET", + PathPattern: "/api/applications/{applicationId}/integrations/thingsboard", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceGetThingsBoardIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceGetThingsBoardIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceGetThingsBoardIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceList gets the list of applications +*/ +func (a *Client) ApplicationServiceList(params *ApplicationServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceListParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_List", + Method: "GET", + PathPattern: "/api/applications", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceListReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceListOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceListDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceListDeviceProfiles lists device profiles used within the given application +*/ +func (a *Client) ApplicationServiceListDeviceProfiles(params *ApplicationServiceListDeviceProfilesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceListDeviceProfilesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceListDeviceProfilesParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_ListDeviceProfiles", + Method: "GET", + PathPattern: "/api/applications/{applicationId}/device-profiles", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceListDeviceProfilesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceListDeviceProfilesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceListDeviceProfilesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceListDeviceTags lists device tags used within the given application +*/ +func (a *Client) ApplicationServiceListDeviceTags(params *ApplicationServiceListDeviceTagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceListDeviceTagsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceListDeviceTagsParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_ListDeviceTags", + Method: "GET", + PathPattern: "/api/applications/{applicationId}/device-tags", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceListDeviceTagsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceListDeviceTagsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceListDeviceTagsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceListIntegrations lists all configured integrations +*/ +func (a *Client) ApplicationServiceListIntegrations(params *ApplicationServiceListIntegrationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceListIntegrationsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceListIntegrationsParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_ListIntegrations", + Method: "GET", + PathPattern: "/api/applications/{applicationId}/integrations", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceListIntegrationsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceListIntegrationsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceListIntegrationsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceUpdate updates updates the given application +*/ +func (a *Client) ApplicationServiceUpdate(params *ApplicationServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_Update", + Method: "PUT", + PathPattern: "/api/applications/{application.id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceUpdateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceUpdateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceUpdateAwsSnsIntegration updates a w s s n s integration +*/ +func (a *Client) ApplicationServiceUpdateAwsSnsIntegration(params *ApplicationServiceUpdateAwsSnsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateAwsSnsIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceUpdateAwsSnsIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_UpdateAwsSnsIntegration", + Method: "PUT", + PathPattern: "/api/applications/{integration.applicationId}/integrations/aws-sns", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceUpdateAwsSnsIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceUpdateAwsSnsIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceUpdateAwsSnsIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceUpdateAzureServiceBusIntegration updates azure service bus integration +*/ +func (a *Client) ApplicationServiceUpdateAzureServiceBusIntegration(params *ApplicationServiceUpdateAzureServiceBusIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateAzureServiceBusIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceUpdateAzureServiceBusIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_UpdateAzureServiceBusIntegration", + Method: "PUT", + PathPattern: "/api/applications/{integration.applicationId}/integrations/azure-service-bus", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceUpdateAzureServiceBusIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceUpdateAzureServiceBusIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceUpdateAzureServiceBusIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceUpdateGcpPubSubIntegration updates g c p pub sub integration +*/ +func (a *Client) ApplicationServiceUpdateGcpPubSubIntegration(params *ApplicationServiceUpdateGcpPubSubIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateGcpPubSubIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceUpdateGcpPubSubIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_UpdateGcpPubSubIntegration", + Method: "PUT", + PathPattern: "/api/applications/{integration.applicationId}/integrations/gcp-pub-sub", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceUpdateGcpPubSubIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceUpdateGcpPubSubIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceUpdateGcpPubSubIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceUpdateHTTPIntegration updates the HTTP integration +*/ +func (a *Client) ApplicationServiceUpdateHTTPIntegration(params *ApplicationServiceUpdateHTTPIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateHTTPIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceUpdateHTTPIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_UpdateHttpIntegration", + Method: "PUT", + PathPattern: "/api/applications/{integration.applicationId}/integrations/http", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceUpdateHTTPIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceUpdateHTTPIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceUpdateHTTPIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceUpdateIftttIntegration updates i f t t t integration +*/ +func (a *Client) ApplicationServiceUpdateIftttIntegration(params *ApplicationServiceUpdateIftttIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateIftttIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceUpdateIftttIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_UpdateIftttIntegration", + Method: "PUT", + PathPattern: "/api/applications/{integration.applicationId}/integrations/ifttt", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceUpdateIftttIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceUpdateIftttIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceUpdateIftttIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceUpdateInfluxDbIntegration updates influx db integration +*/ +func (a *Client) ApplicationServiceUpdateInfluxDbIntegration(params *ApplicationServiceUpdateInfluxDbIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateInfluxDbIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceUpdateInfluxDbIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_UpdateInfluxDbIntegration", + Method: "PUT", + PathPattern: "/api/applications/{integration.applicationId}/integrations/influxdb", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceUpdateInfluxDbIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceUpdateInfluxDbIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceUpdateInfluxDbIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceUpdateMyDevicesIntegration updates my devices integration +*/ +func (a *Client) ApplicationServiceUpdateMyDevicesIntegration(params *ApplicationServiceUpdateMyDevicesIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateMyDevicesIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceUpdateMyDevicesIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_UpdateMyDevicesIntegration", + Method: "PUT", + PathPattern: "/api/applications/{integration.applicationId}/integrations/mydevices", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceUpdateMyDevicesIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceUpdateMyDevicesIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceUpdateMyDevicesIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceUpdatePilotThingsIntegration updates pilot things integration +*/ +func (a *Client) ApplicationServiceUpdatePilotThingsIntegration(params *ApplicationServiceUpdatePilotThingsIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdatePilotThingsIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceUpdatePilotThingsIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_UpdatePilotThingsIntegration", + Method: "PUT", + PathPattern: "/api/applications/{integration.applicationId}/integrations/pilot-things", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceUpdatePilotThingsIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceUpdatePilotThingsIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceUpdatePilotThingsIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ApplicationServiceUpdateThingsBoardIntegration updates things board integration +*/ +func (a *Client) ApplicationServiceUpdateThingsBoardIntegration(params *ApplicationServiceUpdateThingsBoardIntegrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ApplicationServiceUpdateThingsBoardIntegrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewApplicationServiceUpdateThingsBoardIntegrationParams() + } + op := &runtime.ClientOperation{ + ID: "ApplicationService_UpdateThingsBoardIntegration", + Method: "PUT", + PathPattern: "/api/applications/{integration.applicationId}/integrations/thingsboard", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ApplicationServiceUpdateThingsBoardIntegrationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ApplicationServiceUpdateThingsBoardIntegrationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ApplicationServiceUpdateThingsBoardIntegrationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_aws_sns_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_aws_sns_integration_parameters.go new file mode 100644 index 0000000..864edfa --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_aws_sns_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceCreateAwsSnsIntegrationParams creates a new ApplicationServiceCreateAwsSnsIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceCreateAwsSnsIntegrationParams() *ApplicationServiceCreateAwsSnsIntegrationParams { + return &ApplicationServiceCreateAwsSnsIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceCreateAwsSnsIntegrationParamsWithTimeout creates a new ApplicationServiceCreateAwsSnsIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceCreateAwsSnsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateAwsSnsIntegrationParams { + return &ApplicationServiceCreateAwsSnsIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceCreateAwsSnsIntegrationParamsWithContext creates a new ApplicationServiceCreateAwsSnsIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceCreateAwsSnsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateAwsSnsIntegrationParams { + return &ApplicationServiceCreateAwsSnsIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceCreateAwsSnsIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateAwsSnsIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceCreateAwsSnsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateAwsSnsIntegrationParams { + return &ApplicationServiceCreateAwsSnsIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceCreateAwsSnsIntegrationParams contains all the parameters to send to the API endpoint + + for the application service create aws sns integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceCreateAwsSnsIntegrationParams struct { + + // Body. + Body ApplicationServiceCreateAwsSnsIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service create aws sns integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WithDefaults() *ApplicationServiceCreateAwsSnsIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service create aws sns integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateAwsSnsIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service create aws sns integration params +func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateAwsSnsIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service create aws sns integration params +func (o *ApplicationServiceCreateAwsSnsIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service create aws sns integration params +func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateAwsSnsIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service create aws sns integration params +func (o *ApplicationServiceCreateAwsSnsIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service create aws sns integration params +func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateAwsSnsIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service create aws sns integration params +func (o *ApplicationServiceCreateAwsSnsIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service create aws sns integration params +func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WithBody(body ApplicationServiceCreateAwsSnsIntegrationBody) *ApplicationServiceCreateAwsSnsIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service create aws sns integration params +func (o *ApplicationServiceCreateAwsSnsIntegrationParams) SetBody(body ApplicationServiceCreateAwsSnsIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service create aws sns integration params +func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateAwsSnsIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service create aws sns integration params +func (o *ApplicationServiceCreateAwsSnsIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceCreateAwsSnsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_aws_sns_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_aws_sns_integration_responses.go new file mode 100644 index 0000000..1d05975 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_aws_sns_integration_responses.go @@ -0,0 +1,392 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceCreateAwsSnsIntegrationReader is a Reader for the ApplicationServiceCreateAwsSnsIntegration structure. +type ApplicationServiceCreateAwsSnsIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceCreateAwsSnsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceCreateAwsSnsIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceCreateAwsSnsIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceCreateAwsSnsIntegrationOK creates a ApplicationServiceCreateAwsSnsIntegrationOK with default headers values +func NewApplicationServiceCreateAwsSnsIntegrationOK() *ApplicationServiceCreateAwsSnsIntegrationOK { + return &ApplicationServiceCreateAwsSnsIntegrationOK{} +} + +/* +ApplicationServiceCreateAwsSnsIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceCreateAwsSnsIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service create aws sns integration o k response has a 2xx status code +func (o *ApplicationServiceCreateAwsSnsIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service create aws sns integration o k response has a 3xx status code +func (o *ApplicationServiceCreateAwsSnsIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service create aws sns integration o k response has a 4xx status code +func (o *ApplicationServiceCreateAwsSnsIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service create aws sns integration o k response has a 5xx status code +func (o *ApplicationServiceCreateAwsSnsIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service create aws sns integration o k response a status code equal to that given +func (o *ApplicationServiceCreateAwsSnsIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service create aws sns integration o k response +func (o *ApplicationServiceCreateAwsSnsIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceCreateAwsSnsIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/aws-sns][%d] applicationServiceCreateAwsSnsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateAwsSnsIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/aws-sns][%d] applicationServiceCreateAwsSnsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateAwsSnsIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceCreateAwsSnsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceCreateAwsSnsIntegrationDefault creates a ApplicationServiceCreateAwsSnsIntegrationDefault with default headers values +func NewApplicationServiceCreateAwsSnsIntegrationDefault(code int) *ApplicationServiceCreateAwsSnsIntegrationDefault { + return &ApplicationServiceCreateAwsSnsIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceCreateAwsSnsIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceCreateAwsSnsIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service create aws sns integration default response has a 2xx status code +func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service create aws sns integration default response has a 3xx status code +func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service create aws sns integration default response has a 4xx status code +func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service create aws sns integration default response has a 5xx status code +func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service create aws sns integration default response a status code equal to that given +func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service create aws sns integration default response +func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/aws-sns][%d] ApplicationService_CreateAwsSnsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/aws-sns][%d] ApplicationService_CreateAwsSnsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceCreateAwsSnsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceCreateAwsSnsIntegrationBody application service create aws sns integration body +swagger:model ApplicationServiceCreateAwsSnsIntegrationBody +*/ +type ApplicationServiceCreateAwsSnsIntegrationBody struct { + + // integration + Integration *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service create aws sns integration body +func (o *ApplicationServiceCreateAwsSnsIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateAwsSnsIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create aws sns integration body based on the context it is used +func (o *ApplicationServiceCreateAwsSnsIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateAwsSnsIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateAwsSnsIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateAwsSnsIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateAwsSnsIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration Integration object to create. +swagger:model ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration +*/ +type ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration struct { + + // AWS Access Key ID. + AccessKeyID string `json:"accessKeyId,omitempty"` + + // Encoding. + Encoding *models.APIEncoding `json:"encoding,omitempty"` + + // AWS region. + Region string `json:"region,omitempty"` + + // AWS Secret Access Key. + SecretAccessKey string `json:"secretAccessKey,omitempty"` + + // Topic ARN. + TopicArn string `json:"topicArn,omitempty"` +} + +// Validate validates this application service create aws sns integration params body integration +func (o *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateEncoding(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error { + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if o.Encoding != nil { + if err := o.Encoding.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create aws sns integration params body integration based on the context it is used +func (o *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateEncoding(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error { + + if o.Encoding != nil { + + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if err := o.Encoding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateAwsSnsIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_azure_service_bus_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_azure_service_bus_integration_parameters.go new file mode 100644 index 0000000..50aa37a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_azure_service_bus_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceCreateAzureServiceBusIntegrationParams creates a new ApplicationServiceCreateAzureServiceBusIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceCreateAzureServiceBusIntegrationParams() *ApplicationServiceCreateAzureServiceBusIntegrationParams { + return &ApplicationServiceCreateAzureServiceBusIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceCreateAzureServiceBusIntegrationParamsWithTimeout creates a new ApplicationServiceCreateAzureServiceBusIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceCreateAzureServiceBusIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateAzureServiceBusIntegrationParams { + return &ApplicationServiceCreateAzureServiceBusIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceCreateAzureServiceBusIntegrationParamsWithContext creates a new ApplicationServiceCreateAzureServiceBusIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceCreateAzureServiceBusIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateAzureServiceBusIntegrationParams { + return &ApplicationServiceCreateAzureServiceBusIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceCreateAzureServiceBusIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateAzureServiceBusIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceCreateAzureServiceBusIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateAzureServiceBusIntegrationParams { + return &ApplicationServiceCreateAzureServiceBusIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceCreateAzureServiceBusIntegrationParams contains all the parameters to send to the API endpoint + + for the application service create azure service bus integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceCreateAzureServiceBusIntegrationParams struct { + + // Body. + Body ApplicationServiceCreateAzureServiceBusIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service create azure service bus integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WithDefaults() *ApplicationServiceCreateAzureServiceBusIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service create azure service bus integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service create azure service bus integration params +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateAzureServiceBusIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service create azure service bus integration params +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service create azure service bus integration params +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateAzureServiceBusIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service create azure service bus integration params +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service create azure service bus integration params +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateAzureServiceBusIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service create azure service bus integration params +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service create azure service bus integration params +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WithBody(body ApplicationServiceCreateAzureServiceBusIntegrationBody) *ApplicationServiceCreateAzureServiceBusIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service create azure service bus integration params +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) SetBody(body ApplicationServiceCreateAzureServiceBusIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service create azure service bus integration params +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateAzureServiceBusIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service create azure service bus integration params +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_azure_service_bus_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_azure_service_bus_integration_responses.go new file mode 100644 index 0000000..d95237b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_azure_service_bus_integration_responses.go @@ -0,0 +1,387 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceCreateAzureServiceBusIntegrationReader is a Reader for the ApplicationServiceCreateAzureServiceBusIntegration structure. +type ApplicationServiceCreateAzureServiceBusIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceCreateAzureServiceBusIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceCreateAzureServiceBusIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceCreateAzureServiceBusIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceCreateAzureServiceBusIntegrationOK creates a ApplicationServiceCreateAzureServiceBusIntegrationOK with default headers values +func NewApplicationServiceCreateAzureServiceBusIntegrationOK() *ApplicationServiceCreateAzureServiceBusIntegrationOK { + return &ApplicationServiceCreateAzureServiceBusIntegrationOK{} +} + +/* +ApplicationServiceCreateAzureServiceBusIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceCreateAzureServiceBusIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service create azure service bus integration o k response has a 2xx status code +func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service create azure service bus integration o k response has a 3xx status code +func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service create azure service bus integration o k response has a 4xx status code +func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service create azure service bus integration o k response has a 5xx status code +func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service create azure service bus integration o k response a status code equal to that given +func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service create azure service bus integration o k response +func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] applicationServiceCreateAzureServiceBusIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] applicationServiceCreateAzureServiceBusIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceCreateAzureServiceBusIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceCreateAzureServiceBusIntegrationDefault creates a ApplicationServiceCreateAzureServiceBusIntegrationDefault with default headers values +func NewApplicationServiceCreateAzureServiceBusIntegrationDefault(code int) *ApplicationServiceCreateAzureServiceBusIntegrationDefault { + return &ApplicationServiceCreateAzureServiceBusIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceCreateAzureServiceBusIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceCreateAzureServiceBusIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service create azure service bus integration default response has a 2xx status code +func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service create azure service bus integration default response has a 3xx status code +func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service create azure service bus integration default response has a 4xx status code +func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service create azure service bus integration default response has a 5xx status code +func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service create azure service bus integration default response a status code equal to that given +func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service create azure service bus integration default response +func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] ApplicationService_CreateAzureServiceBusIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] ApplicationService_CreateAzureServiceBusIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceCreateAzureServiceBusIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceCreateAzureServiceBusIntegrationBody application service create azure service bus integration body +swagger:model ApplicationServiceCreateAzureServiceBusIntegrationBody +*/ +type ApplicationServiceCreateAzureServiceBusIntegrationBody struct { + + // integration + Integration *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service create azure service bus integration body +func (o *ApplicationServiceCreateAzureServiceBusIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateAzureServiceBusIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create azure service bus integration body based on the context it is used +func (o *ApplicationServiceCreateAzureServiceBusIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateAzureServiceBusIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateAzureServiceBusIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateAzureServiceBusIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateAzureServiceBusIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration Integration object to create. +swagger:model ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration +*/ +type ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration struct { + + // Connection string. + ConnectionString string `json:"connectionString,omitempty"` + + // Encoding. + Encoding *models.APIEncoding `json:"encoding,omitempty"` + + // Publish name. + // This is the name of the topic or queue. + PublishName string `json:"publishName,omitempty"` +} + +// Validate validates this application service create azure service bus integration params body integration +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateEncoding(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error { + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if o.Encoding != nil { + if err := o.Encoding.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create azure service bus integration params body integration based on the context it is used +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateEncoding(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error { + + if o.Encoding != nil { + + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if err := o.Encoding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateAzureServiceBusIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_gcp_pub_sub_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_gcp_pub_sub_integration_parameters.go new file mode 100644 index 0000000..1699514 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_gcp_pub_sub_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceCreateGcpPubSubIntegrationParams creates a new ApplicationServiceCreateGcpPubSubIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceCreateGcpPubSubIntegrationParams() *ApplicationServiceCreateGcpPubSubIntegrationParams { + return &ApplicationServiceCreateGcpPubSubIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceCreateGcpPubSubIntegrationParamsWithTimeout creates a new ApplicationServiceCreateGcpPubSubIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceCreateGcpPubSubIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateGcpPubSubIntegrationParams { + return &ApplicationServiceCreateGcpPubSubIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceCreateGcpPubSubIntegrationParamsWithContext creates a new ApplicationServiceCreateGcpPubSubIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceCreateGcpPubSubIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateGcpPubSubIntegrationParams { + return &ApplicationServiceCreateGcpPubSubIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceCreateGcpPubSubIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateGcpPubSubIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceCreateGcpPubSubIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateGcpPubSubIntegrationParams { + return &ApplicationServiceCreateGcpPubSubIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceCreateGcpPubSubIntegrationParams contains all the parameters to send to the API endpoint + + for the application service create gcp pub sub integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceCreateGcpPubSubIntegrationParams struct { + + // Body. + Body ApplicationServiceCreateGcpPubSubIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service create gcp pub sub integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WithDefaults() *ApplicationServiceCreateGcpPubSubIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service create gcp pub sub integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service create gcp pub sub integration params +func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateGcpPubSubIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service create gcp pub sub integration params +func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service create gcp pub sub integration params +func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateGcpPubSubIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service create gcp pub sub integration params +func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service create gcp pub sub integration params +func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateGcpPubSubIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service create gcp pub sub integration params +func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service create gcp pub sub integration params +func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WithBody(body ApplicationServiceCreateGcpPubSubIntegrationBody) *ApplicationServiceCreateGcpPubSubIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service create gcp pub sub integration params +func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) SetBody(body ApplicationServiceCreateGcpPubSubIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service create gcp pub sub integration params +func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateGcpPubSubIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service create gcp pub sub integration params +func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceCreateGcpPubSubIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_gcp_pub_sub_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_gcp_pub_sub_integration_responses.go new file mode 100644 index 0000000..cca499f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_gcp_pub_sub_integration_responses.go @@ -0,0 +1,393 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceCreateGcpPubSubIntegrationReader is a Reader for the ApplicationServiceCreateGcpPubSubIntegration structure. +type ApplicationServiceCreateGcpPubSubIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceCreateGcpPubSubIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceCreateGcpPubSubIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceCreateGcpPubSubIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceCreateGcpPubSubIntegrationOK creates a ApplicationServiceCreateGcpPubSubIntegrationOK with default headers values +func NewApplicationServiceCreateGcpPubSubIntegrationOK() *ApplicationServiceCreateGcpPubSubIntegrationOK { + return &ApplicationServiceCreateGcpPubSubIntegrationOK{} +} + +/* +ApplicationServiceCreateGcpPubSubIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceCreateGcpPubSubIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service create gcp pub sub integration o k response has a 2xx status code +func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service create gcp pub sub integration o k response has a 3xx status code +func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service create gcp pub sub integration o k response has a 4xx status code +func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service create gcp pub sub integration o k response has a 5xx status code +func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service create gcp pub sub integration o k response a status code equal to that given +func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service create gcp pub sub integration o k response +func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] applicationServiceCreateGcpPubSubIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] applicationServiceCreateGcpPubSubIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceCreateGcpPubSubIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceCreateGcpPubSubIntegrationDefault creates a ApplicationServiceCreateGcpPubSubIntegrationDefault with default headers values +func NewApplicationServiceCreateGcpPubSubIntegrationDefault(code int) *ApplicationServiceCreateGcpPubSubIntegrationDefault { + return &ApplicationServiceCreateGcpPubSubIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceCreateGcpPubSubIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceCreateGcpPubSubIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service create gcp pub sub integration default response has a 2xx status code +func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service create gcp pub sub integration default response has a 3xx status code +func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service create gcp pub sub integration default response has a 4xx status code +func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service create gcp pub sub integration default response has a 5xx status code +func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service create gcp pub sub integration default response a status code equal to that given +func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service create gcp pub sub integration default response +func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_CreateGcpPubSubIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_CreateGcpPubSubIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceCreateGcpPubSubIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceCreateGcpPubSubIntegrationBody application service create gcp pub sub integration body +swagger:model ApplicationServiceCreateGcpPubSubIntegrationBody +*/ +type ApplicationServiceCreateGcpPubSubIntegrationBody struct { + + // integration + Integration *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service create gcp pub sub integration body +func (o *ApplicationServiceCreateGcpPubSubIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateGcpPubSubIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create gcp pub sub integration body based on the context it is used +func (o *ApplicationServiceCreateGcpPubSubIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateGcpPubSubIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateGcpPubSubIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateGcpPubSubIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateGcpPubSubIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration Integration object to create. +swagger:model ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration +*/ +type ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration struct { + + // Credentials file. + // This IAM service-account credentials file (JSON) must have the following + // Pub/Sub roles: + // * Pub/Sub Publisher + CredentialsFile string `json:"credentialsFile,omitempty"` + + // Encoding. + Encoding *models.APIEncoding `json:"encoding,omitempty"` + + // Project ID. + ProjectID string `json:"projectId,omitempty"` + + // Topic name. + // This is the name of the Pub/Sub topic. + TopicName string `json:"topicName,omitempty"` +} + +// Validate validates this application service create gcp pub sub integration params body integration +func (o *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateEncoding(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error { + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if o.Encoding != nil { + if err := o.Encoding.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create gcp pub sub integration params body integration based on the context it is used +func (o *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateEncoding(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error { + + if o.Encoding != nil { + + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if err := o.Encoding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateGcpPubSubIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_http_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_http_integration_parameters.go new file mode 100644 index 0000000..f338894 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_http_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceCreateHTTPIntegrationParams creates a new ApplicationServiceCreateHTTPIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceCreateHTTPIntegrationParams() *ApplicationServiceCreateHTTPIntegrationParams { + return &ApplicationServiceCreateHTTPIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceCreateHTTPIntegrationParamsWithTimeout creates a new ApplicationServiceCreateHTTPIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceCreateHTTPIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateHTTPIntegrationParams { + return &ApplicationServiceCreateHTTPIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceCreateHTTPIntegrationParamsWithContext creates a new ApplicationServiceCreateHTTPIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceCreateHTTPIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateHTTPIntegrationParams { + return &ApplicationServiceCreateHTTPIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceCreateHTTPIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateHTTPIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceCreateHTTPIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateHTTPIntegrationParams { + return &ApplicationServiceCreateHTTPIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceCreateHTTPIntegrationParams contains all the parameters to send to the API endpoint + + for the application service create Http integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceCreateHTTPIntegrationParams struct { + + // Body. + Body ApplicationServiceCreateHTTPIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service create Http integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateHTTPIntegrationParams) WithDefaults() *ApplicationServiceCreateHTTPIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service create Http integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateHTTPIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service create Http integration params +func (o *ApplicationServiceCreateHTTPIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateHTTPIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service create Http integration params +func (o *ApplicationServiceCreateHTTPIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service create Http integration params +func (o *ApplicationServiceCreateHTTPIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateHTTPIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service create Http integration params +func (o *ApplicationServiceCreateHTTPIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service create Http integration params +func (o *ApplicationServiceCreateHTTPIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateHTTPIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service create Http integration params +func (o *ApplicationServiceCreateHTTPIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service create Http integration params +func (o *ApplicationServiceCreateHTTPIntegrationParams) WithBody(body ApplicationServiceCreateHTTPIntegrationBody) *ApplicationServiceCreateHTTPIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service create Http integration params +func (o *ApplicationServiceCreateHTTPIntegrationParams) SetBody(body ApplicationServiceCreateHTTPIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service create Http integration params +func (o *ApplicationServiceCreateHTTPIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateHTTPIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service create Http integration params +func (o *ApplicationServiceCreateHTTPIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceCreateHTTPIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_http_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_http_integration_responses.go new file mode 100644 index 0000000..5975856 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_http_integration_responses.go @@ -0,0 +1,389 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceCreateHTTPIntegrationReader is a Reader for the ApplicationServiceCreateHTTPIntegration structure. +type ApplicationServiceCreateHTTPIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceCreateHTTPIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceCreateHTTPIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceCreateHTTPIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceCreateHTTPIntegrationOK creates a ApplicationServiceCreateHTTPIntegrationOK with default headers values +func NewApplicationServiceCreateHTTPIntegrationOK() *ApplicationServiceCreateHTTPIntegrationOK { + return &ApplicationServiceCreateHTTPIntegrationOK{} +} + +/* +ApplicationServiceCreateHTTPIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceCreateHTTPIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service create Http integration o k response has a 2xx status code +func (o *ApplicationServiceCreateHTTPIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service create Http integration o k response has a 3xx status code +func (o *ApplicationServiceCreateHTTPIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service create Http integration o k response has a 4xx status code +func (o *ApplicationServiceCreateHTTPIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service create Http integration o k response has a 5xx status code +func (o *ApplicationServiceCreateHTTPIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service create Http integration o k response a status code equal to that given +func (o *ApplicationServiceCreateHTTPIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service create Http integration o k response +func (o *ApplicationServiceCreateHTTPIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceCreateHTTPIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/http][%d] applicationServiceCreateHttpIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateHTTPIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/http][%d] applicationServiceCreateHttpIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateHTTPIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceCreateHTTPIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceCreateHTTPIntegrationDefault creates a ApplicationServiceCreateHTTPIntegrationDefault with default headers values +func NewApplicationServiceCreateHTTPIntegrationDefault(code int) *ApplicationServiceCreateHTTPIntegrationDefault { + return &ApplicationServiceCreateHTTPIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceCreateHTTPIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceCreateHTTPIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service create Http integration default response has a 2xx status code +func (o *ApplicationServiceCreateHTTPIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service create Http integration default response has a 3xx status code +func (o *ApplicationServiceCreateHTTPIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service create Http integration default response has a 4xx status code +func (o *ApplicationServiceCreateHTTPIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service create Http integration default response has a 5xx status code +func (o *ApplicationServiceCreateHTTPIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service create Http integration default response a status code equal to that given +func (o *ApplicationServiceCreateHTTPIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service create Http integration default response +func (o *ApplicationServiceCreateHTTPIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceCreateHTTPIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/http][%d] ApplicationService_CreateHttpIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateHTTPIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/http][%d] ApplicationService_CreateHttpIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateHTTPIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceCreateHTTPIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceCreateHTTPIntegrationBody application service create HTTP integration body +swagger:model ApplicationServiceCreateHTTPIntegrationBody +*/ +type ApplicationServiceCreateHTTPIntegrationBody struct { + + // integration + Integration *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service create HTTP integration body +func (o *ApplicationServiceCreateHTTPIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateHTTPIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create HTTP integration body based on the context it is used +func (o *ApplicationServiceCreateHTTPIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateHTTPIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateHTTPIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateHTTPIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateHTTPIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration Integration object to create. +swagger:model ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration +*/ +type ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration struct { + + // Payload encoding. + Encoding *models.APIEncoding `json:"encoding,omitempty"` + + // Event endpoint URL. + // The HTTP integration will POST all events to this enpoint. The request + // will contain a query parameters "event" containing the type of the + // event. + EventEndpointURL string `json:"eventEndpointUrl,omitempty"` + + // HTTP headers to set when making requests. + Headers map[string]string `json:"headers,omitempty"` +} + +// Validate validates this application service create HTTP integration params body integration +func (o *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateEncoding(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error { + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if o.Encoding != nil { + if err := o.Encoding.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create HTTP integration params body integration based on the context it is used +func (o *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateEncoding(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error { + + if o.Encoding != nil { + + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if err := o.Encoding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateHTTPIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_ifttt_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_ifttt_integration_parameters.go new file mode 100644 index 0000000..194ff78 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_ifttt_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceCreateIftttIntegrationParams creates a new ApplicationServiceCreateIftttIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceCreateIftttIntegrationParams() *ApplicationServiceCreateIftttIntegrationParams { + return &ApplicationServiceCreateIftttIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceCreateIftttIntegrationParamsWithTimeout creates a new ApplicationServiceCreateIftttIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceCreateIftttIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateIftttIntegrationParams { + return &ApplicationServiceCreateIftttIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceCreateIftttIntegrationParamsWithContext creates a new ApplicationServiceCreateIftttIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceCreateIftttIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateIftttIntegrationParams { + return &ApplicationServiceCreateIftttIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceCreateIftttIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateIftttIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceCreateIftttIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateIftttIntegrationParams { + return &ApplicationServiceCreateIftttIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceCreateIftttIntegrationParams contains all the parameters to send to the API endpoint + + for the application service create ifttt integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceCreateIftttIntegrationParams struct { + + // Body. + Body ApplicationServiceCreateIftttIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service create ifttt integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateIftttIntegrationParams) WithDefaults() *ApplicationServiceCreateIftttIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service create ifttt integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateIftttIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service create ifttt integration params +func (o *ApplicationServiceCreateIftttIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateIftttIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service create ifttt integration params +func (o *ApplicationServiceCreateIftttIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service create ifttt integration params +func (o *ApplicationServiceCreateIftttIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateIftttIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service create ifttt integration params +func (o *ApplicationServiceCreateIftttIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service create ifttt integration params +func (o *ApplicationServiceCreateIftttIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateIftttIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service create ifttt integration params +func (o *ApplicationServiceCreateIftttIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service create ifttt integration params +func (o *ApplicationServiceCreateIftttIntegrationParams) WithBody(body ApplicationServiceCreateIftttIntegrationBody) *ApplicationServiceCreateIftttIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service create ifttt integration params +func (o *ApplicationServiceCreateIftttIntegrationParams) SetBody(body ApplicationServiceCreateIftttIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service create ifttt integration params +func (o *ApplicationServiceCreateIftttIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateIftttIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service create ifttt integration params +func (o *ApplicationServiceCreateIftttIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceCreateIftttIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_ifttt_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_ifttt_integration_responses.go new file mode 100644 index 0000000..c9360ef --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_ifttt_integration_responses.go @@ -0,0 +1,346 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceCreateIftttIntegrationReader is a Reader for the ApplicationServiceCreateIftttIntegration structure. +type ApplicationServiceCreateIftttIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceCreateIftttIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceCreateIftttIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceCreateIftttIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceCreateIftttIntegrationOK creates a ApplicationServiceCreateIftttIntegrationOK with default headers values +func NewApplicationServiceCreateIftttIntegrationOK() *ApplicationServiceCreateIftttIntegrationOK { + return &ApplicationServiceCreateIftttIntegrationOK{} +} + +/* +ApplicationServiceCreateIftttIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceCreateIftttIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service create ifttt integration o k response has a 2xx status code +func (o *ApplicationServiceCreateIftttIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service create ifttt integration o k response has a 3xx status code +func (o *ApplicationServiceCreateIftttIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service create ifttt integration o k response has a 4xx status code +func (o *ApplicationServiceCreateIftttIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service create ifttt integration o k response has a 5xx status code +func (o *ApplicationServiceCreateIftttIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service create ifttt integration o k response a status code equal to that given +func (o *ApplicationServiceCreateIftttIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service create ifttt integration o k response +func (o *ApplicationServiceCreateIftttIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceCreateIftttIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/ifttt][%d] applicationServiceCreateIftttIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateIftttIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/ifttt][%d] applicationServiceCreateIftttIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateIftttIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceCreateIftttIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceCreateIftttIntegrationDefault creates a ApplicationServiceCreateIftttIntegrationDefault with default headers values +func NewApplicationServiceCreateIftttIntegrationDefault(code int) *ApplicationServiceCreateIftttIntegrationDefault { + return &ApplicationServiceCreateIftttIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceCreateIftttIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceCreateIftttIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service create ifttt integration default response has a 2xx status code +func (o *ApplicationServiceCreateIftttIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service create ifttt integration default response has a 3xx status code +func (o *ApplicationServiceCreateIftttIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service create ifttt integration default response has a 4xx status code +func (o *ApplicationServiceCreateIftttIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service create ifttt integration default response has a 5xx status code +func (o *ApplicationServiceCreateIftttIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service create ifttt integration default response a status code equal to that given +func (o *ApplicationServiceCreateIftttIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service create ifttt integration default response +func (o *ApplicationServiceCreateIftttIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceCreateIftttIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/ifttt][%d] ApplicationService_CreateIftttIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateIftttIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/ifttt][%d] ApplicationService_CreateIftttIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateIftttIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceCreateIftttIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceCreateIftttIntegrationBody application service create ifttt integration body +swagger:model ApplicationServiceCreateIftttIntegrationBody +*/ +type ApplicationServiceCreateIftttIntegrationBody struct { + + // integration + Integration *ApplicationServiceCreateIftttIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service create ifttt integration body +func (o *ApplicationServiceCreateIftttIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateIftttIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create ifttt integration body based on the context it is used +func (o *ApplicationServiceCreateIftttIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateIftttIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateIftttIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateIftttIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateIftttIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceCreateIftttIntegrationParamsBodyIntegration Integration object. +swagger:model ApplicationServiceCreateIftttIntegrationParamsBodyIntegration +*/ +type ApplicationServiceCreateIftttIntegrationParamsBodyIntegration struct { + + // Arbitrary JSON. + // If set to true, ChirpStack events will be sent as-is as arbitrary JSON + // payload. If set to false (default), the 3 JSON values format will be used. + ArbitraryJSON bool `json:"arbitraryJson,omitempty"` + + // Event prefix. + // If set, the event name will be PREFIX_EVENT. For example if event_prefix + // is set to weatherstation, and uplink event will be sent as + // weatherstation_up to the IFTTT webhook. + // Note: Only characters in the A-Z, a-z and 0-9 range are allowed. + EventPrefix string `json:"eventPrefix,omitempty"` + + // Key. + // This key can be obtained from the IFTTT Webhooks documentation page. + Key string `json:"key,omitempty"` + + // Values. + // Up to 2 values can be forwarded to IFTTT. These values must map to the + // decoded payload keys. For example: + // { + // "batteryLevel": 75.3, + // "buttons": [{"pressed": false}, {"pressed": true}] + // } + // You would specify the following fields: + // uplink_values = ["batteryLevel", "buttons_0_pressed"] + UplinkValues []string `json:"uplinkValues"` +} + +// Validate validates this application service create ifttt integration params body integration +func (o *ApplicationServiceCreateIftttIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this application service create ifttt integration params body integration based on context it is used +func (o *ApplicationServiceCreateIftttIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateIftttIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateIftttIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateIftttIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_influx_db_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_influx_db_integration_parameters.go new file mode 100644 index 0000000..7b72e1c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_influx_db_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceCreateInfluxDbIntegrationParams creates a new ApplicationServiceCreateInfluxDbIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceCreateInfluxDbIntegrationParams() *ApplicationServiceCreateInfluxDbIntegrationParams { + return &ApplicationServiceCreateInfluxDbIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceCreateInfluxDbIntegrationParamsWithTimeout creates a new ApplicationServiceCreateInfluxDbIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceCreateInfluxDbIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateInfluxDbIntegrationParams { + return &ApplicationServiceCreateInfluxDbIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceCreateInfluxDbIntegrationParamsWithContext creates a new ApplicationServiceCreateInfluxDbIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceCreateInfluxDbIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateInfluxDbIntegrationParams { + return &ApplicationServiceCreateInfluxDbIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceCreateInfluxDbIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateInfluxDbIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceCreateInfluxDbIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateInfluxDbIntegrationParams { + return &ApplicationServiceCreateInfluxDbIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceCreateInfluxDbIntegrationParams contains all the parameters to send to the API endpoint + + for the application service create influx db integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceCreateInfluxDbIntegrationParams struct { + + // Body. + Body ApplicationServiceCreateInfluxDbIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service create influx db integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WithDefaults() *ApplicationServiceCreateInfluxDbIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service create influx db integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateInfluxDbIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service create influx db integration params +func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateInfluxDbIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service create influx db integration params +func (o *ApplicationServiceCreateInfluxDbIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service create influx db integration params +func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateInfluxDbIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service create influx db integration params +func (o *ApplicationServiceCreateInfluxDbIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service create influx db integration params +func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateInfluxDbIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service create influx db integration params +func (o *ApplicationServiceCreateInfluxDbIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service create influx db integration params +func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WithBody(body ApplicationServiceCreateInfluxDbIntegrationBody) *ApplicationServiceCreateInfluxDbIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service create influx db integration params +func (o *ApplicationServiceCreateInfluxDbIntegrationParams) SetBody(body ApplicationServiceCreateInfluxDbIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service create influx db integration params +func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateInfluxDbIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service create influx db integration params +func (o *ApplicationServiceCreateInfluxDbIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceCreateInfluxDbIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_influx_db_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_influx_db_integration_responses.go new file mode 100644 index 0000000..4b73318 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_influx_db_integration_responses.go @@ -0,0 +1,455 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceCreateInfluxDbIntegrationReader is a Reader for the ApplicationServiceCreateInfluxDbIntegration structure. +type ApplicationServiceCreateInfluxDbIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceCreateInfluxDbIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceCreateInfluxDbIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceCreateInfluxDbIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceCreateInfluxDbIntegrationOK creates a ApplicationServiceCreateInfluxDbIntegrationOK with default headers values +func NewApplicationServiceCreateInfluxDbIntegrationOK() *ApplicationServiceCreateInfluxDbIntegrationOK { + return &ApplicationServiceCreateInfluxDbIntegrationOK{} +} + +/* +ApplicationServiceCreateInfluxDbIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceCreateInfluxDbIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service create influx db integration o k response has a 2xx status code +func (o *ApplicationServiceCreateInfluxDbIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service create influx db integration o k response has a 3xx status code +func (o *ApplicationServiceCreateInfluxDbIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service create influx db integration o k response has a 4xx status code +func (o *ApplicationServiceCreateInfluxDbIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service create influx db integration o k response has a 5xx status code +func (o *ApplicationServiceCreateInfluxDbIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service create influx db integration o k response a status code equal to that given +func (o *ApplicationServiceCreateInfluxDbIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service create influx db integration o k response +func (o *ApplicationServiceCreateInfluxDbIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/influxdb][%d] applicationServiceCreateInfluxDbIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/influxdb][%d] applicationServiceCreateInfluxDbIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceCreateInfluxDbIntegrationDefault creates a ApplicationServiceCreateInfluxDbIntegrationDefault with default headers values +func NewApplicationServiceCreateInfluxDbIntegrationDefault(code int) *ApplicationServiceCreateInfluxDbIntegrationDefault { + return &ApplicationServiceCreateInfluxDbIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceCreateInfluxDbIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceCreateInfluxDbIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service create influx db integration default response has a 2xx status code +func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service create influx db integration default response has a 3xx status code +func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service create influx db integration default response has a 4xx status code +func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service create influx db integration default response has a 5xx status code +func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service create influx db integration default response a status code equal to that given +func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service create influx db integration default response +func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/influxdb][%d] ApplicationService_CreateInfluxDbIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/influxdb][%d] ApplicationService_CreateInfluxDbIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceCreateInfluxDbIntegrationBody application service create influx db integration body +swagger:model ApplicationServiceCreateInfluxDbIntegrationBody +*/ +type ApplicationServiceCreateInfluxDbIntegrationBody struct { + + // integration + Integration *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service create influx db integration body +func (o *ApplicationServiceCreateInfluxDbIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create influx db integration body based on the context it is used +func (o *ApplicationServiceCreateInfluxDbIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateInfluxDbIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateInfluxDbIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateInfluxDbIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration Integration object to create. +swagger:model ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration +*/ +type ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration struct { + + // Bucket. (InfluxDb v2) + Bucket string `json:"bucket,omitempty"` + + // InfluxDb database name. (InfluxDb v1) + Db string `json:"db,omitempty"` + + // InfluxDb API write endpoint (e.g. http://localhost:8086/write). + Endpoint string `json:"endpoint,omitempty"` + + // Organization. (InfluxDb v2) + Organization string `json:"organization,omitempty"` + + // InfluxDb password. (InfluxDb v1) + Password string `json:"password,omitempty"` + + // InfluxDb timestamp precision (InfluxDb v1). + Precision *models.APIInfluxDbPrecision `json:"precision,omitempty"` + + // InfluxDb retention policy name. (InfluxDb v1) + RetentionPolicyName string `json:"retentionPolicyName,omitempty"` + + // Token. (InfluxDb v2) + Token string `json:"token,omitempty"` + + // InfluxDb username. (InfluxDb v1) + Username string `json:"username,omitempty"` + + // InfluxDb version. + Version *models.APIInfluxDbVersion `json:"version,omitempty"` +} + +// Validate validates this application service create influx db integration params body integration +func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validatePrecision(formats); err != nil { + res = append(res, err) + } + + if err := o.validateVersion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) validatePrecision(formats strfmt.Registry) error { + if swag.IsZero(o.Precision) { // not required + return nil + } + + if o.Precision != nil { + if err := o.Precision.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "precision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "precision") + } + return err + } + } + + return nil +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) validateVersion(formats strfmt.Registry) error { + if swag.IsZero(o.Version) { // not required + return nil + } + + if o.Version != nil { + if err := o.Version.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "version") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "version") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create influx db integration params body integration based on the context it is used +func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidatePrecision(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateVersion(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) contextValidatePrecision(ctx context.Context, formats strfmt.Registry) error { + + if o.Precision != nil { + + if swag.IsZero(o.Precision) { // not required + return nil + } + + if err := o.Precision.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "precision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "precision") + } + return err + } + } + + return nil +} + +func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) contextValidateVersion(ctx context.Context, formats strfmt.Registry) error { + + if o.Version != nil { + + if swag.IsZero(o.Version) { // not required + return nil + } + + if err := o.Version.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "version") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "version") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateInfluxDbIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_my_devices_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_my_devices_integration_parameters.go new file mode 100644 index 0000000..13e5a2d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_my_devices_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceCreateMyDevicesIntegrationParams creates a new ApplicationServiceCreateMyDevicesIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceCreateMyDevicesIntegrationParams() *ApplicationServiceCreateMyDevicesIntegrationParams { + return &ApplicationServiceCreateMyDevicesIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceCreateMyDevicesIntegrationParamsWithTimeout creates a new ApplicationServiceCreateMyDevicesIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceCreateMyDevicesIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateMyDevicesIntegrationParams { + return &ApplicationServiceCreateMyDevicesIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceCreateMyDevicesIntegrationParamsWithContext creates a new ApplicationServiceCreateMyDevicesIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceCreateMyDevicesIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateMyDevicesIntegrationParams { + return &ApplicationServiceCreateMyDevicesIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceCreateMyDevicesIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateMyDevicesIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceCreateMyDevicesIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateMyDevicesIntegrationParams { + return &ApplicationServiceCreateMyDevicesIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceCreateMyDevicesIntegrationParams contains all the parameters to send to the API endpoint + + for the application service create my devices integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceCreateMyDevicesIntegrationParams struct { + + // Body. + Body ApplicationServiceCreateMyDevicesIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service create my devices integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WithDefaults() *ApplicationServiceCreateMyDevicesIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service create my devices integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateMyDevicesIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service create my devices integration params +func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateMyDevicesIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service create my devices integration params +func (o *ApplicationServiceCreateMyDevicesIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service create my devices integration params +func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateMyDevicesIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service create my devices integration params +func (o *ApplicationServiceCreateMyDevicesIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service create my devices integration params +func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateMyDevicesIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service create my devices integration params +func (o *ApplicationServiceCreateMyDevicesIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service create my devices integration params +func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WithBody(body ApplicationServiceCreateMyDevicesIntegrationBody) *ApplicationServiceCreateMyDevicesIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service create my devices integration params +func (o *ApplicationServiceCreateMyDevicesIntegrationParams) SetBody(body ApplicationServiceCreateMyDevicesIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service create my devices integration params +func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateMyDevicesIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service create my devices integration params +func (o *ApplicationServiceCreateMyDevicesIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceCreateMyDevicesIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_my_devices_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_my_devices_integration_responses.go new file mode 100644 index 0000000..b19945a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_my_devices_integration_responses.go @@ -0,0 +1,322 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceCreateMyDevicesIntegrationReader is a Reader for the ApplicationServiceCreateMyDevicesIntegration structure. +type ApplicationServiceCreateMyDevicesIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceCreateMyDevicesIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceCreateMyDevicesIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceCreateMyDevicesIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceCreateMyDevicesIntegrationOK creates a ApplicationServiceCreateMyDevicesIntegrationOK with default headers values +func NewApplicationServiceCreateMyDevicesIntegrationOK() *ApplicationServiceCreateMyDevicesIntegrationOK { + return &ApplicationServiceCreateMyDevicesIntegrationOK{} +} + +/* +ApplicationServiceCreateMyDevicesIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceCreateMyDevicesIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service create my devices integration o k response has a 2xx status code +func (o *ApplicationServiceCreateMyDevicesIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service create my devices integration o k response has a 3xx status code +func (o *ApplicationServiceCreateMyDevicesIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service create my devices integration o k response has a 4xx status code +func (o *ApplicationServiceCreateMyDevicesIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service create my devices integration o k response has a 5xx status code +func (o *ApplicationServiceCreateMyDevicesIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service create my devices integration o k response a status code equal to that given +func (o *ApplicationServiceCreateMyDevicesIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service create my devices integration o k response +func (o *ApplicationServiceCreateMyDevicesIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceCreateMyDevicesIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/mydevices][%d] applicationServiceCreateMyDevicesIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateMyDevicesIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/mydevices][%d] applicationServiceCreateMyDevicesIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateMyDevicesIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceCreateMyDevicesIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceCreateMyDevicesIntegrationDefault creates a ApplicationServiceCreateMyDevicesIntegrationDefault with default headers values +func NewApplicationServiceCreateMyDevicesIntegrationDefault(code int) *ApplicationServiceCreateMyDevicesIntegrationDefault { + return &ApplicationServiceCreateMyDevicesIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceCreateMyDevicesIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceCreateMyDevicesIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service create my devices integration default response has a 2xx status code +func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service create my devices integration default response has a 3xx status code +func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service create my devices integration default response has a 4xx status code +func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service create my devices integration default response has a 5xx status code +func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service create my devices integration default response a status code equal to that given +func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service create my devices integration default response +func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/mydevices][%d] ApplicationService_CreateMyDevicesIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/mydevices][%d] ApplicationService_CreateMyDevicesIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceCreateMyDevicesIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceCreateMyDevicesIntegrationBody application service create my devices integration body +swagger:model ApplicationServiceCreateMyDevicesIntegrationBody +*/ +type ApplicationServiceCreateMyDevicesIntegrationBody struct { + + // integration + Integration *ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service create my devices integration body +func (o *ApplicationServiceCreateMyDevicesIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateMyDevicesIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create my devices integration body based on the context it is used +func (o *ApplicationServiceCreateMyDevicesIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateMyDevicesIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateMyDevicesIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateMyDevicesIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateMyDevicesIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration Integration object to create. +swagger:model ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration +*/ +type ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration struct { + + // myDevices API endpoint. + Endpoint string `json:"endpoint,omitempty"` +} + +// Validate validates this application service create my devices integration params body integration +func (o *ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this application service create my devices integration params body integration based on context it is used +func (o *ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateMyDevicesIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_parameters.go new file mode 100644 index 0000000..2ffbd08 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// NewApplicationServiceCreateParams creates a new ApplicationServiceCreateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceCreateParams() *ApplicationServiceCreateParams { + return &ApplicationServiceCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceCreateParamsWithTimeout creates a new ApplicationServiceCreateParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceCreateParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateParams { + return &ApplicationServiceCreateParams{ + timeout: timeout, + } +} + +// NewApplicationServiceCreateParamsWithContext creates a new ApplicationServiceCreateParams object +// with the ability to set a context for a request. +func NewApplicationServiceCreateParamsWithContext(ctx context.Context) *ApplicationServiceCreateParams { + return &ApplicationServiceCreateParams{ + Context: ctx, + } +} + +// NewApplicationServiceCreateParamsWithHTTPClient creates a new ApplicationServiceCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceCreateParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateParams { + return &ApplicationServiceCreateParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceCreateParams contains all the parameters to send to the API endpoint + + for the application service create operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceCreateParams struct { + + // Body. + Body *models.APICreateApplicationRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateParams) WithDefaults() *ApplicationServiceCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service create params +func (o *ApplicationServiceCreateParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service create params +func (o *ApplicationServiceCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service create params +func (o *ApplicationServiceCreateParams) WithContext(ctx context.Context) *ApplicationServiceCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service create params +func (o *ApplicationServiceCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service create params +func (o *ApplicationServiceCreateParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service create params +func (o *ApplicationServiceCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service create params +func (o *ApplicationServiceCreateParams) WithBody(body *models.APICreateApplicationRequest) *ApplicationServiceCreateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service create params +func (o *ApplicationServiceCreateParams) SetBody(body *models.APICreateApplicationRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_pilot_things_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_pilot_things_integration_parameters.go new file mode 100644 index 0000000..933c09c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_pilot_things_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceCreatePilotThingsIntegrationParams creates a new ApplicationServiceCreatePilotThingsIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceCreatePilotThingsIntegrationParams() *ApplicationServiceCreatePilotThingsIntegrationParams { + return &ApplicationServiceCreatePilotThingsIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceCreatePilotThingsIntegrationParamsWithTimeout creates a new ApplicationServiceCreatePilotThingsIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceCreatePilotThingsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreatePilotThingsIntegrationParams { + return &ApplicationServiceCreatePilotThingsIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceCreatePilotThingsIntegrationParamsWithContext creates a new ApplicationServiceCreatePilotThingsIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceCreatePilotThingsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreatePilotThingsIntegrationParams { + return &ApplicationServiceCreatePilotThingsIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceCreatePilotThingsIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreatePilotThingsIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceCreatePilotThingsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreatePilotThingsIntegrationParams { + return &ApplicationServiceCreatePilotThingsIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceCreatePilotThingsIntegrationParams contains all the parameters to send to the API endpoint + + for the application service create pilot things integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceCreatePilotThingsIntegrationParams struct { + + // Body. + Body ApplicationServiceCreatePilotThingsIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service create pilot things integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WithDefaults() *ApplicationServiceCreatePilotThingsIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service create pilot things integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreatePilotThingsIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service create pilot things integration params +func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreatePilotThingsIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service create pilot things integration params +func (o *ApplicationServiceCreatePilotThingsIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service create pilot things integration params +func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreatePilotThingsIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service create pilot things integration params +func (o *ApplicationServiceCreatePilotThingsIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service create pilot things integration params +func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreatePilotThingsIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service create pilot things integration params +func (o *ApplicationServiceCreatePilotThingsIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service create pilot things integration params +func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WithBody(body ApplicationServiceCreatePilotThingsIntegrationBody) *ApplicationServiceCreatePilotThingsIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service create pilot things integration params +func (o *ApplicationServiceCreatePilotThingsIntegrationParams) SetBody(body ApplicationServiceCreatePilotThingsIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service create pilot things integration params +func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreatePilotThingsIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service create pilot things integration params +func (o *ApplicationServiceCreatePilotThingsIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceCreatePilotThingsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_pilot_things_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_pilot_things_integration_responses.go new file mode 100644 index 0000000..046eaf2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_pilot_things_integration_responses.go @@ -0,0 +1,325 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceCreatePilotThingsIntegrationReader is a Reader for the ApplicationServiceCreatePilotThingsIntegration structure. +type ApplicationServiceCreatePilotThingsIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceCreatePilotThingsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceCreatePilotThingsIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceCreatePilotThingsIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceCreatePilotThingsIntegrationOK creates a ApplicationServiceCreatePilotThingsIntegrationOK with default headers values +func NewApplicationServiceCreatePilotThingsIntegrationOK() *ApplicationServiceCreatePilotThingsIntegrationOK { + return &ApplicationServiceCreatePilotThingsIntegrationOK{} +} + +/* +ApplicationServiceCreatePilotThingsIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceCreatePilotThingsIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service create pilot things integration o k response has a 2xx status code +func (o *ApplicationServiceCreatePilotThingsIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service create pilot things integration o k response has a 3xx status code +func (o *ApplicationServiceCreatePilotThingsIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service create pilot things integration o k response has a 4xx status code +func (o *ApplicationServiceCreatePilotThingsIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service create pilot things integration o k response has a 5xx status code +func (o *ApplicationServiceCreatePilotThingsIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service create pilot things integration o k response a status code equal to that given +func (o *ApplicationServiceCreatePilotThingsIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service create pilot things integration o k response +func (o *ApplicationServiceCreatePilotThingsIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceCreatePilotThingsIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/pilot-things][%d] applicationServiceCreatePilotThingsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreatePilotThingsIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/pilot-things][%d] applicationServiceCreatePilotThingsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreatePilotThingsIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceCreatePilotThingsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceCreatePilotThingsIntegrationDefault creates a ApplicationServiceCreatePilotThingsIntegrationDefault with default headers values +func NewApplicationServiceCreatePilotThingsIntegrationDefault(code int) *ApplicationServiceCreatePilotThingsIntegrationDefault { + return &ApplicationServiceCreatePilotThingsIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceCreatePilotThingsIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceCreatePilotThingsIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service create pilot things integration default response has a 2xx status code +func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service create pilot things integration default response has a 3xx status code +func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service create pilot things integration default response has a 4xx status code +func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service create pilot things integration default response has a 5xx status code +func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service create pilot things integration default response a status code equal to that given +func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service create pilot things integration default response +func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/pilot-things][%d] ApplicationService_CreatePilotThingsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/pilot-things][%d] ApplicationService_CreatePilotThingsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceCreatePilotThingsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceCreatePilotThingsIntegrationBody application service create pilot things integration body +swagger:model ApplicationServiceCreatePilotThingsIntegrationBody +*/ +type ApplicationServiceCreatePilotThingsIntegrationBody struct { + + // integration + Integration *ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service create pilot things integration body +func (o *ApplicationServiceCreatePilotThingsIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreatePilotThingsIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create pilot things integration body based on the context it is used +func (o *ApplicationServiceCreatePilotThingsIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreatePilotThingsIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreatePilotThingsIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreatePilotThingsIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreatePilotThingsIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration Integration object to create. +swagger:model ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration +*/ +type ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration struct { + + // Server URL. + Server string `json:"server,omitempty"` + + // Authentication token. + Token string `json:"token,omitempty"` +} + +// Validate validates this application service create pilot things integration params body integration +func (o *ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this application service create pilot things integration params body integration based on context it is used +func (o *ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreatePilotThingsIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_responses.go new file mode 100644 index 0000000..c378249 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceCreateReader is a Reader for the ApplicationServiceCreate structure. +type ApplicationServiceCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceCreateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceCreateOK creates a ApplicationServiceCreateOK with default headers values +func NewApplicationServiceCreateOK() *ApplicationServiceCreateOK { + return &ApplicationServiceCreateOK{} +} + +/* +ApplicationServiceCreateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceCreateOK struct { + Payload *models.APICreateApplicationResponse +} + +// IsSuccess returns true when this application service create o k response has a 2xx status code +func (o *ApplicationServiceCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service create o k response has a 3xx status code +func (o *ApplicationServiceCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service create o k response has a 4xx status code +func (o *ApplicationServiceCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service create o k response has a 5xx status code +func (o *ApplicationServiceCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service create o k response a status code equal to that given +func (o *ApplicationServiceCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service create o k response +func (o *ApplicationServiceCreateOK) Code() int { + return 200 +} + +func (o *ApplicationServiceCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications][%d] applicationServiceCreateOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications][%d] applicationServiceCreateOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateOK) GetPayload() *models.APICreateApplicationResponse { + return o.Payload +} + +func (o *ApplicationServiceCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APICreateApplicationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceCreateDefault creates a ApplicationServiceCreateDefault with default headers values +func NewApplicationServiceCreateDefault(code int) *ApplicationServiceCreateDefault { + return &ApplicationServiceCreateDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceCreateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceCreateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service create default response has a 2xx status code +func (o *ApplicationServiceCreateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service create default response has a 3xx status code +func (o *ApplicationServiceCreateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service create default response has a 4xx status code +func (o *ApplicationServiceCreateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service create default response has a 5xx status code +func (o *ApplicationServiceCreateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service create default response a status code equal to that given +func (o *ApplicationServiceCreateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service create default response +func (o *ApplicationServiceCreateDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceCreateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications][%d] ApplicationService_Create default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications][%d] ApplicationService_Create default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceCreateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_things_board_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_things_board_integration_parameters.go new file mode 100644 index 0000000..2b2cc0d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_things_board_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceCreateThingsBoardIntegrationParams creates a new ApplicationServiceCreateThingsBoardIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceCreateThingsBoardIntegrationParams() *ApplicationServiceCreateThingsBoardIntegrationParams { + return &ApplicationServiceCreateThingsBoardIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceCreateThingsBoardIntegrationParamsWithTimeout creates a new ApplicationServiceCreateThingsBoardIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceCreateThingsBoardIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceCreateThingsBoardIntegrationParams { + return &ApplicationServiceCreateThingsBoardIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceCreateThingsBoardIntegrationParamsWithContext creates a new ApplicationServiceCreateThingsBoardIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceCreateThingsBoardIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceCreateThingsBoardIntegrationParams { + return &ApplicationServiceCreateThingsBoardIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceCreateThingsBoardIntegrationParamsWithHTTPClient creates a new ApplicationServiceCreateThingsBoardIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceCreateThingsBoardIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceCreateThingsBoardIntegrationParams { + return &ApplicationServiceCreateThingsBoardIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceCreateThingsBoardIntegrationParams contains all the parameters to send to the API endpoint + + for the application service create things board integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceCreateThingsBoardIntegrationParams struct { + + // Body. + Body ApplicationServiceCreateThingsBoardIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service create things board integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WithDefaults() *ApplicationServiceCreateThingsBoardIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service create things board integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceCreateThingsBoardIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service create things board integration params +func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceCreateThingsBoardIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service create things board integration params +func (o *ApplicationServiceCreateThingsBoardIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service create things board integration params +func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceCreateThingsBoardIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service create things board integration params +func (o *ApplicationServiceCreateThingsBoardIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service create things board integration params +func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceCreateThingsBoardIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service create things board integration params +func (o *ApplicationServiceCreateThingsBoardIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service create things board integration params +func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WithBody(body ApplicationServiceCreateThingsBoardIntegrationBody) *ApplicationServiceCreateThingsBoardIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service create things board integration params +func (o *ApplicationServiceCreateThingsBoardIntegrationParams) SetBody(body ApplicationServiceCreateThingsBoardIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service create things board integration params +func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceCreateThingsBoardIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service create things board integration params +func (o *ApplicationServiceCreateThingsBoardIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceCreateThingsBoardIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_things_board_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_things_board_integration_responses.go new file mode 100644 index 0000000..7272af7 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_create_things_board_integration_responses.go @@ -0,0 +1,322 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceCreateThingsBoardIntegrationReader is a Reader for the ApplicationServiceCreateThingsBoardIntegration structure. +type ApplicationServiceCreateThingsBoardIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceCreateThingsBoardIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceCreateThingsBoardIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceCreateThingsBoardIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceCreateThingsBoardIntegrationOK creates a ApplicationServiceCreateThingsBoardIntegrationOK with default headers values +func NewApplicationServiceCreateThingsBoardIntegrationOK() *ApplicationServiceCreateThingsBoardIntegrationOK { + return &ApplicationServiceCreateThingsBoardIntegrationOK{} +} + +/* +ApplicationServiceCreateThingsBoardIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceCreateThingsBoardIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service create things board integration o k response has a 2xx status code +func (o *ApplicationServiceCreateThingsBoardIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service create things board integration o k response has a 3xx status code +func (o *ApplicationServiceCreateThingsBoardIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service create things board integration o k response has a 4xx status code +func (o *ApplicationServiceCreateThingsBoardIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service create things board integration o k response has a 5xx status code +func (o *ApplicationServiceCreateThingsBoardIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service create things board integration o k response a status code equal to that given +func (o *ApplicationServiceCreateThingsBoardIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service create things board integration o k response +func (o *ApplicationServiceCreateThingsBoardIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceCreateThingsBoardIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/thingsboard][%d] applicationServiceCreateThingsBoardIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateThingsBoardIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/thingsboard][%d] applicationServiceCreateThingsBoardIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceCreateThingsBoardIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceCreateThingsBoardIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceCreateThingsBoardIntegrationDefault creates a ApplicationServiceCreateThingsBoardIntegrationDefault with default headers values +func NewApplicationServiceCreateThingsBoardIntegrationDefault(code int) *ApplicationServiceCreateThingsBoardIntegrationDefault { + return &ApplicationServiceCreateThingsBoardIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceCreateThingsBoardIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceCreateThingsBoardIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service create things board integration default response has a 2xx status code +func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service create things board integration default response has a 3xx status code +func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service create things board integration default response has a 4xx status code +func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service create things board integration default response has a 5xx status code +func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service create things board integration default response a status code equal to that given +func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service create things board integration default response +func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/thingsboard][%d] ApplicationService_CreateThingsBoardIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{integration.applicationId}/integrations/thingsboard][%d] ApplicationService_CreateThingsBoardIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceCreateThingsBoardIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceCreateThingsBoardIntegrationBody application service create things board integration body +swagger:model ApplicationServiceCreateThingsBoardIntegrationBody +*/ +type ApplicationServiceCreateThingsBoardIntegrationBody struct { + + // integration + Integration *ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service create things board integration body +func (o *ApplicationServiceCreateThingsBoardIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateThingsBoardIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service create things board integration body based on the context it is used +func (o *ApplicationServiceCreateThingsBoardIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceCreateThingsBoardIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateThingsBoardIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateThingsBoardIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateThingsBoardIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration Integration object to create. +swagger:model ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration +*/ +type ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration struct { + + // ThingsBoard server endpoint, e.g. https://example.com + Server string `json:"server,omitempty"` +} + +// Validate validates this application service create things board integration params body integration +func (o *ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this application service create things board integration params body integration based on context it is used +func (o *ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceCreateThingsBoardIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_aws_sns_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_aws_sns_integration_parameters.go new file mode 100644 index 0000000..e39c58d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_aws_sns_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceDeleteAwsSnsIntegrationParams creates a new ApplicationServiceDeleteAwsSnsIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceDeleteAwsSnsIntegrationParams() *ApplicationServiceDeleteAwsSnsIntegrationParams { + return &ApplicationServiceDeleteAwsSnsIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceDeleteAwsSnsIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteAwsSnsIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceDeleteAwsSnsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteAwsSnsIntegrationParams { + return &ApplicationServiceDeleteAwsSnsIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceDeleteAwsSnsIntegrationParamsWithContext creates a new ApplicationServiceDeleteAwsSnsIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceDeleteAwsSnsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteAwsSnsIntegrationParams { + return &ApplicationServiceDeleteAwsSnsIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceDeleteAwsSnsIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteAwsSnsIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceDeleteAwsSnsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteAwsSnsIntegrationParams { + return &ApplicationServiceDeleteAwsSnsIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceDeleteAwsSnsIntegrationParams contains all the parameters to send to the API endpoint + + for the application service delete aws sns integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceDeleteAwsSnsIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service delete aws sns integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) WithDefaults() *ApplicationServiceDeleteAwsSnsIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service delete aws sns integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service delete aws sns integration params +func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteAwsSnsIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service delete aws sns integration params +func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service delete aws sns integration params +func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteAwsSnsIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service delete aws sns integration params +func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service delete aws sns integration params +func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteAwsSnsIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service delete aws sns integration params +func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service delete aws sns integration params +func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteAwsSnsIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service delete aws sns integration params +func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceDeleteAwsSnsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_aws_sns_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_aws_sns_integration_responses.go new file mode 100644 index 0000000..a140318 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_aws_sns_integration_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceDeleteAwsSnsIntegrationReader is a Reader for the ApplicationServiceDeleteAwsSnsIntegration structure. +type ApplicationServiceDeleteAwsSnsIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceDeleteAwsSnsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceDeleteAwsSnsIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceDeleteAwsSnsIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceDeleteAwsSnsIntegrationOK creates a ApplicationServiceDeleteAwsSnsIntegrationOK with default headers values +func NewApplicationServiceDeleteAwsSnsIntegrationOK() *ApplicationServiceDeleteAwsSnsIntegrationOK { + return &ApplicationServiceDeleteAwsSnsIntegrationOK{} +} + +/* +ApplicationServiceDeleteAwsSnsIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceDeleteAwsSnsIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service delete aws sns integration o k response has a 2xx status code +func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service delete aws sns integration o k response has a 3xx status code +func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service delete aws sns integration o k response has a 4xx status code +func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service delete aws sns integration o k response has a 5xx status code +func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service delete aws sns integration o k response a status code equal to that given +func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service delete aws sns integration o k response +func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/aws-sns][%d] applicationServiceDeleteAwsSnsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/aws-sns][%d] applicationServiceDeleteAwsSnsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceDeleteAwsSnsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceDeleteAwsSnsIntegrationDefault creates a ApplicationServiceDeleteAwsSnsIntegrationDefault with default headers values +func NewApplicationServiceDeleteAwsSnsIntegrationDefault(code int) *ApplicationServiceDeleteAwsSnsIntegrationDefault { + return &ApplicationServiceDeleteAwsSnsIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceDeleteAwsSnsIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceDeleteAwsSnsIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service delete aws sns integration default response has a 2xx status code +func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service delete aws sns integration default response has a 3xx status code +func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service delete aws sns integration default response has a 4xx status code +func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service delete aws sns integration default response has a 5xx status code +func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service delete aws sns integration default response a status code equal to that given +func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service delete aws sns integration default response +func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/aws-sns][%d] ApplicationService_DeleteAwsSnsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/aws-sns][%d] ApplicationService_DeleteAwsSnsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceDeleteAwsSnsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_azure_service_bus_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_azure_service_bus_integration_parameters.go new file mode 100644 index 0000000..e2ab691 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_azure_service_bus_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceDeleteAzureServiceBusIntegrationParams creates a new ApplicationServiceDeleteAzureServiceBusIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceDeleteAzureServiceBusIntegrationParams() *ApplicationServiceDeleteAzureServiceBusIntegrationParams { + return &ApplicationServiceDeleteAzureServiceBusIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceDeleteAzureServiceBusIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteAzureServiceBusIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceDeleteAzureServiceBusIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteAzureServiceBusIntegrationParams { + return &ApplicationServiceDeleteAzureServiceBusIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceDeleteAzureServiceBusIntegrationParamsWithContext creates a new ApplicationServiceDeleteAzureServiceBusIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceDeleteAzureServiceBusIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteAzureServiceBusIntegrationParams { + return &ApplicationServiceDeleteAzureServiceBusIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceDeleteAzureServiceBusIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteAzureServiceBusIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceDeleteAzureServiceBusIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteAzureServiceBusIntegrationParams { + return &ApplicationServiceDeleteAzureServiceBusIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceDeleteAzureServiceBusIntegrationParams contains all the parameters to send to the API endpoint + + for the application service delete azure service bus integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceDeleteAzureServiceBusIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service delete azure service bus integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) WithDefaults() *ApplicationServiceDeleteAzureServiceBusIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service delete azure service bus integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service delete azure service bus integration params +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteAzureServiceBusIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service delete azure service bus integration params +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service delete azure service bus integration params +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteAzureServiceBusIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service delete azure service bus integration params +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service delete azure service bus integration params +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteAzureServiceBusIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service delete azure service bus integration params +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service delete azure service bus integration params +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteAzureServiceBusIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service delete azure service bus integration params +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_azure_service_bus_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_azure_service_bus_integration_responses.go new file mode 100644 index 0000000..e632fa5 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_azure_service_bus_integration_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceDeleteAzureServiceBusIntegrationReader is a Reader for the ApplicationServiceDeleteAzureServiceBusIntegration structure. +type ApplicationServiceDeleteAzureServiceBusIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceDeleteAzureServiceBusIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceDeleteAzureServiceBusIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceDeleteAzureServiceBusIntegrationOK creates a ApplicationServiceDeleteAzureServiceBusIntegrationOK with default headers values +func NewApplicationServiceDeleteAzureServiceBusIntegrationOK() *ApplicationServiceDeleteAzureServiceBusIntegrationOK { + return &ApplicationServiceDeleteAzureServiceBusIntegrationOK{} +} + +/* +ApplicationServiceDeleteAzureServiceBusIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceDeleteAzureServiceBusIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service delete azure service bus integration o k response has a 2xx status code +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service delete azure service bus integration o k response has a 3xx status code +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service delete azure service bus integration o k response has a 4xx status code +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service delete azure service bus integration o k response has a 5xx status code +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service delete azure service bus integration o k response a status code equal to that given +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service delete azure service bus integration o k response +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/azure-service-bus][%d] applicationServiceDeleteAzureServiceBusIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/azure-service-bus][%d] applicationServiceDeleteAzureServiceBusIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceDeleteAzureServiceBusIntegrationDefault creates a ApplicationServiceDeleteAzureServiceBusIntegrationDefault with default headers values +func NewApplicationServiceDeleteAzureServiceBusIntegrationDefault(code int) *ApplicationServiceDeleteAzureServiceBusIntegrationDefault { + return &ApplicationServiceDeleteAzureServiceBusIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceDeleteAzureServiceBusIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceDeleteAzureServiceBusIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service delete azure service bus integration default response has a 2xx status code +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service delete azure service bus integration default response has a 3xx status code +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service delete azure service bus integration default response has a 4xx status code +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service delete azure service bus integration default response has a 5xx status code +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service delete azure service bus integration default response a status code equal to that given +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service delete azure service bus integration default response +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/azure-service-bus][%d] ApplicationService_DeleteAzureServiceBusIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/azure-service-bus][%d] ApplicationService_DeleteAzureServiceBusIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceDeleteAzureServiceBusIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_gcp_pub_sub_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_gcp_pub_sub_integration_parameters.go new file mode 100644 index 0000000..9a7bf85 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_gcp_pub_sub_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceDeleteGcpPubSubIntegrationParams creates a new ApplicationServiceDeleteGcpPubSubIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceDeleteGcpPubSubIntegrationParams() *ApplicationServiceDeleteGcpPubSubIntegrationParams { + return &ApplicationServiceDeleteGcpPubSubIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceDeleteGcpPubSubIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteGcpPubSubIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceDeleteGcpPubSubIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteGcpPubSubIntegrationParams { + return &ApplicationServiceDeleteGcpPubSubIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceDeleteGcpPubSubIntegrationParamsWithContext creates a new ApplicationServiceDeleteGcpPubSubIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceDeleteGcpPubSubIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteGcpPubSubIntegrationParams { + return &ApplicationServiceDeleteGcpPubSubIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceDeleteGcpPubSubIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteGcpPubSubIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceDeleteGcpPubSubIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteGcpPubSubIntegrationParams { + return &ApplicationServiceDeleteGcpPubSubIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceDeleteGcpPubSubIntegrationParams contains all the parameters to send to the API endpoint + + for the application service delete gcp pub sub integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceDeleteGcpPubSubIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service delete gcp pub sub integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) WithDefaults() *ApplicationServiceDeleteGcpPubSubIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service delete gcp pub sub integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service delete gcp pub sub integration params +func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteGcpPubSubIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service delete gcp pub sub integration params +func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service delete gcp pub sub integration params +func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteGcpPubSubIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service delete gcp pub sub integration params +func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service delete gcp pub sub integration params +func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteGcpPubSubIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service delete gcp pub sub integration params +func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service delete gcp pub sub integration params +func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteGcpPubSubIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service delete gcp pub sub integration params +func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceDeleteGcpPubSubIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_gcp_pub_sub_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_gcp_pub_sub_integration_responses.go new file mode 100644 index 0000000..42d6582 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_gcp_pub_sub_integration_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceDeleteGcpPubSubIntegrationReader is a Reader for the ApplicationServiceDeleteGcpPubSubIntegration structure. +type ApplicationServiceDeleteGcpPubSubIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceDeleteGcpPubSubIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceDeleteGcpPubSubIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceDeleteGcpPubSubIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceDeleteGcpPubSubIntegrationOK creates a ApplicationServiceDeleteGcpPubSubIntegrationOK with default headers values +func NewApplicationServiceDeleteGcpPubSubIntegrationOK() *ApplicationServiceDeleteGcpPubSubIntegrationOK { + return &ApplicationServiceDeleteGcpPubSubIntegrationOK{} +} + +/* +ApplicationServiceDeleteGcpPubSubIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceDeleteGcpPubSubIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service delete gcp pub sub integration o k response has a 2xx status code +func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service delete gcp pub sub integration o k response has a 3xx status code +func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service delete gcp pub sub integration o k response has a 4xx status code +func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service delete gcp pub sub integration o k response has a 5xx status code +func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service delete gcp pub sub integration o k response a status code equal to that given +func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service delete gcp pub sub integration o k response +func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] applicationServiceDeleteGcpPubSubIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] applicationServiceDeleteGcpPubSubIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceDeleteGcpPubSubIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceDeleteGcpPubSubIntegrationDefault creates a ApplicationServiceDeleteGcpPubSubIntegrationDefault with default headers values +func NewApplicationServiceDeleteGcpPubSubIntegrationDefault(code int) *ApplicationServiceDeleteGcpPubSubIntegrationDefault { + return &ApplicationServiceDeleteGcpPubSubIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceDeleteGcpPubSubIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceDeleteGcpPubSubIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service delete gcp pub sub integration default response has a 2xx status code +func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service delete gcp pub sub integration default response has a 3xx status code +func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service delete gcp pub sub integration default response has a 4xx status code +func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service delete gcp pub sub integration default response has a 5xx status code +func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service delete gcp pub sub integration default response a status code equal to that given +func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service delete gcp pub sub integration default response +func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_DeleteGcpPubSubIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_DeleteGcpPubSubIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceDeleteGcpPubSubIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_http_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_http_integration_parameters.go new file mode 100644 index 0000000..8af1394 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_http_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceDeleteHTTPIntegrationParams creates a new ApplicationServiceDeleteHTTPIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceDeleteHTTPIntegrationParams() *ApplicationServiceDeleteHTTPIntegrationParams { + return &ApplicationServiceDeleteHTTPIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceDeleteHTTPIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteHTTPIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceDeleteHTTPIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteHTTPIntegrationParams { + return &ApplicationServiceDeleteHTTPIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceDeleteHTTPIntegrationParamsWithContext creates a new ApplicationServiceDeleteHTTPIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceDeleteHTTPIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteHTTPIntegrationParams { + return &ApplicationServiceDeleteHTTPIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceDeleteHTTPIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteHTTPIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceDeleteHTTPIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteHTTPIntegrationParams { + return &ApplicationServiceDeleteHTTPIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceDeleteHTTPIntegrationParams contains all the parameters to send to the API endpoint + + for the application service delete Http integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceDeleteHTTPIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service delete Http integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteHTTPIntegrationParams) WithDefaults() *ApplicationServiceDeleteHTTPIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service delete Http integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteHTTPIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service delete Http integration params +func (o *ApplicationServiceDeleteHTTPIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteHTTPIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service delete Http integration params +func (o *ApplicationServiceDeleteHTTPIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service delete Http integration params +func (o *ApplicationServiceDeleteHTTPIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteHTTPIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service delete Http integration params +func (o *ApplicationServiceDeleteHTTPIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service delete Http integration params +func (o *ApplicationServiceDeleteHTTPIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteHTTPIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service delete Http integration params +func (o *ApplicationServiceDeleteHTTPIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service delete Http integration params +func (o *ApplicationServiceDeleteHTTPIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteHTTPIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service delete Http integration params +func (o *ApplicationServiceDeleteHTTPIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceDeleteHTTPIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_http_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_http_integration_responses.go new file mode 100644 index 0000000..07cc4ab --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_http_integration_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceDeleteHTTPIntegrationReader is a Reader for the ApplicationServiceDeleteHTTPIntegration structure. +type ApplicationServiceDeleteHTTPIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceDeleteHTTPIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceDeleteHTTPIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceDeleteHTTPIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceDeleteHTTPIntegrationOK creates a ApplicationServiceDeleteHTTPIntegrationOK with default headers values +func NewApplicationServiceDeleteHTTPIntegrationOK() *ApplicationServiceDeleteHTTPIntegrationOK { + return &ApplicationServiceDeleteHTTPIntegrationOK{} +} + +/* +ApplicationServiceDeleteHTTPIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceDeleteHTTPIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service delete Http integration o k response has a 2xx status code +func (o *ApplicationServiceDeleteHTTPIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service delete Http integration o k response has a 3xx status code +func (o *ApplicationServiceDeleteHTTPIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service delete Http integration o k response has a 4xx status code +func (o *ApplicationServiceDeleteHTTPIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service delete Http integration o k response has a 5xx status code +func (o *ApplicationServiceDeleteHTTPIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service delete Http integration o k response a status code equal to that given +func (o *ApplicationServiceDeleteHTTPIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service delete Http integration o k response +func (o *ApplicationServiceDeleteHTTPIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceDeleteHTTPIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/http][%d] applicationServiceDeleteHttpIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteHTTPIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/http][%d] applicationServiceDeleteHttpIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteHTTPIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceDeleteHTTPIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceDeleteHTTPIntegrationDefault creates a ApplicationServiceDeleteHTTPIntegrationDefault with default headers values +func NewApplicationServiceDeleteHTTPIntegrationDefault(code int) *ApplicationServiceDeleteHTTPIntegrationDefault { + return &ApplicationServiceDeleteHTTPIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceDeleteHTTPIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceDeleteHTTPIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service delete Http integration default response has a 2xx status code +func (o *ApplicationServiceDeleteHTTPIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service delete Http integration default response has a 3xx status code +func (o *ApplicationServiceDeleteHTTPIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service delete Http integration default response has a 4xx status code +func (o *ApplicationServiceDeleteHTTPIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service delete Http integration default response has a 5xx status code +func (o *ApplicationServiceDeleteHTTPIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service delete Http integration default response a status code equal to that given +func (o *ApplicationServiceDeleteHTTPIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service delete Http integration default response +func (o *ApplicationServiceDeleteHTTPIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceDeleteHTTPIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/http][%d] ApplicationService_DeleteHttpIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteHTTPIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/http][%d] ApplicationService_DeleteHttpIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteHTTPIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceDeleteHTTPIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_ifttt_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_ifttt_integration_parameters.go new file mode 100644 index 0000000..1917ddd --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_ifttt_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceDeleteIftttIntegrationParams creates a new ApplicationServiceDeleteIftttIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceDeleteIftttIntegrationParams() *ApplicationServiceDeleteIftttIntegrationParams { + return &ApplicationServiceDeleteIftttIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceDeleteIftttIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteIftttIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceDeleteIftttIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteIftttIntegrationParams { + return &ApplicationServiceDeleteIftttIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceDeleteIftttIntegrationParamsWithContext creates a new ApplicationServiceDeleteIftttIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceDeleteIftttIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteIftttIntegrationParams { + return &ApplicationServiceDeleteIftttIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceDeleteIftttIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteIftttIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceDeleteIftttIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteIftttIntegrationParams { + return &ApplicationServiceDeleteIftttIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceDeleteIftttIntegrationParams contains all the parameters to send to the API endpoint + + for the application service delete ifttt integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceDeleteIftttIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service delete ifttt integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteIftttIntegrationParams) WithDefaults() *ApplicationServiceDeleteIftttIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service delete ifttt integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteIftttIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service delete ifttt integration params +func (o *ApplicationServiceDeleteIftttIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteIftttIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service delete ifttt integration params +func (o *ApplicationServiceDeleteIftttIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service delete ifttt integration params +func (o *ApplicationServiceDeleteIftttIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteIftttIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service delete ifttt integration params +func (o *ApplicationServiceDeleteIftttIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service delete ifttt integration params +func (o *ApplicationServiceDeleteIftttIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteIftttIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service delete ifttt integration params +func (o *ApplicationServiceDeleteIftttIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service delete ifttt integration params +func (o *ApplicationServiceDeleteIftttIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteIftttIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service delete ifttt integration params +func (o *ApplicationServiceDeleteIftttIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceDeleteIftttIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_ifttt_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_ifttt_integration_responses.go new file mode 100644 index 0000000..abae169 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_ifttt_integration_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceDeleteIftttIntegrationReader is a Reader for the ApplicationServiceDeleteIftttIntegration structure. +type ApplicationServiceDeleteIftttIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceDeleteIftttIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceDeleteIftttIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceDeleteIftttIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceDeleteIftttIntegrationOK creates a ApplicationServiceDeleteIftttIntegrationOK with default headers values +func NewApplicationServiceDeleteIftttIntegrationOK() *ApplicationServiceDeleteIftttIntegrationOK { + return &ApplicationServiceDeleteIftttIntegrationOK{} +} + +/* +ApplicationServiceDeleteIftttIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceDeleteIftttIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service delete ifttt integration o k response has a 2xx status code +func (o *ApplicationServiceDeleteIftttIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service delete ifttt integration o k response has a 3xx status code +func (o *ApplicationServiceDeleteIftttIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service delete ifttt integration o k response has a 4xx status code +func (o *ApplicationServiceDeleteIftttIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service delete ifttt integration o k response has a 5xx status code +func (o *ApplicationServiceDeleteIftttIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service delete ifttt integration o k response a status code equal to that given +func (o *ApplicationServiceDeleteIftttIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service delete ifttt integration o k response +func (o *ApplicationServiceDeleteIftttIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceDeleteIftttIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/ifttt][%d] applicationServiceDeleteIftttIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteIftttIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/ifttt][%d] applicationServiceDeleteIftttIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteIftttIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceDeleteIftttIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceDeleteIftttIntegrationDefault creates a ApplicationServiceDeleteIftttIntegrationDefault with default headers values +func NewApplicationServiceDeleteIftttIntegrationDefault(code int) *ApplicationServiceDeleteIftttIntegrationDefault { + return &ApplicationServiceDeleteIftttIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceDeleteIftttIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceDeleteIftttIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service delete ifttt integration default response has a 2xx status code +func (o *ApplicationServiceDeleteIftttIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service delete ifttt integration default response has a 3xx status code +func (o *ApplicationServiceDeleteIftttIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service delete ifttt integration default response has a 4xx status code +func (o *ApplicationServiceDeleteIftttIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service delete ifttt integration default response has a 5xx status code +func (o *ApplicationServiceDeleteIftttIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service delete ifttt integration default response a status code equal to that given +func (o *ApplicationServiceDeleteIftttIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service delete ifttt integration default response +func (o *ApplicationServiceDeleteIftttIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceDeleteIftttIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/ifttt][%d] ApplicationService_DeleteIftttIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteIftttIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/ifttt][%d] ApplicationService_DeleteIftttIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteIftttIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceDeleteIftttIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_influx_db_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_influx_db_integration_parameters.go new file mode 100644 index 0000000..22cf48a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_influx_db_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceDeleteInfluxDbIntegrationParams creates a new ApplicationServiceDeleteInfluxDbIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceDeleteInfluxDbIntegrationParams() *ApplicationServiceDeleteInfluxDbIntegrationParams { + return &ApplicationServiceDeleteInfluxDbIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceDeleteInfluxDbIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteInfluxDbIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceDeleteInfluxDbIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteInfluxDbIntegrationParams { + return &ApplicationServiceDeleteInfluxDbIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceDeleteInfluxDbIntegrationParamsWithContext creates a new ApplicationServiceDeleteInfluxDbIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceDeleteInfluxDbIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteInfluxDbIntegrationParams { + return &ApplicationServiceDeleteInfluxDbIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceDeleteInfluxDbIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteInfluxDbIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceDeleteInfluxDbIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteInfluxDbIntegrationParams { + return &ApplicationServiceDeleteInfluxDbIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceDeleteInfluxDbIntegrationParams contains all the parameters to send to the API endpoint + + for the application service delete influx db integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceDeleteInfluxDbIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service delete influx db integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) WithDefaults() *ApplicationServiceDeleteInfluxDbIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service delete influx db integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service delete influx db integration params +func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteInfluxDbIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service delete influx db integration params +func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service delete influx db integration params +func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteInfluxDbIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service delete influx db integration params +func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service delete influx db integration params +func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteInfluxDbIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service delete influx db integration params +func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service delete influx db integration params +func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteInfluxDbIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service delete influx db integration params +func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceDeleteInfluxDbIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_influx_db_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_influx_db_integration_responses.go new file mode 100644 index 0000000..1e767cb --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_influx_db_integration_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceDeleteInfluxDbIntegrationReader is a Reader for the ApplicationServiceDeleteInfluxDbIntegration structure. +type ApplicationServiceDeleteInfluxDbIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceDeleteInfluxDbIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceDeleteInfluxDbIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceDeleteInfluxDbIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceDeleteInfluxDbIntegrationOK creates a ApplicationServiceDeleteInfluxDbIntegrationOK with default headers values +func NewApplicationServiceDeleteInfluxDbIntegrationOK() *ApplicationServiceDeleteInfluxDbIntegrationOK { + return &ApplicationServiceDeleteInfluxDbIntegrationOK{} +} + +/* +ApplicationServiceDeleteInfluxDbIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceDeleteInfluxDbIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service delete influx db integration o k response has a 2xx status code +func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service delete influx db integration o k response has a 3xx status code +func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service delete influx db integration o k response has a 4xx status code +func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service delete influx db integration o k response has a 5xx status code +func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service delete influx db integration o k response a status code equal to that given +func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service delete influx db integration o k response +func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/influxdb][%d] applicationServiceDeleteInfluxDbIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/influxdb][%d] applicationServiceDeleteInfluxDbIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceDeleteInfluxDbIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceDeleteInfluxDbIntegrationDefault creates a ApplicationServiceDeleteInfluxDbIntegrationDefault with default headers values +func NewApplicationServiceDeleteInfluxDbIntegrationDefault(code int) *ApplicationServiceDeleteInfluxDbIntegrationDefault { + return &ApplicationServiceDeleteInfluxDbIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceDeleteInfluxDbIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceDeleteInfluxDbIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service delete influx db integration default response has a 2xx status code +func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service delete influx db integration default response has a 3xx status code +func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service delete influx db integration default response has a 4xx status code +func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service delete influx db integration default response has a 5xx status code +func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service delete influx db integration default response a status code equal to that given +func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service delete influx db integration default response +func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/influxdb][%d] ApplicationService_DeleteInfluxDbIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/influxdb][%d] ApplicationService_DeleteInfluxDbIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceDeleteInfluxDbIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_my_devices_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_my_devices_integration_parameters.go new file mode 100644 index 0000000..ed5f35d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_my_devices_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceDeleteMyDevicesIntegrationParams creates a new ApplicationServiceDeleteMyDevicesIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceDeleteMyDevicesIntegrationParams() *ApplicationServiceDeleteMyDevicesIntegrationParams { + return &ApplicationServiceDeleteMyDevicesIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceDeleteMyDevicesIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteMyDevicesIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceDeleteMyDevicesIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteMyDevicesIntegrationParams { + return &ApplicationServiceDeleteMyDevicesIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceDeleteMyDevicesIntegrationParamsWithContext creates a new ApplicationServiceDeleteMyDevicesIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceDeleteMyDevicesIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteMyDevicesIntegrationParams { + return &ApplicationServiceDeleteMyDevicesIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceDeleteMyDevicesIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteMyDevicesIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceDeleteMyDevicesIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteMyDevicesIntegrationParams { + return &ApplicationServiceDeleteMyDevicesIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceDeleteMyDevicesIntegrationParams contains all the parameters to send to the API endpoint + + for the application service delete my devices integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceDeleteMyDevicesIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service delete my devices integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) WithDefaults() *ApplicationServiceDeleteMyDevicesIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service delete my devices integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service delete my devices integration params +func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteMyDevicesIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service delete my devices integration params +func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service delete my devices integration params +func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteMyDevicesIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service delete my devices integration params +func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service delete my devices integration params +func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteMyDevicesIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service delete my devices integration params +func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service delete my devices integration params +func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteMyDevicesIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service delete my devices integration params +func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceDeleteMyDevicesIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_my_devices_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_my_devices_integration_responses.go new file mode 100644 index 0000000..abc54f0 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_my_devices_integration_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceDeleteMyDevicesIntegrationReader is a Reader for the ApplicationServiceDeleteMyDevicesIntegration structure. +type ApplicationServiceDeleteMyDevicesIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceDeleteMyDevicesIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceDeleteMyDevicesIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceDeleteMyDevicesIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceDeleteMyDevicesIntegrationOK creates a ApplicationServiceDeleteMyDevicesIntegrationOK with default headers values +func NewApplicationServiceDeleteMyDevicesIntegrationOK() *ApplicationServiceDeleteMyDevicesIntegrationOK { + return &ApplicationServiceDeleteMyDevicesIntegrationOK{} +} + +/* +ApplicationServiceDeleteMyDevicesIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceDeleteMyDevicesIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service delete my devices integration o k response has a 2xx status code +func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service delete my devices integration o k response has a 3xx status code +func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service delete my devices integration o k response has a 4xx status code +func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service delete my devices integration o k response has a 5xx status code +func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service delete my devices integration o k response a status code equal to that given +func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service delete my devices integration o k response +func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/mydevices][%d] applicationServiceDeleteMyDevicesIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/mydevices][%d] applicationServiceDeleteMyDevicesIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceDeleteMyDevicesIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceDeleteMyDevicesIntegrationDefault creates a ApplicationServiceDeleteMyDevicesIntegrationDefault with default headers values +func NewApplicationServiceDeleteMyDevicesIntegrationDefault(code int) *ApplicationServiceDeleteMyDevicesIntegrationDefault { + return &ApplicationServiceDeleteMyDevicesIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceDeleteMyDevicesIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceDeleteMyDevicesIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service delete my devices integration default response has a 2xx status code +func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service delete my devices integration default response has a 3xx status code +func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service delete my devices integration default response has a 4xx status code +func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service delete my devices integration default response has a 5xx status code +func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service delete my devices integration default response a status code equal to that given +func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service delete my devices integration default response +func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/mydevices][%d] ApplicationService_DeleteMyDevicesIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/mydevices][%d] ApplicationService_DeleteMyDevicesIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceDeleteMyDevicesIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_parameters.go new file mode 100644 index 0000000..30a62de --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceDeleteParams creates a new ApplicationServiceDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceDeleteParams() *ApplicationServiceDeleteParams { + return &ApplicationServiceDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceDeleteParamsWithTimeout creates a new ApplicationServiceDeleteParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceDeleteParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteParams { + return &ApplicationServiceDeleteParams{ + timeout: timeout, + } +} + +// NewApplicationServiceDeleteParamsWithContext creates a new ApplicationServiceDeleteParams object +// with the ability to set a context for a request. +func NewApplicationServiceDeleteParamsWithContext(ctx context.Context) *ApplicationServiceDeleteParams { + return &ApplicationServiceDeleteParams{ + Context: ctx, + } +} + +// NewApplicationServiceDeleteParamsWithHTTPClient creates a new ApplicationServiceDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceDeleteParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteParams { + return &ApplicationServiceDeleteParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceDeleteParams contains all the parameters to send to the API endpoint + + for the application service delete operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceDeleteParams struct { + + /* ID. + + Application ID (UUID). + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteParams) WithDefaults() *ApplicationServiceDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service delete params +func (o *ApplicationServiceDeleteParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service delete params +func (o *ApplicationServiceDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service delete params +func (o *ApplicationServiceDeleteParams) WithContext(ctx context.Context) *ApplicationServiceDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service delete params +func (o *ApplicationServiceDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service delete params +func (o *ApplicationServiceDeleteParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service delete params +func (o *ApplicationServiceDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the application service delete params +func (o *ApplicationServiceDeleteParams) WithID(id string) *ApplicationServiceDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the application service delete params +func (o *ApplicationServiceDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_pilot_things_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_pilot_things_integration_parameters.go new file mode 100644 index 0000000..5626997 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_pilot_things_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceDeletePilotThingsIntegrationParams creates a new ApplicationServiceDeletePilotThingsIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceDeletePilotThingsIntegrationParams() *ApplicationServiceDeletePilotThingsIntegrationParams { + return &ApplicationServiceDeletePilotThingsIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceDeletePilotThingsIntegrationParamsWithTimeout creates a new ApplicationServiceDeletePilotThingsIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceDeletePilotThingsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeletePilotThingsIntegrationParams { + return &ApplicationServiceDeletePilotThingsIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceDeletePilotThingsIntegrationParamsWithContext creates a new ApplicationServiceDeletePilotThingsIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceDeletePilotThingsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeletePilotThingsIntegrationParams { + return &ApplicationServiceDeletePilotThingsIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceDeletePilotThingsIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeletePilotThingsIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceDeletePilotThingsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeletePilotThingsIntegrationParams { + return &ApplicationServiceDeletePilotThingsIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceDeletePilotThingsIntegrationParams contains all the parameters to send to the API endpoint + + for the application service delete pilot things integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceDeletePilotThingsIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service delete pilot things integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeletePilotThingsIntegrationParams) WithDefaults() *ApplicationServiceDeletePilotThingsIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service delete pilot things integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeletePilotThingsIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service delete pilot things integration params +func (o *ApplicationServiceDeletePilotThingsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeletePilotThingsIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service delete pilot things integration params +func (o *ApplicationServiceDeletePilotThingsIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service delete pilot things integration params +func (o *ApplicationServiceDeletePilotThingsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeletePilotThingsIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service delete pilot things integration params +func (o *ApplicationServiceDeletePilotThingsIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service delete pilot things integration params +func (o *ApplicationServiceDeletePilotThingsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeletePilotThingsIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service delete pilot things integration params +func (o *ApplicationServiceDeletePilotThingsIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service delete pilot things integration params +func (o *ApplicationServiceDeletePilotThingsIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeletePilotThingsIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service delete pilot things integration params +func (o *ApplicationServiceDeletePilotThingsIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceDeletePilotThingsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_pilot_things_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_pilot_things_integration_responses.go new file mode 100644 index 0000000..67440bd --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_pilot_things_integration_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceDeletePilotThingsIntegrationReader is a Reader for the ApplicationServiceDeletePilotThingsIntegration structure. +type ApplicationServiceDeletePilotThingsIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceDeletePilotThingsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceDeletePilotThingsIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceDeletePilotThingsIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceDeletePilotThingsIntegrationOK creates a ApplicationServiceDeletePilotThingsIntegrationOK with default headers values +func NewApplicationServiceDeletePilotThingsIntegrationOK() *ApplicationServiceDeletePilotThingsIntegrationOK { + return &ApplicationServiceDeletePilotThingsIntegrationOK{} +} + +/* +ApplicationServiceDeletePilotThingsIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceDeletePilotThingsIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service delete pilot things integration o k response has a 2xx status code +func (o *ApplicationServiceDeletePilotThingsIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service delete pilot things integration o k response has a 3xx status code +func (o *ApplicationServiceDeletePilotThingsIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service delete pilot things integration o k response has a 4xx status code +func (o *ApplicationServiceDeletePilotThingsIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service delete pilot things integration o k response has a 5xx status code +func (o *ApplicationServiceDeletePilotThingsIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service delete pilot things integration o k response a status code equal to that given +func (o *ApplicationServiceDeletePilotThingsIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service delete pilot things integration o k response +func (o *ApplicationServiceDeletePilotThingsIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceDeletePilotThingsIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/pilot-things][%d] applicationServiceDeletePilotThingsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeletePilotThingsIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/pilot-things][%d] applicationServiceDeletePilotThingsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeletePilotThingsIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceDeletePilotThingsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceDeletePilotThingsIntegrationDefault creates a ApplicationServiceDeletePilotThingsIntegrationDefault with default headers values +func NewApplicationServiceDeletePilotThingsIntegrationDefault(code int) *ApplicationServiceDeletePilotThingsIntegrationDefault { + return &ApplicationServiceDeletePilotThingsIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceDeletePilotThingsIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceDeletePilotThingsIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service delete pilot things integration default response has a 2xx status code +func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service delete pilot things integration default response has a 3xx status code +func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service delete pilot things integration default response has a 4xx status code +func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service delete pilot things integration default response has a 5xx status code +func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service delete pilot things integration default response a status code equal to that given +func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service delete pilot things integration default response +func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/pilot-things][%d] ApplicationService_DeletePilotThingsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/pilot-things][%d] ApplicationService_DeletePilotThingsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceDeletePilotThingsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_responses.go new file mode 100644 index 0000000..9aa678f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceDeleteReader is a Reader for the ApplicationServiceDelete structure. +type ApplicationServiceDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceDeleteDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceDeleteOK creates a ApplicationServiceDeleteOK with default headers values +func NewApplicationServiceDeleteOK() *ApplicationServiceDeleteOK { + return &ApplicationServiceDeleteOK{} +} + +/* +ApplicationServiceDeleteOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceDeleteOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service delete o k response has a 2xx status code +func (o *ApplicationServiceDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service delete o k response has a 3xx status code +func (o *ApplicationServiceDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service delete o k response has a 4xx status code +func (o *ApplicationServiceDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service delete o k response has a 5xx status code +func (o *ApplicationServiceDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service delete o k response a status code equal to that given +func (o *ApplicationServiceDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service delete o k response +func (o *ApplicationServiceDeleteOK) Code() int { + return 200 +} + +func (o *ApplicationServiceDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{id}][%d] applicationServiceDeleteOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{id}][%d] applicationServiceDeleteOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceDeleteDefault creates a ApplicationServiceDeleteDefault with default headers values +func NewApplicationServiceDeleteDefault(code int) *ApplicationServiceDeleteDefault { + return &ApplicationServiceDeleteDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceDeleteDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceDeleteDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service delete default response has a 2xx status code +func (o *ApplicationServiceDeleteDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service delete default response has a 3xx status code +func (o *ApplicationServiceDeleteDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service delete default response has a 4xx status code +func (o *ApplicationServiceDeleteDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service delete default response has a 5xx status code +func (o *ApplicationServiceDeleteDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service delete default response a status code equal to that given +func (o *ApplicationServiceDeleteDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service delete default response +func (o *ApplicationServiceDeleteDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceDeleteDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{id}][%d] ApplicationService_Delete default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{id}][%d] ApplicationService_Delete default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceDeleteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_things_board_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_things_board_integration_parameters.go new file mode 100644 index 0000000..44e396b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_things_board_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceDeleteThingsBoardIntegrationParams creates a new ApplicationServiceDeleteThingsBoardIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceDeleteThingsBoardIntegrationParams() *ApplicationServiceDeleteThingsBoardIntegrationParams { + return &ApplicationServiceDeleteThingsBoardIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceDeleteThingsBoardIntegrationParamsWithTimeout creates a new ApplicationServiceDeleteThingsBoardIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceDeleteThingsBoardIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceDeleteThingsBoardIntegrationParams { + return &ApplicationServiceDeleteThingsBoardIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceDeleteThingsBoardIntegrationParamsWithContext creates a new ApplicationServiceDeleteThingsBoardIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceDeleteThingsBoardIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceDeleteThingsBoardIntegrationParams { + return &ApplicationServiceDeleteThingsBoardIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceDeleteThingsBoardIntegrationParamsWithHTTPClient creates a new ApplicationServiceDeleteThingsBoardIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceDeleteThingsBoardIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceDeleteThingsBoardIntegrationParams { + return &ApplicationServiceDeleteThingsBoardIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceDeleteThingsBoardIntegrationParams contains all the parameters to send to the API endpoint + + for the application service delete things board integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceDeleteThingsBoardIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service delete things board integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) WithDefaults() *ApplicationServiceDeleteThingsBoardIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service delete things board integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service delete things board integration params +func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceDeleteThingsBoardIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service delete things board integration params +func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service delete things board integration params +func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceDeleteThingsBoardIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service delete things board integration params +func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service delete things board integration params +func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceDeleteThingsBoardIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service delete things board integration params +func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service delete things board integration params +func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceDeleteThingsBoardIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service delete things board integration params +func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceDeleteThingsBoardIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_things_board_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_things_board_integration_responses.go new file mode 100644 index 0000000..54a398b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_delete_things_board_integration_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceDeleteThingsBoardIntegrationReader is a Reader for the ApplicationServiceDeleteThingsBoardIntegration structure. +type ApplicationServiceDeleteThingsBoardIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceDeleteThingsBoardIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceDeleteThingsBoardIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceDeleteThingsBoardIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceDeleteThingsBoardIntegrationOK creates a ApplicationServiceDeleteThingsBoardIntegrationOK with default headers values +func NewApplicationServiceDeleteThingsBoardIntegrationOK() *ApplicationServiceDeleteThingsBoardIntegrationOK { + return &ApplicationServiceDeleteThingsBoardIntegrationOK{} +} + +/* +ApplicationServiceDeleteThingsBoardIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceDeleteThingsBoardIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service delete things board integration o k response has a 2xx status code +func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service delete things board integration o k response has a 3xx status code +func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service delete things board integration o k response has a 4xx status code +func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service delete things board integration o k response has a 5xx status code +func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service delete things board integration o k response a status code equal to that given +func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service delete things board integration o k response +func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/thingsboard][%d] applicationServiceDeleteThingsBoardIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/thingsboard][%d] applicationServiceDeleteThingsBoardIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceDeleteThingsBoardIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceDeleteThingsBoardIntegrationDefault creates a ApplicationServiceDeleteThingsBoardIntegrationDefault with default headers values +func NewApplicationServiceDeleteThingsBoardIntegrationDefault(code int) *ApplicationServiceDeleteThingsBoardIntegrationDefault { + return &ApplicationServiceDeleteThingsBoardIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceDeleteThingsBoardIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceDeleteThingsBoardIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service delete things board integration default response has a 2xx status code +func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service delete things board integration default response has a 3xx status code +func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service delete things board integration default response has a 4xx status code +func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service delete things board integration default response has a 5xx status code +func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service delete things board integration default response a status code equal to that given +func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service delete things board integration default response +func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/thingsboard][%d] ApplicationService_DeleteThingsBoardIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/applications/{applicationId}/integrations/thingsboard][%d] ApplicationService_DeleteThingsBoardIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceDeleteThingsBoardIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_generate_mqtt_integration_client_certificate_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_generate_mqtt_integration_client_certificate_parameters.go new file mode 100644 index 0000000..0179f7c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_generate_mqtt_integration_client_certificate_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceGenerateMqttIntegrationClientCertificateParams creates a new ApplicationServiceGenerateMqttIntegrationClientCertificateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceGenerateMqttIntegrationClientCertificateParams() *ApplicationServiceGenerateMqttIntegrationClientCertificateParams { + return &ApplicationServiceGenerateMqttIntegrationClientCertificateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceGenerateMqttIntegrationClientCertificateParamsWithTimeout creates a new ApplicationServiceGenerateMqttIntegrationClientCertificateParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceGenerateMqttIntegrationClientCertificateParamsWithTimeout(timeout time.Duration) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams { + return &ApplicationServiceGenerateMqttIntegrationClientCertificateParams{ + timeout: timeout, + } +} + +// NewApplicationServiceGenerateMqttIntegrationClientCertificateParamsWithContext creates a new ApplicationServiceGenerateMqttIntegrationClientCertificateParams object +// with the ability to set a context for a request. +func NewApplicationServiceGenerateMqttIntegrationClientCertificateParamsWithContext(ctx context.Context) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams { + return &ApplicationServiceGenerateMqttIntegrationClientCertificateParams{ + Context: ctx, + } +} + +// NewApplicationServiceGenerateMqttIntegrationClientCertificateParamsWithHTTPClient creates a new ApplicationServiceGenerateMqttIntegrationClientCertificateParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceGenerateMqttIntegrationClientCertificateParamsWithHTTPClient(client *http.Client) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams { + return &ApplicationServiceGenerateMqttIntegrationClientCertificateParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceGenerateMqttIntegrationClientCertificateParams contains all the parameters to send to the API endpoint + + for the application service generate mqtt integration client certificate operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceGenerateMqttIntegrationClientCertificateParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service generate mqtt integration client certificate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) WithDefaults() *ApplicationServiceGenerateMqttIntegrationClientCertificateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service generate mqtt integration client certificate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service generate mqtt integration client certificate params +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) WithTimeout(timeout time.Duration) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service generate mqtt integration client certificate params +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service generate mqtt integration client certificate params +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) WithContext(ctx context.Context) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service generate mqtt integration client certificate params +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service generate mqtt integration client certificate params +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) WithHTTPClient(client *http.Client) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service generate mqtt integration client certificate params +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service generate mqtt integration client certificate params +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) WithApplicationID(applicationID string) *ApplicationServiceGenerateMqttIntegrationClientCertificateParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service generate mqtt integration client certificate params +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_generate_mqtt_integration_client_certificate_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_generate_mqtt_integration_client_certificate_responses.go new file mode 100644 index 0000000..21fb3f2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_generate_mqtt_integration_client_certificate_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceGenerateMqttIntegrationClientCertificateReader is a Reader for the ApplicationServiceGenerateMqttIntegrationClientCertificate structure. +type ApplicationServiceGenerateMqttIntegrationClientCertificateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceGenerateMqttIntegrationClientCertificateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceGenerateMqttIntegrationClientCertificateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceGenerateMqttIntegrationClientCertificateOK creates a ApplicationServiceGenerateMqttIntegrationClientCertificateOK with default headers values +func NewApplicationServiceGenerateMqttIntegrationClientCertificateOK() *ApplicationServiceGenerateMqttIntegrationClientCertificateOK { + return &ApplicationServiceGenerateMqttIntegrationClientCertificateOK{} +} + +/* +ApplicationServiceGenerateMqttIntegrationClientCertificateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceGenerateMqttIntegrationClientCertificateOK struct { + Payload *models.APIGenerateMqttIntegrationClientCertificateResponse +} + +// IsSuccess returns true when this application service generate mqtt integration client certificate o k response has a 2xx status code +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service generate mqtt integration client certificate o k response has a 3xx status code +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service generate mqtt integration client certificate o k response has a 4xx status code +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service generate mqtt integration client certificate o k response has a 5xx status code +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service generate mqtt integration client certificate o k response a status code equal to that given +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service generate mqtt integration client certificate o k response +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) Code() int { + return 200 +} + +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{applicationId}/integrations/mqtt/certificate][%d] applicationServiceGenerateMqttIntegrationClientCertificateOK %s", 200, payload) +} + +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{applicationId}/integrations/mqtt/certificate][%d] applicationServiceGenerateMqttIntegrationClientCertificateOK %s", 200, payload) +} + +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) GetPayload() *models.APIGenerateMqttIntegrationClientCertificateResponse { + return o.Payload +} + +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGenerateMqttIntegrationClientCertificateResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceGenerateMqttIntegrationClientCertificateDefault creates a ApplicationServiceGenerateMqttIntegrationClientCertificateDefault with default headers values +func NewApplicationServiceGenerateMqttIntegrationClientCertificateDefault(code int) *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault { + return &ApplicationServiceGenerateMqttIntegrationClientCertificateDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceGenerateMqttIntegrationClientCertificateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceGenerateMqttIntegrationClientCertificateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service generate mqtt integration client certificate default response has a 2xx status code +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service generate mqtt integration client certificate default response has a 3xx status code +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service generate mqtt integration client certificate default response has a 4xx status code +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service generate mqtt integration client certificate default response has a 5xx status code +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service generate mqtt integration client certificate default response a status code equal to that given +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service generate mqtt integration client certificate default response +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{applicationId}/integrations/mqtt/certificate][%d] ApplicationService_GenerateMqttIntegrationClientCertificate default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/applications/{applicationId}/integrations/mqtt/certificate][%d] ApplicationService_GenerateMqttIntegrationClientCertificate default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceGenerateMqttIntegrationClientCertificateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_aws_sns_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_aws_sns_integration_parameters.go new file mode 100644 index 0000000..d5001b4 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_aws_sns_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceGetAwsSnsIntegrationParams creates a new ApplicationServiceGetAwsSnsIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceGetAwsSnsIntegrationParams() *ApplicationServiceGetAwsSnsIntegrationParams { + return &ApplicationServiceGetAwsSnsIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceGetAwsSnsIntegrationParamsWithTimeout creates a new ApplicationServiceGetAwsSnsIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceGetAwsSnsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetAwsSnsIntegrationParams { + return &ApplicationServiceGetAwsSnsIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceGetAwsSnsIntegrationParamsWithContext creates a new ApplicationServiceGetAwsSnsIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceGetAwsSnsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetAwsSnsIntegrationParams { + return &ApplicationServiceGetAwsSnsIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceGetAwsSnsIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetAwsSnsIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceGetAwsSnsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetAwsSnsIntegrationParams { + return &ApplicationServiceGetAwsSnsIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceGetAwsSnsIntegrationParams contains all the parameters to send to the API endpoint + + for the application service get aws sns integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceGetAwsSnsIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service get aws sns integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetAwsSnsIntegrationParams) WithDefaults() *ApplicationServiceGetAwsSnsIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service get aws sns integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetAwsSnsIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service get aws sns integration params +func (o *ApplicationServiceGetAwsSnsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetAwsSnsIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service get aws sns integration params +func (o *ApplicationServiceGetAwsSnsIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service get aws sns integration params +func (o *ApplicationServiceGetAwsSnsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetAwsSnsIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service get aws sns integration params +func (o *ApplicationServiceGetAwsSnsIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service get aws sns integration params +func (o *ApplicationServiceGetAwsSnsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetAwsSnsIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service get aws sns integration params +func (o *ApplicationServiceGetAwsSnsIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service get aws sns integration params +func (o *ApplicationServiceGetAwsSnsIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetAwsSnsIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service get aws sns integration params +func (o *ApplicationServiceGetAwsSnsIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceGetAwsSnsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_aws_sns_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_aws_sns_integration_responses.go new file mode 100644 index 0000000..8d84cd0 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_aws_sns_integration_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceGetAwsSnsIntegrationReader is a Reader for the ApplicationServiceGetAwsSnsIntegration structure. +type ApplicationServiceGetAwsSnsIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceGetAwsSnsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceGetAwsSnsIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceGetAwsSnsIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceGetAwsSnsIntegrationOK creates a ApplicationServiceGetAwsSnsIntegrationOK with default headers values +func NewApplicationServiceGetAwsSnsIntegrationOK() *ApplicationServiceGetAwsSnsIntegrationOK { + return &ApplicationServiceGetAwsSnsIntegrationOK{} +} + +/* +ApplicationServiceGetAwsSnsIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceGetAwsSnsIntegrationOK struct { + Payload *models.APIGetAwsSnsIntegrationResponse +} + +// IsSuccess returns true when this application service get aws sns integration o k response has a 2xx status code +func (o *ApplicationServiceGetAwsSnsIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service get aws sns integration o k response has a 3xx status code +func (o *ApplicationServiceGetAwsSnsIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service get aws sns integration o k response has a 4xx status code +func (o *ApplicationServiceGetAwsSnsIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service get aws sns integration o k response has a 5xx status code +func (o *ApplicationServiceGetAwsSnsIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service get aws sns integration o k response a status code equal to that given +func (o *ApplicationServiceGetAwsSnsIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service get aws sns integration o k response +func (o *ApplicationServiceGetAwsSnsIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceGetAwsSnsIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/aws-sns][%d] applicationServiceGetAwsSnsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetAwsSnsIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/aws-sns][%d] applicationServiceGetAwsSnsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetAwsSnsIntegrationOK) GetPayload() *models.APIGetAwsSnsIntegrationResponse { + return o.Payload +} + +func (o *ApplicationServiceGetAwsSnsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetAwsSnsIntegrationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceGetAwsSnsIntegrationDefault creates a ApplicationServiceGetAwsSnsIntegrationDefault with default headers values +func NewApplicationServiceGetAwsSnsIntegrationDefault(code int) *ApplicationServiceGetAwsSnsIntegrationDefault { + return &ApplicationServiceGetAwsSnsIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceGetAwsSnsIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceGetAwsSnsIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service get aws sns integration default response has a 2xx status code +func (o *ApplicationServiceGetAwsSnsIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service get aws sns integration default response has a 3xx status code +func (o *ApplicationServiceGetAwsSnsIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service get aws sns integration default response has a 4xx status code +func (o *ApplicationServiceGetAwsSnsIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service get aws sns integration default response has a 5xx status code +func (o *ApplicationServiceGetAwsSnsIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service get aws sns integration default response a status code equal to that given +func (o *ApplicationServiceGetAwsSnsIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service get aws sns integration default response +func (o *ApplicationServiceGetAwsSnsIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceGetAwsSnsIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/aws-sns][%d] ApplicationService_GetAwsSnsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetAwsSnsIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/aws-sns][%d] ApplicationService_GetAwsSnsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetAwsSnsIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceGetAwsSnsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_azure_service_bus_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_azure_service_bus_integration_parameters.go new file mode 100644 index 0000000..621159c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_azure_service_bus_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceGetAzureServiceBusIntegrationParams creates a new ApplicationServiceGetAzureServiceBusIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceGetAzureServiceBusIntegrationParams() *ApplicationServiceGetAzureServiceBusIntegrationParams { + return &ApplicationServiceGetAzureServiceBusIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceGetAzureServiceBusIntegrationParamsWithTimeout creates a new ApplicationServiceGetAzureServiceBusIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceGetAzureServiceBusIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetAzureServiceBusIntegrationParams { + return &ApplicationServiceGetAzureServiceBusIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceGetAzureServiceBusIntegrationParamsWithContext creates a new ApplicationServiceGetAzureServiceBusIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceGetAzureServiceBusIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetAzureServiceBusIntegrationParams { + return &ApplicationServiceGetAzureServiceBusIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceGetAzureServiceBusIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetAzureServiceBusIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceGetAzureServiceBusIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetAzureServiceBusIntegrationParams { + return &ApplicationServiceGetAzureServiceBusIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceGetAzureServiceBusIntegrationParams contains all the parameters to send to the API endpoint + + for the application service get azure service bus integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceGetAzureServiceBusIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service get azure service bus integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) WithDefaults() *ApplicationServiceGetAzureServiceBusIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service get azure service bus integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service get azure service bus integration params +func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetAzureServiceBusIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service get azure service bus integration params +func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service get azure service bus integration params +func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetAzureServiceBusIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service get azure service bus integration params +func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service get azure service bus integration params +func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetAzureServiceBusIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service get azure service bus integration params +func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service get azure service bus integration params +func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetAzureServiceBusIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service get azure service bus integration params +func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceGetAzureServiceBusIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_azure_service_bus_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_azure_service_bus_integration_responses.go new file mode 100644 index 0000000..698641a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_azure_service_bus_integration_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceGetAzureServiceBusIntegrationReader is a Reader for the ApplicationServiceGetAzureServiceBusIntegration structure. +type ApplicationServiceGetAzureServiceBusIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceGetAzureServiceBusIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceGetAzureServiceBusIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceGetAzureServiceBusIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceGetAzureServiceBusIntegrationOK creates a ApplicationServiceGetAzureServiceBusIntegrationOK with default headers values +func NewApplicationServiceGetAzureServiceBusIntegrationOK() *ApplicationServiceGetAzureServiceBusIntegrationOK { + return &ApplicationServiceGetAzureServiceBusIntegrationOK{} +} + +/* +ApplicationServiceGetAzureServiceBusIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceGetAzureServiceBusIntegrationOK struct { + Payload *models.APIGetAzureServiceBusIntegrationResponse +} + +// IsSuccess returns true when this application service get azure service bus integration o k response has a 2xx status code +func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service get azure service bus integration o k response has a 3xx status code +func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service get azure service bus integration o k response has a 4xx status code +func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service get azure service bus integration o k response has a 5xx status code +func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service get azure service bus integration o k response a status code equal to that given +func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service get azure service bus integration o k response +func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/azure-service-bus][%d] applicationServiceGetAzureServiceBusIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/azure-service-bus][%d] applicationServiceGetAzureServiceBusIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) GetPayload() *models.APIGetAzureServiceBusIntegrationResponse { + return o.Payload +} + +func (o *ApplicationServiceGetAzureServiceBusIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetAzureServiceBusIntegrationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceGetAzureServiceBusIntegrationDefault creates a ApplicationServiceGetAzureServiceBusIntegrationDefault with default headers values +func NewApplicationServiceGetAzureServiceBusIntegrationDefault(code int) *ApplicationServiceGetAzureServiceBusIntegrationDefault { + return &ApplicationServiceGetAzureServiceBusIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceGetAzureServiceBusIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceGetAzureServiceBusIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service get azure service bus integration default response has a 2xx status code +func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service get azure service bus integration default response has a 3xx status code +func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service get azure service bus integration default response has a 4xx status code +func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service get azure service bus integration default response has a 5xx status code +func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service get azure service bus integration default response a status code equal to that given +func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service get azure service bus integration default response +func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/azure-service-bus][%d] ApplicationService_GetAzureServiceBusIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/azure-service-bus][%d] ApplicationService_GetAzureServiceBusIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceGetAzureServiceBusIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_gcp_pub_sub_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_gcp_pub_sub_integration_parameters.go new file mode 100644 index 0000000..f9ef4c0 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_gcp_pub_sub_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceGetGcpPubSubIntegrationParams creates a new ApplicationServiceGetGcpPubSubIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceGetGcpPubSubIntegrationParams() *ApplicationServiceGetGcpPubSubIntegrationParams { + return &ApplicationServiceGetGcpPubSubIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceGetGcpPubSubIntegrationParamsWithTimeout creates a new ApplicationServiceGetGcpPubSubIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceGetGcpPubSubIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetGcpPubSubIntegrationParams { + return &ApplicationServiceGetGcpPubSubIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceGetGcpPubSubIntegrationParamsWithContext creates a new ApplicationServiceGetGcpPubSubIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceGetGcpPubSubIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetGcpPubSubIntegrationParams { + return &ApplicationServiceGetGcpPubSubIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceGetGcpPubSubIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetGcpPubSubIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceGetGcpPubSubIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetGcpPubSubIntegrationParams { + return &ApplicationServiceGetGcpPubSubIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceGetGcpPubSubIntegrationParams contains all the parameters to send to the API endpoint + + for the application service get gcp pub sub integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceGetGcpPubSubIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service get gcp pub sub integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetGcpPubSubIntegrationParams) WithDefaults() *ApplicationServiceGetGcpPubSubIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service get gcp pub sub integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetGcpPubSubIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service get gcp pub sub integration params +func (o *ApplicationServiceGetGcpPubSubIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetGcpPubSubIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service get gcp pub sub integration params +func (o *ApplicationServiceGetGcpPubSubIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service get gcp pub sub integration params +func (o *ApplicationServiceGetGcpPubSubIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetGcpPubSubIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service get gcp pub sub integration params +func (o *ApplicationServiceGetGcpPubSubIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service get gcp pub sub integration params +func (o *ApplicationServiceGetGcpPubSubIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetGcpPubSubIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service get gcp pub sub integration params +func (o *ApplicationServiceGetGcpPubSubIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service get gcp pub sub integration params +func (o *ApplicationServiceGetGcpPubSubIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetGcpPubSubIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service get gcp pub sub integration params +func (o *ApplicationServiceGetGcpPubSubIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceGetGcpPubSubIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_gcp_pub_sub_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_gcp_pub_sub_integration_responses.go new file mode 100644 index 0000000..ab5e3cc --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_gcp_pub_sub_integration_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceGetGcpPubSubIntegrationReader is a Reader for the ApplicationServiceGetGcpPubSubIntegration structure. +type ApplicationServiceGetGcpPubSubIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceGetGcpPubSubIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceGetGcpPubSubIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceGetGcpPubSubIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceGetGcpPubSubIntegrationOK creates a ApplicationServiceGetGcpPubSubIntegrationOK with default headers values +func NewApplicationServiceGetGcpPubSubIntegrationOK() *ApplicationServiceGetGcpPubSubIntegrationOK { + return &ApplicationServiceGetGcpPubSubIntegrationOK{} +} + +/* +ApplicationServiceGetGcpPubSubIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceGetGcpPubSubIntegrationOK struct { + Payload *models.APIGetGcpPubSubIntegrationResponse +} + +// IsSuccess returns true when this application service get gcp pub sub integration o k response has a 2xx status code +func (o *ApplicationServiceGetGcpPubSubIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service get gcp pub sub integration o k response has a 3xx status code +func (o *ApplicationServiceGetGcpPubSubIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service get gcp pub sub integration o k response has a 4xx status code +func (o *ApplicationServiceGetGcpPubSubIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service get gcp pub sub integration o k response has a 5xx status code +func (o *ApplicationServiceGetGcpPubSubIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service get gcp pub sub integration o k response a status code equal to that given +func (o *ApplicationServiceGetGcpPubSubIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service get gcp pub sub integration o k response +func (o *ApplicationServiceGetGcpPubSubIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceGetGcpPubSubIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] applicationServiceGetGcpPubSubIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetGcpPubSubIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] applicationServiceGetGcpPubSubIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetGcpPubSubIntegrationOK) GetPayload() *models.APIGetGcpPubSubIntegrationResponse { + return o.Payload +} + +func (o *ApplicationServiceGetGcpPubSubIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetGcpPubSubIntegrationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceGetGcpPubSubIntegrationDefault creates a ApplicationServiceGetGcpPubSubIntegrationDefault with default headers values +func NewApplicationServiceGetGcpPubSubIntegrationDefault(code int) *ApplicationServiceGetGcpPubSubIntegrationDefault { + return &ApplicationServiceGetGcpPubSubIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceGetGcpPubSubIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceGetGcpPubSubIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service get gcp pub sub integration default response has a 2xx status code +func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service get gcp pub sub integration default response has a 3xx status code +func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service get gcp pub sub integration default response has a 4xx status code +func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service get gcp pub sub integration default response has a 5xx status code +func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service get gcp pub sub integration default response a status code equal to that given +func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service get gcp pub sub integration default response +func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_GetGcpPubSubIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_GetGcpPubSubIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceGetGcpPubSubIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_http_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_http_integration_parameters.go new file mode 100644 index 0000000..ba31005 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_http_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceGetHTTPIntegrationParams creates a new ApplicationServiceGetHTTPIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceGetHTTPIntegrationParams() *ApplicationServiceGetHTTPIntegrationParams { + return &ApplicationServiceGetHTTPIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceGetHTTPIntegrationParamsWithTimeout creates a new ApplicationServiceGetHTTPIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceGetHTTPIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetHTTPIntegrationParams { + return &ApplicationServiceGetHTTPIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceGetHTTPIntegrationParamsWithContext creates a new ApplicationServiceGetHTTPIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceGetHTTPIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetHTTPIntegrationParams { + return &ApplicationServiceGetHTTPIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceGetHTTPIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetHTTPIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceGetHTTPIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetHTTPIntegrationParams { + return &ApplicationServiceGetHTTPIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceGetHTTPIntegrationParams contains all the parameters to send to the API endpoint + + for the application service get Http integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceGetHTTPIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service get Http integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetHTTPIntegrationParams) WithDefaults() *ApplicationServiceGetHTTPIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service get Http integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetHTTPIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service get Http integration params +func (o *ApplicationServiceGetHTTPIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetHTTPIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service get Http integration params +func (o *ApplicationServiceGetHTTPIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service get Http integration params +func (o *ApplicationServiceGetHTTPIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetHTTPIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service get Http integration params +func (o *ApplicationServiceGetHTTPIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service get Http integration params +func (o *ApplicationServiceGetHTTPIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetHTTPIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service get Http integration params +func (o *ApplicationServiceGetHTTPIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service get Http integration params +func (o *ApplicationServiceGetHTTPIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetHTTPIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service get Http integration params +func (o *ApplicationServiceGetHTTPIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceGetHTTPIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_http_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_http_integration_responses.go new file mode 100644 index 0000000..c4ab475 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_http_integration_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceGetHTTPIntegrationReader is a Reader for the ApplicationServiceGetHTTPIntegration structure. +type ApplicationServiceGetHTTPIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceGetHTTPIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceGetHTTPIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceGetHTTPIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceGetHTTPIntegrationOK creates a ApplicationServiceGetHTTPIntegrationOK with default headers values +func NewApplicationServiceGetHTTPIntegrationOK() *ApplicationServiceGetHTTPIntegrationOK { + return &ApplicationServiceGetHTTPIntegrationOK{} +} + +/* +ApplicationServiceGetHTTPIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceGetHTTPIntegrationOK struct { + Payload *models.APIGetHTTPIntegrationResponse +} + +// IsSuccess returns true when this application service get Http integration o k response has a 2xx status code +func (o *ApplicationServiceGetHTTPIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service get Http integration o k response has a 3xx status code +func (o *ApplicationServiceGetHTTPIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service get Http integration o k response has a 4xx status code +func (o *ApplicationServiceGetHTTPIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service get Http integration o k response has a 5xx status code +func (o *ApplicationServiceGetHTTPIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service get Http integration o k response a status code equal to that given +func (o *ApplicationServiceGetHTTPIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service get Http integration o k response +func (o *ApplicationServiceGetHTTPIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceGetHTTPIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/http][%d] applicationServiceGetHttpIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetHTTPIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/http][%d] applicationServiceGetHttpIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetHTTPIntegrationOK) GetPayload() *models.APIGetHTTPIntegrationResponse { + return o.Payload +} + +func (o *ApplicationServiceGetHTTPIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetHTTPIntegrationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceGetHTTPIntegrationDefault creates a ApplicationServiceGetHTTPIntegrationDefault with default headers values +func NewApplicationServiceGetHTTPIntegrationDefault(code int) *ApplicationServiceGetHTTPIntegrationDefault { + return &ApplicationServiceGetHTTPIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceGetHTTPIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceGetHTTPIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service get Http integration default response has a 2xx status code +func (o *ApplicationServiceGetHTTPIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service get Http integration default response has a 3xx status code +func (o *ApplicationServiceGetHTTPIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service get Http integration default response has a 4xx status code +func (o *ApplicationServiceGetHTTPIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service get Http integration default response has a 5xx status code +func (o *ApplicationServiceGetHTTPIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service get Http integration default response a status code equal to that given +func (o *ApplicationServiceGetHTTPIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service get Http integration default response +func (o *ApplicationServiceGetHTTPIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceGetHTTPIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/http][%d] ApplicationService_GetHttpIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetHTTPIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/http][%d] ApplicationService_GetHttpIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetHTTPIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceGetHTTPIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_ifttt_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_ifttt_integration_parameters.go new file mode 100644 index 0000000..95e268a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_ifttt_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceGetIftttIntegrationParams creates a new ApplicationServiceGetIftttIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceGetIftttIntegrationParams() *ApplicationServiceGetIftttIntegrationParams { + return &ApplicationServiceGetIftttIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceGetIftttIntegrationParamsWithTimeout creates a new ApplicationServiceGetIftttIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceGetIftttIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetIftttIntegrationParams { + return &ApplicationServiceGetIftttIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceGetIftttIntegrationParamsWithContext creates a new ApplicationServiceGetIftttIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceGetIftttIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetIftttIntegrationParams { + return &ApplicationServiceGetIftttIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceGetIftttIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetIftttIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceGetIftttIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetIftttIntegrationParams { + return &ApplicationServiceGetIftttIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceGetIftttIntegrationParams contains all the parameters to send to the API endpoint + + for the application service get ifttt integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceGetIftttIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service get ifttt integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetIftttIntegrationParams) WithDefaults() *ApplicationServiceGetIftttIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service get ifttt integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetIftttIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service get ifttt integration params +func (o *ApplicationServiceGetIftttIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetIftttIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service get ifttt integration params +func (o *ApplicationServiceGetIftttIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service get ifttt integration params +func (o *ApplicationServiceGetIftttIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetIftttIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service get ifttt integration params +func (o *ApplicationServiceGetIftttIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service get ifttt integration params +func (o *ApplicationServiceGetIftttIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetIftttIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service get ifttt integration params +func (o *ApplicationServiceGetIftttIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service get ifttt integration params +func (o *ApplicationServiceGetIftttIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetIftttIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service get ifttt integration params +func (o *ApplicationServiceGetIftttIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceGetIftttIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_ifttt_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_ifttt_integration_responses.go new file mode 100644 index 0000000..3e14d9a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_ifttt_integration_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceGetIftttIntegrationReader is a Reader for the ApplicationServiceGetIftttIntegration structure. +type ApplicationServiceGetIftttIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceGetIftttIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceGetIftttIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceGetIftttIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceGetIftttIntegrationOK creates a ApplicationServiceGetIftttIntegrationOK with default headers values +func NewApplicationServiceGetIftttIntegrationOK() *ApplicationServiceGetIftttIntegrationOK { + return &ApplicationServiceGetIftttIntegrationOK{} +} + +/* +ApplicationServiceGetIftttIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceGetIftttIntegrationOK struct { + Payload *models.APIGetIftttIntegrationResponse +} + +// IsSuccess returns true when this application service get ifttt integration o k response has a 2xx status code +func (o *ApplicationServiceGetIftttIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service get ifttt integration o k response has a 3xx status code +func (o *ApplicationServiceGetIftttIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service get ifttt integration o k response has a 4xx status code +func (o *ApplicationServiceGetIftttIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service get ifttt integration o k response has a 5xx status code +func (o *ApplicationServiceGetIftttIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service get ifttt integration o k response a status code equal to that given +func (o *ApplicationServiceGetIftttIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service get ifttt integration o k response +func (o *ApplicationServiceGetIftttIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceGetIftttIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/ifttt][%d] applicationServiceGetIftttIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetIftttIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/ifttt][%d] applicationServiceGetIftttIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetIftttIntegrationOK) GetPayload() *models.APIGetIftttIntegrationResponse { + return o.Payload +} + +func (o *ApplicationServiceGetIftttIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetIftttIntegrationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceGetIftttIntegrationDefault creates a ApplicationServiceGetIftttIntegrationDefault with default headers values +func NewApplicationServiceGetIftttIntegrationDefault(code int) *ApplicationServiceGetIftttIntegrationDefault { + return &ApplicationServiceGetIftttIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceGetIftttIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceGetIftttIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service get ifttt integration default response has a 2xx status code +func (o *ApplicationServiceGetIftttIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service get ifttt integration default response has a 3xx status code +func (o *ApplicationServiceGetIftttIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service get ifttt integration default response has a 4xx status code +func (o *ApplicationServiceGetIftttIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service get ifttt integration default response has a 5xx status code +func (o *ApplicationServiceGetIftttIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service get ifttt integration default response a status code equal to that given +func (o *ApplicationServiceGetIftttIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service get ifttt integration default response +func (o *ApplicationServiceGetIftttIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceGetIftttIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/ifttt][%d] ApplicationService_GetIftttIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetIftttIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/ifttt][%d] ApplicationService_GetIftttIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetIftttIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceGetIftttIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_influx_db_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_influx_db_integration_parameters.go new file mode 100644 index 0000000..77598c5 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_influx_db_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceGetInfluxDbIntegrationParams creates a new ApplicationServiceGetInfluxDbIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceGetInfluxDbIntegrationParams() *ApplicationServiceGetInfluxDbIntegrationParams { + return &ApplicationServiceGetInfluxDbIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceGetInfluxDbIntegrationParamsWithTimeout creates a new ApplicationServiceGetInfluxDbIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceGetInfluxDbIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetInfluxDbIntegrationParams { + return &ApplicationServiceGetInfluxDbIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceGetInfluxDbIntegrationParamsWithContext creates a new ApplicationServiceGetInfluxDbIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceGetInfluxDbIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetInfluxDbIntegrationParams { + return &ApplicationServiceGetInfluxDbIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceGetInfluxDbIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetInfluxDbIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceGetInfluxDbIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetInfluxDbIntegrationParams { + return &ApplicationServiceGetInfluxDbIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceGetInfluxDbIntegrationParams contains all the parameters to send to the API endpoint + + for the application service get influx db integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceGetInfluxDbIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service get influx db integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetInfluxDbIntegrationParams) WithDefaults() *ApplicationServiceGetInfluxDbIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service get influx db integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetInfluxDbIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service get influx db integration params +func (o *ApplicationServiceGetInfluxDbIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetInfluxDbIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service get influx db integration params +func (o *ApplicationServiceGetInfluxDbIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service get influx db integration params +func (o *ApplicationServiceGetInfluxDbIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetInfluxDbIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service get influx db integration params +func (o *ApplicationServiceGetInfluxDbIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service get influx db integration params +func (o *ApplicationServiceGetInfluxDbIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetInfluxDbIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service get influx db integration params +func (o *ApplicationServiceGetInfluxDbIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service get influx db integration params +func (o *ApplicationServiceGetInfluxDbIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetInfluxDbIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service get influx db integration params +func (o *ApplicationServiceGetInfluxDbIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceGetInfluxDbIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_influx_db_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_influx_db_integration_responses.go new file mode 100644 index 0000000..e7a12f3 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_influx_db_integration_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceGetInfluxDbIntegrationReader is a Reader for the ApplicationServiceGetInfluxDbIntegration structure. +type ApplicationServiceGetInfluxDbIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceGetInfluxDbIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceGetInfluxDbIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceGetInfluxDbIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceGetInfluxDbIntegrationOK creates a ApplicationServiceGetInfluxDbIntegrationOK with default headers values +func NewApplicationServiceGetInfluxDbIntegrationOK() *ApplicationServiceGetInfluxDbIntegrationOK { + return &ApplicationServiceGetInfluxDbIntegrationOK{} +} + +/* +ApplicationServiceGetInfluxDbIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceGetInfluxDbIntegrationOK struct { + Payload *models.APIGetInfluxDbIntegrationResponse +} + +// IsSuccess returns true when this application service get influx db integration o k response has a 2xx status code +func (o *ApplicationServiceGetInfluxDbIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service get influx db integration o k response has a 3xx status code +func (o *ApplicationServiceGetInfluxDbIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service get influx db integration o k response has a 4xx status code +func (o *ApplicationServiceGetInfluxDbIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service get influx db integration o k response has a 5xx status code +func (o *ApplicationServiceGetInfluxDbIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service get influx db integration o k response a status code equal to that given +func (o *ApplicationServiceGetInfluxDbIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service get influx db integration o k response +func (o *ApplicationServiceGetInfluxDbIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceGetInfluxDbIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/influxdb][%d] applicationServiceGetInfluxDbIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetInfluxDbIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/influxdb][%d] applicationServiceGetInfluxDbIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetInfluxDbIntegrationOK) GetPayload() *models.APIGetInfluxDbIntegrationResponse { + return o.Payload +} + +func (o *ApplicationServiceGetInfluxDbIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetInfluxDbIntegrationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceGetInfluxDbIntegrationDefault creates a ApplicationServiceGetInfluxDbIntegrationDefault with default headers values +func NewApplicationServiceGetInfluxDbIntegrationDefault(code int) *ApplicationServiceGetInfluxDbIntegrationDefault { + return &ApplicationServiceGetInfluxDbIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceGetInfluxDbIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceGetInfluxDbIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service get influx db integration default response has a 2xx status code +func (o *ApplicationServiceGetInfluxDbIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service get influx db integration default response has a 3xx status code +func (o *ApplicationServiceGetInfluxDbIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service get influx db integration default response has a 4xx status code +func (o *ApplicationServiceGetInfluxDbIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service get influx db integration default response has a 5xx status code +func (o *ApplicationServiceGetInfluxDbIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service get influx db integration default response a status code equal to that given +func (o *ApplicationServiceGetInfluxDbIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service get influx db integration default response +func (o *ApplicationServiceGetInfluxDbIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceGetInfluxDbIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/influxdb][%d] ApplicationService_GetInfluxDbIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetInfluxDbIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/influxdb][%d] ApplicationService_GetInfluxDbIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetInfluxDbIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceGetInfluxDbIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_my_devices_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_my_devices_integration_parameters.go new file mode 100644 index 0000000..2bb2d8c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_my_devices_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceGetMyDevicesIntegrationParams creates a new ApplicationServiceGetMyDevicesIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceGetMyDevicesIntegrationParams() *ApplicationServiceGetMyDevicesIntegrationParams { + return &ApplicationServiceGetMyDevicesIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceGetMyDevicesIntegrationParamsWithTimeout creates a new ApplicationServiceGetMyDevicesIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceGetMyDevicesIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetMyDevicesIntegrationParams { + return &ApplicationServiceGetMyDevicesIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceGetMyDevicesIntegrationParamsWithContext creates a new ApplicationServiceGetMyDevicesIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceGetMyDevicesIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetMyDevicesIntegrationParams { + return &ApplicationServiceGetMyDevicesIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceGetMyDevicesIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetMyDevicesIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceGetMyDevicesIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetMyDevicesIntegrationParams { + return &ApplicationServiceGetMyDevicesIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceGetMyDevicesIntegrationParams contains all the parameters to send to the API endpoint + + for the application service get my devices integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceGetMyDevicesIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service get my devices integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetMyDevicesIntegrationParams) WithDefaults() *ApplicationServiceGetMyDevicesIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service get my devices integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetMyDevicesIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service get my devices integration params +func (o *ApplicationServiceGetMyDevicesIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetMyDevicesIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service get my devices integration params +func (o *ApplicationServiceGetMyDevicesIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service get my devices integration params +func (o *ApplicationServiceGetMyDevicesIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetMyDevicesIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service get my devices integration params +func (o *ApplicationServiceGetMyDevicesIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service get my devices integration params +func (o *ApplicationServiceGetMyDevicesIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetMyDevicesIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service get my devices integration params +func (o *ApplicationServiceGetMyDevicesIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service get my devices integration params +func (o *ApplicationServiceGetMyDevicesIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetMyDevicesIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service get my devices integration params +func (o *ApplicationServiceGetMyDevicesIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceGetMyDevicesIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_my_devices_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_my_devices_integration_responses.go new file mode 100644 index 0000000..5b8833e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_my_devices_integration_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceGetMyDevicesIntegrationReader is a Reader for the ApplicationServiceGetMyDevicesIntegration structure. +type ApplicationServiceGetMyDevicesIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceGetMyDevicesIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceGetMyDevicesIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceGetMyDevicesIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceGetMyDevicesIntegrationOK creates a ApplicationServiceGetMyDevicesIntegrationOK with default headers values +func NewApplicationServiceGetMyDevicesIntegrationOK() *ApplicationServiceGetMyDevicesIntegrationOK { + return &ApplicationServiceGetMyDevicesIntegrationOK{} +} + +/* +ApplicationServiceGetMyDevicesIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceGetMyDevicesIntegrationOK struct { + Payload *models.APIGetMyDevicesIntegrationResponse +} + +// IsSuccess returns true when this application service get my devices integration o k response has a 2xx status code +func (o *ApplicationServiceGetMyDevicesIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service get my devices integration o k response has a 3xx status code +func (o *ApplicationServiceGetMyDevicesIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service get my devices integration o k response has a 4xx status code +func (o *ApplicationServiceGetMyDevicesIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service get my devices integration o k response has a 5xx status code +func (o *ApplicationServiceGetMyDevicesIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service get my devices integration o k response a status code equal to that given +func (o *ApplicationServiceGetMyDevicesIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service get my devices integration o k response +func (o *ApplicationServiceGetMyDevicesIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceGetMyDevicesIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/mydevices][%d] applicationServiceGetMyDevicesIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetMyDevicesIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/mydevices][%d] applicationServiceGetMyDevicesIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetMyDevicesIntegrationOK) GetPayload() *models.APIGetMyDevicesIntegrationResponse { + return o.Payload +} + +func (o *ApplicationServiceGetMyDevicesIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetMyDevicesIntegrationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceGetMyDevicesIntegrationDefault creates a ApplicationServiceGetMyDevicesIntegrationDefault with default headers values +func NewApplicationServiceGetMyDevicesIntegrationDefault(code int) *ApplicationServiceGetMyDevicesIntegrationDefault { + return &ApplicationServiceGetMyDevicesIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceGetMyDevicesIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceGetMyDevicesIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service get my devices integration default response has a 2xx status code +func (o *ApplicationServiceGetMyDevicesIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service get my devices integration default response has a 3xx status code +func (o *ApplicationServiceGetMyDevicesIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service get my devices integration default response has a 4xx status code +func (o *ApplicationServiceGetMyDevicesIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service get my devices integration default response has a 5xx status code +func (o *ApplicationServiceGetMyDevicesIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service get my devices integration default response a status code equal to that given +func (o *ApplicationServiceGetMyDevicesIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service get my devices integration default response +func (o *ApplicationServiceGetMyDevicesIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceGetMyDevicesIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/mydevices][%d] ApplicationService_GetMyDevicesIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetMyDevicesIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/mydevices][%d] ApplicationService_GetMyDevicesIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetMyDevicesIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceGetMyDevicesIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_parameters.go new file mode 100644 index 0000000..58748cc --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceGetParams creates a new ApplicationServiceGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceGetParams() *ApplicationServiceGetParams { + return &ApplicationServiceGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceGetParamsWithTimeout creates a new ApplicationServiceGetParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceGetParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetParams { + return &ApplicationServiceGetParams{ + timeout: timeout, + } +} + +// NewApplicationServiceGetParamsWithContext creates a new ApplicationServiceGetParams object +// with the ability to set a context for a request. +func NewApplicationServiceGetParamsWithContext(ctx context.Context) *ApplicationServiceGetParams { + return &ApplicationServiceGetParams{ + Context: ctx, + } +} + +// NewApplicationServiceGetParamsWithHTTPClient creates a new ApplicationServiceGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceGetParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetParams { + return &ApplicationServiceGetParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceGetParams contains all the parameters to send to the API endpoint + + for the application service get operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceGetParams struct { + + /* ID. + + Application ID (UUID). + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetParams) WithDefaults() *ApplicationServiceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service get params +func (o *ApplicationServiceGetParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service get params +func (o *ApplicationServiceGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service get params +func (o *ApplicationServiceGetParams) WithContext(ctx context.Context) *ApplicationServiceGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service get params +func (o *ApplicationServiceGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service get params +func (o *ApplicationServiceGetParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service get params +func (o *ApplicationServiceGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the application service get params +func (o *ApplicationServiceGetParams) WithID(id string) *ApplicationServiceGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the application service get params +func (o *ApplicationServiceGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_pilot_things_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_pilot_things_integration_parameters.go new file mode 100644 index 0000000..26a4fe6 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_pilot_things_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceGetPilotThingsIntegrationParams creates a new ApplicationServiceGetPilotThingsIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceGetPilotThingsIntegrationParams() *ApplicationServiceGetPilotThingsIntegrationParams { + return &ApplicationServiceGetPilotThingsIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceGetPilotThingsIntegrationParamsWithTimeout creates a new ApplicationServiceGetPilotThingsIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceGetPilotThingsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetPilotThingsIntegrationParams { + return &ApplicationServiceGetPilotThingsIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceGetPilotThingsIntegrationParamsWithContext creates a new ApplicationServiceGetPilotThingsIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceGetPilotThingsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetPilotThingsIntegrationParams { + return &ApplicationServiceGetPilotThingsIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceGetPilotThingsIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetPilotThingsIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceGetPilotThingsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetPilotThingsIntegrationParams { + return &ApplicationServiceGetPilotThingsIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceGetPilotThingsIntegrationParams contains all the parameters to send to the API endpoint + + for the application service get pilot things integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceGetPilotThingsIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service get pilot things integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetPilotThingsIntegrationParams) WithDefaults() *ApplicationServiceGetPilotThingsIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service get pilot things integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetPilotThingsIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service get pilot things integration params +func (o *ApplicationServiceGetPilotThingsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetPilotThingsIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service get pilot things integration params +func (o *ApplicationServiceGetPilotThingsIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service get pilot things integration params +func (o *ApplicationServiceGetPilotThingsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetPilotThingsIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service get pilot things integration params +func (o *ApplicationServiceGetPilotThingsIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service get pilot things integration params +func (o *ApplicationServiceGetPilotThingsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetPilotThingsIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service get pilot things integration params +func (o *ApplicationServiceGetPilotThingsIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service get pilot things integration params +func (o *ApplicationServiceGetPilotThingsIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetPilotThingsIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service get pilot things integration params +func (o *ApplicationServiceGetPilotThingsIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceGetPilotThingsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_pilot_things_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_pilot_things_integration_responses.go new file mode 100644 index 0000000..43515de --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_pilot_things_integration_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceGetPilotThingsIntegrationReader is a Reader for the ApplicationServiceGetPilotThingsIntegration structure. +type ApplicationServiceGetPilotThingsIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceGetPilotThingsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceGetPilotThingsIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceGetPilotThingsIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceGetPilotThingsIntegrationOK creates a ApplicationServiceGetPilotThingsIntegrationOK with default headers values +func NewApplicationServiceGetPilotThingsIntegrationOK() *ApplicationServiceGetPilotThingsIntegrationOK { + return &ApplicationServiceGetPilotThingsIntegrationOK{} +} + +/* +ApplicationServiceGetPilotThingsIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceGetPilotThingsIntegrationOK struct { + Payload *models.APIGetPilotThingsIntegrationResponse +} + +// IsSuccess returns true when this application service get pilot things integration o k response has a 2xx status code +func (o *ApplicationServiceGetPilotThingsIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service get pilot things integration o k response has a 3xx status code +func (o *ApplicationServiceGetPilotThingsIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service get pilot things integration o k response has a 4xx status code +func (o *ApplicationServiceGetPilotThingsIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service get pilot things integration o k response has a 5xx status code +func (o *ApplicationServiceGetPilotThingsIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service get pilot things integration o k response a status code equal to that given +func (o *ApplicationServiceGetPilotThingsIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service get pilot things integration o k response +func (o *ApplicationServiceGetPilotThingsIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceGetPilotThingsIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/pilot-things][%d] applicationServiceGetPilotThingsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetPilotThingsIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/pilot-things][%d] applicationServiceGetPilotThingsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetPilotThingsIntegrationOK) GetPayload() *models.APIGetPilotThingsIntegrationResponse { + return o.Payload +} + +func (o *ApplicationServiceGetPilotThingsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetPilotThingsIntegrationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceGetPilotThingsIntegrationDefault creates a ApplicationServiceGetPilotThingsIntegrationDefault with default headers values +func NewApplicationServiceGetPilotThingsIntegrationDefault(code int) *ApplicationServiceGetPilotThingsIntegrationDefault { + return &ApplicationServiceGetPilotThingsIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceGetPilotThingsIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceGetPilotThingsIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service get pilot things integration default response has a 2xx status code +func (o *ApplicationServiceGetPilotThingsIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service get pilot things integration default response has a 3xx status code +func (o *ApplicationServiceGetPilotThingsIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service get pilot things integration default response has a 4xx status code +func (o *ApplicationServiceGetPilotThingsIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service get pilot things integration default response has a 5xx status code +func (o *ApplicationServiceGetPilotThingsIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service get pilot things integration default response a status code equal to that given +func (o *ApplicationServiceGetPilotThingsIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service get pilot things integration default response +func (o *ApplicationServiceGetPilotThingsIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceGetPilotThingsIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/pilot-things][%d] ApplicationService_GetPilotThingsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetPilotThingsIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/pilot-things][%d] ApplicationService_GetPilotThingsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetPilotThingsIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceGetPilotThingsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_responses.go new file mode 100644 index 0000000..cfd79a0 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceGetReader is a Reader for the ApplicationServiceGet structure. +type ApplicationServiceGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceGetDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceGetOK creates a ApplicationServiceGetOK with default headers values +func NewApplicationServiceGetOK() *ApplicationServiceGetOK { + return &ApplicationServiceGetOK{} +} + +/* +ApplicationServiceGetOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceGetOK struct { + Payload *models.APIGetApplicationResponse +} + +// IsSuccess returns true when this application service get o k response has a 2xx status code +func (o *ApplicationServiceGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service get o k response has a 3xx status code +func (o *ApplicationServiceGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service get o k response has a 4xx status code +func (o *ApplicationServiceGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service get o k response has a 5xx status code +func (o *ApplicationServiceGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service get o k response a status code equal to that given +func (o *ApplicationServiceGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service get o k response +func (o *ApplicationServiceGetOK) Code() int { + return 200 +} + +func (o *ApplicationServiceGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{id}][%d] applicationServiceGetOK %s", 200, payload) +} + +func (o *ApplicationServiceGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{id}][%d] applicationServiceGetOK %s", 200, payload) +} + +func (o *ApplicationServiceGetOK) GetPayload() *models.APIGetApplicationResponse { + return o.Payload +} + +func (o *ApplicationServiceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetApplicationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceGetDefault creates a ApplicationServiceGetDefault with default headers values +func NewApplicationServiceGetDefault(code int) *ApplicationServiceGetDefault { + return &ApplicationServiceGetDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceGetDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceGetDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service get default response has a 2xx status code +func (o *ApplicationServiceGetDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service get default response has a 3xx status code +func (o *ApplicationServiceGetDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service get default response has a 4xx status code +func (o *ApplicationServiceGetDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service get default response has a 5xx status code +func (o *ApplicationServiceGetDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service get default response a status code equal to that given +func (o *ApplicationServiceGetDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service get default response +func (o *ApplicationServiceGetDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceGetDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{id}][%d] ApplicationService_Get default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{id}][%d] ApplicationService_Get default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceGetDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_things_board_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_things_board_integration_parameters.go new file mode 100644 index 0000000..95fc0bb --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_things_board_integration_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceGetThingsBoardIntegrationParams creates a new ApplicationServiceGetThingsBoardIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceGetThingsBoardIntegrationParams() *ApplicationServiceGetThingsBoardIntegrationParams { + return &ApplicationServiceGetThingsBoardIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceGetThingsBoardIntegrationParamsWithTimeout creates a new ApplicationServiceGetThingsBoardIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceGetThingsBoardIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceGetThingsBoardIntegrationParams { + return &ApplicationServiceGetThingsBoardIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceGetThingsBoardIntegrationParamsWithContext creates a new ApplicationServiceGetThingsBoardIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceGetThingsBoardIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceGetThingsBoardIntegrationParams { + return &ApplicationServiceGetThingsBoardIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceGetThingsBoardIntegrationParamsWithHTTPClient creates a new ApplicationServiceGetThingsBoardIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceGetThingsBoardIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceGetThingsBoardIntegrationParams { + return &ApplicationServiceGetThingsBoardIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceGetThingsBoardIntegrationParams contains all the parameters to send to the API endpoint + + for the application service get things board integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceGetThingsBoardIntegrationParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service get things board integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetThingsBoardIntegrationParams) WithDefaults() *ApplicationServiceGetThingsBoardIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service get things board integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceGetThingsBoardIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service get things board integration params +func (o *ApplicationServiceGetThingsBoardIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceGetThingsBoardIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service get things board integration params +func (o *ApplicationServiceGetThingsBoardIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service get things board integration params +func (o *ApplicationServiceGetThingsBoardIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceGetThingsBoardIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service get things board integration params +func (o *ApplicationServiceGetThingsBoardIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service get things board integration params +func (o *ApplicationServiceGetThingsBoardIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceGetThingsBoardIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service get things board integration params +func (o *ApplicationServiceGetThingsBoardIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service get things board integration params +func (o *ApplicationServiceGetThingsBoardIntegrationParams) WithApplicationID(applicationID string) *ApplicationServiceGetThingsBoardIntegrationParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service get things board integration params +func (o *ApplicationServiceGetThingsBoardIntegrationParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceGetThingsBoardIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_things_board_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_things_board_integration_responses.go new file mode 100644 index 0000000..8390eef --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_get_things_board_integration_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceGetThingsBoardIntegrationReader is a Reader for the ApplicationServiceGetThingsBoardIntegration structure. +type ApplicationServiceGetThingsBoardIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceGetThingsBoardIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceGetThingsBoardIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceGetThingsBoardIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceGetThingsBoardIntegrationOK creates a ApplicationServiceGetThingsBoardIntegrationOK with default headers values +func NewApplicationServiceGetThingsBoardIntegrationOK() *ApplicationServiceGetThingsBoardIntegrationOK { + return &ApplicationServiceGetThingsBoardIntegrationOK{} +} + +/* +ApplicationServiceGetThingsBoardIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceGetThingsBoardIntegrationOK struct { + Payload *models.APIGetThingsBoardIntegrationResponse +} + +// IsSuccess returns true when this application service get things board integration o k response has a 2xx status code +func (o *ApplicationServiceGetThingsBoardIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service get things board integration o k response has a 3xx status code +func (o *ApplicationServiceGetThingsBoardIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service get things board integration o k response has a 4xx status code +func (o *ApplicationServiceGetThingsBoardIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service get things board integration o k response has a 5xx status code +func (o *ApplicationServiceGetThingsBoardIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service get things board integration o k response a status code equal to that given +func (o *ApplicationServiceGetThingsBoardIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service get things board integration o k response +func (o *ApplicationServiceGetThingsBoardIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceGetThingsBoardIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/thingsboard][%d] applicationServiceGetThingsBoardIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetThingsBoardIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/thingsboard][%d] applicationServiceGetThingsBoardIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceGetThingsBoardIntegrationOK) GetPayload() *models.APIGetThingsBoardIntegrationResponse { + return o.Payload +} + +func (o *ApplicationServiceGetThingsBoardIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetThingsBoardIntegrationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceGetThingsBoardIntegrationDefault creates a ApplicationServiceGetThingsBoardIntegrationDefault with default headers values +func NewApplicationServiceGetThingsBoardIntegrationDefault(code int) *ApplicationServiceGetThingsBoardIntegrationDefault { + return &ApplicationServiceGetThingsBoardIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceGetThingsBoardIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceGetThingsBoardIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service get things board integration default response has a 2xx status code +func (o *ApplicationServiceGetThingsBoardIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service get things board integration default response has a 3xx status code +func (o *ApplicationServiceGetThingsBoardIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service get things board integration default response has a 4xx status code +func (o *ApplicationServiceGetThingsBoardIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service get things board integration default response has a 5xx status code +func (o *ApplicationServiceGetThingsBoardIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service get things board integration default response a status code equal to that given +func (o *ApplicationServiceGetThingsBoardIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service get things board integration default response +func (o *ApplicationServiceGetThingsBoardIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceGetThingsBoardIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/thingsboard][%d] ApplicationService_GetThingsBoardIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetThingsBoardIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations/thingsboard][%d] ApplicationService_GetThingsBoardIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceGetThingsBoardIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceGetThingsBoardIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_device_profiles_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_device_profiles_parameters.go new file mode 100644 index 0000000..6fc30c2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_device_profiles_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceListDeviceProfilesParams creates a new ApplicationServiceListDeviceProfilesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceListDeviceProfilesParams() *ApplicationServiceListDeviceProfilesParams { + return &ApplicationServiceListDeviceProfilesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceListDeviceProfilesParamsWithTimeout creates a new ApplicationServiceListDeviceProfilesParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceListDeviceProfilesParamsWithTimeout(timeout time.Duration) *ApplicationServiceListDeviceProfilesParams { + return &ApplicationServiceListDeviceProfilesParams{ + timeout: timeout, + } +} + +// NewApplicationServiceListDeviceProfilesParamsWithContext creates a new ApplicationServiceListDeviceProfilesParams object +// with the ability to set a context for a request. +func NewApplicationServiceListDeviceProfilesParamsWithContext(ctx context.Context) *ApplicationServiceListDeviceProfilesParams { + return &ApplicationServiceListDeviceProfilesParams{ + Context: ctx, + } +} + +// NewApplicationServiceListDeviceProfilesParamsWithHTTPClient creates a new ApplicationServiceListDeviceProfilesParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceListDeviceProfilesParamsWithHTTPClient(client *http.Client) *ApplicationServiceListDeviceProfilesParams { + return &ApplicationServiceListDeviceProfilesParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceListDeviceProfilesParams contains all the parameters to send to the API endpoint + + for the application service list device profiles operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceListDeviceProfilesParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service list device profiles params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceListDeviceProfilesParams) WithDefaults() *ApplicationServiceListDeviceProfilesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service list device profiles params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceListDeviceProfilesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service list device profiles params +func (o *ApplicationServiceListDeviceProfilesParams) WithTimeout(timeout time.Duration) *ApplicationServiceListDeviceProfilesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service list device profiles params +func (o *ApplicationServiceListDeviceProfilesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service list device profiles params +func (o *ApplicationServiceListDeviceProfilesParams) WithContext(ctx context.Context) *ApplicationServiceListDeviceProfilesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service list device profiles params +func (o *ApplicationServiceListDeviceProfilesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service list device profiles params +func (o *ApplicationServiceListDeviceProfilesParams) WithHTTPClient(client *http.Client) *ApplicationServiceListDeviceProfilesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service list device profiles params +func (o *ApplicationServiceListDeviceProfilesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service list device profiles params +func (o *ApplicationServiceListDeviceProfilesParams) WithApplicationID(applicationID string) *ApplicationServiceListDeviceProfilesParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service list device profiles params +func (o *ApplicationServiceListDeviceProfilesParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceListDeviceProfilesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_device_profiles_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_device_profiles_responses.go new file mode 100644 index 0000000..3ad673a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_device_profiles_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceListDeviceProfilesReader is a Reader for the ApplicationServiceListDeviceProfiles structure. +type ApplicationServiceListDeviceProfilesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceListDeviceProfilesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceListDeviceProfilesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceListDeviceProfilesDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceListDeviceProfilesOK creates a ApplicationServiceListDeviceProfilesOK with default headers values +func NewApplicationServiceListDeviceProfilesOK() *ApplicationServiceListDeviceProfilesOK { + return &ApplicationServiceListDeviceProfilesOK{} +} + +/* +ApplicationServiceListDeviceProfilesOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceListDeviceProfilesOK struct { + Payload *models.APIListApplicationDeviceProfilesResponse +} + +// IsSuccess returns true when this application service list device profiles o k response has a 2xx status code +func (o *ApplicationServiceListDeviceProfilesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service list device profiles o k response has a 3xx status code +func (o *ApplicationServiceListDeviceProfilesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service list device profiles o k response has a 4xx status code +func (o *ApplicationServiceListDeviceProfilesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service list device profiles o k response has a 5xx status code +func (o *ApplicationServiceListDeviceProfilesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service list device profiles o k response a status code equal to that given +func (o *ApplicationServiceListDeviceProfilesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service list device profiles o k response +func (o *ApplicationServiceListDeviceProfilesOK) Code() int { + return 200 +} + +func (o *ApplicationServiceListDeviceProfilesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/device-profiles][%d] applicationServiceListDeviceProfilesOK %s", 200, payload) +} + +func (o *ApplicationServiceListDeviceProfilesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/device-profiles][%d] applicationServiceListDeviceProfilesOK %s", 200, payload) +} + +func (o *ApplicationServiceListDeviceProfilesOK) GetPayload() *models.APIListApplicationDeviceProfilesResponse { + return o.Payload +} + +func (o *ApplicationServiceListDeviceProfilesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListApplicationDeviceProfilesResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceListDeviceProfilesDefault creates a ApplicationServiceListDeviceProfilesDefault with default headers values +func NewApplicationServiceListDeviceProfilesDefault(code int) *ApplicationServiceListDeviceProfilesDefault { + return &ApplicationServiceListDeviceProfilesDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceListDeviceProfilesDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceListDeviceProfilesDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service list device profiles default response has a 2xx status code +func (o *ApplicationServiceListDeviceProfilesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service list device profiles default response has a 3xx status code +func (o *ApplicationServiceListDeviceProfilesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service list device profiles default response has a 4xx status code +func (o *ApplicationServiceListDeviceProfilesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service list device profiles default response has a 5xx status code +func (o *ApplicationServiceListDeviceProfilesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service list device profiles default response a status code equal to that given +func (o *ApplicationServiceListDeviceProfilesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service list device profiles default response +func (o *ApplicationServiceListDeviceProfilesDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceListDeviceProfilesDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/device-profiles][%d] ApplicationService_ListDeviceProfiles default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceListDeviceProfilesDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/device-profiles][%d] ApplicationService_ListDeviceProfiles default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceListDeviceProfilesDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceListDeviceProfilesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_device_tags_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_device_tags_parameters.go new file mode 100644 index 0000000..d574eb2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_device_tags_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceListDeviceTagsParams creates a new ApplicationServiceListDeviceTagsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceListDeviceTagsParams() *ApplicationServiceListDeviceTagsParams { + return &ApplicationServiceListDeviceTagsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceListDeviceTagsParamsWithTimeout creates a new ApplicationServiceListDeviceTagsParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceListDeviceTagsParamsWithTimeout(timeout time.Duration) *ApplicationServiceListDeviceTagsParams { + return &ApplicationServiceListDeviceTagsParams{ + timeout: timeout, + } +} + +// NewApplicationServiceListDeviceTagsParamsWithContext creates a new ApplicationServiceListDeviceTagsParams object +// with the ability to set a context for a request. +func NewApplicationServiceListDeviceTagsParamsWithContext(ctx context.Context) *ApplicationServiceListDeviceTagsParams { + return &ApplicationServiceListDeviceTagsParams{ + Context: ctx, + } +} + +// NewApplicationServiceListDeviceTagsParamsWithHTTPClient creates a new ApplicationServiceListDeviceTagsParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceListDeviceTagsParamsWithHTTPClient(client *http.Client) *ApplicationServiceListDeviceTagsParams { + return &ApplicationServiceListDeviceTagsParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceListDeviceTagsParams contains all the parameters to send to the API endpoint + + for the application service list device tags operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceListDeviceTagsParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service list device tags params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceListDeviceTagsParams) WithDefaults() *ApplicationServiceListDeviceTagsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service list device tags params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceListDeviceTagsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service list device tags params +func (o *ApplicationServiceListDeviceTagsParams) WithTimeout(timeout time.Duration) *ApplicationServiceListDeviceTagsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service list device tags params +func (o *ApplicationServiceListDeviceTagsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service list device tags params +func (o *ApplicationServiceListDeviceTagsParams) WithContext(ctx context.Context) *ApplicationServiceListDeviceTagsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service list device tags params +func (o *ApplicationServiceListDeviceTagsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service list device tags params +func (o *ApplicationServiceListDeviceTagsParams) WithHTTPClient(client *http.Client) *ApplicationServiceListDeviceTagsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service list device tags params +func (o *ApplicationServiceListDeviceTagsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service list device tags params +func (o *ApplicationServiceListDeviceTagsParams) WithApplicationID(applicationID string) *ApplicationServiceListDeviceTagsParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service list device tags params +func (o *ApplicationServiceListDeviceTagsParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceListDeviceTagsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_device_tags_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_device_tags_responses.go new file mode 100644 index 0000000..0cde14a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_device_tags_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceListDeviceTagsReader is a Reader for the ApplicationServiceListDeviceTags structure. +type ApplicationServiceListDeviceTagsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceListDeviceTagsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceListDeviceTagsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceListDeviceTagsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceListDeviceTagsOK creates a ApplicationServiceListDeviceTagsOK with default headers values +func NewApplicationServiceListDeviceTagsOK() *ApplicationServiceListDeviceTagsOK { + return &ApplicationServiceListDeviceTagsOK{} +} + +/* +ApplicationServiceListDeviceTagsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceListDeviceTagsOK struct { + Payload *models.APIListApplicationDeviceTagsResponse +} + +// IsSuccess returns true when this application service list device tags o k response has a 2xx status code +func (o *ApplicationServiceListDeviceTagsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service list device tags o k response has a 3xx status code +func (o *ApplicationServiceListDeviceTagsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service list device tags o k response has a 4xx status code +func (o *ApplicationServiceListDeviceTagsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service list device tags o k response has a 5xx status code +func (o *ApplicationServiceListDeviceTagsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service list device tags o k response a status code equal to that given +func (o *ApplicationServiceListDeviceTagsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service list device tags o k response +func (o *ApplicationServiceListDeviceTagsOK) Code() int { + return 200 +} + +func (o *ApplicationServiceListDeviceTagsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/device-tags][%d] applicationServiceListDeviceTagsOK %s", 200, payload) +} + +func (o *ApplicationServiceListDeviceTagsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/device-tags][%d] applicationServiceListDeviceTagsOK %s", 200, payload) +} + +func (o *ApplicationServiceListDeviceTagsOK) GetPayload() *models.APIListApplicationDeviceTagsResponse { + return o.Payload +} + +func (o *ApplicationServiceListDeviceTagsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListApplicationDeviceTagsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceListDeviceTagsDefault creates a ApplicationServiceListDeviceTagsDefault with default headers values +func NewApplicationServiceListDeviceTagsDefault(code int) *ApplicationServiceListDeviceTagsDefault { + return &ApplicationServiceListDeviceTagsDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceListDeviceTagsDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceListDeviceTagsDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service list device tags default response has a 2xx status code +func (o *ApplicationServiceListDeviceTagsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service list device tags default response has a 3xx status code +func (o *ApplicationServiceListDeviceTagsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service list device tags default response has a 4xx status code +func (o *ApplicationServiceListDeviceTagsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service list device tags default response has a 5xx status code +func (o *ApplicationServiceListDeviceTagsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service list device tags default response a status code equal to that given +func (o *ApplicationServiceListDeviceTagsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service list device tags default response +func (o *ApplicationServiceListDeviceTagsDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceListDeviceTagsDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/device-tags][%d] ApplicationService_ListDeviceTags default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceListDeviceTagsDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/device-tags][%d] ApplicationService_ListDeviceTags default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceListDeviceTagsDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceListDeviceTagsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_integrations_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_integrations_parameters.go new file mode 100644 index 0000000..3c74775 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_integrations_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceListIntegrationsParams creates a new ApplicationServiceListIntegrationsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceListIntegrationsParams() *ApplicationServiceListIntegrationsParams { + return &ApplicationServiceListIntegrationsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceListIntegrationsParamsWithTimeout creates a new ApplicationServiceListIntegrationsParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceListIntegrationsParamsWithTimeout(timeout time.Duration) *ApplicationServiceListIntegrationsParams { + return &ApplicationServiceListIntegrationsParams{ + timeout: timeout, + } +} + +// NewApplicationServiceListIntegrationsParamsWithContext creates a new ApplicationServiceListIntegrationsParams object +// with the ability to set a context for a request. +func NewApplicationServiceListIntegrationsParamsWithContext(ctx context.Context) *ApplicationServiceListIntegrationsParams { + return &ApplicationServiceListIntegrationsParams{ + Context: ctx, + } +} + +// NewApplicationServiceListIntegrationsParamsWithHTTPClient creates a new ApplicationServiceListIntegrationsParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceListIntegrationsParamsWithHTTPClient(client *http.Client) *ApplicationServiceListIntegrationsParams { + return &ApplicationServiceListIntegrationsParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceListIntegrationsParams contains all the parameters to send to the API endpoint + + for the application service list integrations operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceListIntegrationsParams struct { + + /* ApplicationID. + + Application ID (UUID). + */ + ApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service list integrations params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceListIntegrationsParams) WithDefaults() *ApplicationServiceListIntegrationsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service list integrations params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceListIntegrationsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service list integrations params +func (o *ApplicationServiceListIntegrationsParams) WithTimeout(timeout time.Duration) *ApplicationServiceListIntegrationsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service list integrations params +func (o *ApplicationServiceListIntegrationsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service list integrations params +func (o *ApplicationServiceListIntegrationsParams) WithContext(ctx context.Context) *ApplicationServiceListIntegrationsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service list integrations params +func (o *ApplicationServiceListIntegrationsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service list integrations params +func (o *ApplicationServiceListIntegrationsParams) WithHTTPClient(client *http.Client) *ApplicationServiceListIntegrationsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service list integrations params +func (o *ApplicationServiceListIntegrationsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service list integrations params +func (o *ApplicationServiceListIntegrationsParams) WithApplicationID(applicationID string) *ApplicationServiceListIntegrationsParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service list integrations params +func (o *ApplicationServiceListIntegrationsParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceListIntegrationsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param applicationId + if err := r.SetPathParam("applicationId", o.ApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_integrations_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_integrations_responses.go new file mode 100644 index 0000000..0dd4ec2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_integrations_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceListIntegrationsReader is a Reader for the ApplicationServiceListIntegrations structure. +type ApplicationServiceListIntegrationsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceListIntegrationsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceListIntegrationsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceListIntegrationsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceListIntegrationsOK creates a ApplicationServiceListIntegrationsOK with default headers values +func NewApplicationServiceListIntegrationsOK() *ApplicationServiceListIntegrationsOK { + return &ApplicationServiceListIntegrationsOK{} +} + +/* +ApplicationServiceListIntegrationsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceListIntegrationsOK struct { + Payload *models.APIListIntegrationsResponse +} + +// IsSuccess returns true when this application service list integrations o k response has a 2xx status code +func (o *ApplicationServiceListIntegrationsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service list integrations o k response has a 3xx status code +func (o *ApplicationServiceListIntegrationsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service list integrations o k response has a 4xx status code +func (o *ApplicationServiceListIntegrationsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service list integrations o k response has a 5xx status code +func (o *ApplicationServiceListIntegrationsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service list integrations o k response a status code equal to that given +func (o *ApplicationServiceListIntegrationsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service list integrations o k response +func (o *ApplicationServiceListIntegrationsOK) Code() int { + return 200 +} + +func (o *ApplicationServiceListIntegrationsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations][%d] applicationServiceListIntegrationsOK %s", 200, payload) +} + +func (o *ApplicationServiceListIntegrationsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations][%d] applicationServiceListIntegrationsOK %s", 200, payload) +} + +func (o *ApplicationServiceListIntegrationsOK) GetPayload() *models.APIListIntegrationsResponse { + return o.Payload +} + +func (o *ApplicationServiceListIntegrationsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListIntegrationsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceListIntegrationsDefault creates a ApplicationServiceListIntegrationsDefault with default headers values +func NewApplicationServiceListIntegrationsDefault(code int) *ApplicationServiceListIntegrationsDefault { + return &ApplicationServiceListIntegrationsDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceListIntegrationsDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceListIntegrationsDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service list integrations default response has a 2xx status code +func (o *ApplicationServiceListIntegrationsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service list integrations default response has a 3xx status code +func (o *ApplicationServiceListIntegrationsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service list integrations default response has a 4xx status code +func (o *ApplicationServiceListIntegrationsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service list integrations default response has a 5xx status code +func (o *ApplicationServiceListIntegrationsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service list integrations default response a status code equal to that given +func (o *ApplicationServiceListIntegrationsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service list integrations default response +func (o *ApplicationServiceListIntegrationsDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceListIntegrationsDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations][%d] ApplicationService_ListIntegrations default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceListIntegrationsDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications/{applicationId}/integrations][%d] ApplicationService_ListIntegrations default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceListIntegrationsDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceListIntegrationsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_parameters.go new file mode 100644 index 0000000..3f266c5 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_parameters.go @@ -0,0 +1,271 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewApplicationServiceListParams creates a new ApplicationServiceListParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceListParams() *ApplicationServiceListParams { + return &ApplicationServiceListParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceListParamsWithTimeout creates a new ApplicationServiceListParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceListParamsWithTimeout(timeout time.Duration) *ApplicationServiceListParams { + return &ApplicationServiceListParams{ + timeout: timeout, + } +} + +// NewApplicationServiceListParamsWithContext creates a new ApplicationServiceListParams object +// with the ability to set a context for a request. +func NewApplicationServiceListParamsWithContext(ctx context.Context) *ApplicationServiceListParams { + return &ApplicationServiceListParams{ + Context: ctx, + } +} + +// NewApplicationServiceListParamsWithHTTPClient creates a new ApplicationServiceListParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceListParamsWithHTTPClient(client *http.Client) *ApplicationServiceListParams { + return &ApplicationServiceListParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceListParams contains all the parameters to send to the API endpoint + + for the application service list operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceListParams struct { + + /* Limit. + + Max number of applications to return in the result-set. + If not set, it will be treated as 0, and the response will only return the total_count. + + Format: int64 + */ + Limit *int64 + + /* Offset. + + Offset in the result-set (for pagination). + + Format: int64 + */ + Offset *int64 + + /* Search. + + If set, the given string will be used to search on name (optional). + */ + Search *string + + /* TenantID. + + Tenant ID to list the applications for. + */ + TenantID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceListParams) WithDefaults() *ApplicationServiceListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceListParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service list params +func (o *ApplicationServiceListParams) WithTimeout(timeout time.Duration) *ApplicationServiceListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service list params +func (o *ApplicationServiceListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service list params +func (o *ApplicationServiceListParams) WithContext(ctx context.Context) *ApplicationServiceListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service list params +func (o *ApplicationServiceListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service list params +func (o *ApplicationServiceListParams) WithHTTPClient(client *http.Client) *ApplicationServiceListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service list params +func (o *ApplicationServiceListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the application service list params +func (o *ApplicationServiceListParams) WithLimit(limit *int64) *ApplicationServiceListParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the application service list params +func (o *ApplicationServiceListParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithOffset adds the offset to the application service list params +func (o *ApplicationServiceListParams) WithOffset(offset *int64) *ApplicationServiceListParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the application service list params +func (o *ApplicationServiceListParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithSearch adds the search to the application service list params +func (o *ApplicationServiceListParams) WithSearch(search *string) *ApplicationServiceListParams { + o.SetSearch(search) + return o +} + +// SetSearch adds the search to the application service list params +func (o *ApplicationServiceListParams) SetSearch(search *string) { + o.Search = search +} + +// WithTenantID adds the tenantID to the application service list params +func (o *ApplicationServiceListParams) WithTenantID(tenantID *string) *ApplicationServiceListParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the application service list params +func (o *ApplicationServiceListParams) SetTenantID(tenantID *string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Limit != nil { + + // query param limit + var qrLimit int64 + + if o.Limit != nil { + qrLimit = *o.Limit + } + qLimit := swag.FormatInt64(qrLimit) + if qLimit != "" { + + if err := r.SetQueryParam("limit", qLimit); err != nil { + return err + } + } + } + + if o.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + if o.Search != nil { + + // query param search + var qrSearch string + + if o.Search != nil { + qrSearch = *o.Search + } + qSearch := qrSearch + if qSearch != "" { + + if err := r.SetQueryParam("search", qSearch); err != nil { + return err + } + } + } + + if o.TenantID != nil { + + // query param tenantId + var qrTenantID string + + if o.TenantID != nil { + qrTenantID = *o.TenantID + } + qTenantID := qrTenantID + if qTenantID != "" { + + if err := r.SetQueryParam("tenantId", qTenantID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_responses.go new file mode 100644 index 0000000..1f576e7 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_list_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceListReader is a Reader for the ApplicationServiceList structure. +type ApplicationServiceListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceListDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceListOK creates a ApplicationServiceListOK with default headers values +func NewApplicationServiceListOK() *ApplicationServiceListOK { + return &ApplicationServiceListOK{} +} + +/* +ApplicationServiceListOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceListOK struct { + Payload *models.APIListApplicationsResponse +} + +// IsSuccess returns true when this application service list o k response has a 2xx status code +func (o *ApplicationServiceListOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service list o k response has a 3xx status code +func (o *ApplicationServiceListOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service list o k response has a 4xx status code +func (o *ApplicationServiceListOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service list o k response has a 5xx status code +func (o *ApplicationServiceListOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service list o k response a status code equal to that given +func (o *ApplicationServiceListOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service list o k response +func (o *ApplicationServiceListOK) Code() int { + return 200 +} + +func (o *ApplicationServiceListOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications][%d] applicationServiceListOK %s", 200, payload) +} + +func (o *ApplicationServiceListOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications][%d] applicationServiceListOK %s", 200, payload) +} + +func (o *ApplicationServiceListOK) GetPayload() *models.APIListApplicationsResponse { + return o.Payload +} + +func (o *ApplicationServiceListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListApplicationsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceListDefault creates a ApplicationServiceListDefault with default headers values +func NewApplicationServiceListDefault(code int) *ApplicationServiceListDefault { + return &ApplicationServiceListDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceListDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceListDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service list default response has a 2xx status code +func (o *ApplicationServiceListDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service list default response has a 3xx status code +func (o *ApplicationServiceListDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service list default response has a 4xx status code +func (o *ApplicationServiceListDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service list default response has a 5xx status code +func (o *ApplicationServiceListDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service list default response a status code equal to that given +func (o *ApplicationServiceListDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service list default response +func (o *ApplicationServiceListDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceListDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications][%d] ApplicationService_List default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceListDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/applications][%d] ApplicationService_List default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceListDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceListDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_aws_sns_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_aws_sns_integration_parameters.go new file mode 100644 index 0000000..fe3997b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_aws_sns_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceUpdateAwsSnsIntegrationParams creates a new ApplicationServiceUpdateAwsSnsIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceUpdateAwsSnsIntegrationParams() *ApplicationServiceUpdateAwsSnsIntegrationParams { + return &ApplicationServiceUpdateAwsSnsIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceUpdateAwsSnsIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateAwsSnsIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceUpdateAwsSnsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateAwsSnsIntegrationParams { + return &ApplicationServiceUpdateAwsSnsIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceUpdateAwsSnsIntegrationParamsWithContext creates a new ApplicationServiceUpdateAwsSnsIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceUpdateAwsSnsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateAwsSnsIntegrationParams { + return &ApplicationServiceUpdateAwsSnsIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceUpdateAwsSnsIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateAwsSnsIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceUpdateAwsSnsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateAwsSnsIntegrationParams { + return &ApplicationServiceUpdateAwsSnsIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceUpdateAwsSnsIntegrationParams contains all the parameters to send to the API endpoint + + for the application service update aws sns integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceUpdateAwsSnsIntegrationParams struct { + + // Body. + Body ApplicationServiceUpdateAwsSnsIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service update aws sns integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WithDefaults() *ApplicationServiceUpdateAwsSnsIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service update aws sns integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service update aws sns integration params +func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateAwsSnsIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service update aws sns integration params +func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service update aws sns integration params +func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateAwsSnsIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service update aws sns integration params +func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service update aws sns integration params +func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateAwsSnsIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service update aws sns integration params +func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service update aws sns integration params +func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WithBody(body ApplicationServiceUpdateAwsSnsIntegrationBody) *ApplicationServiceUpdateAwsSnsIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service update aws sns integration params +func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) SetBody(body ApplicationServiceUpdateAwsSnsIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service update aws sns integration params +func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateAwsSnsIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service update aws sns integration params +func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceUpdateAwsSnsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_aws_sns_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_aws_sns_integration_responses.go new file mode 100644 index 0000000..1d8bb5c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_aws_sns_integration_responses.go @@ -0,0 +1,392 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceUpdateAwsSnsIntegrationReader is a Reader for the ApplicationServiceUpdateAwsSnsIntegration structure. +type ApplicationServiceUpdateAwsSnsIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceUpdateAwsSnsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceUpdateAwsSnsIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceUpdateAwsSnsIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceUpdateAwsSnsIntegrationOK creates a ApplicationServiceUpdateAwsSnsIntegrationOK with default headers values +func NewApplicationServiceUpdateAwsSnsIntegrationOK() *ApplicationServiceUpdateAwsSnsIntegrationOK { + return &ApplicationServiceUpdateAwsSnsIntegrationOK{} +} + +/* +ApplicationServiceUpdateAwsSnsIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceUpdateAwsSnsIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service update aws sns integration o k response has a 2xx status code +func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service update aws sns integration o k response has a 3xx status code +func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service update aws sns integration o k response has a 4xx status code +func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service update aws sns integration o k response has a 5xx status code +func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service update aws sns integration o k response a status code equal to that given +func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service update aws sns integration o k response +func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/aws-sns][%d] applicationServiceUpdateAwsSnsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/aws-sns][%d] applicationServiceUpdateAwsSnsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceUpdateAwsSnsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceUpdateAwsSnsIntegrationDefault creates a ApplicationServiceUpdateAwsSnsIntegrationDefault with default headers values +func NewApplicationServiceUpdateAwsSnsIntegrationDefault(code int) *ApplicationServiceUpdateAwsSnsIntegrationDefault { + return &ApplicationServiceUpdateAwsSnsIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceUpdateAwsSnsIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceUpdateAwsSnsIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service update aws sns integration default response has a 2xx status code +func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service update aws sns integration default response has a 3xx status code +func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service update aws sns integration default response has a 4xx status code +func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service update aws sns integration default response has a 5xx status code +func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service update aws sns integration default response a status code equal to that given +func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service update aws sns integration default response +func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/aws-sns][%d] ApplicationService_UpdateAwsSnsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/aws-sns][%d] ApplicationService_UpdateAwsSnsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceUpdateAwsSnsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceUpdateAwsSnsIntegrationBody application service update aws sns integration body +swagger:model ApplicationServiceUpdateAwsSnsIntegrationBody +*/ +type ApplicationServiceUpdateAwsSnsIntegrationBody struct { + + // integration + Integration *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service update aws sns integration body +func (o *ApplicationServiceUpdateAwsSnsIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateAwsSnsIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update aws sns integration body based on the context it is used +func (o *ApplicationServiceUpdateAwsSnsIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateAwsSnsIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateAwsSnsIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateAwsSnsIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateAwsSnsIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration Integration object to update. +swagger:model ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration +*/ +type ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration struct { + + // AWS Access Key ID. + AccessKeyID string `json:"accessKeyId,omitempty"` + + // Encoding. + Encoding *models.APIEncoding `json:"encoding,omitempty"` + + // AWS region. + Region string `json:"region,omitempty"` + + // AWS Secret Access Key. + SecretAccessKey string `json:"secretAccessKey,omitempty"` + + // Topic ARN. + TopicArn string `json:"topicArn,omitempty"` +} + +// Validate validates this application service update aws sns integration params body integration +func (o *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateEncoding(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error { + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if o.Encoding != nil { + if err := o.Encoding.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update aws sns integration params body integration based on the context it is used +func (o *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateEncoding(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error { + + if o.Encoding != nil { + + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if err := o.Encoding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateAwsSnsIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_azure_service_bus_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_azure_service_bus_integration_parameters.go new file mode 100644 index 0000000..182e3e3 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_azure_service_bus_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceUpdateAzureServiceBusIntegrationParams creates a new ApplicationServiceUpdateAzureServiceBusIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceUpdateAzureServiceBusIntegrationParams() *ApplicationServiceUpdateAzureServiceBusIntegrationParams { + return &ApplicationServiceUpdateAzureServiceBusIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceUpdateAzureServiceBusIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateAzureServiceBusIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceUpdateAzureServiceBusIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateAzureServiceBusIntegrationParams { + return &ApplicationServiceUpdateAzureServiceBusIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceUpdateAzureServiceBusIntegrationParamsWithContext creates a new ApplicationServiceUpdateAzureServiceBusIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceUpdateAzureServiceBusIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateAzureServiceBusIntegrationParams { + return &ApplicationServiceUpdateAzureServiceBusIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceUpdateAzureServiceBusIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateAzureServiceBusIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceUpdateAzureServiceBusIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateAzureServiceBusIntegrationParams { + return &ApplicationServiceUpdateAzureServiceBusIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceUpdateAzureServiceBusIntegrationParams contains all the parameters to send to the API endpoint + + for the application service update azure service bus integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceUpdateAzureServiceBusIntegrationParams struct { + + // Body. + Body ApplicationServiceUpdateAzureServiceBusIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service update azure service bus integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WithDefaults() *ApplicationServiceUpdateAzureServiceBusIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service update azure service bus integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service update azure service bus integration params +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateAzureServiceBusIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service update azure service bus integration params +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service update azure service bus integration params +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateAzureServiceBusIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service update azure service bus integration params +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service update azure service bus integration params +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateAzureServiceBusIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service update azure service bus integration params +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service update azure service bus integration params +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WithBody(body ApplicationServiceUpdateAzureServiceBusIntegrationBody) *ApplicationServiceUpdateAzureServiceBusIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service update azure service bus integration params +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) SetBody(body ApplicationServiceUpdateAzureServiceBusIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service update azure service bus integration params +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateAzureServiceBusIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service update azure service bus integration params +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_azure_service_bus_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_azure_service_bus_integration_responses.go new file mode 100644 index 0000000..32a9b44 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_azure_service_bus_integration_responses.go @@ -0,0 +1,387 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceUpdateAzureServiceBusIntegrationReader is a Reader for the ApplicationServiceUpdateAzureServiceBusIntegration structure. +type ApplicationServiceUpdateAzureServiceBusIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceUpdateAzureServiceBusIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceUpdateAzureServiceBusIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceUpdateAzureServiceBusIntegrationOK creates a ApplicationServiceUpdateAzureServiceBusIntegrationOK with default headers values +func NewApplicationServiceUpdateAzureServiceBusIntegrationOK() *ApplicationServiceUpdateAzureServiceBusIntegrationOK { + return &ApplicationServiceUpdateAzureServiceBusIntegrationOK{} +} + +/* +ApplicationServiceUpdateAzureServiceBusIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceUpdateAzureServiceBusIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service update azure service bus integration o k response has a 2xx status code +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service update azure service bus integration o k response has a 3xx status code +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service update azure service bus integration o k response has a 4xx status code +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service update azure service bus integration o k response has a 5xx status code +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service update azure service bus integration o k response a status code equal to that given +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service update azure service bus integration o k response +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] applicationServiceUpdateAzureServiceBusIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] applicationServiceUpdateAzureServiceBusIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceUpdateAzureServiceBusIntegrationDefault creates a ApplicationServiceUpdateAzureServiceBusIntegrationDefault with default headers values +func NewApplicationServiceUpdateAzureServiceBusIntegrationDefault(code int) *ApplicationServiceUpdateAzureServiceBusIntegrationDefault { + return &ApplicationServiceUpdateAzureServiceBusIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceUpdateAzureServiceBusIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceUpdateAzureServiceBusIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service update azure service bus integration default response has a 2xx status code +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service update azure service bus integration default response has a 3xx status code +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service update azure service bus integration default response has a 4xx status code +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service update azure service bus integration default response has a 5xx status code +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service update azure service bus integration default response a status code equal to that given +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service update azure service bus integration default response +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] ApplicationService_UpdateAzureServiceBusIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/azure-service-bus][%d] ApplicationService_UpdateAzureServiceBusIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceUpdateAzureServiceBusIntegrationBody application service update azure service bus integration body +swagger:model ApplicationServiceUpdateAzureServiceBusIntegrationBody +*/ +type ApplicationServiceUpdateAzureServiceBusIntegrationBody struct { + + // integration + Integration *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service update azure service bus integration body +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update azure service bus integration body based on the context it is used +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateAzureServiceBusIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration Integration object to create. +swagger:model ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration +*/ +type ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration struct { + + // Connection string. + ConnectionString string `json:"connectionString,omitempty"` + + // Encoding. + Encoding *models.APIEncoding `json:"encoding,omitempty"` + + // Publish name. + // This is the name of the topic or queue. + PublishName string `json:"publishName,omitempty"` +} + +// Validate validates this application service update azure service bus integration params body integration +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateEncoding(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error { + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if o.Encoding != nil { + if err := o.Encoding.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update azure service bus integration params body integration based on the context it is used +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateEncoding(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error { + + if o.Encoding != nil { + + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if err := o.Encoding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateAzureServiceBusIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_gcp_pub_sub_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_gcp_pub_sub_integration_parameters.go new file mode 100644 index 0000000..6684c36 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_gcp_pub_sub_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceUpdateGcpPubSubIntegrationParams creates a new ApplicationServiceUpdateGcpPubSubIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceUpdateGcpPubSubIntegrationParams() *ApplicationServiceUpdateGcpPubSubIntegrationParams { + return &ApplicationServiceUpdateGcpPubSubIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceUpdateGcpPubSubIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateGcpPubSubIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceUpdateGcpPubSubIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateGcpPubSubIntegrationParams { + return &ApplicationServiceUpdateGcpPubSubIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceUpdateGcpPubSubIntegrationParamsWithContext creates a new ApplicationServiceUpdateGcpPubSubIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceUpdateGcpPubSubIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateGcpPubSubIntegrationParams { + return &ApplicationServiceUpdateGcpPubSubIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceUpdateGcpPubSubIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateGcpPubSubIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceUpdateGcpPubSubIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateGcpPubSubIntegrationParams { + return &ApplicationServiceUpdateGcpPubSubIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceUpdateGcpPubSubIntegrationParams contains all the parameters to send to the API endpoint + + for the application service update gcp pub sub integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceUpdateGcpPubSubIntegrationParams struct { + + // Body. + Body ApplicationServiceUpdateGcpPubSubIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service update gcp pub sub integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WithDefaults() *ApplicationServiceUpdateGcpPubSubIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service update gcp pub sub integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service update gcp pub sub integration params +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateGcpPubSubIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service update gcp pub sub integration params +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service update gcp pub sub integration params +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateGcpPubSubIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service update gcp pub sub integration params +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service update gcp pub sub integration params +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateGcpPubSubIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service update gcp pub sub integration params +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service update gcp pub sub integration params +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WithBody(body ApplicationServiceUpdateGcpPubSubIntegrationBody) *ApplicationServiceUpdateGcpPubSubIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service update gcp pub sub integration params +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) SetBody(body ApplicationServiceUpdateGcpPubSubIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service update gcp pub sub integration params +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateGcpPubSubIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service update gcp pub sub integration params +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_gcp_pub_sub_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_gcp_pub_sub_integration_responses.go new file mode 100644 index 0000000..dc39e0f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_gcp_pub_sub_integration_responses.go @@ -0,0 +1,393 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceUpdateGcpPubSubIntegrationReader is a Reader for the ApplicationServiceUpdateGcpPubSubIntegration structure. +type ApplicationServiceUpdateGcpPubSubIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceUpdateGcpPubSubIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceUpdateGcpPubSubIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceUpdateGcpPubSubIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceUpdateGcpPubSubIntegrationOK creates a ApplicationServiceUpdateGcpPubSubIntegrationOK with default headers values +func NewApplicationServiceUpdateGcpPubSubIntegrationOK() *ApplicationServiceUpdateGcpPubSubIntegrationOK { + return &ApplicationServiceUpdateGcpPubSubIntegrationOK{} +} + +/* +ApplicationServiceUpdateGcpPubSubIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceUpdateGcpPubSubIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service update gcp pub sub integration o k response has a 2xx status code +func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service update gcp pub sub integration o k response has a 3xx status code +func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service update gcp pub sub integration o k response has a 4xx status code +func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service update gcp pub sub integration o k response has a 5xx status code +func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service update gcp pub sub integration o k response a status code equal to that given +func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service update gcp pub sub integration o k response +func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] applicationServiceUpdateGcpPubSubIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] applicationServiceUpdateGcpPubSubIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceUpdateGcpPubSubIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceUpdateGcpPubSubIntegrationDefault creates a ApplicationServiceUpdateGcpPubSubIntegrationDefault with default headers values +func NewApplicationServiceUpdateGcpPubSubIntegrationDefault(code int) *ApplicationServiceUpdateGcpPubSubIntegrationDefault { + return &ApplicationServiceUpdateGcpPubSubIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceUpdateGcpPubSubIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceUpdateGcpPubSubIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service update gcp pub sub integration default response has a 2xx status code +func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service update gcp pub sub integration default response has a 3xx status code +func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service update gcp pub sub integration default response has a 4xx status code +func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service update gcp pub sub integration default response has a 5xx status code +func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service update gcp pub sub integration default response a status code equal to that given +func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service update gcp pub sub integration default response +func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_UpdateGcpPubSubIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/gcp-pub-sub][%d] ApplicationService_UpdateGcpPubSubIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceUpdateGcpPubSubIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceUpdateGcpPubSubIntegrationBody application service update gcp pub sub integration body +swagger:model ApplicationServiceUpdateGcpPubSubIntegrationBody +*/ +type ApplicationServiceUpdateGcpPubSubIntegrationBody struct { + + // integration + Integration *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service update gcp pub sub integration body +func (o *ApplicationServiceUpdateGcpPubSubIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateGcpPubSubIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update gcp pub sub integration body based on the context it is used +func (o *ApplicationServiceUpdateGcpPubSubIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateGcpPubSubIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateGcpPubSubIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateGcpPubSubIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateGcpPubSubIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration Integration object to update. +swagger:model ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration +*/ +type ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration struct { + + // Credentials file. + // This IAM service-account credentials file (JSON) must have the following + // Pub/Sub roles: + // * Pub/Sub Publisher + CredentialsFile string `json:"credentialsFile,omitempty"` + + // Encoding. + Encoding *models.APIEncoding `json:"encoding,omitempty"` + + // Project ID. + ProjectID string `json:"projectId,omitempty"` + + // Topic name. + // This is the name of the Pub/Sub topic. + TopicName string `json:"topicName,omitempty"` +} + +// Validate validates this application service update gcp pub sub integration params body integration +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateEncoding(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error { + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if o.Encoding != nil { + if err := o.Encoding.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update gcp pub sub integration params body integration based on the context it is used +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateEncoding(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error { + + if o.Encoding != nil { + + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if err := o.Encoding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateGcpPubSubIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_http_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_http_integration_parameters.go new file mode 100644 index 0000000..5bcc1b0 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_http_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceUpdateHTTPIntegrationParams creates a new ApplicationServiceUpdateHTTPIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceUpdateHTTPIntegrationParams() *ApplicationServiceUpdateHTTPIntegrationParams { + return &ApplicationServiceUpdateHTTPIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceUpdateHTTPIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateHTTPIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceUpdateHTTPIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateHTTPIntegrationParams { + return &ApplicationServiceUpdateHTTPIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceUpdateHTTPIntegrationParamsWithContext creates a new ApplicationServiceUpdateHTTPIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceUpdateHTTPIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateHTTPIntegrationParams { + return &ApplicationServiceUpdateHTTPIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceUpdateHTTPIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateHTTPIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceUpdateHTTPIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateHTTPIntegrationParams { + return &ApplicationServiceUpdateHTTPIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceUpdateHTTPIntegrationParams contains all the parameters to send to the API endpoint + + for the application service update Http integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceUpdateHTTPIntegrationParams struct { + + // Body. + Body ApplicationServiceUpdateHTTPIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service update Http integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateHTTPIntegrationParams) WithDefaults() *ApplicationServiceUpdateHTTPIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service update Http integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateHTTPIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service update Http integration params +func (o *ApplicationServiceUpdateHTTPIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateHTTPIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service update Http integration params +func (o *ApplicationServiceUpdateHTTPIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service update Http integration params +func (o *ApplicationServiceUpdateHTTPIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateHTTPIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service update Http integration params +func (o *ApplicationServiceUpdateHTTPIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service update Http integration params +func (o *ApplicationServiceUpdateHTTPIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateHTTPIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service update Http integration params +func (o *ApplicationServiceUpdateHTTPIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service update Http integration params +func (o *ApplicationServiceUpdateHTTPIntegrationParams) WithBody(body ApplicationServiceUpdateHTTPIntegrationBody) *ApplicationServiceUpdateHTTPIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service update Http integration params +func (o *ApplicationServiceUpdateHTTPIntegrationParams) SetBody(body ApplicationServiceUpdateHTTPIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service update Http integration params +func (o *ApplicationServiceUpdateHTTPIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateHTTPIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service update Http integration params +func (o *ApplicationServiceUpdateHTTPIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceUpdateHTTPIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_http_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_http_integration_responses.go new file mode 100644 index 0000000..727ebe7 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_http_integration_responses.go @@ -0,0 +1,389 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceUpdateHTTPIntegrationReader is a Reader for the ApplicationServiceUpdateHTTPIntegration structure. +type ApplicationServiceUpdateHTTPIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceUpdateHTTPIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceUpdateHTTPIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceUpdateHTTPIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceUpdateHTTPIntegrationOK creates a ApplicationServiceUpdateHTTPIntegrationOK with default headers values +func NewApplicationServiceUpdateHTTPIntegrationOK() *ApplicationServiceUpdateHTTPIntegrationOK { + return &ApplicationServiceUpdateHTTPIntegrationOK{} +} + +/* +ApplicationServiceUpdateHTTPIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceUpdateHTTPIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service update Http integration o k response has a 2xx status code +func (o *ApplicationServiceUpdateHTTPIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service update Http integration o k response has a 3xx status code +func (o *ApplicationServiceUpdateHTTPIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service update Http integration o k response has a 4xx status code +func (o *ApplicationServiceUpdateHTTPIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service update Http integration o k response has a 5xx status code +func (o *ApplicationServiceUpdateHTTPIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service update Http integration o k response a status code equal to that given +func (o *ApplicationServiceUpdateHTTPIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service update Http integration o k response +func (o *ApplicationServiceUpdateHTTPIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceUpdateHTTPIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/http][%d] applicationServiceUpdateHttpIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateHTTPIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/http][%d] applicationServiceUpdateHttpIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateHTTPIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceUpdateHTTPIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceUpdateHTTPIntegrationDefault creates a ApplicationServiceUpdateHTTPIntegrationDefault with default headers values +func NewApplicationServiceUpdateHTTPIntegrationDefault(code int) *ApplicationServiceUpdateHTTPIntegrationDefault { + return &ApplicationServiceUpdateHTTPIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceUpdateHTTPIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceUpdateHTTPIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service update Http integration default response has a 2xx status code +func (o *ApplicationServiceUpdateHTTPIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service update Http integration default response has a 3xx status code +func (o *ApplicationServiceUpdateHTTPIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service update Http integration default response has a 4xx status code +func (o *ApplicationServiceUpdateHTTPIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service update Http integration default response has a 5xx status code +func (o *ApplicationServiceUpdateHTTPIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service update Http integration default response a status code equal to that given +func (o *ApplicationServiceUpdateHTTPIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service update Http integration default response +func (o *ApplicationServiceUpdateHTTPIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceUpdateHTTPIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/http][%d] ApplicationService_UpdateHttpIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateHTTPIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/http][%d] ApplicationService_UpdateHttpIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateHTTPIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceUpdateHTTPIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceUpdateHTTPIntegrationBody application service update HTTP integration body +swagger:model ApplicationServiceUpdateHTTPIntegrationBody +*/ +type ApplicationServiceUpdateHTTPIntegrationBody struct { + + // integration + Integration *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service update HTTP integration body +func (o *ApplicationServiceUpdateHTTPIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateHTTPIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update HTTP integration body based on the context it is used +func (o *ApplicationServiceUpdateHTTPIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateHTTPIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateHTTPIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateHTTPIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateHTTPIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration Integration object to update. +swagger:model ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration +*/ +type ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration struct { + + // Payload encoding. + Encoding *models.APIEncoding `json:"encoding,omitempty"` + + // Event endpoint URL. + // The HTTP integration will POST all events to this enpoint. The request + // will contain a query parameters "event" containing the type of the + // event. + EventEndpointURL string `json:"eventEndpointUrl,omitempty"` + + // HTTP headers to set when making requests. + Headers map[string]string `json:"headers,omitempty"` +} + +// Validate validates this application service update HTTP integration params body integration +func (o *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateEncoding(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration) validateEncoding(formats strfmt.Registry) error { + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if o.Encoding != nil { + if err := o.Encoding.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update HTTP integration params body integration based on the context it is used +func (o *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateEncoding(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error { + + if o.Encoding != nil { + + if swag.IsZero(o.Encoding) { // not required + return nil + } + + if err := o.Encoding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "encoding") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateHTTPIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_ifttt_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_ifttt_integration_parameters.go new file mode 100644 index 0000000..f0c6969 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_ifttt_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceUpdateIftttIntegrationParams creates a new ApplicationServiceUpdateIftttIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceUpdateIftttIntegrationParams() *ApplicationServiceUpdateIftttIntegrationParams { + return &ApplicationServiceUpdateIftttIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceUpdateIftttIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateIftttIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceUpdateIftttIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateIftttIntegrationParams { + return &ApplicationServiceUpdateIftttIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceUpdateIftttIntegrationParamsWithContext creates a new ApplicationServiceUpdateIftttIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceUpdateIftttIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateIftttIntegrationParams { + return &ApplicationServiceUpdateIftttIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceUpdateIftttIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateIftttIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceUpdateIftttIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateIftttIntegrationParams { + return &ApplicationServiceUpdateIftttIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceUpdateIftttIntegrationParams contains all the parameters to send to the API endpoint + + for the application service update ifttt integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceUpdateIftttIntegrationParams struct { + + // Body. + Body ApplicationServiceUpdateIftttIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service update ifttt integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateIftttIntegrationParams) WithDefaults() *ApplicationServiceUpdateIftttIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service update ifttt integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateIftttIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service update ifttt integration params +func (o *ApplicationServiceUpdateIftttIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateIftttIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service update ifttt integration params +func (o *ApplicationServiceUpdateIftttIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service update ifttt integration params +func (o *ApplicationServiceUpdateIftttIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateIftttIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service update ifttt integration params +func (o *ApplicationServiceUpdateIftttIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service update ifttt integration params +func (o *ApplicationServiceUpdateIftttIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateIftttIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service update ifttt integration params +func (o *ApplicationServiceUpdateIftttIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service update ifttt integration params +func (o *ApplicationServiceUpdateIftttIntegrationParams) WithBody(body ApplicationServiceUpdateIftttIntegrationBody) *ApplicationServiceUpdateIftttIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service update ifttt integration params +func (o *ApplicationServiceUpdateIftttIntegrationParams) SetBody(body ApplicationServiceUpdateIftttIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service update ifttt integration params +func (o *ApplicationServiceUpdateIftttIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateIftttIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service update ifttt integration params +func (o *ApplicationServiceUpdateIftttIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceUpdateIftttIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_ifttt_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_ifttt_integration_responses.go new file mode 100644 index 0000000..d791ad1 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_ifttt_integration_responses.go @@ -0,0 +1,346 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceUpdateIftttIntegrationReader is a Reader for the ApplicationServiceUpdateIftttIntegration structure. +type ApplicationServiceUpdateIftttIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceUpdateIftttIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceUpdateIftttIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceUpdateIftttIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceUpdateIftttIntegrationOK creates a ApplicationServiceUpdateIftttIntegrationOK with default headers values +func NewApplicationServiceUpdateIftttIntegrationOK() *ApplicationServiceUpdateIftttIntegrationOK { + return &ApplicationServiceUpdateIftttIntegrationOK{} +} + +/* +ApplicationServiceUpdateIftttIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceUpdateIftttIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service update ifttt integration o k response has a 2xx status code +func (o *ApplicationServiceUpdateIftttIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service update ifttt integration o k response has a 3xx status code +func (o *ApplicationServiceUpdateIftttIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service update ifttt integration o k response has a 4xx status code +func (o *ApplicationServiceUpdateIftttIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service update ifttt integration o k response has a 5xx status code +func (o *ApplicationServiceUpdateIftttIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service update ifttt integration o k response a status code equal to that given +func (o *ApplicationServiceUpdateIftttIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service update ifttt integration o k response +func (o *ApplicationServiceUpdateIftttIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceUpdateIftttIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/ifttt][%d] applicationServiceUpdateIftttIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateIftttIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/ifttt][%d] applicationServiceUpdateIftttIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateIftttIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceUpdateIftttIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceUpdateIftttIntegrationDefault creates a ApplicationServiceUpdateIftttIntegrationDefault with default headers values +func NewApplicationServiceUpdateIftttIntegrationDefault(code int) *ApplicationServiceUpdateIftttIntegrationDefault { + return &ApplicationServiceUpdateIftttIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceUpdateIftttIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceUpdateIftttIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service update ifttt integration default response has a 2xx status code +func (o *ApplicationServiceUpdateIftttIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service update ifttt integration default response has a 3xx status code +func (o *ApplicationServiceUpdateIftttIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service update ifttt integration default response has a 4xx status code +func (o *ApplicationServiceUpdateIftttIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service update ifttt integration default response has a 5xx status code +func (o *ApplicationServiceUpdateIftttIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service update ifttt integration default response a status code equal to that given +func (o *ApplicationServiceUpdateIftttIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service update ifttt integration default response +func (o *ApplicationServiceUpdateIftttIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceUpdateIftttIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/ifttt][%d] ApplicationService_UpdateIftttIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateIftttIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/ifttt][%d] ApplicationService_UpdateIftttIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateIftttIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceUpdateIftttIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceUpdateIftttIntegrationBody application service update ifttt integration body +swagger:model ApplicationServiceUpdateIftttIntegrationBody +*/ +type ApplicationServiceUpdateIftttIntegrationBody struct { + + // integration + Integration *ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service update ifttt integration body +func (o *ApplicationServiceUpdateIftttIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateIftttIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update ifttt integration body based on the context it is used +func (o *ApplicationServiceUpdateIftttIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateIftttIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateIftttIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateIftttIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateIftttIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration Integration object to update. +swagger:model ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration +*/ +type ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration struct { + + // Arbitrary JSON. + // If set to true, ChirpStack events will be sent as-is as arbitrary JSON + // payload. If set to false (default), the 3 JSON values format will be used. + ArbitraryJSON bool `json:"arbitraryJson,omitempty"` + + // Event prefix. + // If set, the event name will be PREFIX_EVENT. For example if event_prefix + // is set to weatherstation, and uplink event will be sent as + // weatherstation_up to the IFTTT webhook. + // Note: Only characters in the A-Z, a-z and 0-9 range are allowed. + EventPrefix string `json:"eventPrefix,omitempty"` + + // Key. + // This key can be obtained from the IFTTT Webhooks documentation page. + Key string `json:"key,omitempty"` + + // Values. + // Up to 2 values can be forwarded to IFTTT. These values must map to the + // decoded payload keys. For example: + // { + // "batteryLevel": 75.3, + // "buttons": [{"pressed": false}, {"pressed": true}] + // } + // You would specify the following fields: + // uplink_values = ["batteryLevel", "buttons_0_pressed"] + UplinkValues []string `json:"uplinkValues"` +} + +// Validate validates this application service update ifttt integration params body integration +func (o *ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this application service update ifttt integration params body integration based on context it is used +func (o *ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateIftttIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_influx_db_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_influx_db_integration_parameters.go new file mode 100644 index 0000000..4e9f8d4 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_influx_db_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceUpdateInfluxDbIntegrationParams creates a new ApplicationServiceUpdateInfluxDbIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceUpdateInfluxDbIntegrationParams() *ApplicationServiceUpdateInfluxDbIntegrationParams { + return &ApplicationServiceUpdateInfluxDbIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceUpdateInfluxDbIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateInfluxDbIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceUpdateInfluxDbIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateInfluxDbIntegrationParams { + return &ApplicationServiceUpdateInfluxDbIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceUpdateInfluxDbIntegrationParamsWithContext creates a new ApplicationServiceUpdateInfluxDbIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceUpdateInfluxDbIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateInfluxDbIntegrationParams { + return &ApplicationServiceUpdateInfluxDbIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceUpdateInfluxDbIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateInfluxDbIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceUpdateInfluxDbIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateInfluxDbIntegrationParams { + return &ApplicationServiceUpdateInfluxDbIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceUpdateInfluxDbIntegrationParams contains all the parameters to send to the API endpoint + + for the application service update influx db integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceUpdateInfluxDbIntegrationParams struct { + + // Body. + Body ApplicationServiceUpdateInfluxDbIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service update influx db integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WithDefaults() *ApplicationServiceUpdateInfluxDbIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service update influx db integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service update influx db integration params +func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateInfluxDbIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service update influx db integration params +func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service update influx db integration params +func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateInfluxDbIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service update influx db integration params +func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service update influx db integration params +func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateInfluxDbIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service update influx db integration params +func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service update influx db integration params +func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WithBody(body ApplicationServiceUpdateInfluxDbIntegrationBody) *ApplicationServiceUpdateInfluxDbIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service update influx db integration params +func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) SetBody(body ApplicationServiceUpdateInfluxDbIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service update influx db integration params +func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateInfluxDbIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service update influx db integration params +func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceUpdateInfluxDbIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_influx_db_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_influx_db_integration_responses.go new file mode 100644 index 0000000..f909867 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_influx_db_integration_responses.go @@ -0,0 +1,455 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceUpdateInfluxDbIntegrationReader is a Reader for the ApplicationServiceUpdateInfluxDbIntegration structure. +type ApplicationServiceUpdateInfluxDbIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceUpdateInfluxDbIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceUpdateInfluxDbIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceUpdateInfluxDbIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceUpdateInfluxDbIntegrationOK creates a ApplicationServiceUpdateInfluxDbIntegrationOK with default headers values +func NewApplicationServiceUpdateInfluxDbIntegrationOK() *ApplicationServiceUpdateInfluxDbIntegrationOK { + return &ApplicationServiceUpdateInfluxDbIntegrationOK{} +} + +/* +ApplicationServiceUpdateInfluxDbIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceUpdateInfluxDbIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service update influx db integration o k response has a 2xx status code +func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service update influx db integration o k response has a 3xx status code +func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service update influx db integration o k response has a 4xx status code +func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service update influx db integration o k response has a 5xx status code +func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service update influx db integration o k response a status code equal to that given +func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service update influx db integration o k response +func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/influxdb][%d] applicationServiceUpdateInfluxDbIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/influxdb][%d] applicationServiceUpdateInfluxDbIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceUpdateInfluxDbIntegrationDefault creates a ApplicationServiceUpdateInfluxDbIntegrationDefault with default headers values +func NewApplicationServiceUpdateInfluxDbIntegrationDefault(code int) *ApplicationServiceUpdateInfluxDbIntegrationDefault { + return &ApplicationServiceUpdateInfluxDbIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceUpdateInfluxDbIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceUpdateInfluxDbIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service update influx db integration default response has a 2xx status code +func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service update influx db integration default response has a 3xx status code +func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service update influx db integration default response has a 4xx status code +func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service update influx db integration default response has a 5xx status code +func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service update influx db integration default response a status code equal to that given +func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service update influx db integration default response +func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/influxdb][%d] ApplicationService_UpdateInfluxDbIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/influxdb][%d] ApplicationService_UpdateInfluxDbIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceUpdateInfluxDbIntegrationBody application service update influx db integration body +swagger:model ApplicationServiceUpdateInfluxDbIntegrationBody +*/ +type ApplicationServiceUpdateInfluxDbIntegrationBody struct { + + // integration + Integration *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service update influx db integration body +func (o *ApplicationServiceUpdateInfluxDbIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update influx db integration body based on the context it is used +func (o *ApplicationServiceUpdateInfluxDbIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateInfluxDbIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateInfluxDbIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateInfluxDbIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration Integration object to update. +swagger:model ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration +*/ +type ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration struct { + + // Bucket. (InfluxDb v2) + Bucket string `json:"bucket,omitempty"` + + // InfluxDb database name. (InfluxDb v1) + Db string `json:"db,omitempty"` + + // InfluxDb API write endpoint (e.g. http://localhost:8086/write). + Endpoint string `json:"endpoint,omitempty"` + + // Organization. (InfluxDb v2) + Organization string `json:"organization,omitempty"` + + // InfluxDb password. (InfluxDb v1) + Password string `json:"password,omitempty"` + + // InfluxDb timestamp precision (InfluxDb v1). + Precision *models.APIInfluxDbPrecision `json:"precision,omitempty"` + + // InfluxDb retention policy name. (InfluxDb v1) + RetentionPolicyName string `json:"retentionPolicyName,omitempty"` + + // Token. (InfluxDb v2) + Token string `json:"token,omitempty"` + + // InfluxDb username. (InfluxDb v1) + Username string `json:"username,omitempty"` + + // InfluxDb version. + Version *models.APIInfluxDbVersion `json:"version,omitempty"` +} + +// Validate validates this application service update influx db integration params body integration +func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validatePrecision(formats); err != nil { + res = append(res, err) + } + + if err := o.validateVersion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) validatePrecision(formats strfmt.Registry) error { + if swag.IsZero(o.Precision) { // not required + return nil + } + + if o.Precision != nil { + if err := o.Precision.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "precision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "precision") + } + return err + } + } + + return nil +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) validateVersion(formats strfmt.Registry) error { + if swag.IsZero(o.Version) { // not required + return nil + } + + if o.Version != nil { + if err := o.Version.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "version") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "version") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update influx db integration params body integration based on the context it is used +func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidatePrecision(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateVersion(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) contextValidatePrecision(ctx context.Context, formats strfmt.Registry) error { + + if o.Precision != nil { + + if swag.IsZero(o.Precision) { // not required + return nil + } + + if err := o.Precision.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "precision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "precision") + } + return err + } + } + + return nil +} + +func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) contextValidateVersion(ctx context.Context, formats strfmt.Registry) error { + + if o.Version != nil { + + if swag.IsZero(o.Version) { // not required + return nil + } + + if err := o.Version.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration" + "." + "version") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration" + "." + "version") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateInfluxDbIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_my_devices_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_my_devices_integration_parameters.go new file mode 100644 index 0000000..4a2b583 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_my_devices_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceUpdateMyDevicesIntegrationParams creates a new ApplicationServiceUpdateMyDevicesIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceUpdateMyDevicesIntegrationParams() *ApplicationServiceUpdateMyDevicesIntegrationParams { + return &ApplicationServiceUpdateMyDevicesIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceUpdateMyDevicesIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateMyDevicesIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceUpdateMyDevicesIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateMyDevicesIntegrationParams { + return &ApplicationServiceUpdateMyDevicesIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceUpdateMyDevicesIntegrationParamsWithContext creates a new ApplicationServiceUpdateMyDevicesIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceUpdateMyDevicesIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateMyDevicesIntegrationParams { + return &ApplicationServiceUpdateMyDevicesIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceUpdateMyDevicesIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateMyDevicesIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceUpdateMyDevicesIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateMyDevicesIntegrationParams { + return &ApplicationServiceUpdateMyDevicesIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceUpdateMyDevicesIntegrationParams contains all the parameters to send to the API endpoint + + for the application service update my devices integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceUpdateMyDevicesIntegrationParams struct { + + // Body. + Body ApplicationServiceUpdateMyDevicesIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service update my devices integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateMyDevicesIntegrationParams) WithDefaults() *ApplicationServiceUpdateMyDevicesIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service update my devices integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateMyDevicesIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service update my devices integration params +func (o *ApplicationServiceUpdateMyDevicesIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateMyDevicesIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service update my devices integration params +func (o *ApplicationServiceUpdateMyDevicesIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service update my devices integration params +func (o *ApplicationServiceUpdateMyDevicesIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateMyDevicesIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service update my devices integration params +func (o *ApplicationServiceUpdateMyDevicesIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service update my devices integration params +func (o *ApplicationServiceUpdateMyDevicesIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateMyDevicesIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service update my devices integration params +func (o *ApplicationServiceUpdateMyDevicesIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service update my devices integration params +func (o *ApplicationServiceUpdateMyDevicesIntegrationParams) WithBody(body ApplicationServiceUpdateMyDevicesIntegrationBody) *ApplicationServiceUpdateMyDevicesIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service update my devices integration params +func (o *ApplicationServiceUpdateMyDevicesIntegrationParams) SetBody(body ApplicationServiceUpdateMyDevicesIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service update my devices integration params +func (o *ApplicationServiceUpdateMyDevicesIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateMyDevicesIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service update my devices integration params +func (o *ApplicationServiceUpdateMyDevicesIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceUpdateMyDevicesIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_my_devices_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_my_devices_integration_responses.go new file mode 100644 index 0000000..dbd555e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_my_devices_integration_responses.go @@ -0,0 +1,322 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceUpdateMyDevicesIntegrationReader is a Reader for the ApplicationServiceUpdateMyDevicesIntegration structure. +type ApplicationServiceUpdateMyDevicesIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceUpdateMyDevicesIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceUpdateMyDevicesIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceUpdateMyDevicesIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceUpdateMyDevicesIntegrationOK creates a ApplicationServiceUpdateMyDevicesIntegrationOK with default headers values +func NewApplicationServiceUpdateMyDevicesIntegrationOK() *ApplicationServiceUpdateMyDevicesIntegrationOK { + return &ApplicationServiceUpdateMyDevicesIntegrationOK{} +} + +/* +ApplicationServiceUpdateMyDevicesIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceUpdateMyDevicesIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service update my devices integration o k response has a 2xx status code +func (o *ApplicationServiceUpdateMyDevicesIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service update my devices integration o k response has a 3xx status code +func (o *ApplicationServiceUpdateMyDevicesIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service update my devices integration o k response has a 4xx status code +func (o *ApplicationServiceUpdateMyDevicesIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service update my devices integration o k response has a 5xx status code +func (o *ApplicationServiceUpdateMyDevicesIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service update my devices integration o k response a status code equal to that given +func (o *ApplicationServiceUpdateMyDevicesIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service update my devices integration o k response +func (o *ApplicationServiceUpdateMyDevicesIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceUpdateMyDevicesIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/mydevices][%d] applicationServiceUpdateMyDevicesIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateMyDevicesIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/mydevices][%d] applicationServiceUpdateMyDevicesIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateMyDevicesIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceUpdateMyDevicesIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceUpdateMyDevicesIntegrationDefault creates a ApplicationServiceUpdateMyDevicesIntegrationDefault with default headers values +func NewApplicationServiceUpdateMyDevicesIntegrationDefault(code int) *ApplicationServiceUpdateMyDevicesIntegrationDefault { + return &ApplicationServiceUpdateMyDevicesIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceUpdateMyDevicesIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceUpdateMyDevicesIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service update my devices integration default response has a 2xx status code +func (o *ApplicationServiceUpdateMyDevicesIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service update my devices integration default response has a 3xx status code +func (o *ApplicationServiceUpdateMyDevicesIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service update my devices integration default response has a 4xx status code +func (o *ApplicationServiceUpdateMyDevicesIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service update my devices integration default response has a 5xx status code +func (o *ApplicationServiceUpdateMyDevicesIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service update my devices integration default response a status code equal to that given +func (o *ApplicationServiceUpdateMyDevicesIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service update my devices integration default response +func (o *ApplicationServiceUpdateMyDevicesIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceUpdateMyDevicesIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/mydevices][%d] ApplicationService_UpdateMyDevicesIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateMyDevicesIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/mydevices][%d] ApplicationService_UpdateMyDevicesIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateMyDevicesIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceUpdateMyDevicesIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceUpdateMyDevicesIntegrationBody application service update my devices integration body +swagger:model ApplicationServiceUpdateMyDevicesIntegrationBody +*/ +type ApplicationServiceUpdateMyDevicesIntegrationBody struct { + + // integration + Integration *ApplicationServiceUpdateMyDevicesIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service update my devices integration body +func (o *ApplicationServiceUpdateMyDevicesIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateMyDevicesIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update my devices integration body based on the context it is used +func (o *ApplicationServiceUpdateMyDevicesIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateMyDevicesIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateMyDevicesIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateMyDevicesIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateMyDevicesIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceUpdateMyDevicesIntegrationParamsBodyIntegration Integration object to update. +swagger:model ApplicationServiceUpdateMyDevicesIntegrationParamsBodyIntegration +*/ +type ApplicationServiceUpdateMyDevicesIntegrationParamsBodyIntegration struct { + + // myDevices API endpoint. + Endpoint string `json:"endpoint,omitempty"` +} + +// Validate validates this application service update my devices integration params body integration +func (o *ApplicationServiceUpdateMyDevicesIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this application service update my devices integration params body integration based on context it is used +func (o *ApplicationServiceUpdateMyDevicesIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateMyDevicesIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateMyDevicesIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateMyDevicesIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_parameters.go new file mode 100644 index 0000000..b34cb0e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_parameters.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceUpdateParams creates a new ApplicationServiceUpdateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceUpdateParams() *ApplicationServiceUpdateParams { + return &ApplicationServiceUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceUpdateParamsWithTimeout creates a new ApplicationServiceUpdateParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceUpdateParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateParams { + return &ApplicationServiceUpdateParams{ + timeout: timeout, + } +} + +// NewApplicationServiceUpdateParamsWithContext creates a new ApplicationServiceUpdateParams object +// with the ability to set a context for a request. +func NewApplicationServiceUpdateParamsWithContext(ctx context.Context) *ApplicationServiceUpdateParams { + return &ApplicationServiceUpdateParams{ + Context: ctx, + } +} + +// NewApplicationServiceUpdateParamsWithHTTPClient creates a new ApplicationServiceUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceUpdateParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateParams { + return &ApplicationServiceUpdateParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceUpdateParams contains all the parameters to send to the API endpoint + + for the application service update operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceUpdateParams struct { + + /* ApplicationID. + + Application ID (UUID). + Note: on create this will be automatically generated. + */ + ApplicationID string + + // Body. + Body ApplicationServiceUpdateBody + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateParams) WithDefaults() *ApplicationServiceUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service update params +func (o *ApplicationServiceUpdateParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service update params +func (o *ApplicationServiceUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service update params +func (o *ApplicationServiceUpdateParams) WithContext(ctx context.Context) *ApplicationServiceUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service update params +func (o *ApplicationServiceUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service update params +func (o *ApplicationServiceUpdateParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service update params +func (o *ApplicationServiceUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the application service update params +func (o *ApplicationServiceUpdateParams) WithApplicationID(applicationID string) *ApplicationServiceUpdateParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the application service update params +func (o *ApplicationServiceUpdateParams) SetApplicationID(applicationID string) { + o.ApplicationID = applicationID +} + +// WithBody adds the body to the application service update params +func (o *ApplicationServiceUpdateParams) WithBody(body ApplicationServiceUpdateBody) *ApplicationServiceUpdateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service update params +func (o *ApplicationServiceUpdateParams) SetBody(body ApplicationServiceUpdateBody) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param application.id + if err := r.SetPathParam("application.id", o.ApplicationID); err != nil { + return err + } + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_pilot_things_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_pilot_things_integration_parameters.go new file mode 100644 index 0000000..881196f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_pilot_things_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceUpdatePilotThingsIntegrationParams creates a new ApplicationServiceUpdatePilotThingsIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceUpdatePilotThingsIntegrationParams() *ApplicationServiceUpdatePilotThingsIntegrationParams { + return &ApplicationServiceUpdatePilotThingsIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceUpdatePilotThingsIntegrationParamsWithTimeout creates a new ApplicationServiceUpdatePilotThingsIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceUpdatePilotThingsIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdatePilotThingsIntegrationParams { + return &ApplicationServiceUpdatePilotThingsIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceUpdatePilotThingsIntegrationParamsWithContext creates a new ApplicationServiceUpdatePilotThingsIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceUpdatePilotThingsIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdatePilotThingsIntegrationParams { + return &ApplicationServiceUpdatePilotThingsIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceUpdatePilotThingsIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdatePilotThingsIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceUpdatePilotThingsIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdatePilotThingsIntegrationParams { + return &ApplicationServiceUpdatePilotThingsIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceUpdatePilotThingsIntegrationParams contains all the parameters to send to the API endpoint + + for the application service update pilot things integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceUpdatePilotThingsIntegrationParams struct { + + // Body. + Body ApplicationServiceUpdatePilotThingsIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service update pilot things integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdatePilotThingsIntegrationParams) WithDefaults() *ApplicationServiceUpdatePilotThingsIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service update pilot things integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdatePilotThingsIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service update pilot things integration params +func (o *ApplicationServiceUpdatePilotThingsIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdatePilotThingsIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service update pilot things integration params +func (o *ApplicationServiceUpdatePilotThingsIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service update pilot things integration params +func (o *ApplicationServiceUpdatePilotThingsIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdatePilotThingsIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service update pilot things integration params +func (o *ApplicationServiceUpdatePilotThingsIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service update pilot things integration params +func (o *ApplicationServiceUpdatePilotThingsIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdatePilotThingsIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service update pilot things integration params +func (o *ApplicationServiceUpdatePilotThingsIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service update pilot things integration params +func (o *ApplicationServiceUpdatePilotThingsIntegrationParams) WithBody(body ApplicationServiceUpdatePilotThingsIntegrationBody) *ApplicationServiceUpdatePilotThingsIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service update pilot things integration params +func (o *ApplicationServiceUpdatePilotThingsIntegrationParams) SetBody(body ApplicationServiceUpdatePilotThingsIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service update pilot things integration params +func (o *ApplicationServiceUpdatePilotThingsIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdatePilotThingsIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service update pilot things integration params +func (o *ApplicationServiceUpdatePilotThingsIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceUpdatePilotThingsIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_pilot_things_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_pilot_things_integration_responses.go new file mode 100644 index 0000000..cb63a20 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_pilot_things_integration_responses.go @@ -0,0 +1,325 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceUpdatePilotThingsIntegrationReader is a Reader for the ApplicationServiceUpdatePilotThingsIntegration structure. +type ApplicationServiceUpdatePilotThingsIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceUpdatePilotThingsIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceUpdatePilotThingsIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceUpdatePilotThingsIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceUpdatePilotThingsIntegrationOK creates a ApplicationServiceUpdatePilotThingsIntegrationOK with default headers values +func NewApplicationServiceUpdatePilotThingsIntegrationOK() *ApplicationServiceUpdatePilotThingsIntegrationOK { + return &ApplicationServiceUpdatePilotThingsIntegrationOK{} +} + +/* +ApplicationServiceUpdatePilotThingsIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceUpdatePilotThingsIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service update pilot things integration o k response has a 2xx status code +func (o *ApplicationServiceUpdatePilotThingsIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service update pilot things integration o k response has a 3xx status code +func (o *ApplicationServiceUpdatePilotThingsIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service update pilot things integration o k response has a 4xx status code +func (o *ApplicationServiceUpdatePilotThingsIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service update pilot things integration o k response has a 5xx status code +func (o *ApplicationServiceUpdatePilotThingsIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service update pilot things integration o k response a status code equal to that given +func (o *ApplicationServiceUpdatePilotThingsIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service update pilot things integration o k response +func (o *ApplicationServiceUpdatePilotThingsIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceUpdatePilotThingsIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/pilot-things][%d] applicationServiceUpdatePilotThingsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdatePilotThingsIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/pilot-things][%d] applicationServiceUpdatePilotThingsIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdatePilotThingsIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceUpdatePilotThingsIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceUpdatePilotThingsIntegrationDefault creates a ApplicationServiceUpdatePilotThingsIntegrationDefault with default headers values +func NewApplicationServiceUpdatePilotThingsIntegrationDefault(code int) *ApplicationServiceUpdatePilotThingsIntegrationDefault { + return &ApplicationServiceUpdatePilotThingsIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceUpdatePilotThingsIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceUpdatePilotThingsIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service update pilot things integration default response has a 2xx status code +func (o *ApplicationServiceUpdatePilotThingsIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service update pilot things integration default response has a 3xx status code +func (o *ApplicationServiceUpdatePilotThingsIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service update pilot things integration default response has a 4xx status code +func (o *ApplicationServiceUpdatePilotThingsIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service update pilot things integration default response has a 5xx status code +func (o *ApplicationServiceUpdatePilotThingsIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service update pilot things integration default response a status code equal to that given +func (o *ApplicationServiceUpdatePilotThingsIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service update pilot things integration default response +func (o *ApplicationServiceUpdatePilotThingsIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceUpdatePilotThingsIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/pilot-things][%d] ApplicationService_UpdatePilotThingsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdatePilotThingsIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/pilot-things][%d] ApplicationService_UpdatePilotThingsIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdatePilotThingsIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceUpdatePilotThingsIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceUpdatePilotThingsIntegrationBody application service update pilot things integration body +swagger:model ApplicationServiceUpdatePilotThingsIntegrationBody +*/ +type ApplicationServiceUpdatePilotThingsIntegrationBody struct { + + // integration + Integration *ApplicationServiceUpdatePilotThingsIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service update pilot things integration body +func (o *ApplicationServiceUpdatePilotThingsIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdatePilotThingsIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update pilot things integration body based on the context it is used +func (o *ApplicationServiceUpdatePilotThingsIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdatePilotThingsIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdatePilotThingsIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdatePilotThingsIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdatePilotThingsIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceUpdatePilotThingsIntegrationParamsBodyIntegration Integration object to update. +swagger:model ApplicationServiceUpdatePilotThingsIntegrationParamsBodyIntegration +*/ +type ApplicationServiceUpdatePilotThingsIntegrationParamsBodyIntegration struct { + + // Server URL. + Server string `json:"server,omitempty"` + + // Authentication token. + Token string `json:"token,omitempty"` +} + +// Validate validates this application service update pilot things integration params body integration +func (o *ApplicationServiceUpdatePilotThingsIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this application service update pilot things integration params body integration based on context it is used +func (o *ApplicationServiceUpdatePilotThingsIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdatePilotThingsIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdatePilotThingsIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdatePilotThingsIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_responses.go new file mode 100644 index 0000000..2965577 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_responses.go @@ -0,0 +1,334 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceUpdateReader is a Reader for the ApplicationServiceUpdate structure. +type ApplicationServiceUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceUpdateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceUpdateOK creates a ApplicationServiceUpdateOK with default headers values +func NewApplicationServiceUpdateOK() *ApplicationServiceUpdateOK { + return &ApplicationServiceUpdateOK{} +} + +/* +ApplicationServiceUpdateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceUpdateOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service update o k response has a 2xx status code +func (o *ApplicationServiceUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service update o k response has a 3xx status code +func (o *ApplicationServiceUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service update o k response has a 4xx status code +func (o *ApplicationServiceUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service update o k response has a 5xx status code +func (o *ApplicationServiceUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service update o k response a status code equal to that given +func (o *ApplicationServiceUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service update o k response +func (o *ApplicationServiceUpdateOK) Code() int { + return 200 +} + +func (o *ApplicationServiceUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{application.id}][%d] applicationServiceUpdateOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{application.id}][%d] applicationServiceUpdateOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceUpdateDefault creates a ApplicationServiceUpdateDefault with default headers values +func NewApplicationServiceUpdateDefault(code int) *ApplicationServiceUpdateDefault { + return &ApplicationServiceUpdateDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceUpdateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceUpdateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service update default response has a 2xx status code +func (o *ApplicationServiceUpdateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service update default response has a 3xx status code +func (o *ApplicationServiceUpdateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service update default response has a 4xx status code +func (o *ApplicationServiceUpdateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service update default response has a 5xx status code +func (o *ApplicationServiceUpdateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service update default response a status code equal to that given +func (o *ApplicationServiceUpdateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service update default response +func (o *ApplicationServiceUpdateDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceUpdateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{application.id}][%d] ApplicationService_Update default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{application.id}][%d] ApplicationService_Update default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceUpdateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceUpdateBody application service update body +swagger:model ApplicationServiceUpdateBody +*/ +type ApplicationServiceUpdateBody struct { + + // application + Application *ApplicationServiceUpdateParamsBodyApplication `json:"application,omitempty"` +} + +// Validate validates this application service update body +func (o *ApplicationServiceUpdateBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateApplication(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateBody) validateApplication(formats strfmt.Registry) error { + if swag.IsZero(o.Application) { // not required + return nil + } + + if o.Application != nil { + if err := o.Application.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "application") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update body based on the context it is used +func (o *ApplicationServiceUpdateBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateApplication(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateBody) contextValidateApplication(ctx context.Context, formats strfmt.Registry) error { + + if o.Application != nil { + + if swag.IsZero(o.Application) { // not required + return nil + } + + if err := o.Application.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "application") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceUpdateParamsBodyApplication Application object. +swagger:model ApplicationServiceUpdateParamsBodyApplication +*/ +type ApplicationServiceUpdateParamsBodyApplication struct { + + // Application description. + Description string `json:"description,omitempty"` + + // Application name. + Name string `json:"name,omitempty"` + + // Tags (user defined). + // These tags can be used to add additional information to the application. + // These tags are exposed in all the integration events of devices under + // this application. + Tags map[string]string `json:"tags,omitempty"` + + // Tenant ID (UUID). + TenantID string `json:"tenantId,omitempty"` +} + +// Validate validates this application service update params body application +func (o *ApplicationServiceUpdateParamsBodyApplication) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this application service update params body application based on context it is used +func (o *ApplicationServiceUpdateParamsBodyApplication) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateParamsBodyApplication) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateParamsBodyApplication) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateParamsBodyApplication + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_things_board_integration_parameters.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_things_board_integration_parameters.go new file mode 100644 index 0000000..6cd6aa3 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_things_board_integration_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewApplicationServiceUpdateThingsBoardIntegrationParams creates a new ApplicationServiceUpdateThingsBoardIntegrationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewApplicationServiceUpdateThingsBoardIntegrationParams() *ApplicationServiceUpdateThingsBoardIntegrationParams { + return &ApplicationServiceUpdateThingsBoardIntegrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewApplicationServiceUpdateThingsBoardIntegrationParamsWithTimeout creates a new ApplicationServiceUpdateThingsBoardIntegrationParams object +// with the ability to set a timeout on a request. +func NewApplicationServiceUpdateThingsBoardIntegrationParamsWithTimeout(timeout time.Duration) *ApplicationServiceUpdateThingsBoardIntegrationParams { + return &ApplicationServiceUpdateThingsBoardIntegrationParams{ + timeout: timeout, + } +} + +// NewApplicationServiceUpdateThingsBoardIntegrationParamsWithContext creates a new ApplicationServiceUpdateThingsBoardIntegrationParams object +// with the ability to set a context for a request. +func NewApplicationServiceUpdateThingsBoardIntegrationParamsWithContext(ctx context.Context) *ApplicationServiceUpdateThingsBoardIntegrationParams { + return &ApplicationServiceUpdateThingsBoardIntegrationParams{ + Context: ctx, + } +} + +// NewApplicationServiceUpdateThingsBoardIntegrationParamsWithHTTPClient creates a new ApplicationServiceUpdateThingsBoardIntegrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewApplicationServiceUpdateThingsBoardIntegrationParamsWithHTTPClient(client *http.Client) *ApplicationServiceUpdateThingsBoardIntegrationParams { + return &ApplicationServiceUpdateThingsBoardIntegrationParams{ + HTTPClient: client, + } +} + +/* +ApplicationServiceUpdateThingsBoardIntegrationParams contains all the parameters to send to the API endpoint + + for the application service update things board integration operation. + + Typically these are written to a http.Request. +*/ +type ApplicationServiceUpdateThingsBoardIntegrationParams struct { + + // Body. + Body ApplicationServiceUpdateThingsBoardIntegrationBody + + /* IntegrationApplicationID. + + Application ID (UUID). + */ + IntegrationApplicationID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the application service update things board integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateThingsBoardIntegrationParams) WithDefaults() *ApplicationServiceUpdateThingsBoardIntegrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the application service update things board integration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ApplicationServiceUpdateThingsBoardIntegrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the application service update things board integration params +func (o *ApplicationServiceUpdateThingsBoardIntegrationParams) WithTimeout(timeout time.Duration) *ApplicationServiceUpdateThingsBoardIntegrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the application service update things board integration params +func (o *ApplicationServiceUpdateThingsBoardIntegrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the application service update things board integration params +func (o *ApplicationServiceUpdateThingsBoardIntegrationParams) WithContext(ctx context.Context) *ApplicationServiceUpdateThingsBoardIntegrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the application service update things board integration params +func (o *ApplicationServiceUpdateThingsBoardIntegrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the application service update things board integration params +func (o *ApplicationServiceUpdateThingsBoardIntegrationParams) WithHTTPClient(client *http.Client) *ApplicationServiceUpdateThingsBoardIntegrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the application service update things board integration params +func (o *ApplicationServiceUpdateThingsBoardIntegrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the application service update things board integration params +func (o *ApplicationServiceUpdateThingsBoardIntegrationParams) WithBody(body ApplicationServiceUpdateThingsBoardIntegrationBody) *ApplicationServiceUpdateThingsBoardIntegrationParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the application service update things board integration params +func (o *ApplicationServiceUpdateThingsBoardIntegrationParams) SetBody(body ApplicationServiceUpdateThingsBoardIntegrationBody) { + o.Body = body +} + +// WithIntegrationApplicationID adds the integrationApplicationID to the application service update things board integration params +func (o *ApplicationServiceUpdateThingsBoardIntegrationParams) WithIntegrationApplicationID(integrationApplicationID string) *ApplicationServiceUpdateThingsBoardIntegrationParams { + o.SetIntegrationApplicationID(integrationApplicationID) + return o +} + +// SetIntegrationApplicationID adds the integrationApplicationId to the application service update things board integration params +func (o *ApplicationServiceUpdateThingsBoardIntegrationParams) SetIntegrationApplicationID(integrationApplicationID string) { + o.IntegrationApplicationID = integrationApplicationID +} + +// WriteToRequest writes these params to a swagger request +func (o *ApplicationServiceUpdateThingsBoardIntegrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param integration.applicationId + if err := r.SetPathParam("integration.applicationId", o.IntegrationApplicationID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_things_board_integration_responses.go b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_things_board_integration_responses.go new file mode 100644 index 0000000..d5bbbee --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/application_service/application_service_update_things_board_integration_responses.go @@ -0,0 +1,322 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// ApplicationServiceUpdateThingsBoardIntegrationReader is a Reader for the ApplicationServiceUpdateThingsBoardIntegration structure. +type ApplicationServiceUpdateThingsBoardIntegrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ApplicationServiceUpdateThingsBoardIntegrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewApplicationServiceUpdateThingsBoardIntegrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewApplicationServiceUpdateThingsBoardIntegrationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewApplicationServiceUpdateThingsBoardIntegrationOK creates a ApplicationServiceUpdateThingsBoardIntegrationOK with default headers values +func NewApplicationServiceUpdateThingsBoardIntegrationOK() *ApplicationServiceUpdateThingsBoardIntegrationOK { + return &ApplicationServiceUpdateThingsBoardIntegrationOK{} +} + +/* +ApplicationServiceUpdateThingsBoardIntegrationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ApplicationServiceUpdateThingsBoardIntegrationOK struct { + Payload interface{} +} + +// IsSuccess returns true when this application service update things board integration o k response has a 2xx status code +func (o *ApplicationServiceUpdateThingsBoardIntegrationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this application service update things board integration o k response has a 3xx status code +func (o *ApplicationServiceUpdateThingsBoardIntegrationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this application service update things board integration o k response has a 4xx status code +func (o *ApplicationServiceUpdateThingsBoardIntegrationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this application service update things board integration o k response has a 5xx status code +func (o *ApplicationServiceUpdateThingsBoardIntegrationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this application service update things board integration o k response a status code equal to that given +func (o *ApplicationServiceUpdateThingsBoardIntegrationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the application service update things board integration o k response +func (o *ApplicationServiceUpdateThingsBoardIntegrationOK) Code() int { + return 200 +} + +func (o *ApplicationServiceUpdateThingsBoardIntegrationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/thingsboard][%d] applicationServiceUpdateThingsBoardIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateThingsBoardIntegrationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/thingsboard][%d] applicationServiceUpdateThingsBoardIntegrationOK %s", 200, payload) +} + +func (o *ApplicationServiceUpdateThingsBoardIntegrationOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ApplicationServiceUpdateThingsBoardIntegrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewApplicationServiceUpdateThingsBoardIntegrationDefault creates a ApplicationServiceUpdateThingsBoardIntegrationDefault with default headers values +func NewApplicationServiceUpdateThingsBoardIntegrationDefault(code int) *ApplicationServiceUpdateThingsBoardIntegrationDefault { + return &ApplicationServiceUpdateThingsBoardIntegrationDefault{ + _statusCode: code, + } +} + +/* +ApplicationServiceUpdateThingsBoardIntegrationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ApplicationServiceUpdateThingsBoardIntegrationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this application service update things board integration default response has a 2xx status code +func (o *ApplicationServiceUpdateThingsBoardIntegrationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this application service update things board integration default response has a 3xx status code +func (o *ApplicationServiceUpdateThingsBoardIntegrationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this application service update things board integration default response has a 4xx status code +func (o *ApplicationServiceUpdateThingsBoardIntegrationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this application service update things board integration default response has a 5xx status code +func (o *ApplicationServiceUpdateThingsBoardIntegrationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this application service update things board integration default response a status code equal to that given +func (o *ApplicationServiceUpdateThingsBoardIntegrationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the application service update things board integration default response +func (o *ApplicationServiceUpdateThingsBoardIntegrationDefault) Code() int { + return o._statusCode +} + +func (o *ApplicationServiceUpdateThingsBoardIntegrationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/thingsboard][%d] ApplicationService_UpdateThingsBoardIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateThingsBoardIntegrationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/applications/{integration.applicationId}/integrations/thingsboard][%d] ApplicationService_UpdateThingsBoardIntegration default %s", o._statusCode, payload) +} + +func (o *ApplicationServiceUpdateThingsBoardIntegrationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *ApplicationServiceUpdateThingsBoardIntegrationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +ApplicationServiceUpdateThingsBoardIntegrationBody application service update things board integration body +swagger:model ApplicationServiceUpdateThingsBoardIntegrationBody +*/ +type ApplicationServiceUpdateThingsBoardIntegrationBody struct { + + // integration + Integration *ApplicationServiceUpdateThingsBoardIntegrationParamsBodyIntegration `json:"integration,omitempty"` +} + +// Validate validates this application service update things board integration body +func (o *ApplicationServiceUpdateThingsBoardIntegrationBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateThingsBoardIntegrationBody) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(o.Integration) { // not required + return nil + } + + if o.Integration != nil { + if err := o.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this application service update things board integration body based on the context it is used +func (o *ApplicationServiceUpdateThingsBoardIntegrationBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *ApplicationServiceUpdateThingsBoardIntegrationBody) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if o.Integration != nil { + + if swag.IsZero(o.Integration) { // not required + return nil + } + + if err := o.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateThingsBoardIntegrationBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateThingsBoardIntegrationBody) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateThingsBoardIntegrationBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ApplicationServiceUpdateThingsBoardIntegrationParamsBodyIntegration Integration object to update. +swagger:model ApplicationServiceUpdateThingsBoardIntegrationParamsBodyIntegration +*/ +type ApplicationServiceUpdateThingsBoardIntegrationParamsBodyIntegration struct { + + // ThingsBoard server endpoint, e.g. https://example.com + Server string `json:"server,omitempty"` +} + +// Validate validates this application service update things board integration params body integration +func (o *ApplicationServiceUpdateThingsBoardIntegrationParamsBodyIntegration) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this application service update things board integration params body integration based on context it is used +func (o *ApplicationServiceUpdateThingsBoardIntegrationParamsBodyIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ApplicationServiceUpdateThingsBoardIntegrationParamsBodyIntegration) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ApplicationServiceUpdateThingsBoardIntegrationParamsBodyIntegration) UnmarshalBinary(b []byte) error { + var res ApplicationServiceUpdateThingsBoardIntegrationParamsBodyIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/chirp_stack_r_e_s_t_api_client.go b/internal/app/service/lora/chirp_stack/client/chirp_stack_r_e_s_t_api_client.go new file mode 100644 index 0000000..28d6938 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/chirp_stack_r_e_s_t_api_client.go @@ -0,0 +1,147 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package client + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/client/application_service" + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/client/device_profile_service" + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/client/device_profile_template_service" + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/client/device_service" + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/client/gateway_service" + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/client/multicast_group_service" + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/client/tenant_service" + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/client/user_service" +) + +// Default chirp stack r e s t API HTTP client. +var Default = NewHTTPClient(nil) + +const ( + // DefaultHost is the default Host + // found in Meta (info) section of spec file + DefaultHost string = "localhost" + // DefaultBasePath is the default BasePath + // found in Meta (info) section of spec file + DefaultBasePath string = "/" +) + +// DefaultSchemes are the default schemes found in Meta (info) section of spec file +var DefaultSchemes = []string{"http", "https"} + +// NewHTTPClient creates a new chirp stack r e s t API HTTP client. +func NewHTTPClient(formats strfmt.Registry) *ChirpStackRESTAPI { + return NewHTTPClientWithConfig(formats, nil) +} + +// NewHTTPClientWithConfig creates a new chirp stack r e s t API HTTP client, +// using a customizable transport config. +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *ChirpStackRESTAPI { + // ensure nullable parameters have default + if cfg == nil { + cfg = DefaultTransportConfig() + } + + // create transport and client + transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) + return New(transport, formats) +} + +// New creates a new chirp stack r e s t API client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *ChirpStackRESTAPI { + // ensure nullable parameters have default + if formats == nil { + formats = strfmt.Default + } + + cli := new(ChirpStackRESTAPI) + cli.Transport = transport + cli.ApplicationService = application_service.New(transport, formats) + cli.DeviceProfileService = device_profile_service.New(transport, formats) + cli.DeviceProfileTemplateService = device_profile_template_service.New(transport, formats) + cli.DeviceService = device_service.New(transport, formats) + cli.GatewayService = gateway_service.New(transport, formats) + cli.MulticastGroupService = multicast_group_service.New(transport, formats) + cli.TenantService = tenant_service.New(transport, formats) + cli.UserService = user_service.New(transport, formats) + return cli +} + +// DefaultTransportConfig creates a TransportConfig with the +// default settings taken from the meta section of the spec file. +func DefaultTransportConfig() *TransportConfig { + return &TransportConfig{ + Host: DefaultHost, + BasePath: DefaultBasePath, + Schemes: DefaultSchemes, + } +} + +// TransportConfig contains the transport related info, +// found in the meta section of the spec file. +type TransportConfig struct { + Host string + BasePath string + Schemes []string +} + +// WithHost overrides the default host, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithHost(host string) *TransportConfig { + cfg.Host = host + return cfg +} + +// WithBasePath overrides the default basePath, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { + cfg.BasePath = basePath + return cfg +} + +// WithSchemes overrides the default schemes, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { + cfg.Schemes = schemes + return cfg +} + +// ChirpStackRESTAPI is a client for chirp stack r e s t API +type ChirpStackRESTAPI struct { + ApplicationService application_service.ClientService + + DeviceProfileService device_profile_service.ClientService + + DeviceProfileTemplateService device_profile_template_service.ClientService + + DeviceService device_service.ClientService + + GatewayService gateway_service.ClientService + + MulticastGroupService multicast_group_service.ClientService + + TenantService tenant_service.ClientService + + UserService user_service.ClientService + + Transport runtime.ClientTransport +} + +// SetTransport changes the transport on the client and all its subresources +func (c *ChirpStackRESTAPI) SetTransport(transport runtime.ClientTransport) { + c.Transport = transport + c.ApplicationService.SetTransport(transport) + c.DeviceProfileService.SetTransport(transport) + c.DeviceProfileTemplateService.SetTransport(transport) + c.DeviceService.SetTransport(transport) + c.GatewayService.SetTransport(transport) + c.MulticastGroupService.SetTransport(transport) + c.TenantService.SetTransport(transport) + c.UserService.SetTransport(transport) +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_client.go b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_client.go new file mode 100644 index 0000000..3b1139a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_client.go @@ -0,0 +1,303 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new device profile service API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new device profile service API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new device profile service API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for device profile service API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeviceProfileServiceCreate(params *DeviceProfileServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceCreateOK, error) + + DeviceProfileServiceDelete(params *DeviceProfileServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceDeleteOK, error) + + DeviceProfileServiceGet(params *DeviceProfileServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceGetOK, error) + + DeviceProfileServiceList(params *DeviceProfileServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceListOK, error) + + DeviceProfileServiceListAdrAlgorithms(params *DeviceProfileServiceListAdrAlgorithmsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceListAdrAlgorithmsOK, error) + + DeviceProfileServiceUpdate(params *DeviceProfileServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceUpdateOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeviceProfileServiceCreate creates the given device profile +*/ +func (a *Client) DeviceProfileServiceCreate(params *DeviceProfileServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceProfileServiceCreateParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceProfileService_Create", + Method: "POST", + PathPattern: "/api/device-profiles", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceProfileServiceCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceProfileServiceCreateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceProfileServiceCreateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceProfileServiceDelete deletes the device profile with the given ID +*/ +func (a *Client) DeviceProfileServiceDelete(params *DeviceProfileServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceProfileServiceDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceProfileService_Delete", + Method: "DELETE", + PathPattern: "/api/device-profiles/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceProfileServiceDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceProfileServiceDeleteOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceProfileServiceDeleteDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceProfileServiceGet gets the device profile for the given ID +*/ +func (a *Client) DeviceProfileServiceGet(params *DeviceProfileServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceProfileServiceGetParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceProfileService_Get", + Method: "GET", + PathPattern: "/api/device-profiles/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceProfileServiceGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceProfileServiceGetOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceProfileServiceGetDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceProfileServiceList lists the available device profiles +*/ +func (a *Client) DeviceProfileServiceList(params *DeviceProfileServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceProfileServiceListParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceProfileService_List", + Method: "GET", + PathPattern: "/api/device-profiles", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceProfileServiceListReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceProfileServiceListOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceProfileServiceListDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceProfileServiceListAdrAlgorithms lists available a d r algorithms +*/ +func (a *Client) DeviceProfileServiceListAdrAlgorithms(params *DeviceProfileServiceListAdrAlgorithmsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceListAdrAlgorithmsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceProfileServiceListAdrAlgorithmsParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceProfileService_ListAdrAlgorithms", + Method: "GET", + PathPattern: "/api/device-profiles/adr-algorithms", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceProfileServiceListAdrAlgorithmsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceProfileServiceListAdrAlgorithmsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceProfileServiceListAdrAlgorithmsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceProfileServiceUpdate updates the given device profile +*/ +func (a *Client) DeviceProfileServiceUpdate(params *DeviceProfileServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceProfileServiceUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceProfileService_Update", + Method: "PUT", + PathPattern: "/api/device-profiles/{deviceProfile.id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceProfileServiceUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceProfileServiceUpdateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceProfileServiceUpdateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_create_parameters.go b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_create_parameters.go new file mode 100644 index 0000000..532b50d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_create_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// NewDeviceProfileServiceCreateParams creates a new DeviceProfileServiceCreateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceProfileServiceCreateParams() *DeviceProfileServiceCreateParams { + return &DeviceProfileServiceCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceProfileServiceCreateParamsWithTimeout creates a new DeviceProfileServiceCreateParams object +// with the ability to set a timeout on a request. +func NewDeviceProfileServiceCreateParamsWithTimeout(timeout time.Duration) *DeviceProfileServiceCreateParams { + return &DeviceProfileServiceCreateParams{ + timeout: timeout, + } +} + +// NewDeviceProfileServiceCreateParamsWithContext creates a new DeviceProfileServiceCreateParams object +// with the ability to set a context for a request. +func NewDeviceProfileServiceCreateParamsWithContext(ctx context.Context) *DeviceProfileServiceCreateParams { + return &DeviceProfileServiceCreateParams{ + Context: ctx, + } +} + +// NewDeviceProfileServiceCreateParamsWithHTTPClient creates a new DeviceProfileServiceCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceProfileServiceCreateParamsWithHTTPClient(client *http.Client) *DeviceProfileServiceCreateParams { + return &DeviceProfileServiceCreateParams{ + HTTPClient: client, + } +} + +/* +DeviceProfileServiceCreateParams contains all the parameters to send to the API endpoint + + for the device profile service create operation. + + Typically these are written to a http.Request. +*/ +type DeviceProfileServiceCreateParams struct { + + // Body. + Body *models.APICreateDeviceProfileRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device profile service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileServiceCreateParams) WithDefaults() *DeviceProfileServiceCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device profile service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileServiceCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device profile service create params +func (o *DeviceProfileServiceCreateParams) WithTimeout(timeout time.Duration) *DeviceProfileServiceCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device profile service create params +func (o *DeviceProfileServiceCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device profile service create params +func (o *DeviceProfileServiceCreateParams) WithContext(ctx context.Context) *DeviceProfileServiceCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device profile service create params +func (o *DeviceProfileServiceCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device profile service create params +func (o *DeviceProfileServiceCreateParams) WithHTTPClient(client *http.Client) *DeviceProfileServiceCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device profile service create params +func (o *DeviceProfileServiceCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the device profile service create params +func (o *DeviceProfileServiceCreateParams) WithBody(body *models.APICreateDeviceProfileRequest) *DeviceProfileServiceCreateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the device profile service create params +func (o *DeviceProfileServiceCreateParams) SetBody(body *models.APICreateDeviceProfileRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceProfileServiceCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_create_responses.go b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_create_responses.go new file mode 100644 index 0000000..d3bf63d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_create_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceProfileServiceCreateReader is a Reader for the DeviceProfileServiceCreate structure. +type DeviceProfileServiceCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceProfileServiceCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceProfileServiceCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceProfileServiceCreateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceProfileServiceCreateOK creates a DeviceProfileServiceCreateOK with default headers values +func NewDeviceProfileServiceCreateOK() *DeviceProfileServiceCreateOK { + return &DeviceProfileServiceCreateOK{} +} + +/* +DeviceProfileServiceCreateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceProfileServiceCreateOK struct { + Payload *models.APICreateDeviceProfileResponse +} + +// IsSuccess returns true when this device profile service create o k response has a 2xx status code +func (o *DeviceProfileServiceCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device profile service create o k response has a 3xx status code +func (o *DeviceProfileServiceCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device profile service create o k response has a 4xx status code +func (o *DeviceProfileServiceCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device profile service create o k response has a 5xx status code +func (o *DeviceProfileServiceCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device profile service create o k response a status code equal to that given +func (o *DeviceProfileServiceCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device profile service create o k response +func (o *DeviceProfileServiceCreateOK) Code() int { + return 200 +} + +func (o *DeviceProfileServiceCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/device-profiles][%d] deviceProfileServiceCreateOK %s", 200, payload) +} + +func (o *DeviceProfileServiceCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/device-profiles][%d] deviceProfileServiceCreateOK %s", 200, payload) +} + +func (o *DeviceProfileServiceCreateOK) GetPayload() *models.APICreateDeviceProfileResponse { + return o.Payload +} + +func (o *DeviceProfileServiceCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APICreateDeviceProfileResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceProfileServiceCreateDefault creates a DeviceProfileServiceCreateDefault with default headers values +func NewDeviceProfileServiceCreateDefault(code int) *DeviceProfileServiceCreateDefault { + return &DeviceProfileServiceCreateDefault{ + _statusCode: code, + } +} + +/* +DeviceProfileServiceCreateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceProfileServiceCreateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device profile service create default response has a 2xx status code +func (o *DeviceProfileServiceCreateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device profile service create default response has a 3xx status code +func (o *DeviceProfileServiceCreateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device profile service create default response has a 4xx status code +func (o *DeviceProfileServiceCreateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device profile service create default response has a 5xx status code +func (o *DeviceProfileServiceCreateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device profile service create default response a status code equal to that given +func (o *DeviceProfileServiceCreateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device profile service create default response +func (o *DeviceProfileServiceCreateDefault) Code() int { + return o._statusCode +} + +func (o *DeviceProfileServiceCreateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/device-profiles][%d] DeviceProfileService_Create default %s", o._statusCode, payload) +} + +func (o *DeviceProfileServiceCreateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/device-profiles][%d] DeviceProfileService_Create default %s", o._statusCode, payload) +} + +func (o *DeviceProfileServiceCreateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceProfileServiceCreateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_delete_parameters.go b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_delete_parameters.go new file mode 100644 index 0000000..c600d16 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceProfileServiceDeleteParams creates a new DeviceProfileServiceDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceProfileServiceDeleteParams() *DeviceProfileServiceDeleteParams { + return &DeviceProfileServiceDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceProfileServiceDeleteParamsWithTimeout creates a new DeviceProfileServiceDeleteParams object +// with the ability to set a timeout on a request. +func NewDeviceProfileServiceDeleteParamsWithTimeout(timeout time.Duration) *DeviceProfileServiceDeleteParams { + return &DeviceProfileServiceDeleteParams{ + timeout: timeout, + } +} + +// NewDeviceProfileServiceDeleteParamsWithContext creates a new DeviceProfileServiceDeleteParams object +// with the ability to set a context for a request. +func NewDeviceProfileServiceDeleteParamsWithContext(ctx context.Context) *DeviceProfileServiceDeleteParams { + return &DeviceProfileServiceDeleteParams{ + Context: ctx, + } +} + +// NewDeviceProfileServiceDeleteParamsWithHTTPClient creates a new DeviceProfileServiceDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceProfileServiceDeleteParamsWithHTTPClient(client *http.Client) *DeviceProfileServiceDeleteParams { + return &DeviceProfileServiceDeleteParams{ + HTTPClient: client, + } +} + +/* +DeviceProfileServiceDeleteParams contains all the parameters to send to the API endpoint + + for the device profile service delete operation. + + Typically these are written to a http.Request. +*/ +type DeviceProfileServiceDeleteParams struct { + + /* ID. + + ID (UUID). + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device profile service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileServiceDeleteParams) WithDefaults() *DeviceProfileServiceDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device profile service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileServiceDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device profile service delete params +func (o *DeviceProfileServiceDeleteParams) WithTimeout(timeout time.Duration) *DeviceProfileServiceDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device profile service delete params +func (o *DeviceProfileServiceDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device profile service delete params +func (o *DeviceProfileServiceDeleteParams) WithContext(ctx context.Context) *DeviceProfileServiceDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device profile service delete params +func (o *DeviceProfileServiceDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device profile service delete params +func (o *DeviceProfileServiceDeleteParams) WithHTTPClient(client *http.Client) *DeviceProfileServiceDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device profile service delete params +func (o *DeviceProfileServiceDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the device profile service delete params +func (o *DeviceProfileServiceDeleteParams) WithID(id string) *DeviceProfileServiceDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the device profile service delete params +func (o *DeviceProfileServiceDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceProfileServiceDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_delete_responses.go b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_delete_responses.go new file mode 100644 index 0000000..7a8bcd8 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_delete_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceProfileServiceDeleteReader is a Reader for the DeviceProfileServiceDelete structure. +type DeviceProfileServiceDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceProfileServiceDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceProfileServiceDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceProfileServiceDeleteDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceProfileServiceDeleteOK creates a DeviceProfileServiceDeleteOK with default headers values +func NewDeviceProfileServiceDeleteOK() *DeviceProfileServiceDeleteOK { + return &DeviceProfileServiceDeleteOK{} +} + +/* +DeviceProfileServiceDeleteOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceProfileServiceDeleteOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device profile service delete o k response has a 2xx status code +func (o *DeviceProfileServiceDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device profile service delete o k response has a 3xx status code +func (o *DeviceProfileServiceDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device profile service delete o k response has a 4xx status code +func (o *DeviceProfileServiceDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device profile service delete o k response has a 5xx status code +func (o *DeviceProfileServiceDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device profile service delete o k response a status code equal to that given +func (o *DeviceProfileServiceDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device profile service delete o k response +func (o *DeviceProfileServiceDeleteOK) Code() int { + return 200 +} + +func (o *DeviceProfileServiceDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/device-profiles/{id}][%d] deviceProfileServiceDeleteOK %s", 200, payload) +} + +func (o *DeviceProfileServiceDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/device-profiles/{id}][%d] deviceProfileServiceDeleteOK %s", 200, payload) +} + +func (o *DeviceProfileServiceDeleteOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceProfileServiceDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceProfileServiceDeleteDefault creates a DeviceProfileServiceDeleteDefault with default headers values +func NewDeviceProfileServiceDeleteDefault(code int) *DeviceProfileServiceDeleteDefault { + return &DeviceProfileServiceDeleteDefault{ + _statusCode: code, + } +} + +/* +DeviceProfileServiceDeleteDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceProfileServiceDeleteDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device profile service delete default response has a 2xx status code +func (o *DeviceProfileServiceDeleteDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device profile service delete default response has a 3xx status code +func (o *DeviceProfileServiceDeleteDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device profile service delete default response has a 4xx status code +func (o *DeviceProfileServiceDeleteDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device profile service delete default response has a 5xx status code +func (o *DeviceProfileServiceDeleteDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device profile service delete default response a status code equal to that given +func (o *DeviceProfileServiceDeleteDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device profile service delete default response +func (o *DeviceProfileServiceDeleteDefault) Code() int { + return o._statusCode +} + +func (o *DeviceProfileServiceDeleteDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/device-profiles/{id}][%d] DeviceProfileService_Delete default %s", o._statusCode, payload) +} + +func (o *DeviceProfileServiceDeleteDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/device-profiles/{id}][%d] DeviceProfileService_Delete default %s", o._statusCode, payload) +} + +func (o *DeviceProfileServiceDeleteDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceProfileServiceDeleteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_get_parameters.go b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_get_parameters.go new file mode 100644 index 0000000..a8b6d5f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceProfileServiceGetParams creates a new DeviceProfileServiceGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceProfileServiceGetParams() *DeviceProfileServiceGetParams { + return &DeviceProfileServiceGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceProfileServiceGetParamsWithTimeout creates a new DeviceProfileServiceGetParams object +// with the ability to set a timeout on a request. +func NewDeviceProfileServiceGetParamsWithTimeout(timeout time.Duration) *DeviceProfileServiceGetParams { + return &DeviceProfileServiceGetParams{ + timeout: timeout, + } +} + +// NewDeviceProfileServiceGetParamsWithContext creates a new DeviceProfileServiceGetParams object +// with the ability to set a context for a request. +func NewDeviceProfileServiceGetParamsWithContext(ctx context.Context) *DeviceProfileServiceGetParams { + return &DeviceProfileServiceGetParams{ + Context: ctx, + } +} + +// NewDeviceProfileServiceGetParamsWithHTTPClient creates a new DeviceProfileServiceGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceProfileServiceGetParamsWithHTTPClient(client *http.Client) *DeviceProfileServiceGetParams { + return &DeviceProfileServiceGetParams{ + HTTPClient: client, + } +} + +/* +DeviceProfileServiceGetParams contains all the parameters to send to the API endpoint + + for the device profile service get operation. + + Typically these are written to a http.Request. +*/ +type DeviceProfileServiceGetParams struct { + + /* ID. + + ID (UUID). + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device profile service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileServiceGetParams) WithDefaults() *DeviceProfileServiceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device profile service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileServiceGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device profile service get params +func (o *DeviceProfileServiceGetParams) WithTimeout(timeout time.Duration) *DeviceProfileServiceGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device profile service get params +func (o *DeviceProfileServiceGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device profile service get params +func (o *DeviceProfileServiceGetParams) WithContext(ctx context.Context) *DeviceProfileServiceGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device profile service get params +func (o *DeviceProfileServiceGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device profile service get params +func (o *DeviceProfileServiceGetParams) WithHTTPClient(client *http.Client) *DeviceProfileServiceGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device profile service get params +func (o *DeviceProfileServiceGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the device profile service get params +func (o *DeviceProfileServiceGetParams) WithID(id string) *DeviceProfileServiceGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the device profile service get params +func (o *DeviceProfileServiceGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceProfileServiceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_get_responses.go b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_get_responses.go new file mode 100644 index 0000000..d6fee5f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_get_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceProfileServiceGetReader is a Reader for the DeviceProfileServiceGet structure. +type DeviceProfileServiceGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceProfileServiceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceProfileServiceGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceProfileServiceGetDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceProfileServiceGetOK creates a DeviceProfileServiceGetOK with default headers values +func NewDeviceProfileServiceGetOK() *DeviceProfileServiceGetOK { + return &DeviceProfileServiceGetOK{} +} + +/* +DeviceProfileServiceGetOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceProfileServiceGetOK struct { + Payload *models.APIGetDeviceProfileResponse +} + +// IsSuccess returns true when this device profile service get o k response has a 2xx status code +func (o *DeviceProfileServiceGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device profile service get o k response has a 3xx status code +func (o *DeviceProfileServiceGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device profile service get o k response has a 4xx status code +func (o *DeviceProfileServiceGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device profile service get o k response has a 5xx status code +func (o *DeviceProfileServiceGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device profile service get o k response a status code equal to that given +func (o *DeviceProfileServiceGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device profile service get o k response +func (o *DeviceProfileServiceGetOK) Code() int { + return 200 +} + +func (o *DeviceProfileServiceGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profiles/{id}][%d] deviceProfileServiceGetOK %s", 200, payload) +} + +func (o *DeviceProfileServiceGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profiles/{id}][%d] deviceProfileServiceGetOK %s", 200, payload) +} + +func (o *DeviceProfileServiceGetOK) GetPayload() *models.APIGetDeviceProfileResponse { + return o.Payload +} + +func (o *DeviceProfileServiceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetDeviceProfileResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceProfileServiceGetDefault creates a DeviceProfileServiceGetDefault with default headers values +func NewDeviceProfileServiceGetDefault(code int) *DeviceProfileServiceGetDefault { + return &DeviceProfileServiceGetDefault{ + _statusCode: code, + } +} + +/* +DeviceProfileServiceGetDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceProfileServiceGetDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device profile service get default response has a 2xx status code +func (o *DeviceProfileServiceGetDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device profile service get default response has a 3xx status code +func (o *DeviceProfileServiceGetDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device profile service get default response has a 4xx status code +func (o *DeviceProfileServiceGetDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device profile service get default response has a 5xx status code +func (o *DeviceProfileServiceGetDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device profile service get default response a status code equal to that given +func (o *DeviceProfileServiceGetDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device profile service get default response +func (o *DeviceProfileServiceGetDefault) Code() int { + return o._statusCode +} + +func (o *DeviceProfileServiceGetDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profiles/{id}][%d] DeviceProfileService_Get default %s", o._statusCode, payload) +} + +func (o *DeviceProfileServiceGetDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profiles/{id}][%d] DeviceProfileService_Get default %s", o._statusCode, payload) +} + +func (o *DeviceProfileServiceGetDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceProfileServiceGetDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_list_adr_algorithms_parameters.go b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_list_adr_algorithms_parameters.go new file mode 100644 index 0000000..342e00b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_list_adr_algorithms_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceProfileServiceListAdrAlgorithmsParams creates a new DeviceProfileServiceListAdrAlgorithmsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceProfileServiceListAdrAlgorithmsParams() *DeviceProfileServiceListAdrAlgorithmsParams { + return &DeviceProfileServiceListAdrAlgorithmsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceProfileServiceListAdrAlgorithmsParamsWithTimeout creates a new DeviceProfileServiceListAdrAlgorithmsParams object +// with the ability to set a timeout on a request. +func NewDeviceProfileServiceListAdrAlgorithmsParamsWithTimeout(timeout time.Duration) *DeviceProfileServiceListAdrAlgorithmsParams { + return &DeviceProfileServiceListAdrAlgorithmsParams{ + timeout: timeout, + } +} + +// NewDeviceProfileServiceListAdrAlgorithmsParamsWithContext creates a new DeviceProfileServiceListAdrAlgorithmsParams object +// with the ability to set a context for a request. +func NewDeviceProfileServiceListAdrAlgorithmsParamsWithContext(ctx context.Context) *DeviceProfileServiceListAdrAlgorithmsParams { + return &DeviceProfileServiceListAdrAlgorithmsParams{ + Context: ctx, + } +} + +// NewDeviceProfileServiceListAdrAlgorithmsParamsWithHTTPClient creates a new DeviceProfileServiceListAdrAlgorithmsParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceProfileServiceListAdrAlgorithmsParamsWithHTTPClient(client *http.Client) *DeviceProfileServiceListAdrAlgorithmsParams { + return &DeviceProfileServiceListAdrAlgorithmsParams{ + HTTPClient: client, + } +} + +/* +DeviceProfileServiceListAdrAlgorithmsParams contains all the parameters to send to the API endpoint + + for the device profile service list adr algorithms operation. + + Typically these are written to a http.Request. +*/ +type DeviceProfileServiceListAdrAlgorithmsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device profile service list adr algorithms params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileServiceListAdrAlgorithmsParams) WithDefaults() *DeviceProfileServiceListAdrAlgorithmsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device profile service list adr algorithms params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileServiceListAdrAlgorithmsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device profile service list adr algorithms params +func (o *DeviceProfileServiceListAdrAlgorithmsParams) WithTimeout(timeout time.Duration) *DeviceProfileServiceListAdrAlgorithmsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device profile service list adr algorithms params +func (o *DeviceProfileServiceListAdrAlgorithmsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device profile service list adr algorithms params +func (o *DeviceProfileServiceListAdrAlgorithmsParams) WithContext(ctx context.Context) *DeviceProfileServiceListAdrAlgorithmsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device profile service list adr algorithms params +func (o *DeviceProfileServiceListAdrAlgorithmsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device profile service list adr algorithms params +func (o *DeviceProfileServiceListAdrAlgorithmsParams) WithHTTPClient(client *http.Client) *DeviceProfileServiceListAdrAlgorithmsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device profile service list adr algorithms params +func (o *DeviceProfileServiceListAdrAlgorithmsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceProfileServiceListAdrAlgorithmsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_list_adr_algorithms_responses.go b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_list_adr_algorithms_responses.go new file mode 100644 index 0000000..489eeb1 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_list_adr_algorithms_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceProfileServiceListAdrAlgorithmsReader is a Reader for the DeviceProfileServiceListAdrAlgorithms structure. +type DeviceProfileServiceListAdrAlgorithmsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceProfileServiceListAdrAlgorithmsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceProfileServiceListAdrAlgorithmsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceProfileServiceListAdrAlgorithmsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceProfileServiceListAdrAlgorithmsOK creates a DeviceProfileServiceListAdrAlgorithmsOK with default headers values +func NewDeviceProfileServiceListAdrAlgorithmsOK() *DeviceProfileServiceListAdrAlgorithmsOK { + return &DeviceProfileServiceListAdrAlgorithmsOK{} +} + +/* +DeviceProfileServiceListAdrAlgorithmsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceProfileServiceListAdrAlgorithmsOK struct { + Payload *models.APIListDeviceProfileAdrAlgorithmsResponse +} + +// IsSuccess returns true when this device profile service list adr algorithms o k response has a 2xx status code +func (o *DeviceProfileServiceListAdrAlgorithmsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device profile service list adr algorithms o k response has a 3xx status code +func (o *DeviceProfileServiceListAdrAlgorithmsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device profile service list adr algorithms o k response has a 4xx status code +func (o *DeviceProfileServiceListAdrAlgorithmsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device profile service list adr algorithms o k response has a 5xx status code +func (o *DeviceProfileServiceListAdrAlgorithmsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device profile service list adr algorithms o k response a status code equal to that given +func (o *DeviceProfileServiceListAdrAlgorithmsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device profile service list adr algorithms o k response +func (o *DeviceProfileServiceListAdrAlgorithmsOK) Code() int { + return 200 +} + +func (o *DeviceProfileServiceListAdrAlgorithmsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profiles/adr-algorithms][%d] deviceProfileServiceListAdrAlgorithmsOK %s", 200, payload) +} + +func (o *DeviceProfileServiceListAdrAlgorithmsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profiles/adr-algorithms][%d] deviceProfileServiceListAdrAlgorithmsOK %s", 200, payload) +} + +func (o *DeviceProfileServiceListAdrAlgorithmsOK) GetPayload() *models.APIListDeviceProfileAdrAlgorithmsResponse { + return o.Payload +} + +func (o *DeviceProfileServiceListAdrAlgorithmsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListDeviceProfileAdrAlgorithmsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceProfileServiceListAdrAlgorithmsDefault creates a DeviceProfileServiceListAdrAlgorithmsDefault with default headers values +func NewDeviceProfileServiceListAdrAlgorithmsDefault(code int) *DeviceProfileServiceListAdrAlgorithmsDefault { + return &DeviceProfileServiceListAdrAlgorithmsDefault{ + _statusCode: code, + } +} + +/* +DeviceProfileServiceListAdrAlgorithmsDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceProfileServiceListAdrAlgorithmsDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device profile service list adr algorithms default response has a 2xx status code +func (o *DeviceProfileServiceListAdrAlgorithmsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device profile service list adr algorithms default response has a 3xx status code +func (o *DeviceProfileServiceListAdrAlgorithmsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device profile service list adr algorithms default response has a 4xx status code +func (o *DeviceProfileServiceListAdrAlgorithmsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device profile service list adr algorithms default response has a 5xx status code +func (o *DeviceProfileServiceListAdrAlgorithmsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device profile service list adr algorithms default response a status code equal to that given +func (o *DeviceProfileServiceListAdrAlgorithmsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device profile service list adr algorithms default response +func (o *DeviceProfileServiceListAdrAlgorithmsDefault) Code() int { + return o._statusCode +} + +func (o *DeviceProfileServiceListAdrAlgorithmsDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profiles/adr-algorithms][%d] DeviceProfileService_ListAdrAlgorithms default %s", o._statusCode, payload) +} + +func (o *DeviceProfileServiceListAdrAlgorithmsDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profiles/adr-algorithms][%d] DeviceProfileService_ListAdrAlgorithms default %s", o._statusCode, payload) +} + +func (o *DeviceProfileServiceListAdrAlgorithmsDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceProfileServiceListAdrAlgorithmsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_list_parameters.go b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_list_parameters.go new file mode 100644 index 0000000..bbd9da7 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_list_parameters.go @@ -0,0 +1,271 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewDeviceProfileServiceListParams creates a new DeviceProfileServiceListParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceProfileServiceListParams() *DeviceProfileServiceListParams { + return &DeviceProfileServiceListParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceProfileServiceListParamsWithTimeout creates a new DeviceProfileServiceListParams object +// with the ability to set a timeout on a request. +func NewDeviceProfileServiceListParamsWithTimeout(timeout time.Duration) *DeviceProfileServiceListParams { + return &DeviceProfileServiceListParams{ + timeout: timeout, + } +} + +// NewDeviceProfileServiceListParamsWithContext creates a new DeviceProfileServiceListParams object +// with the ability to set a context for a request. +func NewDeviceProfileServiceListParamsWithContext(ctx context.Context) *DeviceProfileServiceListParams { + return &DeviceProfileServiceListParams{ + Context: ctx, + } +} + +// NewDeviceProfileServiceListParamsWithHTTPClient creates a new DeviceProfileServiceListParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceProfileServiceListParamsWithHTTPClient(client *http.Client) *DeviceProfileServiceListParams { + return &DeviceProfileServiceListParams{ + HTTPClient: client, + } +} + +/* +DeviceProfileServiceListParams contains all the parameters to send to the API endpoint + + for the device profile service list operation. + + Typically these are written to a http.Request. +*/ +type DeviceProfileServiceListParams struct { + + /* Limit. + + Max number of device-profiles to return in the result-set. + If not set, it will be treated as 0, and the response will only return the total_count. + + Format: int64 + */ + Limit *int64 + + /* Offset. + + Offset in the result-set (for pagination). + + Format: int64 + */ + Offset *int64 + + /* Search. + + If set, the given string will be used to search on name. + */ + Search *string + + /* TenantID. + + Tenant ID to list the device-profiles for. + */ + TenantID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device profile service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileServiceListParams) WithDefaults() *DeviceProfileServiceListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device profile service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileServiceListParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device profile service list params +func (o *DeviceProfileServiceListParams) WithTimeout(timeout time.Duration) *DeviceProfileServiceListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device profile service list params +func (o *DeviceProfileServiceListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device profile service list params +func (o *DeviceProfileServiceListParams) WithContext(ctx context.Context) *DeviceProfileServiceListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device profile service list params +func (o *DeviceProfileServiceListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device profile service list params +func (o *DeviceProfileServiceListParams) WithHTTPClient(client *http.Client) *DeviceProfileServiceListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device profile service list params +func (o *DeviceProfileServiceListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the device profile service list params +func (o *DeviceProfileServiceListParams) WithLimit(limit *int64) *DeviceProfileServiceListParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the device profile service list params +func (o *DeviceProfileServiceListParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithOffset adds the offset to the device profile service list params +func (o *DeviceProfileServiceListParams) WithOffset(offset *int64) *DeviceProfileServiceListParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the device profile service list params +func (o *DeviceProfileServiceListParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithSearch adds the search to the device profile service list params +func (o *DeviceProfileServiceListParams) WithSearch(search *string) *DeviceProfileServiceListParams { + o.SetSearch(search) + return o +} + +// SetSearch adds the search to the device profile service list params +func (o *DeviceProfileServiceListParams) SetSearch(search *string) { + o.Search = search +} + +// WithTenantID adds the tenantID to the device profile service list params +func (o *DeviceProfileServiceListParams) WithTenantID(tenantID *string) *DeviceProfileServiceListParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the device profile service list params +func (o *DeviceProfileServiceListParams) SetTenantID(tenantID *string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceProfileServiceListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Limit != nil { + + // query param limit + var qrLimit int64 + + if o.Limit != nil { + qrLimit = *o.Limit + } + qLimit := swag.FormatInt64(qrLimit) + if qLimit != "" { + + if err := r.SetQueryParam("limit", qLimit); err != nil { + return err + } + } + } + + if o.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + if o.Search != nil { + + // query param search + var qrSearch string + + if o.Search != nil { + qrSearch = *o.Search + } + qSearch := qrSearch + if qSearch != "" { + + if err := r.SetQueryParam("search", qSearch); err != nil { + return err + } + } + } + + if o.TenantID != nil { + + // query param tenantId + var qrTenantID string + + if o.TenantID != nil { + qrTenantID = *o.TenantID + } + qTenantID := qrTenantID + if qTenantID != "" { + + if err := r.SetQueryParam("tenantId", qTenantID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_list_responses.go b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_list_responses.go new file mode 100644 index 0000000..54495eb --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_list_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceProfileServiceListReader is a Reader for the DeviceProfileServiceList structure. +type DeviceProfileServiceListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceProfileServiceListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceProfileServiceListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceProfileServiceListDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceProfileServiceListOK creates a DeviceProfileServiceListOK with default headers values +func NewDeviceProfileServiceListOK() *DeviceProfileServiceListOK { + return &DeviceProfileServiceListOK{} +} + +/* +DeviceProfileServiceListOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceProfileServiceListOK struct { + Payload *models.APIListDeviceProfilesResponse +} + +// IsSuccess returns true when this device profile service list o k response has a 2xx status code +func (o *DeviceProfileServiceListOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device profile service list o k response has a 3xx status code +func (o *DeviceProfileServiceListOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device profile service list o k response has a 4xx status code +func (o *DeviceProfileServiceListOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device profile service list o k response has a 5xx status code +func (o *DeviceProfileServiceListOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device profile service list o k response a status code equal to that given +func (o *DeviceProfileServiceListOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device profile service list o k response +func (o *DeviceProfileServiceListOK) Code() int { + return 200 +} + +func (o *DeviceProfileServiceListOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profiles][%d] deviceProfileServiceListOK %s", 200, payload) +} + +func (o *DeviceProfileServiceListOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profiles][%d] deviceProfileServiceListOK %s", 200, payload) +} + +func (o *DeviceProfileServiceListOK) GetPayload() *models.APIListDeviceProfilesResponse { + return o.Payload +} + +func (o *DeviceProfileServiceListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListDeviceProfilesResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceProfileServiceListDefault creates a DeviceProfileServiceListDefault with default headers values +func NewDeviceProfileServiceListDefault(code int) *DeviceProfileServiceListDefault { + return &DeviceProfileServiceListDefault{ + _statusCode: code, + } +} + +/* +DeviceProfileServiceListDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceProfileServiceListDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device profile service list default response has a 2xx status code +func (o *DeviceProfileServiceListDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device profile service list default response has a 3xx status code +func (o *DeviceProfileServiceListDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device profile service list default response has a 4xx status code +func (o *DeviceProfileServiceListDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device profile service list default response has a 5xx status code +func (o *DeviceProfileServiceListDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device profile service list default response a status code equal to that given +func (o *DeviceProfileServiceListDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device profile service list default response +func (o *DeviceProfileServiceListDefault) Code() int { + return o._statusCode +} + +func (o *DeviceProfileServiceListDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profiles][%d] DeviceProfileService_List default %s", o._statusCode, payload) +} + +func (o *DeviceProfileServiceListDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profiles][%d] DeviceProfileService_List default %s", o._statusCode, payload) +} + +func (o *DeviceProfileServiceListDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceProfileServiceListDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_update_parameters.go b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_update_parameters.go new file mode 100644 index 0000000..b4d0249 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_update_parameters.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceProfileServiceUpdateParams creates a new DeviceProfileServiceUpdateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceProfileServiceUpdateParams() *DeviceProfileServiceUpdateParams { + return &DeviceProfileServiceUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceProfileServiceUpdateParamsWithTimeout creates a new DeviceProfileServiceUpdateParams object +// with the ability to set a timeout on a request. +func NewDeviceProfileServiceUpdateParamsWithTimeout(timeout time.Duration) *DeviceProfileServiceUpdateParams { + return &DeviceProfileServiceUpdateParams{ + timeout: timeout, + } +} + +// NewDeviceProfileServiceUpdateParamsWithContext creates a new DeviceProfileServiceUpdateParams object +// with the ability to set a context for a request. +func NewDeviceProfileServiceUpdateParamsWithContext(ctx context.Context) *DeviceProfileServiceUpdateParams { + return &DeviceProfileServiceUpdateParams{ + Context: ctx, + } +} + +// NewDeviceProfileServiceUpdateParamsWithHTTPClient creates a new DeviceProfileServiceUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceProfileServiceUpdateParamsWithHTTPClient(client *http.Client) *DeviceProfileServiceUpdateParams { + return &DeviceProfileServiceUpdateParams{ + HTTPClient: client, + } +} + +/* +DeviceProfileServiceUpdateParams contains all the parameters to send to the API endpoint + + for the device profile service update operation. + + Typically these are written to a http.Request. +*/ +type DeviceProfileServiceUpdateParams struct { + + // Body. + Body DeviceProfileServiceUpdateBody + + /* DeviceProfileID. + + Device-profile ID (UUID). + Note: on create this will be automatically generated. + */ + DeviceProfileID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device profile service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileServiceUpdateParams) WithDefaults() *DeviceProfileServiceUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device profile service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileServiceUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device profile service update params +func (o *DeviceProfileServiceUpdateParams) WithTimeout(timeout time.Duration) *DeviceProfileServiceUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device profile service update params +func (o *DeviceProfileServiceUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device profile service update params +func (o *DeviceProfileServiceUpdateParams) WithContext(ctx context.Context) *DeviceProfileServiceUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device profile service update params +func (o *DeviceProfileServiceUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device profile service update params +func (o *DeviceProfileServiceUpdateParams) WithHTTPClient(client *http.Client) *DeviceProfileServiceUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device profile service update params +func (o *DeviceProfileServiceUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the device profile service update params +func (o *DeviceProfileServiceUpdateParams) WithBody(body DeviceProfileServiceUpdateBody) *DeviceProfileServiceUpdateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the device profile service update params +func (o *DeviceProfileServiceUpdateParams) SetBody(body DeviceProfileServiceUpdateBody) { + o.Body = body +} + +// WithDeviceProfileID adds the deviceProfileID to the device profile service update params +func (o *DeviceProfileServiceUpdateParams) WithDeviceProfileID(deviceProfileID string) *DeviceProfileServiceUpdateParams { + o.SetDeviceProfileID(deviceProfileID) + return o +} + +// SetDeviceProfileID adds the deviceProfileId to the device profile service update params +func (o *DeviceProfileServiceUpdateParams) SetDeviceProfileID(deviceProfileID string) { + o.DeviceProfileID = deviceProfileID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceProfileServiceUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param deviceProfile.id + if err := r.SetPathParam("deviceProfile.id", o.DeviceProfileID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_update_responses.go b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_update_responses.go new file mode 100644 index 0000000..59879e0 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_service/device_profile_service_update_responses.go @@ -0,0 +1,1040 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceProfileServiceUpdateReader is a Reader for the DeviceProfileServiceUpdate structure. +type DeviceProfileServiceUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceProfileServiceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceProfileServiceUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceProfileServiceUpdateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceProfileServiceUpdateOK creates a DeviceProfileServiceUpdateOK with default headers values +func NewDeviceProfileServiceUpdateOK() *DeviceProfileServiceUpdateOK { + return &DeviceProfileServiceUpdateOK{} +} + +/* +DeviceProfileServiceUpdateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceProfileServiceUpdateOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device profile service update o k response has a 2xx status code +func (o *DeviceProfileServiceUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device profile service update o k response has a 3xx status code +func (o *DeviceProfileServiceUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device profile service update o k response has a 4xx status code +func (o *DeviceProfileServiceUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device profile service update o k response has a 5xx status code +func (o *DeviceProfileServiceUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device profile service update o k response a status code equal to that given +func (o *DeviceProfileServiceUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device profile service update o k response +func (o *DeviceProfileServiceUpdateOK) Code() int { + return 200 +} + +func (o *DeviceProfileServiceUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/device-profiles/{deviceProfile.id}][%d] deviceProfileServiceUpdateOK %s", 200, payload) +} + +func (o *DeviceProfileServiceUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/device-profiles/{deviceProfile.id}][%d] deviceProfileServiceUpdateOK %s", 200, payload) +} + +func (o *DeviceProfileServiceUpdateOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceProfileServiceUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceProfileServiceUpdateDefault creates a DeviceProfileServiceUpdateDefault with default headers values +func NewDeviceProfileServiceUpdateDefault(code int) *DeviceProfileServiceUpdateDefault { + return &DeviceProfileServiceUpdateDefault{ + _statusCode: code, + } +} + +/* +DeviceProfileServiceUpdateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceProfileServiceUpdateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device profile service update default response has a 2xx status code +func (o *DeviceProfileServiceUpdateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device profile service update default response has a 3xx status code +func (o *DeviceProfileServiceUpdateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device profile service update default response has a 4xx status code +func (o *DeviceProfileServiceUpdateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device profile service update default response has a 5xx status code +func (o *DeviceProfileServiceUpdateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device profile service update default response a status code equal to that given +func (o *DeviceProfileServiceUpdateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device profile service update default response +func (o *DeviceProfileServiceUpdateDefault) Code() int { + return o._statusCode +} + +func (o *DeviceProfileServiceUpdateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/device-profiles/{deviceProfile.id}][%d] DeviceProfileService_Update default %s", o._statusCode, payload) +} + +func (o *DeviceProfileServiceUpdateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/device-profiles/{deviceProfile.id}][%d] DeviceProfileService_Update default %s", o._statusCode, payload) +} + +func (o *DeviceProfileServiceUpdateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceProfileServiceUpdateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +DeviceProfileServiceUpdateBody device profile service update body +swagger:model DeviceProfileServiceUpdateBody +*/ +type DeviceProfileServiceUpdateBody struct { + + // device profile + DeviceProfile *DeviceProfileServiceUpdateParamsBodyDeviceProfile `json:"deviceProfile,omitempty"` +} + +// Validate validates this device profile service update body +func (o *DeviceProfileServiceUpdateBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateDeviceProfile(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceProfileServiceUpdateBody) validateDeviceProfile(formats strfmt.Registry) error { + if swag.IsZero(o.DeviceProfile) { // not required + return nil + } + + if o.DeviceProfile != nil { + if err := o.DeviceProfile.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile") + } + return err + } + } + + return nil +} + +// ContextValidate validate this device profile service update body based on the context it is used +func (o *DeviceProfileServiceUpdateBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateDeviceProfile(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceProfileServiceUpdateBody) contextValidateDeviceProfile(ctx context.Context, formats strfmt.Registry) error { + + if o.DeviceProfile != nil { + + if swag.IsZero(o.DeviceProfile) { // not required + return nil + } + + if err := o.DeviceProfile.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceProfileServiceUpdateBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceProfileServiceUpdateBody) UnmarshalBinary(b []byte) error { + var res DeviceProfileServiceUpdateBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +DeviceProfileServiceUpdateParamsBodyDeviceProfile Device-profile object. +swagger:model DeviceProfileServiceUpdateParamsBodyDeviceProfile +*/ +type DeviceProfileServiceUpdateParamsBodyDeviceProfile struct { + + // RX1 delay (for ABP). + AbpRx1Delay int64 `json:"abpRx1Delay,omitempty"` + + // RX1 DR offset (for ABP). + AbpRx1DrOffset int64 `json:"abpRx1DrOffset,omitempty"` + + // RX2 DR (for ABP). + AbpRx2Dr int64 `json:"abpRx2Dr,omitempty"` + + // RX2 frequency (for ABP, Hz). + AbpRx2Freq int64 `json:"abpRx2Freq,omitempty"` + + // ADR algorithm ID. + AdrAlgorithmID string `json:"adrAlgorithmId,omitempty"` + + // Allow roaming. + // + // If set to true, it means that the device is allowed to use roaming. + AllowRoaming bool `json:"allowRoaming,omitempty"` + + // Application Layer parameters. + AppLayerParams *models.APIAppLayerParams `json:"appLayerParams,omitempty"` + + // Auto-detect measurements. + // If set to true, measurements will be automatically added based on the + // keys of the decoded payload. In cases where the decoded payload contains + // random keys in the data, you want to set this to false. + AutoDetectMeasurements bool `json:"autoDetectMeasurements,omitempty"` + + // Class-B ping-slot DR. + ClassBPingSlotDr int64 `json:"classBPingSlotDr,omitempty"` + + // Class-B ping-slot freq (Hz). + ClassBPingSlotFreq int64 `json:"classBPingSlotFreq,omitempty"` + + // Class-B ping-slot periodicity. + // Valid options are: 0 - 7. + // + // Number of ping-slots per beacon-period: + // pingNb = 2^(7-periodicity) + // + // Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec + // Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec + ClassBPingSlotPeriodicity int64 `json:"classBPingSlotPeriodicity,omitempty"` + + // Class-B timeout (seconds). + // This is the maximum time ChirpStack will wait to receive an acknowledgement + // from the device (if requested). + ClassBTimeout int64 `json:"classBTimeout,omitempty"` + + // Class-C timeout (seconds). + // This is the maximum time ChirpStack will wait to receive an acknowledgement + // from the device (if requested). + ClassCTimeout int64 `json:"classCTimeout,omitempty"` + + // Description. + Description string `json:"description,omitempty"` + + // Device-status request interval (times / day). + // This defines the times per day that ChirpStack will request the + // device-status from the device. + DeviceStatusReqInterval int64 `json:"deviceStatusReqInterval,omitempty"` + + // Flush queue on device activation. + FlushQueueOnActivate bool `json:"flushQueueOnActivate,omitempty"` + + // Device is a Relay device. + // Enable this in case the device is a Relay. A Relay device implements TS011 + // and is able to relay data from relay capable devices. + // See for more information the TS011 specification. + IsRelay bool `json:"isRelay,omitempty"` + + // Device is a Relay end-device. + // Enable this in case the device is an end-device that can operate under a + // Relay. Please refer to the TS011 specification for more information. + IsRelayEd bool `json:"isRelayEd,omitempty"` + + // LoRaWAN mac-version. + MacVersion *models.CommonMacVersion `json:"macVersion,omitempty"` + + // Measurements. + // If defined, ChirpStack will visualize these metrics in the web-interface. + Measurements map[string]models.APIMeasurement `json:"measurements,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Payload codec runtime. + PayloadCodecRuntime *models.APICodecRuntime `json:"payloadCodecRuntime,omitempty"` + + // Payload codec script. + PayloadCodecScript string `json:"payloadCodecScript,omitempty"` + + // Regional parameters revision. + RegParamsRevision *models.CommonRegParamsRevision `json:"regParamsRevision,omitempty"` + + // Region. + Region *models.CommonRegion `json:"region,omitempty"` + + // Region configuration ID. + // If set, devices will only use the associated region. If let blank, then + // devices will use all regions matching the selected common-name. Note + // that multiple region configurations can exist for the same common-name, + // e.g. to provide an 8 channel and 16 channel configuration for the US915 + // band. + RegionConfigID string `json:"regionConfigId,omitempty"` + + // Relay CAD periodicity. + RelayCadPeriodicity *models.APICadPeriodicity `json:"relayCadPeriodicity,omitempty"` + + // Relay default channel index. + // Valid values are 0 and 1, please refer to the RP002 specification for + // the meaning of these values. + RelayDefaultChannelIndex int64 `json:"relayDefaultChannelIndex,omitempty"` + + // Relay end-device activation mode. + RelayEdActivationMode *models.APIRelayModeActivation `json:"relayEdActivationMode,omitempty"` + + // Relay end-device back-off (in case it does not receive WOR ACK frame). + // 0 = Always send a LoRaWAN uplink + // 1..63 = Send a LoRaWAN uplink after X WOR frames without a WOR ACK + RelayEdBackOff int64 `json:"relayEdBackOff,omitempty"` + + // End-device only accept data through relay. + // Only accept data for this device through a relay. This setting is useful + // for testing as in case of a test-setup, the end-device is usually within + // range of the gateway. + RelayEdRelayOnly bool `json:"relayEdRelayOnly,omitempty"` + + // Relay end-device smart-enable level. + RelayEdSmartEnableLevel int64 `json:"relayEdSmartEnableLevel,omitempty"` + + // Relay end-device uplink limit bucket size. + // + // This field indicates the multiplier to determine the bucket size + // according to the following formula: + // BucketSize TOKEN = _reload_rate x _bucket_size + // + // Valid values (0 - 3): + // 0 = 1 + // 1 = 2 + // 2 = 4 + // 3 = 12 + RelayEdUplinkLimitBucketSize int64 `json:"relayEdUplinkLimitBucketSize,omitempty"` + + // Relay end-device uplink limit reload rate. + // + // Valid values: + // * 0 - 62 = X tokens every hour + // * 63 = no limitation + RelayEdUplinkLimitReloadRate int64 `json:"relayEdUplinkLimitReloadRate,omitempty"` + + // Relay must be enabled. + RelayEnabled bool `json:"relayEnabled,omitempty"` + + // Relay globak uplink limit bucket size. + // + // This field indicates the multiplier to determine the bucket size + // according to the following formula: + // BucketSize TOKEN = _reload_rate x _bucket_size + // + // Valid values (0 - 3): + // 0 = 1 + // 1 = 2 + // 2 = 4 + // 3 = 12 + RelayGlobalUplinkLimitBucketSize int64 `json:"relayGlobalUplinkLimitBucketSize,omitempty"` + + // Relay global uplink limit reload rate. + // + // Valid values: + // * 0 - 126 = X tokens every hour + // * 127 = no limitation + RelayGlobalUplinkLimitReloadRate int64 `json:"relayGlobalUplinkLimitReloadRate,omitempty"` + + // Relay join-request limit bucket size. + // + // This field indicates the multiplier to determine the bucket size + // according to the following formula: + // BucketSize TOKEN = _reload_rate x _bucket_size + // + // Valid values (0 - 3): + // 0 = 1 + // 1 = 2 + // 2 = 4 + // 3 = 12 + RelayJoinReqLimitBucketSize int64 `json:"relayJoinReqLimitBucketSize,omitempty"` + + // Relay join-request limit reload rate. + // + // Valid values: + // * 0 - 126 = X tokens every hour + // * 127 = no limitation + RelayJoinReqLimitReloadRate int64 `json:"relayJoinReqLimitReloadRate,omitempty"` + + // Relay notify limit bucket size. + // + // This field indicates the multiplier to determine the bucket size + // according to the following formula: + // BucketSize TOKEN = _reload_rate x _bucket_size + // + // Valid values (0 - 3): + // 0 = 1 + // 1 = 2 + // 2 = 4 + // 3 = 12 + RelayNotifyLimitBucketSize int64 `json:"relayNotifyLimitBucketSize,omitempty"` + + // Relay notify limit reload rate. + // + // Valid values: + // * 0 - 126 = X tokens every hour + // * 127 = no limitation + RelayNotifyLimitReloadRate int64 `json:"relayNotifyLimitReloadRate,omitempty"` + + // Relay overall limit bucket size. + // + // This field indicates the multiplier to determine the bucket size + // according to the following formula: + // BucketSize TOKEN = _reload_rate x _bucket_size + // + // Valid values (0 - 3): + // 0 = 1 + // 1 = 2 + // 2 = 4 + // 3 = 12 + RelayOverallLimitBucketSize int64 `json:"relayOverallLimitBucketSize,omitempty"` + + // Relay overall limit reload rate. + // + // Valid values: + // * 0 - 126 = X tokens every hour + // * 127 = no limitation + RelayOverallLimitReloadRate int64 `json:"relayOverallLimitReloadRate,omitempty"` + + // Relay second channel ACK offset. + RelaySecondChannelAckOffset *models.APISecondChAckOffset `json:"relaySecondChannelAckOffset,omitempty"` + + // Relay second channel DR. + RelaySecondChannelDr int64 `json:"relaySecondChannelDr,omitempty"` + + // Relay second channel frequency (Hz). + RelaySecondChannelFreq int64 `json:"relaySecondChannelFreq,omitempty"` + + // RX1 Delay. + // + // This makes it possible to override the system RX1 Delay. Please note that + // this values only has effect in case it is higher than the system value. + // In other words, it can be used to increase the RX1 Delay but not to decrease + // it. + // Valid options are 1 - 15 (0 = always use system RX1 Delay). + Rx1Delay int64 `json:"rx1Delay,omitempty"` + + // Supports Class B. + SupportsClassB bool `json:"supportsClassB,omitempty"` + + // Supports Class-C. + SupportsClassC bool `json:"supportsClassC,omitempty"` + + // Supports OTAA. + SupportsOtaa bool `json:"supportsOtaa,omitempty"` + + // Tags (user defined). + // These tags can be used to add additional information the the + // device-profile. These tags are exposed in all the integration events of + // devices using this device-profile. + Tags map[string]string `json:"tags,omitempty"` + + // Tenant ID (UUID). + TenantID string `json:"tenantId,omitempty"` + + // Uplink interval (seconds). + // This defines the expected uplink interval which the device uses for + // communication. If the uplink interval has expired and no uplink has + // been received, the device is considered inactive. + UplinkInterval int64 `json:"uplinkInterval,omitempty"` +} + +// Validate validates this device profile service update params body device profile +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateAppLayerParams(formats); err != nil { + res = append(res, err) + } + + if err := o.validateMacVersion(formats); err != nil { + res = append(res, err) + } + + if err := o.validateMeasurements(formats); err != nil { + res = append(res, err) + } + + if err := o.validatePayloadCodecRuntime(formats); err != nil { + res = append(res, err) + } + + if err := o.validateRegParamsRevision(formats); err != nil { + res = append(res, err) + } + + if err := o.validateRegion(formats); err != nil { + res = append(res, err) + } + + if err := o.validateRelayCadPeriodicity(formats); err != nil { + res = append(res, err) + } + + if err := o.validateRelayEdActivationMode(formats); err != nil { + res = append(res, err) + } + + if err := o.validateRelaySecondChannelAckOffset(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) validateAppLayerParams(formats strfmt.Registry) error { + if swag.IsZero(o.AppLayerParams) { // not required + return nil + } + + if o.AppLayerParams != nil { + if err := o.AppLayerParams.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "appLayerParams") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "appLayerParams") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) validateMacVersion(formats strfmt.Registry) error { + if swag.IsZero(o.MacVersion) { // not required + return nil + } + + if o.MacVersion != nil { + if err := o.MacVersion.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "macVersion") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "macVersion") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) validateMeasurements(formats strfmt.Registry) error { + if swag.IsZero(o.Measurements) { // not required + return nil + } + + for k := range o.Measurements { + + if err := validate.Required("body"+"."+"deviceProfile"+"."+"measurements"+"."+k, "body", o.Measurements[k]); err != nil { + return err + } + if val, ok := o.Measurements[k]; ok { + if err := val.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "measurements" + "." + k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "measurements" + "." + k) + } + return err + } + } + + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) validatePayloadCodecRuntime(formats strfmt.Registry) error { + if swag.IsZero(o.PayloadCodecRuntime) { // not required + return nil + } + + if o.PayloadCodecRuntime != nil { + if err := o.PayloadCodecRuntime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "payloadCodecRuntime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "payloadCodecRuntime") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) validateRegParamsRevision(formats strfmt.Registry) error { + if swag.IsZero(o.RegParamsRevision) { // not required + return nil + } + + if o.RegParamsRevision != nil { + if err := o.RegParamsRevision.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "regParamsRevision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "regParamsRevision") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) validateRegion(formats strfmt.Registry) error { + if swag.IsZero(o.Region) { // not required + return nil + } + + if o.Region != nil { + if err := o.Region.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "region") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) validateRelayCadPeriodicity(formats strfmt.Registry) error { + if swag.IsZero(o.RelayCadPeriodicity) { // not required + return nil + } + + if o.RelayCadPeriodicity != nil { + if err := o.RelayCadPeriodicity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "relayCadPeriodicity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "relayCadPeriodicity") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) validateRelayEdActivationMode(formats strfmt.Registry) error { + if swag.IsZero(o.RelayEdActivationMode) { // not required + return nil + } + + if o.RelayEdActivationMode != nil { + if err := o.RelayEdActivationMode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "relayEdActivationMode") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "relayEdActivationMode") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) validateRelaySecondChannelAckOffset(formats strfmt.Registry) error { + if swag.IsZero(o.RelaySecondChannelAckOffset) { // not required + return nil + } + + if o.RelaySecondChannelAckOffset != nil { + if err := o.RelaySecondChannelAckOffset.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "relaySecondChannelAckOffset") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "relaySecondChannelAckOffset") + } + return err + } + } + + return nil +} + +// ContextValidate validate this device profile service update params body device profile based on the context it is used +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateAppLayerParams(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateMacVersion(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateMeasurements(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidatePayloadCodecRuntime(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateRegParamsRevision(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateRegion(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateRelayCadPeriodicity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateRelayEdActivationMode(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateRelaySecondChannelAckOffset(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) contextValidateAppLayerParams(ctx context.Context, formats strfmt.Registry) error { + + if o.AppLayerParams != nil { + + if swag.IsZero(o.AppLayerParams) { // not required + return nil + } + + if err := o.AppLayerParams.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "appLayerParams") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "appLayerParams") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) contextValidateMacVersion(ctx context.Context, formats strfmt.Registry) error { + + if o.MacVersion != nil { + + if swag.IsZero(o.MacVersion) { // not required + return nil + } + + if err := o.MacVersion.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "macVersion") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "macVersion") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) contextValidateMeasurements(ctx context.Context, formats strfmt.Registry) error { + + for k := range o.Measurements { + + if val, ok := o.Measurements[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) contextValidatePayloadCodecRuntime(ctx context.Context, formats strfmt.Registry) error { + + if o.PayloadCodecRuntime != nil { + + if swag.IsZero(o.PayloadCodecRuntime) { // not required + return nil + } + + if err := o.PayloadCodecRuntime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "payloadCodecRuntime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "payloadCodecRuntime") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) contextValidateRegParamsRevision(ctx context.Context, formats strfmt.Registry) error { + + if o.RegParamsRevision != nil { + + if swag.IsZero(o.RegParamsRevision) { // not required + return nil + } + + if err := o.RegParamsRevision.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "regParamsRevision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "regParamsRevision") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error { + + if o.Region != nil { + + if swag.IsZero(o.Region) { // not required + return nil + } + + if err := o.Region.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "region") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) contextValidateRelayCadPeriodicity(ctx context.Context, formats strfmt.Registry) error { + + if o.RelayCadPeriodicity != nil { + + if swag.IsZero(o.RelayCadPeriodicity) { // not required + return nil + } + + if err := o.RelayCadPeriodicity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "relayCadPeriodicity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "relayCadPeriodicity") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) contextValidateRelayEdActivationMode(ctx context.Context, formats strfmt.Registry) error { + + if o.RelayEdActivationMode != nil { + + if swag.IsZero(o.RelayEdActivationMode) { // not required + return nil + } + + if err := o.RelayEdActivationMode.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "relayEdActivationMode") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "relayEdActivationMode") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) contextValidateRelaySecondChannelAckOffset(ctx context.Context, formats strfmt.Registry) error { + + if o.RelaySecondChannelAckOffset != nil { + + if swag.IsZero(o.RelaySecondChannelAckOffset) { // not required + return nil + } + + if err := o.RelaySecondChannelAckOffset.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfile" + "." + "relaySecondChannelAckOffset") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfile" + "." + "relaySecondChannelAckOffset") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceProfileServiceUpdateParamsBodyDeviceProfile) UnmarshalBinary(b []byte) error { + var res DeviceProfileServiceUpdateParamsBodyDeviceProfile + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_client.go b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_client.go new file mode 100644 index 0000000..74572cb --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_client.go @@ -0,0 +1,263 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_template_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new device profile template service API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new device profile template service API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new device profile template service API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for device profile template service API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeviceProfileTemplateServiceCreate(params *DeviceProfileTemplateServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileTemplateServiceCreateOK, error) + + DeviceProfileTemplateServiceDelete(params *DeviceProfileTemplateServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileTemplateServiceDeleteOK, error) + + DeviceProfileTemplateServiceGet(params *DeviceProfileTemplateServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileTemplateServiceGetOK, error) + + DeviceProfileTemplateServiceList(params *DeviceProfileTemplateServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileTemplateServiceListOK, error) + + DeviceProfileTemplateServiceUpdate(params *DeviceProfileTemplateServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileTemplateServiceUpdateOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeviceProfileTemplateServiceCreate creates the given device profile template +*/ +func (a *Client) DeviceProfileTemplateServiceCreate(params *DeviceProfileTemplateServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileTemplateServiceCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceProfileTemplateServiceCreateParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceProfileTemplateService_Create", + Method: "POST", + PathPattern: "/api/device-profile-templates", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceProfileTemplateServiceCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceProfileTemplateServiceCreateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceProfileTemplateServiceCreateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceProfileTemplateServiceDelete deletes the device profile template with the given ID +*/ +func (a *Client) DeviceProfileTemplateServiceDelete(params *DeviceProfileTemplateServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileTemplateServiceDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceProfileTemplateServiceDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceProfileTemplateService_Delete", + Method: "DELETE", + PathPattern: "/api/device-profile-templates/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceProfileTemplateServiceDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceProfileTemplateServiceDeleteOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceProfileTemplateServiceDeleteDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceProfileTemplateServiceGet gets the device profile template for the given ID +*/ +func (a *Client) DeviceProfileTemplateServiceGet(params *DeviceProfileTemplateServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileTemplateServiceGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceProfileTemplateServiceGetParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceProfileTemplateService_Get", + Method: "GET", + PathPattern: "/api/device-profile-templates/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceProfileTemplateServiceGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceProfileTemplateServiceGetOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceProfileTemplateServiceGetDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceProfileTemplateServiceList lists the available device profile templates +*/ +func (a *Client) DeviceProfileTemplateServiceList(params *DeviceProfileTemplateServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileTemplateServiceListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceProfileTemplateServiceListParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceProfileTemplateService_List", + Method: "GET", + PathPattern: "/api/device-profile-templates", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceProfileTemplateServiceListReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceProfileTemplateServiceListOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceProfileTemplateServiceListDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceProfileTemplateServiceUpdate updates the given device profile template +*/ +func (a *Client) DeviceProfileTemplateServiceUpdate(params *DeviceProfileTemplateServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileTemplateServiceUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceProfileTemplateServiceUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceProfileTemplateService_Update", + Method: "PUT", + PathPattern: "/api/device-profile-templates/{deviceProfileTemplate.id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceProfileTemplateServiceUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceProfileTemplateServiceUpdateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceProfileTemplateServiceUpdateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_create_parameters.go b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_create_parameters.go new file mode 100644 index 0000000..7a1ac4e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_create_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_template_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// NewDeviceProfileTemplateServiceCreateParams creates a new DeviceProfileTemplateServiceCreateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceProfileTemplateServiceCreateParams() *DeviceProfileTemplateServiceCreateParams { + return &DeviceProfileTemplateServiceCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceProfileTemplateServiceCreateParamsWithTimeout creates a new DeviceProfileTemplateServiceCreateParams object +// with the ability to set a timeout on a request. +func NewDeviceProfileTemplateServiceCreateParamsWithTimeout(timeout time.Duration) *DeviceProfileTemplateServiceCreateParams { + return &DeviceProfileTemplateServiceCreateParams{ + timeout: timeout, + } +} + +// NewDeviceProfileTemplateServiceCreateParamsWithContext creates a new DeviceProfileTemplateServiceCreateParams object +// with the ability to set a context for a request. +func NewDeviceProfileTemplateServiceCreateParamsWithContext(ctx context.Context) *DeviceProfileTemplateServiceCreateParams { + return &DeviceProfileTemplateServiceCreateParams{ + Context: ctx, + } +} + +// NewDeviceProfileTemplateServiceCreateParamsWithHTTPClient creates a new DeviceProfileTemplateServiceCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceProfileTemplateServiceCreateParamsWithHTTPClient(client *http.Client) *DeviceProfileTemplateServiceCreateParams { + return &DeviceProfileTemplateServiceCreateParams{ + HTTPClient: client, + } +} + +/* +DeviceProfileTemplateServiceCreateParams contains all the parameters to send to the API endpoint + + for the device profile template service create operation. + + Typically these are written to a http.Request. +*/ +type DeviceProfileTemplateServiceCreateParams struct { + + // Body. + Body *models.APICreateDeviceProfileTemplateRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device profile template service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileTemplateServiceCreateParams) WithDefaults() *DeviceProfileTemplateServiceCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device profile template service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileTemplateServiceCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device profile template service create params +func (o *DeviceProfileTemplateServiceCreateParams) WithTimeout(timeout time.Duration) *DeviceProfileTemplateServiceCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device profile template service create params +func (o *DeviceProfileTemplateServiceCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device profile template service create params +func (o *DeviceProfileTemplateServiceCreateParams) WithContext(ctx context.Context) *DeviceProfileTemplateServiceCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device profile template service create params +func (o *DeviceProfileTemplateServiceCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device profile template service create params +func (o *DeviceProfileTemplateServiceCreateParams) WithHTTPClient(client *http.Client) *DeviceProfileTemplateServiceCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device profile template service create params +func (o *DeviceProfileTemplateServiceCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the device profile template service create params +func (o *DeviceProfileTemplateServiceCreateParams) WithBody(body *models.APICreateDeviceProfileTemplateRequest) *DeviceProfileTemplateServiceCreateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the device profile template service create params +func (o *DeviceProfileTemplateServiceCreateParams) SetBody(body *models.APICreateDeviceProfileTemplateRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceProfileTemplateServiceCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_create_responses.go b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_create_responses.go new file mode 100644 index 0000000..3840400 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_create_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_template_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceProfileTemplateServiceCreateReader is a Reader for the DeviceProfileTemplateServiceCreate structure. +type DeviceProfileTemplateServiceCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceProfileTemplateServiceCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceProfileTemplateServiceCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceProfileTemplateServiceCreateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceProfileTemplateServiceCreateOK creates a DeviceProfileTemplateServiceCreateOK with default headers values +func NewDeviceProfileTemplateServiceCreateOK() *DeviceProfileTemplateServiceCreateOK { + return &DeviceProfileTemplateServiceCreateOK{} +} + +/* +DeviceProfileTemplateServiceCreateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceProfileTemplateServiceCreateOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device profile template service create o k response has a 2xx status code +func (o *DeviceProfileTemplateServiceCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device profile template service create o k response has a 3xx status code +func (o *DeviceProfileTemplateServiceCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device profile template service create o k response has a 4xx status code +func (o *DeviceProfileTemplateServiceCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device profile template service create o k response has a 5xx status code +func (o *DeviceProfileTemplateServiceCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device profile template service create o k response a status code equal to that given +func (o *DeviceProfileTemplateServiceCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device profile template service create o k response +func (o *DeviceProfileTemplateServiceCreateOK) Code() int { + return 200 +} + +func (o *DeviceProfileTemplateServiceCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/device-profile-templates][%d] deviceProfileTemplateServiceCreateOK %s", 200, payload) +} + +func (o *DeviceProfileTemplateServiceCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/device-profile-templates][%d] deviceProfileTemplateServiceCreateOK %s", 200, payload) +} + +func (o *DeviceProfileTemplateServiceCreateOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceProfileTemplateServiceCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceProfileTemplateServiceCreateDefault creates a DeviceProfileTemplateServiceCreateDefault with default headers values +func NewDeviceProfileTemplateServiceCreateDefault(code int) *DeviceProfileTemplateServiceCreateDefault { + return &DeviceProfileTemplateServiceCreateDefault{ + _statusCode: code, + } +} + +/* +DeviceProfileTemplateServiceCreateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceProfileTemplateServiceCreateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device profile template service create default response has a 2xx status code +func (o *DeviceProfileTemplateServiceCreateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device profile template service create default response has a 3xx status code +func (o *DeviceProfileTemplateServiceCreateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device profile template service create default response has a 4xx status code +func (o *DeviceProfileTemplateServiceCreateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device profile template service create default response has a 5xx status code +func (o *DeviceProfileTemplateServiceCreateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device profile template service create default response a status code equal to that given +func (o *DeviceProfileTemplateServiceCreateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device profile template service create default response +func (o *DeviceProfileTemplateServiceCreateDefault) Code() int { + return o._statusCode +} + +func (o *DeviceProfileTemplateServiceCreateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/device-profile-templates][%d] DeviceProfileTemplateService_Create default %s", o._statusCode, payload) +} + +func (o *DeviceProfileTemplateServiceCreateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/device-profile-templates][%d] DeviceProfileTemplateService_Create default %s", o._statusCode, payload) +} + +func (o *DeviceProfileTemplateServiceCreateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceProfileTemplateServiceCreateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_delete_parameters.go b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_delete_parameters.go new file mode 100644 index 0000000..0fbc341 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_template_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceProfileTemplateServiceDeleteParams creates a new DeviceProfileTemplateServiceDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceProfileTemplateServiceDeleteParams() *DeviceProfileTemplateServiceDeleteParams { + return &DeviceProfileTemplateServiceDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceProfileTemplateServiceDeleteParamsWithTimeout creates a new DeviceProfileTemplateServiceDeleteParams object +// with the ability to set a timeout on a request. +func NewDeviceProfileTemplateServiceDeleteParamsWithTimeout(timeout time.Duration) *DeviceProfileTemplateServiceDeleteParams { + return &DeviceProfileTemplateServiceDeleteParams{ + timeout: timeout, + } +} + +// NewDeviceProfileTemplateServiceDeleteParamsWithContext creates a new DeviceProfileTemplateServiceDeleteParams object +// with the ability to set a context for a request. +func NewDeviceProfileTemplateServiceDeleteParamsWithContext(ctx context.Context) *DeviceProfileTemplateServiceDeleteParams { + return &DeviceProfileTemplateServiceDeleteParams{ + Context: ctx, + } +} + +// NewDeviceProfileTemplateServiceDeleteParamsWithHTTPClient creates a new DeviceProfileTemplateServiceDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceProfileTemplateServiceDeleteParamsWithHTTPClient(client *http.Client) *DeviceProfileTemplateServiceDeleteParams { + return &DeviceProfileTemplateServiceDeleteParams{ + HTTPClient: client, + } +} + +/* +DeviceProfileTemplateServiceDeleteParams contains all the parameters to send to the API endpoint + + for the device profile template service delete operation. + + Typically these are written to a http.Request. +*/ +type DeviceProfileTemplateServiceDeleteParams struct { + + /* ID. + + ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device profile template service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileTemplateServiceDeleteParams) WithDefaults() *DeviceProfileTemplateServiceDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device profile template service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileTemplateServiceDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device profile template service delete params +func (o *DeviceProfileTemplateServiceDeleteParams) WithTimeout(timeout time.Duration) *DeviceProfileTemplateServiceDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device profile template service delete params +func (o *DeviceProfileTemplateServiceDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device profile template service delete params +func (o *DeviceProfileTemplateServiceDeleteParams) WithContext(ctx context.Context) *DeviceProfileTemplateServiceDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device profile template service delete params +func (o *DeviceProfileTemplateServiceDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device profile template service delete params +func (o *DeviceProfileTemplateServiceDeleteParams) WithHTTPClient(client *http.Client) *DeviceProfileTemplateServiceDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device profile template service delete params +func (o *DeviceProfileTemplateServiceDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the device profile template service delete params +func (o *DeviceProfileTemplateServiceDeleteParams) WithID(id string) *DeviceProfileTemplateServiceDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the device profile template service delete params +func (o *DeviceProfileTemplateServiceDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceProfileTemplateServiceDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_delete_responses.go b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_delete_responses.go new file mode 100644 index 0000000..bf09c0a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_delete_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_template_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceProfileTemplateServiceDeleteReader is a Reader for the DeviceProfileTemplateServiceDelete structure. +type DeviceProfileTemplateServiceDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceProfileTemplateServiceDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceProfileTemplateServiceDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceProfileTemplateServiceDeleteDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceProfileTemplateServiceDeleteOK creates a DeviceProfileTemplateServiceDeleteOK with default headers values +func NewDeviceProfileTemplateServiceDeleteOK() *DeviceProfileTemplateServiceDeleteOK { + return &DeviceProfileTemplateServiceDeleteOK{} +} + +/* +DeviceProfileTemplateServiceDeleteOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceProfileTemplateServiceDeleteOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device profile template service delete o k response has a 2xx status code +func (o *DeviceProfileTemplateServiceDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device profile template service delete o k response has a 3xx status code +func (o *DeviceProfileTemplateServiceDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device profile template service delete o k response has a 4xx status code +func (o *DeviceProfileTemplateServiceDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device profile template service delete o k response has a 5xx status code +func (o *DeviceProfileTemplateServiceDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device profile template service delete o k response a status code equal to that given +func (o *DeviceProfileTemplateServiceDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device profile template service delete o k response +func (o *DeviceProfileTemplateServiceDeleteOK) Code() int { + return 200 +} + +func (o *DeviceProfileTemplateServiceDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/device-profile-templates/{id}][%d] deviceProfileTemplateServiceDeleteOK %s", 200, payload) +} + +func (o *DeviceProfileTemplateServiceDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/device-profile-templates/{id}][%d] deviceProfileTemplateServiceDeleteOK %s", 200, payload) +} + +func (o *DeviceProfileTemplateServiceDeleteOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceProfileTemplateServiceDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceProfileTemplateServiceDeleteDefault creates a DeviceProfileTemplateServiceDeleteDefault with default headers values +func NewDeviceProfileTemplateServiceDeleteDefault(code int) *DeviceProfileTemplateServiceDeleteDefault { + return &DeviceProfileTemplateServiceDeleteDefault{ + _statusCode: code, + } +} + +/* +DeviceProfileTemplateServiceDeleteDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceProfileTemplateServiceDeleteDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device profile template service delete default response has a 2xx status code +func (o *DeviceProfileTemplateServiceDeleteDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device profile template service delete default response has a 3xx status code +func (o *DeviceProfileTemplateServiceDeleteDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device profile template service delete default response has a 4xx status code +func (o *DeviceProfileTemplateServiceDeleteDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device profile template service delete default response has a 5xx status code +func (o *DeviceProfileTemplateServiceDeleteDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device profile template service delete default response a status code equal to that given +func (o *DeviceProfileTemplateServiceDeleteDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device profile template service delete default response +func (o *DeviceProfileTemplateServiceDeleteDefault) Code() int { + return o._statusCode +} + +func (o *DeviceProfileTemplateServiceDeleteDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/device-profile-templates/{id}][%d] DeviceProfileTemplateService_Delete default %s", o._statusCode, payload) +} + +func (o *DeviceProfileTemplateServiceDeleteDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/device-profile-templates/{id}][%d] DeviceProfileTemplateService_Delete default %s", o._statusCode, payload) +} + +func (o *DeviceProfileTemplateServiceDeleteDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceProfileTemplateServiceDeleteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_get_parameters.go b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_get_parameters.go new file mode 100644 index 0000000..3fea515 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_template_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceProfileTemplateServiceGetParams creates a new DeviceProfileTemplateServiceGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceProfileTemplateServiceGetParams() *DeviceProfileTemplateServiceGetParams { + return &DeviceProfileTemplateServiceGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceProfileTemplateServiceGetParamsWithTimeout creates a new DeviceProfileTemplateServiceGetParams object +// with the ability to set a timeout on a request. +func NewDeviceProfileTemplateServiceGetParamsWithTimeout(timeout time.Duration) *DeviceProfileTemplateServiceGetParams { + return &DeviceProfileTemplateServiceGetParams{ + timeout: timeout, + } +} + +// NewDeviceProfileTemplateServiceGetParamsWithContext creates a new DeviceProfileTemplateServiceGetParams object +// with the ability to set a context for a request. +func NewDeviceProfileTemplateServiceGetParamsWithContext(ctx context.Context) *DeviceProfileTemplateServiceGetParams { + return &DeviceProfileTemplateServiceGetParams{ + Context: ctx, + } +} + +// NewDeviceProfileTemplateServiceGetParamsWithHTTPClient creates a new DeviceProfileTemplateServiceGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceProfileTemplateServiceGetParamsWithHTTPClient(client *http.Client) *DeviceProfileTemplateServiceGetParams { + return &DeviceProfileTemplateServiceGetParams{ + HTTPClient: client, + } +} + +/* +DeviceProfileTemplateServiceGetParams contains all the parameters to send to the API endpoint + + for the device profile template service get operation. + + Typically these are written to a http.Request. +*/ +type DeviceProfileTemplateServiceGetParams struct { + + /* ID. + + ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device profile template service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileTemplateServiceGetParams) WithDefaults() *DeviceProfileTemplateServiceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device profile template service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileTemplateServiceGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device profile template service get params +func (o *DeviceProfileTemplateServiceGetParams) WithTimeout(timeout time.Duration) *DeviceProfileTemplateServiceGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device profile template service get params +func (o *DeviceProfileTemplateServiceGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device profile template service get params +func (o *DeviceProfileTemplateServiceGetParams) WithContext(ctx context.Context) *DeviceProfileTemplateServiceGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device profile template service get params +func (o *DeviceProfileTemplateServiceGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device profile template service get params +func (o *DeviceProfileTemplateServiceGetParams) WithHTTPClient(client *http.Client) *DeviceProfileTemplateServiceGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device profile template service get params +func (o *DeviceProfileTemplateServiceGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the device profile template service get params +func (o *DeviceProfileTemplateServiceGetParams) WithID(id string) *DeviceProfileTemplateServiceGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the device profile template service get params +func (o *DeviceProfileTemplateServiceGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceProfileTemplateServiceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_get_responses.go b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_get_responses.go new file mode 100644 index 0000000..ca42b43 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_get_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_template_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceProfileTemplateServiceGetReader is a Reader for the DeviceProfileTemplateServiceGet structure. +type DeviceProfileTemplateServiceGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceProfileTemplateServiceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceProfileTemplateServiceGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceProfileTemplateServiceGetDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceProfileTemplateServiceGetOK creates a DeviceProfileTemplateServiceGetOK with default headers values +func NewDeviceProfileTemplateServiceGetOK() *DeviceProfileTemplateServiceGetOK { + return &DeviceProfileTemplateServiceGetOK{} +} + +/* +DeviceProfileTemplateServiceGetOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceProfileTemplateServiceGetOK struct { + Payload *models.APIGetDeviceProfileTemplateResponse +} + +// IsSuccess returns true when this device profile template service get o k response has a 2xx status code +func (o *DeviceProfileTemplateServiceGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device profile template service get o k response has a 3xx status code +func (o *DeviceProfileTemplateServiceGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device profile template service get o k response has a 4xx status code +func (o *DeviceProfileTemplateServiceGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device profile template service get o k response has a 5xx status code +func (o *DeviceProfileTemplateServiceGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device profile template service get o k response a status code equal to that given +func (o *DeviceProfileTemplateServiceGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device profile template service get o k response +func (o *DeviceProfileTemplateServiceGetOK) Code() int { + return 200 +} + +func (o *DeviceProfileTemplateServiceGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profile-templates/{id}][%d] deviceProfileTemplateServiceGetOK %s", 200, payload) +} + +func (o *DeviceProfileTemplateServiceGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profile-templates/{id}][%d] deviceProfileTemplateServiceGetOK %s", 200, payload) +} + +func (o *DeviceProfileTemplateServiceGetOK) GetPayload() *models.APIGetDeviceProfileTemplateResponse { + return o.Payload +} + +func (o *DeviceProfileTemplateServiceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetDeviceProfileTemplateResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceProfileTemplateServiceGetDefault creates a DeviceProfileTemplateServiceGetDefault with default headers values +func NewDeviceProfileTemplateServiceGetDefault(code int) *DeviceProfileTemplateServiceGetDefault { + return &DeviceProfileTemplateServiceGetDefault{ + _statusCode: code, + } +} + +/* +DeviceProfileTemplateServiceGetDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceProfileTemplateServiceGetDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device profile template service get default response has a 2xx status code +func (o *DeviceProfileTemplateServiceGetDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device profile template service get default response has a 3xx status code +func (o *DeviceProfileTemplateServiceGetDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device profile template service get default response has a 4xx status code +func (o *DeviceProfileTemplateServiceGetDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device profile template service get default response has a 5xx status code +func (o *DeviceProfileTemplateServiceGetDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device profile template service get default response a status code equal to that given +func (o *DeviceProfileTemplateServiceGetDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device profile template service get default response +func (o *DeviceProfileTemplateServiceGetDefault) Code() int { + return o._statusCode +} + +func (o *DeviceProfileTemplateServiceGetDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profile-templates/{id}][%d] DeviceProfileTemplateService_Get default %s", o._statusCode, payload) +} + +func (o *DeviceProfileTemplateServiceGetDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profile-templates/{id}][%d] DeviceProfileTemplateService_Get default %s", o._statusCode, payload) +} + +func (o *DeviceProfileTemplateServiceGetDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceProfileTemplateServiceGetDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_list_parameters.go b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_list_parameters.go new file mode 100644 index 0000000..687f6ca --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_list_parameters.go @@ -0,0 +1,203 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_template_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewDeviceProfileTemplateServiceListParams creates a new DeviceProfileTemplateServiceListParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceProfileTemplateServiceListParams() *DeviceProfileTemplateServiceListParams { + return &DeviceProfileTemplateServiceListParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceProfileTemplateServiceListParamsWithTimeout creates a new DeviceProfileTemplateServiceListParams object +// with the ability to set a timeout on a request. +func NewDeviceProfileTemplateServiceListParamsWithTimeout(timeout time.Duration) *DeviceProfileTemplateServiceListParams { + return &DeviceProfileTemplateServiceListParams{ + timeout: timeout, + } +} + +// NewDeviceProfileTemplateServiceListParamsWithContext creates a new DeviceProfileTemplateServiceListParams object +// with the ability to set a context for a request. +func NewDeviceProfileTemplateServiceListParamsWithContext(ctx context.Context) *DeviceProfileTemplateServiceListParams { + return &DeviceProfileTemplateServiceListParams{ + Context: ctx, + } +} + +// NewDeviceProfileTemplateServiceListParamsWithHTTPClient creates a new DeviceProfileTemplateServiceListParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceProfileTemplateServiceListParamsWithHTTPClient(client *http.Client) *DeviceProfileTemplateServiceListParams { + return &DeviceProfileTemplateServiceListParams{ + HTTPClient: client, + } +} + +/* +DeviceProfileTemplateServiceListParams contains all the parameters to send to the API endpoint + + for the device profile template service list operation. + + Typically these are written to a http.Request. +*/ +type DeviceProfileTemplateServiceListParams struct { + + /* Limit. + + Max number of device-profile templates to return in the result-set. + If not set, it will be treated as 0, and the response will only return the total_count. + + Format: int64 + */ + Limit *int64 + + /* Offset. + + Offset in the result-set (for pagination). + + Format: int64 + */ + Offset *int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device profile template service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileTemplateServiceListParams) WithDefaults() *DeviceProfileTemplateServiceListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device profile template service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileTemplateServiceListParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device profile template service list params +func (o *DeviceProfileTemplateServiceListParams) WithTimeout(timeout time.Duration) *DeviceProfileTemplateServiceListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device profile template service list params +func (o *DeviceProfileTemplateServiceListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device profile template service list params +func (o *DeviceProfileTemplateServiceListParams) WithContext(ctx context.Context) *DeviceProfileTemplateServiceListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device profile template service list params +func (o *DeviceProfileTemplateServiceListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device profile template service list params +func (o *DeviceProfileTemplateServiceListParams) WithHTTPClient(client *http.Client) *DeviceProfileTemplateServiceListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device profile template service list params +func (o *DeviceProfileTemplateServiceListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the device profile template service list params +func (o *DeviceProfileTemplateServiceListParams) WithLimit(limit *int64) *DeviceProfileTemplateServiceListParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the device profile template service list params +func (o *DeviceProfileTemplateServiceListParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithOffset adds the offset to the device profile template service list params +func (o *DeviceProfileTemplateServiceListParams) WithOffset(offset *int64) *DeviceProfileTemplateServiceListParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the device profile template service list params +func (o *DeviceProfileTemplateServiceListParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceProfileTemplateServiceListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Limit != nil { + + // query param limit + var qrLimit int64 + + if o.Limit != nil { + qrLimit = *o.Limit + } + qLimit := swag.FormatInt64(qrLimit) + if qLimit != "" { + + if err := r.SetQueryParam("limit", qLimit); err != nil { + return err + } + } + } + + if o.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_list_responses.go b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_list_responses.go new file mode 100644 index 0000000..1c6378a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_list_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_template_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceProfileTemplateServiceListReader is a Reader for the DeviceProfileTemplateServiceList structure. +type DeviceProfileTemplateServiceListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceProfileTemplateServiceListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceProfileTemplateServiceListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceProfileTemplateServiceListDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceProfileTemplateServiceListOK creates a DeviceProfileTemplateServiceListOK with default headers values +func NewDeviceProfileTemplateServiceListOK() *DeviceProfileTemplateServiceListOK { + return &DeviceProfileTemplateServiceListOK{} +} + +/* +DeviceProfileTemplateServiceListOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceProfileTemplateServiceListOK struct { + Payload *models.APIListDeviceProfileTemplatesResponse +} + +// IsSuccess returns true when this device profile template service list o k response has a 2xx status code +func (o *DeviceProfileTemplateServiceListOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device profile template service list o k response has a 3xx status code +func (o *DeviceProfileTemplateServiceListOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device profile template service list o k response has a 4xx status code +func (o *DeviceProfileTemplateServiceListOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device profile template service list o k response has a 5xx status code +func (o *DeviceProfileTemplateServiceListOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device profile template service list o k response a status code equal to that given +func (o *DeviceProfileTemplateServiceListOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device profile template service list o k response +func (o *DeviceProfileTemplateServiceListOK) Code() int { + return 200 +} + +func (o *DeviceProfileTemplateServiceListOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profile-templates][%d] deviceProfileTemplateServiceListOK %s", 200, payload) +} + +func (o *DeviceProfileTemplateServiceListOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profile-templates][%d] deviceProfileTemplateServiceListOK %s", 200, payload) +} + +func (o *DeviceProfileTemplateServiceListOK) GetPayload() *models.APIListDeviceProfileTemplatesResponse { + return o.Payload +} + +func (o *DeviceProfileTemplateServiceListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListDeviceProfileTemplatesResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceProfileTemplateServiceListDefault creates a DeviceProfileTemplateServiceListDefault with default headers values +func NewDeviceProfileTemplateServiceListDefault(code int) *DeviceProfileTemplateServiceListDefault { + return &DeviceProfileTemplateServiceListDefault{ + _statusCode: code, + } +} + +/* +DeviceProfileTemplateServiceListDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceProfileTemplateServiceListDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device profile template service list default response has a 2xx status code +func (o *DeviceProfileTemplateServiceListDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device profile template service list default response has a 3xx status code +func (o *DeviceProfileTemplateServiceListDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device profile template service list default response has a 4xx status code +func (o *DeviceProfileTemplateServiceListDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device profile template service list default response has a 5xx status code +func (o *DeviceProfileTemplateServiceListDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device profile template service list default response a status code equal to that given +func (o *DeviceProfileTemplateServiceListDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device profile template service list default response +func (o *DeviceProfileTemplateServiceListDefault) Code() int { + return o._statusCode +} + +func (o *DeviceProfileTemplateServiceListDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profile-templates][%d] DeviceProfileTemplateService_List default %s", o._statusCode, payload) +} + +func (o *DeviceProfileTemplateServiceListDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/device-profile-templates][%d] DeviceProfileTemplateService_List default %s", o._statusCode, payload) +} + +func (o *DeviceProfileTemplateServiceListDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceProfileTemplateServiceListDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_update_parameters.go b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_update_parameters.go new file mode 100644 index 0000000..cb10db7 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_update_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_template_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceProfileTemplateServiceUpdateParams creates a new DeviceProfileTemplateServiceUpdateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceProfileTemplateServiceUpdateParams() *DeviceProfileTemplateServiceUpdateParams { + return &DeviceProfileTemplateServiceUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceProfileTemplateServiceUpdateParamsWithTimeout creates a new DeviceProfileTemplateServiceUpdateParams object +// with the ability to set a timeout on a request. +func NewDeviceProfileTemplateServiceUpdateParamsWithTimeout(timeout time.Duration) *DeviceProfileTemplateServiceUpdateParams { + return &DeviceProfileTemplateServiceUpdateParams{ + timeout: timeout, + } +} + +// NewDeviceProfileTemplateServiceUpdateParamsWithContext creates a new DeviceProfileTemplateServiceUpdateParams object +// with the ability to set a context for a request. +func NewDeviceProfileTemplateServiceUpdateParamsWithContext(ctx context.Context) *DeviceProfileTemplateServiceUpdateParams { + return &DeviceProfileTemplateServiceUpdateParams{ + Context: ctx, + } +} + +// NewDeviceProfileTemplateServiceUpdateParamsWithHTTPClient creates a new DeviceProfileTemplateServiceUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceProfileTemplateServiceUpdateParamsWithHTTPClient(client *http.Client) *DeviceProfileTemplateServiceUpdateParams { + return &DeviceProfileTemplateServiceUpdateParams{ + HTTPClient: client, + } +} + +/* +DeviceProfileTemplateServiceUpdateParams contains all the parameters to send to the API endpoint + + for the device profile template service update operation. + + Typically these are written to a http.Request. +*/ +type DeviceProfileTemplateServiceUpdateParams struct { + + // Body. + Body DeviceProfileTemplateServiceUpdateBody + + /* DeviceProfileTemplateID. + + Device-profile template ID. + */ + DeviceProfileTemplateID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device profile template service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileTemplateServiceUpdateParams) WithDefaults() *DeviceProfileTemplateServiceUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device profile template service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceProfileTemplateServiceUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device profile template service update params +func (o *DeviceProfileTemplateServiceUpdateParams) WithTimeout(timeout time.Duration) *DeviceProfileTemplateServiceUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device profile template service update params +func (o *DeviceProfileTemplateServiceUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device profile template service update params +func (o *DeviceProfileTemplateServiceUpdateParams) WithContext(ctx context.Context) *DeviceProfileTemplateServiceUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device profile template service update params +func (o *DeviceProfileTemplateServiceUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device profile template service update params +func (o *DeviceProfileTemplateServiceUpdateParams) WithHTTPClient(client *http.Client) *DeviceProfileTemplateServiceUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device profile template service update params +func (o *DeviceProfileTemplateServiceUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the device profile template service update params +func (o *DeviceProfileTemplateServiceUpdateParams) WithBody(body DeviceProfileTemplateServiceUpdateBody) *DeviceProfileTemplateServiceUpdateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the device profile template service update params +func (o *DeviceProfileTemplateServiceUpdateParams) SetBody(body DeviceProfileTemplateServiceUpdateBody) { + o.Body = body +} + +// WithDeviceProfileTemplateID adds the deviceProfileTemplateID to the device profile template service update params +func (o *DeviceProfileTemplateServiceUpdateParams) WithDeviceProfileTemplateID(deviceProfileTemplateID string) *DeviceProfileTemplateServiceUpdateParams { + o.SetDeviceProfileTemplateID(deviceProfileTemplateID) + return o +} + +// SetDeviceProfileTemplateID adds the deviceProfileTemplateId to the device profile template service update params +func (o *DeviceProfileTemplateServiceUpdateParams) SetDeviceProfileTemplateID(deviceProfileTemplateID string) { + o.DeviceProfileTemplateID = deviceProfileTemplateID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceProfileTemplateServiceUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param deviceProfileTemplate.id + if err := r.SetPathParam("deviceProfileTemplate.id", o.DeviceProfileTemplateID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_update_responses.go b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_update_responses.go new file mode 100644 index 0000000..16be0dc --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_profile_template_service/device_profile_template_service_update_responses.go @@ -0,0 +1,673 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_profile_template_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceProfileTemplateServiceUpdateReader is a Reader for the DeviceProfileTemplateServiceUpdate structure. +type DeviceProfileTemplateServiceUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceProfileTemplateServiceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceProfileTemplateServiceUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceProfileTemplateServiceUpdateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceProfileTemplateServiceUpdateOK creates a DeviceProfileTemplateServiceUpdateOK with default headers values +func NewDeviceProfileTemplateServiceUpdateOK() *DeviceProfileTemplateServiceUpdateOK { + return &DeviceProfileTemplateServiceUpdateOK{} +} + +/* +DeviceProfileTemplateServiceUpdateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceProfileTemplateServiceUpdateOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device profile template service update o k response has a 2xx status code +func (o *DeviceProfileTemplateServiceUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device profile template service update o k response has a 3xx status code +func (o *DeviceProfileTemplateServiceUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device profile template service update o k response has a 4xx status code +func (o *DeviceProfileTemplateServiceUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device profile template service update o k response has a 5xx status code +func (o *DeviceProfileTemplateServiceUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device profile template service update o k response a status code equal to that given +func (o *DeviceProfileTemplateServiceUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device profile template service update o k response +func (o *DeviceProfileTemplateServiceUpdateOK) Code() int { + return 200 +} + +func (o *DeviceProfileTemplateServiceUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/device-profile-templates/{deviceProfileTemplate.id}][%d] deviceProfileTemplateServiceUpdateOK %s", 200, payload) +} + +func (o *DeviceProfileTemplateServiceUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/device-profile-templates/{deviceProfileTemplate.id}][%d] deviceProfileTemplateServiceUpdateOK %s", 200, payload) +} + +func (o *DeviceProfileTemplateServiceUpdateOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceProfileTemplateServiceUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceProfileTemplateServiceUpdateDefault creates a DeviceProfileTemplateServiceUpdateDefault with default headers values +func NewDeviceProfileTemplateServiceUpdateDefault(code int) *DeviceProfileTemplateServiceUpdateDefault { + return &DeviceProfileTemplateServiceUpdateDefault{ + _statusCode: code, + } +} + +/* +DeviceProfileTemplateServiceUpdateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceProfileTemplateServiceUpdateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device profile template service update default response has a 2xx status code +func (o *DeviceProfileTemplateServiceUpdateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device profile template service update default response has a 3xx status code +func (o *DeviceProfileTemplateServiceUpdateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device profile template service update default response has a 4xx status code +func (o *DeviceProfileTemplateServiceUpdateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device profile template service update default response has a 5xx status code +func (o *DeviceProfileTemplateServiceUpdateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device profile template service update default response a status code equal to that given +func (o *DeviceProfileTemplateServiceUpdateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device profile template service update default response +func (o *DeviceProfileTemplateServiceUpdateDefault) Code() int { + return o._statusCode +} + +func (o *DeviceProfileTemplateServiceUpdateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/device-profile-templates/{deviceProfileTemplate.id}][%d] DeviceProfileTemplateService_Update default %s", o._statusCode, payload) +} + +func (o *DeviceProfileTemplateServiceUpdateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/device-profile-templates/{deviceProfileTemplate.id}][%d] DeviceProfileTemplateService_Update default %s", o._statusCode, payload) +} + +func (o *DeviceProfileTemplateServiceUpdateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceProfileTemplateServiceUpdateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +DeviceProfileTemplateServiceUpdateBody device profile template service update body +swagger:model DeviceProfileTemplateServiceUpdateBody +*/ +type DeviceProfileTemplateServiceUpdateBody struct { + + // device profile template + DeviceProfileTemplate *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate `json:"deviceProfileTemplate,omitempty"` +} + +// Validate validates this device profile template service update body +func (o *DeviceProfileTemplateServiceUpdateBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateDeviceProfileTemplate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceProfileTemplateServiceUpdateBody) validateDeviceProfileTemplate(formats strfmt.Registry) error { + if swag.IsZero(o.DeviceProfileTemplate) { // not required + return nil + } + + if o.DeviceProfileTemplate != nil { + if err := o.DeviceProfileTemplate.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfileTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfileTemplate") + } + return err + } + } + + return nil +} + +// ContextValidate validate this device profile template service update body based on the context it is used +func (o *DeviceProfileTemplateServiceUpdateBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateDeviceProfileTemplate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceProfileTemplateServiceUpdateBody) contextValidateDeviceProfileTemplate(ctx context.Context, formats strfmt.Registry) error { + + if o.DeviceProfileTemplate != nil { + + if swag.IsZero(o.DeviceProfileTemplate) { // not required + return nil + } + + if err := o.DeviceProfileTemplate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfileTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfileTemplate") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceProfileTemplateServiceUpdateBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceProfileTemplateServiceUpdateBody) UnmarshalBinary(b []byte) error { + var res DeviceProfileTemplateServiceUpdateBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate Object to update. +swagger:model DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate +*/ +type DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate struct { + + // RX1 delay (for ABP). + AbpRx1Delay int64 `json:"abpRx1Delay,omitempty"` + + // RX1 DR offset (for ABP). + AbpRx1DrOffset int64 `json:"abpRx1DrOffset,omitempty"` + + // RX2 DR (for ABP). + AbpRx2Dr int64 `json:"abpRx2Dr,omitempty"` + + // RX2 frequency (for ABP, Hz). + AbpRx2Freq int64 `json:"abpRx2Freq,omitempty"` + + // ADR algorithm ID. + AdrAlgorithmID string `json:"adrAlgorithmId,omitempty"` + + // Auto-detect measurements. + // If set to true, measurements will be automatically added based on the + // keys of the decoded payload. In cases where the decoded payload contains + // random keys in the data, you want to set this to false. + AutoDetectMeasurements bool `json:"autoDetectMeasurements,omitempty"` + + // Class-B ping-slot DR. + ClassBPingSlotDr int64 `json:"classBPingSlotDr,omitempty"` + + // Class-B ping-slot freq (Hz). + ClassBPingSlotFreq int64 `json:"classBPingSlotFreq,omitempty"` + + // Class-B ping-slot periodicity (only for Class-B). + // Valid options are: 0 - 7. + // + // Number of ping-slots per beacon-period: + // pingNb = 2^(7-periodicity) + // + // Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec + // Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec + ClassBPingSlotPeriodicity int64 `json:"classBPingSlotPeriodicity,omitempty"` + + // Class-B timeout (seconds). + // This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested). + ClassBTimeout int64 `json:"classBTimeout,omitempty"` + + // Class-C timeout (seconds). + // This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested). + ClassCTimeout int64 `json:"classCTimeout,omitempty"` + + // Description. + Description string `json:"description,omitempty"` + + // Device-status request interval (times / day). + // This defines the times per day that ChirpStack will request the device-status + // from the device. + DeviceStatusReqInterval int64 `json:"deviceStatusReqInterval,omitempty"` + + // Firmware. + Firmware string `json:"firmware,omitempty"` + + // Flush queue on device activation. + FlushQueueOnActivate bool `json:"flushQueueOnActivate,omitempty"` + + // LoRaWAN mac-version. + MacVersion *models.CommonMacVersion `json:"macVersion,omitempty"` + + // Measurements. + // If defined, ChirpStack will visualize these metrics in the web-interface. + Measurements map[string]models.APIMeasurement `json:"measurements,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Payload codec runtime. + PayloadCodecRuntime *models.APICodecRuntime `json:"payloadCodecRuntime,omitempty"` + + // Payload codec script. + PayloadCodecScript string `json:"payloadCodecScript,omitempty"` + + // Regional parameters revision. + RegParamsRevision *models.CommonRegParamsRevision `json:"regParamsRevision,omitempty"` + + // Region. + Region *models.CommonRegion `json:"region,omitempty"` + + // Supports Class B. + SupportsClassB bool `json:"supportsClassB,omitempty"` + + // Supports Class-C. + SupportsClassC bool `json:"supportsClassC,omitempty"` + + // Supports OTAA. + SupportsOtaa bool `json:"supportsOtaa,omitempty"` + + // User defined tags. + Tags map[string]string `json:"tags,omitempty"` + + // Uplink interval (seconds). + // This defines the expected uplink interval which the device uses for + // communication. When the uplink interval has expired and no uplink has + // been received, the device is considered inactive. + UplinkInterval int64 `json:"uplinkInterval,omitempty"` + + // Vendor. + Vendor string `json:"vendor,omitempty"` +} + +// Validate validates this device profile template service update params body device profile template +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateMacVersion(formats); err != nil { + res = append(res, err) + } + + if err := o.validateMeasurements(formats); err != nil { + res = append(res, err) + } + + if err := o.validatePayloadCodecRuntime(formats); err != nil { + res = append(res, err) + } + + if err := o.validateRegParamsRevision(formats); err != nil { + res = append(res, err) + } + + if err := o.validateRegion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) validateMacVersion(formats strfmt.Registry) error { + if swag.IsZero(o.MacVersion) { // not required + return nil + } + + if o.MacVersion != nil { + if err := o.MacVersion.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "macVersion") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "macVersion") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) validateMeasurements(formats strfmt.Registry) error { + if swag.IsZero(o.Measurements) { // not required + return nil + } + + for k := range o.Measurements { + + if err := validate.Required("body"+"."+"deviceProfileTemplate"+"."+"measurements"+"."+k, "body", o.Measurements[k]); err != nil { + return err + } + if val, ok := o.Measurements[k]; ok { + if err := val.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "measurements" + "." + k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "measurements" + "." + k) + } + return err + } + } + + } + + return nil +} + +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) validatePayloadCodecRuntime(formats strfmt.Registry) error { + if swag.IsZero(o.PayloadCodecRuntime) { // not required + return nil + } + + if o.PayloadCodecRuntime != nil { + if err := o.PayloadCodecRuntime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "payloadCodecRuntime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "payloadCodecRuntime") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) validateRegParamsRevision(formats strfmt.Registry) error { + if swag.IsZero(o.RegParamsRevision) { // not required + return nil + } + + if o.RegParamsRevision != nil { + if err := o.RegParamsRevision.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "regParamsRevision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "regParamsRevision") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) validateRegion(formats strfmt.Registry) error { + if swag.IsZero(o.Region) { // not required + return nil + } + + if o.Region != nil { + if err := o.Region.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "region") + } + return err + } + } + + return nil +} + +// ContextValidate validate this device profile template service update params body device profile template based on the context it is used +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateMacVersion(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateMeasurements(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidatePayloadCodecRuntime(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateRegParamsRevision(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateRegion(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) contextValidateMacVersion(ctx context.Context, formats strfmt.Registry) error { + + if o.MacVersion != nil { + + if swag.IsZero(o.MacVersion) { // not required + return nil + } + + if err := o.MacVersion.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "macVersion") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "macVersion") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) contextValidateMeasurements(ctx context.Context, formats strfmt.Registry) error { + + for k := range o.Measurements { + + if val, ok := o.Measurements[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + return nil +} + +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) contextValidatePayloadCodecRuntime(ctx context.Context, formats strfmt.Registry) error { + + if o.PayloadCodecRuntime != nil { + + if swag.IsZero(o.PayloadCodecRuntime) { // not required + return nil + } + + if err := o.PayloadCodecRuntime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "payloadCodecRuntime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "payloadCodecRuntime") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) contextValidateRegParamsRevision(ctx context.Context, formats strfmt.Registry) error { + + if o.RegParamsRevision != nil { + + if swag.IsZero(o.RegParamsRevision) { // not required + return nil + } + + if err := o.RegParamsRevision.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "regParamsRevision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "regParamsRevision") + } + return err + } + } + + return nil +} + +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error { + + if o.Region != nil { + + if swag.IsZero(o.Region) { // not required + return nil + } + + if err := o.Region.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceProfileTemplate" + "." + "region") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate) UnmarshalBinary(b []byte) error { + var res DeviceProfileTemplateServiceUpdateParamsBodyDeviceProfileTemplate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_activate_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_activate_parameters.go new file mode 100644 index 0000000..5ce034b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_activate_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceActivateParams creates a new DeviceServiceActivateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceActivateParams() *DeviceServiceActivateParams { + return &DeviceServiceActivateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceActivateParamsWithTimeout creates a new DeviceServiceActivateParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceActivateParamsWithTimeout(timeout time.Duration) *DeviceServiceActivateParams { + return &DeviceServiceActivateParams{ + timeout: timeout, + } +} + +// NewDeviceServiceActivateParamsWithContext creates a new DeviceServiceActivateParams object +// with the ability to set a context for a request. +func NewDeviceServiceActivateParamsWithContext(ctx context.Context) *DeviceServiceActivateParams { + return &DeviceServiceActivateParams{ + Context: ctx, + } +} + +// NewDeviceServiceActivateParamsWithHTTPClient creates a new DeviceServiceActivateParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceActivateParamsWithHTTPClient(client *http.Client) *DeviceServiceActivateParams { + return &DeviceServiceActivateParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceActivateParams contains all the parameters to send to the API endpoint + + for the device service activate operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceActivateParams struct { + + // Body. + Body DeviceServiceActivateBody + + /* DeviceActivationDevEui. + + Device EUI (EUI64). + */ + DeviceActivationDevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service activate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceActivateParams) WithDefaults() *DeviceServiceActivateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service activate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceActivateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service activate params +func (o *DeviceServiceActivateParams) WithTimeout(timeout time.Duration) *DeviceServiceActivateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service activate params +func (o *DeviceServiceActivateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service activate params +func (o *DeviceServiceActivateParams) WithContext(ctx context.Context) *DeviceServiceActivateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service activate params +func (o *DeviceServiceActivateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service activate params +func (o *DeviceServiceActivateParams) WithHTTPClient(client *http.Client) *DeviceServiceActivateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service activate params +func (o *DeviceServiceActivateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the device service activate params +func (o *DeviceServiceActivateParams) WithBody(body DeviceServiceActivateBody) *DeviceServiceActivateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the device service activate params +func (o *DeviceServiceActivateParams) SetBody(body DeviceServiceActivateBody) { + o.Body = body +} + +// WithDeviceActivationDevEui adds the deviceActivationDevEui to the device service activate params +func (o *DeviceServiceActivateParams) WithDeviceActivationDevEui(deviceActivationDevEui string) *DeviceServiceActivateParams { + o.SetDeviceActivationDevEui(deviceActivationDevEui) + return o +} + +// SetDeviceActivationDevEui adds the deviceActivationDevEui to the device service activate params +func (o *DeviceServiceActivateParams) SetDeviceActivationDevEui(deviceActivationDevEui string) { + o.DeviceActivationDevEui = deviceActivationDevEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceActivateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param deviceActivation.devEui + if err := r.SetPathParam("deviceActivation.devEui", o.DeviceActivationDevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_activate_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_activate_responses.go new file mode 100644 index 0000000..00edd64 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_activate_responses.go @@ -0,0 +1,346 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceActivateReader is a Reader for the DeviceServiceActivate structure. +type DeviceServiceActivateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceActivateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceActivateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceActivateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceActivateOK creates a DeviceServiceActivateOK with default headers values +func NewDeviceServiceActivateOK() *DeviceServiceActivateOK { + return &DeviceServiceActivateOK{} +} + +/* +DeviceServiceActivateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceActivateOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device service activate o k response has a 2xx status code +func (o *DeviceServiceActivateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service activate o k response has a 3xx status code +func (o *DeviceServiceActivateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service activate o k response has a 4xx status code +func (o *DeviceServiceActivateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service activate o k response has a 5xx status code +func (o *DeviceServiceActivateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service activate o k response a status code equal to that given +func (o *DeviceServiceActivateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service activate o k response +func (o *DeviceServiceActivateOK) Code() int { + return 200 +} + +func (o *DeviceServiceActivateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{deviceActivation.devEui}/activate][%d] deviceServiceActivateOK %s", 200, payload) +} + +func (o *DeviceServiceActivateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{deviceActivation.devEui}/activate][%d] deviceServiceActivateOK %s", 200, payload) +} + +func (o *DeviceServiceActivateOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceServiceActivateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceActivateDefault creates a DeviceServiceActivateDefault with default headers values +func NewDeviceServiceActivateDefault(code int) *DeviceServiceActivateDefault { + return &DeviceServiceActivateDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceActivateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceActivateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service activate default response has a 2xx status code +func (o *DeviceServiceActivateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service activate default response has a 3xx status code +func (o *DeviceServiceActivateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service activate default response has a 4xx status code +func (o *DeviceServiceActivateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service activate default response has a 5xx status code +func (o *DeviceServiceActivateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service activate default response a status code equal to that given +func (o *DeviceServiceActivateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service activate default response +func (o *DeviceServiceActivateDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceActivateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{deviceActivation.devEui}/activate][%d] DeviceService_Activate default %s", o._statusCode, payload) +} + +func (o *DeviceServiceActivateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{deviceActivation.devEui}/activate][%d] DeviceService_Activate default %s", o._statusCode, payload) +} + +func (o *DeviceServiceActivateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceActivateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +DeviceServiceActivateBody device service activate body +swagger:model DeviceServiceActivateBody +*/ +type DeviceServiceActivateBody struct { + + // device activation + DeviceActivation *DeviceServiceActivateParamsBodyDeviceActivation `json:"deviceActivation,omitempty"` +} + +// Validate validates this device service activate body +func (o *DeviceServiceActivateBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateDeviceActivation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceServiceActivateBody) validateDeviceActivation(formats strfmt.Registry) error { + if swag.IsZero(o.DeviceActivation) { // not required + return nil + } + + if o.DeviceActivation != nil { + if err := o.DeviceActivation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceActivation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceActivation") + } + return err + } + } + + return nil +} + +// ContextValidate validate this device service activate body based on the context it is used +func (o *DeviceServiceActivateBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateDeviceActivation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceServiceActivateBody) contextValidateDeviceActivation(ctx context.Context, formats strfmt.Registry) error { + + if o.DeviceActivation != nil { + + if swag.IsZero(o.DeviceActivation) { // not required + return nil + } + + if err := o.DeviceActivation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceActivation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceActivation") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceServiceActivateBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceServiceActivateBody) UnmarshalBinary(b []byte) error { + var res DeviceServiceActivateBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +DeviceServiceActivateParamsBodyDeviceActivation Device activation object. +swagger:model DeviceServiceActivateParamsBodyDeviceActivation +*/ +type DeviceServiceActivateParamsBodyDeviceActivation struct { + + // Downlink application frame-counter. + AFCntDown int64 `json:"aFCntDown,omitempty"` + + // Application session key (HEX encoded). + AppSKey string `json:"appSKey,omitempty"` + + // Device address (HEX encoded). + DevAddr string `json:"devAddr,omitempty"` + + // Uplink frame-counter. + FCntUp int64 `json:"fCntUp,omitempty"` + + // Forwarding network session integrity key (HEX encoded). + // Note: For LoRaWAN 1.0.x devices, set this to the NwkSKey. + FNwkSIntKey string `json:"fNwkSIntKey,omitempty"` + + // Downlink network frame-counter. + NFCntDown int64 `json:"nFCntDown,omitempty"` + + // Network session encryption key (HEX encoded). + // Note: For LoRaWAN 1.0.x devices, set this to the NwkSKey. + NwkSEncKey string `json:"nwkSEncKey,omitempty"` + + // Serving network session integrity key (HEX encoded). + // Note: For LoRaWAN 1.0.x devices, set this to the NwkSKey. + SNwkSIntKey string `json:"sNwkSIntKey,omitempty"` +} + +// Validate validates this device service activate params body device activation +func (o *DeviceServiceActivateParamsBodyDeviceActivation) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this device service activate params body device activation based on context it is used +func (o *DeviceServiceActivateParamsBodyDeviceActivation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceServiceActivateParamsBodyDeviceActivation) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceServiceActivateParamsBodyDeviceActivation) UnmarshalBinary(b []byte) error { + var res DeviceServiceActivateParamsBodyDeviceActivation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_client.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_client.go new file mode 100644 index 0000000..a8ff409 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_client.go @@ -0,0 +1,863 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new device service API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new device service API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new device service API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for device service API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeviceServiceActivate(params *DeviceServiceActivateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceActivateOK, error) + + DeviceServiceCreate(params *DeviceServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceCreateOK, error) + + DeviceServiceCreateKeys(params *DeviceServiceCreateKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceCreateKeysOK, error) + + DeviceServiceDeactivate(params *DeviceServiceDeactivateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceDeactivateOK, error) + + DeviceServiceDelete(params *DeviceServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceDeleteOK, error) + + DeviceServiceDeleteKeys(params *DeviceServiceDeleteKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceDeleteKeysOK, error) + + DeviceServiceEnqueue(params *DeviceServiceEnqueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceEnqueueOK, error) + + DeviceServiceFlushDevNonces(params *DeviceServiceFlushDevNoncesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceFlushDevNoncesOK, error) + + DeviceServiceFlushQueue(params *DeviceServiceFlushQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceFlushQueueOK, error) + + DeviceServiceGet(params *DeviceServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetOK, error) + + DeviceServiceGetActivation(params *DeviceServiceGetActivationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetActivationOK, error) + + DeviceServiceGetKeys(params *DeviceServiceGetKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetKeysOK, error) + + DeviceServiceGetLinkMetrics(params *DeviceServiceGetLinkMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetLinkMetricsOK, error) + + DeviceServiceGetMetrics(params *DeviceServiceGetMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetMetricsOK, error) + + DeviceServiceGetNextFCntDown(params *DeviceServiceGetNextFCntDownParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetNextFCntDownOK, error) + + DeviceServiceGetQueue(params *DeviceServiceGetQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetQueueOK, error) + + DeviceServiceGetRandomDevAddr(params *DeviceServiceGetRandomDevAddrParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetRandomDevAddrOK, error) + + DeviceServiceList(params *DeviceServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceListOK, error) + + DeviceServiceUpdate(params *DeviceServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceUpdateOK, error) + + DeviceServiceUpdateKeys(params *DeviceServiceUpdateKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceUpdateKeysOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeviceServiceActivate activates re activates the device with the given parameters for a b p or for importing o t a a activations +*/ +func (a *Client) DeviceServiceActivate(params *DeviceServiceActivateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceActivateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceActivateParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_Activate", + Method: "POST", + PathPattern: "/api/devices/{deviceActivation.devEui}/activate", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceActivateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceActivateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceActivateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceCreate creates the given device +*/ +func (a *Client) DeviceServiceCreate(params *DeviceServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceCreateParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_Create", + Method: "POST", + PathPattern: "/api/devices", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceCreateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceCreateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceCreateKeys creates the given device keys +*/ +func (a *Client) DeviceServiceCreateKeys(params *DeviceServiceCreateKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceCreateKeysOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceCreateKeysParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_CreateKeys", + Method: "POST", + PathPattern: "/api/devices/{deviceKeys.devEui}/keys", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceCreateKeysReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceCreateKeysOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceCreateKeysDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceDeactivate deactivates de activates the device +*/ +func (a *Client) DeviceServiceDeactivate(params *DeviceServiceDeactivateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceDeactivateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceDeactivateParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_Deactivate", + Method: "DELETE", + PathPattern: "/api/devices/{devEui}/activation", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceDeactivateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceDeactivateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceDeactivateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceDelete deletes the device with the given dev e UI +*/ +func (a *Client) DeviceServiceDelete(params *DeviceServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_Delete", + Method: "DELETE", + PathPattern: "/api/devices/{devEui}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceDeleteOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceDeleteDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceDeleteKeys deletes the device keys for the given dev e UI +*/ +func (a *Client) DeviceServiceDeleteKeys(params *DeviceServiceDeleteKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceDeleteKeysOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceDeleteKeysParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_DeleteKeys", + Method: "DELETE", + PathPattern: "/api/devices/{devEui}/keys", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceDeleteKeysReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceDeleteKeysOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceDeleteKeysDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceEnqueue enqueues adds the given item to the downlink queue +*/ +func (a *Client) DeviceServiceEnqueue(params *DeviceServiceEnqueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceEnqueueOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceEnqueueParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_Enqueue", + Method: "POST", + PathPattern: "/api/devices/{queueItem.devEui}/queue", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceEnqueueReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceEnqueueOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceEnqueueDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceFlushDevNonces flushes dev nonces flushes the o t a a device nonces +*/ +func (a *Client) DeviceServiceFlushDevNonces(params *DeviceServiceFlushDevNoncesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceFlushDevNoncesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceFlushDevNoncesParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_FlushDevNonces", + Method: "DELETE", + PathPattern: "/api/devices/{devEui}/dev-nonces", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceFlushDevNoncesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceFlushDevNoncesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceFlushDevNoncesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceFlushQueue flushes queue flushes the downlink device queue +*/ +func (a *Client) DeviceServiceFlushQueue(params *DeviceServiceFlushQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceFlushQueueOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceFlushQueueParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_FlushQueue", + Method: "DELETE", + PathPattern: "/api/devices/{devEui}/queue", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceFlushQueueReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceFlushQueueOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceFlushQueueDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceGet gets returns the device for the given dev e UI +*/ +func (a *Client) DeviceServiceGet(params *DeviceServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceGetParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_Get", + Method: "GET", + PathPattern: "/api/devices/{devEui}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceGetOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceGetDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceGetActivation gets activation returns the current activation details of the device o t a a or a b p +*/ +func (a *Client) DeviceServiceGetActivation(params *DeviceServiceGetActivationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetActivationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceGetActivationParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_GetActivation", + Method: "GET", + PathPattern: "/api/devices/{devEui}/activation", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceGetActivationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceGetActivationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceGetActivationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceGetKeys gets the device keys for the given dev e UI +*/ +func (a *Client) DeviceServiceGetKeys(params *DeviceServiceGetKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetKeysOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceGetKeysParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_GetKeys", + Method: "GET", + PathPattern: "/api/devices/{devEui}/keys", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceGetKeysReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceGetKeysOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceGetKeysDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceGetLinkMetrics gets link metrics returns the device link metrics this includes uplinks downlinks r s s i s n r etc +*/ +func (a *Client) DeviceServiceGetLinkMetrics(params *DeviceServiceGetLinkMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetLinkMetricsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceGetLinkMetricsParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_GetLinkMetrics", + Method: "GET", + PathPattern: "/api/devices/{devEui}/link-metrics", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceGetLinkMetricsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceGetLinkMetricsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceGetLinkMetricsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceGetMetrics gets metrics returns the device metrics note that this requires a device profile with codec and measurements configured +*/ +func (a *Client) DeviceServiceGetMetrics(params *DeviceServiceGetMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetMetricsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceGetMetricsParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_GetMetrics", + Method: "GET", + PathPattern: "/api/devices/{devEui}/metrics", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceGetMetricsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceGetMetricsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceGetMetricsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceGetNextFCntDown gets next f cnt down returns the next f cnt down to use for enqueing encrypted downlinks the difference with the device activation f cont down is that this method takes potential existing queue items into account +*/ +func (a *Client) DeviceServiceGetNextFCntDown(params *DeviceServiceGetNextFCntDownParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetNextFCntDownOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceGetNextFCntDownParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_GetNextFCntDown", + Method: "POST", + PathPattern: "/api/devices/{devEui}/get-next-f-cnt-down", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceGetNextFCntDownReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceGetNextFCntDownOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceGetNextFCntDownDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceGetQueue gets queue returns the downlink device queue +*/ +func (a *Client) DeviceServiceGetQueue(params *DeviceServiceGetQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetQueueOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceGetQueueParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_GetQueue", + Method: "GET", + PathPattern: "/api/devices/{devEui}/queue", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceGetQueueReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceGetQueueOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceGetQueueDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceGetRandomDevAddr gets random dev addr returns a random dev addr taking the nwk ID prefix into account +*/ +func (a *Client) DeviceServiceGetRandomDevAddr(params *DeviceServiceGetRandomDevAddrParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetRandomDevAddrOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceGetRandomDevAddrParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_GetRandomDevAddr", + Method: "POST", + PathPattern: "/api/devices/{devEui}/get-random-dev-addr", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceGetRandomDevAddrReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceGetRandomDevAddrOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceGetRandomDevAddrDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceList gets the list of devices +*/ +func (a *Client) DeviceServiceList(params *DeviceServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceListParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_List", + Method: "GET", + PathPattern: "/api/devices", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceListReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceListOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceListDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceUpdate updates the given device +*/ +func (a *Client) DeviceServiceUpdate(params *DeviceServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_Update", + Method: "PUT", + PathPattern: "/api/devices/{device.devEui}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceUpdateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceUpdateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeviceServiceUpdateKeys updates the given device keys +*/ +func (a *Client) DeviceServiceUpdateKeys(params *DeviceServiceUpdateKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceUpdateKeysOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeviceServiceUpdateKeysParams() + } + op := &runtime.ClientOperation{ + ID: "DeviceService_UpdateKeys", + Method: "PUT", + PathPattern: "/api/devices/{deviceKeys.devEui}/keys", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeviceServiceUpdateKeysReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeviceServiceUpdateKeysOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeviceServiceUpdateKeysDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_create_keys_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_create_keys_parameters.go new file mode 100644 index 0000000..e70ca54 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_create_keys_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceCreateKeysParams creates a new DeviceServiceCreateKeysParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceCreateKeysParams() *DeviceServiceCreateKeysParams { + return &DeviceServiceCreateKeysParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceCreateKeysParamsWithTimeout creates a new DeviceServiceCreateKeysParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceCreateKeysParamsWithTimeout(timeout time.Duration) *DeviceServiceCreateKeysParams { + return &DeviceServiceCreateKeysParams{ + timeout: timeout, + } +} + +// NewDeviceServiceCreateKeysParamsWithContext creates a new DeviceServiceCreateKeysParams object +// with the ability to set a context for a request. +func NewDeviceServiceCreateKeysParamsWithContext(ctx context.Context) *DeviceServiceCreateKeysParams { + return &DeviceServiceCreateKeysParams{ + Context: ctx, + } +} + +// NewDeviceServiceCreateKeysParamsWithHTTPClient creates a new DeviceServiceCreateKeysParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceCreateKeysParamsWithHTTPClient(client *http.Client) *DeviceServiceCreateKeysParams { + return &DeviceServiceCreateKeysParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceCreateKeysParams contains all the parameters to send to the API endpoint + + for the device service create keys operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceCreateKeysParams struct { + + // Body. + Body DeviceServiceCreateKeysBody + + /* DeviceKeysDevEui. + + DevEUI (EUI64). + */ + DeviceKeysDevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service create keys params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceCreateKeysParams) WithDefaults() *DeviceServiceCreateKeysParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service create keys params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceCreateKeysParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service create keys params +func (o *DeviceServiceCreateKeysParams) WithTimeout(timeout time.Duration) *DeviceServiceCreateKeysParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service create keys params +func (o *DeviceServiceCreateKeysParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service create keys params +func (o *DeviceServiceCreateKeysParams) WithContext(ctx context.Context) *DeviceServiceCreateKeysParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service create keys params +func (o *DeviceServiceCreateKeysParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service create keys params +func (o *DeviceServiceCreateKeysParams) WithHTTPClient(client *http.Client) *DeviceServiceCreateKeysParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service create keys params +func (o *DeviceServiceCreateKeysParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the device service create keys params +func (o *DeviceServiceCreateKeysParams) WithBody(body DeviceServiceCreateKeysBody) *DeviceServiceCreateKeysParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the device service create keys params +func (o *DeviceServiceCreateKeysParams) SetBody(body DeviceServiceCreateKeysBody) { + o.Body = body +} + +// WithDeviceKeysDevEui adds the deviceKeysDevEui to the device service create keys params +func (o *DeviceServiceCreateKeysParams) WithDeviceKeysDevEui(deviceKeysDevEui string) *DeviceServiceCreateKeysParams { + o.SetDeviceKeysDevEui(deviceKeysDevEui) + return o +} + +// SetDeviceKeysDevEui adds the deviceKeysDevEui to the device service create keys params +func (o *DeviceServiceCreateKeysParams) SetDeviceKeysDevEui(deviceKeysDevEui string) { + o.DeviceKeysDevEui = deviceKeysDevEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceCreateKeysParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param deviceKeys.devEui + if err := r.SetPathParam("deviceKeys.devEui", o.DeviceKeysDevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_create_keys_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_create_keys_responses.go new file mode 100644 index 0000000..1e0be72 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_create_keys_responses.go @@ -0,0 +1,332 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceCreateKeysReader is a Reader for the DeviceServiceCreateKeys structure. +type DeviceServiceCreateKeysReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceCreateKeysReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceCreateKeysOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceCreateKeysDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceCreateKeysOK creates a DeviceServiceCreateKeysOK with default headers values +func NewDeviceServiceCreateKeysOK() *DeviceServiceCreateKeysOK { + return &DeviceServiceCreateKeysOK{} +} + +/* +DeviceServiceCreateKeysOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceCreateKeysOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device service create keys o k response has a 2xx status code +func (o *DeviceServiceCreateKeysOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service create keys o k response has a 3xx status code +func (o *DeviceServiceCreateKeysOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service create keys o k response has a 4xx status code +func (o *DeviceServiceCreateKeysOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service create keys o k response has a 5xx status code +func (o *DeviceServiceCreateKeysOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service create keys o k response a status code equal to that given +func (o *DeviceServiceCreateKeysOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service create keys o k response +func (o *DeviceServiceCreateKeysOK) Code() int { + return 200 +} + +func (o *DeviceServiceCreateKeysOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{deviceKeys.devEui}/keys][%d] deviceServiceCreateKeysOK %s", 200, payload) +} + +func (o *DeviceServiceCreateKeysOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{deviceKeys.devEui}/keys][%d] deviceServiceCreateKeysOK %s", 200, payload) +} + +func (o *DeviceServiceCreateKeysOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceServiceCreateKeysOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceCreateKeysDefault creates a DeviceServiceCreateKeysDefault with default headers values +func NewDeviceServiceCreateKeysDefault(code int) *DeviceServiceCreateKeysDefault { + return &DeviceServiceCreateKeysDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceCreateKeysDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceCreateKeysDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service create keys default response has a 2xx status code +func (o *DeviceServiceCreateKeysDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service create keys default response has a 3xx status code +func (o *DeviceServiceCreateKeysDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service create keys default response has a 4xx status code +func (o *DeviceServiceCreateKeysDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service create keys default response has a 5xx status code +func (o *DeviceServiceCreateKeysDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service create keys default response a status code equal to that given +func (o *DeviceServiceCreateKeysDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service create keys default response +func (o *DeviceServiceCreateKeysDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceCreateKeysDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{deviceKeys.devEui}/keys][%d] DeviceService_CreateKeys default %s", o._statusCode, payload) +} + +func (o *DeviceServiceCreateKeysDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{deviceKeys.devEui}/keys][%d] DeviceService_CreateKeys default %s", o._statusCode, payload) +} + +func (o *DeviceServiceCreateKeysDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceCreateKeysDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +DeviceServiceCreateKeysBody device service create keys body +swagger:model DeviceServiceCreateKeysBody +*/ +type DeviceServiceCreateKeysBody struct { + + // device keys + DeviceKeys *DeviceServiceCreateKeysParamsBodyDeviceKeys `json:"deviceKeys,omitempty"` +} + +// Validate validates this device service create keys body +func (o *DeviceServiceCreateKeysBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateDeviceKeys(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceServiceCreateKeysBody) validateDeviceKeys(formats strfmt.Registry) error { + if swag.IsZero(o.DeviceKeys) { // not required + return nil + } + + if o.DeviceKeys != nil { + if err := o.DeviceKeys.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceKeys") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceKeys") + } + return err + } + } + + return nil +} + +// ContextValidate validate this device service create keys body based on the context it is used +func (o *DeviceServiceCreateKeysBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateDeviceKeys(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceServiceCreateKeysBody) contextValidateDeviceKeys(ctx context.Context, formats strfmt.Registry) error { + + if o.DeviceKeys != nil { + + if swag.IsZero(o.DeviceKeys) { // not required + return nil + } + + if err := o.DeviceKeys.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceKeys") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceKeys") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceServiceCreateKeysBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceServiceCreateKeysBody) UnmarshalBinary(b []byte) error { + var res DeviceServiceCreateKeysBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +DeviceServiceCreateKeysParamsBodyDeviceKeys Device-keys object. +swagger:model DeviceServiceCreateKeysParamsBodyDeviceKeys +*/ +type DeviceServiceCreateKeysParamsBodyDeviceKeys struct { + + // Application root key (128 bit). + // Note: This field only needs to be set for LoRaWAN 1.1.x devices! + AppKey string `json:"appKey,omitempty"` + + // Gen App Key (128 bit). + // Note: This field only needs to be set for LoRaWAN 1.0.x devices that + // implement TS005 (remote multicast setup). + GenAppKey string `json:"genAppKey,omitempty"` + + // Network root key (128 bit). + // Note: For LoRaWAN 1.0.x, use this field for the LoRaWAN 1.0.x 'AppKey`! + NwkKey string `json:"nwkKey,omitempty"` +} + +// Validate validates this device service create keys params body device keys +func (o *DeviceServiceCreateKeysParamsBodyDeviceKeys) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this device service create keys params body device keys based on context it is used +func (o *DeviceServiceCreateKeysParamsBodyDeviceKeys) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceServiceCreateKeysParamsBodyDeviceKeys) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceServiceCreateKeysParamsBodyDeviceKeys) UnmarshalBinary(b []byte) error { + var res DeviceServiceCreateKeysParamsBodyDeviceKeys + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_create_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_create_parameters.go new file mode 100644 index 0000000..3802041 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_create_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// NewDeviceServiceCreateParams creates a new DeviceServiceCreateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceCreateParams() *DeviceServiceCreateParams { + return &DeviceServiceCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceCreateParamsWithTimeout creates a new DeviceServiceCreateParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceCreateParamsWithTimeout(timeout time.Duration) *DeviceServiceCreateParams { + return &DeviceServiceCreateParams{ + timeout: timeout, + } +} + +// NewDeviceServiceCreateParamsWithContext creates a new DeviceServiceCreateParams object +// with the ability to set a context for a request. +func NewDeviceServiceCreateParamsWithContext(ctx context.Context) *DeviceServiceCreateParams { + return &DeviceServiceCreateParams{ + Context: ctx, + } +} + +// NewDeviceServiceCreateParamsWithHTTPClient creates a new DeviceServiceCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceCreateParamsWithHTTPClient(client *http.Client) *DeviceServiceCreateParams { + return &DeviceServiceCreateParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceCreateParams contains all the parameters to send to the API endpoint + + for the device service create operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceCreateParams struct { + + // Body. + Body *models.APICreateDeviceRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceCreateParams) WithDefaults() *DeviceServiceCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service create params +func (o *DeviceServiceCreateParams) WithTimeout(timeout time.Duration) *DeviceServiceCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service create params +func (o *DeviceServiceCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service create params +func (o *DeviceServiceCreateParams) WithContext(ctx context.Context) *DeviceServiceCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service create params +func (o *DeviceServiceCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service create params +func (o *DeviceServiceCreateParams) WithHTTPClient(client *http.Client) *DeviceServiceCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service create params +func (o *DeviceServiceCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the device service create params +func (o *DeviceServiceCreateParams) WithBody(body *models.APICreateDeviceRequest) *DeviceServiceCreateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the device service create params +func (o *DeviceServiceCreateParams) SetBody(body *models.APICreateDeviceRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_create_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_create_responses.go new file mode 100644 index 0000000..df8b725 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_create_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceCreateReader is a Reader for the DeviceServiceCreate structure. +type DeviceServiceCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceCreateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceCreateOK creates a DeviceServiceCreateOK with default headers values +func NewDeviceServiceCreateOK() *DeviceServiceCreateOK { + return &DeviceServiceCreateOK{} +} + +/* +DeviceServiceCreateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceCreateOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device service create o k response has a 2xx status code +func (o *DeviceServiceCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service create o k response has a 3xx status code +func (o *DeviceServiceCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service create o k response has a 4xx status code +func (o *DeviceServiceCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service create o k response has a 5xx status code +func (o *DeviceServiceCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service create o k response a status code equal to that given +func (o *DeviceServiceCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service create o k response +func (o *DeviceServiceCreateOK) Code() int { + return 200 +} + +func (o *DeviceServiceCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices][%d] deviceServiceCreateOK %s", 200, payload) +} + +func (o *DeviceServiceCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices][%d] deviceServiceCreateOK %s", 200, payload) +} + +func (o *DeviceServiceCreateOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceServiceCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceCreateDefault creates a DeviceServiceCreateDefault with default headers values +func NewDeviceServiceCreateDefault(code int) *DeviceServiceCreateDefault { + return &DeviceServiceCreateDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceCreateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceCreateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service create default response has a 2xx status code +func (o *DeviceServiceCreateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service create default response has a 3xx status code +func (o *DeviceServiceCreateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service create default response has a 4xx status code +func (o *DeviceServiceCreateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service create default response has a 5xx status code +func (o *DeviceServiceCreateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service create default response a status code equal to that given +func (o *DeviceServiceCreateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service create default response +func (o *DeviceServiceCreateDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceCreateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices][%d] DeviceService_Create default %s", o._statusCode, payload) +} + +func (o *DeviceServiceCreateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices][%d] DeviceService_Create default %s", o._statusCode, payload) +} + +func (o *DeviceServiceCreateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceCreateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_deactivate_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_deactivate_parameters.go new file mode 100644 index 0000000..f2a77e2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_deactivate_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceDeactivateParams creates a new DeviceServiceDeactivateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceDeactivateParams() *DeviceServiceDeactivateParams { + return &DeviceServiceDeactivateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceDeactivateParamsWithTimeout creates a new DeviceServiceDeactivateParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceDeactivateParamsWithTimeout(timeout time.Duration) *DeviceServiceDeactivateParams { + return &DeviceServiceDeactivateParams{ + timeout: timeout, + } +} + +// NewDeviceServiceDeactivateParamsWithContext creates a new DeviceServiceDeactivateParams object +// with the ability to set a context for a request. +func NewDeviceServiceDeactivateParamsWithContext(ctx context.Context) *DeviceServiceDeactivateParams { + return &DeviceServiceDeactivateParams{ + Context: ctx, + } +} + +// NewDeviceServiceDeactivateParamsWithHTTPClient creates a new DeviceServiceDeactivateParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceDeactivateParamsWithHTTPClient(client *http.Client) *DeviceServiceDeactivateParams { + return &DeviceServiceDeactivateParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceDeactivateParams contains all the parameters to send to the API endpoint + + for the device service deactivate operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceDeactivateParams struct { + + /* DevEui. + + DevEUI (EUI64). + */ + DevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service deactivate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceDeactivateParams) WithDefaults() *DeviceServiceDeactivateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service deactivate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceDeactivateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service deactivate params +func (o *DeviceServiceDeactivateParams) WithTimeout(timeout time.Duration) *DeviceServiceDeactivateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service deactivate params +func (o *DeviceServiceDeactivateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service deactivate params +func (o *DeviceServiceDeactivateParams) WithContext(ctx context.Context) *DeviceServiceDeactivateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service deactivate params +func (o *DeviceServiceDeactivateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service deactivate params +func (o *DeviceServiceDeactivateParams) WithHTTPClient(client *http.Client) *DeviceServiceDeactivateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service deactivate params +func (o *DeviceServiceDeactivateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDevEui adds the devEui to the device service deactivate params +func (o *DeviceServiceDeactivateParams) WithDevEui(devEui string) *DeviceServiceDeactivateParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the device service deactivate params +func (o *DeviceServiceDeactivateParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceDeactivateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_deactivate_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_deactivate_responses.go new file mode 100644 index 0000000..62da98b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_deactivate_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceDeactivateReader is a Reader for the DeviceServiceDeactivate structure. +type DeviceServiceDeactivateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceDeactivateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceDeactivateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceDeactivateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceDeactivateOK creates a DeviceServiceDeactivateOK with default headers values +func NewDeviceServiceDeactivateOK() *DeviceServiceDeactivateOK { + return &DeviceServiceDeactivateOK{} +} + +/* +DeviceServiceDeactivateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceDeactivateOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device service deactivate o k response has a 2xx status code +func (o *DeviceServiceDeactivateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service deactivate o k response has a 3xx status code +func (o *DeviceServiceDeactivateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service deactivate o k response has a 4xx status code +func (o *DeviceServiceDeactivateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service deactivate o k response has a 5xx status code +func (o *DeviceServiceDeactivateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service deactivate o k response a status code equal to that given +func (o *DeviceServiceDeactivateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service deactivate o k response +func (o *DeviceServiceDeactivateOK) Code() int { + return 200 +} + +func (o *DeviceServiceDeactivateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/activation][%d] deviceServiceDeactivateOK %s", 200, payload) +} + +func (o *DeviceServiceDeactivateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/activation][%d] deviceServiceDeactivateOK %s", 200, payload) +} + +func (o *DeviceServiceDeactivateOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceServiceDeactivateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceDeactivateDefault creates a DeviceServiceDeactivateDefault with default headers values +func NewDeviceServiceDeactivateDefault(code int) *DeviceServiceDeactivateDefault { + return &DeviceServiceDeactivateDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceDeactivateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceDeactivateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service deactivate default response has a 2xx status code +func (o *DeviceServiceDeactivateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service deactivate default response has a 3xx status code +func (o *DeviceServiceDeactivateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service deactivate default response has a 4xx status code +func (o *DeviceServiceDeactivateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service deactivate default response has a 5xx status code +func (o *DeviceServiceDeactivateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service deactivate default response a status code equal to that given +func (o *DeviceServiceDeactivateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service deactivate default response +func (o *DeviceServiceDeactivateDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceDeactivateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/activation][%d] DeviceService_Deactivate default %s", o._statusCode, payload) +} + +func (o *DeviceServiceDeactivateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/activation][%d] DeviceService_Deactivate default %s", o._statusCode, payload) +} + +func (o *DeviceServiceDeactivateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceDeactivateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_delete_keys_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_delete_keys_parameters.go new file mode 100644 index 0000000..9cc73b1 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_delete_keys_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceDeleteKeysParams creates a new DeviceServiceDeleteKeysParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceDeleteKeysParams() *DeviceServiceDeleteKeysParams { + return &DeviceServiceDeleteKeysParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceDeleteKeysParamsWithTimeout creates a new DeviceServiceDeleteKeysParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceDeleteKeysParamsWithTimeout(timeout time.Duration) *DeviceServiceDeleteKeysParams { + return &DeviceServiceDeleteKeysParams{ + timeout: timeout, + } +} + +// NewDeviceServiceDeleteKeysParamsWithContext creates a new DeviceServiceDeleteKeysParams object +// with the ability to set a context for a request. +func NewDeviceServiceDeleteKeysParamsWithContext(ctx context.Context) *DeviceServiceDeleteKeysParams { + return &DeviceServiceDeleteKeysParams{ + Context: ctx, + } +} + +// NewDeviceServiceDeleteKeysParamsWithHTTPClient creates a new DeviceServiceDeleteKeysParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceDeleteKeysParamsWithHTTPClient(client *http.Client) *DeviceServiceDeleteKeysParams { + return &DeviceServiceDeleteKeysParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceDeleteKeysParams contains all the parameters to send to the API endpoint + + for the device service delete keys operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceDeleteKeysParams struct { + + /* DevEui. + + DevEUI (EUI64). + */ + DevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service delete keys params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceDeleteKeysParams) WithDefaults() *DeviceServiceDeleteKeysParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service delete keys params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceDeleteKeysParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service delete keys params +func (o *DeviceServiceDeleteKeysParams) WithTimeout(timeout time.Duration) *DeviceServiceDeleteKeysParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service delete keys params +func (o *DeviceServiceDeleteKeysParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service delete keys params +func (o *DeviceServiceDeleteKeysParams) WithContext(ctx context.Context) *DeviceServiceDeleteKeysParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service delete keys params +func (o *DeviceServiceDeleteKeysParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service delete keys params +func (o *DeviceServiceDeleteKeysParams) WithHTTPClient(client *http.Client) *DeviceServiceDeleteKeysParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service delete keys params +func (o *DeviceServiceDeleteKeysParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDevEui adds the devEui to the device service delete keys params +func (o *DeviceServiceDeleteKeysParams) WithDevEui(devEui string) *DeviceServiceDeleteKeysParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the device service delete keys params +func (o *DeviceServiceDeleteKeysParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceDeleteKeysParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_delete_keys_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_delete_keys_responses.go new file mode 100644 index 0000000..6e3b1e8 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_delete_keys_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceDeleteKeysReader is a Reader for the DeviceServiceDeleteKeys structure. +type DeviceServiceDeleteKeysReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceDeleteKeysReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceDeleteKeysOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceDeleteKeysDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceDeleteKeysOK creates a DeviceServiceDeleteKeysOK with default headers values +func NewDeviceServiceDeleteKeysOK() *DeviceServiceDeleteKeysOK { + return &DeviceServiceDeleteKeysOK{} +} + +/* +DeviceServiceDeleteKeysOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceDeleteKeysOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device service delete keys o k response has a 2xx status code +func (o *DeviceServiceDeleteKeysOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service delete keys o k response has a 3xx status code +func (o *DeviceServiceDeleteKeysOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service delete keys o k response has a 4xx status code +func (o *DeviceServiceDeleteKeysOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service delete keys o k response has a 5xx status code +func (o *DeviceServiceDeleteKeysOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service delete keys o k response a status code equal to that given +func (o *DeviceServiceDeleteKeysOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service delete keys o k response +func (o *DeviceServiceDeleteKeysOK) Code() int { + return 200 +} + +func (o *DeviceServiceDeleteKeysOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/keys][%d] deviceServiceDeleteKeysOK %s", 200, payload) +} + +func (o *DeviceServiceDeleteKeysOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/keys][%d] deviceServiceDeleteKeysOK %s", 200, payload) +} + +func (o *DeviceServiceDeleteKeysOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceServiceDeleteKeysOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceDeleteKeysDefault creates a DeviceServiceDeleteKeysDefault with default headers values +func NewDeviceServiceDeleteKeysDefault(code int) *DeviceServiceDeleteKeysDefault { + return &DeviceServiceDeleteKeysDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceDeleteKeysDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceDeleteKeysDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service delete keys default response has a 2xx status code +func (o *DeviceServiceDeleteKeysDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service delete keys default response has a 3xx status code +func (o *DeviceServiceDeleteKeysDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service delete keys default response has a 4xx status code +func (o *DeviceServiceDeleteKeysDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service delete keys default response has a 5xx status code +func (o *DeviceServiceDeleteKeysDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service delete keys default response a status code equal to that given +func (o *DeviceServiceDeleteKeysDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service delete keys default response +func (o *DeviceServiceDeleteKeysDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceDeleteKeysDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/keys][%d] DeviceService_DeleteKeys default %s", o._statusCode, payload) +} + +func (o *DeviceServiceDeleteKeysDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/keys][%d] DeviceService_DeleteKeys default %s", o._statusCode, payload) +} + +func (o *DeviceServiceDeleteKeysDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceDeleteKeysDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_delete_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_delete_parameters.go new file mode 100644 index 0000000..b1c046d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceDeleteParams creates a new DeviceServiceDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceDeleteParams() *DeviceServiceDeleteParams { + return &DeviceServiceDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceDeleteParamsWithTimeout creates a new DeviceServiceDeleteParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceDeleteParamsWithTimeout(timeout time.Duration) *DeviceServiceDeleteParams { + return &DeviceServiceDeleteParams{ + timeout: timeout, + } +} + +// NewDeviceServiceDeleteParamsWithContext creates a new DeviceServiceDeleteParams object +// with the ability to set a context for a request. +func NewDeviceServiceDeleteParamsWithContext(ctx context.Context) *DeviceServiceDeleteParams { + return &DeviceServiceDeleteParams{ + Context: ctx, + } +} + +// NewDeviceServiceDeleteParamsWithHTTPClient creates a new DeviceServiceDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceDeleteParamsWithHTTPClient(client *http.Client) *DeviceServiceDeleteParams { + return &DeviceServiceDeleteParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceDeleteParams contains all the parameters to send to the API endpoint + + for the device service delete operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceDeleteParams struct { + + /* DevEui. + + DevEUI (EUI64). + */ + DevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceDeleteParams) WithDefaults() *DeviceServiceDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service delete params +func (o *DeviceServiceDeleteParams) WithTimeout(timeout time.Duration) *DeviceServiceDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service delete params +func (o *DeviceServiceDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service delete params +func (o *DeviceServiceDeleteParams) WithContext(ctx context.Context) *DeviceServiceDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service delete params +func (o *DeviceServiceDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service delete params +func (o *DeviceServiceDeleteParams) WithHTTPClient(client *http.Client) *DeviceServiceDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service delete params +func (o *DeviceServiceDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDevEui adds the devEui to the device service delete params +func (o *DeviceServiceDeleteParams) WithDevEui(devEui string) *DeviceServiceDeleteParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the device service delete params +func (o *DeviceServiceDeleteParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_delete_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_delete_responses.go new file mode 100644 index 0000000..fa06997 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_delete_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceDeleteReader is a Reader for the DeviceServiceDelete structure. +type DeviceServiceDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceDeleteDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceDeleteOK creates a DeviceServiceDeleteOK with default headers values +func NewDeviceServiceDeleteOK() *DeviceServiceDeleteOK { + return &DeviceServiceDeleteOK{} +} + +/* +DeviceServiceDeleteOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceDeleteOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device service delete o k response has a 2xx status code +func (o *DeviceServiceDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service delete o k response has a 3xx status code +func (o *DeviceServiceDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service delete o k response has a 4xx status code +func (o *DeviceServiceDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service delete o k response has a 5xx status code +func (o *DeviceServiceDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service delete o k response a status code equal to that given +func (o *DeviceServiceDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service delete o k response +func (o *DeviceServiceDeleteOK) Code() int { + return 200 +} + +func (o *DeviceServiceDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}][%d] deviceServiceDeleteOK %s", 200, payload) +} + +func (o *DeviceServiceDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}][%d] deviceServiceDeleteOK %s", 200, payload) +} + +func (o *DeviceServiceDeleteOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceServiceDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceDeleteDefault creates a DeviceServiceDeleteDefault with default headers values +func NewDeviceServiceDeleteDefault(code int) *DeviceServiceDeleteDefault { + return &DeviceServiceDeleteDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceDeleteDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceDeleteDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service delete default response has a 2xx status code +func (o *DeviceServiceDeleteDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service delete default response has a 3xx status code +func (o *DeviceServiceDeleteDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service delete default response has a 4xx status code +func (o *DeviceServiceDeleteDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service delete default response has a 5xx status code +func (o *DeviceServiceDeleteDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service delete default response a status code equal to that given +func (o *DeviceServiceDeleteDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service delete default response +func (o *DeviceServiceDeleteDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceDeleteDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}][%d] DeviceService_Delete default %s", o._statusCode, payload) +} + +func (o *DeviceServiceDeleteDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}][%d] DeviceService_Delete default %s", o._statusCode, payload) +} + +func (o *DeviceServiceDeleteDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceDeleteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_enqueue_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_enqueue_parameters.go new file mode 100644 index 0000000..2069033 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_enqueue_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceEnqueueParams creates a new DeviceServiceEnqueueParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceEnqueueParams() *DeviceServiceEnqueueParams { + return &DeviceServiceEnqueueParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceEnqueueParamsWithTimeout creates a new DeviceServiceEnqueueParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceEnqueueParamsWithTimeout(timeout time.Duration) *DeviceServiceEnqueueParams { + return &DeviceServiceEnqueueParams{ + timeout: timeout, + } +} + +// NewDeviceServiceEnqueueParamsWithContext creates a new DeviceServiceEnqueueParams object +// with the ability to set a context for a request. +func NewDeviceServiceEnqueueParamsWithContext(ctx context.Context) *DeviceServiceEnqueueParams { + return &DeviceServiceEnqueueParams{ + Context: ctx, + } +} + +// NewDeviceServiceEnqueueParamsWithHTTPClient creates a new DeviceServiceEnqueueParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceEnqueueParamsWithHTTPClient(client *http.Client) *DeviceServiceEnqueueParams { + return &DeviceServiceEnqueueParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceEnqueueParams contains all the parameters to send to the API endpoint + + for the device service enqueue operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceEnqueueParams struct { + + // Body. + Body DeviceServiceEnqueueBody + + /* QueueItemDevEui. + + Device EUI (EUI64). + */ + QueueItemDevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service enqueue params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceEnqueueParams) WithDefaults() *DeviceServiceEnqueueParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service enqueue params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceEnqueueParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service enqueue params +func (o *DeviceServiceEnqueueParams) WithTimeout(timeout time.Duration) *DeviceServiceEnqueueParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service enqueue params +func (o *DeviceServiceEnqueueParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service enqueue params +func (o *DeviceServiceEnqueueParams) WithContext(ctx context.Context) *DeviceServiceEnqueueParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service enqueue params +func (o *DeviceServiceEnqueueParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service enqueue params +func (o *DeviceServiceEnqueueParams) WithHTTPClient(client *http.Client) *DeviceServiceEnqueueParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service enqueue params +func (o *DeviceServiceEnqueueParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the device service enqueue params +func (o *DeviceServiceEnqueueParams) WithBody(body DeviceServiceEnqueueBody) *DeviceServiceEnqueueParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the device service enqueue params +func (o *DeviceServiceEnqueueParams) SetBody(body DeviceServiceEnqueueBody) { + o.Body = body +} + +// WithQueueItemDevEui adds the queueItemDevEui to the device service enqueue params +func (o *DeviceServiceEnqueueParams) WithQueueItemDevEui(queueItemDevEui string) *DeviceServiceEnqueueParams { + o.SetQueueItemDevEui(queueItemDevEui) + return o +} + +// SetQueueItemDevEui adds the queueItemDevEui to the device service enqueue params +func (o *DeviceServiceEnqueueParams) SetQueueItemDevEui(queueItemDevEui string) { + o.QueueItemDevEui = queueItemDevEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceEnqueueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param queueItem.devEui + if err := r.SetPathParam("queueItem.devEui", o.QueueItemDevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_enqueue_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_enqueue_responses.go new file mode 100644 index 0000000..7bf3a9e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_enqueue_responses.go @@ -0,0 +1,385 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceEnqueueReader is a Reader for the DeviceServiceEnqueue structure. +type DeviceServiceEnqueueReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceEnqueueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceEnqueueOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceEnqueueDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceEnqueueOK creates a DeviceServiceEnqueueOK with default headers values +func NewDeviceServiceEnqueueOK() *DeviceServiceEnqueueOK { + return &DeviceServiceEnqueueOK{} +} + +/* +DeviceServiceEnqueueOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceEnqueueOK struct { + Payload *models.APIEnqueueDeviceQueueItemResponse +} + +// IsSuccess returns true when this device service enqueue o k response has a 2xx status code +func (o *DeviceServiceEnqueueOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service enqueue o k response has a 3xx status code +func (o *DeviceServiceEnqueueOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service enqueue o k response has a 4xx status code +func (o *DeviceServiceEnqueueOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service enqueue o k response has a 5xx status code +func (o *DeviceServiceEnqueueOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service enqueue o k response a status code equal to that given +func (o *DeviceServiceEnqueueOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service enqueue o k response +func (o *DeviceServiceEnqueueOK) Code() int { + return 200 +} + +func (o *DeviceServiceEnqueueOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{queueItem.devEui}/queue][%d] deviceServiceEnqueueOK %s", 200, payload) +} + +func (o *DeviceServiceEnqueueOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{queueItem.devEui}/queue][%d] deviceServiceEnqueueOK %s", 200, payload) +} + +func (o *DeviceServiceEnqueueOK) GetPayload() *models.APIEnqueueDeviceQueueItemResponse { + return o.Payload +} + +func (o *DeviceServiceEnqueueOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIEnqueueDeviceQueueItemResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceEnqueueDefault creates a DeviceServiceEnqueueDefault with default headers values +func NewDeviceServiceEnqueueDefault(code int) *DeviceServiceEnqueueDefault { + return &DeviceServiceEnqueueDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceEnqueueDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceEnqueueDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service enqueue default response has a 2xx status code +func (o *DeviceServiceEnqueueDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service enqueue default response has a 3xx status code +func (o *DeviceServiceEnqueueDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service enqueue default response has a 4xx status code +func (o *DeviceServiceEnqueueDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service enqueue default response has a 5xx status code +func (o *DeviceServiceEnqueueDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service enqueue default response a status code equal to that given +func (o *DeviceServiceEnqueueDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service enqueue default response +func (o *DeviceServiceEnqueueDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceEnqueueDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{queueItem.devEui}/queue][%d] DeviceService_Enqueue default %s", o._statusCode, payload) +} + +func (o *DeviceServiceEnqueueDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{queueItem.devEui}/queue][%d] DeviceService_Enqueue default %s", o._statusCode, payload) +} + +func (o *DeviceServiceEnqueueDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceEnqueueDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +DeviceServiceEnqueueBody device service enqueue body +swagger:model DeviceServiceEnqueueBody +*/ +type DeviceServiceEnqueueBody struct { + + // queue item + QueueItem *DeviceServiceEnqueueParamsBodyQueueItem `json:"queueItem,omitempty"` +} + +// Validate validates this device service enqueue body +func (o *DeviceServiceEnqueueBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateQueueItem(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceServiceEnqueueBody) validateQueueItem(formats strfmt.Registry) error { + if swag.IsZero(o.QueueItem) { // not required + return nil + } + + if o.QueueItem != nil { + if err := o.QueueItem.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "queueItem") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "queueItem") + } + return err + } + } + + return nil +} + +// ContextValidate validate this device service enqueue body based on the context it is used +func (o *DeviceServiceEnqueueBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateQueueItem(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceServiceEnqueueBody) contextValidateQueueItem(ctx context.Context, formats strfmt.Registry) error { + + if o.QueueItem != nil { + + if swag.IsZero(o.QueueItem) { // not required + return nil + } + + if err := o.QueueItem.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "queueItem") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "queueItem") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceServiceEnqueueBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceServiceEnqueueBody) UnmarshalBinary(b []byte) error { + var res DeviceServiceEnqueueBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +DeviceServiceEnqueueParamsBodyQueueItem device service enqueue params body queue item +swagger:model DeviceServiceEnqueueParamsBodyQueueItem +*/ +type DeviceServiceEnqueueParamsBodyQueueItem struct { + + // Confirmed. + Confirmed bool `json:"confirmed,omitempty"` + + // Data. + // Or use the json_object field when a codec has been configured. + // Format: byte + Data strfmt.Base64 `json:"data,omitempty"` + + // Expires at (optional). + // Expired queue-items will be automatically removed from the queue. + // Format: date-time + ExpiresAt strfmt.DateTime `json:"expiresAt,omitempty"` + + // Downlink frame-counter. + // Do not set this for plain-text data payloads. It will be automatically set + // by ChirpStack when the payload has been sent as downlink. + FCntDown int64 `json:"fCntDown,omitempty"` + + // FPort (must be > 0). + // On enqueue and if using a JavaScript codec, this value might be + // automatically set by the codec function. + FPort int64 `json:"fPort,omitempty"` + + // ID (UUID). + // This is automatically generated on enqueue. + ID string `json:"id,omitempty"` + + // Is encrypted. + // This must be set to true if the end-application has already encrypted + // the data payload. In this case, the f_cnt_down field must be set to + // the corresponding frame-counter which has been used during the encryption. + IsEncrypted bool `json:"isEncrypted,omitempty"` + + // Is pending. + // This is set by ChirpStack to true when the downlink is pending (e.g. it + // has been sent, but a confirmation is still pending). + IsPending bool `json:"isPending,omitempty"` + + // Only use this when a codec has been configured that can encode this + // object to bytes. + Object interface{} `json:"object,omitempty"` +} + +// Validate validates this device service enqueue params body queue item +func (o *DeviceServiceEnqueueParamsBodyQueueItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateExpiresAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceServiceEnqueueParamsBodyQueueItem) validateExpiresAt(formats strfmt.Registry) error { + if swag.IsZero(o.ExpiresAt) { // not required + return nil + } + + if err := validate.FormatOf("body"+"."+"queueItem"+"."+"expiresAt", "body", "date-time", o.ExpiresAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this device service enqueue params body queue item based on context it is used +func (o *DeviceServiceEnqueueParamsBodyQueueItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceServiceEnqueueParamsBodyQueueItem) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceServiceEnqueueParamsBodyQueueItem) UnmarshalBinary(b []byte) error { + var res DeviceServiceEnqueueParamsBodyQueueItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_flush_dev_nonces_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_flush_dev_nonces_parameters.go new file mode 100644 index 0000000..1be02e9 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_flush_dev_nonces_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceFlushDevNoncesParams creates a new DeviceServiceFlushDevNoncesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceFlushDevNoncesParams() *DeviceServiceFlushDevNoncesParams { + return &DeviceServiceFlushDevNoncesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceFlushDevNoncesParamsWithTimeout creates a new DeviceServiceFlushDevNoncesParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceFlushDevNoncesParamsWithTimeout(timeout time.Duration) *DeviceServiceFlushDevNoncesParams { + return &DeviceServiceFlushDevNoncesParams{ + timeout: timeout, + } +} + +// NewDeviceServiceFlushDevNoncesParamsWithContext creates a new DeviceServiceFlushDevNoncesParams object +// with the ability to set a context for a request. +func NewDeviceServiceFlushDevNoncesParamsWithContext(ctx context.Context) *DeviceServiceFlushDevNoncesParams { + return &DeviceServiceFlushDevNoncesParams{ + Context: ctx, + } +} + +// NewDeviceServiceFlushDevNoncesParamsWithHTTPClient creates a new DeviceServiceFlushDevNoncesParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceFlushDevNoncesParamsWithHTTPClient(client *http.Client) *DeviceServiceFlushDevNoncesParams { + return &DeviceServiceFlushDevNoncesParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceFlushDevNoncesParams contains all the parameters to send to the API endpoint + + for the device service flush dev nonces operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceFlushDevNoncesParams struct { + + /* DevEui. + + Device EUI (EUI64). + */ + DevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service flush dev nonces params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceFlushDevNoncesParams) WithDefaults() *DeviceServiceFlushDevNoncesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service flush dev nonces params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceFlushDevNoncesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service flush dev nonces params +func (o *DeviceServiceFlushDevNoncesParams) WithTimeout(timeout time.Duration) *DeviceServiceFlushDevNoncesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service flush dev nonces params +func (o *DeviceServiceFlushDevNoncesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service flush dev nonces params +func (o *DeviceServiceFlushDevNoncesParams) WithContext(ctx context.Context) *DeviceServiceFlushDevNoncesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service flush dev nonces params +func (o *DeviceServiceFlushDevNoncesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service flush dev nonces params +func (o *DeviceServiceFlushDevNoncesParams) WithHTTPClient(client *http.Client) *DeviceServiceFlushDevNoncesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service flush dev nonces params +func (o *DeviceServiceFlushDevNoncesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDevEui adds the devEui to the device service flush dev nonces params +func (o *DeviceServiceFlushDevNoncesParams) WithDevEui(devEui string) *DeviceServiceFlushDevNoncesParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the device service flush dev nonces params +func (o *DeviceServiceFlushDevNoncesParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceFlushDevNoncesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_flush_dev_nonces_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_flush_dev_nonces_responses.go new file mode 100644 index 0000000..4e5d456 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_flush_dev_nonces_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceFlushDevNoncesReader is a Reader for the DeviceServiceFlushDevNonces structure. +type DeviceServiceFlushDevNoncesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceFlushDevNoncesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceFlushDevNoncesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceFlushDevNoncesDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceFlushDevNoncesOK creates a DeviceServiceFlushDevNoncesOK with default headers values +func NewDeviceServiceFlushDevNoncesOK() *DeviceServiceFlushDevNoncesOK { + return &DeviceServiceFlushDevNoncesOK{} +} + +/* +DeviceServiceFlushDevNoncesOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceFlushDevNoncesOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device service flush dev nonces o k response has a 2xx status code +func (o *DeviceServiceFlushDevNoncesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service flush dev nonces o k response has a 3xx status code +func (o *DeviceServiceFlushDevNoncesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service flush dev nonces o k response has a 4xx status code +func (o *DeviceServiceFlushDevNoncesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service flush dev nonces o k response has a 5xx status code +func (o *DeviceServiceFlushDevNoncesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service flush dev nonces o k response a status code equal to that given +func (o *DeviceServiceFlushDevNoncesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service flush dev nonces o k response +func (o *DeviceServiceFlushDevNoncesOK) Code() int { + return 200 +} + +func (o *DeviceServiceFlushDevNoncesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/dev-nonces][%d] deviceServiceFlushDevNoncesOK %s", 200, payload) +} + +func (o *DeviceServiceFlushDevNoncesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/dev-nonces][%d] deviceServiceFlushDevNoncesOK %s", 200, payload) +} + +func (o *DeviceServiceFlushDevNoncesOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceServiceFlushDevNoncesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceFlushDevNoncesDefault creates a DeviceServiceFlushDevNoncesDefault with default headers values +func NewDeviceServiceFlushDevNoncesDefault(code int) *DeviceServiceFlushDevNoncesDefault { + return &DeviceServiceFlushDevNoncesDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceFlushDevNoncesDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceFlushDevNoncesDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service flush dev nonces default response has a 2xx status code +func (o *DeviceServiceFlushDevNoncesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service flush dev nonces default response has a 3xx status code +func (o *DeviceServiceFlushDevNoncesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service flush dev nonces default response has a 4xx status code +func (o *DeviceServiceFlushDevNoncesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service flush dev nonces default response has a 5xx status code +func (o *DeviceServiceFlushDevNoncesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service flush dev nonces default response a status code equal to that given +func (o *DeviceServiceFlushDevNoncesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service flush dev nonces default response +func (o *DeviceServiceFlushDevNoncesDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceFlushDevNoncesDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/dev-nonces][%d] DeviceService_FlushDevNonces default %s", o._statusCode, payload) +} + +func (o *DeviceServiceFlushDevNoncesDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/dev-nonces][%d] DeviceService_FlushDevNonces default %s", o._statusCode, payload) +} + +func (o *DeviceServiceFlushDevNoncesDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceFlushDevNoncesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_flush_queue_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_flush_queue_parameters.go new file mode 100644 index 0000000..cd60ab2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_flush_queue_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceFlushQueueParams creates a new DeviceServiceFlushQueueParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceFlushQueueParams() *DeviceServiceFlushQueueParams { + return &DeviceServiceFlushQueueParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceFlushQueueParamsWithTimeout creates a new DeviceServiceFlushQueueParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceFlushQueueParamsWithTimeout(timeout time.Duration) *DeviceServiceFlushQueueParams { + return &DeviceServiceFlushQueueParams{ + timeout: timeout, + } +} + +// NewDeviceServiceFlushQueueParamsWithContext creates a new DeviceServiceFlushQueueParams object +// with the ability to set a context for a request. +func NewDeviceServiceFlushQueueParamsWithContext(ctx context.Context) *DeviceServiceFlushQueueParams { + return &DeviceServiceFlushQueueParams{ + Context: ctx, + } +} + +// NewDeviceServiceFlushQueueParamsWithHTTPClient creates a new DeviceServiceFlushQueueParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceFlushQueueParamsWithHTTPClient(client *http.Client) *DeviceServiceFlushQueueParams { + return &DeviceServiceFlushQueueParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceFlushQueueParams contains all the parameters to send to the API endpoint + + for the device service flush queue operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceFlushQueueParams struct { + + /* DevEui. + + Device EUI (EUI64). + */ + DevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service flush queue params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceFlushQueueParams) WithDefaults() *DeviceServiceFlushQueueParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service flush queue params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceFlushQueueParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service flush queue params +func (o *DeviceServiceFlushQueueParams) WithTimeout(timeout time.Duration) *DeviceServiceFlushQueueParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service flush queue params +func (o *DeviceServiceFlushQueueParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service flush queue params +func (o *DeviceServiceFlushQueueParams) WithContext(ctx context.Context) *DeviceServiceFlushQueueParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service flush queue params +func (o *DeviceServiceFlushQueueParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service flush queue params +func (o *DeviceServiceFlushQueueParams) WithHTTPClient(client *http.Client) *DeviceServiceFlushQueueParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service flush queue params +func (o *DeviceServiceFlushQueueParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDevEui adds the devEui to the device service flush queue params +func (o *DeviceServiceFlushQueueParams) WithDevEui(devEui string) *DeviceServiceFlushQueueParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the device service flush queue params +func (o *DeviceServiceFlushQueueParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceFlushQueueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_flush_queue_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_flush_queue_responses.go new file mode 100644 index 0000000..1d3ad4b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_flush_queue_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceFlushQueueReader is a Reader for the DeviceServiceFlushQueue structure. +type DeviceServiceFlushQueueReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceFlushQueueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceFlushQueueOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceFlushQueueDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceFlushQueueOK creates a DeviceServiceFlushQueueOK with default headers values +func NewDeviceServiceFlushQueueOK() *DeviceServiceFlushQueueOK { + return &DeviceServiceFlushQueueOK{} +} + +/* +DeviceServiceFlushQueueOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceFlushQueueOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device service flush queue o k response has a 2xx status code +func (o *DeviceServiceFlushQueueOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service flush queue o k response has a 3xx status code +func (o *DeviceServiceFlushQueueOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service flush queue o k response has a 4xx status code +func (o *DeviceServiceFlushQueueOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service flush queue o k response has a 5xx status code +func (o *DeviceServiceFlushQueueOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service flush queue o k response a status code equal to that given +func (o *DeviceServiceFlushQueueOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service flush queue o k response +func (o *DeviceServiceFlushQueueOK) Code() int { + return 200 +} + +func (o *DeviceServiceFlushQueueOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/queue][%d] deviceServiceFlushQueueOK %s", 200, payload) +} + +func (o *DeviceServiceFlushQueueOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/queue][%d] deviceServiceFlushQueueOK %s", 200, payload) +} + +func (o *DeviceServiceFlushQueueOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceServiceFlushQueueOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceFlushQueueDefault creates a DeviceServiceFlushQueueDefault with default headers values +func NewDeviceServiceFlushQueueDefault(code int) *DeviceServiceFlushQueueDefault { + return &DeviceServiceFlushQueueDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceFlushQueueDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceFlushQueueDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service flush queue default response has a 2xx status code +func (o *DeviceServiceFlushQueueDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service flush queue default response has a 3xx status code +func (o *DeviceServiceFlushQueueDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service flush queue default response has a 4xx status code +func (o *DeviceServiceFlushQueueDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service flush queue default response has a 5xx status code +func (o *DeviceServiceFlushQueueDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service flush queue default response a status code equal to that given +func (o *DeviceServiceFlushQueueDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service flush queue default response +func (o *DeviceServiceFlushQueueDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceFlushQueueDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/queue][%d] DeviceService_FlushQueue default %s", o._statusCode, payload) +} + +func (o *DeviceServiceFlushQueueDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/devices/{devEui}/queue][%d] DeviceService_FlushQueue default %s", o._statusCode, payload) +} + +func (o *DeviceServiceFlushQueueDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceFlushQueueDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_activation_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_activation_parameters.go new file mode 100644 index 0000000..502523e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_activation_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceGetActivationParams creates a new DeviceServiceGetActivationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceGetActivationParams() *DeviceServiceGetActivationParams { + return &DeviceServiceGetActivationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceGetActivationParamsWithTimeout creates a new DeviceServiceGetActivationParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceGetActivationParamsWithTimeout(timeout time.Duration) *DeviceServiceGetActivationParams { + return &DeviceServiceGetActivationParams{ + timeout: timeout, + } +} + +// NewDeviceServiceGetActivationParamsWithContext creates a new DeviceServiceGetActivationParams object +// with the ability to set a context for a request. +func NewDeviceServiceGetActivationParamsWithContext(ctx context.Context) *DeviceServiceGetActivationParams { + return &DeviceServiceGetActivationParams{ + Context: ctx, + } +} + +// NewDeviceServiceGetActivationParamsWithHTTPClient creates a new DeviceServiceGetActivationParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceGetActivationParamsWithHTTPClient(client *http.Client) *DeviceServiceGetActivationParams { + return &DeviceServiceGetActivationParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceGetActivationParams contains all the parameters to send to the API endpoint + + for the device service get activation operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceGetActivationParams struct { + + /* DevEui. + + DevEUI (EUI64). + */ + DevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service get activation params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetActivationParams) WithDefaults() *DeviceServiceGetActivationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service get activation params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetActivationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service get activation params +func (o *DeviceServiceGetActivationParams) WithTimeout(timeout time.Duration) *DeviceServiceGetActivationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service get activation params +func (o *DeviceServiceGetActivationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service get activation params +func (o *DeviceServiceGetActivationParams) WithContext(ctx context.Context) *DeviceServiceGetActivationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service get activation params +func (o *DeviceServiceGetActivationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service get activation params +func (o *DeviceServiceGetActivationParams) WithHTTPClient(client *http.Client) *DeviceServiceGetActivationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service get activation params +func (o *DeviceServiceGetActivationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDevEui adds the devEui to the device service get activation params +func (o *DeviceServiceGetActivationParams) WithDevEui(devEui string) *DeviceServiceGetActivationParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the device service get activation params +func (o *DeviceServiceGetActivationParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceGetActivationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_activation_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_activation_responses.go new file mode 100644 index 0000000..50ebadc --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_activation_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceGetActivationReader is a Reader for the DeviceServiceGetActivation structure. +type DeviceServiceGetActivationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceGetActivationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceGetActivationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceGetActivationDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceGetActivationOK creates a DeviceServiceGetActivationOK with default headers values +func NewDeviceServiceGetActivationOK() *DeviceServiceGetActivationOK { + return &DeviceServiceGetActivationOK{} +} + +/* +DeviceServiceGetActivationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceGetActivationOK struct { + Payload *models.APIGetDeviceActivationResponse +} + +// IsSuccess returns true when this device service get activation o k response has a 2xx status code +func (o *DeviceServiceGetActivationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service get activation o k response has a 3xx status code +func (o *DeviceServiceGetActivationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service get activation o k response has a 4xx status code +func (o *DeviceServiceGetActivationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service get activation o k response has a 5xx status code +func (o *DeviceServiceGetActivationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service get activation o k response a status code equal to that given +func (o *DeviceServiceGetActivationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service get activation o k response +func (o *DeviceServiceGetActivationOK) Code() int { + return 200 +} + +func (o *DeviceServiceGetActivationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/activation][%d] deviceServiceGetActivationOK %s", 200, payload) +} + +func (o *DeviceServiceGetActivationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/activation][%d] deviceServiceGetActivationOK %s", 200, payload) +} + +func (o *DeviceServiceGetActivationOK) GetPayload() *models.APIGetDeviceActivationResponse { + return o.Payload +} + +func (o *DeviceServiceGetActivationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetDeviceActivationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceGetActivationDefault creates a DeviceServiceGetActivationDefault with default headers values +func NewDeviceServiceGetActivationDefault(code int) *DeviceServiceGetActivationDefault { + return &DeviceServiceGetActivationDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceGetActivationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceGetActivationDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service get activation default response has a 2xx status code +func (o *DeviceServiceGetActivationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service get activation default response has a 3xx status code +func (o *DeviceServiceGetActivationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service get activation default response has a 4xx status code +func (o *DeviceServiceGetActivationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service get activation default response has a 5xx status code +func (o *DeviceServiceGetActivationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service get activation default response a status code equal to that given +func (o *DeviceServiceGetActivationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service get activation default response +func (o *DeviceServiceGetActivationDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceGetActivationDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/activation][%d] DeviceService_GetActivation default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetActivationDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/activation][%d] DeviceService_GetActivation default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetActivationDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceGetActivationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_keys_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_keys_parameters.go new file mode 100644 index 0000000..75fe194 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_keys_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceGetKeysParams creates a new DeviceServiceGetKeysParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceGetKeysParams() *DeviceServiceGetKeysParams { + return &DeviceServiceGetKeysParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceGetKeysParamsWithTimeout creates a new DeviceServiceGetKeysParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceGetKeysParamsWithTimeout(timeout time.Duration) *DeviceServiceGetKeysParams { + return &DeviceServiceGetKeysParams{ + timeout: timeout, + } +} + +// NewDeviceServiceGetKeysParamsWithContext creates a new DeviceServiceGetKeysParams object +// with the ability to set a context for a request. +func NewDeviceServiceGetKeysParamsWithContext(ctx context.Context) *DeviceServiceGetKeysParams { + return &DeviceServiceGetKeysParams{ + Context: ctx, + } +} + +// NewDeviceServiceGetKeysParamsWithHTTPClient creates a new DeviceServiceGetKeysParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceGetKeysParamsWithHTTPClient(client *http.Client) *DeviceServiceGetKeysParams { + return &DeviceServiceGetKeysParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceGetKeysParams contains all the parameters to send to the API endpoint + + for the device service get keys operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceGetKeysParams struct { + + /* DevEui. + + DevEUI (EUI64). + */ + DevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service get keys params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetKeysParams) WithDefaults() *DeviceServiceGetKeysParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service get keys params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetKeysParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service get keys params +func (o *DeviceServiceGetKeysParams) WithTimeout(timeout time.Duration) *DeviceServiceGetKeysParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service get keys params +func (o *DeviceServiceGetKeysParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service get keys params +func (o *DeviceServiceGetKeysParams) WithContext(ctx context.Context) *DeviceServiceGetKeysParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service get keys params +func (o *DeviceServiceGetKeysParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service get keys params +func (o *DeviceServiceGetKeysParams) WithHTTPClient(client *http.Client) *DeviceServiceGetKeysParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service get keys params +func (o *DeviceServiceGetKeysParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDevEui adds the devEui to the device service get keys params +func (o *DeviceServiceGetKeysParams) WithDevEui(devEui string) *DeviceServiceGetKeysParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the device service get keys params +func (o *DeviceServiceGetKeysParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceGetKeysParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_keys_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_keys_responses.go new file mode 100644 index 0000000..4de7c55 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_keys_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceGetKeysReader is a Reader for the DeviceServiceGetKeys structure. +type DeviceServiceGetKeysReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceGetKeysReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceGetKeysOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceGetKeysDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceGetKeysOK creates a DeviceServiceGetKeysOK with default headers values +func NewDeviceServiceGetKeysOK() *DeviceServiceGetKeysOK { + return &DeviceServiceGetKeysOK{} +} + +/* +DeviceServiceGetKeysOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceGetKeysOK struct { + Payload *models.APIGetDeviceKeysResponse +} + +// IsSuccess returns true when this device service get keys o k response has a 2xx status code +func (o *DeviceServiceGetKeysOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service get keys o k response has a 3xx status code +func (o *DeviceServiceGetKeysOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service get keys o k response has a 4xx status code +func (o *DeviceServiceGetKeysOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service get keys o k response has a 5xx status code +func (o *DeviceServiceGetKeysOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service get keys o k response a status code equal to that given +func (o *DeviceServiceGetKeysOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service get keys o k response +func (o *DeviceServiceGetKeysOK) Code() int { + return 200 +} + +func (o *DeviceServiceGetKeysOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/keys][%d] deviceServiceGetKeysOK %s", 200, payload) +} + +func (o *DeviceServiceGetKeysOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/keys][%d] deviceServiceGetKeysOK %s", 200, payload) +} + +func (o *DeviceServiceGetKeysOK) GetPayload() *models.APIGetDeviceKeysResponse { + return o.Payload +} + +func (o *DeviceServiceGetKeysOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetDeviceKeysResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceGetKeysDefault creates a DeviceServiceGetKeysDefault with default headers values +func NewDeviceServiceGetKeysDefault(code int) *DeviceServiceGetKeysDefault { + return &DeviceServiceGetKeysDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceGetKeysDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceGetKeysDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service get keys default response has a 2xx status code +func (o *DeviceServiceGetKeysDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service get keys default response has a 3xx status code +func (o *DeviceServiceGetKeysDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service get keys default response has a 4xx status code +func (o *DeviceServiceGetKeysDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service get keys default response has a 5xx status code +func (o *DeviceServiceGetKeysDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service get keys default response a status code equal to that given +func (o *DeviceServiceGetKeysDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service get keys default response +func (o *DeviceServiceGetKeysDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceGetKeysDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/keys][%d] DeviceService_GetKeys default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetKeysDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/keys][%d] DeviceService_GetKeys default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetKeysDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceGetKeysDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_link_metrics_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_link_metrics_parameters.go new file mode 100644 index 0000000..cd062e9 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_link_metrics_parameters.go @@ -0,0 +1,275 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceGetLinkMetricsParams creates a new DeviceServiceGetLinkMetricsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceGetLinkMetricsParams() *DeviceServiceGetLinkMetricsParams { + return &DeviceServiceGetLinkMetricsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceGetLinkMetricsParamsWithTimeout creates a new DeviceServiceGetLinkMetricsParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceGetLinkMetricsParamsWithTimeout(timeout time.Duration) *DeviceServiceGetLinkMetricsParams { + return &DeviceServiceGetLinkMetricsParams{ + timeout: timeout, + } +} + +// NewDeviceServiceGetLinkMetricsParamsWithContext creates a new DeviceServiceGetLinkMetricsParams object +// with the ability to set a context for a request. +func NewDeviceServiceGetLinkMetricsParamsWithContext(ctx context.Context) *DeviceServiceGetLinkMetricsParams { + return &DeviceServiceGetLinkMetricsParams{ + Context: ctx, + } +} + +// NewDeviceServiceGetLinkMetricsParamsWithHTTPClient creates a new DeviceServiceGetLinkMetricsParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceGetLinkMetricsParamsWithHTTPClient(client *http.Client) *DeviceServiceGetLinkMetricsParams { + return &DeviceServiceGetLinkMetricsParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceGetLinkMetricsParams contains all the parameters to send to the API endpoint + + for the device service get link metrics operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceGetLinkMetricsParams struct { + + /* Aggregation. + + Aggregation. + + - HOUR: Hour. + - DAY: Day. + - MONTH: Month. + - MINUTE: Minute. + + Default: "HOUR" + */ + Aggregation *string + + /* DevEui. + + DevEUI (EUI64). + */ + DevEui string + + /* End. + + Interval end timestamp. + + Format: date-time + */ + End *strfmt.DateTime + + /* Start. + + Interval start timestamp. + + Format: date-time + */ + Start *strfmt.DateTime + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service get link metrics params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetLinkMetricsParams) WithDefaults() *DeviceServiceGetLinkMetricsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service get link metrics params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetLinkMetricsParams) SetDefaults() { + var ( + aggregationDefault = string("HOUR") + ) + + val := DeviceServiceGetLinkMetricsParams{ + Aggregation: &aggregationDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) WithTimeout(timeout time.Duration) *DeviceServiceGetLinkMetricsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) WithContext(ctx context.Context) *DeviceServiceGetLinkMetricsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) WithHTTPClient(client *http.Client) *DeviceServiceGetLinkMetricsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAggregation adds the aggregation to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) WithAggregation(aggregation *string) *DeviceServiceGetLinkMetricsParams { + o.SetAggregation(aggregation) + return o +} + +// SetAggregation adds the aggregation to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) SetAggregation(aggregation *string) { + o.Aggregation = aggregation +} + +// WithDevEui adds the devEui to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) WithDevEui(devEui string) *DeviceServiceGetLinkMetricsParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WithEnd adds the end to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) WithEnd(end *strfmt.DateTime) *DeviceServiceGetLinkMetricsParams { + o.SetEnd(end) + return o +} + +// SetEnd adds the end to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) SetEnd(end *strfmt.DateTime) { + o.End = end +} + +// WithStart adds the start to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) WithStart(start *strfmt.DateTime) *DeviceServiceGetLinkMetricsParams { + o.SetStart(start) + return o +} + +// SetStart adds the start to the device service get link metrics params +func (o *DeviceServiceGetLinkMetricsParams) SetStart(start *strfmt.DateTime) { + o.Start = start +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceGetLinkMetricsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Aggregation != nil { + + // query param aggregation + var qrAggregation string + + if o.Aggregation != nil { + qrAggregation = *o.Aggregation + } + qAggregation := qrAggregation + if qAggregation != "" { + + if err := r.SetQueryParam("aggregation", qAggregation); err != nil { + return err + } + } + } + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + if o.End != nil { + + // query param end + var qrEnd strfmt.DateTime + + if o.End != nil { + qrEnd = *o.End + } + qEnd := qrEnd.String() + if qEnd != "" { + + if err := r.SetQueryParam("end", qEnd); err != nil { + return err + } + } + } + + if o.Start != nil { + + // query param start + var qrStart strfmt.DateTime + + if o.Start != nil { + qrStart = *o.Start + } + qStart := qrStart.String() + if qStart != "" { + + if err := r.SetQueryParam("start", qStart); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_link_metrics_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_link_metrics_responses.go new file mode 100644 index 0000000..997e742 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_link_metrics_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceGetLinkMetricsReader is a Reader for the DeviceServiceGetLinkMetrics structure. +type DeviceServiceGetLinkMetricsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceGetLinkMetricsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceGetLinkMetricsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceGetLinkMetricsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceGetLinkMetricsOK creates a DeviceServiceGetLinkMetricsOK with default headers values +func NewDeviceServiceGetLinkMetricsOK() *DeviceServiceGetLinkMetricsOK { + return &DeviceServiceGetLinkMetricsOK{} +} + +/* +DeviceServiceGetLinkMetricsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceGetLinkMetricsOK struct { + Payload *models.APIGetDeviceLinkMetricsResponse +} + +// IsSuccess returns true when this device service get link metrics o k response has a 2xx status code +func (o *DeviceServiceGetLinkMetricsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service get link metrics o k response has a 3xx status code +func (o *DeviceServiceGetLinkMetricsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service get link metrics o k response has a 4xx status code +func (o *DeviceServiceGetLinkMetricsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service get link metrics o k response has a 5xx status code +func (o *DeviceServiceGetLinkMetricsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service get link metrics o k response a status code equal to that given +func (o *DeviceServiceGetLinkMetricsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service get link metrics o k response +func (o *DeviceServiceGetLinkMetricsOK) Code() int { + return 200 +} + +func (o *DeviceServiceGetLinkMetricsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/link-metrics][%d] deviceServiceGetLinkMetricsOK %s", 200, payload) +} + +func (o *DeviceServiceGetLinkMetricsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/link-metrics][%d] deviceServiceGetLinkMetricsOK %s", 200, payload) +} + +func (o *DeviceServiceGetLinkMetricsOK) GetPayload() *models.APIGetDeviceLinkMetricsResponse { + return o.Payload +} + +func (o *DeviceServiceGetLinkMetricsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetDeviceLinkMetricsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceGetLinkMetricsDefault creates a DeviceServiceGetLinkMetricsDefault with default headers values +func NewDeviceServiceGetLinkMetricsDefault(code int) *DeviceServiceGetLinkMetricsDefault { + return &DeviceServiceGetLinkMetricsDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceGetLinkMetricsDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceGetLinkMetricsDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service get link metrics default response has a 2xx status code +func (o *DeviceServiceGetLinkMetricsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service get link metrics default response has a 3xx status code +func (o *DeviceServiceGetLinkMetricsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service get link metrics default response has a 4xx status code +func (o *DeviceServiceGetLinkMetricsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service get link metrics default response has a 5xx status code +func (o *DeviceServiceGetLinkMetricsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service get link metrics default response a status code equal to that given +func (o *DeviceServiceGetLinkMetricsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service get link metrics default response +func (o *DeviceServiceGetLinkMetricsDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceGetLinkMetricsDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/link-metrics][%d] DeviceService_GetLinkMetrics default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetLinkMetricsDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/link-metrics][%d] DeviceService_GetLinkMetrics default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetLinkMetricsDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceGetLinkMetricsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_metrics_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_metrics_parameters.go new file mode 100644 index 0000000..d024f73 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_metrics_parameters.go @@ -0,0 +1,275 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceGetMetricsParams creates a new DeviceServiceGetMetricsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceGetMetricsParams() *DeviceServiceGetMetricsParams { + return &DeviceServiceGetMetricsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceGetMetricsParamsWithTimeout creates a new DeviceServiceGetMetricsParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceGetMetricsParamsWithTimeout(timeout time.Duration) *DeviceServiceGetMetricsParams { + return &DeviceServiceGetMetricsParams{ + timeout: timeout, + } +} + +// NewDeviceServiceGetMetricsParamsWithContext creates a new DeviceServiceGetMetricsParams object +// with the ability to set a context for a request. +func NewDeviceServiceGetMetricsParamsWithContext(ctx context.Context) *DeviceServiceGetMetricsParams { + return &DeviceServiceGetMetricsParams{ + Context: ctx, + } +} + +// NewDeviceServiceGetMetricsParamsWithHTTPClient creates a new DeviceServiceGetMetricsParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceGetMetricsParamsWithHTTPClient(client *http.Client) *DeviceServiceGetMetricsParams { + return &DeviceServiceGetMetricsParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceGetMetricsParams contains all the parameters to send to the API endpoint + + for the device service get metrics operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceGetMetricsParams struct { + + /* Aggregation. + + Aggregation. + + - HOUR: Hour. + - DAY: Day. + - MONTH: Month. + - MINUTE: Minute. + + Default: "HOUR" + */ + Aggregation *string + + /* DevEui. + + DevEUI (EUI64). + */ + DevEui string + + /* End. + + Interval end timestamp. + + Format: date-time + */ + End *strfmt.DateTime + + /* Start. + + Interval start timestamp. + + Format: date-time + */ + Start *strfmt.DateTime + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service get metrics params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetMetricsParams) WithDefaults() *DeviceServiceGetMetricsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service get metrics params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetMetricsParams) SetDefaults() { + var ( + aggregationDefault = string("HOUR") + ) + + val := DeviceServiceGetMetricsParams{ + Aggregation: &aggregationDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) WithTimeout(timeout time.Duration) *DeviceServiceGetMetricsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) WithContext(ctx context.Context) *DeviceServiceGetMetricsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) WithHTTPClient(client *http.Client) *DeviceServiceGetMetricsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAggregation adds the aggregation to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) WithAggregation(aggregation *string) *DeviceServiceGetMetricsParams { + o.SetAggregation(aggregation) + return o +} + +// SetAggregation adds the aggregation to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) SetAggregation(aggregation *string) { + o.Aggregation = aggregation +} + +// WithDevEui adds the devEui to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) WithDevEui(devEui string) *DeviceServiceGetMetricsParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WithEnd adds the end to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) WithEnd(end *strfmt.DateTime) *DeviceServiceGetMetricsParams { + o.SetEnd(end) + return o +} + +// SetEnd adds the end to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) SetEnd(end *strfmt.DateTime) { + o.End = end +} + +// WithStart adds the start to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) WithStart(start *strfmt.DateTime) *DeviceServiceGetMetricsParams { + o.SetStart(start) + return o +} + +// SetStart adds the start to the device service get metrics params +func (o *DeviceServiceGetMetricsParams) SetStart(start *strfmt.DateTime) { + o.Start = start +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceGetMetricsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Aggregation != nil { + + // query param aggregation + var qrAggregation string + + if o.Aggregation != nil { + qrAggregation = *o.Aggregation + } + qAggregation := qrAggregation + if qAggregation != "" { + + if err := r.SetQueryParam("aggregation", qAggregation); err != nil { + return err + } + } + } + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + if o.End != nil { + + // query param end + var qrEnd strfmt.DateTime + + if o.End != nil { + qrEnd = *o.End + } + qEnd := qrEnd.String() + if qEnd != "" { + + if err := r.SetQueryParam("end", qEnd); err != nil { + return err + } + } + } + + if o.Start != nil { + + // query param start + var qrStart strfmt.DateTime + + if o.Start != nil { + qrStart = *o.Start + } + qStart := qrStart.String() + if qStart != "" { + + if err := r.SetQueryParam("start", qStart); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_metrics_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_metrics_responses.go new file mode 100644 index 0000000..4b14d3d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_metrics_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceGetMetricsReader is a Reader for the DeviceServiceGetMetrics structure. +type DeviceServiceGetMetricsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceGetMetricsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceGetMetricsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceGetMetricsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceGetMetricsOK creates a DeviceServiceGetMetricsOK with default headers values +func NewDeviceServiceGetMetricsOK() *DeviceServiceGetMetricsOK { + return &DeviceServiceGetMetricsOK{} +} + +/* +DeviceServiceGetMetricsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceGetMetricsOK struct { + Payload *models.APIGetDeviceMetricsResponse +} + +// IsSuccess returns true when this device service get metrics o k response has a 2xx status code +func (o *DeviceServiceGetMetricsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service get metrics o k response has a 3xx status code +func (o *DeviceServiceGetMetricsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service get metrics o k response has a 4xx status code +func (o *DeviceServiceGetMetricsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service get metrics o k response has a 5xx status code +func (o *DeviceServiceGetMetricsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service get metrics o k response a status code equal to that given +func (o *DeviceServiceGetMetricsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service get metrics o k response +func (o *DeviceServiceGetMetricsOK) Code() int { + return 200 +} + +func (o *DeviceServiceGetMetricsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/metrics][%d] deviceServiceGetMetricsOK %s", 200, payload) +} + +func (o *DeviceServiceGetMetricsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/metrics][%d] deviceServiceGetMetricsOK %s", 200, payload) +} + +func (o *DeviceServiceGetMetricsOK) GetPayload() *models.APIGetDeviceMetricsResponse { + return o.Payload +} + +func (o *DeviceServiceGetMetricsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetDeviceMetricsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceGetMetricsDefault creates a DeviceServiceGetMetricsDefault with default headers values +func NewDeviceServiceGetMetricsDefault(code int) *DeviceServiceGetMetricsDefault { + return &DeviceServiceGetMetricsDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceGetMetricsDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceGetMetricsDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service get metrics default response has a 2xx status code +func (o *DeviceServiceGetMetricsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service get metrics default response has a 3xx status code +func (o *DeviceServiceGetMetricsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service get metrics default response has a 4xx status code +func (o *DeviceServiceGetMetricsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service get metrics default response has a 5xx status code +func (o *DeviceServiceGetMetricsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service get metrics default response a status code equal to that given +func (o *DeviceServiceGetMetricsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service get metrics default response +func (o *DeviceServiceGetMetricsDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceGetMetricsDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/metrics][%d] DeviceService_GetMetrics default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetMetricsDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/metrics][%d] DeviceService_GetMetrics default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetMetricsDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceGetMetricsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_next_f_cnt_down_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_next_f_cnt_down_parameters.go new file mode 100644 index 0000000..6d08635 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_next_f_cnt_down_parameters.go @@ -0,0 +1,170 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceGetNextFCntDownParams creates a new DeviceServiceGetNextFCntDownParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceGetNextFCntDownParams() *DeviceServiceGetNextFCntDownParams { + return &DeviceServiceGetNextFCntDownParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceGetNextFCntDownParamsWithTimeout creates a new DeviceServiceGetNextFCntDownParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceGetNextFCntDownParamsWithTimeout(timeout time.Duration) *DeviceServiceGetNextFCntDownParams { + return &DeviceServiceGetNextFCntDownParams{ + timeout: timeout, + } +} + +// NewDeviceServiceGetNextFCntDownParamsWithContext creates a new DeviceServiceGetNextFCntDownParams object +// with the ability to set a context for a request. +func NewDeviceServiceGetNextFCntDownParamsWithContext(ctx context.Context) *DeviceServiceGetNextFCntDownParams { + return &DeviceServiceGetNextFCntDownParams{ + Context: ctx, + } +} + +// NewDeviceServiceGetNextFCntDownParamsWithHTTPClient creates a new DeviceServiceGetNextFCntDownParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceGetNextFCntDownParamsWithHTTPClient(client *http.Client) *DeviceServiceGetNextFCntDownParams { + return &DeviceServiceGetNextFCntDownParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceGetNextFCntDownParams contains all the parameters to send to the API endpoint + + for the device service get next f cnt down operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceGetNextFCntDownParams struct { + + // Body. + Body interface{} + + /* DevEui. + + Device EUI (EUI64). + */ + DevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service get next f cnt down params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetNextFCntDownParams) WithDefaults() *DeviceServiceGetNextFCntDownParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service get next f cnt down params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetNextFCntDownParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service get next f cnt down params +func (o *DeviceServiceGetNextFCntDownParams) WithTimeout(timeout time.Duration) *DeviceServiceGetNextFCntDownParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service get next f cnt down params +func (o *DeviceServiceGetNextFCntDownParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service get next f cnt down params +func (o *DeviceServiceGetNextFCntDownParams) WithContext(ctx context.Context) *DeviceServiceGetNextFCntDownParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service get next f cnt down params +func (o *DeviceServiceGetNextFCntDownParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service get next f cnt down params +func (o *DeviceServiceGetNextFCntDownParams) WithHTTPClient(client *http.Client) *DeviceServiceGetNextFCntDownParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service get next f cnt down params +func (o *DeviceServiceGetNextFCntDownParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the device service get next f cnt down params +func (o *DeviceServiceGetNextFCntDownParams) WithBody(body interface{}) *DeviceServiceGetNextFCntDownParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the device service get next f cnt down params +func (o *DeviceServiceGetNextFCntDownParams) SetBody(body interface{}) { + o.Body = body +} + +// WithDevEui adds the devEui to the device service get next f cnt down params +func (o *DeviceServiceGetNextFCntDownParams) WithDevEui(devEui string) *DeviceServiceGetNextFCntDownParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the device service get next f cnt down params +func (o *DeviceServiceGetNextFCntDownParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceGetNextFCntDownParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_next_f_cnt_down_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_next_f_cnt_down_responses.go new file mode 100644 index 0000000..a143a3a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_next_f_cnt_down_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceGetNextFCntDownReader is a Reader for the DeviceServiceGetNextFCntDown structure. +type DeviceServiceGetNextFCntDownReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceGetNextFCntDownReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceGetNextFCntDownOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceGetNextFCntDownDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceGetNextFCntDownOK creates a DeviceServiceGetNextFCntDownOK with default headers values +func NewDeviceServiceGetNextFCntDownOK() *DeviceServiceGetNextFCntDownOK { + return &DeviceServiceGetNextFCntDownOK{} +} + +/* +DeviceServiceGetNextFCntDownOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceGetNextFCntDownOK struct { + Payload *models.APIGetDeviceNextFCntDownResponse +} + +// IsSuccess returns true when this device service get next f cnt down o k response has a 2xx status code +func (o *DeviceServiceGetNextFCntDownOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service get next f cnt down o k response has a 3xx status code +func (o *DeviceServiceGetNextFCntDownOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service get next f cnt down o k response has a 4xx status code +func (o *DeviceServiceGetNextFCntDownOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service get next f cnt down o k response has a 5xx status code +func (o *DeviceServiceGetNextFCntDownOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service get next f cnt down o k response a status code equal to that given +func (o *DeviceServiceGetNextFCntDownOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service get next f cnt down o k response +func (o *DeviceServiceGetNextFCntDownOK) Code() int { + return 200 +} + +func (o *DeviceServiceGetNextFCntDownOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{devEui}/get-next-f-cnt-down][%d] deviceServiceGetNextFCntDownOK %s", 200, payload) +} + +func (o *DeviceServiceGetNextFCntDownOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{devEui}/get-next-f-cnt-down][%d] deviceServiceGetNextFCntDownOK %s", 200, payload) +} + +func (o *DeviceServiceGetNextFCntDownOK) GetPayload() *models.APIGetDeviceNextFCntDownResponse { + return o.Payload +} + +func (o *DeviceServiceGetNextFCntDownOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetDeviceNextFCntDownResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceGetNextFCntDownDefault creates a DeviceServiceGetNextFCntDownDefault with default headers values +func NewDeviceServiceGetNextFCntDownDefault(code int) *DeviceServiceGetNextFCntDownDefault { + return &DeviceServiceGetNextFCntDownDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceGetNextFCntDownDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceGetNextFCntDownDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service get next f cnt down default response has a 2xx status code +func (o *DeviceServiceGetNextFCntDownDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service get next f cnt down default response has a 3xx status code +func (o *DeviceServiceGetNextFCntDownDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service get next f cnt down default response has a 4xx status code +func (o *DeviceServiceGetNextFCntDownDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service get next f cnt down default response has a 5xx status code +func (o *DeviceServiceGetNextFCntDownDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service get next f cnt down default response a status code equal to that given +func (o *DeviceServiceGetNextFCntDownDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service get next f cnt down default response +func (o *DeviceServiceGetNextFCntDownDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceGetNextFCntDownDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{devEui}/get-next-f-cnt-down][%d] DeviceService_GetNextFCntDown default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetNextFCntDownDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{devEui}/get-next-f-cnt-down][%d] DeviceService_GetNextFCntDown default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetNextFCntDownDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceGetNextFCntDownDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_parameters.go new file mode 100644 index 0000000..a9b8a51 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceGetParams creates a new DeviceServiceGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceGetParams() *DeviceServiceGetParams { + return &DeviceServiceGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceGetParamsWithTimeout creates a new DeviceServiceGetParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceGetParamsWithTimeout(timeout time.Duration) *DeviceServiceGetParams { + return &DeviceServiceGetParams{ + timeout: timeout, + } +} + +// NewDeviceServiceGetParamsWithContext creates a new DeviceServiceGetParams object +// with the ability to set a context for a request. +func NewDeviceServiceGetParamsWithContext(ctx context.Context) *DeviceServiceGetParams { + return &DeviceServiceGetParams{ + Context: ctx, + } +} + +// NewDeviceServiceGetParamsWithHTTPClient creates a new DeviceServiceGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceGetParamsWithHTTPClient(client *http.Client) *DeviceServiceGetParams { + return &DeviceServiceGetParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceGetParams contains all the parameters to send to the API endpoint + + for the device service get operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceGetParams struct { + + /* DevEui. + + DevEUI (EUI64). + */ + DevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetParams) WithDefaults() *DeviceServiceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service get params +func (o *DeviceServiceGetParams) WithTimeout(timeout time.Duration) *DeviceServiceGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service get params +func (o *DeviceServiceGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service get params +func (o *DeviceServiceGetParams) WithContext(ctx context.Context) *DeviceServiceGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service get params +func (o *DeviceServiceGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service get params +func (o *DeviceServiceGetParams) WithHTTPClient(client *http.Client) *DeviceServiceGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service get params +func (o *DeviceServiceGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDevEui adds the devEui to the device service get params +func (o *DeviceServiceGetParams) WithDevEui(devEui string) *DeviceServiceGetParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the device service get params +func (o *DeviceServiceGetParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_queue_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_queue_parameters.go new file mode 100644 index 0000000..b610cb6 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_queue_parameters.go @@ -0,0 +1,186 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewDeviceServiceGetQueueParams creates a new DeviceServiceGetQueueParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceGetQueueParams() *DeviceServiceGetQueueParams { + return &DeviceServiceGetQueueParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceGetQueueParamsWithTimeout creates a new DeviceServiceGetQueueParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceGetQueueParamsWithTimeout(timeout time.Duration) *DeviceServiceGetQueueParams { + return &DeviceServiceGetQueueParams{ + timeout: timeout, + } +} + +// NewDeviceServiceGetQueueParamsWithContext creates a new DeviceServiceGetQueueParams object +// with the ability to set a context for a request. +func NewDeviceServiceGetQueueParamsWithContext(ctx context.Context) *DeviceServiceGetQueueParams { + return &DeviceServiceGetQueueParams{ + Context: ctx, + } +} + +// NewDeviceServiceGetQueueParamsWithHTTPClient creates a new DeviceServiceGetQueueParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceGetQueueParamsWithHTTPClient(client *http.Client) *DeviceServiceGetQueueParams { + return &DeviceServiceGetQueueParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceGetQueueParams contains all the parameters to send to the API endpoint + + for the device service get queue operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceGetQueueParams struct { + + /* CountOnly. + + Return only the count, not the result-set. + */ + CountOnly *bool + + /* DevEui. + + Device EUI (EUI64). + */ + DevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service get queue params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetQueueParams) WithDefaults() *DeviceServiceGetQueueParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service get queue params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetQueueParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service get queue params +func (o *DeviceServiceGetQueueParams) WithTimeout(timeout time.Duration) *DeviceServiceGetQueueParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service get queue params +func (o *DeviceServiceGetQueueParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service get queue params +func (o *DeviceServiceGetQueueParams) WithContext(ctx context.Context) *DeviceServiceGetQueueParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service get queue params +func (o *DeviceServiceGetQueueParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service get queue params +func (o *DeviceServiceGetQueueParams) WithHTTPClient(client *http.Client) *DeviceServiceGetQueueParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service get queue params +func (o *DeviceServiceGetQueueParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCountOnly adds the countOnly to the device service get queue params +func (o *DeviceServiceGetQueueParams) WithCountOnly(countOnly *bool) *DeviceServiceGetQueueParams { + o.SetCountOnly(countOnly) + return o +} + +// SetCountOnly adds the countOnly to the device service get queue params +func (o *DeviceServiceGetQueueParams) SetCountOnly(countOnly *bool) { + o.CountOnly = countOnly +} + +// WithDevEui adds the devEui to the device service get queue params +func (o *DeviceServiceGetQueueParams) WithDevEui(devEui string) *DeviceServiceGetQueueParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the device service get queue params +func (o *DeviceServiceGetQueueParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceGetQueueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.CountOnly != nil { + + // query param countOnly + var qrCountOnly bool + + if o.CountOnly != nil { + qrCountOnly = *o.CountOnly + } + qCountOnly := swag.FormatBool(qrCountOnly) + if qCountOnly != "" { + + if err := r.SetQueryParam("countOnly", qCountOnly); err != nil { + return err + } + } + } + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_queue_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_queue_responses.go new file mode 100644 index 0000000..66a3b75 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_queue_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceGetQueueReader is a Reader for the DeviceServiceGetQueue structure. +type DeviceServiceGetQueueReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceGetQueueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceGetQueueOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceGetQueueDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceGetQueueOK creates a DeviceServiceGetQueueOK with default headers values +func NewDeviceServiceGetQueueOK() *DeviceServiceGetQueueOK { + return &DeviceServiceGetQueueOK{} +} + +/* +DeviceServiceGetQueueOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceGetQueueOK struct { + Payload *models.APIGetDeviceQueueItemsResponse +} + +// IsSuccess returns true when this device service get queue o k response has a 2xx status code +func (o *DeviceServiceGetQueueOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service get queue o k response has a 3xx status code +func (o *DeviceServiceGetQueueOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service get queue o k response has a 4xx status code +func (o *DeviceServiceGetQueueOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service get queue o k response has a 5xx status code +func (o *DeviceServiceGetQueueOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service get queue o k response a status code equal to that given +func (o *DeviceServiceGetQueueOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service get queue o k response +func (o *DeviceServiceGetQueueOK) Code() int { + return 200 +} + +func (o *DeviceServiceGetQueueOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/queue][%d] deviceServiceGetQueueOK %s", 200, payload) +} + +func (o *DeviceServiceGetQueueOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/queue][%d] deviceServiceGetQueueOK %s", 200, payload) +} + +func (o *DeviceServiceGetQueueOK) GetPayload() *models.APIGetDeviceQueueItemsResponse { + return o.Payload +} + +func (o *DeviceServiceGetQueueOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetDeviceQueueItemsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceGetQueueDefault creates a DeviceServiceGetQueueDefault with default headers values +func NewDeviceServiceGetQueueDefault(code int) *DeviceServiceGetQueueDefault { + return &DeviceServiceGetQueueDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceGetQueueDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceGetQueueDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service get queue default response has a 2xx status code +func (o *DeviceServiceGetQueueDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service get queue default response has a 3xx status code +func (o *DeviceServiceGetQueueDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service get queue default response has a 4xx status code +func (o *DeviceServiceGetQueueDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service get queue default response has a 5xx status code +func (o *DeviceServiceGetQueueDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service get queue default response a status code equal to that given +func (o *DeviceServiceGetQueueDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service get queue default response +func (o *DeviceServiceGetQueueDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceGetQueueDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/queue][%d] DeviceService_GetQueue default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetQueueDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}/queue][%d] DeviceService_GetQueue default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetQueueDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceGetQueueDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_random_dev_addr_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_random_dev_addr_parameters.go new file mode 100644 index 0000000..be6502c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_random_dev_addr_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceGetRandomDevAddrParams creates a new DeviceServiceGetRandomDevAddrParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceGetRandomDevAddrParams() *DeviceServiceGetRandomDevAddrParams { + return &DeviceServiceGetRandomDevAddrParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceGetRandomDevAddrParamsWithTimeout creates a new DeviceServiceGetRandomDevAddrParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceGetRandomDevAddrParamsWithTimeout(timeout time.Duration) *DeviceServiceGetRandomDevAddrParams { + return &DeviceServiceGetRandomDevAddrParams{ + timeout: timeout, + } +} + +// NewDeviceServiceGetRandomDevAddrParamsWithContext creates a new DeviceServiceGetRandomDevAddrParams object +// with the ability to set a context for a request. +func NewDeviceServiceGetRandomDevAddrParamsWithContext(ctx context.Context) *DeviceServiceGetRandomDevAddrParams { + return &DeviceServiceGetRandomDevAddrParams{ + Context: ctx, + } +} + +// NewDeviceServiceGetRandomDevAddrParamsWithHTTPClient creates a new DeviceServiceGetRandomDevAddrParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceGetRandomDevAddrParamsWithHTTPClient(client *http.Client) *DeviceServiceGetRandomDevAddrParams { + return &DeviceServiceGetRandomDevAddrParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceGetRandomDevAddrParams contains all the parameters to send to the API endpoint + + for the device service get random dev addr operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceGetRandomDevAddrParams struct { + + /* DevEui. + + DevEUI (EUI64). + */ + DevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service get random dev addr params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetRandomDevAddrParams) WithDefaults() *DeviceServiceGetRandomDevAddrParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service get random dev addr params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceGetRandomDevAddrParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service get random dev addr params +func (o *DeviceServiceGetRandomDevAddrParams) WithTimeout(timeout time.Duration) *DeviceServiceGetRandomDevAddrParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service get random dev addr params +func (o *DeviceServiceGetRandomDevAddrParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service get random dev addr params +func (o *DeviceServiceGetRandomDevAddrParams) WithContext(ctx context.Context) *DeviceServiceGetRandomDevAddrParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service get random dev addr params +func (o *DeviceServiceGetRandomDevAddrParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service get random dev addr params +func (o *DeviceServiceGetRandomDevAddrParams) WithHTTPClient(client *http.Client) *DeviceServiceGetRandomDevAddrParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service get random dev addr params +func (o *DeviceServiceGetRandomDevAddrParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDevEui adds the devEui to the device service get random dev addr params +func (o *DeviceServiceGetRandomDevAddrParams) WithDevEui(devEui string) *DeviceServiceGetRandomDevAddrParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the device service get random dev addr params +func (o *DeviceServiceGetRandomDevAddrParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceGetRandomDevAddrParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_random_dev_addr_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_random_dev_addr_responses.go new file mode 100644 index 0000000..4f93f10 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_random_dev_addr_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceGetRandomDevAddrReader is a Reader for the DeviceServiceGetRandomDevAddr structure. +type DeviceServiceGetRandomDevAddrReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceGetRandomDevAddrReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceGetRandomDevAddrOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceGetRandomDevAddrDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceGetRandomDevAddrOK creates a DeviceServiceGetRandomDevAddrOK with default headers values +func NewDeviceServiceGetRandomDevAddrOK() *DeviceServiceGetRandomDevAddrOK { + return &DeviceServiceGetRandomDevAddrOK{} +} + +/* +DeviceServiceGetRandomDevAddrOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceGetRandomDevAddrOK struct { + Payload *models.APIGetRandomDevAddrResponse +} + +// IsSuccess returns true when this device service get random dev addr o k response has a 2xx status code +func (o *DeviceServiceGetRandomDevAddrOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service get random dev addr o k response has a 3xx status code +func (o *DeviceServiceGetRandomDevAddrOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service get random dev addr o k response has a 4xx status code +func (o *DeviceServiceGetRandomDevAddrOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service get random dev addr o k response has a 5xx status code +func (o *DeviceServiceGetRandomDevAddrOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service get random dev addr o k response a status code equal to that given +func (o *DeviceServiceGetRandomDevAddrOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service get random dev addr o k response +func (o *DeviceServiceGetRandomDevAddrOK) Code() int { + return 200 +} + +func (o *DeviceServiceGetRandomDevAddrOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{devEui}/get-random-dev-addr][%d] deviceServiceGetRandomDevAddrOK %s", 200, payload) +} + +func (o *DeviceServiceGetRandomDevAddrOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{devEui}/get-random-dev-addr][%d] deviceServiceGetRandomDevAddrOK %s", 200, payload) +} + +func (o *DeviceServiceGetRandomDevAddrOK) GetPayload() *models.APIGetRandomDevAddrResponse { + return o.Payload +} + +func (o *DeviceServiceGetRandomDevAddrOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetRandomDevAddrResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceGetRandomDevAddrDefault creates a DeviceServiceGetRandomDevAddrDefault with default headers values +func NewDeviceServiceGetRandomDevAddrDefault(code int) *DeviceServiceGetRandomDevAddrDefault { + return &DeviceServiceGetRandomDevAddrDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceGetRandomDevAddrDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceGetRandomDevAddrDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service get random dev addr default response has a 2xx status code +func (o *DeviceServiceGetRandomDevAddrDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service get random dev addr default response has a 3xx status code +func (o *DeviceServiceGetRandomDevAddrDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service get random dev addr default response has a 4xx status code +func (o *DeviceServiceGetRandomDevAddrDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service get random dev addr default response has a 5xx status code +func (o *DeviceServiceGetRandomDevAddrDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service get random dev addr default response a status code equal to that given +func (o *DeviceServiceGetRandomDevAddrDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service get random dev addr default response +func (o *DeviceServiceGetRandomDevAddrDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceGetRandomDevAddrDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{devEui}/get-random-dev-addr][%d] DeviceService_GetRandomDevAddr default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetRandomDevAddrDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/devices/{devEui}/get-random-dev-addr][%d] DeviceService_GetRandomDevAddr default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetRandomDevAddrDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceGetRandomDevAddrDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_responses.go new file mode 100644 index 0000000..e581fa5 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_get_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceGetReader is a Reader for the DeviceServiceGet structure. +type DeviceServiceGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceGetDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceGetOK creates a DeviceServiceGetOK with default headers values +func NewDeviceServiceGetOK() *DeviceServiceGetOK { + return &DeviceServiceGetOK{} +} + +/* +DeviceServiceGetOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceGetOK struct { + Payload *models.APIGetDeviceResponse +} + +// IsSuccess returns true when this device service get o k response has a 2xx status code +func (o *DeviceServiceGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service get o k response has a 3xx status code +func (o *DeviceServiceGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service get o k response has a 4xx status code +func (o *DeviceServiceGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service get o k response has a 5xx status code +func (o *DeviceServiceGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service get o k response a status code equal to that given +func (o *DeviceServiceGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service get o k response +func (o *DeviceServiceGetOK) Code() int { + return 200 +} + +func (o *DeviceServiceGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}][%d] deviceServiceGetOK %s", 200, payload) +} + +func (o *DeviceServiceGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}][%d] deviceServiceGetOK %s", 200, payload) +} + +func (o *DeviceServiceGetOK) GetPayload() *models.APIGetDeviceResponse { + return o.Payload +} + +func (o *DeviceServiceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetDeviceResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceGetDefault creates a DeviceServiceGetDefault with default headers values +func NewDeviceServiceGetDefault(code int) *DeviceServiceGetDefault { + return &DeviceServiceGetDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceGetDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceGetDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service get default response has a 2xx status code +func (o *DeviceServiceGetDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service get default response has a 3xx status code +func (o *DeviceServiceGetDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service get default response has a 4xx status code +func (o *DeviceServiceGetDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service get default response has a 5xx status code +func (o *DeviceServiceGetDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service get default response a status code equal to that given +func (o *DeviceServiceGetDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service get default response +func (o *DeviceServiceGetDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceGetDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}][%d] DeviceService_Get default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices/{devEui}][%d] DeviceService_Get default %s", o._statusCode, payload) +} + +func (o *DeviceServiceGetDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceGetDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_list_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_list_parameters.go new file mode 100644 index 0000000..ce0d81b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_list_parameters.go @@ -0,0 +1,420 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewDeviceServiceListParams creates a new DeviceServiceListParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceListParams() *DeviceServiceListParams { + return &DeviceServiceListParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceListParamsWithTimeout creates a new DeviceServiceListParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceListParamsWithTimeout(timeout time.Duration) *DeviceServiceListParams { + return &DeviceServiceListParams{ + timeout: timeout, + } +} + +// NewDeviceServiceListParamsWithContext creates a new DeviceServiceListParams object +// with the ability to set a context for a request. +func NewDeviceServiceListParamsWithContext(ctx context.Context) *DeviceServiceListParams { + return &DeviceServiceListParams{ + Context: ctx, + } +} + +// NewDeviceServiceListParamsWithHTTPClient creates a new DeviceServiceListParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceListParamsWithHTTPClient(client *http.Client) *DeviceServiceListParams { + return &DeviceServiceListParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceListParams contains all the parameters to send to the API endpoint + + for the device service list operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceListParams struct { + + /* ApplicationID. + + Application ID (UUID) to filter devices on. + */ + ApplicationID *string + + /* DeviceProfileID. + + Device-profile ID (UUID) to filter devices on. + */ + DeviceProfileID *string + + /* Limit. + + Max number of devices to return in the result-set. + If not set, it will be treated as 0, and the response will only return the total_count. + + Format: int64 + */ + Limit *int64 + + /* MulticastGroupID. + + Multicst-group ID (UUID) to filter devices on. + */ + MulticastGroupID *string + + /* Offset. + + Offset in the result-set (for pagination). + + Format: int64 + */ + Offset *int64 + + /* OrderBy. + + If set, the given value will be used to sort by (optional). + + Default: "NAME" + */ + OrderBy *string + + /* OrderByDesc. + + If set, the sorting direction will be decending (default = ascending) (optional). + */ + OrderByDesc *bool + + /* Search. + + If set, the given string will be used to search on name (optional). + */ + Search *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceListParams) WithDefaults() *DeviceServiceListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceListParams) SetDefaults() { + var ( + orderByDefault = string("NAME") + ) + + val := DeviceServiceListParams{ + OrderBy: &orderByDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the device service list params +func (o *DeviceServiceListParams) WithTimeout(timeout time.Duration) *DeviceServiceListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service list params +func (o *DeviceServiceListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service list params +func (o *DeviceServiceListParams) WithContext(ctx context.Context) *DeviceServiceListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service list params +func (o *DeviceServiceListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service list params +func (o *DeviceServiceListParams) WithHTTPClient(client *http.Client) *DeviceServiceListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service list params +func (o *DeviceServiceListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the device service list params +func (o *DeviceServiceListParams) WithApplicationID(applicationID *string) *DeviceServiceListParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the device service list params +func (o *DeviceServiceListParams) SetApplicationID(applicationID *string) { + o.ApplicationID = applicationID +} + +// WithDeviceProfileID adds the deviceProfileID to the device service list params +func (o *DeviceServiceListParams) WithDeviceProfileID(deviceProfileID *string) *DeviceServiceListParams { + o.SetDeviceProfileID(deviceProfileID) + return o +} + +// SetDeviceProfileID adds the deviceProfileId to the device service list params +func (o *DeviceServiceListParams) SetDeviceProfileID(deviceProfileID *string) { + o.DeviceProfileID = deviceProfileID +} + +// WithLimit adds the limit to the device service list params +func (o *DeviceServiceListParams) WithLimit(limit *int64) *DeviceServiceListParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the device service list params +func (o *DeviceServiceListParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMulticastGroupID adds the multicastGroupID to the device service list params +func (o *DeviceServiceListParams) WithMulticastGroupID(multicastGroupID *string) *DeviceServiceListParams { + o.SetMulticastGroupID(multicastGroupID) + return o +} + +// SetMulticastGroupID adds the multicastGroupId to the device service list params +func (o *DeviceServiceListParams) SetMulticastGroupID(multicastGroupID *string) { + o.MulticastGroupID = multicastGroupID +} + +// WithOffset adds the offset to the device service list params +func (o *DeviceServiceListParams) WithOffset(offset *int64) *DeviceServiceListParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the device service list params +func (o *DeviceServiceListParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithOrderBy adds the orderBy to the device service list params +func (o *DeviceServiceListParams) WithOrderBy(orderBy *string) *DeviceServiceListParams { + o.SetOrderBy(orderBy) + return o +} + +// SetOrderBy adds the orderBy to the device service list params +func (o *DeviceServiceListParams) SetOrderBy(orderBy *string) { + o.OrderBy = orderBy +} + +// WithOrderByDesc adds the orderByDesc to the device service list params +func (o *DeviceServiceListParams) WithOrderByDesc(orderByDesc *bool) *DeviceServiceListParams { + o.SetOrderByDesc(orderByDesc) + return o +} + +// SetOrderByDesc adds the orderByDesc to the device service list params +func (o *DeviceServiceListParams) SetOrderByDesc(orderByDesc *bool) { + o.OrderByDesc = orderByDesc +} + +// WithSearch adds the search to the device service list params +func (o *DeviceServiceListParams) WithSearch(search *string) *DeviceServiceListParams { + o.SetSearch(search) + return o +} + +// SetSearch adds the search to the device service list params +func (o *DeviceServiceListParams) SetSearch(search *string) { + o.Search = search +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ApplicationID != nil { + + // query param applicationId + var qrApplicationID string + + if o.ApplicationID != nil { + qrApplicationID = *o.ApplicationID + } + qApplicationID := qrApplicationID + if qApplicationID != "" { + + if err := r.SetQueryParam("applicationId", qApplicationID); err != nil { + return err + } + } + } + + if o.DeviceProfileID != nil { + + // query param deviceProfileId + var qrDeviceProfileID string + + if o.DeviceProfileID != nil { + qrDeviceProfileID = *o.DeviceProfileID + } + qDeviceProfileID := qrDeviceProfileID + if qDeviceProfileID != "" { + + if err := r.SetQueryParam("deviceProfileId", qDeviceProfileID); err != nil { + return err + } + } + } + + if o.Limit != nil { + + // query param limit + var qrLimit int64 + + if o.Limit != nil { + qrLimit = *o.Limit + } + qLimit := swag.FormatInt64(qrLimit) + if qLimit != "" { + + if err := r.SetQueryParam("limit", qLimit); err != nil { + return err + } + } + } + + if o.MulticastGroupID != nil { + + // query param multicastGroupId + var qrMulticastGroupID string + + if o.MulticastGroupID != nil { + qrMulticastGroupID = *o.MulticastGroupID + } + qMulticastGroupID := qrMulticastGroupID + if qMulticastGroupID != "" { + + if err := r.SetQueryParam("multicastGroupId", qMulticastGroupID); err != nil { + return err + } + } + } + + if o.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + if o.OrderBy != nil { + + // query param orderBy + var qrOrderBy string + + if o.OrderBy != nil { + qrOrderBy = *o.OrderBy + } + qOrderBy := qrOrderBy + if qOrderBy != "" { + + if err := r.SetQueryParam("orderBy", qOrderBy); err != nil { + return err + } + } + } + + if o.OrderByDesc != nil { + + // query param orderByDesc + var qrOrderByDesc bool + + if o.OrderByDesc != nil { + qrOrderByDesc = *o.OrderByDesc + } + qOrderByDesc := swag.FormatBool(qrOrderByDesc) + if qOrderByDesc != "" { + + if err := r.SetQueryParam("orderByDesc", qOrderByDesc); err != nil { + return err + } + } + } + + if o.Search != nil { + + // query param search + var qrSearch string + + if o.Search != nil { + qrSearch = *o.Search + } + qSearch := qrSearch + if qSearch != "" { + + if err := r.SetQueryParam("search", qSearch); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_list_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_list_responses.go new file mode 100644 index 0000000..2629f84 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_list_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceListReader is a Reader for the DeviceServiceList structure. +type DeviceServiceListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceListDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceListOK creates a DeviceServiceListOK with default headers values +func NewDeviceServiceListOK() *DeviceServiceListOK { + return &DeviceServiceListOK{} +} + +/* +DeviceServiceListOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceListOK struct { + Payload *models.APIListDevicesResponse +} + +// IsSuccess returns true when this device service list o k response has a 2xx status code +func (o *DeviceServiceListOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service list o k response has a 3xx status code +func (o *DeviceServiceListOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service list o k response has a 4xx status code +func (o *DeviceServiceListOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service list o k response has a 5xx status code +func (o *DeviceServiceListOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service list o k response a status code equal to that given +func (o *DeviceServiceListOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service list o k response +func (o *DeviceServiceListOK) Code() int { + return 200 +} + +func (o *DeviceServiceListOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices][%d] deviceServiceListOK %s", 200, payload) +} + +func (o *DeviceServiceListOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices][%d] deviceServiceListOK %s", 200, payload) +} + +func (o *DeviceServiceListOK) GetPayload() *models.APIListDevicesResponse { + return o.Payload +} + +func (o *DeviceServiceListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListDevicesResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceListDefault creates a DeviceServiceListDefault with default headers values +func NewDeviceServiceListDefault(code int) *DeviceServiceListDefault { + return &DeviceServiceListDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceListDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceListDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service list default response has a 2xx status code +func (o *DeviceServiceListDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service list default response has a 3xx status code +func (o *DeviceServiceListDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service list default response has a 4xx status code +func (o *DeviceServiceListDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service list default response has a 5xx status code +func (o *DeviceServiceListDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service list default response a status code equal to that given +func (o *DeviceServiceListDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service list default response +func (o *DeviceServiceListDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceListDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices][%d] DeviceService_List default %s", o._statusCode, payload) +} + +func (o *DeviceServiceListDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/devices][%d] DeviceService_List default %s", o._statusCode, payload) +} + +func (o *DeviceServiceListDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceListDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_update_keys_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_update_keys_parameters.go new file mode 100644 index 0000000..5b1e106 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_update_keys_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceUpdateKeysParams creates a new DeviceServiceUpdateKeysParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceUpdateKeysParams() *DeviceServiceUpdateKeysParams { + return &DeviceServiceUpdateKeysParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceUpdateKeysParamsWithTimeout creates a new DeviceServiceUpdateKeysParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceUpdateKeysParamsWithTimeout(timeout time.Duration) *DeviceServiceUpdateKeysParams { + return &DeviceServiceUpdateKeysParams{ + timeout: timeout, + } +} + +// NewDeviceServiceUpdateKeysParamsWithContext creates a new DeviceServiceUpdateKeysParams object +// with the ability to set a context for a request. +func NewDeviceServiceUpdateKeysParamsWithContext(ctx context.Context) *DeviceServiceUpdateKeysParams { + return &DeviceServiceUpdateKeysParams{ + Context: ctx, + } +} + +// NewDeviceServiceUpdateKeysParamsWithHTTPClient creates a new DeviceServiceUpdateKeysParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceUpdateKeysParamsWithHTTPClient(client *http.Client) *DeviceServiceUpdateKeysParams { + return &DeviceServiceUpdateKeysParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceUpdateKeysParams contains all the parameters to send to the API endpoint + + for the device service update keys operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceUpdateKeysParams struct { + + // Body. + Body DeviceServiceUpdateKeysBody + + /* DeviceKeysDevEui. + + DevEUI (EUI64). + */ + DeviceKeysDevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service update keys params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceUpdateKeysParams) WithDefaults() *DeviceServiceUpdateKeysParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service update keys params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceUpdateKeysParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service update keys params +func (o *DeviceServiceUpdateKeysParams) WithTimeout(timeout time.Duration) *DeviceServiceUpdateKeysParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service update keys params +func (o *DeviceServiceUpdateKeysParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service update keys params +func (o *DeviceServiceUpdateKeysParams) WithContext(ctx context.Context) *DeviceServiceUpdateKeysParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service update keys params +func (o *DeviceServiceUpdateKeysParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service update keys params +func (o *DeviceServiceUpdateKeysParams) WithHTTPClient(client *http.Client) *DeviceServiceUpdateKeysParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service update keys params +func (o *DeviceServiceUpdateKeysParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the device service update keys params +func (o *DeviceServiceUpdateKeysParams) WithBody(body DeviceServiceUpdateKeysBody) *DeviceServiceUpdateKeysParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the device service update keys params +func (o *DeviceServiceUpdateKeysParams) SetBody(body DeviceServiceUpdateKeysBody) { + o.Body = body +} + +// WithDeviceKeysDevEui adds the deviceKeysDevEui to the device service update keys params +func (o *DeviceServiceUpdateKeysParams) WithDeviceKeysDevEui(deviceKeysDevEui string) *DeviceServiceUpdateKeysParams { + o.SetDeviceKeysDevEui(deviceKeysDevEui) + return o +} + +// SetDeviceKeysDevEui adds the deviceKeysDevEui to the device service update keys params +func (o *DeviceServiceUpdateKeysParams) SetDeviceKeysDevEui(deviceKeysDevEui string) { + o.DeviceKeysDevEui = deviceKeysDevEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceUpdateKeysParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param deviceKeys.devEui + if err := r.SetPathParam("deviceKeys.devEui", o.DeviceKeysDevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_update_keys_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_update_keys_responses.go new file mode 100644 index 0000000..6d78b4e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_update_keys_responses.go @@ -0,0 +1,332 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceUpdateKeysReader is a Reader for the DeviceServiceUpdateKeys structure. +type DeviceServiceUpdateKeysReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceUpdateKeysReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceUpdateKeysOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceUpdateKeysDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceUpdateKeysOK creates a DeviceServiceUpdateKeysOK with default headers values +func NewDeviceServiceUpdateKeysOK() *DeviceServiceUpdateKeysOK { + return &DeviceServiceUpdateKeysOK{} +} + +/* +DeviceServiceUpdateKeysOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceUpdateKeysOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device service update keys o k response has a 2xx status code +func (o *DeviceServiceUpdateKeysOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service update keys o k response has a 3xx status code +func (o *DeviceServiceUpdateKeysOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service update keys o k response has a 4xx status code +func (o *DeviceServiceUpdateKeysOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service update keys o k response has a 5xx status code +func (o *DeviceServiceUpdateKeysOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service update keys o k response a status code equal to that given +func (o *DeviceServiceUpdateKeysOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service update keys o k response +func (o *DeviceServiceUpdateKeysOK) Code() int { + return 200 +} + +func (o *DeviceServiceUpdateKeysOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/devices/{deviceKeys.devEui}/keys][%d] deviceServiceUpdateKeysOK %s", 200, payload) +} + +func (o *DeviceServiceUpdateKeysOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/devices/{deviceKeys.devEui}/keys][%d] deviceServiceUpdateKeysOK %s", 200, payload) +} + +func (o *DeviceServiceUpdateKeysOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceServiceUpdateKeysOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceUpdateKeysDefault creates a DeviceServiceUpdateKeysDefault with default headers values +func NewDeviceServiceUpdateKeysDefault(code int) *DeviceServiceUpdateKeysDefault { + return &DeviceServiceUpdateKeysDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceUpdateKeysDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceUpdateKeysDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service update keys default response has a 2xx status code +func (o *DeviceServiceUpdateKeysDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service update keys default response has a 3xx status code +func (o *DeviceServiceUpdateKeysDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service update keys default response has a 4xx status code +func (o *DeviceServiceUpdateKeysDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service update keys default response has a 5xx status code +func (o *DeviceServiceUpdateKeysDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service update keys default response a status code equal to that given +func (o *DeviceServiceUpdateKeysDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service update keys default response +func (o *DeviceServiceUpdateKeysDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceUpdateKeysDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/devices/{deviceKeys.devEui}/keys][%d] DeviceService_UpdateKeys default %s", o._statusCode, payload) +} + +func (o *DeviceServiceUpdateKeysDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/devices/{deviceKeys.devEui}/keys][%d] DeviceService_UpdateKeys default %s", o._statusCode, payload) +} + +func (o *DeviceServiceUpdateKeysDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceUpdateKeysDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +DeviceServiceUpdateKeysBody device service update keys body +swagger:model DeviceServiceUpdateKeysBody +*/ +type DeviceServiceUpdateKeysBody struct { + + // device keys + DeviceKeys *DeviceServiceUpdateKeysParamsBodyDeviceKeys `json:"deviceKeys,omitempty"` +} + +// Validate validates this device service update keys body +func (o *DeviceServiceUpdateKeysBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateDeviceKeys(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceServiceUpdateKeysBody) validateDeviceKeys(formats strfmt.Registry) error { + if swag.IsZero(o.DeviceKeys) { // not required + return nil + } + + if o.DeviceKeys != nil { + if err := o.DeviceKeys.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceKeys") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceKeys") + } + return err + } + } + + return nil +} + +// ContextValidate validate this device service update keys body based on the context it is used +func (o *DeviceServiceUpdateKeysBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateDeviceKeys(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceServiceUpdateKeysBody) contextValidateDeviceKeys(ctx context.Context, formats strfmt.Registry) error { + + if o.DeviceKeys != nil { + + if swag.IsZero(o.DeviceKeys) { // not required + return nil + } + + if err := o.DeviceKeys.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "deviceKeys") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "deviceKeys") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceServiceUpdateKeysBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceServiceUpdateKeysBody) UnmarshalBinary(b []byte) error { + var res DeviceServiceUpdateKeysBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +DeviceServiceUpdateKeysParamsBodyDeviceKeys Device-keys object. +swagger:model DeviceServiceUpdateKeysParamsBodyDeviceKeys +*/ +type DeviceServiceUpdateKeysParamsBodyDeviceKeys struct { + + // Application root key (128 bit). + // Note: This field only needs to be set for LoRaWAN 1.1.x devices! + AppKey string `json:"appKey,omitempty"` + + // Gen App Key (128 bit). + // Note: This field only needs to be set for LoRaWAN 1.0.x devices that + // implement TS005 (remote multicast setup). + GenAppKey string `json:"genAppKey,omitempty"` + + // Network root key (128 bit). + // Note: For LoRaWAN 1.0.x, use this field for the LoRaWAN 1.0.x 'AppKey`! + NwkKey string `json:"nwkKey,omitempty"` +} + +// Validate validates this device service update keys params body device keys +func (o *DeviceServiceUpdateKeysParamsBodyDeviceKeys) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this device service update keys params body device keys based on context it is used +func (o *DeviceServiceUpdateKeysParamsBodyDeviceKeys) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceServiceUpdateKeysParamsBodyDeviceKeys) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceServiceUpdateKeysParamsBodyDeviceKeys) UnmarshalBinary(b []byte) error { + var res DeviceServiceUpdateKeysParamsBodyDeviceKeys + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_update_parameters.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_update_parameters.go new file mode 100644 index 0000000..df2d64a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_update_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeviceServiceUpdateParams creates a new DeviceServiceUpdateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeviceServiceUpdateParams() *DeviceServiceUpdateParams { + return &DeviceServiceUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeviceServiceUpdateParamsWithTimeout creates a new DeviceServiceUpdateParams object +// with the ability to set a timeout on a request. +func NewDeviceServiceUpdateParamsWithTimeout(timeout time.Duration) *DeviceServiceUpdateParams { + return &DeviceServiceUpdateParams{ + timeout: timeout, + } +} + +// NewDeviceServiceUpdateParamsWithContext creates a new DeviceServiceUpdateParams object +// with the ability to set a context for a request. +func NewDeviceServiceUpdateParamsWithContext(ctx context.Context) *DeviceServiceUpdateParams { + return &DeviceServiceUpdateParams{ + Context: ctx, + } +} + +// NewDeviceServiceUpdateParamsWithHTTPClient creates a new DeviceServiceUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeviceServiceUpdateParamsWithHTTPClient(client *http.Client) *DeviceServiceUpdateParams { + return &DeviceServiceUpdateParams{ + HTTPClient: client, + } +} + +/* +DeviceServiceUpdateParams contains all the parameters to send to the API endpoint + + for the device service update operation. + + Typically these are written to a http.Request. +*/ +type DeviceServiceUpdateParams struct { + + // Body. + Body DeviceServiceUpdateBody + + /* DeviceDevEui. + + DevEUI (EUI64). + */ + DeviceDevEui string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the device service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceUpdateParams) WithDefaults() *DeviceServiceUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the device service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeviceServiceUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the device service update params +func (o *DeviceServiceUpdateParams) WithTimeout(timeout time.Duration) *DeviceServiceUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the device service update params +func (o *DeviceServiceUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the device service update params +func (o *DeviceServiceUpdateParams) WithContext(ctx context.Context) *DeviceServiceUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the device service update params +func (o *DeviceServiceUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the device service update params +func (o *DeviceServiceUpdateParams) WithHTTPClient(client *http.Client) *DeviceServiceUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the device service update params +func (o *DeviceServiceUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the device service update params +func (o *DeviceServiceUpdateParams) WithBody(body DeviceServiceUpdateBody) *DeviceServiceUpdateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the device service update params +func (o *DeviceServiceUpdateParams) SetBody(body DeviceServiceUpdateBody) { + o.Body = body +} + +// WithDeviceDevEui adds the deviceDevEui to the device service update params +func (o *DeviceServiceUpdateParams) WithDeviceDevEui(deviceDevEui string) *DeviceServiceUpdateParams { + o.SetDeviceDevEui(deviceDevEui) + return o +} + +// SetDeviceDevEui adds the deviceDevEui to the device service update params +func (o *DeviceServiceUpdateParams) SetDeviceDevEui(deviceDevEui string) { + o.DeviceDevEui = deviceDevEui +} + +// WriteToRequest writes these params to a swagger request +func (o *DeviceServiceUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param device.devEui + if err := r.SetPathParam("device.devEui", o.DeviceDevEui); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/device_service/device_service_update_responses.go b/internal/app/service/lora/chirp_stack/client/device_service/device_service_update_responses.go new file mode 100644 index 0000000..040defb --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/device_service/device_service_update_responses.go @@ -0,0 +1,356 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package device_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// DeviceServiceUpdateReader is a Reader for the DeviceServiceUpdate structure. +type DeviceServiceUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeviceServiceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeviceServiceUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeviceServiceUpdateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeviceServiceUpdateOK creates a DeviceServiceUpdateOK with default headers values +func NewDeviceServiceUpdateOK() *DeviceServiceUpdateOK { + return &DeviceServiceUpdateOK{} +} + +/* +DeviceServiceUpdateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeviceServiceUpdateOK struct { + Payload interface{} +} + +// IsSuccess returns true when this device service update o k response has a 2xx status code +func (o *DeviceServiceUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this device service update o k response has a 3xx status code +func (o *DeviceServiceUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this device service update o k response has a 4xx status code +func (o *DeviceServiceUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this device service update o k response has a 5xx status code +func (o *DeviceServiceUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this device service update o k response a status code equal to that given +func (o *DeviceServiceUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the device service update o k response +func (o *DeviceServiceUpdateOK) Code() int { + return 200 +} + +func (o *DeviceServiceUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/devices/{device.devEui}][%d] deviceServiceUpdateOK %s", 200, payload) +} + +func (o *DeviceServiceUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/devices/{device.devEui}][%d] deviceServiceUpdateOK %s", 200, payload) +} + +func (o *DeviceServiceUpdateOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeviceServiceUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeviceServiceUpdateDefault creates a DeviceServiceUpdateDefault with default headers values +func NewDeviceServiceUpdateDefault(code int) *DeviceServiceUpdateDefault { + return &DeviceServiceUpdateDefault{ + _statusCode: code, + } +} + +/* +DeviceServiceUpdateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeviceServiceUpdateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this device service update default response has a 2xx status code +func (o *DeviceServiceUpdateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this device service update default response has a 3xx status code +func (o *DeviceServiceUpdateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this device service update default response has a 4xx status code +func (o *DeviceServiceUpdateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this device service update default response has a 5xx status code +func (o *DeviceServiceUpdateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this device service update default response a status code equal to that given +func (o *DeviceServiceUpdateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the device service update default response +func (o *DeviceServiceUpdateDefault) Code() int { + return o._statusCode +} + +func (o *DeviceServiceUpdateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/devices/{device.devEui}][%d] DeviceService_Update default %s", o._statusCode, payload) +} + +func (o *DeviceServiceUpdateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/devices/{device.devEui}][%d] DeviceService_Update default %s", o._statusCode, payload) +} + +func (o *DeviceServiceUpdateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *DeviceServiceUpdateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +DeviceServiceUpdateBody device service update body +swagger:model DeviceServiceUpdateBody +*/ +type DeviceServiceUpdateBody struct { + + // device + Device *DeviceServiceUpdateParamsBodyDevice `json:"device,omitempty"` +} + +// Validate validates this device service update body +func (o *DeviceServiceUpdateBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateDevice(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceServiceUpdateBody) validateDevice(formats strfmt.Registry) error { + if swag.IsZero(o.Device) { // not required + return nil + } + + if o.Device != nil { + if err := o.Device.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "device") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "device") + } + return err + } + } + + return nil +} + +// ContextValidate validate this device service update body based on the context it is used +func (o *DeviceServiceUpdateBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateDevice(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *DeviceServiceUpdateBody) contextValidateDevice(ctx context.Context, formats strfmt.Registry) error { + + if o.Device != nil { + + if swag.IsZero(o.Device) { // not required + return nil + } + + if err := o.Device.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "device") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "device") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceServiceUpdateBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceServiceUpdateBody) UnmarshalBinary(b []byte) error { + var res DeviceServiceUpdateBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +DeviceServiceUpdateParamsBodyDevice Device object. +swagger:model DeviceServiceUpdateParamsBodyDevice +*/ +type DeviceServiceUpdateParamsBodyDevice struct { + + // Application ID (UUID). + ApplicationID string `json:"applicationId,omitempty"` + + // Description. + Description string `json:"description,omitempty"` + + // Device-profile ID (UUID). + DeviceProfileID string `json:"deviceProfileId,omitempty"` + + // Device is disabled. + IsDisabled bool `json:"isDisabled,omitempty"` + + // JoinEUI (optional, EUI64). + // This field will be automatically set / updated on OTAA. However, in some + // cases it must be pre-configured. For example to allow OTAA using a Relay. + // In this case the Relay needs to know the JoinEUI + DevEUI combinations + // of the devices for which it needs to forward uplinks. + JoinEui string `json:"joinEui,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Skip frame-counter checks (this is insecure, but could be helpful for + // debugging). + SkipFcntCheck bool `json:"skipFcntCheck,omitempty"` + + // Tags (user defined). + // These tags can be used to add additional information to the device. + // These tags are exposed in all the integration events. + Tags map[string]string `json:"tags,omitempty"` + + // Variables (user defined). + // These variables can be used together with integrations to store tokens / + // secrets that must be configured per device. These variables are not + // exposed in the event payloads. + Variables map[string]string `json:"variables,omitempty"` +} + +// Validate validates this device service update params body device +func (o *DeviceServiceUpdateParamsBodyDevice) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this device service update params body device based on context it is used +func (o *DeviceServiceUpdateParamsBodyDevice) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *DeviceServiceUpdateParamsBodyDevice) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *DeviceServiceUpdateParamsBodyDevice) UnmarshalBinary(b []byte) error { + var res DeviceServiceUpdateParamsBodyDevice + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_client.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_client.go new file mode 100644 index 0000000..93b6075 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_client.go @@ -0,0 +1,543 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new gateway service API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new gateway service API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new gateway service API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for gateway service API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GatewayServiceCreate(params *GatewayServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceCreateOK, error) + + GatewayServiceDelete(params *GatewayServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceDeleteOK, error) + + GatewayServiceDeleteRelayGateway(params *GatewayServiceDeleteRelayGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceDeleteRelayGatewayOK, error) + + GatewayServiceGenerateClientCertificate(params *GatewayServiceGenerateClientCertificateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGenerateClientCertificateOK, error) + + GatewayServiceGet(params *GatewayServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetOK, error) + + GatewayServiceGetDutyCycleMetrics(params *GatewayServiceGetDutyCycleMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetDutyCycleMetricsOK, error) + + GatewayServiceGetMetrics(params *GatewayServiceGetMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetMetricsOK, error) + + GatewayServiceGetRelayGateway(params *GatewayServiceGetRelayGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetRelayGatewayOK, error) + + GatewayServiceList(params *GatewayServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceListOK, error) + + GatewayServiceListRelayGateways(params *GatewayServiceListRelayGatewaysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceListRelayGatewaysOK, error) + + GatewayServiceUpdate(params *GatewayServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceUpdateOK, error) + + GatewayServiceUpdateRelayGateway(params *GatewayServiceUpdateRelayGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceUpdateRelayGatewayOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GatewayServiceCreate creates creates the given gateway +*/ +func (a *Client) GatewayServiceCreate(params *GatewayServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGatewayServiceCreateParams() + } + op := &runtime.ClientOperation{ + ID: "GatewayService_Create", + Method: "POST", + PathPattern: "/api/gateways", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GatewayServiceCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GatewayServiceCreateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GatewayServiceCreateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GatewayServiceDelete deletes deletes the gateway matching the given gateway ID +*/ +func (a *Client) GatewayServiceDelete(params *GatewayServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGatewayServiceDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "GatewayService_Delete", + Method: "DELETE", + PathPattern: "/api/gateways/{gatewayId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GatewayServiceDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GatewayServiceDeleteOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GatewayServiceDeleteDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GatewayServiceDeleteRelayGateway deletes the given relay gateway +*/ +func (a *Client) GatewayServiceDeleteRelayGateway(params *GatewayServiceDeleteRelayGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceDeleteRelayGatewayOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGatewayServiceDeleteRelayGatewayParams() + } + op := &runtime.ClientOperation{ + ID: "GatewayService_DeleteRelayGateway", + Method: "DELETE", + PathPattern: "/api/gateways/relay-gateways/{tenantId}/{relayId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GatewayServiceDeleteRelayGatewayReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GatewayServiceDeleteRelayGatewayOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GatewayServiceDeleteRelayGatewayDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GatewayServiceGenerateClientCertificate generates client certificate for the gateway +*/ +func (a *Client) GatewayServiceGenerateClientCertificate(params *GatewayServiceGenerateClientCertificateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGenerateClientCertificateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGatewayServiceGenerateClientCertificateParams() + } + op := &runtime.ClientOperation{ + ID: "GatewayService_GenerateClientCertificate", + Method: "POST", + PathPattern: "/api/gateways/{gatewayId}/generate-certificate", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GatewayServiceGenerateClientCertificateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GatewayServiceGenerateClientCertificateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GatewayServiceGenerateClientCertificateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GatewayServiceGet gets returns the gateway for the given gateway ID +*/ +func (a *Client) GatewayServiceGet(params *GatewayServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGatewayServiceGetParams() + } + op := &runtime.ClientOperation{ + ID: "GatewayService_Get", + Method: "GET", + PathPattern: "/api/gateways/{gatewayId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GatewayServiceGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GatewayServiceGetOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GatewayServiceGetDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GatewayServiceGetDutyCycleMetrics gets duty cycle metrics returns the duty cycle metrics note that only the last 2 hours of data are stored currently only per minute aggregation is available +*/ +func (a *Client) GatewayServiceGetDutyCycleMetrics(params *GatewayServiceGetDutyCycleMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetDutyCycleMetricsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGatewayServiceGetDutyCycleMetricsParams() + } + op := &runtime.ClientOperation{ + ID: "GatewayService_GetDutyCycleMetrics", + Method: "GET", + PathPattern: "/api/gateways/{gatewayId}/duty-cycle-metrics", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GatewayServiceGetDutyCycleMetricsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GatewayServiceGetDutyCycleMetricsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GatewayServiceGetDutyCycleMetricsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GatewayServiceGetMetrics gets metrics returns the gateway metrics +*/ +func (a *Client) GatewayServiceGetMetrics(params *GatewayServiceGetMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetMetricsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGatewayServiceGetMetricsParams() + } + op := &runtime.ClientOperation{ + ID: "GatewayService_GetMetrics", + Method: "GET", + PathPattern: "/api/gateways/{gatewayId}/metrics", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GatewayServiceGetMetricsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GatewayServiceGetMetricsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GatewayServiceGetMetricsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GatewayServiceGetRelayGateway gets the given relay gateway +*/ +func (a *Client) GatewayServiceGetRelayGateway(params *GatewayServiceGetRelayGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetRelayGatewayOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGatewayServiceGetRelayGatewayParams() + } + op := &runtime.ClientOperation{ + ID: "GatewayService_GetRelayGateway", + Method: "GET", + PathPattern: "/api/gateways/relay-gateways/{tenantId}/{relayId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GatewayServiceGetRelayGatewayReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GatewayServiceGetRelayGatewayOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GatewayServiceGetRelayGatewayDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GatewayServiceList gets the list of gateways +*/ +func (a *Client) GatewayServiceList(params *GatewayServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGatewayServiceListParams() + } + op := &runtime.ClientOperation{ + ID: "GatewayService_List", + Method: "GET", + PathPattern: "/api/gateways", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GatewayServiceListReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GatewayServiceListOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GatewayServiceListDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GatewayServiceListRelayGateways lists the detected relay gateways +*/ +func (a *Client) GatewayServiceListRelayGateways(params *GatewayServiceListRelayGatewaysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceListRelayGatewaysOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGatewayServiceListRelayGatewaysParams() + } + op := &runtime.ClientOperation{ + ID: "GatewayService_ListRelayGateways", + Method: "GET", + PathPattern: "/api/gateways/relay-gateways", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GatewayServiceListRelayGatewaysReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GatewayServiceListRelayGatewaysOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GatewayServiceListRelayGatewaysDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GatewayServiceUpdate updates updates the given gateway +*/ +func (a *Client) GatewayServiceUpdate(params *GatewayServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGatewayServiceUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "GatewayService_Update", + Method: "PUT", + PathPattern: "/api/gateways/{gateway.gatewayId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GatewayServiceUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GatewayServiceUpdateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GatewayServiceUpdateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GatewayServiceUpdateRelayGateway updates the given relay gateway +*/ +func (a *Client) GatewayServiceUpdateRelayGateway(params *GatewayServiceUpdateRelayGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceUpdateRelayGatewayOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGatewayServiceUpdateRelayGatewayParams() + } + op := &runtime.ClientOperation{ + ID: "GatewayService_UpdateRelayGateway", + Method: "PUT", + PathPattern: "/api/gateways/relay-gateways/{relayGateway.tenantId}/{relayGateway.relayId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GatewayServiceUpdateRelayGatewayReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GatewayServiceUpdateRelayGatewayOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GatewayServiceUpdateRelayGatewayDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_create_parameters.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_create_parameters.go new file mode 100644 index 0000000..b9ece31 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_create_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// NewGatewayServiceCreateParams creates a new GatewayServiceCreateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGatewayServiceCreateParams() *GatewayServiceCreateParams { + return &GatewayServiceCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGatewayServiceCreateParamsWithTimeout creates a new GatewayServiceCreateParams object +// with the ability to set a timeout on a request. +func NewGatewayServiceCreateParamsWithTimeout(timeout time.Duration) *GatewayServiceCreateParams { + return &GatewayServiceCreateParams{ + timeout: timeout, + } +} + +// NewGatewayServiceCreateParamsWithContext creates a new GatewayServiceCreateParams object +// with the ability to set a context for a request. +func NewGatewayServiceCreateParamsWithContext(ctx context.Context) *GatewayServiceCreateParams { + return &GatewayServiceCreateParams{ + Context: ctx, + } +} + +// NewGatewayServiceCreateParamsWithHTTPClient creates a new GatewayServiceCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewGatewayServiceCreateParamsWithHTTPClient(client *http.Client) *GatewayServiceCreateParams { + return &GatewayServiceCreateParams{ + HTTPClient: client, + } +} + +/* +GatewayServiceCreateParams contains all the parameters to send to the API endpoint + + for the gateway service create operation. + + Typically these are written to a http.Request. +*/ +type GatewayServiceCreateParams struct { + + // Body. + Body *models.APICreateGatewayRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the gateway service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceCreateParams) WithDefaults() *GatewayServiceCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the gateway service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the gateway service create params +func (o *GatewayServiceCreateParams) WithTimeout(timeout time.Duration) *GatewayServiceCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the gateway service create params +func (o *GatewayServiceCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the gateway service create params +func (o *GatewayServiceCreateParams) WithContext(ctx context.Context) *GatewayServiceCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the gateway service create params +func (o *GatewayServiceCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the gateway service create params +func (o *GatewayServiceCreateParams) WithHTTPClient(client *http.Client) *GatewayServiceCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the gateway service create params +func (o *GatewayServiceCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the gateway service create params +func (o *GatewayServiceCreateParams) WithBody(body *models.APICreateGatewayRequest) *GatewayServiceCreateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the gateway service create params +func (o *GatewayServiceCreateParams) SetBody(body *models.APICreateGatewayRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *GatewayServiceCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_create_responses.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_create_responses.go new file mode 100644 index 0000000..bb7fe78 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_create_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// GatewayServiceCreateReader is a Reader for the GatewayServiceCreate structure. +type GatewayServiceCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GatewayServiceCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGatewayServiceCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGatewayServiceCreateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGatewayServiceCreateOK creates a GatewayServiceCreateOK with default headers values +func NewGatewayServiceCreateOK() *GatewayServiceCreateOK { + return &GatewayServiceCreateOK{} +} + +/* +GatewayServiceCreateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GatewayServiceCreateOK struct { + Payload interface{} +} + +// IsSuccess returns true when this gateway service create o k response has a 2xx status code +func (o *GatewayServiceCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this gateway service create o k response has a 3xx status code +func (o *GatewayServiceCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this gateway service create o k response has a 4xx status code +func (o *GatewayServiceCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this gateway service create o k response has a 5xx status code +func (o *GatewayServiceCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this gateway service create o k response a status code equal to that given +func (o *GatewayServiceCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the gateway service create o k response +func (o *GatewayServiceCreateOK) Code() int { + return 200 +} + +func (o *GatewayServiceCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/gateways][%d] gatewayServiceCreateOK %s", 200, payload) +} + +func (o *GatewayServiceCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/gateways][%d] gatewayServiceCreateOK %s", 200, payload) +} + +func (o *GatewayServiceCreateOK) GetPayload() interface{} { + return o.Payload +} + +func (o *GatewayServiceCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGatewayServiceCreateDefault creates a GatewayServiceCreateDefault with default headers values +func NewGatewayServiceCreateDefault(code int) *GatewayServiceCreateDefault { + return &GatewayServiceCreateDefault{ + _statusCode: code, + } +} + +/* +GatewayServiceCreateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GatewayServiceCreateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this gateway service create default response has a 2xx status code +func (o *GatewayServiceCreateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this gateway service create default response has a 3xx status code +func (o *GatewayServiceCreateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this gateway service create default response has a 4xx status code +func (o *GatewayServiceCreateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this gateway service create default response has a 5xx status code +func (o *GatewayServiceCreateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this gateway service create default response a status code equal to that given +func (o *GatewayServiceCreateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the gateway service create default response +func (o *GatewayServiceCreateDefault) Code() int { + return o._statusCode +} + +func (o *GatewayServiceCreateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/gateways][%d] GatewayService_Create default %s", o._statusCode, payload) +} + +func (o *GatewayServiceCreateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/gateways][%d] GatewayService_Create default %s", o._statusCode, payload) +} + +func (o *GatewayServiceCreateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *GatewayServiceCreateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_delete_parameters.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_delete_parameters.go new file mode 100644 index 0000000..6f063e9 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGatewayServiceDeleteParams creates a new GatewayServiceDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGatewayServiceDeleteParams() *GatewayServiceDeleteParams { + return &GatewayServiceDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGatewayServiceDeleteParamsWithTimeout creates a new GatewayServiceDeleteParams object +// with the ability to set a timeout on a request. +func NewGatewayServiceDeleteParamsWithTimeout(timeout time.Duration) *GatewayServiceDeleteParams { + return &GatewayServiceDeleteParams{ + timeout: timeout, + } +} + +// NewGatewayServiceDeleteParamsWithContext creates a new GatewayServiceDeleteParams object +// with the ability to set a context for a request. +func NewGatewayServiceDeleteParamsWithContext(ctx context.Context) *GatewayServiceDeleteParams { + return &GatewayServiceDeleteParams{ + Context: ctx, + } +} + +// NewGatewayServiceDeleteParamsWithHTTPClient creates a new GatewayServiceDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewGatewayServiceDeleteParamsWithHTTPClient(client *http.Client) *GatewayServiceDeleteParams { + return &GatewayServiceDeleteParams{ + HTTPClient: client, + } +} + +/* +GatewayServiceDeleteParams contains all the parameters to send to the API endpoint + + for the gateway service delete operation. + + Typically these are written to a http.Request. +*/ +type GatewayServiceDeleteParams struct { + + /* GatewayID. + + Gateway ID (EUI64). + */ + GatewayID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the gateway service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceDeleteParams) WithDefaults() *GatewayServiceDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the gateway service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the gateway service delete params +func (o *GatewayServiceDeleteParams) WithTimeout(timeout time.Duration) *GatewayServiceDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the gateway service delete params +func (o *GatewayServiceDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the gateway service delete params +func (o *GatewayServiceDeleteParams) WithContext(ctx context.Context) *GatewayServiceDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the gateway service delete params +func (o *GatewayServiceDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the gateway service delete params +func (o *GatewayServiceDeleteParams) WithHTTPClient(client *http.Client) *GatewayServiceDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the gateway service delete params +func (o *GatewayServiceDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGatewayID adds the gatewayID to the gateway service delete params +func (o *GatewayServiceDeleteParams) WithGatewayID(gatewayID string) *GatewayServiceDeleteParams { + o.SetGatewayID(gatewayID) + return o +} + +// SetGatewayID adds the gatewayId to the gateway service delete params +func (o *GatewayServiceDeleteParams) SetGatewayID(gatewayID string) { + o.GatewayID = gatewayID +} + +// WriteToRequest writes these params to a swagger request +func (o *GatewayServiceDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param gatewayId + if err := r.SetPathParam("gatewayId", o.GatewayID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_delete_relay_gateway_parameters.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_delete_relay_gateway_parameters.go new file mode 100644 index 0000000..d8911eb --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_delete_relay_gateway_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGatewayServiceDeleteRelayGatewayParams creates a new GatewayServiceDeleteRelayGatewayParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGatewayServiceDeleteRelayGatewayParams() *GatewayServiceDeleteRelayGatewayParams { + return &GatewayServiceDeleteRelayGatewayParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGatewayServiceDeleteRelayGatewayParamsWithTimeout creates a new GatewayServiceDeleteRelayGatewayParams object +// with the ability to set a timeout on a request. +func NewGatewayServiceDeleteRelayGatewayParamsWithTimeout(timeout time.Duration) *GatewayServiceDeleteRelayGatewayParams { + return &GatewayServiceDeleteRelayGatewayParams{ + timeout: timeout, + } +} + +// NewGatewayServiceDeleteRelayGatewayParamsWithContext creates a new GatewayServiceDeleteRelayGatewayParams object +// with the ability to set a context for a request. +func NewGatewayServiceDeleteRelayGatewayParamsWithContext(ctx context.Context) *GatewayServiceDeleteRelayGatewayParams { + return &GatewayServiceDeleteRelayGatewayParams{ + Context: ctx, + } +} + +// NewGatewayServiceDeleteRelayGatewayParamsWithHTTPClient creates a new GatewayServiceDeleteRelayGatewayParams object +// with the ability to set a custom HTTPClient for a request. +func NewGatewayServiceDeleteRelayGatewayParamsWithHTTPClient(client *http.Client) *GatewayServiceDeleteRelayGatewayParams { + return &GatewayServiceDeleteRelayGatewayParams{ + HTTPClient: client, + } +} + +/* +GatewayServiceDeleteRelayGatewayParams contains all the parameters to send to the API endpoint + + for the gateway service delete relay gateway operation. + + Typically these are written to a http.Request. +*/ +type GatewayServiceDeleteRelayGatewayParams struct { + + /* RelayID. + + Relay ID (4 byte HEX). + */ + RelayID string + + /* TenantID. + + Tenant ID. + */ + TenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the gateway service delete relay gateway params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceDeleteRelayGatewayParams) WithDefaults() *GatewayServiceDeleteRelayGatewayParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the gateway service delete relay gateway params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceDeleteRelayGatewayParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the gateway service delete relay gateway params +func (o *GatewayServiceDeleteRelayGatewayParams) WithTimeout(timeout time.Duration) *GatewayServiceDeleteRelayGatewayParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the gateway service delete relay gateway params +func (o *GatewayServiceDeleteRelayGatewayParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the gateway service delete relay gateway params +func (o *GatewayServiceDeleteRelayGatewayParams) WithContext(ctx context.Context) *GatewayServiceDeleteRelayGatewayParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the gateway service delete relay gateway params +func (o *GatewayServiceDeleteRelayGatewayParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the gateway service delete relay gateway params +func (o *GatewayServiceDeleteRelayGatewayParams) WithHTTPClient(client *http.Client) *GatewayServiceDeleteRelayGatewayParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the gateway service delete relay gateway params +func (o *GatewayServiceDeleteRelayGatewayParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRelayID adds the relayID to the gateway service delete relay gateway params +func (o *GatewayServiceDeleteRelayGatewayParams) WithRelayID(relayID string) *GatewayServiceDeleteRelayGatewayParams { + o.SetRelayID(relayID) + return o +} + +// SetRelayID adds the relayId to the gateway service delete relay gateway params +func (o *GatewayServiceDeleteRelayGatewayParams) SetRelayID(relayID string) { + o.RelayID = relayID +} + +// WithTenantID adds the tenantID to the gateway service delete relay gateway params +func (o *GatewayServiceDeleteRelayGatewayParams) WithTenantID(tenantID string) *GatewayServiceDeleteRelayGatewayParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the gateway service delete relay gateway params +func (o *GatewayServiceDeleteRelayGatewayParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *GatewayServiceDeleteRelayGatewayParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param relayId + if err := r.SetPathParam("relayId", o.RelayID); err != nil { + return err + } + + // path param tenantId + if err := r.SetPathParam("tenantId", o.TenantID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_delete_relay_gateway_responses.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_delete_relay_gateway_responses.go new file mode 100644 index 0000000..56bbb2d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_delete_relay_gateway_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// GatewayServiceDeleteRelayGatewayReader is a Reader for the GatewayServiceDeleteRelayGateway structure. +type GatewayServiceDeleteRelayGatewayReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GatewayServiceDeleteRelayGatewayReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGatewayServiceDeleteRelayGatewayOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGatewayServiceDeleteRelayGatewayDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGatewayServiceDeleteRelayGatewayOK creates a GatewayServiceDeleteRelayGatewayOK with default headers values +func NewGatewayServiceDeleteRelayGatewayOK() *GatewayServiceDeleteRelayGatewayOK { + return &GatewayServiceDeleteRelayGatewayOK{} +} + +/* +GatewayServiceDeleteRelayGatewayOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GatewayServiceDeleteRelayGatewayOK struct { + Payload interface{} +} + +// IsSuccess returns true when this gateway service delete relay gateway o k response has a 2xx status code +func (o *GatewayServiceDeleteRelayGatewayOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this gateway service delete relay gateway o k response has a 3xx status code +func (o *GatewayServiceDeleteRelayGatewayOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this gateway service delete relay gateway o k response has a 4xx status code +func (o *GatewayServiceDeleteRelayGatewayOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this gateway service delete relay gateway o k response has a 5xx status code +func (o *GatewayServiceDeleteRelayGatewayOK) IsServerError() bool { + return false +} + +// IsCode returns true when this gateway service delete relay gateway o k response a status code equal to that given +func (o *GatewayServiceDeleteRelayGatewayOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the gateway service delete relay gateway o k response +func (o *GatewayServiceDeleteRelayGatewayOK) Code() int { + return 200 +} + +func (o *GatewayServiceDeleteRelayGatewayOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/gateways/relay-gateways/{tenantId}/{relayId}][%d] gatewayServiceDeleteRelayGatewayOK %s", 200, payload) +} + +func (o *GatewayServiceDeleteRelayGatewayOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/gateways/relay-gateways/{tenantId}/{relayId}][%d] gatewayServiceDeleteRelayGatewayOK %s", 200, payload) +} + +func (o *GatewayServiceDeleteRelayGatewayOK) GetPayload() interface{} { + return o.Payload +} + +func (o *GatewayServiceDeleteRelayGatewayOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGatewayServiceDeleteRelayGatewayDefault creates a GatewayServiceDeleteRelayGatewayDefault with default headers values +func NewGatewayServiceDeleteRelayGatewayDefault(code int) *GatewayServiceDeleteRelayGatewayDefault { + return &GatewayServiceDeleteRelayGatewayDefault{ + _statusCode: code, + } +} + +/* +GatewayServiceDeleteRelayGatewayDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GatewayServiceDeleteRelayGatewayDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this gateway service delete relay gateway default response has a 2xx status code +func (o *GatewayServiceDeleteRelayGatewayDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this gateway service delete relay gateway default response has a 3xx status code +func (o *GatewayServiceDeleteRelayGatewayDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this gateway service delete relay gateway default response has a 4xx status code +func (o *GatewayServiceDeleteRelayGatewayDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this gateway service delete relay gateway default response has a 5xx status code +func (o *GatewayServiceDeleteRelayGatewayDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this gateway service delete relay gateway default response a status code equal to that given +func (o *GatewayServiceDeleteRelayGatewayDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the gateway service delete relay gateway default response +func (o *GatewayServiceDeleteRelayGatewayDefault) Code() int { + return o._statusCode +} + +func (o *GatewayServiceDeleteRelayGatewayDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/gateways/relay-gateways/{tenantId}/{relayId}][%d] GatewayService_DeleteRelayGateway default %s", o._statusCode, payload) +} + +func (o *GatewayServiceDeleteRelayGatewayDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/gateways/relay-gateways/{tenantId}/{relayId}][%d] GatewayService_DeleteRelayGateway default %s", o._statusCode, payload) +} + +func (o *GatewayServiceDeleteRelayGatewayDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *GatewayServiceDeleteRelayGatewayDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_delete_responses.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_delete_responses.go new file mode 100644 index 0000000..6c6f80b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_delete_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// GatewayServiceDeleteReader is a Reader for the GatewayServiceDelete structure. +type GatewayServiceDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GatewayServiceDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGatewayServiceDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGatewayServiceDeleteDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGatewayServiceDeleteOK creates a GatewayServiceDeleteOK with default headers values +func NewGatewayServiceDeleteOK() *GatewayServiceDeleteOK { + return &GatewayServiceDeleteOK{} +} + +/* +GatewayServiceDeleteOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GatewayServiceDeleteOK struct { + Payload interface{} +} + +// IsSuccess returns true when this gateway service delete o k response has a 2xx status code +func (o *GatewayServiceDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this gateway service delete o k response has a 3xx status code +func (o *GatewayServiceDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this gateway service delete o k response has a 4xx status code +func (o *GatewayServiceDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this gateway service delete o k response has a 5xx status code +func (o *GatewayServiceDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this gateway service delete o k response a status code equal to that given +func (o *GatewayServiceDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the gateway service delete o k response +func (o *GatewayServiceDeleteOK) Code() int { + return 200 +} + +func (o *GatewayServiceDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/gateways/{gatewayId}][%d] gatewayServiceDeleteOK %s", 200, payload) +} + +func (o *GatewayServiceDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/gateways/{gatewayId}][%d] gatewayServiceDeleteOK %s", 200, payload) +} + +func (o *GatewayServiceDeleteOK) GetPayload() interface{} { + return o.Payload +} + +func (o *GatewayServiceDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGatewayServiceDeleteDefault creates a GatewayServiceDeleteDefault with default headers values +func NewGatewayServiceDeleteDefault(code int) *GatewayServiceDeleteDefault { + return &GatewayServiceDeleteDefault{ + _statusCode: code, + } +} + +/* +GatewayServiceDeleteDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GatewayServiceDeleteDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this gateway service delete default response has a 2xx status code +func (o *GatewayServiceDeleteDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this gateway service delete default response has a 3xx status code +func (o *GatewayServiceDeleteDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this gateway service delete default response has a 4xx status code +func (o *GatewayServiceDeleteDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this gateway service delete default response has a 5xx status code +func (o *GatewayServiceDeleteDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this gateway service delete default response a status code equal to that given +func (o *GatewayServiceDeleteDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the gateway service delete default response +func (o *GatewayServiceDeleteDefault) Code() int { + return o._statusCode +} + +func (o *GatewayServiceDeleteDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/gateways/{gatewayId}][%d] GatewayService_Delete default %s", o._statusCode, payload) +} + +func (o *GatewayServiceDeleteDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/gateways/{gatewayId}][%d] GatewayService_Delete default %s", o._statusCode, payload) +} + +func (o *GatewayServiceDeleteDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *GatewayServiceDeleteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_generate_client_certificate_parameters.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_generate_client_certificate_parameters.go new file mode 100644 index 0000000..d3d3040 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_generate_client_certificate_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGatewayServiceGenerateClientCertificateParams creates a new GatewayServiceGenerateClientCertificateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGatewayServiceGenerateClientCertificateParams() *GatewayServiceGenerateClientCertificateParams { + return &GatewayServiceGenerateClientCertificateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGatewayServiceGenerateClientCertificateParamsWithTimeout creates a new GatewayServiceGenerateClientCertificateParams object +// with the ability to set a timeout on a request. +func NewGatewayServiceGenerateClientCertificateParamsWithTimeout(timeout time.Duration) *GatewayServiceGenerateClientCertificateParams { + return &GatewayServiceGenerateClientCertificateParams{ + timeout: timeout, + } +} + +// NewGatewayServiceGenerateClientCertificateParamsWithContext creates a new GatewayServiceGenerateClientCertificateParams object +// with the ability to set a context for a request. +func NewGatewayServiceGenerateClientCertificateParamsWithContext(ctx context.Context) *GatewayServiceGenerateClientCertificateParams { + return &GatewayServiceGenerateClientCertificateParams{ + Context: ctx, + } +} + +// NewGatewayServiceGenerateClientCertificateParamsWithHTTPClient creates a new GatewayServiceGenerateClientCertificateParams object +// with the ability to set a custom HTTPClient for a request. +func NewGatewayServiceGenerateClientCertificateParamsWithHTTPClient(client *http.Client) *GatewayServiceGenerateClientCertificateParams { + return &GatewayServiceGenerateClientCertificateParams{ + HTTPClient: client, + } +} + +/* +GatewayServiceGenerateClientCertificateParams contains all the parameters to send to the API endpoint + + for the gateway service generate client certificate operation. + + Typically these are written to a http.Request. +*/ +type GatewayServiceGenerateClientCertificateParams struct { + + /* GatewayID. + + Gateway ID (EUI64). + */ + GatewayID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the gateway service generate client certificate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceGenerateClientCertificateParams) WithDefaults() *GatewayServiceGenerateClientCertificateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the gateway service generate client certificate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceGenerateClientCertificateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the gateway service generate client certificate params +func (o *GatewayServiceGenerateClientCertificateParams) WithTimeout(timeout time.Duration) *GatewayServiceGenerateClientCertificateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the gateway service generate client certificate params +func (o *GatewayServiceGenerateClientCertificateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the gateway service generate client certificate params +func (o *GatewayServiceGenerateClientCertificateParams) WithContext(ctx context.Context) *GatewayServiceGenerateClientCertificateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the gateway service generate client certificate params +func (o *GatewayServiceGenerateClientCertificateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the gateway service generate client certificate params +func (o *GatewayServiceGenerateClientCertificateParams) WithHTTPClient(client *http.Client) *GatewayServiceGenerateClientCertificateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the gateway service generate client certificate params +func (o *GatewayServiceGenerateClientCertificateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGatewayID adds the gatewayID to the gateway service generate client certificate params +func (o *GatewayServiceGenerateClientCertificateParams) WithGatewayID(gatewayID string) *GatewayServiceGenerateClientCertificateParams { + o.SetGatewayID(gatewayID) + return o +} + +// SetGatewayID adds the gatewayId to the gateway service generate client certificate params +func (o *GatewayServiceGenerateClientCertificateParams) SetGatewayID(gatewayID string) { + o.GatewayID = gatewayID +} + +// WriteToRequest writes these params to a swagger request +func (o *GatewayServiceGenerateClientCertificateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param gatewayId + if err := r.SetPathParam("gatewayId", o.GatewayID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_generate_client_certificate_responses.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_generate_client_certificate_responses.go new file mode 100644 index 0000000..018a487 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_generate_client_certificate_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// GatewayServiceGenerateClientCertificateReader is a Reader for the GatewayServiceGenerateClientCertificate structure. +type GatewayServiceGenerateClientCertificateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GatewayServiceGenerateClientCertificateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGatewayServiceGenerateClientCertificateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGatewayServiceGenerateClientCertificateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGatewayServiceGenerateClientCertificateOK creates a GatewayServiceGenerateClientCertificateOK with default headers values +func NewGatewayServiceGenerateClientCertificateOK() *GatewayServiceGenerateClientCertificateOK { + return &GatewayServiceGenerateClientCertificateOK{} +} + +/* +GatewayServiceGenerateClientCertificateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GatewayServiceGenerateClientCertificateOK struct { + Payload *models.APIGenerateGatewayClientCertificateResponse +} + +// IsSuccess returns true when this gateway service generate client certificate o k response has a 2xx status code +func (o *GatewayServiceGenerateClientCertificateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this gateway service generate client certificate o k response has a 3xx status code +func (o *GatewayServiceGenerateClientCertificateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this gateway service generate client certificate o k response has a 4xx status code +func (o *GatewayServiceGenerateClientCertificateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this gateway service generate client certificate o k response has a 5xx status code +func (o *GatewayServiceGenerateClientCertificateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this gateway service generate client certificate o k response a status code equal to that given +func (o *GatewayServiceGenerateClientCertificateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the gateway service generate client certificate o k response +func (o *GatewayServiceGenerateClientCertificateOK) Code() int { + return 200 +} + +func (o *GatewayServiceGenerateClientCertificateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/gateways/{gatewayId}/generate-certificate][%d] gatewayServiceGenerateClientCertificateOK %s", 200, payload) +} + +func (o *GatewayServiceGenerateClientCertificateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/gateways/{gatewayId}/generate-certificate][%d] gatewayServiceGenerateClientCertificateOK %s", 200, payload) +} + +func (o *GatewayServiceGenerateClientCertificateOK) GetPayload() *models.APIGenerateGatewayClientCertificateResponse { + return o.Payload +} + +func (o *GatewayServiceGenerateClientCertificateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGenerateGatewayClientCertificateResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGatewayServiceGenerateClientCertificateDefault creates a GatewayServiceGenerateClientCertificateDefault with default headers values +func NewGatewayServiceGenerateClientCertificateDefault(code int) *GatewayServiceGenerateClientCertificateDefault { + return &GatewayServiceGenerateClientCertificateDefault{ + _statusCode: code, + } +} + +/* +GatewayServiceGenerateClientCertificateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GatewayServiceGenerateClientCertificateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this gateway service generate client certificate default response has a 2xx status code +func (o *GatewayServiceGenerateClientCertificateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this gateway service generate client certificate default response has a 3xx status code +func (o *GatewayServiceGenerateClientCertificateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this gateway service generate client certificate default response has a 4xx status code +func (o *GatewayServiceGenerateClientCertificateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this gateway service generate client certificate default response has a 5xx status code +func (o *GatewayServiceGenerateClientCertificateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this gateway service generate client certificate default response a status code equal to that given +func (o *GatewayServiceGenerateClientCertificateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the gateway service generate client certificate default response +func (o *GatewayServiceGenerateClientCertificateDefault) Code() int { + return o._statusCode +} + +func (o *GatewayServiceGenerateClientCertificateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/gateways/{gatewayId}/generate-certificate][%d] GatewayService_GenerateClientCertificate default %s", o._statusCode, payload) +} + +func (o *GatewayServiceGenerateClientCertificateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/gateways/{gatewayId}/generate-certificate][%d] GatewayService_GenerateClientCertificate default %s", o._statusCode, payload) +} + +func (o *GatewayServiceGenerateClientCertificateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *GatewayServiceGenerateClientCertificateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_duty_cycle_metrics_parameters.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_duty_cycle_metrics_parameters.go new file mode 100644 index 0000000..79204b4 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_duty_cycle_metrics_parameters.go @@ -0,0 +1,223 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGatewayServiceGetDutyCycleMetricsParams creates a new GatewayServiceGetDutyCycleMetricsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGatewayServiceGetDutyCycleMetricsParams() *GatewayServiceGetDutyCycleMetricsParams { + return &GatewayServiceGetDutyCycleMetricsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGatewayServiceGetDutyCycleMetricsParamsWithTimeout creates a new GatewayServiceGetDutyCycleMetricsParams object +// with the ability to set a timeout on a request. +func NewGatewayServiceGetDutyCycleMetricsParamsWithTimeout(timeout time.Duration) *GatewayServiceGetDutyCycleMetricsParams { + return &GatewayServiceGetDutyCycleMetricsParams{ + timeout: timeout, + } +} + +// NewGatewayServiceGetDutyCycleMetricsParamsWithContext creates a new GatewayServiceGetDutyCycleMetricsParams object +// with the ability to set a context for a request. +func NewGatewayServiceGetDutyCycleMetricsParamsWithContext(ctx context.Context) *GatewayServiceGetDutyCycleMetricsParams { + return &GatewayServiceGetDutyCycleMetricsParams{ + Context: ctx, + } +} + +// NewGatewayServiceGetDutyCycleMetricsParamsWithHTTPClient creates a new GatewayServiceGetDutyCycleMetricsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGatewayServiceGetDutyCycleMetricsParamsWithHTTPClient(client *http.Client) *GatewayServiceGetDutyCycleMetricsParams { + return &GatewayServiceGetDutyCycleMetricsParams{ + HTTPClient: client, + } +} + +/* +GatewayServiceGetDutyCycleMetricsParams contains all the parameters to send to the API endpoint + + for the gateway service get duty cycle metrics operation. + + Typically these are written to a http.Request. +*/ +type GatewayServiceGetDutyCycleMetricsParams struct { + + /* End. + + Interval end timestamp. + + Format: date-time + */ + End *strfmt.DateTime + + /* GatewayID. + + Gateway ID (EUI64). + */ + GatewayID string + + /* Start. + + Interval start timestamp. + + Format: date-time + */ + Start *strfmt.DateTime + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the gateway service get duty cycle metrics params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceGetDutyCycleMetricsParams) WithDefaults() *GatewayServiceGetDutyCycleMetricsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the gateway service get duty cycle metrics params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceGetDutyCycleMetricsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the gateway service get duty cycle metrics params +func (o *GatewayServiceGetDutyCycleMetricsParams) WithTimeout(timeout time.Duration) *GatewayServiceGetDutyCycleMetricsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the gateway service get duty cycle metrics params +func (o *GatewayServiceGetDutyCycleMetricsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the gateway service get duty cycle metrics params +func (o *GatewayServiceGetDutyCycleMetricsParams) WithContext(ctx context.Context) *GatewayServiceGetDutyCycleMetricsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the gateway service get duty cycle metrics params +func (o *GatewayServiceGetDutyCycleMetricsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the gateway service get duty cycle metrics params +func (o *GatewayServiceGetDutyCycleMetricsParams) WithHTTPClient(client *http.Client) *GatewayServiceGetDutyCycleMetricsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the gateway service get duty cycle metrics params +func (o *GatewayServiceGetDutyCycleMetricsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithEnd adds the end to the gateway service get duty cycle metrics params +func (o *GatewayServiceGetDutyCycleMetricsParams) WithEnd(end *strfmt.DateTime) *GatewayServiceGetDutyCycleMetricsParams { + o.SetEnd(end) + return o +} + +// SetEnd adds the end to the gateway service get duty cycle metrics params +func (o *GatewayServiceGetDutyCycleMetricsParams) SetEnd(end *strfmt.DateTime) { + o.End = end +} + +// WithGatewayID adds the gatewayID to the gateway service get duty cycle metrics params +func (o *GatewayServiceGetDutyCycleMetricsParams) WithGatewayID(gatewayID string) *GatewayServiceGetDutyCycleMetricsParams { + o.SetGatewayID(gatewayID) + return o +} + +// SetGatewayID adds the gatewayId to the gateway service get duty cycle metrics params +func (o *GatewayServiceGetDutyCycleMetricsParams) SetGatewayID(gatewayID string) { + o.GatewayID = gatewayID +} + +// WithStart adds the start to the gateway service get duty cycle metrics params +func (o *GatewayServiceGetDutyCycleMetricsParams) WithStart(start *strfmt.DateTime) *GatewayServiceGetDutyCycleMetricsParams { + o.SetStart(start) + return o +} + +// SetStart adds the start to the gateway service get duty cycle metrics params +func (o *GatewayServiceGetDutyCycleMetricsParams) SetStart(start *strfmt.DateTime) { + o.Start = start +} + +// WriteToRequest writes these params to a swagger request +func (o *GatewayServiceGetDutyCycleMetricsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.End != nil { + + // query param end + var qrEnd strfmt.DateTime + + if o.End != nil { + qrEnd = *o.End + } + qEnd := qrEnd.String() + if qEnd != "" { + + if err := r.SetQueryParam("end", qEnd); err != nil { + return err + } + } + } + + // path param gatewayId + if err := r.SetPathParam("gatewayId", o.GatewayID); err != nil { + return err + } + + if o.Start != nil { + + // query param start + var qrStart strfmt.DateTime + + if o.Start != nil { + qrStart = *o.Start + } + qStart := qrStart.String() + if qStart != "" { + + if err := r.SetQueryParam("start", qStart); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_duty_cycle_metrics_responses.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_duty_cycle_metrics_responses.go new file mode 100644 index 0000000..f6b5822 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_duty_cycle_metrics_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// GatewayServiceGetDutyCycleMetricsReader is a Reader for the GatewayServiceGetDutyCycleMetrics structure. +type GatewayServiceGetDutyCycleMetricsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GatewayServiceGetDutyCycleMetricsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGatewayServiceGetDutyCycleMetricsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGatewayServiceGetDutyCycleMetricsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGatewayServiceGetDutyCycleMetricsOK creates a GatewayServiceGetDutyCycleMetricsOK with default headers values +func NewGatewayServiceGetDutyCycleMetricsOK() *GatewayServiceGetDutyCycleMetricsOK { + return &GatewayServiceGetDutyCycleMetricsOK{} +} + +/* +GatewayServiceGetDutyCycleMetricsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GatewayServiceGetDutyCycleMetricsOK struct { + Payload *models.APIGetGatewayDutyCycleMetricsResponse +} + +// IsSuccess returns true when this gateway service get duty cycle metrics o k response has a 2xx status code +func (o *GatewayServiceGetDutyCycleMetricsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this gateway service get duty cycle metrics o k response has a 3xx status code +func (o *GatewayServiceGetDutyCycleMetricsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this gateway service get duty cycle metrics o k response has a 4xx status code +func (o *GatewayServiceGetDutyCycleMetricsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this gateway service get duty cycle metrics o k response has a 5xx status code +func (o *GatewayServiceGetDutyCycleMetricsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this gateway service get duty cycle metrics o k response a status code equal to that given +func (o *GatewayServiceGetDutyCycleMetricsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the gateway service get duty cycle metrics o k response +func (o *GatewayServiceGetDutyCycleMetricsOK) Code() int { + return 200 +} + +func (o *GatewayServiceGetDutyCycleMetricsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/{gatewayId}/duty-cycle-metrics][%d] gatewayServiceGetDutyCycleMetricsOK %s", 200, payload) +} + +func (o *GatewayServiceGetDutyCycleMetricsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/{gatewayId}/duty-cycle-metrics][%d] gatewayServiceGetDutyCycleMetricsOK %s", 200, payload) +} + +func (o *GatewayServiceGetDutyCycleMetricsOK) GetPayload() *models.APIGetGatewayDutyCycleMetricsResponse { + return o.Payload +} + +func (o *GatewayServiceGetDutyCycleMetricsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetGatewayDutyCycleMetricsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGatewayServiceGetDutyCycleMetricsDefault creates a GatewayServiceGetDutyCycleMetricsDefault with default headers values +func NewGatewayServiceGetDutyCycleMetricsDefault(code int) *GatewayServiceGetDutyCycleMetricsDefault { + return &GatewayServiceGetDutyCycleMetricsDefault{ + _statusCode: code, + } +} + +/* +GatewayServiceGetDutyCycleMetricsDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GatewayServiceGetDutyCycleMetricsDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this gateway service get duty cycle metrics default response has a 2xx status code +func (o *GatewayServiceGetDutyCycleMetricsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this gateway service get duty cycle metrics default response has a 3xx status code +func (o *GatewayServiceGetDutyCycleMetricsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this gateway service get duty cycle metrics default response has a 4xx status code +func (o *GatewayServiceGetDutyCycleMetricsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this gateway service get duty cycle metrics default response has a 5xx status code +func (o *GatewayServiceGetDutyCycleMetricsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this gateway service get duty cycle metrics default response a status code equal to that given +func (o *GatewayServiceGetDutyCycleMetricsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the gateway service get duty cycle metrics default response +func (o *GatewayServiceGetDutyCycleMetricsDefault) Code() int { + return o._statusCode +} + +func (o *GatewayServiceGetDutyCycleMetricsDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/{gatewayId}/duty-cycle-metrics][%d] GatewayService_GetDutyCycleMetrics default %s", o._statusCode, payload) +} + +func (o *GatewayServiceGetDutyCycleMetricsDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/{gatewayId}/duty-cycle-metrics][%d] GatewayService_GetDutyCycleMetrics default %s", o._statusCode, payload) +} + +func (o *GatewayServiceGetDutyCycleMetricsDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *GatewayServiceGetDutyCycleMetricsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_metrics_parameters.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_metrics_parameters.go new file mode 100644 index 0000000..110c1ab --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_metrics_parameters.go @@ -0,0 +1,275 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGatewayServiceGetMetricsParams creates a new GatewayServiceGetMetricsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGatewayServiceGetMetricsParams() *GatewayServiceGetMetricsParams { + return &GatewayServiceGetMetricsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGatewayServiceGetMetricsParamsWithTimeout creates a new GatewayServiceGetMetricsParams object +// with the ability to set a timeout on a request. +func NewGatewayServiceGetMetricsParamsWithTimeout(timeout time.Duration) *GatewayServiceGetMetricsParams { + return &GatewayServiceGetMetricsParams{ + timeout: timeout, + } +} + +// NewGatewayServiceGetMetricsParamsWithContext creates a new GatewayServiceGetMetricsParams object +// with the ability to set a context for a request. +func NewGatewayServiceGetMetricsParamsWithContext(ctx context.Context) *GatewayServiceGetMetricsParams { + return &GatewayServiceGetMetricsParams{ + Context: ctx, + } +} + +// NewGatewayServiceGetMetricsParamsWithHTTPClient creates a new GatewayServiceGetMetricsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGatewayServiceGetMetricsParamsWithHTTPClient(client *http.Client) *GatewayServiceGetMetricsParams { + return &GatewayServiceGetMetricsParams{ + HTTPClient: client, + } +} + +/* +GatewayServiceGetMetricsParams contains all the parameters to send to the API endpoint + + for the gateway service get metrics operation. + + Typically these are written to a http.Request. +*/ +type GatewayServiceGetMetricsParams struct { + + /* Aggregation. + + Aggregation. + + - HOUR: Hour. + - DAY: Day. + - MONTH: Month. + - MINUTE: Minute. + + Default: "HOUR" + */ + Aggregation *string + + /* End. + + Interval end timestamp. + + Format: date-time + */ + End *strfmt.DateTime + + /* GatewayID. + + Gateway ID (EUI64). + */ + GatewayID string + + /* Start. + + Interval start timestamp. + + Format: date-time + */ + Start *strfmt.DateTime + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the gateway service get metrics params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceGetMetricsParams) WithDefaults() *GatewayServiceGetMetricsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the gateway service get metrics params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceGetMetricsParams) SetDefaults() { + var ( + aggregationDefault = string("HOUR") + ) + + val := GatewayServiceGetMetricsParams{ + Aggregation: &aggregationDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) WithTimeout(timeout time.Duration) *GatewayServiceGetMetricsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) WithContext(ctx context.Context) *GatewayServiceGetMetricsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) WithHTTPClient(client *http.Client) *GatewayServiceGetMetricsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAggregation adds the aggregation to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) WithAggregation(aggregation *string) *GatewayServiceGetMetricsParams { + o.SetAggregation(aggregation) + return o +} + +// SetAggregation adds the aggregation to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) SetAggregation(aggregation *string) { + o.Aggregation = aggregation +} + +// WithEnd adds the end to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) WithEnd(end *strfmt.DateTime) *GatewayServiceGetMetricsParams { + o.SetEnd(end) + return o +} + +// SetEnd adds the end to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) SetEnd(end *strfmt.DateTime) { + o.End = end +} + +// WithGatewayID adds the gatewayID to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) WithGatewayID(gatewayID string) *GatewayServiceGetMetricsParams { + o.SetGatewayID(gatewayID) + return o +} + +// SetGatewayID adds the gatewayId to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) SetGatewayID(gatewayID string) { + o.GatewayID = gatewayID +} + +// WithStart adds the start to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) WithStart(start *strfmt.DateTime) *GatewayServiceGetMetricsParams { + o.SetStart(start) + return o +} + +// SetStart adds the start to the gateway service get metrics params +func (o *GatewayServiceGetMetricsParams) SetStart(start *strfmt.DateTime) { + o.Start = start +} + +// WriteToRequest writes these params to a swagger request +func (o *GatewayServiceGetMetricsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Aggregation != nil { + + // query param aggregation + var qrAggregation string + + if o.Aggregation != nil { + qrAggregation = *o.Aggregation + } + qAggregation := qrAggregation + if qAggregation != "" { + + if err := r.SetQueryParam("aggregation", qAggregation); err != nil { + return err + } + } + } + + if o.End != nil { + + // query param end + var qrEnd strfmt.DateTime + + if o.End != nil { + qrEnd = *o.End + } + qEnd := qrEnd.String() + if qEnd != "" { + + if err := r.SetQueryParam("end", qEnd); err != nil { + return err + } + } + } + + // path param gatewayId + if err := r.SetPathParam("gatewayId", o.GatewayID); err != nil { + return err + } + + if o.Start != nil { + + // query param start + var qrStart strfmt.DateTime + + if o.Start != nil { + qrStart = *o.Start + } + qStart := qrStart.String() + if qStart != "" { + + if err := r.SetQueryParam("start", qStart); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_metrics_responses.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_metrics_responses.go new file mode 100644 index 0000000..c2dc65b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_metrics_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// GatewayServiceGetMetricsReader is a Reader for the GatewayServiceGetMetrics structure. +type GatewayServiceGetMetricsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GatewayServiceGetMetricsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGatewayServiceGetMetricsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGatewayServiceGetMetricsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGatewayServiceGetMetricsOK creates a GatewayServiceGetMetricsOK with default headers values +func NewGatewayServiceGetMetricsOK() *GatewayServiceGetMetricsOK { + return &GatewayServiceGetMetricsOK{} +} + +/* +GatewayServiceGetMetricsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GatewayServiceGetMetricsOK struct { + Payload *models.APIGetGatewayMetricsResponse +} + +// IsSuccess returns true when this gateway service get metrics o k response has a 2xx status code +func (o *GatewayServiceGetMetricsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this gateway service get metrics o k response has a 3xx status code +func (o *GatewayServiceGetMetricsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this gateway service get metrics o k response has a 4xx status code +func (o *GatewayServiceGetMetricsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this gateway service get metrics o k response has a 5xx status code +func (o *GatewayServiceGetMetricsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this gateway service get metrics o k response a status code equal to that given +func (o *GatewayServiceGetMetricsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the gateway service get metrics o k response +func (o *GatewayServiceGetMetricsOK) Code() int { + return 200 +} + +func (o *GatewayServiceGetMetricsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/{gatewayId}/metrics][%d] gatewayServiceGetMetricsOK %s", 200, payload) +} + +func (o *GatewayServiceGetMetricsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/{gatewayId}/metrics][%d] gatewayServiceGetMetricsOK %s", 200, payload) +} + +func (o *GatewayServiceGetMetricsOK) GetPayload() *models.APIGetGatewayMetricsResponse { + return o.Payload +} + +func (o *GatewayServiceGetMetricsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetGatewayMetricsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGatewayServiceGetMetricsDefault creates a GatewayServiceGetMetricsDefault with default headers values +func NewGatewayServiceGetMetricsDefault(code int) *GatewayServiceGetMetricsDefault { + return &GatewayServiceGetMetricsDefault{ + _statusCode: code, + } +} + +/* +GatewayServiceGetMetricsDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GatewayServiceGetMetricsDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this gateway service get metrics default response has a 2xx status code +func (o *GatewayServiceGetMetricsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this gateway service get metrics default response has a 3xx status code +func (o *GatewayServiceGetMetricsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this gateway service get metrics default response has a 4xx status code +func (o *GatewayServiceGetMetricsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this gateway service get metrics default response has a 5xx status code +func (o *GatewayServiceGetMetricsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this gateway service get metrics default response a status code equal to that given +func (o *GatewayServiceGetMetricsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the gateway service get metrics default response +func (o *GatewayServiceGetMetricsDefault) Code() int { + return o._statusCode +} + +func (o *GatewayServiceGetMetricsDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/{gatewayId}/metrics][%d] GatewayService_GetMetrics default %s", o._statusCode, payload) +} + +func (o *GatewayServiceGetMetricsDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/{gatewayId}/metrics][%d] GatewayService_GetMetrics default %s", o._statusCode, payload) +} + +func (o *GatewayServiceGetMetricsDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *GatewayServiceGetMetricsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_parameters.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_parameters.go new file mode 100644 index 0000000..da864f1 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGatewayServiceGetParams creates a new GatewayServiceGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGatewayServiceGetParams() *GatewayServiceGetParams { + return &GatewayServiceGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGatewayServiceGetParamsWithTimeout creates a new GatewayServiceGetParams object +// with the ability to set a timeout on a request. +func NewGatewayServiceGetParamsWithTimeout(timeout time.Duration) *GatewayServiceGetParams { + return &GatewayServiceGetParams{ + timeout: timeout, + } +} + +// NewGatewayServiceGetParamsWithContext creates a new GatewayServiceGetParams object +// with the ability to set a context for a request. +func NewGatewayServiceGetParamsWithContext(ctx context.Context) *GatewayServiceGetParams { + return &GatewayServiceGetParams{ + Context: ctx, + } +} + +// NewGatewayServiceGetParamsWithHTTPClient creates a new GatewayServiceGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewGatewayServiceGetParamsWithHTTPClient(client *http.Client) *GatewayServiceGetParams { + return &GatewayServiceGetParams{ + HTTPClient: client, + } +} + +/* +GatewayServiceGetParams contains all the parameters to send to the API endpoint + + for the gateway service get operation. + + Typically these are written to a http.Request. +*/ +type GatewayServiceGetParams struct { + + /* GatewayID. + + Gateway ID (EUI64). + */ + GatewayID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the gateway service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceGetParams) WithDefaults() *GatewayServiceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the gateway service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the gateway service get params +func (o *GatewayServiceGetParams) WithTimeout(timeout time.Duration) *GatewayServiceGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the gateway service get params +func (o *GatewayServiceGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the gateway service get params +func (o *GatewayServiceGetParams) WithContext(ctx context.Context) *GatewayServiceGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the gateway service get params +func (o *GatewayServiceGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the gateway service get params +func (o *GatewayServiceGetParams) WithHTTPClient(client *http.Client) *GatewayServiceGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the gateway service get params +func (o *GatewayServiceGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGatewayID adds the gatewayID to the gateway service get params +func (o *GatewayServiceGetParams) WithGatewayID(gatewayID string) *GatewayServiceGetParams { + o.SetGatewayID(gatewayID) + return o +} + +// SetGatewayID adds the gatewayId to the gateway service get params +func (o *GatewayServiceGetParams) SetGatewayID(gatewayID string) { + o.GatewayID = gatewayID +} + +// WriteToRequest writes these params to a swagger request +func (o *GatewayServiceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param gatewayId + if err := r.SetPathParam("gatewayId", o.GatewayID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_relay_gateway_parameters.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_relay_gateway_parameters.go new file mode 100644 index 0000000..915dc1c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_relay_gateway_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGatewayServiceGetRelayGatewayParams creates a new GatewayServiceGetRelayGatewayParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGatewayServiceGetRelayGatewayParams() *GatewayServiceGetRelayGatewayParams { + return &GatewayServiceGetRelayGatewayParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGatewayServiceGetRelayGatewayParamsWithTimeout creates a new GatewayServiceGetRelayGatewayParams object +// with the ability to set a timeout on a request. +func NewGatewayServiceGetRelayGatewayParamsWithTimeout(timeout time.Duration) *GatewayServiceGetRelayGatewayParams { + return &GatewayServiceGetRelayGatewayParams{ + timeout: timeout, + } +} + +// NewGatewayServiceGetRelayGatewayParamsWithContext creates a new GatewayServiceGetRelayGatewayParams object +// with the ability to set a context for a request. +func NewGatewayServiceGetRelayGatewayParamsWithContext(ctx context.Context) *GatewayServiceGetRelayGatewayParams { + return &GatewayServiceGetRelayGatewayParams{ + Context: ctx, + } +} + +// NewGatewayServiceGetRelayGatewayParamsWithHTTPClient creates a new GatewayServiceGetRelayGatewayParams object +// with the ability to set a custom HTTPClient for a request. +func NewGatewayServiceGetRelayGatewayParamsWithHTTPClient(client *http.Client) *GatewayServiceGetRelayGatewayParams { + return &GatewayServiceGetRelayGatewayParams{ + HTTPClient: client, + } +} + +/* +GatewayServiceGetRelayGatewayParams contains all the parameters to send to the API endpoint + + for the gateway service get relay gateway operation. + + Typically these are written to a http.Request. +*/ +type GatewayServiceGetRelayGatewayParams struct { + + /* RelayID. + + Relay ID (4 byte HEX). + */ + RelayID string + + /* TenantID. + + Tenant ID (UUID). + */ + TenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the gateway service get relay gateway params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceGetRelayGatewayParams) WithDefaults() *GatewayServiceGetRelayGatewayParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the gateway service get relay gateway params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceGetRelayGatewayParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the gateway service get relay gateway params +func (o *GatewayServiceGetRelayGatewayParams) WithTimeout(timeout time.Duration) *GatewayServiceGetRelayGatewayParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the gateway service get relay gateway params +func (o *GatewayServiceGetRelayGatewayParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the gateway service get relay gateway params +func (o *GatewayServiceGetRelayGatewayParams) WithContext(ctx context.Context) *GatewayServiceGetRelayGatewayParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the gateway service get relay gateway params +func (o *GatewayServiceGetRelayGatewayParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the gateway service get relay gateway params +func (o *GatewayServiceGetRelayGatewayParams) WithHTTPClient(client *http.Client) *GatewayServiceGetRelayGatewayParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the gateway service get relay gateway params +func (o *GatewayServiceGetRelayGatewayParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRelayID adds the relayID to the gateway service get relay gateway params +func (o *GatewayServiceGetRelayGatewayParams) WithRelayID(relayID string) *GatewayServiceGetRelayGatewayParams { + o.SetRelayID(relayID) + return o +} + +// SetRelayID adds the relayId to the gateway service get relay gateway params +func (o *GatewayServiceGetRelayGatewayParams) SetRelayID(relayID string) { + o.RelayID = relayID +} + +// WithTenantID adds the tenantID to the gateway service get relay gateway params +func (o *GatewayServiceGetRelayGatewayParams) WithTenantID(tenantID string) *GatewayServiceGetRelayGatewayParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the gateway service get relay gateway params +func (o *GatewayServiceGetRelayGatewayParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *GatewayServiceGetRelayGatewayParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param relayId + if err := r.SetPathParam("relayId", o.RelayID); err != nil { + return err + } + + // path param tenantId + if err := r.SetPathParam("tenantId", o.TenantID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_relay_gateway_responses.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_relay_gateway_responses.go new file mode 100644 index 0000000..05a8ac6 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_relay_gateway_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// GatewayServiceGetRelayGatewayReader is a Reader for the GatewayServiceGetRelayGateway structure. +type GatewayServiceGetRelayGatewayReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GatewayServiceGetRelayGatewayReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGatewayServiceGetRelayGatewayOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGatewayServiceGetRelayGatewayDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGatewayServiceGetRelayGatewayOK creates a GatewayServiceGetRelayGatewayOK with default headers values +func NewGatewayServiceGetRelayGatewayOK() *GatewayServiceGetRelayGatewayOK { + return &GatewayServiceGetRelayGatewayOK{} +} + +/* +GatewayServiceGetRelayGatewayOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GatewayServiceGetRelayGatewayOK struct { + Payload *models.APIGetRelayGatewayResponse +} + +// IsSuccess returns true when this gateway service get relay gateway o k response has a 2xx status code +func (o *GatewayServiceGetRelayGatewayOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this gateway service get relay gateway o k response has a 3xx status code +func (o *GatewayServiceGetRelayGatewayOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this gateway service get relay gateway o k response has a 4xx status code +func (o *GatewayServiceGetRelayGatewayOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this gateway service get relay gateway o k response has a 5xx status code +func (o *GatewayServiceGetRelayGatewayOK) IsServerError() bool { + return false +} + +// IsCode returns true when this gateway service get relay gateway o k response a status code equal to that given +func (o *GatewayServiceGetRelayGatewayOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the gateway service get relay gateway o k response +func (o *GatewayServiceGetRelayGatewayOK) Code() int { + return 200 +} + +func (o *GatewayServiceGetRelayGatewayOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/relay-gateways/{tenantId}/{relayId}][%d] gatewayServiceGetRelayGatewayOK %s", 200, payload) +} + +func (o *GatewayServiceGetRelayGatewayOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/relay-gateways/{tenantId}/{relayId}][%d] gatewayServiceGetRelayGatewayOK %s", 200, payload) +} + +func (o *GatewayServiceGetRelayGatewayOK) GetPayload() *models.APIGetRelayGatewayResponse { + return o.Payload +} + +func (o *GatewayServiceGetRelayGatewayOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetRelayGatewayResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGatewayServiceGetRelayGatewayDefault creates a GatewayServiceGetRelayGatewayDefault with default headers values +func NewGatewayServiceGetRelayGatewayDefault(code int) *GatewayServiceGetRelayGatewayDefault { + return &GatewayServiceGetRelayGatewayDefault{ + _statusCode: code, + } +} + +/* +GatewayServiceGetRelayGatewayDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GatewayServiceGetRelayGatewayDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this gateway service get relay gateway default response has a 2xx status code +func (o *GatewayServiceGetRelayGatewayDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this gateway service get relay gateway default response has a 3xx status code +func (o *GatewayServiceGetRelayGatewayDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this gateway service get relay gateway default response has a 4xx status code +func (o *GatewayServiceGetRelayGatewayDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this gateway service get relay gateway default response has a 5xx status code +func (o *GatewayServiceGetRelayGatewayDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this gateway service get relay gateway default response a status code equal to that given +func (o *GatewayServiceGetRelayGatewayDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the gateway service get relay gateway default response +func (o *GatewayServiceGetRelayGatewayDefault) Code() int { + return o._statusCode +} + +func (o *GatewayServiceGetRelayGatewayDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/relay-gateways/{tenantId}/{relayId}][%d] GatewayService_GetRelayGateway default %s", o._statusCode, payload) +} + +func (o *GatewayServiceGetRelayGatewayDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/relay-gateways/{tenantId}/{relayId}][%d] GatewayService_GetRelayGateway default %s", o._statusCode, payload) +} + +func (o *GatewayServiceGetRelayGatewayDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *GatewayServiceGetRelayGatewayDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_responses.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_responses.go new file mode 100644 index 0000000..a93bf0b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_get_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// GatewayServiceGetReader is a Reader for the GatewayServiceGet structure. +type GatewayServiceGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GatewayServiceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGatewayServiceGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGatewayServiceGetDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGatewayServiceGetOK creates a GatewayServiceGetOK with default headers values +func NewGatewayServiceGetOK() *GatewayServiceGetOK { + return &GatewayServiceGetOK{} +} + +/* +GatewayServiceGetOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GatewayServiceGetOK struct { + Payload *models.APIGetGatewayResponse +} + +// IsSuccess returns true when this gateway service get o k response has a 2xx status code +func (o *GatewayServiceGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this gateway service get o k response has a 3xx status code +func (o *GatewayServiceGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this gateway service get o k response has a 4xx status code +func (o *GatewayServiceGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this gateway service get o k response has a 5xx status code +func (o *GatewayServiceGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this gateway service get o k response a status code equal to that given +func (o *GatewayServiceGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the gateway service get o k response +func (o *GatewayServiceGetOK) Code() int { + return 200 +} + +func (o *GatewayServiceGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/{gatewayId}][%d] gatewayServiceGetOK %s", 200, payload) +} + +func (o *GatewayServiceGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/{gatewayId}][%d] gatewayServiceGetOK %s", 200, payload) +} + +func (o *GatewayServiceGetOK) GetPayload() *models.APIGetGatewayResponse { + return o.Payload +} + +func (o *GatewayServiceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetGatewayResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGatewayServiceGetDefault creates a GatewayServiceGetDefault with default headers values +func NewGatewayServiceGetDefault(code int) *GatewayServiceGetDefault { + return &GatewayServiceGetDefault{ + _statusCode: code, + } +} + +/* +GatewayServiceGetDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GatewayServiceGetDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this gateway service get default response has a 2xx status code +func (o *GatewayServiceGetDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this gateway service get default response has a 3xx status code +func (o *GatewayServiceGetDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this gateway service get default response has a 4xx status code +func (o *GatewayServiceGetDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this gateway service get default response has a 5xx status code +func (o *GatewayServiceGetDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this gateway service get default response a status code equal to that given +func (o *GatewayServiceGetDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the gateway service get default response +func (o *GatewayServiceGetDefault) Code() int { + return o._statusCode +} + +func (o *GatewayServiceGetDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/{gatewayId}][%d] GatewayService_Get default %s", o._statusCode, payload) +} + +func (o *GatewayServiceGetDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/{gatewayId}][%d] GatewayService_Get default %s", o._statusCode, payload) +} + +func (o *GatewayServiceGetDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *GatewayServiceGetDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_list_parameters.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_list_parameters.go new file mode 100644 index 0000000..cdf19f6 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_list_parameters.go @@ -0,0 +1,387 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewGatewayServiceListParams creates a new GatewayServiceListParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGatewayServiceListParams() *GatewayServiceListParams { + return &GatewayServiceListParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGatewayServiceListParamsWithTimeout creates a new GatewayServiceListParams object +// with the ability to set a timeout on a request. +func NewGatewayServiceListParamsWithTimeout(timeout time.Duration) *GatewayServiceListParams { + return &GatewayServiceListParams{ + timeout: timeout, + } +} + +// NewGatewayServiceListParamsWithContext creates a new GatewayServiceListParams object +// with the ability to set a context for a request. +func NewGatewayServiceListParamsWithContext(ctx context.Context) *GatewayServiceListParams { + return &GatewayServiceListParams{ + Context: ctx, + } +} + +// NewGatewayServiceListParamsWithHTTPClient creates a new GatewayServiceListParams object +// with the ability to set a custom HTTPClient for a request. +func NewGatewayServiceListParamsWithHTTPClient(client *http.Client) *GatewayServiceListParams { + return &GatewayServiceListParams{ + HTTPClient: client, + } +} + +/* +GatewayServiceListParams contains all the parameters to send to the API endpoint + + for the gateway service list operation. + + Typically these are written to a http.Request. +*/ +type GatewayServiceListParams struct { + + /* Limit. + + Max number of gateways to return in the result-set. + If not set, it will be treated as 0, and the response will only return the total_count. + + Format: int64 + */ + Limit *int64 + + /* MulticastGroupID. + + Multicast-group ID (UUID) to filter gateways on. + */ + MulticastGroupID *string + + /* Offset. + + Offset in the result-set (for pagination). + + Format: int64 + */ + Offset *int64 + + /* OrderBy. + + If set, the given value will be used to sort by (optional). + + Default: "NAME" + */ + OrderBy *string + + /* OrderByDesc. + + If set, the sorting direction will be decending (default = ascending) (optional). + */ + OrderByDesc *bool + + /* Search. + + If set, the given string will be used to search on name (optional). + */ + Search *string + + /* TenantID. + + Tenant ID (UUID) to filter gateways on. + To list all gateways as a global admin user, this field can be left blank. + */ + TenantID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the gateway service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceListParams) WithDefaults() *GatewayServiceListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the gateway service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceListParams) SetDefaults() { + var ( + orderByDefault = string("NAME") + ) + + val := GatewayServiceListParams{ + OrderBy: &orderByDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the gateway service list params +func (o *GatewayServiceListParams) WithTimeout(timeout time.Duration) *GatewayServiceListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the gateway service list params +func (o *GatewayServiceListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the gateway service list params +func (o *GatewayServiceListParams) WithContext(ctx context.Context) *GatewayServiceListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the gateway service list params +func (o *GatewayServiceListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the gateway service list params +func (o *GatewayServiceListParams) WithHTTPClient(client *http.Client) *GatewayServiceListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the gateway service list params +func (o *GatewayServiceListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the gateway service list params +func (o *GatewayServiceListParams) WithLimit(limit *int64) *GatewayServiceListParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the gateway service list params +func (o *GatewayServiceListParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMulticastGroupID adds the multicastGroupID to the gateway service list params +func (o *GatewayServiceListParams) WithMulticastGroupID(multicastGroupID *string) *GatewayServiceListParams { + o.SetMulticastGroupID(multicastGroupID) + return o +} + +// SetMulticastGroupID adds the multicastGroupId to the gateway service list params +func (o *GatewayServiceListParams) SetMulticastGroupID(multicastGroupID *string) { + o.MulticastGroupID = multicastGroupID +} + +// WithOffset adds the offset to the gateway service list params +func (o *GatewayServiceListParams) WithOffset(offset *int64) *GatewayServiceListParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the gateway service list params +func (o *GatewayServiceListParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithOrderBy adds the orderBy to the gateway service list params +func (o *GatewayServiceListParams) WithOrderBy(orderBy *string) *GatewayServiceListParams { + o.SetOrderBy(orderBy) + return o +} + +// SetOrderBy adds the orderBy to the gateway service list params +func (o *GatewayServiceListParams) SetOrderBy(orderBy *string) { + o.OrderBy = orderBy +} + +// WithOrderByDesc adds the orderByDesc to the gateway service list params +func (o *GatewayServiceListParams) WithOrderByDesc(orderByDesc *bool) *GatewayServiceListParams { + o.SetOrderByDesc(orderByDesc) + return o +} + +// SetOrderByDesc adds the orderByDesc to the gateway service list params +func (o *GatewayServiceListParams) SetOrderByDesc(orderByDesc *bool) { + o.OrderByDesc = orderByDesc +} + +// WithSearch adds the search to the gateway service list params +func (o *GatewayServiceListParams) WithSearch(search *string) *GatewayServiceListParams { + o.SetSearch(search) + return o +} + +// SetSearch adds the search to the gateway service list params +func (o *GatewayServiceListParams) SetSearch(search *string) { + o.Search = search +} + +// WithTenantID adds the tenantID to the gateway service list params +func (o *GatewayServiceListParams) WithTenantID(tenantID *string) *GatewayServiceListParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the gateway service list params +func (o *GatewayServiceListParams) SetTenantID(tenantID *string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *GatewayServiceListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Limit != nil { + + // query param limit + var qrLimit int64 + + if o.Limit != nil { + qrLimit = *o.Limit + } + qLimit := swag.FormatInt64(qrLimit) + if qLimit != "" { + + if err := r.SetQueryParam("limit", qLimit); err != nil { + return err + } + } + } + + if o.MulticastGroupID != nil { + + // query param multicastGroupId + var qrMulticastGroupID string + + if o.MulticastGroupID != nil { + qrMulticastGroupID = *o.MulticastGroupID + } + qMulticastGroupID := qrMulticastGroupID + if qMulticastGroupID != "" { + + if err := r.SetQueryParam("multicastGroupId", qMulticastGroupID); err != nil { + return err + } + } + } + + if o.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + if o.OrderBy != nil { + + // query param orderBy + var qrOrderBy string + + if o.OrderBy != nil { + qrOrderBy = *o.OrderBy + } + qOrderBy := qrOrderBy + if qOrderBy != "" { + + if err := r.SetQueryParam("orderBy", qOrderBy); err != nil { + return err + } + } + } + + if o.OrderByDesc != nil { + + // query param orderByDesc + var qrOrderByDesc bool + + if o.OrderByDesc != nil { + qrOrderByDesc = *o.OrderByDesc + } + qOrderByDesc := swag.FormatBool(qrOrderByDesc) + if qOrderByDesc != "" { + + if err := r.SetQueryParam("orderByDesc", qOrderByDesc); err != nil { + return err + } + } + } + + if o.Search != nil { + + // query param search + var qrSearch string + + if o.Search != nil { + qrSearch = *o.Search + } + qSearch := qrSearch + if qSearch != "" { + + if err := r.SetQueryParam("search", qSearch); err != nil { + return err + } + } + } + + if o.TenantID != nil { + + // query param tenantId + var qrTenantID string + + if o.TenantID != nil { + qrTenantID = *o.TenantID + } + qTenantID := qrTenantID + if qTenantID != "" { + + if err := r.SetQueryParam("tenantId", qTenantID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_list_relay_gateways_parameters.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_list_relay_gateways_parameters.go new file mode 100644 index 0000000..a1b68e3 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_list_relay_gateways_parameters.go @@ -0,0 +1,238 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewGatewayServiceListRelayGatewaysParams creates a new GatewayServiceListRelayGatewaysParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGatewayServiceListRelayGatewaysParams() *GatewayServiceListRelayGatewaysParams { + return &GatewayServiceListRelayGatewaysParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGatewayServiceListRelayGatewaysParamsWithTimeout creates a new GatewayServiceListRelayGatewaysParams object +// with the ability to set a timeout on a request. +func NewGatewayServiceListRelayGatewaysParamsWithTimeout(timeout time.Duration) *GatewayServiceListRelayGatewaysParams { + return &GatewayServiceListRelayGatewaysParams{ + timeout: timeout, + } +} + +// NewGatewayServiceListRelayGatewaysParamsWithContext creates a new GatewayServiceListRelayGatewaysParams object +// with the ability to set a context for a request. +func NewGatewayServiceListRelayGatewaysParamsWithContext(ctx context.Context) *GatewayServiceListRelayGatewaysParams { + return &GatewayServiceListRelayGatewaysParams{ + Context: ctx, + } +} + +// NewGatewayServiceListRelayGatewaysParamsWithHTTPClient creates a new GatewayServiceListRelayGatewaysParams object +// with the ability to set a custom HTTPClient for a request. +func NewGatewayServiceListRelayGatewaysParamsWithHTTPClient(client *http.Client) *GatewayServiceListRelayGatewaysParams { + return &GatewayServiceListRelayGatewaysParams{ + HTTPClient: client, + } +} + +/* +GatewayServiceListRelayGatewaysParams contains all the parameters to send to the API endpoint + + for the gateway service list relay gateways operation. + + Typically these are written to a http.Request. +*/ +type GatewayServiceListRelayGatewaysParams struct { + + /* Limit. + + Max number of relay-gateways to return in the result-set. + If not set, it will be treated as 0, and the response will only return the total_count. + + Format: int64 + */ + Limit *int64 + + /* Offset. + + Offset in the result-set (for pagination). + + Format: int64 + */ + Offset *int64 + + /* TenantID. + + Tenant ID (UUID) to filter relay-gateways on. + To list all relay-gateways as a global admin user, this field can be left blank. + */ + TenantID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the gateway service list relay gateways params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceListRelayGatewaysParams) WithDefaults() *GatewayServiceListRelayGatewaysParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the gateway service list relay gateways params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceListRelayGatewaysParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the gateway service list relay gateways params +func (o *GatewayServiceListRelayGatewaysParams) WithTimeout(timeout time.Duration) *GatewayServiceListRelayGatewaysParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the gateway service list relay gateways params +func (o *GatewayServiceListRelayGatewaysParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the gateway service list relay gateways params +func (o *GatewayServiceListRelayGatewaysParams) WithContext(ctx context.Context) *GatewayServiceListRelayGatewaysParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the gateway service list relay gateways params +func (o *GatewayServiceListRelayGatewaysParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the gateway service list relay gateways params +func (o *GatewayServiceListRelayGatewaysParams) WithHTTPClient(client *http.Client) *GatewayServiceListRelayGatewaysParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the gateway service list relay gateways params +func (o *GatewayServiceListRelayGatewaysParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the gateway service list relay gateways params +func (o *GatewayServiceListRelayGatewaysParams) WithLimit(limit *int64) *GatewayServiceListRelayGatewaysParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the gateway service list relay gateways params +func (o *GatewayServiceListRelayGatewaysParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithOffset adds the offset to the gateway service list relay gateways params +func (o *GatewayServiceListRelayGatewaysParams) WithOffset(offset *int64) *GatewayServiceListRelayGatewaysParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the gateway service list relay gateways params +func (o *GatewayServiceListRelayGatewaysParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithTenantID adds the tenantID to the gateway service list relay gateways params +func (o *GatewayServiceListRelayGatewaysParams) WithTenantID(tenantID *string) *GatewayServiceListRelayGatewaysParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the gateway service list relay gateways params +func (o *GatewayServiceListRelayGatewaysParams) SetTenantID(tenantID *string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *GatewayServiceListRelayGatewaysParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Limit != nil { + + // query param limit + var qrLimit int64 + + if o.Limit != nil { + qrLimit = *o.Limit + } + qLimit := swag.FormatInt64(qrLimit) + if qLimit != "" { + + if err := r.SetQueryParam("limit", qLimit); err != nil { + return err + } + } + } + + if o.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + if o.TenantID != nil { + + // query param tenantId + var qrTenantID string + + if o.TenantID != nil { + qrTenantID = *o.TenantID + } + qTenantID := qrTenantID + if qTenantID != "" { + + if err := r.SetQueryParam("tenantId", qTenantID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_list_relay_gateways_responses.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_list_relay_gateways_responses.go new file mode 100644 index 0000000..4beed3c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_list_relay_gateways_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// GatewayServiceListRelayGatewaysReader is a Reader for the GatewayServiceListRelayGateways structure. +type GatewayServiceListRelayGatewaysReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GatewayServiceListRelayGatewaysReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGatewayServiceListRelayGatewaysOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGatewayServiceListRelayGatewaysDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGatewayServiceListRelayGatewaysOK creates a GatewayServiceListRelayGatewaysOK with default headers values +func NewGatewayServiceListRelayGatewaysOK() *GatewayServiceListRelayGatewaysOK { + return &GatewayServiceListRelayGatewaysOK{} +} + +/* +GatewayServiceListRelayGatewaysOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GatewayServiceListRelayGatewaysOK struct { + Payload *models.APIListRelayGatewaysResponse +} + +// IsSuccess returns true when this gateway service list relay gateways o k response has a 2xx status code +func (o *GatewayServiceListRelayGatewaysOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this gateway service list relay gateways o k response has a 3xx status code +func (o *GatewayServiceListRelayGatewaysOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this gateway service list relay gateways o k response has a 4xx status code +func (o *GatewayServiceListRelayGatewaysOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this gateway service list relay gateways o k response has a 5xx status code +func (o *GatewayServiceListRelayGatewaysOK) IsServerError() bool { + return false +} + +// IsCode returns true when this gateway service list relay gateways o k response a status code equal to that given +func (o *GatewayServiceListRelayGatewaysOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the gateway service list relay gateways o k response +func (o *GatewayServiceListRelayGatewaysOK) Code() int { + return 200 +} + +func (o *GatewayServiceListRelayGatewaysOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/relay-gateways][%d] gatewayServiceListRelayGatewaysOK %s", 200, payload) +} + +func (o *GatewayServiceListRelayGatewaysOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/relay-gateways][%d] gatewayServiceListRelayGatewaysOK %s", 200, payload) +} + +func (o *GatewayServiceListRelayGatewaysOK) GetPayload() *models.APIListRelayGatewaysResponse { + return o.Payload +} + +func (o *GatewayServiceListRelayGatewaysOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListRelayGatewaysResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGatewayServiceListRelayGatewaysDefault creates a GatewayServiceListRelayGatewaysDefault with default headers values +func NewGatewayServiceListRelayGatewaysDefault(code int) *GatewayServiceListRelayGatewaysDefault { + return &GatewayServiceListRelayGatewaysDefault{ + _statusCode: code, + } +} + +/* +GatewayServiceListRelayGatewaysDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GatewayServiceListRelayGatewaysDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this gateway service list relay gateways default response has a 2xx status code +func (o *GatewayServiceListRelayGatewaysDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this gateway service list relay gateways default response has a 3xx status code +func (o *GatewayServiceListRelayGatewaysDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this gateway service list relay gateways default response has a 4xx status code +func (o *GatewayServiceListRelayGatewaysDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this gateway service list relay gateways default response has a 5xx status code +func (o *GatewayServiceListRelayGatewaysDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this gateway service list relay gateways default response a status code equal to that given +func (o *GatewayServiceListRelayGatewaysDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the gateway service list relay gateways default response +func (o *GatewayServiceListRelayGatewaysDefault) Code() int { + return o._statusCode +} + +func (o *GatewayServiceListRelayGatewaysDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/relay-gateways][%d] GatewayService_ListRelayGateways default %s", o._statusCode, payload) +} + +func (o *GatewayServiceListRelayGatewaysDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways/relay-gateways][%d] GatewayService_ListRelayGateways default %s", o._statusCode, payload) +} + +func (o *GatewayServiceListRelayGatewaysDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *GatewayServiceListRelayGatewaysDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_list_responses.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_list_responses.go new file mode 100644 index 0000000..86eabc6 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_list_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// GatewayServiceListReader is a Reader for the GatewayServiceList structure. +type GatewayServiceListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GatewayServiceListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGatewayServiceListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGatewayServiceListDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGatewayServiceListOK creates a GatewayServiceListOK with default headers values +func NewGatewayServiceListOK() *GatewayServiceListOK { + return &GatewayServiceListOK{} +} + +/* +GatewayServiceListOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GatewayServiceListOK struct { + Payload *models.APIListGatewaysResponse +} + +// IsSuccess returns true when this gateway service list o k response has a 2xx status code +func (o *GatewayServiceListOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this gateway service list o k response has a 3xx status code +func (o *GatewayServiceListOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this gateway service list o k response has a 4xx status code +func (o *GatewayServiceListOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this gateway service list o k response has a 5xx status code +func (o *GatewayServiceListOK) IsServerError() bool { + return false +} + +// IsCode returns true when this gateway service list o k response a status code equal to that given +func (o *GatewayServiceListOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the gateway service list o k response +func (o *GatewayServiceListOK) Code() int { + return 200 +} + +func (o *GatewayServiceListOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways][%d] gatewayServiceListOK %s", 200, payload) +} + +func (o *GatewayServiceListOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways][%d] gatewayServiceListOK %s", 200, payload) +} + +func (o *GatewayServiceListOK) GetPayload() *models.APIListGatewaysResponse { + return o.Payload +} + +func (o *GatewayServiceListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListGatewaysResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGatewayServiceListDefault creates a GatewayServiceListDefault with default headers values +func NewGatewayServiceListDefault(code int) *GatewayServiceListDefault { + return &GatewayServiceListDefault{ + _statusCode: code, + } +} + +/* +GatewayServiceListDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GatewayServiceListDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this gateway service list default response has a 2xx status code +func (o *GatewayServiceListDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this gateway service list default response has a 3xx status code +func (o *GatewayServiceListDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this gateway service list default response has a 4xx status code +func (o *GatewayServiceListDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this gateway service list default response has a 5xx status code +func (o *GatewayServiceListDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this gateway service list default response a status code equal to that given +func (o *GatewayServiceListDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the gateway service list default response +func (o *GatewayServiceListDefault) Code() int { + return o._statusCode +} + +func (o *GatewayServiceListDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways][%d] GatewayService_List default %s", o._statusCode, payload) +} + +func (o *GatewayServiceListDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/gateways][%d] GatewayService_List default %s", o._statusCode, payload) +} + +func (o *GatewayServiceListDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *GatewayServiceListDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_update_parameters.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_update_parameters.go new file mode 100644 index 0000000..413edd9 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_update_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGatewayServiceUpdateParams creates a new GatewayServiceUpdateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGatewayServiceUpdateParams() *GatewayServiceUpdateParams { + return &GatewayServiceUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGatewayServiceUpdateParamsWithTimeout creates a new GatewayServiceUpdateParams object +// with the ability to set a timeout on a request. +func NewGatewayServiceUpdateParamsWithTimeout(timeout time.Duration) *GatewayServiceUpdateParams { + return &GatewayServiceUpdateParams{ + timeout: timeout, + } +} + +// NewGatewayServiceUpdateParamsWithContext creates a new GatewayServiceUpdateParams object +// with the ability to set a context for a request. +func NewGatewayServiceUpdateParamsWithContext(ctx context.Context) *GatewayServiceUpdateParams { + return &GatewayServiceUpdateParams{ + Context: ctx, + } +} + +// NewGatewayServiceUpdateParamsWithHTTPClient creates a new GatewayServiceUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewGatewayServiceUpdateParamsWithHTTPClient(client *http.Client) *GatewayServiceUpdateParams { + return &GatewayServiceUpdateParams{ + HTTPClient: client, + } +} + +/* +GatewayServiceUpdateParams contains all the parameters to send to the API endpoint + + for the gateway service update operation. + + Typically these are written to a http.Request. +*/ +type GatewayServiceUpdateParams struct { + + // Body. + Body GatewayServiceUpdateBody + + /* GatewayGatewayID. + + Gateway ID (EUI64). + */ + GatewayGatewayID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the gateway service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceUpdateParams) WithDefaults() *GatewayServiceUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the gateway service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the gateway service update params +func (o *GatewayServiceUpdateParams) WithTimeout(timeout time.Duration) *GatewayServiceUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the gateway service update params +func (o *GatewayServiceUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the gateway service update params +func (o *GatewayServiceUpdateParams) WithContext(ctx context.Context) *GatewayServiceUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the gateway service update params +func (o *GatewayServiceUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the gateway service update params +func (o *GatewayServiceUpdateParams) WithHTTPClient(client *http.Client) *GatewayServiceUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the gateway service update params +func (o *GatewayServiceUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the gateway service update params +func (o *GatewayServiceUpdateParams) WithBody(body GatewayServiceUpdateBody) *GatewayServiceUpdateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the gateway service update params +func (o *GatewayServiceUpdateParams) SetBody(body GatewayServiceUpdateBody) { + o.Body = body +} + +// WithGatewayGatewayID adds the gatewayGatewayID to the gateway service update params +func (o *GatewayServiceUpdateParams) WithGatewayGatewayID(gatewayGatewayID string) *GatewayServiceUpdateParams { + o.SetGatewayGatewayID(gatewayGatewayID) + return o +} + +// SetGatewayGatewayID adds the gatewayGatewayId to the gateway service update params +func (o *GatewayServiceUpdateParams) SetGatewayGatewayID(gatewayGatewayID string) { + o.GatewayGatewayID = gatewayGatewayID +} + +// WriteToRequest writes these params to a swagger request +func (o *GatewayServiceUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param gateway.gatewayId + if err := r.SetPathParam("gateway.gatewayId", o.GatewayGatewayID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_update_relay_gateway_parameters.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_update_relay_gateway_parameters.go new file mode 100644 index 0000000..abc2935 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_update_relay_gateway_parameters.go @@ -0,0 +1,190 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGatewayServiceUpdateRelayGatewayParams creates a new GatewayServiceUpdateRelayGatewayParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGatewayServiceUpdateRelayGatewayParams() *GatewayServiceUpdateRelayGatewayParams { + return &GatewayServiceUpdateRelayGatewayParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGatewayServiceUpdateRelayGatewayParamsWithTimeout creates a new GatewayServiceUpdateRelayGatewayParams object +// with the ability to set a timeout on a request. +func NewGatewayServiceUpdateRelayGatewayParamsWithTimeout(timeout time.Duration) *GatewayServiceUpdateRelayGatewayParams { + return &GatewayServiceUpdateRelayGatewayParams{ + timeout: timeout, + } +} + +// NewGatewayServiceUpdateRelayGatewayParamsWithContext creates a new GatewayServiceUpdateRelayGatewayParams object +// with the ability to set a context for a request. +func NewGatewayServiceUpdateRelayGatewayParamsWithContext(ctx context.Context) *GatewayServiceUpdateRelayGatewayParams { + return &GatewayServiceUpdateRelayGatewayParams{ + Context: ctx, + } +} + +// NewGatewayServiceUpdateRelayGatewayParamsWithHTTPClient creates a new GatewayServiceUpdateRelayGatewayParams object +// with the ability to set a custom HTTPClient for a request. +func NewGatewayServiceUpdateRelayGatewayParamsWithHTTPClient(client *http.Client) *GatewayServiceUpdateRelayGatewayParams { + return &GatewayServiceUpdateRelayGatewayParams{ + HTTPClient: client, + } +} + +/* +GatewayServiceUpdateRelayGatewayParams contains all the parameters to send to the API endpoint + + for the gateway service update relay gateway operation. + + Typically these are written to a http.Request. +*/ +type GatewayServiceUpdateRelayGatewayParams struct { + + // Body. + Body GatewayServiceUpdateRelayGatewayBody + + /* RelayGatewayRelayID. + + Relay ID (4 byte HEX). + */ + RelayGatewayRelayID string + + /* RelayGatewayTenantID. + + Tenant ID. + */ + RelayGatewayTenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the gateway service update relay gateway params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceUpdateRelayGatewayParams) WithDefaults() *GatewayServiceUpdateRelayGatewayParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the gateway service update relay gateway params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GatewayServiceUpdateRelayGatewayParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the gateway service update relay gateway params +func (o *GatewayServiceUpdateRelayGatewayParams) WithTimeout(timeout time.Duration) *GatewayServiceUpdateRelayGatewayParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the gateway service update relay gateway params +func (o *GatewayServiceUpdateRelayGatewayParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the gateway service update relay gateway params +func (o *GatewayServiceUpdateRelayGatewayParams) WithContext(ctx context.Context) *GatewayServiceUpdateRelayGatewayParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the gateway service update relay gateway params +func (o *GatewayServiceUpdateRelayGatewayParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the gateway service update relay gateway params +func (o *GatewayServiceUpdateRelayGatewayParams) WithHTTPClient(client *http.Client) *GatewayServiceUpdateRelayGatewayParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the gateway service update relay gateway params +func (o *GatewayServiceUpdateRelayGatewayParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the gateway service update relay gateway params +func (o *GatewayServiceUpdateRelayGatewayParams) WithBody(body GatewayServiceUpdateRelayGatewayBody) *GatewayServiceUpdateRelayGatewayParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the gateway service update relay gateway params +func (o *GatewayServiceUpdateRelayGatewayParams) SetBody(body GatewayServiceUpdateRelayGatewayBody) { + o.Body = body +} + +// WithRelayGatewayRelayID adds the relayGatewayRelayID to the gateway service update relay gateway params +func (o *GatewayServiceUpdateRelayGatewayParams) WithRelayGatewayRelayID(relayGatewayRelayID string) *GatewayServiceUpdateRelayGatewayParams { + o.SetRelayGatewayRelayID(relayGatewayRelayID) + return o +} + +// SetRelayGatewayRelayID adds the relayGatewayRelayId to the gateway service update relay gateway params +func (o *GatewayServiceUpdateRelayGatewayParams) SetRelayGatewayRelayID(relayGatewayRelayID string) { + o.RelayGatewayRelayID = relayGatewayRelayID +} + +// WithRelayGatewayTenantID adds the relayGatewayTenantID to the gateway service update relay gateway params +func (o *GatewayServiceUpdateRelayGatewayParams) WithRelayGatewayTenantID(relayGatewayTenantID string) *GatewayServiceUpdateRelayGatewayParams { + o.SetRelayGatewayTenantID(relayGatewayTenantID) + return o +} + +// SetRelayGatewayTenantID adds the relayGatewayTenantId to the gateway service update relay gateway params +func (o *GatewayServiceUpdateRelayGatewayParams) SetRelayGatewayTenantID(relayGatewayTenantID string) { + o.RelayGatewayTenantID = relayGatewayTenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *GatewayServiceUpdateRelayGatewayParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param relayGateway.relayId + if err := r.SetPathParam("relayGateway.relayId", o.RelayGatewayRelayID); err != nil { + return err + } + + // path param relayGateway.tenantId + if err := r.SetPathParam("relayGateway.tenantId", o.RelayGatewayTenantID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_update_relay_gateway_responses.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_update_relay_gateway_responses.go new file mode 100644 index 0000000..41f8910 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_update_relay_gateway_responses.go @@ -0,0 +1,333 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// GatewayServiceUpdateRelayGatewayReader is a Reader for the GatewayServiceUpdateRelayGateway structure. +type GatewayServiceUpdateRelayGatewayReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GatewayServiceUpdateRelayGatewayReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGatewayServiceUpdateRelayGatewayOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGatewayServiceUpdateRelayGatewayDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGatewayServiceUpdateRelayGatewayOK creates a GatewayServiceUpdateRelayGatewayOK with default headers values +func NewGatewayServiceUpdateRelayGatewayOK() *GatewayServiceUpdateRelayGatewayOK { + return &GatewayServiceUpdateRelayGatewayOK{} +} + +/* +GatewayServiceUpdateRelayGatewayOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GatewayServiceUpdateRelayGatewayOK struct { + Payload interface{} +} + +// IsSuccess returns true when this gateway service update relay gateway o k response has a 2xx status code +func (o *GatewayServiceUpdateRelayGatewayOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this gateway service update relay gateway o k response has a 3xx status code +func (o *GatewayServiceUpdateRelayGatewayOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this gateway service update relay gateway o k response has a 4xx status code +func (o *GatewayServiceUpdateRelayGatewayOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this gateway service update relay gateway o k response has a 5xx status code +func (o *GatewayServiceUpdateRelayGatewayOK) IsServerError() bool { + return false +} + +// IsCode returns true when this gateway service update relay gateway o k response a status code equal to that given +func (o *GatewayServiceUpdateRelayGatewayOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the gateway service update relay gateway o k response +func (o *GatewayServiceUpdateRelayGatewayOK) Code() int { + return 200 +} + +func (o *GatewayServiceUpdateRelayGatewayOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/gateways/relay-gateways/{relayGateway.tenantId}/{relayGateway.relayId}][%d] gatewayServiceUpdateRelayGatewayOK %s", 200, payload) +} + +func (o *GatewayServiceUpdateRelayGatewayOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/gateways/relay-gateways/{relayGateway.tenantId}/{relayGateway.relayId}][%d] gatewayServiceUpdateRelayGatewayOK %s", 200, payload) +} + +func (o *GatewayServiceUpdateRelayGatewayOK) GetPayload() interface{} { + return o.Payload +} + +func (o *GatewayServiceUpdateRelayGatewayOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGatewayServiceUpdateRelayGatewayDefault creates a GatewayServiceUpdateRelayGatewayDefault with default headers values +func NewGatewayServiceUpdateRelayGatewayDefault(code int) *GatewayServiceUpdateRelayGatewayDefault { + return &GatewayServiceUpdateRelayGatewayDefault{ + _statusCode: code, + } +} + +/* +GatewayServiceUpdateRelayGatewayDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GatewayServiceUpdateRelayGatewayDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this gateway service update relay gateway default response has a 2xx status code +func (o *GatewayServiceUpdateRelayGatewayDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this gateway service update relay gateway default response has a 3xx status code +func (o *GatewayServiceUpdateRelayGatewayDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this gateway service update relay gateway default response has a 4xx status code +func (o *GatewayServiceUpdateRelayGatewayDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this gateway service update relay gateway default response has a 5xx status code +func (o *GatewayServiceUpdateRelayGatewayDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this gateway service update relay gateway default response a status code equal to that given +func (o *GatewayServiceUpdateRelayGatewayDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the gateway service update relay gateway default response +func (o *GatewayServiceUpdateRelayGatewayDefault) Code() int { + return o._statusCode +} + +func (o *GatewayServiceUpdateRelayGatewayDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/gateways/relay-gateways/{relayGateway.tenantId}/{relayGateway.relayId}][%d] GatewayService_UpdateRelayGateway default %s", o._statusCode, payload) +} + +func (o *GatewayServiceUpdateRelayGatewayDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/gateways/relay-gateways/{relayGateway.tenantId}/{relayGateway.relayId}][%d] GatewayService_UpdateRelayGateway default %s", o._statusCode, payload) +} + +func (o *GatewayServiceUpdateRelayGatewayDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *GatewayServiceUpdateRelayGatewayDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +GatewayServiceUpdateRelayGatewayBody gateway service update relay gateway body +swagger:model GatewayServiceUpdateRelayGatewayBody +*/ +type GatewayServiceUpdateRelayGatewayBody struct { + + // relay gateway + RelayGateway *GatewayServiceUpdateRelayGatewayParamsBodyRelayGateway `json:"relayGateway,omitempty"` +} + +// Validate validates this gateway service update relay gateway body +func (o *GatewayServiceUpdateRelayGatewayBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateRelayGateway(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *GatewayServiceUpdateRelayGatewayBody) validateRelayGateway(formats strfmt.Registry) error { + if swag.IsZero(o.RelayGateway) { // not required + return nil + } + + if o.RelayGateway != nil { + if err := o.RelayGateway.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "relayGateway") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "relayGateway") + } + return err + } + } + + return nil +} + +// ContextValidate validate this gateway service update relay gateway body based on the context it is used +func (o *GatewayServiceUpdateRelayGatewayBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateRelayGateway(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *GatewayServiceUpdateRelayGatewayBody) contextValidateRelayGateway(ctx context.Context, formats strfmt.Registry) error { + + if o.RelayGateway != nil { + + if swag.IsZero(o.RelayGateway) { // not required + return nil + } + + if err := o.RelayGateway.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "relayGateway") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "relayGateway") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *GatewayServiceUpdateRelayGatewayBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *GatewayServiceUpdateRelayGatewayBody) UnmarshalBinary(b []byte) error { + var res GatewayServiceUpdateRelayGatewayBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +GatewayServiceUpdateRelayGatewayParamsBodyRelayGateway Relay Gateway object. +swagger:model GatewayServiceUpdateRelayGatewayParamsBodyRelayGateway +*/ +type GatewayServiceUpdateRelayGatewayParamsBodyRelayGateway struct { + + // Description. + Description string `json:"description,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Region configuration ID. + RegionConfigID string `json:"regionConfigId,omitempty"` + + // Stats interval (seconds). + // This defines the expected interval in which the gateway sends its + // statistics. + StatsInterval int64 `json:"statsInterval,omitempty"` +} + +// Validate validates this gateway service update relay gateway params body relay gateway +func (o *GatewayServiceUpdateRelayGatewayParamsBodyRelayGateway) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this gateway service update relay gateway params body relay gateway based on context it is used +func (o *GatewayServiceUpdateRelayGatewayParamsBodyRelayGateway) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *GatewayServiceUpdateRelayGatewayParamsBodyRelayGateway) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *GatewayServiceUpdateRelayGatewayParamsBodyRelayGateway) UnmarshalBinary(b []byte) error { + var res GatewayServiceUpdateRelayGatewayParamsBodyRelayGateway + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_update_responses.go b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_update_responses.go new file mode 100644 index 0000000..33261f8 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/gateway_service/gateway_service_update_responses.go @@ -0,0 +1,400 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package gateway_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// GatewayServiceUpdateReader is a Reader for the GatewayServiceUpdate structure. +type GatewayServiceUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GatewayServiceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGatewayServiceUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGatewayServiceUpdateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGatewayServiceUpdateOK creates a GatewayServiceUpdateOK with default headers values +func NewGatewayServiceUpdateOK() *GatewayServiceUpdateOK { + return &GatewayServiceUpdateOK{} +} + +/* +GatewayServiceUpdateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GatewayServiceUpdateOK struct { + Payload interface{} +} + +// IsSuccess returns true when this gateway service update o k response has a 2xx status code +func (o *GatewayServiceUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this gateway service update o k response has a 3xx status code +func (o *GatewayServiceUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this gateway service update o k response has a 4xx status code +func (o *GatewayServiceUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this gateway service update o k response has a 5xx status code +func (o *GatewayServiceUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this gateway service update o k response a status code equal to that given +func (o *GatewayServiceUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the gateway service update o k response +func (o *GatewayServiceUpdateOK) Code() int { + return 200 +} + +func (o *GatewayServiceUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/gateways/{gateway.gatewayId}][%d] gatewayServiceUpdateOK %s", 200, payload) +} + +func (o *GatewayServiceUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/gateways/{gateway.gatewayId}][%d] gatewayServiceUpdateOK %s", 200, payload) +} + +func (o *GatewayServiceUpdateOK) GetPayload() interface{} { + return o.Payload +} + +func (o *GatewayServiceUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGatewayServiceUpdateDefault creates a GatewayServiceUpdateDefault with default headers values +func NewGatewayServiceUpdateDefault(code int) *GatewayServiceUpdateDefault { + return &GatewayServiceUpdateDefault{ + _statusCode: code, + } +} + +/* +GatewayServiceUpdateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GatewayServiceUpdateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this gateway service update default response has a 2xx status code +func (o *GatewayServiceUpdateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this gateway service update default response has a 3xx status code +func (o *GatewayServiceUpdateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this gateway service update default response has a 4xx status code +func (o *GatewayServiceUpdateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this gateway service update default response has a 5xx status code +func (o *GatewayServiceUpdateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this gateway service update default response a status code equal to that given +func (o *GatewayServiceUpdateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the gateway service update default response +func (o *GatewayServiceUpdateDefault) Code() int { + return o._statusCode +} + +func (o *GatewayServiceUpdateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/gateways/{gateway.gatewayId}][%d] GatewayService_Update default %s", o._statusCode, payload) +} + +func (o *GatewayServiceUpdateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/gateways/{gateway.gatewayId}][%d] GatewayService_Update default %s", o._statusCode, payload) +} + +func (o *GatewayServiceUpdateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *GatewayServiceUpdateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +GatewayServiceUpdateBody gateway service update body +swagger:model GatewayServiceUpdateBody +*/ +type GatewayServiceUpdateBody struct { + + // gateway + Gateway *GatewayServiceUpdateParamsBodyGateway `json:"gateway,omitempty"` +} + +// Validate validates this gateway service update body +func (o *GatewayServiceUpdateBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateGateway(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *GatewayServiceUpdateBody) validateGateway(formats strfmt.Registry) error { + if swag.IsZero(o.Gateway) { // not required + return nil + } + + if o.Gateway != nil { + if err := o.Gateway.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "gateway") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "gateway") + } + return err + } + } + + return nil +} + +// ContextValidate validate this gateway service update body based on the context it is used +func (o *GatewayServiceUpdateBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateGateway(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *GatewayServiceUpdateBody) contextValidateGateway(ctx context.Context, formats strfmt.Registry) error { + + if o.Gateway != nil { + + if swag.IsZero(o.Gateway) { // not required + return nil + } + + if err := o.Gateway.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "gateway") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "gateway") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *GatewayServiceUpdateBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *GatewayServiceUpdateBody) UnmarshalBinary(b []byte) error { + var res GatewayServiceUpdateBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +GatewayServiceUpdateParamsBodyGateway Gateway object. +swagger:model GatewayServiceUpdateParamsBodyGateway +*/ +type GatewayServiceUpdateParamsBodyGateway struct { + + // Description. + Description string `json:"description,omitempty"` + + // Gateway location. + Location *models.CommonLocation `json:"location,omitempty"` + + // Metadata (provided by the gateway). + Metadata map[string]string `json:"metadata,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Stats interval (seconds). + // This defines the expected interval in which the gateway sends its + // statistics. + StatsInterval int64 `json:"statsInterval,omitempty"` + + // Tags. + Tags map[string]string `json:"tags,omitempty"` + + // Tenant ID (UUID). + TenantID string `json:"tenantId,omitempty"` +} + +// Validate validates this gateway service update params body gateway +func (o *GatewayServiceUpdateParamsBodyGateway) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateLocation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *GatewayServiceUpdateParamsBodyGateway) validateLocation(formats strfmt.Registry) error { + if swag.IsZero(o.Location) { // not required + return nil + } + + if o.Location != nil { + if err := o.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "gateway" + "." + "location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "gateway" + "." + "location") + } + return err + } + } + + return nil +} + +// ContextValidate validate this gateway service update params body gateway based on the context it is used +func (o *GatewayServiceUpdateParamsBodyGateway) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateLocation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *GatewayServiceUpdateParamsBodyGateway) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { + + if o.Location != nil { + + if swag.IsZero(o.Location) { // not required + return nil + } + + if err := o.Location.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "gateway" + "." + "location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "gateway" + "." + "location") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *GatewayServiceUpdateParamsBodyGateway) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *GatewayServiceUpdateParamsBodyGateway) UnmarshalBinary(b []byte) error { + var res GatewayServiceUpdateParamsBodyGateway + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_add_device_parameters.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_add_device_parameters.go new file mode 100644 index 0000000..4204854 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_add_device_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewMulticastGroupServiceAddDeviceParams creates a new MulticastGroupServiceAddDeviceParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewMulticastGroupServiceAddDeviceParams() *MulticastGroupServiceAddDeviceParams { + return &MulticastGroupServiceAddDeviceParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMulticastGroupServiceAddDeviceParamsWithTimeout creates a new MulticastGroupServiceAddDeviceParams object +// with the ability to set a timeout on a request. +func NewMulticastGroupServiceAddDeviceParamsWithTimeout(timeout time.Duration) *MulticastGroupServiceAddDeviceParams { + return &MulticastGroupServiceAddDeviceParams{ + timeout: timeout, + } +} + +// NewMulticastGroupServiceAddDeviceParamsWithContext creates a new MulticastGroupServiceAddDeviceParams object +// with the ability to set a context for a request. +func NewMulticastGroupServiceAddDeviceParamsWithContext(ctx context.Context) *MulticastGroupServiceAddDeviceParams { + return &MulticastGroupServiceAddDeviceParams{ + Context: ctx, + } +} + +// NewMulticastGroupServiceAddDeviceParamsWithHTTPClient creates a new MulticastGroupServiceAddDeviceParams object +// with the ability to set a custom HTTPClient for a request. +func NewMulticastGroupServiceAddDeviceParamsWithHTTPClient(client *http.Client) *MulticastGroupServiceAddDeviceParams { + return &MulticastGroupServiceAddDeviceParams{ + HTTPClient: client, + } +} + +/* +MulticastGroupServiceAddDeviceParams contains all the parameters to send to the API endpoint + + for the multicast group service add device operation. + + Typically these are written to a http.Request. +*/ +type MulticastGroupServiceAddDeviceParams struct { + + // Body. + Body MulticastGroupServiceAddDeviceBody + + /* MulticastGroupID. + + Multicast group ID. + */ + MulticastGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the multicast group service add device params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceAddDeviceParams) WithDefaults() *MulticastGroupServiceAddDeviceParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the multicast group service add device params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceAddDeviceParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the multicast group service add device params +func (o *MulticastGroupServiceAddDeviceParams) WithTimeout(timeout time.Duration) *MulticastGroupServiceAddDeviceParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the multicast group service add device params +func (o *MulticastGroupServiceAddDeviceParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the multicast group service add device params +func (o *MulticastGroupServiceAddDeviceParams) WithContext(ctx context.Context) *MulticastGroupServiceAddDeviceParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the multicast group service add device params +func (o *MulticastGroupServiceAddDeviceParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the multicast group service add device params +func (o *MulticastGroupServiceAddDeviceParams) WithHTTPClient(client *http.Client) *MulticastGroupServiceAddDeviceParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the multicast group service add device params +func (o *MulticastGroupServiceAddDeviceParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the multicast group service add device params +func (o *MulticastGroupServiceAddDeviceParams) WithBody(body MulticastGroupServiceAddDeviceBody) *MulticastGroupServiceAddDeviceParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the multicast group service add device params +func (o *MulticastGroupServiceAddDeviceParams) SetBody(body MulticastGroupServiceAddDeviceBody) { + o.Body = body +} + +// WithMulticastGroupID adds the multicastGroupID to the multicast group service add device params +func (o *MulticastGroupServiceAddDeviceParams) WithMulticastGroupID(multicastGroupID string) *MulticastGroupServiceAddDeviceParams { + o.SetMulticastGroupID(multicastGroupID) + return o +} + +// SetMulticastGroupID adds the multicastGroupId to the multicast group service add device params +func (o *MulticastGroupServiceAddDeviceParams) SetMulticastGroupID(multicastGroupID string) { + o.MulticastGroupID = multicastGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *MulticastGroupServiceAddDeviceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param multicastGroupId + if err := r.SetPathParam("multicastGroupId", o.MulticastGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_add_device_responses.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_add_device_responses.go new file mode 100644 index 0000000..f190674 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_add_device_responses.go @@ -0,0 +1,225 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// MulticastGroupServiceAddDeviceReader is a Reader for the MulticastGroupServiceAddDevice structure. +type MulticastGroupServiceAddDeviceReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MulticastGroupServiceAddDeviceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMulticastGroupServiceAddDeviceOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMulticastGroupServiceAddDeviceDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewMulticastGroupServiceAddDeviceOK creates a MulticastGroupServiceAddDeviceOK with default headers values +func NewMulticastGroupServiceAddDeviceOK() *MulticastGroupServiceAddDeviceOK { + return &MulticastGroupServiceAddDeviceOK{} +} + +/* +MulticastGroupServiceAddDeviceOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type MulticastGroupServiceAddDeviceOK struct { + Payload interface{} +} + +// IsSuccess returns true when this multicast group service add device o k response has a 2xx status code +func (o *MulticastGroupServiceAddDeviceOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this multicast group service add device o k response has a 3xx status code +func (o *MulticastGroupServiceAddDeviceOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this multicast group service add device o k response has a 4xx status code +func (o *MulticastGroupServiceAddDeviceOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this multicast group service add device o k response has a 5xx status code +func (o *MulticastGroupServiceAddDeviceOK) IsServerError() bool { + return false +} + +// IsCode returns true when this multicast group service add device o k response a status code equal to that given +func (o *MulticastGroupServiceAddDeviceOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the multicast group service add device o k response +func (o *MulticastGroupServiceAddDeviceOK) Code() int { + return 200 +} + +func (o *MulticastGroupServiceAddDeviceOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups/{multicastGroupId}/devices][%d] multicastGroupServiceAddDeviceOK %s", 200, payload) +} + +func (o *MulticastGroupServiceAddDeviceOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups/{multicastGroupId}/devices][%d] multicastGroupServiceAddDeviceOK %s", 200, payload) +} + +func (o *MulticastGroupServiceAddDeviceOK) GetPayload() interface{} { + return o.Payload +} + +func (o *MulticastGroupServiceAddDeviceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMulticastGroupServiceAddDeviceDefault creates a MulticastGroupServiceAddDeviceDefault with default headers values +func NewMulticastGroupServiceAddDeviceDefault(code int) *MulticastGroupServiceAddDeviceDefault { + return &MulticastGroupServiceAddDeviceDefault{ + _statusCode: code, + } +} + +/* +MulticastGroupServiceAddDeviceDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type MulticastGroupServiceAddDeviceDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this multicast group service add device default response has a 2xx status code +func (o *MulticastGroupServiceAddDeviceDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this multicast group service add device default response has a 3xx status code +func (o *MulticastGroupServiceAddDeviceDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this multicast group service add device default response has a 4xx status code +func (o *MulticastGroupServiceAddDeviceDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this multicast group service add device default response has a 5xx status code +func (o *MulticastGroupServiceAddDeviceDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this multicast group service add device default response a status code equal to that given +func (o *MulticastGroupServiceAddDeviceDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the multicast group service add device default response +func (o *MulticastGroupServiceAddDeviceDefault) Code() int { + return o._statusCode +} + +func (o *MulticastGroupServiceAddDeviceDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups/{multicastGroupId}/devices][%d] MulticastGroupService_AddDevice default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceAddDeviceDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups/{multicastGroupId}/devices][%d] MulticastGroupService_AddDevice default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceAddDeviceDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *MulticastGroupServiceAddDeviceDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +MulticastGroupServiceAddDeviceBody multicast group service add device body +swagger:model MulticastGroupServiceAddDeviceBody +*/ +type MulticastGroupServiceAddDeviceBody struct { + + // Device EUI (HEX encoded). + DevEui string `json:"devEui,omitempty"` +} + +// Validate validates this multicast group service add device body +func (o *MulticastGroupServiceAddDeviceBody) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this multicast group service add device body based on context it is used +func (o *MulticastGroupServiceAddDeviceBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *MulticastGroupServiceAddDeviceBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *MulticastGroupServiceAddDeviceBody) UnmarshalBinary(b []byte) error { + var res MulticastGroupServiceAddDeviceBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_add_gateway_parameters.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_add_gateway_parameters.go new file mode 100644 index 0000000..da08449 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_add_gateway_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewMulticastGroupServiceAddGatewayParams creates a new MulticastGroupServiceAddGatewayParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewMulticastGroupServiceAddGatewayParams() *MulticastGroupServiceAddGatewayParams { + return &MulticastGroupServiceAddGatewayParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMulticastGroupServiceAddGatewayParamsWithTimeout creates a new MulticastGroupServiceAddGatewayParams object +// with the ability to set a timeout on a request. +func NewMulticastGroupServiceAddGatewayParamsWithTimeout(timeout time.Duration) *MulticastGroupServiceAddGatewayParams { + return &MulticastGroupServiceAddGatewayParams{ + timeout: timeout, + } +} + +// NewMulticastGroupServiceAddGatewayParamsWithContext creates a new MulticastGroupServiceAddGatewayParams object +// with the ability to set a context for a request. +func NewMulticastGroupServiceAddGatewayParamsWithContext(ctx context.Context) *MulticastGroupServiceAddGatewayParams { + return &MulticastGroupServiceAddGatewayParams{ + Context: ctx, + } +} + +// NewMulticastGroupServiceAddGatewayParamsWithHTTPClient creates a new MulticastGroupServiceAddGatewayParams object +// with the ability to set a custom HTTPClient for a request. +func NewMulticastGroupServiceAddGatewayParamsWithHTTPClient(client *http.Client) *MulticastGroupServiceAddGatewayParams { + return &MulticastGroupServiceAddGatewayParams{ + HTTPClient: client, + } +} + +/* +MulticastGroupServiceAddGatewayParams contains all the parameters to send to the API endpoint + + for the multicast group service add gateway operation. + + Typically these are written to a http.Request. +*/ +type MulticastGroupServiceAddGatewayParams struct { + + // Body. + Body MulticastGroupServiceAddGatewayBody + + /* MulticastGroupID. + + Multicast group ID. + */ + MulticastGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the multicast group service add gateway params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceAddGatewayParams) WithDefaults() *MulticastGroupServiceAddGatewayParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the multicast group service add gateway params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceAddGatewayParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the multicast group service add gateway params +func (o *MulticastGroupServiceAddGatewayParams) WithTimeout(timeout time.Duration) *MulticastGroupServiceAddGatewayParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the multicast group service add gateway params +func (o *MulticastGroupServiceAddGatewayParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the multicast group service add gateway params +func (o *MulticastGroupServiceAddGatewayParams) WithContext(ctx context.Context) *MulticastGroupServiceAddGatewayParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the multicast group service add gateway params +func (o *MulticastGroupServiceAddGatewayParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the multicast group service add gateway params +func (o *MulticastGroupServiceAddGatewayParams) WithHTTPClient(client *http.Client) *MulticastGroupServiceAddGatewayParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the multicast group service add gateway params +func (o *MulticastGroupServiceAddGatewayParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the multicast group service add gateway params +func (o *MulticastGroupServiceAddGatewayParams) WithBody(body MulticastGroupServiceAddGatewayBody) *MulticastGroupServiceAddGatewayParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the multicast group service add gateway params +func (o *MulticastGroupServiceAddGatewayParams) SetBody(body MulticastGroupServiceAddGatewayBody) { + o.Body = body +} + +// WithMulticastGroupID adds the multicastGroupID to the multicast group service add gateway params +func (o *MulticastGroupServiceAddGatewayParams) WithMulticastGroupID(multicastGroupID string) *MulticastGroupServiceAddGatewayParams { + o.SetMulticastGroupID(multicastGroupID) + return o +} + +// SetMulticastGroupID adds the multicastGroupId to the multicast group service add gateway params +func (o *MulticastGroupServiceAddGatewayParams) SetMulticastGroupID(multicastGroupID string) { + o.MulticastGroupID = multicastGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *MulticastGroupServiceAddGatewayParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param multicastGroupId + if err := r.SetPathParam("multicastGroupId", o.MulticastGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_add_gateway_responses.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_add_gateway_responses.go new file mode 100644 index 0000000..a48d345 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_add_gateway_responses.go @@ -0,0 +1,225 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// MulticastGroupServiceAddGatewayReader is a Reader for the MulticastGroupServiceAddGateway structure. +type MulticastGroupServiceAddGatewayReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MulticastGroupServiceAddGatewayReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMulticastGroupServiceAddGatewayOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMulticastGroupServiceAddGatewayDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewMulticastGroupServiceAddGatewayOK creates a MulticastGroupServiceAddGatewayOK with default headers values +func NewMulticastGroupServiceAddGatewayOK() *MulticastGroupServiceAddGatewayOK { + return &MulticastGroupServiceAddGatewayOK{} +} + +/* +MulticastGroupServiceAddGatewayOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type MulticastGroupServiceAddGatewayOK struct { + Payload interface{} +} + +// IsSuccess returns true when this multicast group service add gateway o k response has a 2xx status code +func (o *MulticastGroupServiceAddGatewayOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this multicast group service add gateway o k response has a 3xx status code +func (o *MulticastGroupServiceAddGatewayOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this multicast group service add gateway o k response has a 4xx status code +func (o *MulticastGroupServiceAddGatewayOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this multicast group service add gateway o k response has a 5xx status code +func (o *MulticastGroupServiceAddGatewayOK) IsServerError() bool { + return false +} + +// IsCode returns true when this multicast group service add gateway o k response a status code equal to that given +func (o *MulticastGroupServiceAddGatewayOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the multicast group service add gateway o k response +func (o *MulticastGroupServiceAddGatewayOK) Code() int { + return 200 +} + +func (o *MulticastGroupServiceAddGatewayOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups/{multicastGroupId}/gateways][%d] multicastGroupServiceAddGatewayOK %s", 200, payload) +} + +func (o *MulticastGroupServiceAddGatewayOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups/{multicastGroupId}/gateways][%d] multicastGroupServiceAddGatewayOK %s", 200, payload) +} + +func (o *MulticastGroupServiceAddGatewayOK) GetPayload() interface{} { + return o.Payload +} + +func (o *MulticastGroupServiceAddGatewayOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMulticastGroupServiceAddGatewayDefault creates a MulticastGroupServiceAddGatewayDefault with default headers values +func NewMulticastGroupServiceAddGatewayDefault(code int) *MulticastGroupServiceAddGatewayDefault { + return &MulticastGroupServiceAddGatewayDefault{ + _statusCode: code, + } +} + +/* +MulticastGroupServiceAddGatewayDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type MulticastGroupServiceAddGatewayDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this multicast group service add gateway default response has a 2xx status code +func (o *MulticastGroupServiceAddGatewayDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this multicast group service add gateway default response has a 3xx status code +func (o *MulticastGroupServiceAddGatewayDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this multicast group service add gateway default response has a 4xx status code +func (o *MulticastGroupServiceAddGatewayDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this multicast group service add gateway default response has a 5xx status code +func (o *MulticastGroupServiceAddGatewayDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this multicast group service add gateway default response a status code equal to that given +func (o *MulticastGroupServiceAddGatewayDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the multicast group service add gateway default response +func (o *MulticastGroupServiceAddGatewayDefault) Code() int { + return o._statusCode +} + +func (o *MulticastGroupServiceAddGatewayDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups/{multicastGroupId}/gateways][%d] MulticastGroupService_AddGateway default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceAddGatewayDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups/{multicastGroupId}/gateways][%d] MulticastGroupService_AddGateway default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceAddGatewayDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *MulticastGroupServiceAddGatewayDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +MulticastGroupServiceAddGatewayBody multicast group service add gateway body +swagger:model MulticastGroupServiceAddGatewayBody +*/ +type MulticastGroupServiceAddGatewayBody struct { + + // Gateway ID (HEX encoded). + GatewayID string `json:"gatewayId,omitempty"` +} + +// Validate validates this multicast group service add gateway body +func (o *MulticastGroupServiceAddGatewayBody) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this multicast group service add gateway body based on context it is used +func (o *MulticastGroupServiceAddGatewayBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *MulticastGroupServiceAddGatewayBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *MulticastGroupServiceAddGatewayBody) UnmarshalBinary(b []byte) error { + var res MulticastGroupServiceAddGatewayBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_client.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_client.go new file mode 100644 index 0000000..2d6df9e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_client.go @@ -0,0 +1,543 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new multicast group service API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new multicast group service API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new multicast group service API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for multicast group service API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + MulticastGroupServiceAddDevice(params *MulticastGroupServiceAddDeviceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceAddDeviceOK, error) + + MulticastGroupServiceAddGateway(params *MulticastGroupServiceAddGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceAddGatewayOK, error) + + MulticastGroupServiceCreate(params *MulticastGroupServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceCreateOK, error) + + MulticastGroupServiceDelete(params *MulticastGroupServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceDeleteOK, error) + + MulticastGroupServiceEnqueue(params *MulticastGroupServiceEnqueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceEnqueueOK, error) + + MulticastGroupServiceFlushQueue(params *MulticastGroupServiceFlushQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceFlushQueueOK, error) + + MulticastGroupServiceGet(params *MulticastGroupServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceGetOK, error) + + MulticastGroupServiceList(params *MulticastGroupServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceListOK, error) + + MulticastGroupServiceListQueue(params *MulticastGroupServiceListQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceListQueueOK, error) + + MulticastGroupServiceRemoveDevice(params *MulticastGroupServiceRemoveDeviceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceRemoveDeviceOK, error) + + MulticastGroupServiceRemoveGateway(params *MulticastGroupServiceRemoveGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceRemoveGatewayOK, error) + + MulticastGroupServiceUpdate(params *MulticastGroupServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceUpdateOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +MulticastGroupServiceAddDevice adds a device to the multicast group +*/ +func (a *Client) MulticastGroupServiceAddDevice(params *MulticastGroupServiceAddDeviceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceAddDeviceOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMulticastGroupServiceAddDeviceParams() + } + op := &runtime.ClientOperation{ + ID: "MulticastGroupService_AddDevice", + Method: "POST", + PathPattern: "/api/multicast-groups/{multicastGroupId}/devices", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MulticastGroupServiceAddDeviceReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MulticastGroupServiceAddDeviceOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MulticastGroupServiceAddDeviceDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +MulticastGroupServiceAddGateway adds a gateway to the multicast group +*/ +func (a *Client) MulticastGroupServiceAddGateway(params *MulticastGroupServiceAddGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceAddGatewayOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMulticastGroupServiceAddGatewayParams() + } + op := &runtime.ClientOperation{ + ID: "MulticastGroupService_AddGateway", + Method: "POST", + PathPattern: "/api/multicast-groups/{multicastGroupId}/gateways", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MulticastGroupServiceAddGatewayReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MulticastGroupServiceAddGatewayOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MulticastGroupServiceAddGatewayDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +MulticastGroupServiceCreate creates the given multicast group +*/ +func (a *Client) MulticastGroupServiceCreate(params *MulticastGroupServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMulticastGroupServiceCreateParams() + } + op := &runtime.ClientOperation{ + ID: "MulticastGroupService_Create", + Method: "POST", + PathPattern: "/api/multicast-groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MulticastGroupServiceCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MulticastGroupServiceCreateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MulticastGroupServiceCreateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +MulticastGroupServiceDelete deletes the multicast group with the given ID +*/ +func (a *Client) MulticastGroupServiceDelete(params *MulticastGroupServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMulticastGroupServiceDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "MulticastGroupService_Delete", + Method: "DELETE", + PathPattern: "/api/multicast-groups/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MulticastGroupServiceDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MulticastGroupServiceDeleteOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MulticastGroupServiceDeleteDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +MulticastGroupServiceEnqueue adds the given item to the multicast group queue +*/ +func (a *Client) MulticastGroupServiceEnqueue(params *MulticastGroupServiceEnqueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceEnqueueOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMulticastGroupServiceEnqueueParams() + } + op := &runtime.ClientOperation{ + ID: "MulticastGroupService_Enqueue", + Method: "POST", + PathPattern: "/api/multicast-groups/{queueItem.multicastGroupId}/queue", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MulticastGroupServiceEnqueueReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MulticastGroupServiceEnqueueOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MulticastGroupServiceEnqueueDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +MulticastGroupServiceFlushQueue flushes the queue for the given multicast group +*/ +func (a *Client) MulticastGroupServiceFlushQueue(params *MulticastGroupServiceFlushQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceFlushQueueOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMulticastGroupServiceFlushQueueParams() + } + op := &runtime.ClientOperation{ + ID: "MulticastGroupService_FlushQueue", + Method: "DELETE", + PathPattern: "/api/multicast-groups/{multicastGroupId}/queue", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MulticastGroupServiceFlushQueueReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MulticastGroupServiceFlushQueueOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MulticastGroupServiceFlushQueueDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +MulticastGroupServiceGet gets returns the multicast group for the given ID +*/ +func (a *Client) MulticastGroupServiceGet(params *MulticastGroupServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMulticastGroupServiceGetParams() + } + op := &runtime.ClientOperation{ + ID: "MulticastGroupService_Get", + Method: "GET", + PathPattern: "/api/multicast-groups/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MulticastGroupServiceGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MulticastGroupServiceGetOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MulticastGroupServiceGetDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +MulticastGroupServiceList lists the available multicast groups +*/ +func (a *Client) MulticastGroupServiceList(params *MulticastGroupServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMulticastGroupServiceListParams() + } + op := &runtime.ClientOperation{ + ID: "MulticastGroupService_List", + Method: "GET", + PathPattern: "/api/multicast-groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MulticastGroupServiceListReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MulticastGroupServiceListOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MulticastGroupServiceListDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +MulticastGroupServiceListQueue lists the items in the multicast group queue +*/ +func (a *Client) MulticastGroupServiceListQueue(params *MulticastGroupServiceListQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceListQueueOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMulticastGroupServiceListQueueParams() + } + op := &runtime.ClientOperation{ + ID: "MulticastGroupService_ListQueue", + Method: "GET", + PathPattern: "/api/multicast-groups/{multicastGroupId}/queue", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MulticastGroupServiceListQueueReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MulticastGroupServiceListQueueOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MulticastGroupServiceListQueueDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +MulticastGroupServiceRemoveDevice removes a device from the multicast group +*/ +func (a *Client) MulticastGroupServiceRemoveDevice(params *MulticastGroupServiceRemoveDeviceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceRemoveDeviceOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMulticastGroupServiceRemoveDeviceParams() + } + op := &runtime.ClientOperation{ + ID: "MulticastGroupService_RemoveDevice", + Method: "DELETE", + PathPattern: "/api/multicast-groups/{multicastGroupId}/devices/{devEui}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MulticastGroupServiceRemoveDeviceReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MulticastGroupServiceRemoveDeviceOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MulticastGroupServiceRemoveDeviceDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +MulticastGroupServiceRemoveGateway removes a gateway from the multicast group +*/ +func (a *Client) MulticastGroupServiceRemoveGateway(params *MulticastGroupServiceRemoveGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceRemoveGatewayOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMulticastGroupServiceRemoveGatewayParams() + } + op := &runtime.ClientOperation{ + ID: "MulticastGroupService_RemoveGateway", + Method: "DELETE", + PathPattern: "/api/multicast-groups/{multicastGroupId}/gateways/{gatewayId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MulticastGroupServiceRemoveGatewayReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MulticastGroupServiceRemoveGatewayOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MulticastGroupServiceRemoveGatewayDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +MulticastGroupServiceUpdate updates the given multicast group +*/ +func (a *Client) MulticastGroupServiceUpdate(params *MulticastGroupServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMulticastGroupServiceUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "MulticastGroupService_Update", + Method: "PUT", + PathPattern: "/api/multicast-groups/{multicastGroup.id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MulticastGroupServiceUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MulticastGroupServiceUpdateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*MulticastGroupServiceUpdateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_create_parameters.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_create_parameters.go new file mode 100644 index 0000000..b463738 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_create_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// NewMulticastGroupServiceCreateParams creates a new MulticastGroupServiceCreateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewMulticastGroupServiceCreateParams() *MulticastGroupServiceCreateParams { + return &MulticastGroupServiceCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMulticastGroupServiceCreateParamsWithTimeout creates a new MulticastGroupServiceCreateParams object +// with the ability to set a timeout on a request. +func NewMulticastGroupServiceCreateParamsWithTimeout(timeout time.Duration) *MulticastGroupServiceCreateParams { + return &MulticastGroupServiceCreateParams{ + timeout: timeout, + } +} + +// NewMulticastGroupServiceCreateParamsWithContext creates a new MulticastGroupServiceCreateParams object +// with the ability to set a context for a request. +func NewMulticastGroupServiceCreateParamsWithContext(ctx context.Context) *MulticastGroupServiceCreateParams { + return &MulticastGroupServiceCreateParams{ + Context: ctx, + } +} + +// NewMulticastGroupServiceCreateParamsWithHTTPClient creates a new MulticastGroupServiceCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewMulticastGroupServiceCreateParamsWithHTTPClient(client *http.Client) *MulticastGroupServiceCreateParams { + return &MulticastGroupServiceCreateParams{ + HTTPClient: client, + } +} + +/* +MulticastGroupServiceCreateParams contains all the parameters to send to the API endpoint + + for the multicast group service create operation. + + Typically these are written to a http.Request. +*/ +type MulticastGroupServiceCreateParams struct { + + // Body. + Body *models.APICreateMulticastGroupRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the multicast group service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceCreateParams) WithDefaults() *MulticastGroupServiceCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the multicast group service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the multicast group service create params +func (o *MulticastGroupServiceCreateParams) WithTimeout(timeout time.Duration) *MulticastGroupServiceCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the multicast group service create params +func (o *MulticastGroupServiceCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the multicast group service create params +func (o *MulticastGroupServiceCreateParams) WithContext(ctx context.Context) *MulticastGroupServiceCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the multicast group service create params +func (o *MulticastGroupServiceCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the multicast group service create params +func (o *MulticastGroupServiceCreateParams) WithHTTPClient(client *http.Client) *MulticastGroupServiceCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the multicast group service create params +func (o *MulticastGroupServiceCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the multicast group service create params +func (o *MulticastGroupServiceCreateParams) WithBody(body *models.APICreateMulticastGroupRequest) *MulticastGroupServiceCreateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the multicast group service create params +func (o *MulticastGroupServiceCreateParams) SetBody(body *models.APICreateMulticastGroupRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *MulticastGroupServiceCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_create_responses.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_create_responses.go new file mode 100644 index 0000000..f088e27 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_create_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// MulticastGroupServiceCreateReader is a Reader for the MulticastGroupServiceCreate structure. +type MulticastGroupServiceCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MulticastGroupServiceCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMulticastGroupServiceCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMulticastGroupServiceCreateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewMulticastGroupServiceCreateOK creates a MulticastGroupServiceCreateOK with default headers values +func NewMulticastGroupServiceCreateOK() *MulticastGroupServiceCreateOK { + return &MulticastGroupServiceCreateOK{} +} + +/* +MulticastGroupServiceCreateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type MulticastGroupServiceCreateOK struct { + Payload *models.APICreateMulticastGroupResponse +} + +// IsSuccess returns true when this multicast group service create o k response has a 2xx status code +func (o *MulticastGroupServiceCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this multicast group service create o k response has a 3xx status code +func (o *MulticastGroupServiceCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this multicast group service create o k response has a 4xx status code +func (o *MulticastGroupServiceCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this multicast group service create o k response has a 5xx status code +func (o *MulticastGroupServiceCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this multicast group service create o k response a status code equal to that given +func (o *MulticastGroupServiceCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the multicast group service create o k response +func (o *MulticastGroupServiceCreateOK) Code() int { + return 200 +} + +func (o *MulticastGroupServiceCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups][%d] multicastGroupServiceCreateOK %s", 200, payload) +} + +func (o *MulticastGroupServiceCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups][%d] multicastGroupServiceCreateOK %s", 200, payload) +} + +func (o *MulticastGroupServiceCreateOK) GetPayload() *models.APICreateMulticastGroupResponse { + return o.Payload +} + +func (o *MulticastGroupServiceCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APICreateMulticastGroupResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMulticastGroupServiceCreateDefault creates a MulticastGroupServiceCreateDefault with default headers values +func NewMulticastGroupServiceCreateDefault(code int) *MulticastGroupServiceCreateDefault { + return &MulticastGroupServiceCreateDefault{ + _statusCode: code, + } +} + +/* +MulticastGroupServiceCreateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type MulticastGroupServiceCreateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this multicast group service create default response has a 2xx status code +func (o *MulticastGroupServiceCreateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this multicast group service create default response has a 3xx status code +func (o *MulticastGroupServiceCreateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this multicast group service create default response has a 4xx status code +func (o *MulticastGroupServiceCreateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this multicast group service create default response has a 5xx status code +func (o *MulticastGroupServiceCreateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this multicast group service create default response a status code equal to that given +func (o *MulticastGroupServiceCreateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the multicast group service create default response +func (o *MulticastGroupServiceCreateDefault) Code() int { + return o._statusCode +} + +func (o *MulticastGroupServiceCreateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups][%d] MulticastGroupService_Create default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceCreateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups][%d] MulticastGroupService_Create default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceCreateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *MulticastGroupServiceCreateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_delete_parameters.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_delete_parameters.go new file mode 100644 index 0000000..a7eb5f5 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewMulticastGroupServiceDeleteParams creates a new MulticastGroupServiceDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewMulticastGroupServiceDeleteParams() *MulticastGroupServiceDeleteParams { + return &MulticastGroupServiceDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMulticastGroupServiceDeleteParamsWithTimeout creates a new MulticastGroupServiceDeleteParams object +// with the ability to set a timeout on a request. +func NewMulticastGroupServiceDeleteParamsWithTimeout(timeout time.Duration) *MulticastGroupServiceDeleteParams { + return &MulticastGroupServiceDeleteParams{ + timeout: timeout, + } +} + +// NewMulticastGroupServiceDeleteParamsWithContext creates a new MulticastGroupServiceDeleteParams object +// with the ability to set a context for a request. +func NewMulticastGroupServiceDeleteParamsWithContext(ctx context.Context) *MulticastGroupServiceDeleteParams { + return &MulticastGroupServiceDeleteParams{ + Context: ctx, + } +} + +// NewMulticastGroupServiceDeleteParamsWithHTTPClient creates a new MulticastGroupServiceDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewMulticastGroupServiceDeleteParamsWithHTTPClient(client *http.Client) *MulticastGroupServiceDeleteParams { + return &MulticastGroupServiceDeleteParams{ + HTTPClient: client, + } +} + +/* +MulticastGroupServiceDeleteParams contains all the parameters to send to the API endpoint + + for the multicast group service delete operation. + + Typically these are written to a http.Request. +*/ +type MulticastGroupServiceDeleteParams struct { + + /* ID. + + Multicast group iD. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the multicast group service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceDeleteParams) WithDefaults() *MulticastGroupServiceDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the multicast group service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the multicast group service delete params +func (o *MulticastGroupServiceDeleteParams) WithTimeout(timeout time.Duration) *MulticastGroupServiceDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the multicast group service delete params +func (o *MulticastGroupServiceDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the multicast group service delete params +func (o *MulticastGroupServiceDeleteParams) WithContext(ctx context.Context) *MulticastGroupServiceDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the multicast group service delete params +func (o *MulticastGroupServiceDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the multicast group service delete params +func (o *MulticastGroupServiceDeleteParams) WithHTTPClient(client *http.Client) *MulticastGroupServiceDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the multicast group service delete params +func (o *MulticastGroupServiceDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the multicast group service delete params +func (o *MulticastGroupServiceDeleteParams) WithID(id string) *MulticastGroupServiceDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the multicast group service delete params +func (o *MulticastGroupServiceDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *MulticastGroupServiceDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_delete_responses.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_delete_responses.go new file mode 100644 index 0000000..d25f7e1 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_delete_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// MulticastGroupServiceDeleteReader is a Reader for the MulticastGroupServiceDelete structure. +type MulticastGroupServiceDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MulticastGroupServiceDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMulticastGroupServiceDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMulticastGroupServiceDeleteDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewMulticastGroupServiceDeleteOK creates a MulticastGroupServiceDeleteOK with default headers values +func NewMulticastGroupServiceDeleteOK() *MulticastGroupServiceDeleteOK { + return &MulticastGroupServiceDeleteOK{} +} + +/* +MulticastGroupServiceDeleteOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type MulticastGroupServiceDeleteOK struct { + Payload interface{} +} + +// IsSuccess returns true when this multicast group service delete o k response has a 2xx status code +func (o *MulticastGroupServiceDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this multicast group service delete o k response has a 3xx status code +func (o *MulticastGroupServiceDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this multicast group service delete o k response has a 4xx status code +func (o *MulticastGroupServiceDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this multicast group service delete o k response has a 5xx status code +func (o *MulticastGroupServiceDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this multicast group service delete o k response a status code equal to that given +func (o *MulticastGroupServiceDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the multicast group service delete o k response +func (o *MulticastGroupServiceDeleteOK) Code() int { + return 200 +} + +func (o *MulticastGroupServiceDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{id}][%d] multicastGroupServiceDeleteOK %s", 200, payload) +} + +func (o *MulticastGroupServiceDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{id}][%d] multicastGroupServiceDeleteOK %s", 200, payload) +} + +func (o *MulticastGroupServiceDeleteOK) GetPayload() interface{} { + return o.Payload +} + +func (o *MulticastGroupServiceDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMulticastGroupServiceDeleteDefault creates a MulticastGroupServiceDeleteDefault with default headers values +func NewMulticastGroupServiceDeleteDefault(code int) *MulticastGroupServiceDeleteDefault { + return &MulticastGroupServiceDeleteDefault{ + _statusCode: code, + } +} + +/* +MulticastGroupServiceDeleteDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type MulticastGroupServiceDeleteDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this multicast group service delete default response has a 2xx status code +func (o *MulticastGroupServiceDeleteDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this multicast group service delete default response has a 3xx status code +func (o *MulticastGroupServiceDeleteDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this multicast group service delete default response has a 4xx status code +func (o *MulticastGroupServiceDeleteDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this multicast group service delete default response has a 5xx status code +func (o *MulticastGroupServiceDeleteDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this multicast group service delete default response a status code equal to that given +func (o *MulticastGroupServiceDeleteDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the multicast group service delete default response +func (o *MulticastGroupServiceDeleteDefault) Code() int { + return o._statusCode +} + +func (o *MulticastGroupServiceDeleteDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{id}][%d] MulticastGroupService_Delete default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceDeleteDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{id}][%d] MulticastGroupService_Delete default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceDeleteDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *MulticastGroupServiceDeleteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_enqueue_parameters.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_enqueue_parameters.go new file mode 100644 index 0000000..0960b21 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_enqueue_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewMulticastGroupServiceEnqueueParams creates a new MulticastGroupServiceEnqueueParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewMulticastGroupServiceEnqueueParams() *MulticastGroupServiceEnqueueParams { + return &MulticastGroupServiceEnqueueParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMulticastGroupServiceEnqueueParamsWithTimeout creates a new MulticastGroupServiceEnqueueParams object +// with the ability to set a timeout on a request. +func NewMulticastGroupServiceEnqueueParamsWithTimeout(timeout time.Duration) *MulticastGroupServiceEnqueueParams { + return &MulticastGroupServiceEnqueueParams{ + timeout: timeout, + } +} + +// NewMulticastGroupServiceEnqueueParamsWithContext creates a new MulticastGroupServiceEnqueueParams object +// with the ability to set a context for a request. +func NewMulticastGroupServiceEnqueueParamsWithContext(ctx context.Context) *MulticastGroupServiceEnqueueParams { + return &MulticastGroupServiceEnqueueParams{ + Context: ctx, + } +} + +// NewMulticastGroupServiceEnqueueParamsWithHTTPClient creates a new MulticastGroupServiceEnqueueParams object +// with the ability to set a custom HTTPClient for a request. +func NewMulticastGroupServiceEnqueueParamsWithHTTPClient(client *http.Client) *MulticastGroupServiceEnqueueParams { + return &MulticastGroupServiceEnqueueParams{ + HTTPClient: client, + } +} + +/* +MulticastGroupServiceEnqueueParams contains all the parameters to send to the API endpoint + + for the multicast group service enqueue operation. + + Typically these are written to a http.Request. +*/ +type MulticastGroupServiceEnqueueParams struct { + + // Body. + Body MulticastGroupServiceEnqueueBody + + /* QueueItemMulticastGroupID. + + Multicast group ID. + */ + QueueItemMulticastGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the multicast group service enqueue params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceEnqueueParams) WithDefaults() *MulticastGroupServiceEnqueueParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the multicast group service enqueue params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceEnqueueParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the multicast group service enqueue params +func (o *MulticastGroupServiceEnqueueParams) WithTimeout(timeout time.Duration) *MulticastGroupServiceEnqueueParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the multicast group service enqueue params +func (o *MulticastGroupServiceEnqueueParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the multicast group service enqueue params +func (o *MulticastGroupServiceEnqueueParams) WithContext(ctx context.Context) *MulticastGroupServiceEnqueueParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the multicast group service enqueue params +func (o *MulticastGroupServiceEnqueueParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the multicast group service enqueue params +func (o *MulticastGroupServiceEnqueueParams) WithHTTPClient(client *http.Client) *MulticastGroupServiceEnqueueParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the multicast group service enqueue params +func (o *MulticastGroupServiceEnqueueParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the multicast group service enqueue params +func (o *MulticastGroupServiceEnqueueParams) WithBody(body MulticastGroupServiceEnqueueBody) *MulticastGroupServiceEnqueueParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the multicast group service enqueue params +func (o *MulticastGroupServiceEnqueueParams) SetBody(body MulticastGroupServiceEnqueueBody) { + o.Body = body +} + +// WithQueueItemMulticastGroupID adds the queueItemMulticastGroupID to the multicast group service enqueue params +func (o *MulticastGroupServiceEnqueueParams) WithQueueItemMulticastGroupID(queueItemMulticastGroupID string) *MulticastGroupServiceEnqueueParams { + o.SetQueueItemMulticastGroupID(queueItemMulticastGroupID) + return o +} + +// SetQueueItemMulticastGroupID adds the queueItemMulticastGroupId to the multicast group service enqueue params +func (o *MulticastGroupServiceEnqueueParams) SetQueueItemMulticastGroupID(queueItemMulticastGroupID string) { + o.QueueItemMulticastGroupID = queueItemMulticastGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *MulticastGroupServiceEnqueueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param queueItem.multicastGroupId + if err := r.SetPathParam("queueItem.multicastGroupId", o.QueueItemMulticastGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_enqueue_responses.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_enqueue_responses.go new file mode 100644 index 0000000..a54efb5 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_enqueue_responses.go @@ -0,0 +1,359 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// MulticastGroupServiceEnqueueReader is a Reader for the MulticastGroupServiceEnqueue structure. +type MulticastGroupServiceEnqueueReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MulticastGroupServiceEnqueueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMulticastGroupServiceEnqueueOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMulticastGroupServiceEnqueueDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewMulticastGroupServiceEnqueueOK creates a MulticastGroupServiceEnqueueOK with default headers values +func NewMulticastGroupServiceEnqueueOK() *MulticastGroupServiceEnqueueOK { + return &MulticastGroupServiceEnqueueOK{} +} + +/* +MulticastGroupServiceEnqueueOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type MulticastGroupServiceEnqueueOK struct { + Payload *models.APIEnqueueMulticastGroupQueueItemResponse +} + +// IsSuccess returns true when this multicast group service enqueue o k response has a 2xx status code +func (o *MulticastGroupServiceEnqueueOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this multicast group service enqueue o k response has a 3xx status code +func (o *MulticastGroupServiceEnqueueOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this multicast group service enqueue o k response has a 4xx status code +func (o *MulticastGroupServiceEnqueueOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this multicast group service enqueue o k response has a 5xx status code +func (o *MulticastGroupServiceEnqueueOK) IsServerError() bool { + return false +} + +// IsCode returns true when this multicast group service enqueue o k response a status code equal to that given +func (o *MulticastGroupServiceEnqueueOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the multicast group service enqueue o k response +func (o *MulticastGroupServiceEnqueueOK) Code() int { + return 200 +} + +func (o *MulticastGroupServiceEnqueueOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups/{queueItem.multicastGroupId}/queue][%d] multicastGroupServiceEnqueueOK %s", 200, payload) +} + +func (o *MulticastGroupServiceEnqueueOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups/{queueItem.multicastGroupId}/queue][%d] multicastGroupServiceEnqueueOK %s", 200, payload) +} + +func (o *MulticastGroupServiceEnqueueOK) GetPayload() *models.APIEnqueueMulticastGroupQueueItemResponse { + return o.Payload +} + +func (o *MulticastGroupServiceEnqueueOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIEnqueueMulticastGroupQueueItemResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMulticastGroupServiceEnqueueDefault creates a MulticastGroupServiceEnqueueDefault with default headers values +func NewMulticastGroupServiceEnqueueDefault(code int) *MulticastGroupServiceEnqueueDefault { + return &MulticastGroupServiceEnqueueDefault{ + _statusCode: code, + } +} + +/* +MulticastGroupServiceEnqueueDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type MulticastGroupServiceEnqueueDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this multicast group service enqueue default response has a 2xx status code +func (o *MulticastGroupServiceEnqueueDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this multicast group service enqueue default response has a 3xx status code +func (o *MulticastGroupServiceEnqueueDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this multicast group service enqueue default response has a 4xx status code +func (o *MulticastGroupServiceEnqueueDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this multicast group service enqueue default response has a 5xx status code +func (o *MulticastGroupServiceEnqueueDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this multicast group service enqueue default response a status code equal to that given +func (o *MulticastGroupServiceEnqueueDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the multicast group service enqueue default response +func (o *MulticastGroupServiceEnqueueDefault) Code() int { + return o._statusCode +} + +func (o *MulticastGroupServiceEnqueueDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups/{queueItem.multicastGroupId}/queue][%d] MulticastGroupService_Enqueue default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceEnqueueDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/multicast-groups/{queueItem.multicastGroupId}/queue][%d] MulticastGroupService_Enqueue default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceEnqueueDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *MulticastGroupServiceEnqueueDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +MulticastGroupServiceEnqueueBody multicast group service enqueue body +swagger:model MulticastGroupServiceEnqueueBody +*/ +type MulticastGroupServiceEnqueueBody struct { + + // queue item + QueueItem *MulticastGroupServiceEnqueueParamsBodyQueueItem `json:"queueItem,omitempty"` +} + +// Validate validates this multicast group service enqueue body +func (o *MulticastGroupServiceEnqueueBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateQueueItem(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *MulticastGroupServiceEnqueueBody) validateQueueItem(formats strfmt.Registry) error { + if swag.IsZero(o.QueueItem) { // not required + return nil + } + + if o.QueueItem != nil { + if err := o.QueueItem.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "queueItem") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "queueItem") + } + return err + } + } + + return nil +} + +// ContextValidate validate this multicast group service enqueue body based on the context it is used +func (o *MulticastGroupServiceEnqueueBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateQueueItem(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *MulticastGroupServiceEnqueueBody) contextValidateQueueItem(ctx context.Context, formats strfmt.Registry) error { + + if o.QueueItem != nil { + + if swag.IsZero(o.QueueItem) { // not required + return nil + } + + if err := o.QueueItem.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "queueItem") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "queueItem") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *MulticastGroupServiceEnqueueBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *MulticastGroupServiceEnqueueBody) UnmarshalBinary(b []byte) error { + var res MulticastGroupServiceEnqueueBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +MulticastGroupServiceEnqueueParamsBodyQueueItem Multicast queue-item to enqueue. +swagger:model MulticastGroupServiceEnqueueParamsBodyQueueItem +*/ +type MulticastGroupServiceEnqueueParamsBodyQueueItem struct { + + // Payload. + // Format: byte + Data strfmt.Base64 `json:"data,omitempty"` + + // Expires at (optional). + // Expired queue-items will be automatically removed from the queue. + // Format: date-time + ExpiresAt strfmt.DateTime `json:"expiresAt,omitempty"` + + // Downlink frame-counter. + // This will be automatically set on enqueue. + FCnt int64 `json:"fCnt,omitempty"` + + // FPort (must be > 0). + FPort int64 `json:"fPort,omitempty"` +} + +// Validate validates this multicast group service enqueue params body queue item +func (o *MulticastGroupServiceEnqueueParamsBodyQueueItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateExpiresAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *MulticastGroupServiceEnqueueParamsBodyQueueItem) validateExpiresAt(formats strfmt.Registry) error { + if swag.IsZero(o.ExpiresAt) { // not required + return nil + } + + if err := validate.FormatOf("body"+"."+"queueItem"+"."+"expiresAt", "body", "date-time", o.ExpiresAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this multicast group service enqueue params body queue item based on context it is used +func (o *MulticastGroupServiceEnqueueParamsBodyQueueItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *MulticastGroupServiceEnqueueParamsBodyQueueItem) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *MulticastGroupServiceEnqueueParamsBodyQueueItem) UnmarshalBinary(b []byte) error { + var res MulticastGroupServiceEnqueueParamsBodyQueueItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_flush_queue_parameters.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_flush_queue_parameters.go new file mode 100644 index 0000000..17d6f7d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_flush_queue_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewMulticastGroupServiceFlushQueueParams creates a new MulticastGroupServiceFlushQueueParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewMulticastGroupServiceFlushQueueParams() *MulticastGroupServiceFlushQueueParams { + return &MulticastGroupServiceFlushQueueParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMulticastGroupServiceFlushQueueParamsWithTimeout creates a new MulticastGroupServiceFlushQueueParams object +// with the ability to set a timeout on a request. +func NewMulticastGroupServiceFlushQueueParamsWithTimeout(timeout time.Duration) *MulticastGroupServiceFlushQueueParams { + return &MulticastGroupServiceFlushQueueParams{ + timeout: timeout, + } +} + +// NewMulticastGroupServiceFlushQueueParamsWithContext creates a new MulticastGroupServiceFlushQueueParams object +// with the ability to set a context for a request. +func NewMulticastGroupServiceFlushQueueParamsWithContext(ctx context.Context) *MulticastGroupServiceFlushQueueParams { + return &MulticastGroupServiceFlushQueueParams{ + Context: ctx, + } +} + +// NewMulticastGroupServiceFlushQueueParamsWithHTTPClient creates a new MulticastGroupServiceFlushQueueParams object +// with the ability to set a custom HTTPClient for a request. +func NewMulticastGroupServiceFlushQueueParamsWithHTTPClient(client *http.Client) *MulticastGroupServiceFlushQueueParams { + return &MulticastGroupServiceFlushQueueParams{ + HTTPClient: client, + } +} + +/* +MulticastGroupServiceFlushQueueParams contains all the parameters to send to the API endpoint + + for the multicast group service flush queue operation. + + Typically these are written to a http.Request. +*/ +type MulticastGroupServiceFlushQueueParams struct { + + /* MulticastGroupID. + + Multicast group ID. + */ + MulticastGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the multicast group service flush queue params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceFlushQueueParams) WithDefaults() *MulticastGroupServiceFlushQueueParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the multicast group service flush queue params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceFlushQueueParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the multicast group service flush queue params +func (o *MulticastGroupServiceFlushQueueParams) WithTimeout(timeout time.Duration) *MulticastGroupServiceFlushQueueParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the multicast group service flush queue params +func (o *MulticastGroupServiceFlushQueueParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the multicast group service flush queue params +func (o *MulticastGroupServiceFlushQueueParams) WithContext(ctx context.Context) *MulticastGroupServiceFlushQueueParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the multicast group service flush queue params +func (o *MulticastGroupServiceFlushQueueParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the multicast group service flush queue params +func (o *MulticastGroupServiceFlushQueueParams) WithHTTPClient(client *http.Client) *MulticastGroupServiceFlushQueueParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the multicast group service flush queue params +func (o *MulticastGroupServiceFlushQueueParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithMulticastGroupID adds the multicastGroupID to the multicast group service flush queue params +func (o *MulticastGroupServiceFlushQueueParams) WithMulticastGroupID(multicastGroupID string) *MulticastGroupServiceFlushQueueParams { + o.SetMulticastGroupID(multicastGroupID) + return o +} + +// SetMulticastGroupID adds the multicastGroupId to the multicast group service flush queue params +func (o *MulticastGroupServiceFlushQueueParams) SetMulticastGroupID(multicastGroupID string) { + o.MulticastGroupID = multicastGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *MulticastGroupServiceFlushQueueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param multicastGroupId + if err := r.SetPathParam("multicastGroupId", o.MulticastGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_flush_queue_responses.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_flush_queue_responses.go new file mode 100644 index 0000000..03af3c1 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_flush_queue_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// MulticastGroupServiceFlushQueueReader is a Reader for the MulticastGroupServiceFlushQueue structure. +type MulticastGroupServiceFlushQueueReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MulticastGroupServiceFlushQueueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMulticastGroupServiceFlushQueueOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMulticastGroupServiceFlushQueueDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewMulticastGroupServiceFlushQueueOK creates a MulticastGroupServiceFlushQueueOK with default headers values +func NewMulticastGroupServiceFlushQueueOK() *MulticastGroupServiceFlushQueueOK { + return &MulticastGroupServiceFlushQueueOK{} +} + +/* +MulticastGroupServiceFlushQueueOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type MulticastGroupServiceFlushQueueOK struct { + Payload interface{} +} + +// IsSuccess returns true when this multicast group service flush queue o k response has a 2xx status code +func (o *MulticastGroupServiceFlushQueueOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this multicast group service flush queue o k response has a 3xx status code +func (o *MulticastGroupServiceFlushQueueOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this multicast group service flush queue o k response has a 4xx status code +func (o *MulticastGroupServiceFlushQueueOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this multicast group service flush queue o k response has a 5xx status code +func (o *MulticastGroupServiceFlushQueueOK) IsServerError() bool { + return false +} + +// IsCode returns true when this multicast group service flush queue o k response a status code equal to that given +func (o *MulticastGroupServiceFlushQueueOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the multicast group service flush queue o k response +func (o *MulticastGroupServiceFlushQueueOK) Code() int { + return 200 +} + +func (o *MulticastGroupServiceFlushQueueOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{multicastGroupId}/queue][%d] multicastGroupServiceFlushQueueOK %s", 200, payload) +} + +func (o *MulticastGroupServiceFlushQueueOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{multicastGroupId}/queue][%d] multicastGroupServiceFlushQueueOK %s", 200, payload) +} + +func (o *MulticastGroupServiceFlushQueueOK) GetPayload() interface{} { + return o.Payload +} + +func (o *MulticastGroupServiceFlushQueueOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMulticastGroupServiceFlushQueueDefault creates a MulticastGroupServiceFlushQueueDefault with default headers values +func NewMulticastGroupServiceFlushQueueDefault(code int) *MulticastGroupServiceFlushQueueDefault { + return &MulticastGroupServiceFlushQueueDefault{ + _statusCode: code, + } +} + +/* +MulticastGroupServiceFlushQueueDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type MulticastGroupServiceFlushQueueDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this multicast group service flush queue default response has a 2xx status code +func (o *MulticastGroupServiceFlushQueueDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this multicast group service flush queue default response has a 3xx status code +func (o *MulticastGroupServiceFlushQueueDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this multicast group service flush queue default response has a 4xx status code +func (o *MulticastGroupServiceFlushQueueDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this multicast group service flush queue default response has a 5xx status code +func (o *MulticastGroupServiceFlushQueueDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this multicast group service flush queue default response a status code equal to that given +func (o *MulticastGroupServiceFlushQueueDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the multicast group service flush queue default response +func (o *MulticastGroupServiceFlushQueueDefault) Code() int { + return o._statusCode +} + +func (o *MulticastGroupServiceFlushQueueDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{multicastGroupId}/queue][%d] MulticastGroupService_FlushQueue default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceFlushQueueDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{multicastGroupId}/queue][%d] MulticastGroupService_FlushQueue default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceFlushQueueDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *MulticastGroupServiceFlushQueueDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_get_parameters.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_get_parameters.go new file mode 100644 index 0000000..e9bf6af --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewMulticastGroupServiceGetParams creates a new MulticastGroupServiceGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewMulticastGroupServiceGetParams() *MulticastGroupServiceGetParams { + return &MulticastGroupServiceGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMulticastGroupServiceGetParamsWithTimeout creates a new MulticastGroupServiceGetParams object +// with the ability to set a timeout on a request. +func NewMulticastGroupServiceGetParamsWithTimeout(timeout time.Duration) *MulticastGroupServiceGetParams { + return &MulticastGroupServiceGetParams{ + timeout: timeout, + } +} + +// NewMulticastGroupServiceGetParamsWithContext creates a new MulticastGroupServiceGetParams object +// with the ability to set a context for a request. +func NewMulticastGroupServiceGetParamsWithContext(ctx context.Context) *MulticastGroupServiceGetParams { + return &MulticastGroupServiceGetParams{ + Context: ctx, + } +} + +// NewMulticastGroupServiceGetParamsWithHTTPClient creates a new MulticastGroupServiceGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewMulticastGroupServiceGetParamsWithHTTPClient(client *http.Client) *MulticastGroupServiceGetParams { + return &MulticastGroupServiceGetParams{ + HTTPClient: client, + } +} + +/* +MulticastGroupServiceGetParams contains all the parameters to send to the API endpoint + + for the multicast group service get operation. + + Typically these are written to a http.Request. +*/ +type MulticastGroupServiceGetParams struct { + + /* ID. + + Multicast group ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the multicast group service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceGetParams) WithDefaults() *MulticastGroupServiceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the multicast group service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the multicast group service get params +func (o *MulticastGroupServiceGetParams) WithTimeout(timeout time.Duration) *MulticastGroupServiceGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the multicast group service get params +func (o *MulticastGroupServiceGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the multicast group service get params +func (o *MulticastGroupServiceGetParams) WithContext(ctx context.Context) *MulticastGroupServiceGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the multicast group service get params +func (o *MulticastGroupServiceGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the multicast group service get params +func (o *MulticastGroupServiceGetParams) WithHTTPClient(client *http.Client) *MulticastGroupServiceGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the multicast group service get params +func (o *MulticastGroupServiceGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the multicast group service get params +func (o *MulticastGroupServiceGetParams) WithID(id string) *MulticastGroupServiceGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the multicast group service get params +func (o *MulticastGroupServiceGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *MulticastGroupServiceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_get_responses.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_get_responses.go new file mode 100644 index 0000000..9626e2b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_get_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// MulticastGroupServiceGetReader is a Reader for the MulticastGroupServiceGet structure. +type MulticastGroupServiceGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MulticastGroupServiceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMulticastGroupServiceGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMulticastGroupServiceGetDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewMulticastGroupServiceGetOK creates a MulticastGroupServiceGetOK with default headers values +func NewMulticastGroupServiceGetOK() *MulticastGroupServiceGetOK { + return &MulticastGroupServiceGetOK{} +} + +/* +MulticastGroupServiceGetOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type MulticastGroupServiceGetOK struct { + Payload *models.APIGetMulticastGroupResponse +} + +// IsSuccess returns true when this multicast group service get o k response has a 2xx status code +func (o *MulticastGroupServiceGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this multicast group service get o k response has a 3xx status code +func (o *MulticastGroupServiceGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this multicast group service get o k response has a 4xx status code +func (o *MulticastGroupServiceGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this multicast group service get o k response has a 5xx status code +func (o *MulticastGroupServiceGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this multicast group service get o k response a status code equal to that given +func (o *MulticastGroupServiceGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the multicast group service get o k response +func (o *MulticastGroupServiceGetOK) Code() int { + return 200 +} + +func (o *MulticastGroupServiceGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/multicast-groups/{id}][%d] multicastGroupServiceGetOK %s", 200, payload) +} + +func (o *MulticastGroupServiceGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/multicast-groups/{id}][%d] multicastGroupServiceGetOK %s", 200, payload) +} + +func (o *MulticastGroupServiceGetOK) GetPayload() *models.APIGetMulticastGroupResponse { + return o.Payload +} + +func (o *MulticastGroupServiceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetMulticastGroupResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMulticastGroupServiceGetDefault creates a MulticastGroupServiceGetDefault with default headers values +func NewMulticastGroupServiceGetDefault(code int) *MulticastGroupServiceGetDefault { + return &MulticastGroupServiceGetDefault{ + _statusCode: code, + } +} + +/* +MulticastGroupServiceGetDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type MulticastGroupServiceGetDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this multicast group service get default response has a 2xx status code +func (o *MulticastGroupServiceGetDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this multicast group service get default response has a 3xx status code +func (o *MulticastGroupServiceGetDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this multicast group service get default response has a 4xx status code +func (o *MulticastGroupServiceGetDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this multicast group service get default response has a 5xx status code +func (o *MulticastGroupServiceGetDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this multicast group service get default response a status code equal to that given +func (o *MulticastGroupServiceGetDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the multicast group service get default response +func (o *MulticastGroupServiceGetDefault) Code() int { + return o._statusCode +} + +func (o *MulticastGroupServiceGetDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/multicast-groups/{id}][%d] MulticastGroupService_Get default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceGetDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/multicast-groups/{id}][%d] MulticastGroupService_Get default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceGetDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *MulticastGroupServiceGetDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_list_parameters.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_list_parameters.go new file mode 100644 index 0000000..66637b2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_list_parameters.go @@ -0,0 +1,271 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewMulticastGroupServiceListParams creates a new MulticastGroupServiceListParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewMulticastGroupServiceListParams() *MulticastGroupServiceListParams { + return &MulticastGroupServiceListParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMulticastGroupServiceListParamsWithTimeout creates a new MulticastGroupServiceListParams object +// with the ability to set a timeout on a request. +func NewMulticastGroupServiceListParamsWithTimeout(timeout time.Duration) *MulticastGroupServiceListParams { + return &MulticastGroupServiceListParams{ + timeout: timeout, + } +} + +// NewMulticastGroupServiceListParamsWithContext creates a new MulticastGroupServiceListParams object +// with the ability to set a context for a request. +func NewMulticastGroupServiceListParamsWithContext(ctx context.Context) *MulticastGroupServiceListParams { + return &MulticastGroupServiceListParams{ + Context: ctx, + } +} + +// NewMulticastGroupServiceListParamsWithHTTPClient creates a new MulticastGroupServiceListParams object +// with the ability to set a custom HTTPClient for a request. +func NewMulticastGroupServiceListParamsWithHTTPClient(client *http.Client) *MulticastGroupServiceListParams { + return &MulticastGroupServiceListParams{ + HTTPClient: client, + } +} + +/* +MulticastGroupServiceListParams contains all the parameters to send to the API endpoint + + for the multicast group service list operation. + + Typically these are written to a http.Request. +*/ +type MulticastGroupServiceListParams struct { + + /* ApplicationID. + + Application ID to list the multicast groups for. + */ + ApplicationID *string + + /* Limit. + + Max number of multicast groups to return in the result-set. + If not set, it will be treated as 0, and the response will only return the total_count. + + Format: int64 + */ + Limit *int64 + + /* Offset. + + Offset in the result-set (for pagination). + + Format: int64 + */ + Offset *int64 + + /* Search. + + If set, the given string will be used to search on name. + */ + Search *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the multicast group service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceListParams) WithDefaults() *MulticastGroupServiceListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the multicast group service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceListParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the multicast group service list params +func (o *MulticastGroupServiceListParams) WithTimeout(timeout time.Duration) *MulticastGroupServiceListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the multicast group service list params +func (o *MulticastGroupServiceListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the multicast group service list params +func (o *MulticastGroupServiceListParams) WithContext(ctx context.Context) *MulticastGroupServiceListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the multicast group service list params +func (o *MulticastGroupServiceListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the multicast group service list params +func (o *MulticastGroupServiceListParams) WithHTTPClient(client *http.Client) *MulticastGroupServiceListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the multicast group service list params +func (o *MulticastGroupServiceListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithApplicationID adds the applicationID to the multicast group service list params +func (o *MulticastGroupServiceListParams) WithApplicationID(applicationID *string) *MulticastGroupServiceListParams { + o.SetApplicationID(applicationID) + return o +} + +// SetApplicationID adds the applicationId to the multicast group service list params +func (o *MulticastGroupServiceListParams) SetApplicationID(applicationID *string) { + o.ApplicationID = applicationID +} + +// WithLimit adds the limit to the multicast group service list params +func (o *MulticastGroupServiceListParams) WithLimit(limit *int64) *MulticastGroupServiceListParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the multicast group service list params +func (o *MulticastGroupServiceListParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithOffset adds the offset to the multicast group service list params +func (o *MulticastGroupServiceListParams) WithOffset(offset *int64) *MulticastGroupServiceListParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the multicast group service list params +func (o *MulticastGroupServiceListParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithSearch adds the search to the multicast group service list params +func (o *MulticastGroupServiceListParams) WithSearch(search *string) *MulticastGroupServiceListParams { + o.SetSearch(search) + return o +} + +// SetSearch adds the search to the multicast group service list params +func (o *MulticastGroupServiceListParams) SetSearch(search *string) { + o.Search = search +} + +// WriteToRequest writes these params to a swagger request +func (o *MulticastGroupServiceListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ApplicationID != nil { + + // query param applicationId + var qrApplicationID string + + if o.ApplicationID != nil { + qrApplicationID = *o.ApplicationID + } + qApplicationID := qrApplicationID + if qApplicationID != "" { + + if err := r.SetQueryParam("applicationId", qApplicationID); err != nil { + return err + } + } + } + + if o.Limit != nil { + + // query param limit + var qrLimit int64 + + if o.Limit != nil { + qrLimit = *o.Limit + } + qLimit := swag.FormatInt64(qrLimit) + if qLimit != "" { + + if err := r.SetQueryParam("limit", qLimit); err != nil { + return err + } + } + } + + if o.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + if o.Search != nil { + + // query param search + var qrSearch string + + if o.Search != nil { + qrSearch = *o.Search + } + qSearch := qrSearch + if qSearch != "" { + + if err := r.SetQueryParam("search", qSearch); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_list_queue_parameters.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_list_queue_parameters.go new file mode 100644 index 0000000..2d0d0e3 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_list_queue_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewMulticastGroupServiceListQueueParams creates a new MulticastGroupServiceListQueueParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewMulticastGroupServiceListQueueParams() *MulticastGroupServiceListQueueParams { + return &MulticastGroupServiceListQueueParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMulticastGroupServiceListQueueParamsWithTimeout creates a new MulticastGroupServiceListQueueParams object +// with the ability to set a timeout on a request. +func NewMulticastGroupServiceListQueueParamsWithTimeout(timeout time.Duration) *MulticastGroupServiceListQueueParams { + return &MulticastGroupServiceListQueueParams{ + timeout: timeout, + } +} + +// NewMulticastGroupServiceListQueueParamsWithContext creates a new MulticastGroupServiceListQueueParams object +// with the ability to set a context for a request. +func NewMulticastGroupServiceListQueueParamsWithContext(ctx context.Context) *MulticastGroupServiceListQueueParams { + return &MulticastGroupServiceListQueueParams{ + Context: ctx, + } +} + +// NewMulticastGroupServiceListQueueParamsWithHTTPClient creates a new MulticastGroupServiceListQueueParams object +// with the ability to set a custom HTTPClient for a request. +func NewMulticastGroupServiceListQueueParamsWithHTTPClient(client *http.Client) *MulticastGroupServiceListQueueParams { + return &MulticastGroupServiceListQueueParams{ + HTTPClient: client, + } +} + +/* +MulticastGroupServiceListQueueParams contains all the parameters to send to the API endpoint + + for the multicast group service list queue operation. + + Typically these are written to a http.Request. +*/ +type MulticastGroupServiceListQueueParams struct { + + /* MulticastGroupID. + + Multicast group ID. + */ + MulticastGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the multicast group service list queue params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceListQueueParams) WithDefaults() *MulticastGroupServiceListQueueParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the multicast group service list queue params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceListQueueParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the multicast group service list queue params +func (o *MulticastGroupServiceListQueueParams) WithTimeout(timeout time.Duration) *MulticastGroupServiceListQueueParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the multicast group service list queue params +func (o *MulticastGroupServiceListQueueParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the multicast group service list queue params +func (o *MulticastGroupServiceListQueueParams) WithContext(ctx context.Context) *MulticastGroupServiceListQueueParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the multicast group service list queue params +func (o *MulticastGroupServiceListQueueParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the multicast group service list queue params +func (o *MulticastGroupServiceListQueueParams) WithHTTPClient(client *http.Client) *MulticastGroupServiceListQueueParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the multicast group service list queue params +func (o *MulticastGroupServiceListQueueParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithMulticastGroupID adds the multicastGroupID to the multicast group service list queue params +func (o *MulticastGroupServiceListQueueParams) WithMulticastGroupID(multicastGroupID string) *MulticastGroupServiceListQueueParams { + o.SetMulticastGroupID(multicastGroupID) + return o +} + +// SetMulticastGroupID adds the multicastGroupId to the multicast group service list queue params +func (o *MulticastGroupServiceListQueueParams) SetMulticastGroupID(multicastGroupID string) { + o.MulticastGroupID = multicastGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *MulticastGroupServiceListQueueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param multicastGroupId + if err := r.SetPathParam("multicastGroupId", o.MulticastGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_list_queue_responses.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_list_queue_responses.go new file mode 100644 index 0000000..6116d59 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_list_queue_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// MulticastGroupServiceListQueueReader is a Reader for the MulticastGroupServiceListQueue structure. +type MulticastGroupServiceListQueueReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MulticastGroupServiceListQueueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMulticastGroupServiceListQueueOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMulticastGroupServiceListQueueDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewMulticastGroupServiceListQueueOK creates a MulticastGroupServiceListQueueOK with default headers values +func NewMulticastGroupServiceListQueueOK() *MulticastGroupServiceListQueueOK { + return &MulticastGroupServiceListQueueOK{} +} + +/* +MulticastGroupServiceListQueueOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type MulticastGroupServiceListQueueOK struct { + Payload *models.APIListMulticastGroupQueueResponse +} + +// IsSuccess returns true when this multicast group service list queue o k response has a 2xx status code +func (o *MulticastGroupServiceListQueueOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this multicast group service list queue o k response has a 3xx status code +func (o *MulticastGroupServiceListQueueOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this multicast group service list queue o k response has a 4xx status code +func (o *MulticastGroupServiceListQueueOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this multicast group service list queue o k response has a 5xx status code +func (o *MulticastGroupServiceListQueueOK) IsServerError() bool { + return false +} + +// IsCode returns true when this multicast group service list queue o k response a status code equal to that given +func (o *MulticastGroupServiceListQueueOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the multicast group service list queue o k response +func (o *MulticastGroupServiceListQueueOK) Code() int { + return 200 +} + +func (o *MulticastGroupServiceListQueueOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/multicast-groups/{multicastGroupId}/queue][%d] multicastGroupServiceListQueueOK %s", 200, payload) +} + +func (o *MulticastGroupServiceListQueueOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/multicast-groups/{multicastGroupId}/queue][%d] multicastGroupServiceListQueueOK %s", 200, payload) +} + +func (o *MulticastGroupServiceListQueueOK) GetPayload() *models.APIListMulticastGroupQueueResponse { + return o.Payload +} + +func (o *MulticastGroupServiceListQueueOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListMulticastGroupQueueResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMulticastGroupServiceListQueueDefault creates a MulticastGroupServiceListQueueDefault with default headers values +func NewMulticastGroupServiceListQueueDefault(code int) *MulticastGroupServiceListQueueDefault { + return &MulticastGroupServiceListQueueDefault{ + _statusCode: code, + } +} + +/* +MulticastGroupServiceListQueueDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type MulticastGroupServiceListQueueDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this multicast group service list queue default response has a 2xx status code +func (o *MulticastGroupServiceListQueueDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this multicast group service list queue default response has a 3xx status code +func (o *MulticastGroupServiceListQueueDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this multicast group service list queue default response has a 4xx status code +func (o *MulticastGroupServiceListQueueDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this multicast group service list queue default response has a 5xx status code +func (o *MulticastGroupServiceListQueueDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this multicast group service list queue default response a status code equal to that given +func (o *MulticastGroupServiceListQueueDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the multicast group service list queue default response +func (o *MulticastGroupServiceListQueueDefault) Code() int { + return o._statusCode +} + +func (o *MulticastGroupServiceListQueueDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/multicast-groups/{multicastGroupId}/queue][%d] MulticastGroupService_ListQueue default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceListQueueDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/multicast-groups/{multicastGroupId}/queue][%d] MulticastGroupService_ListQueue default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceListQueueDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *MulticastGroupServiceListQueueDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_list_responses.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_list_responses.go new file mode 100644 index 0000000..072d4b0 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_list_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// MulticastGroupServiceListReader is a Reader for the MulticastGroupServiceList structure. +type MulticastGroupServiceListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MulticastGroupServiceListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMulticastGroupServiceListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMulticastGroupServiceListDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewMulticastGroupServiceListOK creates a MulticastGroupServiceListOK with default headers values +func NewMulticastGroupServiceListOK() *MulticastGroupServiceListOK { + return &MulticastGroupServiceListOK{} +} + +/* +MulticastGroupServiceListOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type MulticastGroupServiceListOK struct { + Payload *models.APIListMulticastGroupsResponse +} + +// IsSuccess returns true when this multicast group service list o k response has a 2xx status code +func (o *MulticastGroupServiceListOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this multicast group service list o k response has a 3xx status code +func (o *MulticastGroupServiceListOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this multicast group service list o k response has a 4xx status code +func (o *MulticastGroupServiceListOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this multicast group service list o k response has a 5xx status code +func (o *MulticastGroupServiceListOK) IsServerError() bool { + return false +} + +// IsCode returns true when this multicast group service list o k response a status code equal to that given +func (o *MulticastGroupServiceListOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the multicast group service list o k response +func (o *MulticastGroupServiceListOK) Code() int { + return 200 +} + +func (o *MulticastGroupServiceListOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/multicast-groups][%d] multicastGroupServiceListOK %s", 200, payload) +} + +func (o *MulticastGroupServiceListOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/multicast-groups][%d] multicastGroupServiceListOK %s", 200, payload) +} + +func (o *MulticastGroupServiceListOK) GetPayload() *models.APIListMulticastGroupsResponse { + return o.Payload +} + +func (o *MulticastGroupServiceListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListMulticastGroupsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMulticastGroupServiceListDefault creates a MulticastGroupServiceListDefault with default headers values +func NewMulticastGroupServiceListDefault(code int) *MulticastGroupServiceListDefault { + return &MulticastGroupServiceListDefault{ + _statusCode: code, + } +} + +/* +MulticastGroupServiceListDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type MulticastGroupServiceListDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this multicast group service list default response has a 2xx status code +func (o *MulticastGroupServiceListDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this multicast group service list default response has a 3xx status code +func (o *MulticastGroupServiceListDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this multicast group service list default response has a 4xx status code +func (o *MulticastGroupServiceListDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this multicast group service list default response has a 5xx status code +func (o *MulticastGroupServiceListDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this multicast group service list default response a status code equal to that given +func (o *MulticastGroupServiceListDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the multicast group service list default response +func (o *MulticastGroupServiceListDefault) Code() int { + return o._statusCode +} + +func (o *MulticastGroupServiceListDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/multicast-groups][%d] MulticastGroupService_List default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceListDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/multicast-groups][%d] MulticastGroupService_List default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceListDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *MulticastGroupServiceListDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_remove_device_parameters.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_remove_device_parameters.go new file mode 100644 index 0000000..9924619 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_remove_device_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewMulticastGroupServiceRemoveDeviceParams creates a new MulticastGroupServiceRemoveDeviceParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewMulticastGroupServiceRemoveDeviceParams() *MulticastGroupServiceRemoveDeviceParams { + return &MulticastGroupServiceRemoveDeviceParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMulticastGroupServiceRemoveDeviceParamsWithTimeout creates a new MulticastGroupServiceRemoveDeviceParams object +// with the ability to set a timeout on a request. +func NewMulticastGroupServiceRemoveDeviceParamsWithTimeout(timeout time.Duration) *MulticastGroupServiceRemoveDeviceParams { + return &MulticastGroupServiceRemoveDeviceParams{ + timeout: timeout, + } +} + +// NewMulticastGroupServiceRemoveDeviceParamsWithContext creates a new MulticastGroupServiceRemoveDeviceParams object +// with the ability to set a context for a request. +func NewMulticastGroupServiceRemoveDeviceParamsWithContext(ctx context.Context) *MulticastGroupServiceRemoveDeviceParams { + return &MulticastGroupServiceRemoveDeviceParams{ + Context: ctx, + } +} + +// NewMulticastGroupServiceRemoveDeviceParamsWithHTTPClient creates a new MulticastGroupServiceRemoveDeviceParams object +// with the ability to set a custom HTTPClient for a request. +func NewMulticastGroupServiceRemoveDeviceParamsWithHTTPClient(client *http.Client) *MulticastGroupServiceRemoveDeviceParams { + return &MulticastGroupServiceRemoveDeviceParams{ + HTTPClient: client, + } +} + +/* +MulticastGroupServiceRemoveDeviceParams contains all the parameters to send to the API endpoint + + for the multicast group service remove device operation. + + Typically these are written to a http.Request. +*/ +type MulticastGroupServiceRemoveDeviceParams struct { + + /* DevEui. + + Device EUI (HEX encoded). + */ + DevEui string + + /* MulticastGroupID. + + Multicast group ID. + */ + MulticastGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the multicast group service remove device params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceRemoveDeviceParams) WithDefaults() *MulticastGroupServiceRemoveDeviceParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the multicast group service remove device params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceRemoveDeviceParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the multicast group service remove device params +func (o *MulticastGroupServiceRemoveDeviceParams) WithTimeout(timeout time.Duration) *MulticastGroupServiceRemoveDeviceParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the multicast group service remove device params +func (o *MulticastGroupServiceRemoveDeviceParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the multicast group service remove device params +func (o *MulticastGroupServiceRemoveDeviceParams) WithContext(ctx context.Context) *MulticastGroupServiceRemoveDeviceParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the multicast group service remove device params +func (o *MulticastGroupServiceRemoveDeviceParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the multicast group service remove device params +func (o *MulticastGroupServiceRemoveDeviceParams) WithHTTPClient(client *http.Client) *MulticastGroupServiceRemoveDeviceParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the multicast group service remove device params +func (o *MulticastGroupServiceRemoveDeviceParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDevEui adds the devEui to the multicast group service remove device params +func (o *MulticastGroupServiceRemoveDeviceParams) WithDevEui(devEui string) *MulticastGroupServiceRemoveDeviceParams { + o.SetDevEui(devEui) + return o +} + +// SetDevEui adds the devEui to the multicast group service remove device params +func (o *MulticastGroupServiceRemoveDeviceParams) SetDevEui(devEui string) { + o.DevEui = devEui +} + +// WithMulticastGroupID adds the multicastGroupID to the multicast group service remove device params +func (o *MulticastGroupServiceRemoveDeviceParams) WithMulticastGroupID(multicastGroupID string) *MulticastGroupServiceRemoveDeviceParams { + o.SetMulticastGroupID(multicastGroupID) + return o +} + +// SetMulticastGroupID adds the multicastGroupId to the multicast group service remove device params +func (o *MulticastGroupServiceRemoveDeviceParams) SetMulticastGroupID(multicastGroupID string) { + o.MulticastGroupID = multicastGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *MulticastGroupServiceRemoveDeviceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param devEui + if err := r.SetPathParam("devEui", o.DevEui); err != nil { + return err + } + + // path param multicastGroupId + if err := r.SetPathParam("multicastGroupId", o.MulticastGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_remove_device_responses.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_remove_device_responses.go new file mode 100644 index 0000000..687ba15 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_remove_device_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// MulticastGroupServiceRemoveDeviceReader is a Reader for the MulticastGroupServiceRemoveDevice structure. +type MulticastGroupServiceRemoveDeviceReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MulticastGroupServiceRemoveDeviceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMulticastGroupServiceRemoveDeviceOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMulticastGroupServiceRemoveDeviceDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewMulticastGroupServiceRemoveDeviceOK creates a MulticastGroupServiceRemoveDeviceOK with default headers values +func NewMulticastGroupServiceRemoveDeviceOK() *MulticastGroupServiceRemoveDeviceOK { + return &MulticastGroupServiceRemoveDeviceOK{} +} + +/* +MulticastGroupServiceRemoveDeviceOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type MulticastGroupServiceRemoveDeviceOK struct { + Payload interface{} +} + +// IsSuccess returns true when this multicast group service remove device o k response has a 2xx status code +func (o *MulticastGroupServiceRemoveDeviceOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this multicast group service remove device o k response has a 3xx status code +func (o *MulticastGroupServiceRemoveDeviceOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this multicast group service remove device o k response has a 4xx status code +func (o *MulticastGroupServiceRemoveDeviceOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this multicast group service remove device o k response has a 5xx status code +func (o *MulticastGroupServiceRemoveDeviceOK) IsServerError() bool { + return false +} + +// IsCode returns true when this multicast group service remove device o k response a status code equal to that given +func (o *MulticastGroupServiceRemoveDeviceOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the multicast group service remove device o k response +func (o *MulticastGroupServiceRemoveDeviceOK) Code() int { + return 200 +} + +func (o *MulticastGroupServiceRemoveDeviceOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{multicastGroupId}/devices/{devEui}][%d] multicastGroupServiceRemoveDeviceOK %s", 200, payload) +} + +func (o *MulticastGroupServiceRemoveDeviceOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{multicastGroupId}/devices/{devEui}][%d] multicastGroupServiceRemoveDeviceOK %s", 200, payload) +} + +func (o *MulticastGroupServiceRemoveDeviceOK) GetPayload() interface{} { + return o.Payload +} + +func (o *MulticastGroupServiceRemoveDeviceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMulticastGroupServiceRemoveDeviceDefault creates a MulticastGroupServiceRemoveDeviceDefault with default headers values +func NewMulticastGroupServiceRemoveDeviceDefault(code int) *MulticastGroupServiceRemoveDeviceDefault { + return &MulticastGroupServiceRemoveDeviceDefault{ + _statusCode: code, + } +} + +/* +MulticastGroupServiceRemoveDeviceDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type MulticastGroupServiceRemoveDeviceDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this multicast group service remove device default response has a 2xx status code +func (o *MulticastGroupServiceRemoveDeviceDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this multicast group service remove device default response has a 3xx status code +func (o *MulticastGroupServiceRemoveDeviceDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this multicast group service remove device default response has a 4xx status code +func (o *MulticastGroupServiceRemoveDeviceDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this multicast group service remove device default response has a 5xx status code +func (o *MulticastGroupServiceRemoveDeviceDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this multicast group service remove device default response a status code equal to that given +func (o *MulticastGroupServiceRemoveDeviceDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the multicast group service remove device default response +func (o *MulticastGroupServiceRemoveDeviceDefault) Code() int { + return o._statusCode +} + +func (o *MulticastGroupServiceRemoveDeviceDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{multicastGroupId}/devices/{devEui}][%d] MulticastGroupService_RemoveDevice default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceRemoveDeviceDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{multicastGroupId}/devices/{devEui}][%d] MulticastGroupService_RemoveDevice default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceRemoveDeviceDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *MulticastGroupServiceRemoveDeviceDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_remove_gateway_parameters.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_remove_gateway_parameters.go new file mode 100644 index 0000000..09f1e79 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_remove_gateway_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewMulticastGroupServiceRemoveGatewayParams creates a new MulticastGroupServiceRemoveGatewayParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewMulticastGroupServiceRemoveGatewayParams() *MulticastGroupServiceRemoveGatewayParams { + return &MulticastGroupServiceRemoveGatewayParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMulticastGroupServiceRemoveGatewayParamsWithTimeout creates a new MulticastGroupServiceRemoveGatewayParams object +// with the ability to set a timeout on a request. +func NewMulticastGroupServiceRemoveGatewayParamsWithTimeout(timeout time.Duration) *MulticastGroupServiceRemoveGatewayParams { + return &MulticastGroupServiceRemoveGatewayParams{ + timeout: timeout, + } +} + +// NewMulticastGroupServiceRemoveGatewayParamsWithContext creates a new MulticastGroupServiceRemoveGatewayParams object +// with the ability to set a context for a request. +func NewMulticastGroupServiceRemoveGatewayParamsWithContext(ctx context.Context) *MulticastGroupServiceRemoveGatewayParams { + return &MulticastGroupServiceRemoveGatewayParams{ + Context: ctx, + } +} + +// NewMulticastGroupServiceRemoveGatewayParamsWithHTTPClient creates a new MulticastGroupServiceRemoveGatewayParams object +// with the ability to set a custom HTTPClient for a request. +func NewMulticastGroupServiceRemoveGatewayParamsWithHTTPClient(client *http.Client) *MulticastGroupServiceRemoveGatewayParams { + return &MulticastGroupServiceRemoveGatewayParams{ + HTTPClient: client, + } +} + +/* +MulticastGroupServiceRemoveGatewayParams contains all the parameters to send to the API endpoint + + for the multicast group service remove gateway operation. + + Typically these are written to a http.Request. +*/ +type MulticastGroupServiceRemoveGatewayParams struct { + + /* GatewayID. + + Gateway ID (HEX encoded). + */ + GatewayID string + + /* MulticastGroupID. + + Multicast group ID. + */ + MulticastGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the multicast group service remove gateway params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceRemoveGatewayParams) WithDefaults() *MulticastGroupServiceRemoveGatewayParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the multicast group service remove gateway params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceRemoveGatewayParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the multicast group service remove gateway params +func (o *MulticastGroupServiceRemoveGatewayParams) WithTimeout(timeout time.Duration) *MulticastGroupServiceRemoveGatewayParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the multicast group service remove gateway params +func (o *MulticastGroupServiceRemoveGatewayParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the multicast group service remove gateway params +func (o *MulticastGroupServiceRemoveGatewayParams) WithContext(ctx context.Context) *MulticastGroupServiceRemoveGatewayParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the multicast group service remove gateway params +func (o *MulticastGroupServiceRemoveGatewayParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the multicast group service remove gateway params +func (o *MulticastGroupServiceRemoveGatewayParams) WithHTTPClient(client *http.Client) *MulticastGroupServiceRemoveGatewayParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the multicast group service remove gateway params +func (o *MulticastGroupServiceRemoveGatewayParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGatewayID adds the gatewayID to the multicast group service remove gateway params +func (o *MulticastGroupServiceRemoveGatewayParams) WithGatewayID(gatewayID string) *MulticastGroupServiceRemoveGatewayParams { + o.SetGatewayID(gatewayID) + return o +} + +// SetGatewayID adds the gatewayId to the multicast group service remove gateway params +func (o *MulticastGroupServiceRemoveGatewayParams) SetGatewayID(gatewayID string) { + o.GatewayID = gatewayID +} + +// WithMulticastGroupID adds the multicastGroupID to the multicast group service remove gateway params +func (o *MulticastGroupServiceRemoveGatewayParams) WithMulticastGroupID(multicastGroupID string) *MulticastGroupServiceRemoveGatewayParams { + o.SetMulticastGroupID(multicastGroupID) + return o +} + +// SetMulticastGroupID adds the multicastGroupId to the multicast group service remove gateway params +func (o *MulticastGroupServiceRemoveGatewayParams) SetMulticastGroupID(multicastGroupID string) { + o.MulticastGroupID = multicastGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *MulticastGroupServiceRemoveGatewayParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param gatewayId + if err := r.SetPathParam("gatewayId", o.GatewayID); err != nil { + return err + } + + // path param multicastGroupId + if err := r.SetPathParam("multicastGroupId", o.MulticastGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_remove_gateway_responses.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_remove_gateway_responses.go new file mode 100644 index 0000000..842e615 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_remove_gateway_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// MulticastGroupServiceRemoveGatewayReader is a Reader for the MulticastGroupServiceRemoveGateway structure. +type MulticastGroupServiceRemoveGatewayReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MulticastGroupServiceRemoveGatewayReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMulticastGroupServiceRemoveGatewayOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMulticastGroupServiceRemoveGatewayDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewMulticastGroupServiceRemoveGatewayOK creates a MulticastGroupServiceRemoveGatewayOK with default headers values +func NewMulticastGroupServiceRemoveGatewayOK() *MulticastGroupServiceRemoveGatewayOK { + return &MulticastGroupServiceRemoveGatewayOK{} +} + +/* +MulticastGroupServiceRemoveGatewayOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type MulticastGroupServiceRemoveGatewayOK struct { + Payload interface{} +} + +// IsSuccess returns true when this multicast group service remove gateway o k response has a 2xx status code +func (o *MulticastGroupServiceRemoveGatewayOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this multicast group service remove gateway o k response has a 3xx status code +func (o *MulticastGroupServiceRemoveGatewayOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this multicast group service remove gateway o k response has a 4xx status code +func (o *MulticastGroupServiceRemoveGatewayOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this multicast group service remove gateway o k response has a 5xx status code +func (o *MulticastGroupServiceRemoveGatewayOK) IsServerError() bool { + return false +} + +// IsCode returns true when this multicast group service remove gateway o k response a status code equal to that given +func (o *MulticastGroupServiceRemoveGatewayOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the multicast group service remove gateway o k response +func (o *MulticastGroupServiceRemoveGatewayOK) Code() int { + return 200 +} + +func (o *MulticastGroupServiceRemoveGatewayOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{multicastGroupId}/gateways/{gatewayId}][%d] multicastGroupServiceRemoveGatewayOK %s", 200, payload) +} + +func (o *MulticastGroupServiceRemoveGatewayOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{multicastGroupId}/gateways/{gatewayId}][%d] multicastGroupServiceRemoveGatewayOK %s", 200, payload) +} + +func (o *MulticastGroupServiceRemoveGatewayOK) GetPayload() interface{} { + return o.Payload +} + +func (o *MulticastGroupServiceRemoveGatewayOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMulticastGroupServiceRemoveGatewayDefault creates a MulticastGroupServiceRemoveGatewayDefault with default headers values +func NewMulticastGroupServiceRemoveGatewayDefault(code int) *MulticastGroupServiceRemoveGatewayDefault { + return &MulticastGroupServiceRemoveGatewayDefault{ + _statusCode: code, + } +} + +/* +MulticastGroupServiceRemoveGatewayDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type MulticastGroupServiceRemoveGatewayDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this multicast group service remove gateway default response has a 2xx status code +func (o *MulticastGroupServiceRemoveGatewayDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this multicast group service remove gateway default response has a 3xx status code +func (o *MulticastGroupServiceRemoveGatewayDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this multicast group service remove gateway default response has a 4xx status code +func (o *MulticastGroupServiceRemoveGatewayDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this multicast group service remove gateway default response has a 5xx status code +func (o *MulticastGroupServiceRemoveGatewayDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this multicast group service remove gateway default response a status code equal to that given +func (o *MulticastGroupServiceRemoveGatewayDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the multicast group service remove gateway default response +func (o *MulticastGroupServiceRemoveGatewayDefault) Code() int { + return o._statusCode +} + +func (o *MulticastGroupServiceRemoveGatewayDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{multicastGroupId}/gateways/{gatewayId}][%d] MulticastGroupService_RemoveGateway default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceRemoveGatewayDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/multicast-groups/{multicastGroupId}/gateways/{gatewayId}][%d] MulticastGroupService_RemoveGateway default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceRemoveGatewayDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *MulticastGroupServiceRemoveGatewayDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_update_parameters.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_update_parameters.go new file mode 100644 index 0000000..bb72739 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_update_parameters.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewMulticastGroupServiceUpdateParams creates a new MulticastGroupServiceUpdateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewMulticastGroupServiceUpdateParams() *MulticastGroupServiceUpdateParams { + return &MulticastGroupServiceUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMulticastGroupServiceUpdateParamsWithTimeout creates a new MulticastGroupServiceUpdateParams object +// with the ability to set a timeout on a request. +func NewMulticastGroupServiceUpdateParamsWithTimeout(timeout time.Duration) *MulticastGroupServiceUpdateParams { + return &MulticastGroupServiceUpdateParams{ + timeout: timeout, + } +} + +// NewMulticastGroupServiceUpdateParamsWithContext creates a new MulticastGroupServiceUpdateParams object +// with the ability to set a context for a request. +func NewMulticastGroupServiceUpdateParamsWithContext(ctx context.Context) *MulticastGroupServiceUpdateParams { + return &MulticastGroupServiceUpdateParams{ + Context: ctx, + } +} + +// NewMulticastGroupServiceUpdateParamsWithHTTPClient creates a new MulticastGroupServiceUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewMulticastGroupServiceUpdateParamsWithHTTPClient(client *http.Client) *MulticastGroupServiceUpdateParams { + return &MulticastGroupServiceUpdateParams{ + HTTPClient: client, + } +} + +/* +MulticastGroupServiceUpdateParams contains all the parameters to send to the API endpoint + + for the multicast group service update operation. + + Typically these are written to a http.Request. +*/ +type MulticastGroupServiceUpdateParams struct { + + // Body. + Body MulticastGroupServiceUpdateBody + + /* MulticastGroupID. + + ID (UUID). + This will be generated automatically on create. + */ + MulticastGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the multicast group service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceUpdateParams) WithDefaults() *MulticastGroupServiceUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the multicast group service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MulticastGroupServiceUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the multicast group service update params +func (o *MulticastGroupServiceUpdateParams) WithTimeout(timeout time.Duration) *MulticastGroupServiceUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the multicast group service update params +func (o *MulticastGroupServiceUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the multicast group service update params +func (o *MulticastGroupServiceUpdateParams) WithContext(ctx context.Context) *MulticastGroupServiceUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the multicast group service update params +func (o *MulticastGroupServiceUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the multicast group service update params +func (o *MulticastGroupServiceUpdateParams) WithHTTPClient(client *http.Client) *MulticastGroupServiceUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the multicast group service update params +func (o *MulticastGroupServiceUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the multicast group service update params +func (o *MulticastGroupServiceUpdateParams) WithBody(body MulticastGroupServiceUpdateBody) *MulticastGroupServiceUpdateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the multicast group service update params +func (o *MulticastGroupServiceUpdateParams) SetBody(body MulticastGroupServiceUpdateBody) { + o.Body = body +} + +// WithMulticastGroupID adds the multicastGroupID to the multicast group service update params +func (o *MulticastGroupServiceUpdateParams) WithMulticastGroupID(multicastGroupID string) *MulticastGroupServiceUpdateParams { + o.SetMulticastGroupID(multicastGroupID) + return o +} + +// SetMulticastGroupID adds the multicastGroupId to the multicast group service update params +func (o *MulticastGroupServiceUpdateParams) SetMulticastGroupID(multicastGroupID string) { + o.MulticastGroupID = multicastGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *MulticastGroupServiceUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param multicastGroup.id + if err := r.SetPathParam("multicastGroup.id", o.MulticastGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_update_responses.go b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_update_responses.go new file mode 100644 index 0000000..643eb0d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/multicast_group_service/multicast_group_service_update_responses.go @@ -0,0 +1,517 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package multicast_group_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// MulticastGroupServiceUpdateReader is a Reader for the MulticastGroupServiceUpdate structure. +type MulticastGroupServiceUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MulticastGroupServiceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMulticastGroupServiceUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewMulticastGroupServiceUpdateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewMulticastGroupServiceUpdateOK creates a MulticastGroupServiceUpdateOK with default headers values +func NewMulticastGroupServiceUpdateOK() *MulticastGroupServiceUpdateOK { + return &MulticastGroupServiceUpdateOK{} +} + +/* +MulticastGroupServiceUpdateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type MulticastGroupServiceUpdateOK struct { + Payload interface{} +} + +// IsSuccess returns true when this multicast group service update o k response has a 2xx status code +func (o *MulticastGroupServiceUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this multicast group service update o k response has a 3xx status code +func (o *MulticastGroupServiceUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this multicast group service update o k response has a 4xx status code +func (o *MulticastGroupServiceUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this multicast group service update o k response has a 5xx status code +func (o *MulticastGroupServiceUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this multicast group service update o k response a status code equal to that given +func (o *MulticastGroupServiceUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the multicast group service update o k response +func (o *MulticastGroupServiceUpdateOK) Code() int { + return 200 +} + +func (o *MulticastGroupServiceUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/multicast-groups/{multicastGroup.id}][%d] multicastGroupServiceUpdateOK %s", 200, payload) +} + +func (o *MulticastGroupServiceUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/multicast-groups/{multicastGroup.id}][%d] multicastGroupServiceUpdateOK %s", 200, payload) +} + +func (o *MulticastGroupServiceUpdateOK) GetPayload() interface{} { + return o.Payload +} + +func (o *MulticastGroupServiceUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMulticastGroupServiceUpdateDefault creates a MulticastGroupServiceUpdateDefault with default headers values +func NewMulticastGroupServiceUpdateDefault(code int) *MulticastGroupServiceUpdateDefault { + return &MulticastGroupServiceUpdateDefault{ + _statusCode: code, + } +} + +/* +MulticastGroupServiceUpdateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type MulticastGroupServiceUpdateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this multicast group service update default response has a 2xx status code +func (o *MulticastGroupServiceUpdateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this multicast group service update default response has a 3xx status code +func (o *MulticastGroupServiceUpdateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this multicast group service update default response has a 4xx status code +func (o *MulticastGroupServiceUpdateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this multicast group service update default response has a 5xx status code +func (o *MulticastGroupServiceUpdateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this multicast group service update default response a status code equal to that given +func (o *MulticastGroupServiceUpdateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the multicast group service update default response +func (o *MulticastGroupServiceUpdateDefault) Code() int { + return o._statusCode +} + +func (o *MulticastGroupServiceUpdateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/multicast-groups/{multicastGroup.id}][%d] MulticastGroupService_Update default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceUpdateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/multicast-groups/{multicastGroup.id}][%d] MulticastGroupService_Update default %s", o._statusCode, payload) +} + +func (o *MulticastGroupServiceUpdateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *MulticastGroupServiceUpdateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +MulticastGroupServiceUpdateBody multicast group service update body +swagger:model MulticastGroupServiceUpdateBody +*/ +type MulticastGroupServiceUpdateBody struct { + + // multicast group + MulticastGroup *MulticastGroupServiceUpdateParamsBodyMulticastGroup `json:"multicastGroup,omitempty"` +} + +// Validate validates this multicast group service update body +func (o *MulticastGroupServiceUpdateBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateMulticastGroup(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *MulticastGroupServiceUpdateBody) validateMulticastGroup(formats strfmt.Registry) error { + if swag.IsZero(o.MulticastGroup) { // not required + return nil + } + + if o.MulticastGroup != nil { + if err := o.MulticastGroup.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "multicastGroup") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "multicastGroup") + } + return err + } + } + + return nil +} + +// ContextValidate validate this multicast group service update body based on the context it is used +func (o *MulticastGroupServiceUpdateBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateMulticastGroup(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *MulticastGroupServiceUpdateBody) contextValidateMulticastGroup(ctx context.Context, formats strfmt.Registry) error { + + if o.MulticastGroup != nil { + + if swag.IsZero(o.MulticastGroup) { // not required + return nil + } + + if err := o.MulticastGroup.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "multicastGroup") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "multicastGroup") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *MulticastGroupServiceUpdateBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *MulticastGroupServiceUpdateBody) UnmarshalBinary(b []byte) error { + var res MulticastGroupServiceUpdateBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +MulticastGroupServiceUpdateParamsBodyMulticastGroup Multicast group object to update. +swagger:model MulticastGroupServiceUpdateParamsBodyMulticastGroup +*/ +type MulticastGroupServiceUpdateParamsBodyMulticastGroup struct { + + // Application ID. + // After creation, this can not be updated. + ApplicationID string `json:"applicationId,omitempty"` + + // Class-B ping-slot periodicity (only for Class-B). + // Valid options are: 0 - 7. + // + // Number of ping-slots per beacon-period: + // pingNb = 2^(7-periodicity) + // + // Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec + // Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec + ClassBPingSlotPeriodicity int64 `json:"classBPingSlotPeriodicity,omitempty"` + + // Scheduling type (only for Class-C). + ClassCSchedulingType *models.APIMulticastGroupSchedulingType `json:"classCSchedulingType,omitempty"` + + // Data-rate. + Dr int64 `json:"dr,omitempty"` + + // Frame-counter. + FCnt int64 `json:"fCnt,omitempty"` + + // Frequency (Hz). + Frequency int64 `json:"frequency,omitempty"` + + // Multicast group type. + GroupType *models.APIMulticastGroupType `json:"groupType,omitempty"` + + // Multicast address (HEX encoded DevAddr). + McAddr string `json:"mcAddr,omitempty"` + + // Multicast application session key (HEX encoded AES128 key). + McAppSKey string `json:"mcAppSKey,omitempty"` + + // Multicast network session key (HEX encoded AES128 key). + McNwkSKey string `json:"mcNwkSKey,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Region. + Region *models.CommonRegion `json:"region,omitempty"` +} + +// Validate validates this multicast group service update params body multicast group +func (o *MulticastGroupServiceUpdateParamsBodyMulticastGroup) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateClassCSchedulingType(formats); err != nil { + res = append(res, err) + } + + if err := o.validateGroupType(formats); err != nil { + res = append(res, err) + } + + if err := o.validateRegion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *MulticastGroupServiceUpdateParamsBodyMulticastGroup) validateClassCSchedulingType(formats strfmt.Registry) error { + if swag.IsZero(o.ClassCSchedulingType) { // not required + return nil + } + + if o.ClassCSchedulingType != nil { + if err := o.ClassCSchedulingType.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "multicastGroup" + "." + "classCSchedulingType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "multicastGroup" + "." + "classCSchedulingType") + } + return err + } + } + + return nil +} + +func (o *MulticastGroupServiceUpdateParamsBodyMulticastGroup) validateGroupType(formats strfmt.Registry) error { + if swag.IsZero(o.GroupType) { // not required + return nil + } + + if o.GroupType != nil { + if err := o.GroupType.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "multicastGroup" + "." + "groupType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "multicastGroup" + "." + "groupType") + } + return err + } + } + + return nil +} + +func (o *MulticastGroupServiceUpdateParamsBodyMulticastGroup) validateRegion(formats strfmt.Registry) error { + if swag.IsZero(o.Region) { // not required + return nil + } + + if o.Region != nil { + if err := o.Region.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "multicastGroup" + "." + "region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "multicastGroup" + "." + "region") + } + return err + } + } + + return nil +} + +// ContextValidate validate this multicast group service update params body multicast group based on the context it is used +func (o *MulticastGroupServiceUpdateParamsBodyMulticastGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateClassCSchedulingType(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateGroupType(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateRegion(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *MulticastGroupServiceUpdateParamsBodyMulticastGroup) contextValidateClassCSchedulingType(ctx context.Context, formats strfmt.Registry) error { + + if o.ClassCSchedulingType != nil { + + if swag.IsZero(o.ClassCSchedulingType) { // not required + return nil + } + + if err := o.ClassCSchedulingType.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "multicastGroup" + "." + "classCSchedulingType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "multicastGroup" + "." + "classCSchedulingType") + } + return err + } + } + + return nil +} + +func (o *MulticastGroupServiceUpdateParamsBodyMulticastGroup) contextValidateGroupType(ctx context.Context, formats strfmt.Registry) error { + + if o.GroupType != nil { + + if swag.IsZero(o.GroupType) { // not required + return nil + } + + if err := o.GroupType.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "multicastGroup" + "." + "groupType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "multicastGroup" + "." + "groupType") + } + return err + } + } + + return nil +} + +func (o *MulticastGroupServiceUpdateParamsBodyMulticastGroup) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error { + + if o.Region != nil { + + if swag.IsZero(o.Region) { // not required + return nil + } + + if err := o.Region.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "multicastGroup" + "." + "region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "multicastGroup" + "." + "region") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *MulticastGroupServiceUpdateParamsBodyMulticastGroup) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *MulticastGroupServiceUpdateParamsBodyMulticastGroup) UnmarshalBinary(b []byte) error { + var res MulticastGroupServiceUpdateParamsBodyMulticastGroup + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_add_user_parameters.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_add_user_parameters.go new file mode 100644 index 0000000..421801b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_add_user_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewTenantServiceAddUserParams creates a new TenantServiceAddUserParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewTenantServiceAddUserParams() *TenantServiceAddUserParams { + return &TenantServiceAddUserParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTenantServiceAddUserParamsWithTimeout creates a new TenantServiceAddUserParams object +// with the ability to set a timeout on a request. +func NewTenantServiceAddUserParamsWithTimeout(timeout time.Duration) *TenantServiceAddUserParams { + return &TenantServiceAddUserParams{ + timeout: timeout, + } +} + +// NewTenantServiceAddUserParamsWithContext creates a new TenantServiceAddUserParams object +// with the ability to set a context for a request. +func NewTenantServiceAddUserParamsWithContext(ctx context.Context) *TenantServiceAddUserParams { + return &TenantServiceAddUserParams{ + Context: ctx, + } +} + +// NewTenantServiceAddUserParamsWithHTTPClient creates a new TenantServiceAddUserParams object +// with the ability to set a custom HTTPClient for a request. +func NewTenantServiceAddUserParamsWithHTTPClient(client *http.Client) *TenantServiceAddUserParams { + return &TenantServiceAddUserParams{ + HTTPClient: client, + } +} + +/* +TenantServiceAddUserParams contains all the parameters to send to the API endpoint + + for the tenant service add user operation. + + Typically these are written to a http.Request. +*/ +type TenantServiceAddUserParams struct { + + // Body. + Body TenantServiceAddUserBody + + /* TenantUserTenantID. + + Tenant ID (UUID). + */ + TenantUserTenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the tenant service add user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceAddUserParams) WithDefaults() *TenantServiceAddUserParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tenant service add user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceAddUserParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the tenant service add user params +func (o *TenantServiceAddUserParams) WithTimeout(timeout time.Duration) *TenantServiceAddUserParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the tenant service add user params +func (o *TenantServiceAddUserParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the tenant service add user params +func (o *TenantServiceAddUserParams) WithContext(ctx context.Context) *TenantServiceAddUserParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the tenant service add user params +func (o *TenantServiceAddUserParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the tenant service add user params +func (o *TenantServiceAddUserParams) WithHTTPClient(client *http.Client) *TenantServiceAddUserParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the tenant service add user params +func (o *TenantServiceAddUserParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the tenant service add user params +func (o *TenantServiceAddUserParams) WithBody(body TenantServiceAddUserBody) *TenantServiceAddUserParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the tenant service add user params +func (o *TenantServiceAddUserParams) SetBody(body TenantServiceAddUserBody) { + o.Body = body +} + +// WithTenantUserTenantID adds the tenantUserTenantID to the tenant service add user params +func (o *TenantServiceAddUserParams) WithTenantUserTenantID(tenantUserTenantID string) *TenantServiceAddUserParams { + o.SetTenantUserTenantID(tenantUserTenantID) + return o +} + +// SetTenantUserTenantID adds the tenantUserTenantId to the tenant service add user params +func (o *TenantServiceAddUserParams) SetTenantUserTenantID(tenantUserTenantID string) { + o.TenantUserTenantID = tenantUserTenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *TenantServiceAddUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param tenantUser.tenantId + if err := r.SetPathParam("tenantUser.tenantId", o.TenantUserTenantID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_add_user_responses.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_add_user_responses.go new file mode 100644 index 0000000..3fc2d58 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_add_user_responses.go @@ -0,0 +1,336 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// TenantServiceAddUserReader is a Reader for the TenantServiceAddUser structure. +type TenantServiceAddUserReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TenantServiceAddUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTenantServiceAddUserOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewTenantServiceAddUserDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewTenantServiceAddUserOK creates a TenantServiceAddUserOK with default headers values +func NewTenantServiceAddUserOK() *TenantServiceAddUserOK { + return &TenantServiceAddUserOK{} +} + +/* +TenantServiceAddUserOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type TenantServiceAddUserOK struct { + Payload interface{} +} + +// IsSuccess returns true when this tenant service add user o k response has a 2xx status code +func (o *TenantServiceAddUserOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this tenant service add user o k response has a 3xx status code +func (o *TenantServiceAddUserOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tenant service add user o k response has a 4xx status code +func (o *TenantServiceAddUserOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this tenant service add user o k response has a 5xx status code +func (o *TenantServiceAddUserOK) IsServerError() bool { + return false +} + +// IsCode returns true when this tenant service add user o k response a status code equal to that given +func (o *TenantServiceAddUserOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the tenant service add user o k response +func (o *TenantServiceAddUserOK) Code() int { + return 200 +} + +func (o *TenantServiceAddUserOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/tenants/{tenantUser.tenantId}/users][%d] tenantServiceAddUserOK %s", 200, payload) +} + +func (o *TenantServiceAddUserOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/tenants/{tenantUser.tenantId}/users][%d] tenantServiceAddUserOK %s", 200, payload) +} + +func (o *TenantServiceAddUserOK) GetPayload() interface{} { + return o.Payload +} + +func (o *TenantServiceAddUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTenantServiceAddUserDefault creates a TenantServiceAddUserDefault with default headers values +func NewTenantServiceAddUserDefault(code int) *TenantServiceAddUserDefault { + return &TenantServiceAddUserDefault{ + _statusCode: code, + } +} + +/* +TenantServiceAddUserDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type TenantServiceAddUserDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this tenant service add user default response has a 2xx status code +func (o *TenantServiceAddUserDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this tenant service add user default response has a 3xx status code +func (o *TenantServiceAddUserDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this tenant service add user default response has a 4xx status code +func (o *TenantServiceAddUserDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this tenant service add user default response has a 5xx status code +func (o *TenantServiceAddUserDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this tenant service add user default response a status code equal to that given +func (o *TenantServiceAddUserDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the tenant service add user default response +func (o *TenantServiceAddUserDefault) Code() int { + return o._statusCode +} + +func (o *TenantServiceAddUserDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/tenants/{tenantUser.tenantId}/users][%d] TenantService_AddUser default %s", o._statusCode, payload) +} + +func (o *TenantServiceAddUserDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/tenants/{tenantUser.tenantId}/users][%d] TenantService_AddUser default %s", o._statusCode, payload) +} + +func (o *TenantServiceAddUserDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *TenantServiceAddUserDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +TenantServiceAddUserBody tenant service add user body +swagger:model TenantServiceAddUserBody +*/ +type TenantServiceAddUserBody struct { + + // tenant user + TenantUser *TenantServiceAddUserParamsBodyTenantUser `json:"tenantUser,omitempty"` +} + +// Validate validates this tenant service add user body +func (o *TenantServiceAddUserBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateTenantUser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *TenantServiceAddUserBody) validateTenantUser(formats strfmt.Registry) error { + if swag.IsZero(o.TenantUser) { // not required + return nil + } + + if o.TenantUser != nil { + if err := o.TenantUser.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "tenantUser") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "tenantUser") + } + return err + } + } + + return nil +} + +// ContextValidate validate this tenant service add user body based on the context it is used +func (o *TenantServiceAddUserBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateTenantUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *TenantServiceAddUserBody) contextValidateTenantUser(ctx context.Context, formats strfmt.Registry) error { + + if o.TenantUser != nil { + + if swag.IsZero(o.TenantUser) { // not required + return nil + } + + if err := o.TenantUser.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "tenantUser") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "tenantUser") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *TenantServiceAddUserBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *TenantServiceAddUserBody) UnmarshalBinary(b []byte) error { + var res TenantServiceAddUserBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +TenantServiceAddUserParamsBodyTenantUser Tenant user object. +swagger:model TenantServiceAddUserParamsBodyTenantUser +*/ +type TenantServiceAddUserParamsBodyTenantUser struct { + + // Email (only used on get and when adding a user to a tenant). + Email string `json:"email,omitempty"` + + // User is admin within the context of the tenant. + // There is no need to set the is_device_admin and is_gateway_admin flags. + IsAdmin bool `json:"isAdmin,omitempty"` + + // User is able to modify device related resources (applications, + // device-profiles, devices, multicast-groups). + IsDeviceAdmin bool `json:"isDeviceAdmin,omitempty"` + + // User is able to modify gateways. + IsGatewayAdmin bool `json:"isGatewayAdmin,omitempty"` + + // User ID (UUID). + UserID string `json:"userId,omitempty"` +} + +// Validate validates this tenant service add user params body tenant user +func (o *TenantServiceAddUserParamsBodyTenantUser) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this tenant service add user params body tenant user based on context it is used +func (o *TenantServiceAddUserParamsBodyTenantUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *TenantServiceAddUserParamsBodyTenantUser) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *TenantServiceAddUserParamsBodyTenantUser) UnmarshalBinary(b []byte) error { + var res TenantServiceAddUserParamsBodyTenantUser + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_client.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_client.go new file mode 100644 index 0000000..5dd73b6 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_client.go @@ -0,0 +1,463 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new tenant service API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new tenant service API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new tenant service API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for tenant service API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + TenantServiceAddUser(params *TenantServiceAddUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceAddUserOK, error) + + TenantServiceCreate(params *TenantServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceCreateOK, error) + + TenantServiceDelete(params *TenantServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceDeleteOK, error) + + TenantServiceDeleteUser(params *TenantServiceDeleteUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceDeleteUserOK, error) + + TenantServiceGet(params *TenantServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceGetOK, error) + + TenantServiceGetUser(params *TenantServiceGetUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceGetUserOK, error) + + TenantServiceList(params *TenantServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceListOK, error) + + TenantServiceListUsers(params *TenantServiceListUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceListUsersOK, error) + + TenantServiceUpdate(params *TenantServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceUpdateOK, error) + + TenantServiceUpdateUser(params *TenantServiceUpdateUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceUpdateUserOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +TenantServiceAddUser adds an user to the tenant note the user must already exist +*/ +func (a *Client) TenantServiceAddUser(params *TenantServiceAddUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceAddUserOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTenantServiceAddUserParams() + } + op := &runtime.ClientOperation{ + ID: "TenantService_AddUser", + Method: "POST", + PathPattern: "/api/tenants/{tenantUser.tenantId}/users", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TenantServiceAddUserReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TenantServiceAddUserOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*TenantServiceAddUserDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +TenantServiceCreate creates a new tenant +*/ +func (a *Client) TenantServiceCreate(params *TenantServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTenantServiceCreateParams() + } + op := &runtime.ClientOperation{ + ID: "TenantService_Create", + Method: "POST", + PathPattern: "/api/tenants", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TenantServiceCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TenantServiceCreateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*TenantServiceCreateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +TenantServiceDelete deletes the tenant with the given ID +*/ +func (a *Client) TenantServiceDelete(params *TenantServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTenantServiceDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "TenantService_Delete", + Method: "DELETE", + PathPattern: "/api/tenants/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TenantServiceDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TenantServiceDeleteOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*TenantServiceDeleteDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +TenantServiceDeleteUser deletes the given tenant user +*/ +func (a *Client) TenantServiceDeleteUser(params *TenantServiceDeleteUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceDeleteUserOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTenantServiceDeleteUserParams() + } + op := &runtime.ClientOperation{ + ID: "TenantService_DeleteUser", + Method: "DELETE", + PathPattern: "/api/tenants/{tenantId}/users/{userId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TenantServiceDeleteUserReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TenantServiceDeleteUserOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*TenantServiceDeleteUserDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +TenantServiceGet gets the tenant for the given ID +*/ +func (a *Client) TenantServiceGet(params *TenantServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTenantServiceGetParams() + } + op := &runtime.ClientOperation{ + ID: "TenantService_Get", + Method: "GET", + PathPattern: "/api/tenants/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TenantServiceGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TenantServiceGetOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*TenantServiceGetDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +TenantServiceGetUser gets the the tenant user for the given tenant and user i ds +*/ +func (a *Client) TenantServiceGetUser(params *TenantServiceGetUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceGetUserOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTenantServiceGetUserParams() + } + op := &runtime.ClientOperation{ + ID: "TenantService_GetUser", + Method: "GET", + PathPattern: "/api/tenants/{tenantId}/users/{userId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TenantServiceGetUserReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TenantServiceGetUserOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*TenantServiceGetUserDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +TenantServiceList gets the list of tenants +*/ +func (a *Client) TenantServiceList(params *TenantServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTenantServiceListParams() + } + op := &runtime.ClientOperation{ + ID: "TenantService_List", + Method: "GET", + PathPattern: "/api/tenants", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TenantServiceListReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TenantServiceListOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*TenantServiceListDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +TenantServiceListUsers gets the list of tenant users +*/ +func (a *Client) TenantServiceListUsers(params *TenantServiceListUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceListUsersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTenantServiceListUsersParams() + } + op := &runtime.ClientOperation{ + ID: "TenantService_ListUsers", + Method: "GET", + PathPattern: "/api/tenants/{tenantId}/users", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TenantServiceListUsersReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TenantServiceListUsersOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*TenantServiceListUsersDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +TenantServiceUpdate updates the given tenant +*/ +func (a *Client) TenantServiceUpdate(params *TenantServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTenantServiceUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "TenantService_Update", + Method: "PUT", + PathPattern: "/api/tenants/{tenant.id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TenantServiceUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TenantServiceUpdateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*TenantServiceUpdateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +TenantServiceUpdateUser updates the given tenant user +*/ +func (a *Client) TenantServiceUpdateUser(params *TenantServiceUpdateUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TenantServiceUpdateUserOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTenantServiceUpdateUserParams() + } + op := &runtime.ClientOperation{ + ID: "TenantService_UpdateUser", + Method: "PUT", + PathPattern: "/api/tenants/{tenantUser.tenantId}/users/{tenantUser.userId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TenantServiceUpdateUserReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TenantServiceUpdateUserOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*TenantServiceUpdateUserDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_create_parameters.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_create_parameters.go new file mode 100644 index 0000000..981ec0c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_create_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// NewTenantServiceCreateParams creates a new TenantServiceCreateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewTenantServiceCreateParams() *TenantServiceCreateParams { + return &TenantServiceCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTenantServiceCreateParamsWithTimeout creates a new TenantServiceCreateParams object +// with the ability to set a timeout on a request. +func NewTenantServiceCreateParamsWithTimeout(timeout time.Duration) *TenantServiceCreateParams { + return &TenantServiceCreateParams{ + timeout: timeout, + } +} + +// NewTenantServiceCreateParamsWithContext creates a new TenantServiceCreateParams object +// with the ability to set a context for a request. +func NewTenantServiceCreateParamsWithContext(ctx context.Context) *TenantServiceCreateParams { + return &TenantServiceCreateParams{ + Context: ctx, + } +} + +// NewTenantServiceCreateParamsWithHTTPClient creates a new TenantServiceCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewTenantServiceCreateParamsWithHTTPClient(client *http.Client) *TenantServiceCreateParams { + return &TenantServiceCreateParams{ + HTTPClient: client, + } +} + +/* +TenantServiceCreateParams contains all the parameters to send to the API endpoint + + for the tenant service create operation. + + Typically these are written to a http.Request. +*/ +type TenantServiceCreateParams struct { + + // Body. + Body *models.APICreateTenantRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the tenant service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceCreateParams) WithDefaults() *TenantServiceCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tenant service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the tenant service create params +func (o *TenantServiceCreateParams) WithTimeout(timeout time.Duration) *TenantServiceCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the tenant service create params +func (o *TenantServiceCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the tenant service create params +func (o *TenantServiceCreateParams) WithContext(ctx context.Context) *TenantServiceCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the tenant service create params +func (o *TenantServiceCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the tenant service create params +func (o *TenantServiceCreateParams) WithHTTPClient(client *http.Client) *TenantServiceCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the tenant service create params +func (o *TenantServiceCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the tenant service create params +func (o *TenantServiceCreateParams) WithBody(body *models.APICreateTenantRequest) *TenantServiceCreateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the tenant service create params +func (o *TenantServiceCreateParams) SetBody(body *models.APICreateTenantRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *TenantServiceCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_create_responses.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_create_responses.go new file mode 100644 index 0000000..4920a4a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_create_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// TenantServiceCreateReader is a Reader for the TenantServiceCreate structure. +type TenantServiceCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TenantServiceCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTenantServiceCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewTenantServiceCreateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewTenantServiceCreateOK creates a TenantServiceCreateOK with default headers values +func NewTenantServiceCreateOK() *TenantServiceCreateOK { + return &TenantServiceCreateOK{} +} + +/* +TenantServiceCreateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type TenantServiceCreateOK struct { + Payload *models.APICreateTenantResponse +} + +// IsSuccess returns true when this tenant service create o k response has a 2xx status code +func (o *TenantServiceCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this tenant service create o k response has a 3xx status code +func (o *TenantServiceCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tenant service create o k response has a 4xx status code +func (o *TenantServiceCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this tenant service create o k response has a 5xx status code +func (o *TenantServiceCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this tenant service create o k response a status code equal to that given +func (o *TenantServiceCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the tenant service create o k response +func (o *TenantServiceCreateOK) Code() int { + return 200 +} + +func (o *TenantServiceCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/tenants][%d] tenantServiceCreateOK %s", 200, payload) +} + +func (o *TenantServiceCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/tenants][%d] tenantServiceCreateOK %s", 200, payload) +} + +func (o *TenantServiceCreateOK) GetPayload() *models.APICreateTenantResponse { + return o.Payload +} + +func (o *TenantServiceCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APICreateTenantResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTenantServiceCreateDefault creates a TenantServiceCreateDefault with default headers values +func NewTenantServiceCreateDefault(code int) *TenantServiceCreateDefault { + return &TenantServiceCreateDefault{ + _statusCode: code, + } +} + +/* +TenantServiceCreateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type TenantServiceCreateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this tenant service create default response has a 2xx status code +func (o *TenantServiceCreateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this tenant service create default response has a 3xx status code +func (o *TenantServiceCreateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this tenant service create default response has a 4xx status code +func (o *TenantServiceCreateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this tenant service create default response has a 5xx status code +func (o *TenantServiceCreateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this tenant service create default response a status code equal to that given +func (o *TenantServiceCreateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the tenant service create default response +func (o *TenantServiceCreateDefault) Code() int { + return o._statusCode +} + +func (o *TenantServiceCreateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/tenants][%d] TenantService_Create default %s", o._statusCode, payload) +} + +func (o *TenantServiceCreateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/tenants][%d] TenantService_Create default %s", o._statusCode, payload) +} + +func (o *TenantServiceCreateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *TenantServiceCreateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_delete_parameters.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_delete_parameters.go new file mode 100644 index 0000000..faac3aa --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewTenantServiceDeleteParams creates a new TenantServiceDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewTenantServiceDeleteParams() *TenantServiceDeleteParams { + return &TenantServiceDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTenantServiceDeleteParamsWithTimeout creates a new TenantServiceDeleteParams object +// with the ability to set a timeout on a request. +func NewTenantServiceDeleteParamsWithTimeout(timeout time.Duration) *TenantServiceDeleteParams { + return &TenantServiceDeleteParams{ + timeout: timeout, + } +} + +// NewTenantServiceDeleteParamsWithContext creates a new TenantServiceDeleteParams object +// with the ability to set a context for a request. +func NewTenantServiceDeleteParamsWithContext(ctx context.Context) *TenantServiceDeleteParams { + return &TenantServiceDeleteParams{ + Context: ctx, + } +} + +// NewTenantServiceDeleteParamsWithHTTPClient creates a new TenantServiceDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewTenantServiceDeleteParamsWithHTTPClient(client *http.Client) *TenantServiceDeleteParams { + return &TenantServiceDeleteParams{ + HTTPClient: client, + } +} + +/* +TenantServiceDeleteParams contains all the parameters to send to the API endpoint + + for the tenant service delete operation. + + Typically these are written to a http.Request. +*/ +type TenantServiceDeleteParams struct { + + /* ID. + + Tenant ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the tenant service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceDeleteParams) WithDefaults() *TenantServiceDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tenant service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the tenant service delete params +func (o *TenantServiceDeleteParams) WithTimeout(timeout time.Duration) *TenantServiceDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the tenant service delete params +func (o *TenantServiceDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the tenant service delete params +func (o *TenantServiceDeleteParams) WithContext(ctx context.Context) *TenantServiceDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the tenant service delete params +func (o *TenantServiceDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the tenant service delete params +func (o *TenantServiceDeleteParams) WithHTTPClient(client *http.Client) *TenantServiceDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the tenant service delete params +func (o *TenantServiceDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the tenant service delete params +func (o *TenantServiceDeleteParams) WithID(id string) *TenantServiceDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the tenant service delete params +func (o *TenantServiceDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *TenantServiceDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_delete_responses.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_delete_responses.go new file mode 100644 index 0000000..68b8412 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_delete_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// TenantServiceDeleteReader is a Reader for the TenantServiceDelete structure. +type TenantServiceDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TenantServiceDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTenantServiceDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewTenantServiceDeleteDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewTenantServiceDeleteOK creates a TenantServiceDeleteOK with default headers values +func NewTenantServiceDeleteOK() *TenantServiceDeleteOK { + return &TenantServiceDeleteOK{} +} + +/* +TenantServiceDeleteOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type TenantServiceDeleteOK struct { + Payload interface{} +} + +// IsSuccess returns true when this tenant service delete o k response has a 2xx status code +func (o *TenantServiceDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this tenant service delete o k response has a 3xx status code +func (o *TenantServiceDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tenant service delete o k response has a 4xx status code +func (o *TenantServiceDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this tenant service delete o k response has a 5xx status code +func (o *TenantServiceDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this tenant service delete o k response a status code equal to that given +func (o *TenantServiceDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the tenant service delete o k response +func (o *TenantServiceDeleteOK) Code() int { + return 200 +} + +func (o *TenantServiceDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/tenants/{id}][%d] tenantServiceDeleteOK %s", 200, payload) +} + +func (o *TenantServiceDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/tenants/{id}][%d] tenantServiceDeleteOK %s", 200, payload) +} + +func (o *TenantServiceDeleteOK) GetPayload() interface{} { + return o.Payload +} + +func (o *TenantServiceDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTenantServiceDeleteDefault creates a TenantServiceDeleteDefault with default headers values +func NewTenantServiceDeleteDefault(code int) *TenantServiceDeleteDefault { + return &TenantServiceDeleteDefault{ + _statusCode: code, + } +} + +/* +TenantServiceDeleteDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type TenantServiceDeleteDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this tenant service delete default response has a 2xx status code +func (o *TenantServiceDeleteDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this tenant service delete default response has a 3xx status code +func (o *TenantServiceDeleteDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this tenant service delete default response has a 4xx status code +func (o *TenantServiceDeleteDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this tenant service delete default response has a 5xx status code +func (o *TenantServiceDeleteDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this tenant service delete default response a status code equal to that given +func (o *TenantServiceDeleteDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the tenant service delete default response +func (o *TenantServiceDeleteDefault) Code() int { + return o._statusCode +} + +func (o *TenantServiceDeleteDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/tenants/{id}][%d] TenantService_Delete default %s", o._statusCode, payload) +} + +func (o *TenantServiceDeleteDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/tenants/{id}][%d] TenantService_Delete default %s", o._statusCode, payload) +} + +func (o *TenantServiceDeleteDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *TenantServiceDeleteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_delete_user_parameters.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_delete_user_parameters.go new file mode 100644 index 0000000..1f017f5 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_delete_user_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewTenantServiceDeleteUserParams creates a new TenantServiceDeleteUserParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewTenantServiceDeleteUserParams() *TenantServiceDeleteUserParams { + return &TenantServiceDeleteUserParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTenantServiceDeleteUserParamsWithTimeout creates a new TenantServiceDeleteUserParams object +// with the ability to set a timeout on a request. +func NewTenantServiceDeleteUserParamsWithTimeout(timeout time.Duration) *TenantServiceDeleteUserParams { + return &TenantServiceDeleteUserParams{ + timeout: timeout, + } +} + +// NewTenantServiceDeleteUserParamsWithContext creates a new TenantServiceDeleteUserParams object +// with the ability to set a context for a request. +func NewTenantServiceDeleteUserParamsWithContext(ctx context.Context) *TenantServiceDeleteUserParams { + return &TenantServiceDeleteUserParams{ + Context: ctx, + } +} + +// NewTenantServiceDeleteUserParamsWithHTTPClient creates a new TenantServiceDeleteUserParams object +// with the ability to set a custom HTTPClient for a request. +func NewTenantServiceDeleteUserParamsWithHTTPClient(client *http.Client) *TenantServiceDeleteUserParams { + return &TenantServiceDeleteUserParams{ + HTTPClient: client, + } +} + +/* +TenantServiceDeleteUserParams contains all the parameters to send to the API endpoint + + for the tenant service delete user operation. + + Typically these are written to a http.Request. +*/ +type TenantServiceDeleteUserParams struct { + + /* TenantID. + + Tenant ID (UUID). + */ + TenantID string + + /* UserID. + + User ID (UUID). + */ + UserID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the tenant service delete user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceDeleteUserParams) WithDefaults() *TenantServiceDeleteUserParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tenant service delete user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceDeleteUserParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the tenant service delete user params +func (o *TenantServiceDeleteUserParams) WithTimeout(timeout time.Duration) *TenantServiceDeleteUserParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the tenant service delete user params +func (o *TenantServiceDeleteUserParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the tenant service delete user params +func (o *TenantServiceDeleteUserParams) WithContext(ctx context.Context) *TenantServiceDeleteUserParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the tenant service delete user params +func (o *TenantServiceDeleteUserParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the tenant service delete user params +func (o *TenantServiceDeleteUserParams) WithHTTPClient(client *http.Client) *TenantServiceDeleteUserParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the tenant service delete user params +func (o *TenantServiceDeleteUserParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithTenantID adds the tenantID to the tenant service delete user params +func (o *TenantServiceDeleteUserParams) WithTenantID(tenantID string) *TenantServiceDeleteUserParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the tenant service delete user params +func (o *TenantServiceDeleteUserParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WithUserID adds the userID to the tenant service delete user params +func (o *TenantServiceDeleteUserParams) WithUserID(userID string) *TenantServiceDeleteUserParams { + o.SetUserID(userID) + return o +} + +// SetUserID adds the userId to the tenant service delete user params +func (o *TenantServiceDeleteUserParams) SetUserID(userID string) { + o.UserID = userID +} + +// WriteToRequest writes these params to a swagger request +func (o *TenantServiceDeleteUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param tenantId + if err := r.SetPathParam("tenantId", o.TenantID); err != nil { + return err + } + + // path param userId + if err := r.SetPathParam("userId", o.UserID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_delete_user_responses.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_delete_user_responses.go new file mode 100644 index 0000000..a5ff3ba --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_delete_user_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// TenantServiceDeleteUserReader is a Reader for the TenantServiceDeleteUser structure. +type TenantServiceDeleteUserReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TenantServiceDeleteUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTenantServiceDeleteUserOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewTenantServiceDeleteUserDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewTenantServiceDeleteUserOK creates a TenantServiceDeleteUserOK with default headers values +func NewTenantServiceDeleteUserOK() *TenantServiceDeleteUserOK { + return &TenantServiceDeleteUserOK{} +} + +/* +TenantServiceDeleteUserOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type TenantServiceDeleteUserOK struct { + Payload interface{} +} + +// IsSuccess returns true when this tenant service delete user o k response has a 2xx status code +func (o *TenantServiceDeleteUserOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this tenant service delete user o k response has a 3xx status code +func (o *TenantServiceDeleteUserOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tenant service delete user o k response has a 4xx status code +func (o *TenantServiceDeleteUserOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this tenant service delete user o k response has a 5xx status code +func (o *TenantServiceDeleteUserOK) IsServerError() bool { + return false +} + +// IsCode returns true when this tenant service delete user o k response a status code equal to that given +func (o *TenantServiceDeleteUserOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the tenant service delete user o k response +func (o *TenantServiceDeleteUserOK) Code() int { + return 200 +} + +func (o *TenantServiceDeleteUserOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/tenants/{tenantId}/users/{userId}][%d] tenantServiceDeleteUserOK %s", 200, payload) +} + +func (o *TenantServiceDeleteUserOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/tenants/{tenantId}/users/{userId}][%d] tenantServiceDeleteUserOK %s", 200, payload) +} + +func (o *TenantServiceDeleteUserOK) GetPayload() interface{} { + return o.Payload +} + +func (o *TenantServiceDeleteUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTenantServiceDeleteUserDefault creates a TenantServiceDeleteUserDefault with default headers values +func NewTenantServiceDeleteUserDefault(code int) *TenantServiceDeleteUserDefault { + return &TenantServiceDeleteUserDefault{ + _statusCode: code, + } +} + +/* +TenantServiceDeleteUserDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type TenantServiceDeleteUserDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this tenant service delete user default response has a 2xx status code +func (o *TenantServiceDeleteUserDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this tenant service delete user default response has a 3xx status code +func (o *TenantServiceDeleteUserDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this tenant service delete user default response has a 4xx status code +func (o *TenantServiceDeleteUserDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this tenant service delete user default response has a 5xx status code +func (o *TenantServiceDeleteUserDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this tenant service delete user default response a status code equal to that given +func (o *TenantServiceDeleteUserDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the tenant service delete user default response +func (o *TenantServiceDeleteUserDefault) Code() int { + return o._statusCode +} + +func (o *TenantServiceDeleteUserDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/tenants/{tenantId}/users/{userId}][%d] TenantService_DeleteUser default %s", o._statusCode, payload) +} + +func (o *TenantServiceDeleteUserDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/tenants/{tenantId}/users/{userId}][%d] TenantService_DeleteUser default %s", o._statusCode, payload) +} + +func (o *TenantServiceDeleteUserDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *TenantServiceDeleteUserDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_get_parameters.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_get_parameters.go new file mode 100644 index 0000000..b219348 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewTenantServiceGetParams creates a new TenantServiceGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewTenantServiceGetParams() *TenantServiceGetParams { + return &TenantServiceGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTenantServiceGetParamsWithTimeout creates a new TenantServiceGetParams object +// with the ability to set a timeout on a request. +func NewTenantServiceGetParamsWithTimeout(timeout time.Duration) *TenantServiceGetParams { + return &TenantServiceGetParams{ + timeout: timeout, + } +} + +// NewTenantServiceGetParamsWithContext creates a new TenantServiceGetParams object +// with the ability to set a context for a request. +func NewTenantServiceGetParamsWithContext(ctx context.Context) *TenantServiceGetParams { + return &TenantServiceGetParams{ + Context: ctx, + } +} + +// NewTenantServiceGetParamsWithHTTPClient creates a new TenantServiceGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewTenantServiceGetParamsWithHTTPClient(client *http.Client) *TenantServiceGetParams { + return &TenantServiceGetParams{ + HTTPClient: client, + } +} + +/* +TenantServiceGetParams contains all the parameters to send to the API endpoint + + for the tenant service get operation. + + Typically these are written to a http.Request. +*/ +type TenantServiceGetParams struct { + + /* ID. + + Tenant ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the tenant service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceGetParams) WithDefaults() *TenantServiceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tenant service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the tenant service get params +func (o *TenantServiceGetParams) WithTimeout(timeout time.Duration) *TenantServiceGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the tenant service get params +func (o *TenantServiceGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the tenant service get params +func (o *TenantServiceGetParams) WithContext(ctx context.Context) *TenantServiceGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the tenant service get params +func (o *TenantServiceGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the tenant service get params +func (o *TenantServiceGetParams) WithHTTPClient(client *http.Client) *TenantServiceGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the tenant service get params +func (o *TenantServiceGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the tenant service get params +func (o *TenantServiceGetParams) WithID(id string) *TenantServiceGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the tenant service get params +func (o *TenantServiceGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *TenantServiceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_get_responses.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_get_responses.go new file mode 100644 index 0000000..c5a0082 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_get_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// TenantServiceGetReader is a Reader for the TenantServiceGet structure. +type TenantServiceGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TenantServiceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTenantServiceGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewTenantServiceGetDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewTenantServiceGetOK creates a TenantServiceGetOK with default headers values +func NewTenantServiceGetOK() *TenantServiceGetOK { + return &TenantServiceGetOK{} +} + +/* +TenantServiceGetOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type TenantServiceGetOK struct { + Payload *models.APIGetTenantResponse +} + +// IsSuccess returns true when this tenant service get o k response has a 2xx status code +func (o *TenantServiceGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this tenant service get o k response has a 3xx status code +func (o *TenantServiceGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tenant service get o k response has a 4xx status code +func (o *TenantServiceGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this tenant service get o k response has a 5xx status code +func (o *TenantServiceGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this tenant service get o k response a status code equal to that given +func (o *TenantServiceGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the tenant service get o k response +func (o *TenantServiceGetOK) Code() int { + return 200 +} + +func (o *TenantServiceGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants/{id}][%d] tenantServiceGetOK %s", 200, payload) +} + +func (o *TenantServiceGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants/{id}][%d] tenantServiceGetOK %s", 200, payload) +} + +func (o *TenantServiceGetOK) GetPayload() *models.APIGetTenantResponse { + return o.Payload +} + +func (o *TenantServiceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetTenantResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTenantServiceGetDefault creates a TenantServiceGetDefault with default headers values +func NewTenantServiceGetDefault(code int) *TenantServiceGetDefault { + return &TenantServiceGetDefault{ + _statusCode: code, + } +} + +/* +TenantServiceGetDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type TenantServiceGetDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this tenant service get default response has a 2xx status code +func (o *TenantServiceGetDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this tenant service get default response has a 3xx status code +func (o *TenantServiceGetDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this tenant service get default response has a 4xx status code +func (o *TenantServiceGetDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this tenant service get default response has a 5xx status code +func (o *TenantServiceGetDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this tenant service get default response a status code equal to that given +func (o *TenantServiceGetDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the tenant service get default response +func (o *TenantServiceGetDefault) Code() int { + return o._statusCode +} + +func (o *TenantServiceGetDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants/{id}][%d] TenantService_Get default %s", o._statusCode, payload) +} + +func (o *TenantServiceGetDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants/{id}][%d] TenantService_Get default %s", o._statusCode, payload) +} + +func (o *TenantServiceGetDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *TenantServiceGetDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_get_user_parameters.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_get_user_parameters.go new file mode 100644 index 0000000..f9e458e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_get_user_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewTenantServiceGetUserParams creates a new TenantServiceGetUserParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewTenantServiceGetUserParams() *TenantServiceGetUserParams { + return &TenantServiceGetUserParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTenantServiceGetUserParamsWithTimeout creates a new TenantServiceGetUserParams object +// with the ability to set a timeout on a request. +func NewTenantServiceGetUserParamsWithTimeout(timeout time.Duration) *TenantServiceGetUserParams { + return &TenantServiceGetUserParams{ + timeout: timeout, + } +} + +// NewTenantServiceGetUserParamsWithContext creates a new TenantServiceGetUserParams object +// with the ability to set a context for a request. +func NewTenantServiceGetUserParamsWithContext(ctx context.Context) *TenantServiceGetUserParams { + return &TenantServiceGetUserParams{ + Context: ctx, + } +} + +// NewTenantServiceGetUserParamsWithHTTPClient creates a new TenantServiceGetUserParams object +// with the ability to set a custom HTTPClient for a request. +func NewTenantServiceGetUserParamsWithHTTPClient(client *http.Client) *TenantServiceGetUserParams { + return &TenantServiceGetUserParams{ + HTTPClient: client, + } +} + +/* +TenantServiceGetUserParams contains all the parameters to send to the API endpoint + + for the tenant service get user operation. + + Typically these are written to a http.Request. +*/ +type TenantServiceGetUserParams struct { + + /* TenantID. + + Tenant ID (UUID). + */ + TenantID string + + /* UserID. + + User ID (UUID). + */ + UserID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the tenant service get user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceGetUserParams) WithDefaults() *TenantServiceGetUserParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tenant service get user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceGetUserParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the tenant service get user params +func (o *TenantServiceGetUserParams) WithTimeout(timeout time.Duration) *TenantServiceGetUserParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the tenant service get user params +func (o *TenantServiceGetUserParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the tenant service get user params +func (o *TenantServiceGetUserParams) WithContext(ctx context.Context) *TenantServiceGetUserParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the tenant service get user params +func (o *TenantServiceGetUserParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the tenant service get user params +func (o *TenantServiceGetUserParams) WithHTTPClient(client *http.Client) *TenantServiceGetUserParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the tenant service get user params +func (o *TenantServiceGetUserParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithTenantID adds the tenantID to the tenant service get user params +func (o *TenantServiceGetUserParams) WithTenantID(tenantID string) *TenantServiceGetUserParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the tenant service get user params +func (o *TenantServiceGetUserParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WithUserID adds the userID to the tenant service get user params +func (o *TenantServiceGetUserParams) WithUserID(userID string) *TenantServiceGetUserParams { + o.SetUserID(userID) + return o +} + +// SetUserID adds the userId to the tenant service get user params +func (o *TenantServiceGetUserParams) SetUserID(userID string) { + o.UserID = userID +} + +// WriteToRequest writes these params to a swagger request +func (o *TenantServiceGetUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param tenantId + if err := r.SetPathParam("tenantId", o.TenantID); err != nil { + return err + } + + // path param userId + if err := r.SetPathParam("userId", o.UserID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_get_user_responses.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_get_user_responses.go new file mode 100644 index 0000000..ef01708 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_get_user_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// TenantServiceGetUserReader is a Reader for the TenantServiceGetUser structure. +type TenantServiceGetUserReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TenantServiceGetUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTenantServiceGetUserOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewTenantServiceGetUserDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewTenantServiceGetUserOK creates a TenantServiceGetUserOK with default headers values +func NewTenantServiceGetUserOK() *TenantServiceGetUserOK { + return &TenantServiceGetUserOK{} +} + +/* +TenantServiceGetUserOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type TenantServiceGetUserOK struct { + Payload *models.APIGetTenantUserResponse +} + +// IsSuccess returns true when this tenant service get user o k response has a 2xx status code +func (o *TenantServiceGetUserOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this tenant service get user o k response has a 3xx status code +func (o *TenantServiceGetUserOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tenant service get user o k response has a 4xx status code +func (o *TenantServiceGetUserOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this tenant service get user o k response has a 5xx status code +func (o *TenantServiceGetUserOK) IsServerError() bool { + return false +} + +// IsCode returns true when this tenant service get user o k response a status code equal to that given +func (o *TenantServiceGetUserOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the tenant service get user o k response +func (o *TenantServiceGetUserOK) Code() int { + return 200 +} + +func (o *TenantServiceGetUserOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants/{tenantId}/users/{userId}][%d] tenantServiceGetUserOK %s", 200, payload) +} + +func (o *TenantServiceGetUserOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants/{tenantId}/users/{userId}][%d] tenantServiceGetUserOK %s", 200, payload) +} + +func (o *TenantServiceGetUserOK) GetPayload() *models.APIGetTenantUserResponse { + return o.Payload +} + +func (o *TenantServiceGetUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetTenantUserResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTenantServiceGetUserDefault creates a TenantServiceGetUserDefault with default headers values +func NewTenantServiceGetUserDefault(code int) *TenantServiceGetUserDefault { + return &TenantServiceGetUserDefault{ + _statusCode: code, + } +} + +/* +TenantServiceGetUserDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type TenantServiceGetUserDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this tenant service get user default response has a 2xx status code +func (o *TenantServiceGetUserDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this tenant service get user default response has a 3xx status code +func (o *TenantServiceGetUserDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this tenant service get user default response has a 4xx status code +func (o *TenantServiceGetUserDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this tenant service get user default response has a 5xx status code +func (o *TenantServiceGetUserDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this tenant service get user default response a status code equal to that given +func (o *TenantServiceGetUserDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the tenant service get user default response +func (o *TenantServiceGetUserDefault) Code() int { + return o._statusCode +} + +func (o *TenantServiceGetUserDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants/{tenantId}/users/{userId}][%d] TenantService_GetUser default %s", o._statusCode, payload) +} + +func (o *TenantServiceGetUserDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants/{tenantId}/users/{userId}][%d] TenantService_GetUser default %s", o._statusCode, payload) +} + +func (o *TenantServiceGetUserDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *TenantServiceGetUserDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_list_parameters.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_list_parameters.go new file mode 100644 index 0000000..3853c2d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_list_parameters.go @@ -0,0 +1,272 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewTenantServiceListParams creates a new TenantServiceListParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewTenantServiceListParams() *TenantServiceListParams { + return &TenantServiceListParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTenantServiceListParamsWithTimeout creates a new TenantServiceListParams object +// with the ability to set a timeout on a request. +func NewTenantServiceListParamsWithTimeout(timeout time.Duration) *TenantServiceListParams { + return &TenantServiceListParams{ + timeout: timeout, + } +} + +// NewTenantServiceListParamsWithContext creates a new TenantServiceListParams object +// with the ability to set a context for a request. +func NewTenantServiceListParamsWithContext(ctx context.Context) *TenantServiceListParams { + return &TenantServiceListParams{ + Context: ctx, + } +} + +// NewTenantServiceListParamsWithHTTPClient creates a new TenantServiceListParams object +// with the ability to set a custom HTTPClient for a request. +func NewTenantServiceListParamsWithHTTPClient(client *http.Client) *TenantServiceListParams { + return &TenantServiceListParams{ + HTTPClient: client, + } +} + +/* +TenantServiceListParams contains all the parameters to send to the API endpoint + + for the tenant service list operation. + + Typically these are written to a http.Request. +*/ +type TenantServiceListParams struct { + + /* Limit. + + Max number of tenants to return in the result-set. + If not set, it will be treated as 0, and the response will only return the total_count. + + Format: int64 + */ + Limit *int64 + + /* Offset. + + Offset in the result-set (for pagination). + + Format: int64 + */ + Offset *int64 + + /* Search. + + If set, the given string will be used to search on name. + */ + Search *string + + /* UserID. + + If set, filters the result set to the tenants of the user. + Only global API keys are able to filter by this field. + */ + UserID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the tenant service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceListParams) WithDefaults() *TenantServiceListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tenant service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceListParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the tenant service list params +func (o *TenantServiceListParams) WithTimeout(timeout time.Duration) *TenantServiceListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the tenant service list params +func (o *TenantServiceListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the tenant service list params +func (o *TenantServiceListParams) WithContext(ctx context.Context) *TenantServiceListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the tenant service list params +func (o *TenantServiceListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the tenant service list params +func (o *TenantServiceListParams) WithHTTPClient(client *http.Client) *TenantServiceListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the tenant service list params +func (o *TenantServiceListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the tenant service list params +func (o *TenantServiceListParams) WithLimit(limit *int64) *TenantServiceListParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the tenant service list params +func (o *TenantServiceListParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithOffset adds the offset to the tenant service list params +func (o *TenantServiceListParams) WithOffset(offset *int64) *TenantServiceListParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the tenant service list params +func (o *TenantServiceListParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithSearch adds the search to the tenant service list params +func (o *TenantServiceListParams) WithSearch(search *string) *TenantServiceListParams { + o.SetSearch(search) + return o +} + +// SetSearch adds the search to the tenant service list params +func (o *TenantServiceListParams) SetSearch(search *string) { + o.Search = search +} + +// WithUserID adds the userID to the tenant service list params +func (o *TenantServiceListParams) WithUserID(userID *string) *TenantServiceListParams { + o.SetUserID(userID) + return o +} + +// SetUserID adds the userId to the tenant service list params +func (o *TenantServiceListParams) SetUserID(userID *string) { + o.UserID = userID +} + +// WriteToRequest writes these params to a swagger request +func (o *TenantServiceListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Limit != nil { + + // query param limit + var qrLimit int64 + + if o.Limit != nil { + qrLimit = *o.Limit + } + qLimit := swag.FormatInt64(qrLimit) + if qLimit != "" { + + if err := r.SetQueryParam("limit", qLimit); err != nil { + return err + } + } + } + + if o.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + if o.Search != nil { + + // query param search + var qrSearch string + + if o.Search != nil { + qrSearch = *o.Search + } + qSearch := qrSearch + if qSearch != "" { + + if err := r.SetQueryParam("search", qSearch); err != nil { + return err + } + } + } + + if o.UserID != nil { + + // query param userId + var qrUserID string + + if o.UserID != nil { + qrUserID = *o.UserID + } + qUserID := qrUserID + if qUserID != "" { + + if err := r.SetQueryParam("userId", qUserID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_list_responses.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_list_responses.go new file mode 100644 index 0000000..ff1187e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_list_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// TenantServiceListReader is a Reader for the TenantServiceList structure. +type TenantServiceListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TenantServiceListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTenantServiceListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewTenantServiceListDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewTenantServiceListOK creates a TenantServiceListOK with default headers values +func NewTenantServiceListOK() *TenantServiceListOK { + return &TenantServiceListOK{} +} + +/* +TenantServiceListOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type TenantServiceListOK struct { + Payload *models.APIListTenantsResponse +} + +// IsSuccess returns true when this tenant service list o k response has a 2xx status code +func (o *TenantServiceListOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this tenant service list o k response has a 3xx status code +func (o *TenantServiceListOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tenant service list o k response has a 4xx status code +func (o *TenantServiceListOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this tenant service list o k response has a 5xx status code +func (o *TenantServiceListOK) IsServerError() bool { + return false +} + +// IsCode returns true when this tenant service list o k response a status code equal to that given +func (o *TenantServiceListOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the tenant service list o k response +func (o *TenantServiceListOK) Code() int { + return 200 +} + +func (o *TenantServiceListOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants][%d] tenantServiceListOK %s", 200, payload) +} + +func (o *TenantServiceListOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants][%d] tenantServiceListOK %s", 200, payload) +} + +func (o *TenantServiceListOK) GetPayload() *models.APIListTenantsResponse { + return o.Payload +} + +func (o *TenantServiceListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListTenantsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTenantServiceListDefault creates a TenantServiceListDefault with default headers values +func NewTenantServiceListDefault(code int) *TenantServiceListDefault { + return &TenantServiceListDefault{ + _statusCode: code, + } +} + +/* +TenantServiceListDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type TenantServiceListDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this tenant service list default response has a 2xx status code +func (o *TenantServiceListDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this tenant service list default response has a 3xx status code +func (o *TenantServiceListDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this tenant service list default response has a 4xx status code +func (o *TenantServiceListDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this tenant service list default response has a 5xx status code +func (o *TenantServiceListDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this tenant service list default response a status code equal to that given +func (o *TenantServiceListDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the tenant service list default response +func (o *TenantServiceListDefault) Code() int { + return o._statusCode +} + +func (o *TenantServiceListDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants][%d] TenantService_List default %s", o._statusCode, payload) +} + +func (o *TenantServiceListDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants][%d] TenantService_List default %s", o._statusCode, payload) +} + +func (o *TenantServiceListDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *TenantServiceListDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_list_users_parameters.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_list_users_parameters.go new file mode 100644 index 0000000..010b40a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_list_users_parameters.go @@ -0,0 +1,225 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewTenantServiceListUsersParams creates a new TenantServiceListUsersParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewTenantServiceListUsersParams() *TenantServiceListUsersParams { + return &TenantServiceListUsersParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTenantServiceListUsersParamsWithTimeout creates a new TenantServiceListUsersParams object +// with the ability to set a timeout on a request. +func NewTenantServiceListUsersParamsWithTimeout(timeout time.Duration) *TenantServiceListUsersParams { + return &TenantServiceListUsersParams{ + timeout: timeout, + } +} + +// NewTenantServiceListUsersParamsWithContext creates a new TenantServiceListUsersParams object +// with the ability to set a context for a request. +func NewTenantServiceListUsersParamsWithContext(ctx context.Context) *TenantServiceListUsersParams { + return &TenantServiceListUsersParams{ + Context: ctx, + } +} + +// NewTenantServiceListUsersParamsWithHTTPClient creates a new TenantServiceListUsersParams object +// with the ability to set a custom HTTPClient for a request. +func NewTenantServiceListUsersParamsWithHTTPClient(client *http.Client) *TenantServiceListUsersParams { + return &TenantServiceListUsersParams{ + HTTPClient: client, + } +} + +/* +TenantServiceListUsersParams contains all the parameters to send to the API endpoint + + for the tenant service list users operation. + + Typically these are written to a http.Request. +*/ +type TenantServiceListUsersParams struct { + + /* Limit. + + Max number of tenants to return in the result-set. + If not set, it will be treated as 0, and the response will only return the total_count. + + Format: int64 + */ + Limit *int64 + + /* Offset. + + Offset in the result-set (for pagination). + + Format: int64 + */ + Offset *int64 + + /* TenantID. + + Tenant ID (UUID). + */ + TenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the tenant service list users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceListUsersParams) WithDefaults() *TenantServiceListUsersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tenant service list users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceListUsersParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the tenant service list users params +func (o *TenantServiceListUsersParams) WithTimeout(timeout time.Duration) *TenantServiceListUsersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the tenant service list users params +func (o *TenantServiceListUsersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the tenant service list users params +func (o *TenantServiceListUsersParams) WithContext(ctx context.Context) *TenantServiceListUsersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the tenant service list users params +func (o *TenantServiceListUsersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the tenant service list users params +func (o *TenantServiceListUsersParams) WithHTTPClient(client *http.Client) *TenantServiceListUsersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the tenant service list users params +func (o *TenantServiceListUsersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the tenant service list users params +func (o *TenantServiceListUsersParams) WithLimit(limit *int64) *TenantServiceListUsersParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the tenant service list users params +func (o *TenantServiceListUsersParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithOffset adds the offset to the tenant service list users params +func (o *TenantServiceListUsersParams) WithOffset(offset *int64) *TenantServiceListUsersParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the tenant service list users params +func (o *TenantServiceListUsersParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithTenantID adds the tenantID to the tenant service list users params +func (o *TenantServiceListUsersParams) WithTenantID(tenantID string) *TenantServiceListUsersParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the tenant service list users params +func (o *TenantServiceListUsersParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *TenantServiceListUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Limit != nil { + + // query param limit + var qrLimit int64 + + if o.Limit != nil { + qrLimit = *o.Limit + } + qLimit := swag.FormatInt64(qrLimit) + if qLimit != "" { + + if err := r.SetQueryParam("limit", qLimit); err != nil { + return err + } + } + } + + if o.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + // path param tenantId + if err := r.SetPathParam("tenantId", o.TenantID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_list_users_responses.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_list_users_responses.go new file mode 100644 index 0000000..c12c116 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_list_users_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// TenantServiceListUsersReader is a Reader for the TenantServiceListUsers structure. +type TenantServiceListUsersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TenantServiceListUsersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTenantServiceListUsersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewTenantServiceListUsersDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewTenantServiceListUsersOK creates a TenantServiceListUsersOK with default headers values +func NewTenantServiceListUsersOK() *TenantServiceListUsersOK { + return &TenantServiceListUsersOK{} +} + +/* +TenantServiceListUsersOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type TenantServiceListUsersOK struct { + Payload *models.APIListTenantUsersResponse +} + +// IsSuccess returns true when this tenant service list users o k response has a 2xx status code +func (o *TenantServiceListUsersOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this tenant service list users o k response has a 3xx status code +func (o *TenantServiceListUsersOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tenant service list users o k response has a 4xx status code +func (o *TenantServiceListUsersOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this tenant service list users o k response has a 5xx status code +func (o *TenantServiceListUsersOK) IsServerError() bool { + return false +} + +// IsCode returns true when this tenant service list users o k response a status code equal to that given +func (o *TenantServiceListUsersOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the tenant service list users o k response +func (o *TenantServiceListUsersOK) Code() int { + return 200 +} + +func (o *TenantServiceListUsersOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants/{tenantId}/users][%d] tenantServiceListUsersOK %s", 200, payload) +} + +func (o *TenantServiceListUsersOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants/{tenantId}/users][%d] tenantServiceListUsersOK %s", 200, payload) +} + +func (o *TenantServiceListUsersOK) GetPayload() *models.APIListTenantUsersResponse { + return o.Payload +} + +func (o *TenantServiceListUsersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListTenantUsersResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTenantServiceListUsersDefault creates a TenantServiceListUsersDefault with default headers values +func NewTenantServiceListUsersDefault(code int) *TenantServiceListUsersDefault { + return &TenantServiceListUsersDefault{ + _statusCode: code, + } +} + +/* +TenantServiceListUsersDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type TenantServiceListUsersDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this tenant service list users default response has a 2xx status code +func (o *TenantServiceListUsersDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this tenant service list users default response has a 3xx status code +func (o *TenantServiceListUsersDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this tenant service list users default response has a 4xx status code +func (o *TenantServiceListUsersDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this tenant service list users default response has a 5xx status code +func (o *TenantServiceListUsersDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this tenant service list users default response a status code equal to that given +func (o *TenantServiceListUsersDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the tenant service list users default response +func (o *TenantServiceListUsersDefault) Code() int { + return o._statusCode +} + +func (o *TenantServiceListUsersDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants/{tenantId}/users][%d] TenantService_ListUsers default %s", o._statusCode, payload) +} + +func (o *TenantServiceListUsersDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/tenants/{tenantId}/users][%d] TenantService_ListUsers default %s", o._statusCode, payload) +} + +func (o *TenantServiceListUsersDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *TenantServiceListUsersDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_update_parameters.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_update_parameters.go new file mode 100644 index 0000000..4c328c8 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_update_parameters.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewTenantServiceUpdateParams creates a new TenantServiceUpdateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewTenantServiceUpdateParams() *TenantServiceUpdateParams { + return &TenantServiceUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTenantServiceUpdateParamsWithTimeout creates a new TenantServiceUpdateParams object +// with the ability to set a timeout on a request. +func NewTenantServiceUpdateParamsWithTimeout(timeout time.Duration) *TenantServiceUpdateParams { + return &TenantServiceUpdateParams{ + timeout: timeout, + } +} + +// NewTenantServiceUpdateParamsWithContext creates a new TenantServiceUpdateParams object +// with the ability to set a context for a request. +func NewTenantServiceUpdateParamsWithContext(ctx context.Context) *TenantServiceUpdateParams { + return &TenantServiceUpdateParams{ + Context: ctx, + } +} + +// NewTenantServiceUpdateParamsWithHTTPClient creates a new TenantServiceUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewTenantServiceUpdateParamsWithHTTPClient(client *http.Client) *TenantServiceUpdateParams { + return &TenantServiceUpdateParams{ + HTTPClient: client, + } +} + +/* +TenantServiceUpdateParams contains all the parameters to send to the API endpoint + + for the tenant service update operation. + + Typically these are written to a http.Request. +*/ +type TenantServiceUpdateParams struct { + + // Body. + Body TenantServiceUpdateBody + + /* TenantID. + + Tenant ID (UUID). + Note: this value will be automatically generated on create. + */ + TenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the tenant service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceUpdateParams) WithDefaults() *TenantServiceUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tenant service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the tenant service update params +func (o *TenantServiceUpdateParams) WithTimeout(timeout time.Duration) *TenantServiceUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the tenant service update params +func (o *TenantServiceUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the tenant service update params +func (o *TenantServiceUpdateParams) WithContext(ctx context.Context) *TenantServiceUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the tenant service update params +func (o *TenantServiceUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the tenant service update params +func (o *TenantServiceUpdateParams) WithHTTPClient(client *http.Client) *TenantServiceUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the tenant service update params +func (o *TenantServiceUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the tenant service update params +func (o *TenantServiceUpdateParams) WithBody(body TenantServiceUpdateBody) *TenantServiceUpdateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the tenant service update params +func (o *TenantServiceUpdateParams) SetBody(body TenantServiceUpdateBody) { + o.Body = body +} + +// WithTenantID adds the tenantID to the tenant service update params +func (o *TenantServiceUpdateParams) WithTenantID(tenantID string) *TenantServiceUpdateParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the tenant service update params +func (o *TenantServiceUpdateParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *TenantServiceUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param tenant.id + if err := r.SetPathParam("tenant.id", o.TenantID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_update_responses.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_update_responses.go new file mode 100644 index 0000000..2e8d8e8 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_update_responses.go @@ -0,0 +1,352 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// TenantServiceUpdateReader is a Reader for the TenantServiceUpdate structure. +type TenantServiceUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TenantServiceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTenantServiceUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewTenantServiceUpdateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewTenantServiceUpdateOK creates a TenantServiceUpdateOK with default headers values +func NewTenantServiceUpdateOK() *TenantServiceUpdateOK { + return &TenantServiceUpdateOK{} +} + +/* +TenantServiceUpdateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type TenantServiceUpdateOK struct { + Payload interface{} +} + +// IsSuccess returns true when this tenant service update o k response has a 2xx status code +func (o *TenantServiceUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this tenant service update o k response has a 3xx status code +func (o *TenantServiceUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tenant service update o k response has a 4xx status code +func (o *TenantServiceUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this tenant service update o k response has a 5xx status code +func (o *TenantServiceUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this tenant service update o k response a status code equal to that given +func (o *TenantServiceUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the tenant service update o k response +func (o *TenantServiceUpdateOK) Code() int { + return 200 +} + +func (o *TenantServiceUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/tenants/{tenant.id}][%d] tenantServiceUpdateOK %s", 200, payload) +} + +func (o *TenantServiceUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/tenants/{tenant.id}][%d] tenantServiceUpdateOK %s", 200, payload) +} + +func (o *TenantServiceUpdateOK) GetPayload() interface{} { + return o.Payload +} + +func (o *TenantServiceUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTenantServiceUpdateDefault creates a TenantServiceUpdateDefault with default headers values +func NewTenantServiceUpdateDefault(code int) *TenantServiceUpdateDefault { + return &TenantServiceUpdateDefault{ + _statusCode: code, + } +} + +/* +TenantServiceUpdateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type TenantServiceUpdateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this tenant service update default response has a 2xx status code +func (o *TenantServiceUpdateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this tenant service update default response has a 3xx status code +func (o *TenantServiceUpdateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this tenant service update default response has a 4xx status code +func (o *TenantServiceUpdateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this tenant service update default response has a 5xx status code +func (o *TenantServiceUpdateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this tenant service update default response a status code equal to that given +func (o *TenantServiceUpdateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the tenant service update default response +func (o *TenantServiceUpdateDefault) Code() int { + return o._statusCode +} + +func (o *TenantServiceUpdateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/tenants/{tenant.id}][%d] TenantService_Update default %s", o._statusCode, payload) +} + +func (o *TenantServiceUpdateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/tenants/{tenant.id}][%d] TenantService_Update default %s", o._statusCode, payload) +} + +func (o *TenantServiceUpdateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *TenantServiceUpdateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +TenantServiceUpdateBody tenant service update body +swagger:model TenantServiceUpdateBody +*/ +type TenantServiceUpdateBody struct { + + // tenant + Tenant *TenantServiceUpdateParamsBodyTenant `json:"tenant,omitempty"` +} + +// Validate validates this tenant service update body +func (o *TenantServiceUpdateBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateTenant(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *TenantServiceUpdateBody) validateTenant(formats strfmt.Registry) error { + if swag.IsZero(o.Tenant) { // not required + return nil + } + + if o.Tenant != nil { + if err := o.Tenant.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "tenant") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "tenant") + } + return err + } + } + + return nil +} + +// ContextValidate validate this tenant service update body based on the context it is used +func (o *TenantServiceUpdateBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateTenant(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *TenantServiceUpdateBody) contextValidateTenant(ctx context.Context, formats strfmt.Registry) error { + + if o.Tenant != nil { + + if swag.IsZero(o.Tenant) { // not required + return nil + } + + if err := o.Tenant.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "tenant") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "tenant") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *TenantServiceUpdateBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *TenantServiceUpdateBody) UnmarshalBinary(b []byte) error { + var res TenantServiceUpdateBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +TenantServiceUpdateParamsBodyTenant Tenant object. +swagger:model TenantServiceUpdateParamsBodyTenant +*/ +type TenantServiceUpdateParamsBodyTenant struct { + + // Can the tenant create and "own" Gateways? + CanHaveGateways bool `json:"canHaveGateways,omitempty"` + + // Tenant description. + Description string `json:"description,omitempty"` + + // Max. device count for tenant. + // When set to 0, the tenant can have unlimited devices. + MaxDeviceCount int64 `json:"maxDeviceCount,omitempty"` + + // Max. gateway count for tenant. + // When set to 0, the tenant can have unlimited gateways. + MaxGatewayCount int64 `json:"maxGatewayCount,omitempty"` + + // Tenant name, + Name string `json:"name,omitempty"` + + // Private gateways (downlink). + // If enabled, then other tenants will not be able to schedule downlink + // messages through the gateways of this tenant. For example, in case you + // do want to share uplinks with other tenants (private_gateways_up=false), + // but you want to prevent other tenants from using gateway airtime. + PrivateGatewaysDown bool `json:"privateGatewaysDown,omitempty"` + + // Private gateways (uplink). + // If enabled, then uplink messages will not be shared with other tenants. + PrivateGatewaysUp bool `json:"privateGatewaysUp,omitempty"` + + // Tags (user defined). + // These tags can be used to add additional information to the tenant. These + // tags are NOT exposed in the integration events. + Tags map[string]string `json:"tags,omitempty"` +} + +// Validate validates this tenant service update params body tenant +func (o *TenantServiceUpdateParamsBodyTenant) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this tenant service update params body tenant based on context it is used +func (o *TenantServiceUpdateParamsBodyTenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *TenantServiceUpdateParamsBodyTenant) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *TenantServiceUpdateParamsBodyTenant) UnmarshalBinary(b []byte) error { + var res TenantServiceUpdateParamsBodyTenant + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_update_user_parameters.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_update_user_parameters.go new file mode 100644 index 0000000..9691a6c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_update_user_parameters.go @@ -0,0 +1,190 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewTenantServiceUpdateUserParams creates a new TenantServiceUpdateUserParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewTenantServiceUpdateUserParams() *TenantServiceUpdateUserParams { + return &TenantServiceUpdateUserParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTenantServiceUpdateUserParamsWithTimeout creates a new TenantServiceUpdateUserParams object +// with the ability to set a timeout on a request. +func NewTenantServiceUpdateUserParamsWithTimeout(timeout time.Duration) *TenantServiceUpdateUserParams { + return &TenantServiceUpdateUserParams{ + timeout: timeout, + } +} + +// NewTenantServiceUpdateUserParamsWithContext creates a new TenantServiceUpdateUserParams object +// with the ability to set a context for a request. +func NewTenantServiceUpdateUserParamsWithContext(ctx context.Context) *TenantServiceUpdateUserParams { + return &TenantServiceUpdateUserParams{ + Context: ctx, + } +} + +// NewTenantServiceUpdateUserParamsWithHTTPClient creates a new TenantServiceUpdateUserParams object +// with the ability to set a custom HTTPClient for a request. +func NewTenantServiceUpdateUserParamsWithHTTPClient(client *http.Client) *TenantServiceUpdateUserParams { + return &TenantServiceUpdateUserParams{ + HTTPClient: client, + } +} + +/* +TenantServiceUpdateUserParams contains all the parameters to send to the API endpoint + + for the tenant service update user operation. + + Typically these are written to a http.Request. +*/ +type TenantServiceUpdateUserParams struct { + + // Body. + Body TenantServiceUpdateUserBody + + /* TenantUserTenantID. + + Tenant ID (UUID). + */ + TenantUserTenantID string + + /* TenantUserUserID. + + User ID (UUID). + */ + TenantUserUserID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the tenant service update user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceUpdateUserParams) WithDefaults() *TenantServiceUpdateUserParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tenant service update user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TenantServiceUpdateUserParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the tenant service update user params +func (o *TenantServiceUpdateUserParams) WithTimeout(timeout time.Duration) *TenantServiceUpdateUserParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the tenant service update user params +func (o *TenantServiceUpdateUserParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the tenant service update user params +func (o *TenantServiceUpdateUserParams) WithContext(ctx context.Context) *TenantServiceUpdateUserParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the tenant service update user params +func (o *TenantServiceUpdateUserParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the tenant service update user params +func (o *TenantServiceUpdateUserParams) WithHTTPClient(client *http.Client) *TenantServiceUpdateUserParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the tenant service update user params +func (o *TenantServiceUpdateUserParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the tenant service update user params +func (o *TenantServiceUpdateUserParams) WithBody(body TenantServiceUpdateUserBody) *TenantServiceUpdateUserParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the tenant service update user params +func (o *TenantServiceUpdateUserParams) SetBody(body TenantServiceUpdateUserBody) { + o.Body = body +} + +// WithTenantUserTenantID adds the tenantUserTenantID to the tenant service update user params +func (o *TenantServiceUpdateUserParams) WithTenantUserTenantID(tenantUserTenantID string) *TenantServiceUpdateUserParams { + o.SetTenantUserTenantID(tenantUserTenantID) + return o +} + +// SetTenantUserTenantID adds the tenantUserTenantId to the tenant service update user params +func (o *TenantServiceUpdateUserParams) SetTenantUserTenantID(tenantUserTenantID string) { + o.TenantUserTenantID = tenantUserTenantID +} + +// WithTenantUserUserID adds the tenantUserUserID to the tenant service update user params +func (o *TenantServiceUpdateUserParams) WithTenantUserUserID(tenantUserUserID string) *TenantServiceUpdateUserParams { + o.SetTenantUserUserID(tenantUserUserID) + return o +} + +// SetTenantUserUserID adds the tenantUserUserId to the tenant service update user params +func (o *TenantServiceUpdateUserParams) SetTenantUserUserID(tenantUserUserID string) { + o.TenantUserUserID = tenantUserUserID +} + +// WriteToRequest writes these params to a swagger request +func (o *TenantServiceUpdateUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param tenantUser.tenantId + if err := r.SetPathParam("tenantUser.tenantId", o.TenantUserTenantID); err != nil { + return err + } + + // path param tenantUser.userId + if err := r.SetPathParam("tenantUser.userId", o.TenantUserUserID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_update_user_responses.go b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_update_user_responses.go new file mode 100644 index 0000000..e8acf29 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/tenant_service/tenant_service_update_user_responses.go @@ -0,0 +1,333 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tenant_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// TenantServiceUpdateUserReader is a Reader for the TenantServiceUpdateUser structure. +type TenantServiceUpdateUserReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TenantServiceUpdateUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTenantServiceUpdateUserOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewTenantServiceUpdateUserDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewTenantServiceUpdateUserOK creates a TenantServiceUpdateUserOK with default headers values +func NewTenantServiceUpdateUserOK() *TenantServiceUpdateUserOK { + return &TenantServiceUpdateUserOK{} +} + +/* +TenantServiceUpdateUserOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type TenantServiceUpdateUserOK struct { + Payload interface{} +} + +// IsSuccess returns true when this tenant service update user o k response has a 2xx status code +func (o *TenantServiceUpdateUserOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this tenant service update user o k response has a 3xx status code +func (o *TenantServiceUpdateUserOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tenant service update user o k response has a 4xx status code +func (o *TenantServiceUpdateUserOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this tenant service update user o k response has a 5xx status code +func (o *TenantServiceUpdateUserOK) IsServerError() bool { + return false +} + +// IsCode returns true when this tenant service update user o k response a status code equal to that given +func (o *TenantServiceUpdateUserOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the tenant service update user o k response +func (o *TenantServiceUpdateUserOK) Code() int { + return 200 +} + +func (o *TenantServiceUpdateUserOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/tenants/{tenantUser.tenantId}/users/{tenantUser.userId}][%d] tenantServiceUpdateUserOK %s", 200, payload) +} + +func (o *TenantServiceUpdateUserOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/tenants/{tenantUser.tenantId}/users/{tenantUser.userId}][%d] tenantServiceUpdateUserOK %s", 200, payload) +} + +func (o *TenantServiceUpdateUserOK) GetPayload() interface{} { + return o.Payload +} + +func (o *TenantServiceUpdateUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTenantServiceUpdateUserDefault creates a TenantServiceUpdateUserDefault with default headers values +func NewTenantServiceUpdateUserDefault(code int) *TenantServiceUpdateUserDefault { + return &TenantServiceUpdateUserDefault{ + _statusCode: code, + } +} + +/* +TenantServiceUpdateUserDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type TenantServiceUpdateUserDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this tenant service update user default response has a 2xx status code +func (o *TenantServiceUpdateUserDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this tenant service update user default response has a 3xx status code +func (o *TenantServiceUpdateUserDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this tenant service update user default response has a 4xx status code +func (o *TenantServiceUpdateUserDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this tenant service update user default response has a 5xx status code +func (o *TenantServiceUpdateUserDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this tenant service update user default response a status code equal to that given +func (o *TenantServiceUpdateUserDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the tenant service update user default response +func (o *TenantServiceUpdateUserDefault) Code() int { + return o._statusCode +} + +func (o *TenantServiceUpdateUserDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/tenants/{tenantUser.tenantId}/users/{tenantUser.userId}][%d] TenantService_UpdateUser default %s", o._statusCode, payload) +} + +func (o *TenantServiceUpdateUserDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/tenants/{tenantUser.tenantId}/users/{tenantUser.userId}][%d] TenantService_UpdateUser default %s", o._statusCode, payload) +} + +func (o *TenantServiceUpdateUserDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *TenantServiceUpdateUserDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +TenantServiceUpdateUserBody tenant service update user body +swagger:model TenantServiceUpdateUserBody +*/ +type TenantServiceUpdateUserBody struct { + + // tenant user + TenantUser *TenantServiceUpdateUserParamsBodyTenantUser `json:"tenantUser,omitempty"` +} + +// Validate validates this tenant service update user body +func (o *TenantServiceUpdateUserBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateTenantUser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *TenantServiceUpdateUserBody) validateTenantUser(formats strfmt.Registry) error { + if swag.IsZero(o.TenantUser) { // not required + return nil + } + + if o.TenantUser != nil { + if err := o.TenantUser.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "tenantUser") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "tenantUser") + } + return err + } + } + + return nil +} + +// ContextValidate validate this tenant service update user body based on the context it is used +func (o *TenantServiceUpdateUserBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateTenantUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *TenantServiceUpdateUserBody) contextValidateTenantUser(ctx context.Context, formats strfmt.Registry) error { + + if o.TenantUser != nil { + + if swag.IsZero(o.TenantUser) { // not required + return nil + } + + if err := o.TenantUser.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "tenantUser") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "tenantUser") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *TenantServiceUpdateUserBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *TenantServiceUpdateUserBody) UnmarshalBinary(b []byte) error { + var res TenantServiceUpdateUserBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +TenantServiceUpdateUserParamsBodyTenantUser Tenant user object. +swagger:model TenantServiceUpdateUserParamsBodyTenantUser +*/ +type TenantServiceUpdateUserParamsBodyTenantUser struct { + + // Email (only used on get and when adding a user to a tenant). + Email string `json:"email,omitempty"` + + // User is admin within the context of the tenant. + // There is no need to set the is_device_admin and is_gateway_admin flags. + IsAdmin bool `json:"isAdmin,omitempty"` + + // User is able to modify device related resources (applications, + // device-profiles, devices, multicast-groups). + IsDeviceAdmin bool `json:"isDeviceAdmin,omitempty"` + + // User is able to modify gateways. + IsGatewayAdmin bool `json:"isGatewayAdmin,omitempty"` +} + +// Validate validates this tenant service update user params body tenant user +func (o *TenantServiceUpdateUserParamsBodyTenantUser) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this tenant service update user params body tenant user based on context it is used +func (o *TenantServiceUpdateUserParamsBodyTenantUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *TenantServiceUpdateUserParamsBodyTenantUser) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *TenantServiceUpdateUserParamsBodyTenantUser) UnmarshalBinary(b []byte) error { + var res TenantServiceUpdateUserParamsBodyTenantUser + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/user_service/user_service_client.go b/internal/app/service/lora/chirp_stack/client/user_service/user_service_client.go new file mode 100644 index 0000000..51312f1 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/user_service/user_service_client.go @@ -0,0 +1,303 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new user service API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new user service API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new user service API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for user service API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + UserServiceCreate(params *UserServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceCreateOK, error) + + UserServiceDelete(params *UserServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceDeleteOK, error) + + UserServiceGet(params *UserServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceGetOK, error) + + UserServiceList(params *UserServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceListOK, error) + + UserServiceUpdate(params *UserServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceUpdateOK, error) + + UserServiceUpdatePassword(params *UserServiceUpdatePasswordParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceUpdatePasswordOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +UserServiceCreate creates a new user +*/ +func (a *Client) UserServiceCreate(params *UserServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUserServiceCreateParams() + } + op := &runtime.ClientOperation{ + ID: "UserService_Create", + Method: "POST", + PathPattern: "/api/users", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &UserServiceCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*UserServiceCreateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UserServiceCreateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +UserServiceDelete deletes the user with the given ID +*/ +func (a *Client) UserServiceDelete(params *UserServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUserServiceDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "UserService_Delete", + Method: "DELETE", + PathPattern: "/api/users/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &UserServiceDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*UserServiceDeleteOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UserServiceDeleteDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +UserServiceGet gets the user for the given ID +*/ +func (a *Client) UserServiceGet(params *UserServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUserServiceGetParams() + } + op := &runtime.ClientOperation{ + ID: "UserService_Get", + Method: "GET", + PathPattern: "/api/users/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &UserServiceGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*UserServiceGetOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UserServiceGetDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +UserServiceList gets the list of users +*/ +func (a *Client) UserServiceList(params *UserServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUserServiceListParams() + } + op := &runtime.ClientOperation{ + ID: "UserService_List", + Method: "GET", + PathPattern: "/api/users", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &UserServiceListReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*UserServiceListOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UserServiceListDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +UserServiceUpdate updates the given user +*/ +func (a *Client) UserServiceUpdate(params *UserServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUserServiceUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "UserService_Update", + Method: "PUT", + PathPattern: "/api/users/{user.id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &UserServiceUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*UserServiceUpdateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UserServiceUpdateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +UserServiceUpdatePassword updates the password for the given user +*/ +func (a *Client) UserServiceUpdatePassword(params *UserServiceUpdatePasswordParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceUpdatePasswordOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUserServiceUpdatePasswordParams() + } + op := &runtime.ClientOperation{ + ID: "UserService_UpdatePassword", + Method: "POST", + PathPattern: "/api/users/{userId}/password", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &UserServiceUpdatePasswordReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*UserServiceUpdatePasswordOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UserServiceUpdatePasswordDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/internal/app/service/lora/chirp_stack/client/user_service/user_service_create_parameters.go b/internal/app/service/lora/chirp_stack/client/user_service/user_service_create_parameters.go new file mode 100644 index 0000000..a6f033c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/user_service/user_service_create_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// NewUserServiceCreateParams creates a new UserServiceCreateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewUserServiceCreateParams() *UserServiceCreateParams { + return &UserServiceCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUserServiceCreateParamsWithTimeout creates a new UserServiceCreateParams object +// with the ability to set a timeout on a request. +func NewUserServiceCreateParamsWithTimeout(timeout time.Duration) *UserServiceCreateParams { + return &UserServiceCreateParams{ + timeout: timeout, + } +} + +// NewUserServiceCreateParamsWithContext creates a new UserServiceCreateParams object +// with the ability to set a context for a request. +func NewUserServiceCreateParamsWithContext(ctx context.Context) *UserServiceCreateParams { + return &UserServiceCreateParams{ + Context: ctx, + } +} + +// NewUserServiceCreateParamsWithHTTPClient creates a new UserServiceCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewUserServiceCreateParamsWithHTTPClient(client *http.Client) *UserServiceCreateParams { + return &UserServiceCreateParams{ + HTTPClient: client, + } +} + +/* +UserServiceCreateParams contains all the parameters to send to the API endpoint + + for the user service create operation. + + Typically these are written to a http.Request. +*/ +type UserServiceCreateParams struct { + + // Body. + Body *models.APICreateUserRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the user service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserServiceCreateParams) WithDefaults() *UserServiceCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the user service create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserServiceCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the user service create params +func (o *UserServiceCreateParams) WithTimeout(timeout time.Duration) *UserServiceCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the user service create params +func (o *UserServiceCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the user service create params +func (o *UserServiceCreateParams) WithContext(ctx context.Context) *UserServiceCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the user service create params +func (o *UserServiceCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the user service create params +func (o *UserServiceCreateParams) WithHTTPClient(client *http.Client) *UserServiceCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the user service create params +func (o *UserServiceCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the user service create params +func (o *UserServiceCreateParams) WithBody(body *models.APICreateUserRequest) *UserServiceCreateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the user service create params +func (o *UserServiceCreateParams) SetBody(body *models.APICreateUserRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *UserServiceCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/user_service/user_service_create_responses.go b/internal/app/service/lora/chirp_stack/client/user_service/user_service_create_responses.go new file mode 100644 index 0000000..e8bb465 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/user_service/user_service_create_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// UserServiceCreateReader is a Reader for the UserServiceCreate structure. +type UserServiceCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UserServiceCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUserServiceCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUserServiceCreateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewUserServiceCreateOK creates a UserServiceCreateOK with default headers values +func NewUserServiceCreateOK() *UserServiceCreateOK { + return &UserServiceCreateOK{} +} + +/* +UserServiceCreateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type UserServiceCreateOK struct { + Payload *models.APICreateUserResponse +} + +// IsSuccess returns true when this user service create o k response has a 2xx status code +func (o *UserServiceCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this user service create o k response has a 3xx status code +func (o *UserServiceCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user service create o k response has a 4xx status code +func (o *UserServiceCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this user service create o k response has a 5xx status code +func (o *UserServiceCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this user service create o k response a status code equal to that given +func (o *UserServiceCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the user service create o k response +func (o *UserServiceCreateOK) Code() int { + return 200 +} + +func (o *UserServiceCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/users][%d] userServiceCreateOK %s", 200, payload) +} + +func (o *UserServiceCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/users][%d] userServiceCreateOK %s", 200, payload) +} + +func (o *UserServiceCreateOK) GetPayload() *models.APICreateUserResponse { + return o.Payload +} + +func (o *UserServiceCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APICreateUserResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUserServiceCreateDefault creates a UserServiceCreateDefault with default headers values +func NewUserServiceCreateDefault(code int) *UserServiceCreateDefault { + return &UserServiceCreateDefault{ + _statusCode: code, + } +} + +/* +UserServiceCreateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type UserServiceCreateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this user service create default response has a 2xx status code +func (o *UserServiceCreateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this user service create default response has a 3xx status code +func (o *UserServiceCreateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this user service create default response has a 4xx status code +func (o *UserServiceCreateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this user service create default response has a 5xx status code +func (o *UserServiceCreateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this user service create default response a status code equal to that given +func (o *UserServiceCreateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the user service create default response +func (o *UserServiceCreateDefault) Code() int { + return o._statusCode +} + +func (o *UserServiceCreateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/users][%d] UserService_Create default %s", o._statusCode, payload) +} + +func (o *UserServiceCreateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/users][%d] UserService_Create default %s", o._statusCode, payload) +} + +func (o *UserServiceCreateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *UserServiceCreateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/user_service/user_service_delete_parameters.go b/internal/app/service/lora/chirp_stack/client/user_service/user_service_delete_parameters.go new file mode 100644 index 0000000..6122221 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/user_service/user_service_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewUserServiceDeleteParams creates a new UserServiceDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewUserServiceDeleteParams() *UserServiceDeleteParams { + return &UserServiceDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUserServiceDeleteParamsWithTimeout creates a new UserServiceDeleteParams object +// with the ability to set a timeout on a request. +func NewUserServiceDeleteParamsWithTimeout(timeout time.Duration) *UserServiceDeleteParams { + return &UserServiceDeleteParams{ + timeout: timeout, + } +} + +// NewUserServiceDeleteParamsWithContext creates a new UserServiceDeleteParams object +// with the ability to set a context for a request. +func NewUserServiceDeleteParamsWithContext(ctx context.Context) *UserServiceDeleteParams { + return &UserServiceDeleteParams{ + Context: ctx, + } +} + +// NewUserServiceDeleteParamsWithHTTPClient creates a new UserServiceDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewUserServiceDeleteParamsWithHTTPClient(client *http.Client) *UserServiceDeleteParams { + return &UserServiceDeleteParams{ + HTTPClient: client, + } +} + +/* +UserServiceDeleteParams contains all the parameters to send to the API endpoint + + for the user service delete operation. + + Typically these are written to a http.Request. +*/ +type UserServiceDeleteParams struct { + + /* ID. + + User ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the user service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserServiceDeleteParams) WithDefaults() *UserServiceDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the user service delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserServiceDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the user service delete params +func (o *UserServiceDeleteParams) WithTimeout(timeout time.Duration) *UserServiceDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the user service delete params +func (o *UserServiceDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the user service delete params +func (o *UserServiceDeleteParams) WithContext(ctx context.Context) *UserServiceDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the user service delete params +func (o *UserServiceDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the user service delete params +func (o *UserServiceDeleteParams) WithHTTPClient(client *http.Client) *UserServiceDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the user service delete params +func (o *UserServiceDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the user service delete params +func (o *UserServiceDeleteParams) WithID(id string) *UserServiceDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the user service delete params +func (o *UserServiceDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *UserServiceDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/user_service/user_service_delete_responses.go b/internal/app/service/lora/chirp_stack/client/user_service/user_service_delete_responses.go new file mode 100644 index 0000000..ca65c05 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/user_service/user_service_delete_responses.go @@ -0,0 +1,185 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// UserServiceDeleteReader is a Reader for the UserServiceDelete structure. +type UserServiceDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UserServiceDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUserServiceDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUserServiceDeleteDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewUserServiceDeleteOK creates a UserServiceDeleteOK with default headers values +func NewUserServiceDeleteOK() *UserServiceDeleteOK { + return &UserServiceDeleteOK{} +} + +/* +UserServiceDeleteOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type UserServiceDeleteOK struct { + Payload interface{} +} + +// IsSuccess returns true when this user service delete o k response has a 2xx status code +func (o *UserServiceDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this user service delete o k response has a 3xx status code +func (o *UserServiceDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user service delete o k response has a 4xx status code +func (o *UserServiceDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this user service delete o k response has a 5xx status code +func (o *UserServiceDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this user service delete o k response a status code equal to that given +func (o *UserServiceDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the user service delete o k response +func (o *UserServiceDeleteOK) Code() int { + return 200 +} + +func (o *UserServiceDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/users/{id}][%d] userServiceDeleteOK %s", 200, payload) +} + +func (o *UserServiceDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/users/{id}][%d] userServiceDeleteOK %s", 200, payload) +} + +func (o *UserServiceDeleteOK) GetPayload() interface{} { + return o.Payload +} + +func (o *UserServiceDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUserServiceDeleteDefault creates a UserServiceDeleteDefault with default headers values +func NewUserServiceDeleteDefault(code int) *UserServiceDeleteDefault { + return &UserServiceDeleteDefault{ + _statusCode: code, + } +} + +/* +UserServiceDeleteDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type UserServiceDeleteDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this user service delete default response has a 2xx status code +func (o *UserServiceDeleteDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this user service delete default response has a 3xx status code +func (o *UserServiceDeleteDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this user service delete default response has a 4xx status code +func (o *UserServiceDeleteDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this user service delete default response has a 5xx status code +func (o *UserServiceDeleteDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this user service delete default response a status code equal to that given +func (o *UserServiceDeleteDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the user service delete default response +func (o *UserServiceDeleteDefault) Code() int { + return o._statusCode +} + +func (o *UserServiceDeleteDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/users/{id}][%d] UserService_Delete default %s", o._statusCode, payload) +} + +func (o *UserServiceDeleteDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/users/{id}][%d] UserService_Delete default %s", o._statusCode, payload) +} + +func (o *UserServiceDeleteDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *UserServiceDeleteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/user_service/user_service_get_parameters.go b/internal/app/service/lora/chirp_stack/client/user_service/user_service_get_parameters.go new file mode 100644 index 0000000..913824a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/user_service/user_service_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewUserServiceGetParams creates a new UserServiceGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewUserServiceGetParams() *UserServiceGetParams { + return &UserServiceGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUserServiceGetParamsWithTimeout creates a new UserServiceGetParams object +// with the ability to set a timeout on a request. +func NewUserServiceGetParamsWithTimeout(timeout time.Duration) *UserServiceGetParams { + return &UserServiceGetParams{ + timeout: timeout, + } +} + +// NewUserServiceGetParamsWithContext creates a new UserServiceGetParams object +// with the ability to set a context for a request. +func NewUserServiceGetParamsWithContext(ctx context.Context) *UserServiceGetParams { + return &UserServiceGetParams{ + Context: ctx, + } +} + +// NewUserServiceGetParamsWithHTTPClient creates a new UserServiceGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewUserServiceGetParamsWithHTTPClient(client *http.Client) *UserServiceGetParams { + return &UserServiceGetParams{ + HTTPClient: client, + } +} + +/* +UserServiceGetParams contains all the parameters to send to the API endpoint + + for the user service get operation. + + Typically these are written to a http.Request. +*/ +type UserServiceGetParams struct { + + /* ID. + + User ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the user service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserServiceGetParams) WithDefaults() *UserServiceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the user service get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserServiceGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the user service get params +func (o *UserServiceGetParams) WithTimeout(timeout time.Duration) *UserServiceGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the user service get params +func (o *UserServiceGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the user service get params +func (o *UserServiceGetParams) WithContext(ctx context.Context) *UserServiceGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the user service get params +func (o *UserServiceGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the user service get params +func (o *UserServiceGetParams) WithHTTPClient(client *http.Client) *UserServiceGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the user service get params +func (o *UserServiceGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the user service get params +func (o *UserServiceGetParams) WithID(id string) *UserServiceGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the user service get params +func (o *UserServiceGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *UserServiceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/user_service/user_service_get_responses.go b/internal/app/service/lora/chirp_stack/client/user_service/user_service_get_responses.go new file mode 100644 index 0000000..4ba526f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/user_service/user_service_get_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// UserServiceGetReader is a Reader for the UserServiceGet structure. +type UserServiceGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UserServiceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUserServiceGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUserServiceGetDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewUserServiceGetOK creates a UserServiceGetOK with default headers values +func NewUserServiceGetOK() *UserServiceGetOK { + return &UserServiceGetOK{} +} + +/* +UserServiceGetOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type UserServiceGetOK struct { + Payload *models.APIGetUserResponse +} + +// IsSuccess returns true when this user service get o k response has a 2xx status code +func (o *UserServiceGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this user service get o k response has a 3xx status code +func (o *UserServiceGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user service get o k response has a 4xx status code +func (o *UserServiceGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this user service get o k response has a 5xx status code +func (o *UserServiceGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this user service get o k response a status code equal to that given +func (o *UserServiceGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the user service get o k response +func (o *UserServiceGetOK) Code() int { + return 200 +} + +func (o *UserServiceGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/users/{id}][%d] userServiceGetOK %s", 200, payload) +} + +func (o *UserServiceGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/users/{id}][%d] userServiceGetOK %s", 200, payload) +} + +func (o *UserServiceGetOK) GetPayload() *models.APIGetUserResponse { + return o.Payload +} + +func (o *UserServiceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIGetUserResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUserServiceGetDefault creates a UserServiceGetDefault with default headers values +func NewUserServiceGetDefault(code int) *UserServiceGetDefault { + return &UserServiceGetDefault{ + _statusCode: code, + } +} + +/* +UserServiceGetDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type UserServiceGetDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this user service get default response has a 2xx status code +func (o *UserServiceGetDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this user service get default response has a 3xx status code +func (o *UserServiceGetDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this user service get default response has a 4xx status code +func (o *UserServiceGetDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this user service get default response has a 5xx status code +func (o *UserServiceGetDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this user service get default response a status code equal to that given +func (o *UserServiceGetDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the user service get default response +func (o *UserServiceGetDefault) Code() int { + return o._statusCode +} + +func (o *UserServiceGetDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/users/{id}][%d] UserService_Get default %s", o._statusCode, payload) +} + +func (o *UserServiceGetDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/users/{id}][%d] UserService_Get default %s", o._statusCode, payload) +} + +func (o *UserServiceGetDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *UserServiceGetDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/user_service/user_service_list_parameters.go b/internal/app/service/lora/chirp_stack/client/user_service/user_service_list_parameters.go new file mode 100644 index 0000000..175e343 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/user_service/user_service_list_parameters.go @@ -0,0 +1,203 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewUserServiceListParams creates a new UserServiceListParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewUserServiceListParams() *UserServiceListParams { + return &UserServiceListParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUserServiceListParamsWithTimeout creates a new UserServiceListParams object +// with the ability to set a timeout on a request. +func NewUserServiceListParamsWithTimeout(timeout time.Duration) *UserServiceListParams { + return &UserServiceListParams{ + timeout: timeout, + } +} + +// NewUserServiceListParamsWithContext creates a new UserServiceListParams object +// with the ability to set a context for a request. +func NewUserServiceListParamsWithContext(ctx context.Context) *UserServiceListParams { + return &UserServiceListParams{ + Context: ctx, + } +} + +// NewUserServiceListParamsWithHTTPClient creates a new UserServiceListParams object +// with the ability to set a custom HTTPClient for a request. +func NewUserServiceListParamsWithHTTPClient(client *http.Client) *UserServiceListParams { + return &UserServiceListParams{ + HTTPClient: client, + } +} + +/* +UserServiceListParams contains all the parameters to send to the API endpoint + + for the user service list operation. + + Typically these are written to a http.Request. +*/ +type UserServiceListParams struct { + + /* Limit. + + Max number of tenants to return in the result-set. + If not set, it will be treated as 0, and the response will only return the total_count. + + Format: int64 + */ + Limit *int64 + + /* Offset. + + Offset in the result-set (for pagination). + + Format: int64 + */ + Offset *int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the user service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserServiceListParams) WithDefaults() *UserServiceListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the user service list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserServiceListParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the user service list params +func (o *UserServiceListParams) WithTimeout(timeout time.Duration) *UserServiceListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the user service list params +func (o *UserServiceListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the user service list params +func (o *UserServiceListParams) WithContext(ctx context.Context) *UserServiceListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the user service list params +func (o *UserServiceListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the user service list params +func (o *UserServiceListParams) WithHTTPClient(client *http.Client) *UserServiceListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the user service list params +func (o *UserServiceListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the user service list params +func (o *UserServiceListParams) WithLimit(limit *int64) *UserServiceListParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the user service list params +func (o *UserServiceListParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithOffset adds the offset to the user service list params +func (o *UserServiceListParams) WithOffset(offset *int64) *UserServiceListParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the user service list params +func (o *UserServiceListParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WriteToRequest writes these params to a swagger request +func (o *UserServiceListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Limit != nil { + + // query param limit + var qrLimit int64 + + if o.Limit != nil { + qrLimit = *o.Limit + } + qLimit := swag.FormatInt64(qrLimit) + if qLimit != "" { + + if err := r.SetQueryParam("limit", qLimit); err != nil { + return err + } + } + } + + if o.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/user_service/user_service_list_responses.go b/internal/app/service/lora/chirp_stack/client/user_service/user_service_list_responses.go new file mode 100644 index 0000000..afa9f99 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/user_service/user_service_list_responses.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// UserServiceListReader is a Reader for the UserServiceList structure. +type UserServiceListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UserServiceListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUserServiceListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUserServiceListDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewUserServiceListOK creates a UserServiceListOK with default headers values +func NewUserServiceListOK() *UserServiceListOK { + return &UserServiceListOK{} +} + +/* +UserServiceListOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type UserServiceListOK struct { + Payload *models.APIListUsersResponse +} + +// IsSuccess returns true when this user service list o k response has a 2xx status code +func (o *UserServiceListOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this user service list o k response has a 3xx status code +func (o *UserServiceListOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user service list o k response has a 4xx status code +func (o *UserServiceListOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this user service list o k response has a 5xx status code +func (o *UserServiceListOK) IsServerError() bool { + return false +} + +// IsCode returns true when this user service list o k response a status code equal to that given +func (o *UserServiceListOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the user service list o k response +func (o *UserServiceListOK) Code() int { + return 200 +} + +func (o *UserServiceListOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/users][%d] userServiceListOK %s", 200, payload) +} + +func (o *UserServiceListOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/users][%d] userServiceListOK %s", 200, payload) +} + +func (o *UserServiceListOK) GetPayload() *models.APIListUsersResponse { + return o.Payload +} + +func (o *UserServiceListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.APIListUsersResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUserServiceListDefault creates a UserServiceListDefault with default headers values +func NewUserServiceListDefault(code int) *UserServiceListDefault { + return &UserServiceListDefault{ + _statusCode: code, + } +} + +/* +UserServiceListDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type UserServiceListDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this user service list default response has a 2xx status code +func (o *UserServiceListDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this user service list default response has a 3xx status code +func (o *UserServiceListDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this user service list default response has a 4xx status code +func (o *UserServiceListDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this user service list default response has a 5xx status code +func (o *UserServiceListDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this user service list default response a status code equal to that given +func (o *UserServiceListDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the user service list default response +func (o *UserServiceListDefault) Code() int { + return o._statusCode +} + +func (o *UserServiceListDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/users][%d] UserService_List default %s", o._statusCode, payload) +} + +func (o *UserServiceListDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/users][%d] UserService_List default %s", o._statusCode, payload) +} + +func (o *UserServiceListDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *UserServiceListDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/user_service/user_service_update_parameters.go b/internal/app/service/lora/chirp_stack/client/user_service/user_service_update_parameters.go new file mode 100644 index 0000000..e68c9fe --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/user_service/user_service_update_parameters.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewUserServiceUpdateParams creates a new UserServiceUpdateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewUserServiceUpdateParams() *UserServiceUpdateParams { + return &UserServiceUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUserServiceUpdateParamsWithTimeout creates a new UserServiceUpdateParams object +// with the ability to set a timeout on a request. +func NewUserServiceUpdateParamsWithTimeout(timeout time.Duration) *UserServiceUpdateParams { + return &UserServiceUpdateParams{ + timeout: timeout, + } +} + +// NewUserServiceUpdateParamsWithContext creates a new UserServiceUpdateParams object +// with the ability to set a context for a request. +func NewUserServiceUpdateParamsWithContext(ctx context.Context) *UserServiceUpdateParams { + return &UserServiceUpdateParams{ + Context: ctx, + } +} + +// NewUserServiceUpdateParamsWithHTTPClient creates a new UserServiceUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewUserServiceUpdateParamsWithHTTPClient(client *http.Client) *UserServiceUpdateParams { + return &UserServiceUpdateParams{ + HTTPClient: client, + } +} + +/* +UserServiceUpdateParams contains all the parameters to send to the API endpoint + + for the user service update operation. + + Typically these are written to a http.Request. +*/ +type UserServiceUpdateParams struct { + + // Body. + Body UserServiceUpdateBody + + /* UserID. + + User ID (UUID). + Will be set automatically on create. + */ + UserID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the user service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserServiceUpdateParams) WithDefaults() *UserServiceUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the user service update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserServiceUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the user service update params +func (o *UserServiceUpdateParams) WithTimeout(timeout time.Duration) *UserServiceUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the user service update params +func (o *UserServiceUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the user service update params +func (o *UserServiceUpdateParams) WithContext(ctx context.Context) *UserServiceUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the user service update params +func (o *UserServiceUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the user service update params +func (o *UserServiceUpdateParams) WithHTTPClient(client *http.Client) *UserServiceUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the user service update params +func (o *UserServiceUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the user service update params +func (o *UserServiceUpdateParams) WithBody(body UserServiceUpdateBody) *UserServiceUpdateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the user service update params +func (o *UserServiceUpdateParams) SetBody(body UserServiceUpdateBody) { + o.Body = body +} + +// WithUserID adds the userID to the user service update params +func (o *UserServiceUpdateParams) WithUserID(userID string) *UserServiceUpdateParams { + o.SetUserID(userID) + return o +} + +// SetUserID adds the userId to the user service update params +func (o *UserServiceUpdateParams) SetUserID(userID string) { + o.UserID = userID +} + +// WriteToRequest writes these params to a swagger request +func (o *UserServiceUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param user.id + if err := r.SetPathParam("user.id", o.UserID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/user_service/user_service_update_password_parameters.go b/internal/app/service/lora/chirp_stack/client/user_service/user_service_update_password_parameters.go new file mode 100644 index 0000000..360214e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/user_service/user_service_update_password_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewUserServiceUpdatePasswordParams creates a new UserServiceUpdatePasswordParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewUserServiceUpdatePasswordParams() *UserServiceUpdatePasswordParams { + return &UserServiceUpdatePasswordParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUserServiceUpdatePasswordParamsWithTimeout creates a new UserServiceUpdatePasswordParams object +// with the ability to set a timeout on a request. +func NewUserServiceUpdatePasswordParamsWithTimeout(timeout time.Duration) *UserServiceUpdatePasswordParams { + return &UserServiceUpdatePasswordParams{ + timeout: timeout, + } +} + +// NewUserServiceUpdatePasswordParamsWithContext creates a new UserServiceUpdatePasswordParams object +// with the ability to set a context for a request. +func NewUserServiceUpdatePasswordParamsWithContext(ctx context.Context) *UserServiceUpdatePasswordParams { + return &UserServiceUpdatePasswordParams{ + Context: ctx, + } +} + +// NewUserServiceUpdatePasswordParamsWithHTTPClient creates a new UserServiceUpdatePasswordParams object +// with the ability to set a custom HTTPClient for a request. +func NewUserServiceUpdatePasswordParamsWithHTTPClient(client *http.Client) *UserServiceUpdatePasswordParams { + return &UserServiceUpdatePasswordParams{ + HTTPClient: client, + } +} + +/* +UserServiceUpdatePasswordParams contains all the parameters to send to the API endpoint + + for the user service update password operation. + + Typically these are written to a http.Request. +*/ +type UserServiceUpdatePasswordParams struct { + + // Body. + Body UserServiceUpdatePasswordBody + + /* UserID. + + User ID. + */ + UserID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the user service update password params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserServiceUpdatePasswordParams) WithDefaults() *UserServiceUpdatePasswordParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the user service update password params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserServiceUpdatePasswordParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the user service update password params +func (o *UserServiceUpdatePasswordParams) WithTimeout(timeout time.Duration) *UserServiceUpdatePasswordParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the user service update password params +func (o *UserServiceUpdatePasswordParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the user service update password params +func (o *UserServiceUpdatePasswordParams) WithContext(ctx context.Context) *UserServiceUpdatePasswordParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the user service update password params +func (o *UserServiceUpdatePasswordParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the user service update password params +func (o *UserServiceUpdatePasswordParams) WithHTTPClient(client *http.Client) *UserServiceUpdatePasswordParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the user service update password params +func (o *UserServiceUpdatePasswordParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the user service update password params +func (o *UserServiceUpdatePasswordParams) WithBody(body UserServiceUpdatePasswordBody) *UserServiceUpdatePasswordParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the user service update password params +func (o *UserServiceUpdatePasswordParams) SetBody(body UserServiceUpdatePasswordBody) { + o.Body = body +} + +// WithUserID adds the userID to the user service update password params +func (o *UserServiceUpdatePasswordParams) WithUserID(userID string) *UserServiceUpdatePasswordParams { + o.SetUserID(userID) + return o +} + +// SetUserID adds the userId to the user service update password params +func (o *UserServiceUpdatePasswordParams) SetUserID(userID string) { + o.UserID = userID +} + +// WriteToRequest writes these params to a swagger request +func (o *UserServiceUpdatePasswordParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param userId + if err := r.SetPathParam("userId", o.UserID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/user_service/user_service_update_password_responses.go b/internal/app/service/lora/chirp_stack/client/user_service/user_service_update_password_responses.go new file mode 100644 index 0000000..a7dd609 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/user_service/user_service_update_password_responses.go @@ -0,0 +1,225 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// UserServiceUpdatePasswordReader is a Reader for the UserServiceUpdatePassword structure. +type UserServiceUpdatePasswordReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UserServiceUpdatePasswordReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUserServiceUpdatePasswordOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUserServiceUpdatePasswordDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewUserServiceUpdatePasswordOK creates a UserServiceUpdatePasswordOK with default headers values +func NewUserServiceUpdatePasswordOK() *UserServiceUpdatePasswordOK { + return &UserServiceUpdatePasswordOK{} +} + +/* +UserServiceUpdatePasswordOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type UserServiceUpdatePasswordOK struct { + Payload interface{} +} + +// IsSuccess returns true when this user service update password o k response has a 2xx status code +func (o *UserServiceUpdatePasswordOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this user service update password o k response has a 3xx status code +func (o *UserServiceUpdatePasswordOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user service update password o k response has a 4xx status code +func (o *UserServiceUpdatePasswordOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this user service update password o k response has a 5xx status code +func (o *UserServiceUpdatePasswordOK) IsServerError() bool { + return false +} + +// IsCode returns true when this user service update password o k response a status code equal to that given +func (o *UserServiceUpdatePasswordOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the user service update password o k response +func (o *UserServiceUpdatePasswordOK) Code() int { + return 200 +} + +func (o *UserServiceUpdatePasswordOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/users/{userId}/password][%d] userServiceUpdatePasswordOK %s", 200, payload) +} + +func (o *UserServiceUpdatePasswordOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/users/{userId}/password][%d] userServiceUpdatePasswordOK %s", 200, payload) +} + +func (o *UserServiceUpdatePasswordOK) GetPayload() interface{} { + return o.Payload +} + +func (o *UserServiceUpdatePasswordOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUserServiceUpdatePasswordDefault creates a UserServiceUpdatePasswordDefault with default headers values +func NewUserServiceUpdatePasswordDefault(code int) *UserServiceUpdatePasswordDefault { + return &UserServiceUpdatePasswordDefault{ + _statusCode: code, + } +} + +/* +UserServiceUpdatePasswordDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type UserServiceUpdatePasswordDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this user service update password default response has a 2xx status code +func (o *UserServiceUpdatePasswordDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this user service update password default response has a 3xx status code +func (o *UserServiceUpdatePasswordDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this user service update password default response has a 4xx status code +func (o *UserServiceUpdatePasswordDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this user service update password default response has a 5xx status code +func (o *UserServiceUpdatePasswordDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this user service update password default response a status code equal to that given +func (o *UserServiceUpdatePasswordDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the user service update password default response +func (o *UserServiceUpdatePasswordDefault) Code() int { + return o._statusCode +} + +func (o *UserServiceUpdatePasswordDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/users/{userId}/password][%d] UserService_UpdatePassword default %s", o._statusCode, payload) +} + +func (o *UserServiceUpdatePasswordDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/users/{userId}/password][%d] UserService_UpdatePassword default %s", o._statusCode, payload) +} + +func (o *UserServiceUpdatePasswordDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *UserServiceUpdatePasswordDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +UserServiceUpdatePasswordBody user service update password body +swagger:model UserServiceUpdatePasswordBody +*/ +type UserServiceUpdatePasswordBody struct { + + // Password to set. + Password string `json:"password,omitempty"` +} + +// Validate validates this user service update password body +func (o *UserServiceUpdatePasswordBody) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this user service update password body based on context it is used +func (o *UserServiceUpdatePasswordBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *UserServiceUpdatePasswordBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *UserServiceUpdatePasswordBody) UnmarshalBinary(b []byte) error { + var res UserServiceUpdatePasswordBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/client/user_service/user_service_update_responses.go b/internal/app/service/lora/chirp_stack/client/user_service/user_service_update_responses.go new file mode 100644 index 0000000..63676fa --- /dev/null +++ b/internal/app/service/lora/chirp_stack/client/user_service/user_service_update_responses.go @@ -0,0 +1,331 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "git.huangwc.com/pig/pig-farm-controller/internal/app/service/lora/chirp_stack/models" +) + +// UserServiceUpdateReader is a Reader for the UserServiceUpdate structure. +type UserServiceUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UserServiceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUserServiceUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUserServiceUpdateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewUserServiceUpdateOK creates a UserServiceUpdateOK with default headers values +func NewUserServiceUpdateOK() *UserServiceUpdateOK { + return &UserServiceUpdateOK{} +} + +/* +UserServiceUpdateOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type UserServiceUpdateOK struct { + Payload interface{} +} + +// IsSuccess returns true when this user service update o k response has a 2xx status code +func (o *UserServiceUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this user service update o k response has a 3xx status code +func (o *UserServiceUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user service update o k response has a 4xx status code +func (o *UserServiceUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this user service update o k response has a 5xx status code +func (o *UserServiceUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this user service update o k response a status code equal to that given +func (o *UserServiceUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the user service update o k response +func (o *UserServiceUpdateOK) Code() int { + return 200 +} + +func (o *UserServiceUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/users/{user.id}][%d] userServiceUpdateOK %s", 200, payload) +} + +func (o *UserServiceUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/users/{user.id}][%d] userServiceUpdateOK %s", 200, payload) +} + +func (o *UserServiceUpdateOK) GetPayload() interface{} { + return o.Payload +} + +func (o *UserServiceUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUserServiceUpdateDefault creates a UserServiceUpdateDefault with default headers values +func NewUserServiceUpdateDefault(code int) *UserServiceUpdateDefault { + return &UserServiceUpdateDefault{ + _statusCode: code, + } +} + +/* +UserServiceUpdateDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type UserServiceUpdateDefault struct { + _statusCode int + + Payload *models.RPCStatus +} + +// IsSuccess returns true when this user service update default response has a 2xx status code +func (o *UserServiceUpdateDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this user service update default response has a 3xx status code +func (o *UserServiceUpdateDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this user service update default response has a 4xx status code +func (o *UserServiceUpdateDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this user service update default response has a 5xx status code +func (o *UserServiceUpdateDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this user service update default response a status code equal to that given +func (o *UserServiceUpdateDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the user service update default response +func (o *UserServiceUpdateDefault) Code() int { + return o._statusCode +} + +func (o *UserServiceUpdateDefault) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/users/{user.id}][%d] UserService_Update default %s", o._statusCode, payload) +} + +func (o *UserServiceUpdateDefault) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/users/{user.id}][%d] UserService_Update default %s", o._statusCode, payload) +} + +func (o *UserServiceUpdateDefault) GetPayload() *models.RPCStatus { + return o.Payload +} + +func (o *UserServiceUpdateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +UserServiceUpdateBody user service update body +swagger:model UserServiceUpdateBody +*/ +type UserServiceUpdateBody struct { + + // user + User *UserServiceUpdateParamsBodyUser `json:"user,omitempty"` +} + +// Validate validates this user service update body +func (o *UserServiceUpdateBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateUser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *UserServiceUpdateBody) validateUser(formats strfmt.Registry) error { + if swag.IsZero(o.User) { // not required + return nil + } + + if o.User != nil { + if err := o.User.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "user") + } + return err + } + } + + return nil +} + +// ContextValidate validate this user service update body based on the context it is used +func (o *UserServiceUpdateBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *UserServiceUpdateBody) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { + + if o.User != nil { + + if swag.IsZero(o.User) { // not required + return nil + } + + if err := o.User.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "user") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *UserServiceUpdateBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *UserServiceUpdateBody) UnmarshalBinary(b []byte) error { + var res UserServiceUpdateBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +UserServiceUpdateParamsBodyUser User object. +swagger:model UserServiceUpdateParamsBodyUser +*/ +type UserServiceUpdateParamsBodyUser struct { + + // E-mail of the user. + Email string `json:"email,omitempty"` + + // Set to false to disable the user. + IsActive bool `json:"isActive,omitempty"` + + // Set to true to make the user a global administrator. + IsAdmin bool `json:"isAdmin,omitempty"` + + // Optional note to store with the user. + Note string `json:"note,omitempty"` +} + +// Validate validates this user service update params body user +func (o *UserServiceUpdateParamsBodyUser) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this user service update params body user based on context it is used +func (o *UserServiceUpdateParamsBodyUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *UserServiceUpdateParamsBodyUser) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *UserServiceUpdateParamsBodyUser) UnmarshalBinary(b []byte) error { + var res UserServiceUpdateParamsBodyUser + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_adr_algorithm_list_item.go b/internal/app/service/lora/chirp_stack/models/api_adr_algorithm_list_item.go new file mode 100644 index 0000000..346b30d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_adr_algorithm_list_item.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIAdrAlgorithmListItem api adr algorithm list item +// +// swagger:model apiAdrAlgorithmListItem +type APIAdrAlgorithmListItem struct { + + // Algorithm ID. + ID string `json:"id,omitempty"` + + // Algorithm name. + Name string `json:"name,omitempty"` +} + +// Validate validates this api adr algorithm list item +func (m *APIAdrAlgorithmListItem) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api adr algorithm list item based on context it is used +func (m *APIAdrAlgorithmListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIAdrAlgorithmListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIAdrAlgorithmListItem) UnmarshalBinary(b []byte) error { + var res APIAdrAlgorithmListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_app_layer_params.go b/internal/app/service/lora/chirp_stack/models/api_app_layer_params.go new file mode 100644 index 0000000..0c052e6 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_app_layer_params.go @@ -0,0 +1,220 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIAppLayerParams api app layer params +// +// swagger:model apiAppLayerParams +type APIAppLayerParams struct { + + // TS003 fPort. + Ts003FPort int64 `json:"ts003FPort,omitempty"` + + // TS003 version (Application Layer Clock Sync). + Ts003Version *APITs003Version `json:"ts003Version,omitempty"` + + // TS004 fPort. + Ts004FPort int64 `json:"ts004FPort,omitempty"` + + // TS004 version (Fragmented Data Block Transport). + Ts004Version *APITs004Version `json:"ts004Version,omitempty"` + + // TS005 fPort. + Ts005FPort int64 `json:"ts005FPort,omitempty"` + + // TS005 version (Remote Multicast Setup). + Ts005Version *APITs005Version `json:"ts005Version,omitempty"` +} + +// Validate validates this api app layer params +func (m *APIAppLayerParams) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTs003Version(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTs004Version(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTs005Version(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIAppLayerParams) validateTs003Version(formats strfmt.Registry) error { + if swag.IsZero(m.Ts003Version) { // not required + return nil + } + + if m.Ts003Version != nil { + if err := m.Ts003Version.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ts003Version") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ts003Version") + } + return err + } + } + + return nil +} + +func (m *APIAppLayerParams) validateTs004Version(formats strfmt.Registry) error { + if swag.IsZero(m.Ts004Version) { // not required + return nil + } + + if m.Ts004Version != nil { + if err := m.Ts004Version.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ts004Version") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ts004Version") + } + return err + } + } + + return nil +} + +func (m *APIAppLayerParams) validateTs005Version(formats strfmt.Registry) error { + if swag.IsZero(m.Ts005Version) { // not required + return nil + } + + if m.Ts005Version != nil { + if err := m.Ts005Version.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ts005Version") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ts005Version") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api app layer params based on the context it is used +func (m *APIAppLayerParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTs003Version(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTs004Version(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTs005Version(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIAppLayerParams) contextValidateTs003Version(ctx context.Context, formats strfmt.Registry) error { + + if m.Ts003Version != nil { + + if swag.IsZero(m.Ts003Version) { // not required + return nil + } + + if err := m.Ts003Version.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ts003Version") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ts003Version") + } + return err + } + } + + return nil +} + +func (m *APIAppLayerParams) contextValidateTs004Version(ctx context.Context, formats strfmt.Registry) error { + + if m.Ts004Version != nil { + + if swag.IsZero(m.Ts004Version) { // not required + return nil + } + + if err := m.Ts004Version.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ts004Version") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ts004Version") + } + return err + } + } + + return nil +} + +func (m *APIAppLayerParams) contextValidateTs005Version(ctx context.Context, formats strfmt.Registry) error { + + if m.Ts005Version != nil { + + if swag.IsZero(m.Ts005Version) { // not required + return nil + } + + if err := m.Ts005Version.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ts005Version") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ts005Version") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIAppLayerParams) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIAppLayerParams) UnmarshalBinary(b []byte) error { + var res APIAppLayerParams + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_application.go b/internal/app/service/lora/chirp_stack/models/api_application.go new file mode 100644 index 0000000..44f954a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_application.go @@ -0,0 +1,66 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIApplication api application +// +// swagger:model apiApplication +type APIApplication struct { + + // Application description. + Description string `json:"description,omitempty"` + + // Application ID (UUID). + // Note: on create this will be automatically generated. + ID string `json:"id,omitempty"` + + // Application name. + Name string `json:"name,omitempty"` + + // Tags (user defined). + // These tags can be used to add additional information to the application. + // These tags are exposed in all the integration events of devices under + // this application. + Tags map[string]string `json:"tags,omitempty"` + + // Tenant ID (UUID). + TenantID string `json:"tenantId,omitempty"` +} + +// Validate validates this api application +func (m *APIApplication) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api application based on context it is used +func (m *APIApplication) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIApplication) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIApplication) UnmarshalBinary(b []byte) error { + var res APIApplication + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_application_device_profile_list_item.go b/internal/app/service/lora/chirp_stack/models/api_application_device_profile_list_item.go new file mode 100644 index 0000000..9f8d76e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_application_device_profile_list_item.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIApplicationDeviceProfileListItem api application device profile list item +// +// swagger:model apiApplicationDeviceProfileListItem +type APIApplicationDeviceProfileListItem struct { + + // Device-profile ID (UUID). + ID string `json:"id,omitempty"` + + // Name. + Name string `json:"name,omitempty"` +} + +// Validate validates this api application device profile list item +func (m *APIApplicationDeviceProfileListItem) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api application device profile list item based on context it is used +func (m *APIApplicationDeviceProfileListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIApplicationDeviceProfileListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIApplicationDeviceProfileListItem) UnmarshalBinary(b []byte) error { + var res APIApplicationDeviceProfileListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_application_device_tag_list_item.go b/internal/app/service/lora/chirp_stack/models/api_application_device_tag_list_item.go new file mode 100644 index 0000000..5368087 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_application_device_tag_list_item.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIApplicationDeviceTagListItem api application device tag list item +// +// swagger:model apiApplicationDeviceTagListItem +type APIApplicationDeviceTagListItem struct { + + // Tag key. + Key string `json:"key,omitempty"` + + // Used values. + Values []string `json:"values"` +} + +// Validate validates this api application device tag list item +func (m *APIApplicationDeviceTagListItem) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api application device tag list item based on context it is used +func (m *APIApplicationDeviceTagListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIApplicationDeviceTagListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIApplicationDeviceTagListItem) UnmarshalBinary(b []byte) error { + var res APIApplicationDeviceTagListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_application_list_item.go b/internal/app/service/lora/chirp_stack/models/api_application_list_item.go new file mode 100644 index 0000000..4bb9591 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_application_list_item.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIApplicationListItem api application list item +// +// swagger:model apiApplicationListItem +type APIApplicationListItem struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Application description. + Description string `json:"description,omitempty"` + + // Application ID (UUID). + ID string `json:"id,omitempty"` + + // Application name. + Name string `json:"name,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api application list item +func (m *APIApplicationListItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIApplicationListItem) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIApplicationListItem) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this api application list item based on context it is used +func (m *APIApplicationListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIApplicationListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIApplicationListItem) UnmarshalBinary(b []byte) error { + var res APIApplicationListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_aws_sns_integration.go b/internal/app/service/lora/chirp_stack/models/api_aws_sns_integration.go new file mode 100644 index 0000000..0a38dab --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_aws_sns_integration.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIAwsSnsIntegration api aws sns integration +// +// swagger:model apiAwsSnsIntegration +type APIAwsSnsIntegration struct { + + // AWS Access Key ID. + AccessKeyID string `json:"accessKeyId,omitempty"` + + // Application ID (UUID). + ApplicationID string `json:"applicationId,omitempty"` + + // Encoding. + Encoding *APIEncoding `json:"encoding,omitempty"` + + // AWS region. + Region string `json:"region,omitempty"` + + // AWS Secret Access Key. + SecretAccessKey string `json:"secretAccessKey,omitempty"` + + // Topic ARN. + TopicArn string `json:"topicArn,omitempty"` +} + +// Validate validates this api aws sns integration +func (m *APIAwsSnsIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEncoding(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIAwsSnsIntegration) validateEncoding(formats strfmt.Registry) error { + if swag.IsZero(m.Encoding) { // not required + return nil + } + + if m.Encoding != nil { + if err := m.Encoding.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encoding") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api aws sns integration based on the context it is used +func (m *APIAwsSnsIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEncoding(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIAwsSnsIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error { + + if m.Encoding != nil { + + if swag.IsZero(m.Encoding) { // not required + return nil + } + + if err := m.Encoding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encoding") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIAwsSnsIntegration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIAwsSnsIntegration) UnmarshalBinary(b []byte) error { + var res APIAwsSnsIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_azure_service_bus_integration.go b/internal/app/service/lora/chirp_stack/models/api_azure_service_bus_integration.go new file mode 100644 index 0000000..65ca663 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_azure_service_bus_integration.go @@ -0,0 +1,119 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIAzureServiceBusIntegration api azure service bus integration +// +// swagger:model apiAzureServiceBusIntegration +type APIAzureServiceBusIntegration struct { + + // Application ID (UUID). + ApplicationID string `json:"applicationId,omitempty"` + + // Connection string. + ConnectionString string `json:"connectionString,omitempty"` + + // Encoding. + Encoding *APIEncoding `json:"encoding,omitempty"` + + // Publish name. + // This is the name of the topic or queue. + PublishName string `json:"publishName,omitempty"` +} + +// Validate validates this api azure service bus integration +func (m *APIAzureServiceBusIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEncoding(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIAzureServiceBusIntegration) validateEncoding(formats strfmt.Registry) error { + if swag.IsZero(m.Encoding) { // not required + return nil + } + + if m.Encoding != nil { + if err := m.Encoding.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encoding") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api azure service bus integration based on the context it is used +func (m *APIAzureServiceBusIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEncoding(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIAzureServiceBusIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error { + + if m.Encoding != nil { + + if swag.IsZero(m.Encoding) { // not required + return nil + } + + if err := m.Encoding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encoding") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIAzureServiceBusIntegration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIAzureServiceBusIntegration) UnmarshalBinary(b []byte) error { + var res APIAzureServiceBusIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_cad_periodicity.go b/internal/app/service/lora/chirp_stack/models/api_cad_periodicity.go new file mode 100644 index 0000000..6d75063 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_cad_periodicity.go @@ -0,0 +1,95 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APICadPeriodicity - SEC_1: 1 second. +// - MS_500: 500 milliseconds +// - MS_250: 250 milliseconds +// - MS_100: 100 milliseconds +// - MS_50: 50 milliseconds +// - MS_20: 20 milliseconds +// +// swagger:model apiCadPeriodicity +type APICadPeriodicity string + +func NewAPICadPeriodicity(value APICadPeriodicity) *APICadPeriodicity { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APICadPeriodicity. +func (m APICadPeriodicity) Pointer() *APICadPeriodicity { + return &m +} + +const ( + + // APICadPeriodicitySEC1 captures enum value "SEC_1" + APICadPeriodicitySEC1 APICadPeriodicity = "SEC_1" + + // APICadPeriodicityMS500 captures enum value "MS_500" + APICadPeriodicityMS500 APICadPeriodicity = "MS_500" + + // APICadPeriodicityMS250 captures enum value "MS_250" + APICadPeriodicityMS250 APICadPeriodicity = "MS_250" + + // APICadPeriodicityMS100 captures enum value "MS_100" + APICadPeriodicityMS100 APICadPeriodicity = "MS_100" + + // APICadPeriodicityMS50 captures enum value "MS_50" + APICadPeriodicityMS50 APICadPeriodicity = "MS_50" + + // APICadPeriodicityMS20 captures enum value "MS_20" + APICadPeriodicityMS20 APICadPeriodicity = "MS_20" +) + +// for schema +var apiCadPeriodicityEnum []interface{} + +func init() { + var res []APICadPeriodicity + if err := json.Unmarshal([]byte(`["SEC_1","MS_500","MS_250","MS_100","MS_50","MS_20"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiCadPeriodicityEnum = append(apiCadPeriodicityEnum, v) + } +} + +func (m APICadPeriodicity) validateAPICadPeriodicityEnum(path, location string, value APICadPeriodicity) error { + if err := validate.EnumCase(path, location, value, apiCadPeriodicityEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api cad periodicity +func (m APICadPeriodicity) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPICadPeriodicityEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api cad periodicity based on context it is used +func (m APICadPeriodicity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_codec_runtime.go b/internal/app/service/lora/chirp_stack/models/api_codec_runtime.go new file mode 100644 index 0000000..c408d8c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_codec_runtime.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APICodecRuntime - NONE: None. +// - CAYENNE_LPP: Cayenne LPP. +// - JS: JavaScript. +// +// swagger:model apiCodecRuntime +type APICodecRuntime string + +func NewAPICodecRuntime(value APICodecRuntime) *APICodecRuntime { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APICodecRuntime. +func (m APICodecRuntime) Pointer() *APICodecRuntime { + return &m +} + +const ( + + // APICodecRuntimeNONE captures enum value "NONE" + APICodecRuntimeNONE APICodecRuntime = "NONE" + + // APICodecRuntimeCAYENNELPP captures enum value "CAYENNE_LPP" + APICodecRuntimeCAYENNELPP APICodecRuntime = "CAYENNE_LPP" + + // APICodecRuntimeJS captures enum value "JS" + APICodecRuntimeJS APICodecRuntime = "JS" +) + +// for schema +var apiCodecRuntimeEnum []interface{} + +func init() { + var res []APICodecRuntime + if err := json.Unmarshal([]byte(`["NONE","CAYENNE_LPP","JS"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiCodecRuntimeEnum = append(apiCodecRuntimeEnum, v) + } +} + +func (m APICodecRuntime) validateAPICodecRuntimeEnum(path, location string, value APICodecRuntime) error { + if err := validate.EnumCase(path, location, value, apiCodecRuntimeEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api codec runtime +func (m APICodecRuntime) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPICodecRuntimeEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api codec runtime based on context it is used +func (m APICodecRuntime) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_create_application_request.go b/internal/app/service/lora/chirp_stack/models/api_create_application_request.go new file mode 100644 index 0000000..f3642ca --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_create_application_request.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APICreateApplicationRequest api create application request +// +// swagger:model apiCreateApplicationRequest +type APICreateApplicationRequest struct { + + // Application object to create. + Application *APIApplication `json:"application,omitempty"` +} + +// Validate validates this api create application request +func (m *APICreateApplicationRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateApplication(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateApplicationRequest) validateApplication(formats strfmt.Registry) error { + if swag.IsZero(m.Application) { // not required + return nil + } + + if m.Application != nil { + if err := m.Application.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("application") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api create application request based on the context it is used +func (m *APICreateApplicationRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateApplication(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateApplicationRequest) contextValidateApplication(ctx context.Context, formats strfmt.Registry) error { + + if m.Application != nil { + + if swag.IsZero(m.Application) { // not required + return nil + } + + if err := m.Application.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("application") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APICreateApplicationRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APICreateApplicationRequest) UnmarshalBinary(b []byte) error { + var res APICreateApplicationRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_create_application_response.go b/internal/app/service/lora/chirp_stack/models/api_create_application_response.go new file mode 100644 index 0000000..b30f58f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_create_application_response.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APICreateApplicationResponse api create application response +// +// swagger:model apiCreateApplicationResponse +type APICreateApplicationResponse struct { + + // Application ID (UUID). + ID string `json:"id,omitempty"` +} + +// Validate validates this api create application response +func (m *APICreateApplicationResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api create application response based on context it is used +func (m *APICreateApplicationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APICreateApplicationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APICreateApplicationResponse) UnmarshalBinary(b []byte) error { + var res APICreateApplicationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_create_device_profile_request.go b/internal/app/service/lora/chirp_stack/models/api_create_device_profile_request.go new file mode 100644 index 0000000..65532c8 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_create_device_profile_request.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APICreateDeviceProfileRequest api create device profile request +// +// swagger:model apiCreateDeviceProfileRequest +type APICreateDeviceProfileRequest struct { + + // Object to create. + DeviceProfile *APIDeviceProfile `json:"deviceProfile,omitempty"` +} + +// Validate validates this api create device profile request +func (m *APICreateDeviceProfileRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDeviceProfile(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateDeviceProfileRequest) validateDeviceProfile(formats strfmt.Registry) error { + if swag.IsZero(m.DeviceProfile) { // not required + return nil + } + + if m.DeviceProfile != nil { + if err := m.DeviceProfile.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceProfile") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api create device profile request based on the context it is used +func (m *APICreateDeviceProfileRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDeviceProfile(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateDeviceProfileRequest) contextValidateDeviceProfile(ctx context.Context, formats strfmt.Registry) error { + + if m.DeviceProfile != nil { + + if swag.IsZero(m.DeviceProfile) { // not required + return nil + } + + if err := m.DeviceProfile.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceProfile") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APICreateDeviceProfileRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APICreateDeviceProfileRequest) UnmarshalBinary(b []byte) error { + var res APICreateDeviceProfileRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_create_device_profile_response.go b/internal/app/service/lora/chirp_stack/models/api_create_device_profile_response.go new file mode 100644 index 0000000..8dcea32 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_create_device_profile_response.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APICreateDeviceProfileResponse api create device profile response +// +// swagger:model apiCreateDeviceProfileResponse +type APICreateDeviceProfileResponse struct { + + // ID (UUID). + ID string `json:"id,omitempty"` +} + +// Validate validates this api create device profile response +func (m *APICreateDeviceProfileResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api create device profile response based on context it is used +func (m *APICreateDeviceProfileResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APICreateDeviceProfileResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APICreateDeviceProfileResponse) UnmarshalBinary(b []byte) error { + var res APICreateDeviceProfileResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_create_device_profile_template_request.go b/internal/app/service/lora/chirp_stack/models/api_create_device_profile_template_request.go new file mode 100644 index 0000000..9f91fc5 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_create_device_profile_template_request.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APICreateDeviceProfileTemplateRequest api create device profile template request +// +// swagger:model apiCreateDeviceProfileTemplateRequest +type APICreateDeviceProfileTemplateRequest struct { + + // Object to create. + DeviceProfileTemplate *APIDeviceProfileTemplate `json:"deviceProfileTemplate,omitempty"` +} + +// Validate validates this api create device profile template request +func (m *APICreateDeviceProfileTemplateRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDeviceProfileTemplate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateDeviceProfileTemplateRequest) validateDeviceProfileTemplate(formats strfmt.Registry) error { + if swag.IsZero(m.DeviceProfileTemplate) { // not required + return nil + } + + if m.DeviceProfileTemplate != nil { + if err := m.DeviceProfileTemplate.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceProfileTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceProfileTemplate") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api create device profile template request based on the context it is used +func (m *APICreateDeviceProfileTemplateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDeviceProfileTemplate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateDeviceProfileTemplateRequest) contextValidateDeviceProfileTemplate(ctx context.Context, formats strfmt.Registry) error { + + if m.DeviceProfileTemplate != nil { + + if swag.IsZero(m.DeviceProfileTemplate) { // not required + return nil + } + + if err := m.DeviceProfileTemplate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceProfileTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceProfileTemplate") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APICreateDeviceProfileTemplateRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APICreateDeviceProfileTemplateRequest) UnmarshalBinary(b []byte) error { + var res APICreateDeviceProfileTemplateRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_create_device_request.go b/internal/app/service/lora/chirp_stack/models/api_create_device_request.go new file mode 100644 index 0000000..9e9935e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_create_device_request.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APICreateDeviceRequest api create device request +// +// swagger:model apiCreateDeviceRequest +type APICreateDeviceRequest struct { + + // Device object. + Device *APIDevice `json:"device,omitempty"` +} + +// Validate validates this api create device request +func (m *APICreateDeviceRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDevice(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateDeviceRequest) validateDevice(formats strfmt.Registry) error { + if swag.IsZero(m.Device) { // not required + return nil + } + + if m.Device != nil { + if err := m.Device.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("device") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("device") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api create device request based on the context it is used +func (m *APICreateDeviceRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDevice(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateDeviceRequest) contextValidateDevice(ctx context.Context, formats strfmt.Registry) error { + + if m.Device != nil { + + if swag.IsZero(m.Device) { // not required + return nil + } + + if err := m.Device.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("device") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("device") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APICreateDeviceRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APICreateDeviceRequest) UnmarshalBinary(b []byte) error { + var res APICreateDeviceRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_create_gateway_request.go b/internal/app/service/lora/chirp_stack/models/api_create_gateway_request.go new file mode 100644 index 0000000..f56f316 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_create_gateway_request.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APICreateGatewayRequest api create gateway request +// +// swagger:model apiCreateGatewayRequest +type APICreateGatewayRequest struct { + + // Gateway object. + Gateway *APIGateway `json:"gateway,omitempty"` +} + +// Validate validates this api create gateway request +func (m *APICreateGatewayRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateGateway(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateGatewayRequest) validateGateway(formats strfmt.Registry) error { + if swag.IsZero(m.Gateway) { // not required + return nil + } + + if m.Gateway != nil { + if err := m.Gateway.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gateway") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gateway") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api create gateway request based on the context it is used +func (m *APICreateGatewayRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGateway(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateGatewayRequest) contextValidateGateway(ctx context.Context, formats strfmt.Registry) error { + + if m.Gateway != nil { + + if swag.IsZero(m.Gateway) { // not required + return nil + } + + if err := m.Gateway.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gateway") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gateway") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APICreateGatewayRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APICreateGatewayRequest) UnmarshalBinary(b []byte) error { + var res APICreateGatewayRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_create_multicast_group_request.go b/internal/app/service/lora/chirp_stack/models/api_create_multicast_group_request.go new file mode 100644 index 0000000..0f5364c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_create_multicast_group_request.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APICreateMulticastGroupRequest api create multicast group request +// +// swagger:model apiCreateMulticastGroupRequest +type APICreateMulticastGroupRequest struct { + + // Multicast group to create. + MulticastGroup *APIMulticastGroup `json:"multicastGroup,omitempty"` +} + +// Validate validates this api create multicast group request +func (m *APICreateMulticastGroupRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMulticastGroup(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateMulticastGroupRequest) validateMulticastGroup(formats strfmt.Registry) error { + if swag.IsZero(m.MulticastGroup) { // not required + return nil + } + + if m.MulticastGroup != nil { + if err := m.MulticastGroup.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("multicastGroup") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("multicastGroup") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api create multicast group request based on the context it is used +func (m *APICreateMulticastGroupRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMulticastGroup(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateMulticastGroupRequest) contextValidateMulticastGroup(ctx context.Context, formats strfmt.Registry) error { + + if m.MulticastGroup != nil { + + if swag.IsZero(m.MulticastGroup) { // not required + return nil + } + + if err := m.MulticastGroup.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("multicastGroup") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("multicastGroup") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APICreateMulticastGroupRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APICreateMulticastGroupRequest) UnmarshalBinary(b []byte) error { + var res APICreateMulticastGroupRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_create_multicast_group_response.go b/internal/app/service/lora/chirp_stack/models/api_create_multicast_group_response.go new file mode 100644 index 0000000..1f7b25b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_create_multicast_group_response.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APICreateMulticastGroupResponse api create multicast group response +// +// swagger:model apiCreateMulticastGroupResponse +type APICreateMulticastGroupResponse struct { + + // ID of created multicast group (UUID). + ID string `json:"id,omitempty"` +} + +// Validate validates this api create multicast group response +func (m *APICreateMulticastGroupResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api create multicast group response based on context it is used +func (m *APICreateMulticastGroupResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APICreateMulticastGroupResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APICreateMulticastGroupResponse) UnmarshalBinary(b []byte) error { + var res APICreateMulticastGroupResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_create_tenant_request.go b/internal/app/service/lora/chirp_stack/models/api_create_tenant_request.go new file mode 100644 index 0000000..8529f9c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_create_tenant_request.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APICreateTenantRequest api create tenant request +// +// swagger:model apiCreateTenantRequest +type APICreateTenantRequest struct { + + // Tenant object to create. + Tenant *APITenant `json:"tenant,omitempty"` +} + +// Validate validates this api create tenant request +func (m *APICreateTenantRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTenant(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateTenantRequest) validateTenant(formats strfmt.Registry) error { + if swag.IsZero(m.Tenant) { // not required + return nil + } + + if m.Tenant != nil { + if err := m.Tenant.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tenant") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tenant") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api create tenant request based on the context it is used +func (m *APICreateTenantRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTenant(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateTenantRequest) contextValidateTenant(ctx context.Context, formats strfmt.Registry) error { + + if m.Tenant != nil { + + if swag.IsZero(m.Tenant) { // not required + return nil + } + + if err := m.Tenant.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tenant") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tenant") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APICreateTenantRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APICreateTenantRequest) UnmarshalBinary(b []byte) error { + var res APICreateTenantRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_create_tenant_response.go b/internal/app/service/lora/chirp_stack/models/api_create_tenant_response.go new file mode 100644 index 0000000..9d5f903 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_create_tenant_response.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APICreateTenantResponse api create tenant response +// +// swagger:model apiCreateTenantResponse +type APICreateTenantResponse struct { + + // Tenant ID. + ID string `json:"id,omitempty"` +} + +// Validate validates this api create tenant response +func (m *APICreateTenantResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api create tenant response based on context it is used +func (m *APICreateTenantResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APICreateTenantResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APICreateTenantResponse) UnmarshalBinary(b []byte) error { + var res APICreateTenantResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_create_user_request.go b/internal/app/service/lora/chirp_stack/models/api_create_user_request.go new file mode 100644 index 0000000..2e574d2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_create_user_request.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APICreateUserRequest api create user request +// +// swagger:model apiCreateUserRequest +type APICreateUserRequest struct { + + // Password to set for the user. + Password string `json:"password,omitempty"` + + // Add the user to the following tenants. + Tenants []*APIUserTenant `json:"tenants"` + + // User object to create. + User *APIUser `json:"user,omitempty"` +} + +// Validate validates this api create user request +func (m *APICreateUserRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTenants(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateUserRequest) validateTenants(formats strfmt.Registry) error { + if swag.IsZero(m.Tenants) { // not required + return nil + } + + for i := 0; i < len(m.Tenants); i++ { + if swag.IsZero(m.Tenants[i]) { // not required + continue + } + + if m.Tenants[i] != nil { + if err := m.Tenants[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tenants" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tenants" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *APICreateUserRequest) validateUser(formats strfmt.Registry) error { + if swag.IsZero(m.User) { // not required + return nil + } + + if m.User != nil { + if err := m.User.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api create user request based on the context it is used +func (m *APICreateUserRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTenants(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APICreateUserRequest) contextValidateTenants(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Tenants); i++ { + + if m.Tenants[i] != nil { + + if swag.IsZero(m.Tenants[i]) { // not required + return nil + } + + if err := m.Tenants[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tenants" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tenants" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *APICreateUserRequest) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { + + if m.User != nil { + + if swag.IsZero(m.User) { // not required + return nil + } + + if err := m.User.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APICreateUserRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APICreateUserRequest) UnmarshalBinary(b []byte) error { + var res APICreateUserRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_create_user_response.go b/internal/app/service/lora/chirp_stack/models/api_create_user_response.go new file mode 100644 index 0000000..29a6d90 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_create_user_response.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APICreateUserResponse api create user response +// +// swagger:model apiCreateUserResponse +type APICreateUserResponse struct { + + // User ID. + ID string `json:"id,omitempty"` +} + +// Validate validates this api create user response +func (m *APICreateUserResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api create user response based on context it is used +func (m *APICreateUserResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APICreateUserResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APICreateUserResponse) UnmarshalBinary(b []byte) error { + var res APICreateUserResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_device.go b/internal/app/service/lora/chirp_stack/models/api_device.go new file mode 100644 index 0000000..2b8cb44 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_device.go @@ -0,0 +1,87 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIDevice api device +// +// swagger:model apiDevice +type APIDevice struct { + + // Application ID (UUID). + ApplicationID string `json:"applicationId,omitempty"` + + // Description. + Description string `json:"description,omitempty"` + + // DevEUI (EUI64). + DevEui string `json:"devEui,omitempty"` + + // Device-profile ID (UUID). + DeviceProfileID string `json:"deviceProfileId,omitempty"` + + // Device is disabled. + IsDisabled bool `json:"isDisabled,omitempty"` + + // JoinEUI (optional, EUI64). + // This field will be automatically set / updated on OTAA. However, in some + // cases it must be pre-configured. For example to allow OTAA using a Relay. + // In this case the Relay needs to know the JoinEUI + DevEUI combinations + // of the devices for which it needs to forward uplinks. + JoinEui string `json:"joinEui,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Skip frame-counter checks (this is insecure, but could be helpful for + // debugging). + SkipFcntCheck bool `json:"skipFcntCheck,omitempty"` + + // Tags (user defined). + // These tags can be used to add additional information to the device. + // These tags are exposed in all the integration events. + Tags map[string]string `json:"tags,omitempty"` + + // Variables (user defined). + // These variables can be used together with integrations to store tokens / + // secrets that must be configured per device. These variables are not + // exposed in the event payloads. + Variables map[string]string `json:"variables,omitempty"` +} + +// Validate validates this api device +func (m *APIDevice) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api device based on context it is used +func (m *APIDevice) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIDevice) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIDevice) UnmarshalBinary(b []byte) error { + var res APIDevice + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_device_activation.go b/internal/app/service/lora/chirp_stack/models/api_device_activation.go new file mode 100644 index 0000000..9690b0d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_device_activation.go @@ -0,0 +1,77 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIDeviceActivation api device activation +// +// swagger:model apiDeviceActivation +type APIDeviceActivation struct { + + // Downlink application frame-counter. + AFCntDown int64 `json:"aFCntDown,omitempty"` + + // Application session key (HEX encoded). + AppSKey string `json:"appSKey,omitempty"` + + // Device address (HEX encoded). + DevAddr string `json:"devAddr,omitempty"` + + // Device EUI (EUI64). + DevEui string `json:"devEui,omitempty"` + + // Uplink frame-counter. + FCntUp int64 `json:"fCntUp,omitempty"` + + // Forwarding network session integrity key (HEX encoded). + // Note: For LoRaWAN 1.0.x devices, set this to the NwkSKey. + FNwkSIntKey string `json:"fNwkSIntKey,omitempty"` + + // Downlink network frame-counter. + NFCntDown int64 `json:"nFCntDown,omitempty"` + + // Network session encryption key (HEX encoded). + // Note: For LoRaWAN 1.0.x devices, set this to the NwkSKey. + NwkSEncKey string `json:"nwkSEncKey,omitempty"` + + // Serving network session integrity key (HEX encoded). + // Note: For LoRaWAN 1.0.x devices, set this to the NwkSKey. + SNwkSIntKey string `json:"sNwkSIntKey,omitempty"` +} + +// Validate validates this api device activation +func (m *APIDeviceActivation) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api device activation based on context it is used +func (m *APIDeviceActivation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIDeviceActivation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIDeviceActivation) UnmarshalBinary(b []byte) error { + var res APIDeviceActivation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_device_keys.go b/internal/app/service/lora/chirp_stack/models/api_device_keys.go new file mode 100644 index 0000000..201d8e5 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_device_keys.go @@ -0,0 +1,63 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIDeviceKeys api device keys +// +// swagger:model apiDeviceKeys +type APIDeviceKeys struct { + + // Application root key (128 bit). + // Note: This field only needs to be set for LoRaWAN 1.1.x devices! + AppKey string `json:"appKey,omitempty"` + + // DevEUI (EUI64). + DevEui string `json:"devEui,omitempty"` + + // Gen App Key (128 bit). + // Note: This field only needs to be set for LoRaWAN 1.0.x devices that + // implement TS005 (remote multicast setup). + GenAppKey string `json:"genAppKey,omitempty"` + + // Network root key (128 bit). + // Note: For LoRaWAN 1.0.x, use this field for the LoRaWAN 1.0.x 'AppKey`! + NwkKey string `json:"nwkKey,omitempty"` +} + +// Validate validates this api device keys +func (m *APIDeviceKeys) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api device keys based on context it is used +func (m *APIDeviceKeys) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIDeviceKeys) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIDeviceKeys) UnmarshalBinary(b []byte) error { + var res APIDeviceKeys + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_device_list_item.go b/internal/app/service/lora/chirp_stack/models/api_device_list_item.go new file mode 100644 index 0000000..b83b5b5 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_device_list_item.go @@ -0,0 +1,188 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIDeviceListItem api device list item +// +// swagger:model apiDeviceListItem +type APIDeviceListItem struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Description. + Description string `json:"description,omitempty"` + + // DevEUI (EUI64). + DevEui string `json:"devEui,omitempty"` + + // Device-profile ID (UUID). + DeviceProfileID string `json:"deviceProfileId,omitempty"` + + // Device-profile name. + DeviceProfileName string `json:"deviceProfileName,omitempty"` + + // Device status. + DeviceStatus *APIDeviceStatus `json:"deviceStatus,omitempty"` + + // Last seen at timestamp. + // Format: date-time + LastSeenAt strfmt.DateTime `json:"lastSeenAt,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Device tags. + Tags map[string]string `json:"tags,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api device list item +func (m *APIDeviceListItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDeviceStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastSeenAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIDeviceListItem) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIDeviceListItem) validateDeviceStatus(formats strfmt.Registry) error { + if swag.IsZero(m.DeviceStatus) { // not required + return nil + } + + if m.DeviceStatus != nil { + if err := m.DeviceStatus.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceStatus") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceStatus") + } + return err + } + } + + return nil +} + +func (m *APIDeviceListItem) validateLastSeenAt(formats strfmt.Registry) error { + if swag.IsZero(m.LastSeenAt) { // not required + return nil + } + + if err := validate.FormatOf("lastSeenAt", "body", "date-time", m.LastSeenAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIDeviceListItem) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api device list item based on the context it is used +func (m *APIDeviceListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDeviceStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIDeviceListItem) contextValidateDeviceStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.DeviceStatus != nil { + + if swag.IsZero(m.DeviceStatus) { // not required + return nil + } + + if err := m.DeviceStatus.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceStatus") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceStatus") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIDeviceListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIDeviceListItem) UnmarshalBinary(b []byte) error { + var res APIDeviceListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_device_profile.go b/internal/app/service/lora/chirp_stack/models/api_device_profile.go new file mode 100644 index 0000000..860feab --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_device_profile.go @@ -0,0 +1,773 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIDeviceProfile api device profile +// +// swagger:model apiDeviceProfile +type APIDeviceProfile struct { + + // RX1 delay (for ABP). + AbpRx1Delay int64 `json:"abpRx1Delay,omitempty"` + + // RX1 DR offset (for ABP). + AbpRx1DrOffset int64 `json:"abpRx1DrOffset,omitempty"` + + // RX2 DR (for ABP). + AbpRx2Dr int64 `json:"abpRx2Dr,omitempty"` + + // RX2 frequency (for ABP, Hz). + AbpRx2Freq int64 `json:"abpRx2Freq,omitempty"` + + // ADR algorithm ID. + AdrAlgorithmID string `json:"adrAlgorithmId,omitempty"` + + // Allow roaming. + // + // If set to true, it means that the device is allowed to use roaming. + AllowRoaming bool `json:"allowRoaming,omitempty"` + + // Application Layer parameters. + AppLayerParams *APIAppLayerParams `json:"appLayerParams,omitempty"` + + // Auto-detect measurements. + // If set to true, measurements will be automatically added based on the + // keys of the decoded payload. In cases where the decoded payload contains + // random keys in the data, you want to set this to false. + AutoDetectMeasurements bool `json:"autoDetectMeasurements,omitempty"` + + // Class-B ping-slot DR. + ClassBPingSlotDr int64 `json:"classBPingSlotDr,omitempty"` + + // Class-B ping-slot freq (Hz). + ClassBPingSlotFreq int64 `json:"classBPingSlotFreq,omitempty"` + + // Class-B ping-slot periodicity. + // Valid options are: 0 - 7. + // + // Number of ping-slots per beacon-period: + // pingNb = 2^(7-periodicity) + // + // Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec + // Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec + ClassBPingSlotPeriodicity int64 `json:"classBPingSlotPeriodicity,omitempty"` + + // Class-B timeout (seconds). + // This is the maximum time ChirpStack will wait to receive an acknowledgement + // from the device (if requested). + ClassBTimeout int64 `json:"classBTimeout,omitempty"` + + // Class-C timeout (seconds). + // This is the maximum time ChirpStack will wait to receive an acknowledgement + // from the device (if requested). + ClassCTimeout int64 `json:"classCTimeout,omitempty"` + + // Description. + Description string `json:"description,omitempty"` + + // Device-status request interval (times / day). + // This defines the times per day that ChirpStack will request the + // device-status from the device. + DeviceStatusReqInterval int64 `json:"deviceStatusReqInterval,omitempty"` + + // Flush queue on device activation. + FlushQueueOnActivate bool `json:"flushQueueOnActivate,omitempty"` + + // Device-profile ID (UUID). + // Note: on create this will be automatically generated. + ID string `json:"id,omitempty"` + + // Device is a Relay device. + // Enable this in case the device is a Relay. A Relay device implements TS011 + // and is able to relay data from relay capable devices. + // See for more information the TS011 specification. + IsRelay bool `json:"isRelay,omitempty"` + + // Device is a Relay end-device. + // Enable this in case the device is an end-device that can operate under a + // Relay. Please refer to the TS011 specification for more information. + IsRelayEd bool `json:"isRelayEd,omitempty"` + + // LoRaWAN mac-version. + MacVersion *CommonMacVersion `json:"macVersion,omitempty"` + + // Measurements. + // If defined, ChirpStack will visualize these metrics in the web-interface. + Measurements map[string]APIMeasurement `json:"measurements,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Payload codec runtime. + PayloadCodecRuntime *APICodecRuntime `json:"payloadCodecRuntime,omitempty"` + + // Payload codec script. + PayloadCodecScript string `json:"payloadCodecScript,omitempty"` + + // Regional parameters revision. + RegParamsRevision *CommonRegParamsRevision `json:"regParamsRevision,omitempty"` + + // Region. + Region *CommonRegion `json:"region,omitempty"` + + // Region configuration ID. + // If set, devices will only use the associated region. If let blank, then + // devices will use all regions matching the selected common-name. Note + // that multiple region configurations can exist for the same common-name, + // e.g. to provide an 8 channel and 16 channel configuration for the US915 + // band. + RegionConfigID string `json:"regionConfigId,omitempty"` + + // Relay CAD periodicity. + RelayCadPeriodicity *APICadPeriodicity `json:"relayCadPeriodicity,omitempty"` + + // Relay default channel index. + // Valid values are 0 and 1, please refer to the RP002 specification for + // the meaning of these values. + RelayDefaultChannelIndex int64 `json:"relayDefaultChannelIndex,omitempty"` + + // Relay end-device activation mode. + RelayEdActivationMode *APIRelayModeActivation `json:"relayEdActivationMode,omitempty"` + + // Relay end-device back-off (in case it does not receive WOR ACK frame). + // 0 = Always send a LoRaWAN uplink + // 1..63 = Send a LoRaWAN uplink after X WOR frames without a WOR ACK + RelayEdBackOff int64 `json:"relayEdBackOff,omitempty"` + + // End-device only accept data through relay. + // Only accept data for this device through a relay. This setting is useful + // for testing as in case of a test-setup, the end-device is usually within + // range of the gateway. + RelayEdRelayOnly bool `json:"relayEdRelayOnly,omitempty"` + + // Relay end-device smart-enable level. + RelayEdSmartEnableLevel int64 `json:"relayEdSmartEnableLevel,omitempty"` + + // Relay end-device uplink limit bucket size. + // + // This field indicates the multiplier to determine the bucket size + // according to the following formula: + // BucketSize TOKEN = _reload_rate x _bucket_size + // + // Valid values (0 - 3): + // 0 = 1 + // 1 = 2 + // 2 = 4 + // 3 = 12 + RelayEdUplinkLimitBucketSize int64 `json:"relayEdUplinkLimitBucketSize,omitempty"` + + // Relay end-device uplink limit reload rate. + // + // Valid values: + // * 0 - 62 = X tokens every hour + // * 63 = no limitation + RelayEdUplinkLimitReloadRate int64 `json:"relayEdUplinkLimitReloadRate,omitempty"` + + // Relay must be enabled. + RelayEnabled bool `json:"relayEnabled,omitempty"` + + // Relay globak uplink limit bucket size. + // + // This field indicates the multiplier to determine the bucket size + // according to the following formula: + // BucketSize TOKEN = _reload_rate x _bucket_size + // + // Valid values (0 - 3): + // 0 = 1 + // 1 = 2 + // 2 = 4 + // 3 = 12 + RelayGlobalUplinkLimitBucketSize int64 `json:"relayGlobalUplinkLimitBucketSize,omitempty"` + + // Relay global uplink limit reload rate. + // + // Valid values: + // * 0 - 126 = X tokens every hour + // * 127 = no limitation + RelayGlobalUplinkLimitReloadRate int64 `json:"relayGlobalUplinkLimitReloadRate,omitempty"` + + // Relay join-request limit bucket size. + // + // This field indicates the multiplier to determine the bucket size + // according to the following formula: + // BucketSize TOKEN = _reload_rate x _bucket_size + // + // Valid values (0 - 3): + // 0 = 1 + // 1 = 2 + // 2 = 4 + // 3 = 12 + RelayJoinReqLimitBucketSize int64 `json:"relayJoinReqLimitBucketSize,omitempty"` + + // Relay join-request limit reload rate. + // + // Valid values: + // * 0 - 126 = X tokens every hour + // * 127 = no limitation + RelayJoinReqLimitReloadRate int64 `json:"relayJoinReqLimitReloadRate,omitempty"` + + // Relay notify limit bucket size. + // + // This field indicates the multiplier to determine the bucket size + // according to the following formula: + // BucketSize TOKEN = _reload_rate x _bucket_size + // + // Valid values (0 - 3): + // 0 = 1 + // 1 = 2 + // 2 = 4 + // 3 = 12 + RelayNotifyLimitBucketSize int64 `json:"relayNotifyLimitBucketSize,omitempty"` + + // Relay notify limit reload rate. + // + // Valid values: + // * 0 - 126 = X tokens every hour + // * 127 = no limitation + RelayNotifyLimitReloadRate int64 `json:"relayNotifyLimitReloadRate,omitempty"` + + // Relay overall limit bucket size. + // + // This field indicates the multiplier to determine the bucket size + // according to the following formula: + // BucketSize TOKEN = _reload_rate x _bucket_size + // + // Valid values (0 - 3): + // 0 = 1 + // 1 = 2 + // 2 = 4 + // 3 = 12 + RelayOverallLimitBucketSize int64 `json:"relayOverallLimitBucketSize,omitempty"` + + // Relay overall limit reload rate. + // + // Valid values: + // * 0 - 126 = X tokens every hour + // * 127 = no limitation + RelayOverallLimitReloadRate int64 `json:"relayOverallLimitReloadRate,omitempty"` + + // Relay second channel ACK offset. + RelaySecondChannelAckOffset *APISecondChAckOffset `json:"relaySecondChannelAckOffset,omitempty"` + + // Relay second channel DR. + RelaySecondChannelDr int64 `json:"relaySecondChannelDr,omitempty"` + + // Relay second channel frequency (Hz). + RelaySecondChannelFreq int64 `json:"relaySecondChannelFreq,omitempty"` + + // RX1 Delay. + // + // This makes it possible to override the system RX1 Delay. Please note that + // this values only has effect in case it is higher than the system value. + // In other words, it can be used to increase the RX1 Delay but not to decrease + // it. + // Valid options are 1 - 15 (0 = always use system RX1 Delay). + Rx1Delay int64 `json:"rx1Delay,omitempty"` + + // Supports Class B. + SupportsClassB bool `json:"supportsClassB,omitempty"` + + // Supports Class-C. + SupportsClassC bool `json:"supportsClassC,omitempty"` + + // Supports OTAA. + SupportsOtaa bool `json:"supportsOtaa,omitempty"` + + // Tags (user defined). + // These tags can be used to add additional information the the + // device-profile. These tags are exposed in all the integration events of + // devices using this device-profile. + Tags map[string]string `json:"tags,omitempty"` + + // Tenant ID (UUID). + TenantID string `json:"tenantId,omitempty"` + + // Uplink interval (seconds). + // This defines the expected uplink interval which the device uses for + // communication. If the uplink interval has expired and no uplink has + // been received, the device is considered inactive. + UplinkInterval int64 `json:"uplinkInterval,omitempty"` +} + +// Validate validates this api device profile +func (m *APIDeviceProfile) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAppLayerParams(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMacVersion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMeasurements(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePayloadCodecRuntime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegParamsRevision(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRelayCadPeriodicity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRelayEdActivationMode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRelaySecondChannelAckOffset(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIDeviceProfile) validateAppLayerParams(formats strfmt.Registry) error { + if swag.IsZero(m.AppLayerParams) { // not required + return nil + } + + if m.AppLayerParams != nil { + if err := m.AppLayerParams.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("appLayerParams") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("appLayerParams") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) validateMacVersion(formats strfmt.Registry) error { + if swag.IsZero(m.MacVersion) { // not required + return nil + } + + if m.MacVersion != nil { + if err := m.MacVersion.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("macVersion") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("macVersion") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) validateMeasurements(formats strfmt.Registry) error { + if swag.IsZero(m.Measurements) { // not required + return nil + } + + for k := range m.Measurements { + + if err := validate.Required("measurements"+"."+k, "body", m.Measurements[k]); err != nil { + return err + } + if val, ok := m.Measurements[k]; ok { + if err := val.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("measurements" + "." + k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("measurements" + "." + k) + } + return err + } + } + + } + + return nil +} + +func (m *APIDeviceProfile) validatePayloadCodecRuntime(formats strfmt.Registry) error { + if swag.IsZero(m.PayloadCodecRuntime) { // not required + return nil + } + + if m.PayloadCodecRuntime != nil { + if err := m.PayloadCodecRuntime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("payloadCodecRuntime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("payloadCodecRuntime") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) validateRegParamsRevision(formats strfmt.Registry) error { + if swag.IsZero(m.RegParamsRevision) { // not required + return nil + } + + if m.RegParamsRevision != nil { + if err := m.RegParamsRevision.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("regParamsRevision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("regParamsRevision") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) validateRegion(formats strfmt.Registry) error { + if swag.IsZero(m.Region) { // not required + return nil + } + + if m.Region != nil { + if err := m.Region.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) validateRelayCadPeriodicity(formats strfmt.Registry) error { + if swag.IsZero(m.RelayCadPeriodicity) { // not required + return nil + } + + if m.RelayCadPeriodicity != nil { + if err := m.RelayCadPeriodicity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relayCadPeriodicity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relayCadPeriodicity") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) validateRelayEdActivationMode(formats strfmt.Registry) error { + if swag.IsZero(m.RelayEdActivationMode) { // not required + return nil + } + + if m.RelayEdActivationMode != nil { + if err := m.RelayEdActivationMode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relayEdActivationMode") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relayEdActivationMode") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) validateRelaySecondChannelAckOffset(formats strfmt.Registry) error { + if swag.IsZero(m.RelaySecondChannelAckOffset) { // not required + return nil + } + + if m.RelaySecondChannelAckOffset != nil { + if err := m.RelaySecondChannelAckOffset.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relaySecondChannelAckOffset") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relaySecondChannelAckOffset") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api device profile based on the context it is used +func (m *APIDeviceProfile) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAppLayerParams(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMacVersion(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMeasurements(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePayloadCodecRuntime(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRegParamsRevision(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRegion(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRelayCadPeriodicity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRelayEdActivationMode(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRelaySecondChannelAckOffset(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIDeviceProfile) contextValidateAppLayerParams(ctx context.Context, formats strfmt.Registry) error { + + if m.AppLayerParams != nil { + + if swag.IsZero(m.AppLayerParams) { // not required + return nil + } + + if err := m.AppLayerParams.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("appLayerParams") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("appLayerParams") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) contextValidateMacVersion(ctx context.Context, formats strfmt.Registry) error { + + if m.MacVersion != nil { + + if swag.IsZero(m.MacVersion) { // not required + return nil + } + + if err := m.MacVersion.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("macVersion") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("macVersion") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) contextValidateMeasurements(ctx context.Context, formats strfmt.Registry) error { + + for k := range m.Measurements { + + if val, ok := m.Measurements[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + return nil +} + +func (m *APIDeviceProfile) contextValidatePayloadCodecRuntime(ctx context.Context, formats strfmt.Registry) error { + + if m.PayloadCodecRuntime != nil { + + if swag.IsZero(m.PayloadCodecRuntime) { // not required + return nil + } + + if err := m.PayloadCodecRuntime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("payloadCodecRuntime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("payloadCodecRuntime") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) contextValidateRegParamsRevision(ctx context.Context, formats strfmt.Registry) error { + + if m.RegParamsRevision != nil { + + if swag.IsZero(m.RegParamsRevision) { // not required + return nil + } + + if err := m.RegParamsRevision.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("regParamsRevision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("regParamsRevision") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error { + + if m.Region != nil { + + if swag.IsZero(m.Region) { // not required + return nil + } + + if err := m.Region.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) contextValidateRelayCadPeriodicity(ctx context.Context, formats strfmt.Registry) error { + + if m.RelayCadPeriodicity != nil { + + if swag.IsZero(m.RelayCadPeriodicity) { // not required + return nil + } + + if err := m.RelayCadPeriodicity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relayCadPeriodicity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relayCadPeriodicity") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) contextValidateRelayEdActivationMode(ctx context.Context, formats strfmt.Registry) error { + + if m.RelayEdActivationMode != nil { + + if swag.IsZero(m.RelayEdActivationMode) { // not required + return nil + } + + if err := m.RelayEdActivationMode.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relayEdActivationMode") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relayEdActivationMode") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfile) contextValidateRelaySecondChannelAckOffset(ctx context.Context, formats strfmt.Registry) error { + + if m.RelaySecondChannelAckOffset != nil { + + if swag.IsZero(m.RelaySecondChannelAckOffset) { // not required + return nil + } + + if err := m.RelaySecondChannelAckOffset.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relaySecondChannelAckOffset") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relaySecondChannelAckOffset") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIDeviceProfile) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIDeviceProfile) UnmarshalBinary(b []byte) error { + var res APIDeviceProfile + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_device_profile_list_item.go b/internal/app/service/lora/chirp_stack/models/api_device_profile_list_item.go new file mode 100644 index 0000000..476c7ab --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_device_profile_list_item.go @@ -0,0 +1,267 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIDeviceProfileListItem api device profile list item +// +// swagger:model apiDeviceProfileListItem +type APIDeviceProfileListItem struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Device-profile ID (UUID). + ID string `json:"id,omitempty"` + + // LoRaWAN mac-version. + MacVersion *CommonMacVersion `json:"macVersion,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Regional parameters revision. + RegParamsRevision *CommonRegParamsRevision `json:"regParamsRevision,omitempty"` + + // Region. + Region *CommonRegion `json:"region,omitempty"` + + // Supports Class-B. + SupportsClassB bool `json:"supportsClassB,omitempty"` + + // Supports Class-C. + SupportsClassC bool `json:"supportsClassC,omitempty"` + + // Supports OTAA. + SupportsOtaa bool `json:"supportsOtaa,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api device profile list item +func (m *APIDeviceProfileListItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMacVersion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegParamsRevision(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIDeviceProfileListItem) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIDeviceProfileListItem) validateMacVersion(formats strfmt.Registry) error { + if swag.IsZero(m.MacVersion) { // not required + return nil + } + + if m.MacVersion != nil { + if err := m.MacVersion.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("macVersion") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("macVersion") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileListItem) validateRegParamsRevision(formats strfmt.Registry) error { + if swag.IsZero(m.RegParamsRevision) { // not required + return nil + } + + if m.RegParamsRevision != nil { + if err := m.RegParamsRevision.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("regParamsRevision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("regParamsRevision") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileListItem) validateRegion(formats strfmt.Registry) error { + if swag.IsZero(m.Region) { // not required + return nil + } + + if m.Region != nil { + if err := m.Region.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileListItem) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api device profile list item based on the context it is used +func (m *APIDeviceProfileListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMacVersion(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRegParamsRevision(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRegion(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIDeviceProfileListItem) contextValidateMacVersion(ctx context.Context, formats strfmt.Registry) error { + + if m.MacVersion != nil { + + if swag.IsZero(m.MacVersion) { // not required + return nil + } + + if err := m.MacVersion.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("macVersion") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("macVersion") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileListItem) contextValidateRegParamsRevision(ctx context.Context, formats strfmt.Registry) error { + + if m.RegParamsRevision != nil { + + if swag.IsZero(m.RegParamsRevision) { // not required + return nil + } + + if err := m.RegParamsRevision.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("regParamsRevision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("regParamsRevision") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileListItem) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error { + + if m.Region != nil { + + if swag.IsZero(m.Region) { // not required + return nil + } + + if err := m.Region.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIDeviceProfileListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIDeviceProfileListItem) UnmarshalBinary(b []byte) error { + var res APIDeviceProfileListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_device_profile_template.go b/internal/app/service/lora/chirp_stack/models/api_device_profile_template.go new file mode 100644 index 0000000..47c16a5 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_device_profile_template.go @@ -0,0 +1,405 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIDeviceProfileTemplate api device profile template +// +// swagger:model apiDeviceProfileTemplate +type APIDeviceProfileTemplate struct { + + // RX1 delay (for ABP). + AbpRx1Delay int64 `json:"abpRx1Delay,omitempty"` + + // RX1 DR offset (for ABP). + AbpRx1DrOffset int64 `json:"abpRx1DrOffset,omitempty"` + + // RX2 DR (for ABP). + AbpRx2Dr int64 `json:"abpRx2Dr,omitempty"` + + // RX2 frequency (for ABP, Hz). + AbpRx2Freq int64 `json:"abpRx2Freq,omitempty"` + + // ADR algorithm ID. + AdrAlgorithmID string `json:"adrAlgorithmId,omitempty"` + + // Auto-detect measurements. + // If set to true, measurements will be automatically added based on the + // keys of the decoded payload. In cases where the decoded payload contains + // random keys in the data, you want to set this to false. + AutoDetectMeasurements bool `json:"autoDetectMeasurements,omitempty"` + + // Class-B ping-slot DR. + ClassBPingSlotDr int64 `json:"classBPingSlotDr,omitempty"` + + // Class-B ping-slot freq (Hz). + ClassBPingSlotFreq int64 `json:"classBPingSlotFreq,omitempty"` + + // Class-B ping-slot periodicity (only for Class-B). + // Valid options are: 0 - 7. + // + // Number of ping-slots per beacon-period: + // pingNb = 2^(7-periodicity) + // + // Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec + // Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec + ClassBPingSlotPeriodicity int64 `json:"classBPingSlotPeriodicity,omitempty"` + + // Class-B timeout (seconds). + // This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested). + ClassBTimeout int64 `json:"classBTimeout,omitempty"` + + // Class-C timeout (seconds). + // This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested). + ClassCTimeout int64 `json:"classCTimeout,omitempty"` + + // Description. + Description string `json:"description,omitempty"` + + // Device-status request interval (times / day). + // This defines the times per day that ChirpStack will request the device-status + // from the device. + DeviceStatusReqInterval int64 `json:"deviceStatusReqInterval,omitempty"` + + // Firmware. + Firmware string `json:"firmware,omitempty"` + + // Flush queue on device activation. + FlushQueueOnActivate bool `json:"flushQueueOnActivate,omitempty"` + + // Device-profile template ID. + ID string `json:"id,omitempty"` + + // LoRaWAN mac-version. + MacVersion *CommonMacVersion `json:"macVersion,omitempty"` + + // Measurements. + // If defined, ChirpStack will visualize these metrics in the web-interface. + Measurements map[string]APIMeasurement `json:"measurements,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Payload codec runtime. + PayloadCodecRuntime *APICodecRuntime `json:"payloadCodecRuntime,omitempty"` + + // Payload codec script. + PayloadCodecScript string `json:"payloadCodecScript,omitempty"` + + // Regional parameters revision. + RegParamsRevision *CommonRegParamsRevision `json:"regParamsRevision,omitempty"` + + // Region. + Region *CommonRegion `json:"region,omitempty"` + + // Supports Class B. + SupportsClassB bool `json:"supportsClassB,omitempty"` + + // Supports Class-C. + SupportsClassC bool `json:"supportsClassC,omitempty"` + + // Supports OTAA. + SupportsOtaa bool `json:"supportsOtaa,omitempty"` + + // User defined tags. + Tags map[string]string `json:"tags,omitempty"` + + // Uplink interval (seconds). + // This defines the expected uplink interval which the device uses for + // communication. When the uplink interval has expired and no uplink has + // been received, the device is considered inactive. + UplinkInterval int64 `json:"uplinkInterval,omitempty"` + + // Vendor. + Vendor string `json:"vendor,omitempty"` +} + +// Validate validates this api device profile template +func (m *APIDeviceProfileTemplate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMacVersion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMeasurements(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePayloadCodecRuntime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegParamsRevision(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIDeviceProfileTemplate) validateMacVersion(formats strfmt.Registry) error { + if swag.IsZero(m.MacVersion) { // not required + return nil + } + + if m.MacVersion != nil { + if err := m.MacVersion.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("macVersion") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("macVersion") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileTemplate) validateMeasurements(formats strfmt.Registry) error { + if swag.IsZero(m.Measurements) { // not required + return nil + } + + for k := range m.Measurements { + + if err := validate.Required("measurements"+"."+k, "body", m.Measurements[k]); err != nil { + return err + } + if val, ok := m.Measurements[k]; ok { + if err := val.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("measurements" + "." + k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("measurements" + "." + k) + } + return err + } + } + + } + + return nil +} + +func (m *APIDeviceProfileTemplate) validatePayloadCodecRuntime(formats strfmt.Registry) error { + if swag.IsZero(m.PayloadCodecRuntime) { // not required + return nil + } + + if m.PayloadCodecRuntime != nil { + if err := m.PayloadCodecRuntime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("payloadCodecRuntime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("payloadCodecRuntime") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileTemplate) validateRegParamsRevision(formats strfmt.Registry) error { + if swag.IsZero(m.RegParamsRevision) { // not required + return nil + } + + if m.RegParamsRevision != nil { + if err := m.RegParamsRevision.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("regParamsRevision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("regParamsRevision") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileTemplate) validateRegion(formats strfmt.Registry) error { + if swag.IsZero(m.Region) { // not required + return nil + } + + if m.Region != nil { + if err := m.Region.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api device profile template based on the context it is used +func (m *APIDeviceProfileTemplate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMacVersion(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMeasurements(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePayloadCodecRuntime(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRegParamsRevision(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRegion(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIDeviceProfileTemplate) contextValidateMacVersion(ctx context.Context, formats strfmt.Registry) error { + + if m.MacVersion != nil { + + if swag.IsZero(m.MacVersion) { // not required + return nil + } + + if err := m.MacVersion.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("macVersion") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("macVersion") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileTemplate) contextValidateMeasurements(ctx context.Context, formats strfmt.Registry) error { + + for k := range m.Measurements { + + if val, ok := m.Measurements[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + return nil +} + +func (m *APIDeviceProfileTemplate) contextValidatePayloadCodecRuntime(ctx context.Context, formats strfmt.Registry) error { + + if m.PayloadCodecRuntime != nil { + + if swag.IsZero(m.PayloadCodecRuntime) { // not required + return nil + } + + if err := m.PayloadCodecRuntime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("payloadCodecRuntime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("payloadCodecRuntime") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileTemplate) contextValidateRegParamsRevision(ctx context.Context, formats strfmt.Registry) error { + + if m.RegParamsRevision != nil { + + if swag.IsZero(m.RegParamsRevision) { // not required + return nil + } + + if err := m.RegParamsRevision.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("regParamsRevision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("regParamsRevision") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileTemplate) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error { + + if m.Region != nil { + + if swag.IsZero(m.Region) { // not required + return nil + } + + if err := m.Region.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIDeviceProfileTemplate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIDeviceProfileTemplate) UnmarshalBinary(b []byte) error { + var res APIDeviceProfileTemplate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_device_profile_template_list_item.go b/internal/app/service/lora/chirp_stack/models/api_device_profile_template_list_item.go new file mode 100644 index 0000000..2249cf8 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_device_profile_template_list_item.go @@ -0,0 +1,273 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIDeviceProfileTemplateListItem api device profile template list item +// +// swagger:model apiDeviceProfileTemplateListItem +type APIDeviceProfileTemplateListItem struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Firmware. + Firmware string `json:"firmware,omitempty"` + + // Device-profile template ID. + ID string `json:"id,omitempty"` + + // LoRaWAN mac-version. + MacVersion *CommonMacVersion `json:"macVersion,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Regional parameters revision. + RegParamsRevision *CommonRegParamsRevision `json:"regParamsRevision,omitempty"` + + // Region. + Region *CommonRegion `json:"region,omitempty"` + + // Supports Class-B. + SupportsClassB bool `json:"supportsClassB,omitempty"` + + // Supports Class-C. + SupportsClassC bool `json:"supportsClassC,omitempty"` + + // Supports OTAA. + SupportsOtaa bool `json:"supportsOtaa,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` + + // Vendor. + Vendor string `json:"vendor,omitempty"` +} + +// Validate validates this api device profile template list item +func (m *APIDeviceProfileTemplateListItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMacVersion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegParamsRevision(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIDeviceProfileTemplateListItem) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIDeviceProfileTemplateListItem) validateMacVersion(formats strfmt.Registry) error { + if swag.IsZero(m.MacVersion) { // not required + return nil + } + + if m.MacVersion != nil { + if err := m.MacVersion.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("macVersion") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("macVersion") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileTemplateListItem) validateRegParamsRevision(formats strfmt.Registry) error { + if swag.IsZero(m.RegParamsRevision) { // not required + return nil + } + + if m.RegParamsRevision != nil { + if err := m.RegParamsRevision.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("regParamsRevision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("regParamsRevision") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileTemplateListItem) validateRegion(formats strfmt.Registry) error { + if swag.IsZero(m.Region) { // not required + return nil + } + + if m.Region != nil { + if err := m.Region.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileTemplateListItem) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api device profile template list item based on the context it is used +func (m *APIDeviceProfileTemplateListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMacVersion(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRegParamsRevision(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRegion(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIDeviceProfileTemplateListItem) contextValidateMacVersion(ctx context.Context, formats strfmt.Registry) error { + + if m.MacVersion != nil { + + if swag.IsZero(m.MacVersion) { // not required + return nil + } + + if err := m.MacVersion.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("macVersion") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("macVersion") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileTemplateListItem) contextValidateRegParamsRevision(ctx context.Context, formats strfmt.Registry) error { + + if m.RegParamsRevision != nil { + + if swag.IsZero(m.RegParamsRevision) { // not required + return nil + } + + if err := m.RegParamsRevision.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("regParamsRevision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("regParamsRevision") + } + return err + } + } + + return nil +} + +func (m *APIDeviceProfileTemplateListItem) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error { + + if m.Region != nil { + + if swag.IsZero(m.Region) { // not required + return nil + } + + if err := m.Region.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIDeviceProfileTemplateListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIDeviceProfileTemplateListItem) UnmarshalBinary(b []byte) error { + var res APIDeviceProfileTemplateListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_device_queue_item.go b/internal/app/service/lora/chirp_stack/models/api_device_queue_item.go new file mode 100644 index 0000000..9aec97c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_device_queue_item.go @@ -0,0 +1,115 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIDeviceQueueItem api device queue item +// +// swagger:model apiDeviceQueueItem +type APIDeviceQueueItem struct { + + // Confirmed. + Confirmed bool `json:"confirmed,omitempty"` + + // Data. + // Or use the json_object field when a codec has been configured. + // Format: byte + Data strfmt.Base64 `json:"data,omitempty"` + + // Device EUI (EUI64). + DevEui string `json:"devEui,omitempty"` + + // Expires at (optional). + // Expired queue-items will be automatically removed from the queue. + // Format: date-time + ExpiresAt strfmt.DateTime `json:"expiresAt,omitempty"` + + // Downlink frame-counter. + // Do not set this for plain-text data payloads. It will be automatically set + // by ChirpStack when the payload has been sent as downlink. + FCntDown int64 `json:"fCntDown,omitempty"` + + // FPort (must be > 0). + // On enqueue and if using a JavaScript codec, this value might be + // automatically set by the codec function. + FPort int64 `json:"fPort,omitempty"` + + // ID (UUID). + // This is automatically generated on enqueue. + ID string `json:"id,omitempty"` + + // Is encrypted. + // This must be set to true if the end-application has already encrypted + // the data payload. In this case, the f_cnt_down field must be set to + // the corresponding frame-counter which has been used during the encryption. + IsEncrypted bool `json:"isEncrypted,omitempty"` + + // Is pending. + // This is set by ChirpStack to true when the downlink is pending (e.g. it + // has been sent, but a confirmation is still pending). + IsPending bool `json:"isPending,omitempty"` + + // Only use this when a codec has been configured that can encode this + // object to bytes. + Object interface{} `json:"object,omitempty"` +} + +// Validate validates this api device queue item +func (m *APIDeviceQueueItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateExpiresAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIDeviceQueueItem) validateExpiresAt(formats strfmt.Registry) error { + if swag.IsZero(m.ExpiresAt) { // not required + return nil + } + + if err := validate.FormatOf("expiresAt", "body", "date-time", m.ExpiresAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this api device queue item based on context it is used +func (m *APIDeviceQueueItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIDeviceQueueItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIDeviceQueueItem) UnmarshalBinary(b []byte) error { + var res APIDeviceQueueItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_device_state.go b/internal/app/service/lora/chirp_stack/models/api_device_state.go new file mode 100644 index 0000000..117744a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_device_state.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIDeviceState api device state +// +// swagger:model apiDeviceState +type APIDeviceState struct { + + // Name. + Name string `json:"name,omitempty"` + + // Value. + Value string `json:"value,omitempty"` +} + +// Validate validates this api device state +func (m *APIDeviceState) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api device state based on context it is used +func (m *APIDeviceState) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIDeviceState) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIDeviceState) UnmarshalBinary(b []byte) error { + var res APIDeviceState + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_device_status.go b/internal/app/service/lora/chirp_stack/models/api_device_status.go new file mode 100644 index 0000000..a3e8232 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_device_status.go @@ -0,0 +1,58 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIDeviceStatus api device status +// +// swagger:model apiDeviceStatus +type APIDeviceStatus struct { + + // Device battery level as a percentage. + // -1 when the battery level is not available. + BatteryLevel float32 `json:"batteryLevel,omitempty"` + + // Device is connected to an external power source. + ExternalPowerSource bool `json:"externalPowerSource,omitempty"` + + // The device margin status + // -32..32: The demodulation SNR ration in dB + Margin int32 `json:"margin,omitempty"` +} + +// Validate validates this api device status +func (m *APIDeviceStatus) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api device status based on context it is used +func (m *APIDeviceStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIDeviceStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIDeviceStatus) UnmarshalBinary(b []byte) error { + var res APIDeviceStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_encoding.go b/internal/app/service/lora/chirp_stack/models/api_encoding.go new file mode 100644 index 0000000..d9a7011 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_encoding.go @@ -0,0 +1,78 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APIEncoding api encoding +// +// swagger:model apiEncoding +type APIEncoding string + +func NewAPIEncoding(value APIEncoding) *APIEncoding { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APIEncoding. +func (m APIEncoding) Pointer() *APIEncoding { + return &m +} + +const ( + + // APIEncodingJSON captures enum value "JSON" + APIEncodingJSON APIEncoding = "JSON" + + // APIEncodingPROTOBUF captures enum value "PROTOBUF" + APIEncodingPROTOBUF APIEncoding = "PROTOBUF" +) + +// for schema +var apiEncodingEnum []interface{} + +func init() { + var res []APIEncoding + if err := json.Unmarshal([]byte(`["JSON","PROTOBUF"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiEncodingEnum = append(apiEncodingEnum, v) + } +} + +func (m APIEncoding) validateAPIEncodingEnum(path, location string, value APIEncoding) error { + if err := validate.EnumCase(path, location, value, apiEncodingEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api encoding +func (m APIEncoding) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPIEncodingEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api encoding based on context it is used +func (m APIEncoding) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_enqueue_device_queue_item_response.go b/internal/app/service/lora/chirp_stack/models/api_enqueue_device_queue_item_response.go new file mode 100644 index 0000000..9464cf6 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_enqueue_device_queue_item_response.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIEnqueueDeviceQueueItemResponse api enqueue device queue item response +// +// swagger:model apiEnqueueDeviceQueueItemResponse +type APIEnqueueDeviceQueueItemResponse struct { + + // ID (UUID). + ID string `json:"id,omitempty"` +} + +// Validate validates this api enqueue device queue item response +func (m *APIEnqueueDeviceQueueItemResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api enqueue device queue item response based on context it is used +func (m *APIEnqueueDeviceQueueItemResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIEnqueueDeviceQueueItemResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIEnqueueDeviceQueueItemResponse) UnmarshalBinary(b []byte) error { + var res APIEnqueueDeviceQueueItemResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_enqueue_multicast_group_queue_item_response.go b/internal/app/service/lora/chirp_stack/models/api_enqueue_multicast_group_queue_item_response.go new file mode 100644 index 0000000..7fb18bc --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_enqueue_multicast_group_queue_item_response.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIEnqueueMulticastGroupQueueItemResponse api enqueue multicast group queue item response +// +// swagger:model apiEnqueueMulticastGroupQueueItemResponse +type APIEnqueueMulticastGroupQueueItemResponse struct { + + // Frame-counter of the enqueued payload. + FCnt int64 `json:"fCnt,omitempty"` +} + +// Validate validates this api enqueue multicast group queue item response +func (m *APIEnqueueMulticastGroupQueueItemResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api enqueue multicast group queue item response based on context it is used +func (m *APIEnqueueMulticastGroupQueueItemResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIEnqueueMulticastGroupQueueItemResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIEnqueueMulticastGroupQueueItemResponse) UnmarshalBinary(b []byte) error { + var res APIEnqueueMulticastGroupQueueItemResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_gateway.go b/internal/app/service/lora/chirp_stack/models/api_gateway.go new file mode 100644 index 0000000..030f332 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_gateway.go @@ -0,0 +1,132 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGateway api gateway +// +// swagger:model apiGateway +type APIGateway struct { + + // Description. + Description string `json:"description,omitempty"` + + // Gateway ID (EUI64). + GatewayID string `json:"gatewayId,omitempty"` + + // Gateway location. + Location *CommonLocation `json:"location,omitempty"` + + // Metadata (provided by the gateway). + Metadata map[string]string `json:"metadata,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Stats interval (seconds). + // This defines the expected interval in which the gateway sends its + // statistics. + StatsInterval int64 `json:"statsInterval,omitempty"` + + // Tags. + Tags map[string]string `json:"tags,omitempty"` + + // Tenant ID (UUID). + TenantID string `json:"tenantId,omitempty"` +} + +// Validate validates this api gateway +func (m *APIGateway) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLocation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGateway) validateLocation(formats strfmt.Registry) error { + if swag.IsZero(m.Location) { // not required + return nil + } + + if m.Location != nil { + if err := m.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api gateway based on the context it is used +func (m *APIGateway) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLocation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGateway) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { + + if m.Location != nil { + + if swag.IsZero(m.Location) { // not required + return nil + } + + if err := m.Location.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGateway) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGateway) UnmarshalBinary(b []byte) error { + var res APIGateway + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_gateway_list_item.go b/internal/app/service/lora/chirp_stack/models/api_gateway_list_item.go new file mode 100644 index 0000000..70c975f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_gateway_list_item.go @@ -0,0 +1,238 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGatewayListItem api gateway list item +// +// swagger:model apiGatewayListItem +type APIGatewayListItem struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Description. + Description string `json:"description,omitempty"` + + // Gateway ID (EUI64). + GatewayID string `json:"gatewayId,omitempty"` + + // Last seen at timestamp. + // Format: date-time + LastSeenAt strfmt.DateTime `json:"lastSeenAt,omitempty"` + + // Location. + Location *CommonLocation `json:"location,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Gateway properties. + Properties map[string]string `json:"properties,omitempty"` + + // Gateway state. + // Please note that the state of the gateway is driven by the stats + // packages that are sent by the gateway. + State *APIGatewayState `json:"state,omitempty"` + + // Tenant ID. + TenantID string `json:"tenantId,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api gateway list item +func (m *APIGatewayListItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastSeenAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLocation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGatewayListItem) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGatewayListItem) validateLastSeenAt(formats strfmt.Registry) error { + if swag.IsZero(m.LastSeenAt) { // not required + return nil + } + + if err := validate.FormatOf("lastSeenAt", "body", "date-time", m.LastSeenAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGatewayListItem) validateLocation(formats strfmt.Registry) error { + if swag.IsZero(m.Location) { // not required + return nil + } + + if m.Location != nil { + if err := m.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +func (m *APIGatewayListItem) validateState(formats strfmt.Registry) error { + if swag.IsZero(m.State) { // not required + return nil + } + + if m.State != nil { + if err := m.State.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("state") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("state") + } + return err + } + } + + return nil +} + +func (m *APIGatewayListItem) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api gateway list item based on the context it is used +func (m *APIGatewayListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLocation(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateState(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGatewayListItem) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { + + if m.Location != nil { + + if swag.IsZero(m.Location) { // not required + return nil + } + + if err := m.Location.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +func (m *APIGatewayListItem) contextValidateState(ctx context.Context, formats strfmt.Registry) error { + + if m.State != nil { + + if swag.IsZero(m.State) { // not required + return nil + } + + if err := m.State.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("state") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("state") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGatewayListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGatewayListItem) UnmarshalBinary(b []byte) error { + var res APIGatewayListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_gateway_state.go b/internal/app/service/lora/chirp_stack/models/api_gateway_state.go new file mode 100644 index 0000000..2515070 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_gateway_state.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APIGatewayState - NEVER_SEEN: The gateway has never sent any stats. +// - ONLINE: Online. +// - OFFLINE: Offline. +// +// swagger:model apiGatewayState +type APIGatewayState string + +func NewAPIGatewayState(value APIGatewayState) *APIGatewayState { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APIGatewayState. +func (m APIGatewayState) Pointer() *APIGatewayState { + return &m +} + +const ( + + // APIGatewayStateNEVERSEEN captures enum value "NEVER_SEEN" + APIGatewayStateNEVERSEEN APIGatewayState = "NEVER_SEEN" + + // APIGatewayStateONLINE captures enum value "ONLINE" + APIGatewayStateONLINE APIGatewayState = "ONLINE" + + // APIGatewayStateOFFLINE captures enum value "OFFLINE" + APIGatewayStateOFFLINE APIGatewayState = "OFFLINE" +) + +// for schema +var apiGatewayStateEnum []interface{} + +func init() { + var res []APIGatewayState + if err := json.Unmarshal([]byte(`["NEVER_SEEN","ONLINE","OFFLINE"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiGatewayStateEnum = append(apiGatewayStateEnum, v) + } +} + +func (m APIGatewayState) validateAPIGatewayStateEnum(path, location string, value APIGatewayState) error { + if err := validate.EnumCase(path, location, value, apiGatewayStateEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api gateway state +func (m APIGatewayState) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPIGatewayStateEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api gateway state based on context it is used +func (m APIGatewayState) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_gcp_pub_sub_integration.go b/internal/app/service/lora/chirp_stack/models/api_gcp_pub_sub_integration.go new file mode 100644 index 0000000..138388d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_gcp_pub_sub_integration.go @@ -0,0 +1,125 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGcpPubSubIntegration api gcp pub sub integration +// +// swagger:model apiGcpPubSubIntegration +type APIGcpPubSubIntegration struct { + + // Application ID (UUID). + ApplicationID string `json:"applicationId,omitempty"` + + // Credentials file. + // This IAM service-account credentials file (JSON) must have the following + // Pub/Sub roles: + // * Pub/Sub Publisher + CredentialsFile string `json:"credentialsFile,omitempty"` + + // Encoding. + Encoding *APIEncoding `json:"encoding,omitempty"` + + // Project ID. + ProjectID string `json:"projectId,omitempty"` + + // Topic name. + // This is the name of the Pub/Sub topic. + TopicName string `json:"topicName,omitempty"` +} + +// Validate validates this api gcp pub sub integration +func (m *APIGcpPubSubIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEncoding(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGcpPubSubIntegration) validateEncoding(formats strfmt.Registry) error { + if swag.IsZero(m.Encoding) { // not required + return nil + } + + if m.Encoding != nil { + if err := m.Encoding.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encoding") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api gcp pub sub integration based on the context it is used +func (m *APIGcpPubSubIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEncoding(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGcpPubSubIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error { + + if m.Encoding != nil { + + if swag.IsZero(m.Encoding) { // not required + return nil + } + + if err := m.Encoding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encoding") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGcpPubSubIntegration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGcpPubSubIntegration) UnmarshalBinary(b []byte) error { + var res APIGcpPubSubIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_generate_gateway_client_certificate_response.go b/internal/app/service/lora/chirp_stack/models/api_generate_gateway_client_certificate_response.go new file mode 100644 index 0000000..a9ba421 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_generate_gateway_client_certificate_response.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGenerateGatewayClientCertificateResponse api generate gateway client certificate response +// +// swagger:model apiGenerateGatewayClientCertificateResponse +type APIGenerateGatewayClientCertificateResponse struct { + + // CA certificate. + CaCert string `json:"caCert,omitempty"` + + // Expires at defines the expiration date of the certificate. + // Format: date-time + ExpiresAt strfmt.DateTime `json:"expiresAt,omitempty"` + + // TLS certificate. + TLSCert string `json:"tlsCert,omitempty"` + + // TLS key. + TLSKey string `json:"tlsKey,omitempty"` +} + +// Validate validates this api generate gateway client certificate response +func (m *APIGenerateGatewayClientCertificateResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateExpiresAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGenerateGatewayClientCertificateResponse) validateExpiresAt(formats strfmt.Registry) error { + if swag.IsZero(m.ExpiresAt) { // not required + return nil + } + + if err := validate.FormatOf("expiresAt", "body", "date-time", m.ExpiresAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this api generate gateway client certificate response based on context it is used +func (m *APIGenerateGatewayClientCertificateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIGenerateGatewayClientCertificateResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGenerateGatewayClientCertificateResponse) UnmarshalBinary(b []byte) error { + var res APIGenerateGatewayClientCertificateResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_generate_mqtt_integration_client_certificate_response.go b/internal/app/service/lora/chirp_stack/models/api_generate_mqtt_integration_client_certificate_response.go new file mode 100644 index 0000000..fffdb1a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_generate_mqtt_integration_client_certificate_response.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGenerateMqttIntegrationClientCertificateResponse api generate mqtt integration client certificate response +// +// swagger:model apiGenerateMqttIntegrationClientCertificateResponse +type APIGenerateMqttIntegrationClientCertificateResponse struct { + + // CA certificate. + CaCert string `json:"caCert,omitempty"` + + // Expires at defines the expiration date of the certificate. + // Format: date-time + ExpiresAt strfmt.DateTime `json:"expiresAt,omitempty"` + + // TLS certificate. + TLSCert string `json:"tlsCert,omitempty"` + + // TLS key. + TLSKey string `json:"tlsKey,omitempty"` +} + +// Validate validates this api generate mqtt integration client certificate response +func (m *APIGenerateMqttIntegrationClientCertificateResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateExpiresAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGenerateMqttIntegrationClientCertificateResponse) validateExpiresAt(formats strfmt.Registry) error { + if swag.IsZero(m.ExpiresAt) { // not required + return nil + } + + if err := validate.FormatOf("expiresAt", "body", "date-time", m.ExpiresAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this api generate mqtt integration client certificate response based on context it is used +func (m *APIGenerateMqttIntegrationClientCertificateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIGenerateMqttIntegrationClientCertificateResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGenerateMqttIntegrationClientCertificateResponse) UnmarshalBinary(b []byte) error { + var res APIGenerateMqttIntegrationClientCertificateResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_application_response.go b/internal/app/service/lora/chirp_stack/models/api_get_application_response.go new file mode 100644 index 0000000..f1bd336 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_application_response.go @@ -0,0 +1,155 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGetApplicationResponse api get application response +// +// swagger:model apiGetApplicationResponse +type APIGetApplicationResponse struct { + + // Application object. + Application *APIApplication `json:"application,omitempty"` + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Measurement keys. + // This contains the measurement keys from all the device-profiles that + // are used by the devices under this application. + MeasurementKeys []string `json:"measurementKeys"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api get application response +func (m *APIGetApplicationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateApplication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetApplicationResponse) validateApplication(formats strfmt.Registry) error { + if swag.IsZero(m.Application) { // not required + return nil + } + + if m.Application != nil { + if err := m.Application.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("application") + } + return err + } + } + + return nil +} + +func (m *APIGetApplicationResponse) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetApplicationResponse) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api get application response based on the context it is used +func (m *APIGetApplicationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateApplication(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetApplicationResponse) contextValidateApplication(ctx context.Context, formats strfmt.Registry) error { + + if m.Application != nil { + + if swag.IsZero(m.Application) { // not required + return nil + } + + if err := m.Application.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("application") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetApplicationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetApplicationResponse) UnmarshalBinary(b []byte) error { + var res APIGetApplicationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_aws_sns_integration_response.go b/internal/app/service/lora/chirp_stack/models/api_get_aws_sns_integration_response.go new file mode 100644 index 0000000..780a691 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_aws_sns_integration_response.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetAwsSnsIntegrationResponse api get aws sns integration response +// +// swagger:model apiGetAwsSnsIntegrationResponse +type APIGetAwsSnsIntegrationResponse struct { + + // Integration object. + Integration *APIAwsSnsIntegration `json:"integration,omitempty"` +} + +// Validate validates this api get aws sns integration response +func (m *APIGetAwsSnsIntegrationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetAwsSnsIntegrationResponse) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(m.Integration) { // not required + return nil + } + + if m.Integration != nil { + if err := m.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get aws sns integration response based on the context it is used +func (m *APIGetAwsSnsIntegrationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetAwsSnsIntegrationResponse) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if m.Integration != nil { + + if swag.IsZero(m.Integration) { // not required + return nil + } + + if err := m.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetAwsSnsIntegrationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetAwsSnsIntegrationResponse) UnmarshalBinary(b []byte) error { + var res APIGetAwsSnsIntegrationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_azure_service_bus_integration_response.go b/internal/app/service/lora/chirp_stack/models/api_get_azure_service_bus_integration_response.go new file mode 100644 index 0000000..8c16cb2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_azure_service_bus_integration_response.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetAzureServiceBusIntegrationResponse api get azure service bus integration response +// +// swagger:model apiGetAzureServiceBusIntegrationResponse +type APIGetAzureServiceBusIntegrationResponse struct { + + // Integration object. + Integration *APIAzureServiceBusIntegration `json:"integration,omitempty"` +} + +// Validate validates this api get azure service bus integration response +func (m *APIGetAzureServiceBusIntegrationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetAzureServiceBusIntegrationResponse) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(m.Integration) { // not required + return nil + } + + if m.Integration != nil { + if err := m.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get azure service bus integration response based on the context it is used +func (m *APIGetAzureServiceBusIntegrationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetAzureServiceBusIntegrationResponse) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if m.Integration != nil { + + if swag.IsZero(m.Integration) { // not required + return nil + } + + if err := m.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetAzureServiceBusIntegrationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetAzureServiceBusIntegrationResponse) UnmarshalBinary(b []byte) error { + var res APIGetAzureServiceBusIntegrationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_device_activation_response.go b/internal/app/service/lora/chirp_stack/models/api_get_device_activation_response.go new file mode 100644 index 0000000..f676481 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_device_activation_response.go @@ -0,0 +1,163 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetDeviceActivationResponse api get device activation response +// +// swagger:model apiGetDeviceActivationResponse +type APIGetDeviceActivationResponse struct { + + // Device activation object. + DeviceActivation *APIDeviceActivation `json:"deviceActivation,omitempty"` + + // Join-Server context. + // A non-empty value indicatest that ChirpStack does not have access to + // the AppSKey and that the encryption / decryption of the payloads is + // the responsibility of the end-application. + JoinServerContext *CommonJoinServerContext `json:"joinServerContext,omitempty"` +} + +// Validate validates this api get device activation response +func (m *APIGetDeviceActivationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDeviceActivation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateJoinServerContext(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceActivationResponse) validateDeviceActivation(formats strfmt.Registry) error { + if swag.IsZero(m.DeviceActivation) { // not required + return nil + } + + if m.DeviceActivation != nil { + if err := m.DeviceActivation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceActivation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceActivation") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceActivationResponse) validateJoinServerContext(formats strfmt.Registry) error { + if swag.IsZero(m.JoinServerContext) { // not required + return nil + } + + if m.JoinServerContext != nil { + if err := m.JoinServerContext.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("joinServerContext") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("joinServerContext") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get device activation response based on the context it is used +func (m *APIGetDeviceActivationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDeviceActivation(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateJoinServerContext(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceActivationResponse) contextValidateDeviceActivation(ctx context.Context, formats strfmt.Registry) error { + + if m.DeviceActivation != nil { + + if swag.IsZero(m.DeviceActivation) { // not required + return nil + } + + if err := m.DeviceActivation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceActivation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceActivation") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceActivationResponse) contextValidateJoinServerContext(ctx context.Context, formats strfmt.Registry) error { + + if m.JoinServerContext != nil { + + if swag.IsZero(m.JoinServerContext) { // not required + return nil + } + + if err := m.JoinServerContext.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("joinServerContext") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("joinServerContext") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetDeviceActivationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetDeviceActivationResponse) UnmarshalBinary(b []byte) error { + var res APIGetDeviceActivationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_device_keys_response.go b/internal/app/service/lora/chirp_stack/models/api_get_device_keys_response.go new file mode 100644 index 0000000..fe71086 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_device_keys_response.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGetDeviceKeysResponse api get device keys response +// +// swagger:model apiGetDeviceKeysResponse +type APIGetDeviceKeysResponse struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Device-keys object. + DeviceKeys *APIDeviceKeys `json:"deviceKeys,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api get device keys response +func (m *APIGetDeviceKeysResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDeviceKeys(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceKeysResponse) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetDeviceKeysResponse) validateDeviceKeys(formats strfmt.Registry) error { + if swag.IsZero(m.DeviceKeys) { // not required + return nil + } + + if m.DeviceKeys != nil { + if err := m.DeviceKeys.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceKeys") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceKeys") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceKeysResponse) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api get device keys response based on the context it is used +func (m *APIGetDeviceKeysResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDeviceKeys(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceKeysResponse) contextValidateDeviceKeys(ctx context.Context, formats strfmt.Registry) error { + + if m.DeviceKeys != nil { + + if swag.IsZero(m.DeviceKeys) { // not required + return nil + } + + if err := m.DeviceKeys.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceKeys") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceKeys") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetDeviceKeysResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetDeviceKeysResponse) UnmarshalBinary(b []byte) error { + var res APIGetDeviceKeysResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_device_link_metrics_response.go b/internal/app/service/lora/chirp_stack/models/api_get_device_link_metrics_response.go new file mode 100644 index 0000000..93501b2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_device_link_metrics_response.go @@ -0,0 +1,364 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetDeviceLinkMetricsResponse api get device link metrics response +// +// swagger:model apiGetDeviceLinkMetricsResponse +type APIGetDeviceLinkMetricsResponse struct { + + // Errors. + Errors *CommonMetric `json:"errors,omitempty"` + + // RSSI (as reported by the gateway(s)). + GwRssi *CommonMetric `json:"gwRssi,omitempty"` + + // SNR (as reported by the gateway(s)). + GwSnr *CommonMetric `json:"gwSnr,omitempty"` + + // Packets received from the device. + RxPackets *CommonMetric `json:"rxPackets,omitempty"` + + // Packets received by DR. + RxPacketsPerDr *CommonMetric `json:"rxPacketsPerDr,omitempty"` + + // Packets received by frequency. + RxPacketsPerFreq *CommonMetric `json:"rxPacketsPerFreq,omitempty"` +} + +// Validate validates this api get device link metrics response +func (m *APIGetDeviceLinkMetricsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateErrors(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGwRssi(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGwSnr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRxPackets(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRxPacketsPerDr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRxPacketsPerFreq(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceLinkMetricsResponse) validateErrors(formats strfmt.Registry) error { + if swag.IsZero(m.Errors) { // not required + return nil + } + + if m.Errors != nil { + if err := m.Errors.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("errors") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("errors") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceLinkMetricsResponse) validateGwRssi(formats strfmt.Registry) error { + if swag.IsZero(m.GwRssi) { // not required + return nil + } + + if m.GwRssi != nil { + if err := m.GwRssi.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gwRssi") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gwRssi") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceLinkMetricsResponse) validateGwSnr(formats strfmt.Registry) error { + if swag.IsZero(m.GwSnr) { // not required + return nil + } + + if m.GwSnr != nil { + if err := m.GwSnr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gwSnr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gwSnr") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceLinkMetricsResponse) validateRxPackets(formats strfmt.Registry) error { + if swag.IsZero(m.RxPackets) { // not required + return nil + } + + if m.RxPackets != nil { + if err := m.RxPackets.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rxPackets") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rxPackets") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceLinkMetricsResponse) validateRxPacketsPerDr(formats strfmt.Registry) error { + if swag.IsZero(m.RxPacketsPerDr) { // not required + return nil + } + + if m.RxPacketsPerDr != nil { + if err := m.RxPacketsPerDr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rxPacketsPerDr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rxPacketsPerDr") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceLinkMetricsResponse) validateRxPacketsPerFreq(formats strfmt.Registry) error { + if swag.IsZero(m.RxPacketsPerFreq) { // not required + return nil + } + + if m.RxPacketsPerFreq != nil { + if err := m.RxPacketsPerFreq.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rxPacketsPerFreq") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rxPacketsPerFreq") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get device link metrics response based on the context it is used +func (m *APIGetDeviceLinkMetricsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateErrors(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGwRssi(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGwSnr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRxPackets(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRxPacketsPerDr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRxPacketsPerFreq(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceLinkMetricsResponse) contextValidateErrors(ctx context.Context, formats strfmt.Registry) error { + + if m.Errors != nil { + + if swag.IsZero(m.Errors) { // not required + return nil + } + + if err := m.Errors.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("errors") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("errors") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceLinkMetricsResponse) contextValidateGwRssi(ctx context.Context, formats strfmt.Registry) error { + + if m.GwRssi != nil { + + if swag.IsZero(m.GwRssi) { // not required + return nil + } + + if err := m.GwRssi.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gwRssi") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gwRssi") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceLinkMetricsResponse) contextValidateGwSnr(ctx context.Context, formats strfmt.Registry) error { + + if m.GwSnr != nil { + + if swag.IsZero(m.GwSnr) { // not required + return nil + } + + if err := m.GwSnr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gwSnr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gwSnr") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceLinkMetricsResponse) contextValidateRxPackets(ctx context.Context, formats strfmt.Registry) error { + + if m.RxPackets != nil { + + if swag.IsZero(m.RxPackets) { // not required + return nil + } + + if err := m.RxPackets.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rxPackets") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rxPackets") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceLinkMetricsResponse) contextValidateRxPacketsPerDr(ctx context.Context, formats strfmt.Registry) error { + + if m.RxPacketsPerDr != nil { + + if swag.IsZero(m.RxPacketsPerDr) { // not required + return nil + } + + if err := m.RxPacketsPerDr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rxPacketsPerDr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rxPacketsPerDr") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceLinkMetricsResponse) contextValidateRxPacketsPerFreq(ctx context.Context, formats strfmt.Registry) error { + + if m.RxPacketsPerFreq != nil { + + if swag.IsZero(m.RxPacketsPerFreq) { // not required + return nil + } + + if err := m.RxPacketsPerFreq.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rxPacketsPerFreq") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rxPacketsPerFreq") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetDeviceLinkMetricsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetDeviceLinkMetricsResponse) UnmarshalBinary(b []byte) error { + var res APIGetDeviceLinkMetricsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_device_metrics_response.go b/internal/app/service/lora/chirp_stack/models/api_get_device_metrics_response.go new file mode 100644 index 0000000..e99d937 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_device_metrics_response.go @@ -0,0 +1,163 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGetDeviceMetricsResponse api get device metrics response +// +// swagger:model apiGetDeviceMetricsResponse +type APIGetDeviceMetricsResponse struct { + + // metrics + Metrics map[string]CommonMetric `json:"metrics,omitempty"` + + // states + States map[string]APIDeviceState `json:"states,omitempty"` +} + +// Validate validates this api get device metrics response +func (m *APIGetDeviceMetricsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMetrics(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStates(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceMetricsResponse) validateMetrics(formats strfmt.Registry) error { + if swag.IsZero(m.Metrics) { // not required + return nil + } + + for k := range m.Metrics { + + if err := validate.Required("metrics"+"."+k, "body", m.Metrics[k]); err != nil { + return err + } + if val, ok := m.Metrics[k]; ok { + if err := val.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metrics" + "." + k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metrics" + "." + k) + } + return err + } + } + + } + + return nil +} + +func (m *APIGetDeviceMetricsResponse) validateStates(formats strfmt.Registry) error { + if swag.IsZero(m.States) { // not required + return nil + } + + for k := range m.States { + + if err := validate.Required("states"+"."+k, "body", m.States[k]); err != nil { + return err + } + if val, ok := m.States[k]; ok { + if err := val.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("states" + "." + k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("states" + "." + k) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api get device metrics response based on the context it is used +func (m *APIGetDeviceMetricsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMetrics(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStates(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceMetricsResponse) contextValidateMetrics(ctx context.Context, formats strfmt.Registry) error { + + for k := range m.Metrics { + + if val, ok := m.Metrics[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + return nil +} + +func (m *APIGetDeviceMetricsResponse) contextValidateStates(ctx context.Context, formats strfmt.Registry) error { + + for k := range m.States { + + if val, ok := m.States[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetDeviceMetricsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetDeviceMetricsResponse) UnmarshalBinary(b []byte) error { + var res APIGetDeviceMetricsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_device_next_f_cnt_down_response.go b/internal/app/service/lora/chirp_stack/models/api_get_device_next_f_cnt_down_response.go new file mode 100644 index 0000000..e443a08 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_device_next_f_cnt_down_response.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetDeviceNextFCntDownResponse api get device next f cnt down response +// +// swagger:model apiGetDeviceNextFCntDownResponse +type APIGetDeviceNextFCntDownResponse struct { + + // FCntDown. + FCntDown int64 `json:"fCntDown,omitempty"` +} + +// Validate validates this api get device next f cnt down response +func (m *APIGetDeviceNextFCntDownResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api get device next f cnt down response based on context it is used +func (m *APIGetDeviceNextFCntDownResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetDeviceNextFCntDownResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetDeviceNextFCntDownResponse) UnmarshalBinary(b []byte) error { + var res APIGetDeviceNextFCntDownResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_device_profile_response.go b/internal/app/service/lora/chirp_stack/models/api_get_device_profile_response.go new file mode 100644 index 0000000..9d6e6ba --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_device_profile_response.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGetDeviceProfileResponse api get device profile response +// +// swagger:model apiGetDeviceProfileResponse +type APIGetDeviceProfileResponse struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Device-profile object. + DeviceProfile *APIDeviceProfile `json:"deviceProfile,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api get device profile response +func (m *APIGetDeviceProfileResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDeviceProfile(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceProfileResponse) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetDeviceProfileResponse) validateDeviceProfile(formats strfmt.Registry) error { + if swag.IsZero(m.DeviceProfile) { // not required + return nil + } + + if m.DeviceProfile != nil { + if err := m.DeviceProfile.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceProfile") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceProfileResponse) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api get device profile response based on the context it is used +func (m *APIGetDeviceProfileResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDeviceProfile(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceProfileResponse) contextValidateDeviceProfile(ctx context.Context, formats strfmt.Registry) error { + + if m.DeviceProfile != nil { + + if swag.IsZero(m.DeviceProfile) { // not required + return nil + } + + if err := m.DeviceProfile.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceProfile") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetDeviceProfileResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetDeviceProfileResponse) UnmarshalBinary(b []byte) error { + var res APIGetDeviceProfileResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_device_profile_template_response.go b/internal/app/service/lora/chirp_stack/models/api_get_device_profile_template_response.go new file mode 100644 index 0000000..45909e6 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_device_profile_template_response.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGetDeviceProfileTemplateResponse api get device profile template response +// +// swagger:model apiGetDeviceProfileTemplateResponse +type APIGetDeviceProfileTemplateResponse struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Device-profile template object. + DeviceProfileTemplate *APIDeviceProfileTemplate `json:"deviceProfileTemplate,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api get device profile template response +func (m *APIGetDeviceProfileTemplateResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDeviceProfileTemplate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceProfileTemplateResponse) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetDeviceProfileTemplateResponse) validateDeviceProfileTemplate(formats strfmt.Registry) error { + if swag.IsZero(m.DeviceProfileTemplate) { // not required + return nil + } + + if m.DeviceProfileTemplate != nil { + if err := m.DeviceProfileTemplate.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceProfileTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceProfileTemplate") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceProfileTemplateResponse) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api get device profile template response based on the context it is used +func (m *APIGetDeviceProfileTemplateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDeviceProfileTemplate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceProfileTemplateResponse) contextValidateDeviceProfileTemplate(ctx context.Context, formats strfmt.Registry) error { + + if m.DeviceProfileTemplate != nil { + + if swag.IsZero(m.DeviceProfileTemplate) { // not required + return nil + } + + if err := m.DeviceProfileTemplate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceProfileTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceProfileTemplate") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetDeviceProfileTemplateResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetDeviceProfileTemplateResponse) UnmarshalBinary(b []byte) error { + var res APIGetDeviceProfileTemplateResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_device_queue_items_response.go b/internal/app/service/lora/chirp_stack/models/api_get_device_queue_items_response.go new file mode 100644 index 0000000..337b96f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_device_queue_items_response.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetDeviceQueueItemsResponse api get device queue items response +// +// swagger:model apiGetDeviceQueueItemsResponse +type APIGetDeviceQueueItemsResponse struct { + + // Result-set. + Result []*APIDeviceQueueItem `json:"result"` + + // Total number of queue items. + TotalCount int64 `json:"totalCount,omitempty"` +} + +// Validate validates this api get device queue items response +func (m *APIGetDeviceQueueItemsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceQueueItemsResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api get device queue items response based on the context it is used +func (m *APIGetDeviceQueueItemsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceQueueItemsResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetDeviceQueueItemsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetDeviceQueueItemsResponse) UnmarshalBinary(b []byte) error { + var res APIGetDeviceQueueItemsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_device_response.go b/internal/app/service/lora/chirp_stack/models/api_get_device_response.go new file mode 100644 index 0000000..2558856 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_device_response.go @@ -0,0 +1,272 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGetDeviceResponse api get device response +// +// swagger:model apiGetDeviceResponse +type APIGetDeviceResponse struct { + + // Enabled device class. + ClassEnabled *CommonDeviceClass `json:"classEnabled,omitempty"` + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Device object. + Device *APIDevice `json:"device,omitempty"` + + // Device status. + DeviceStatus *APIDeviceStatus `json:"deviceStatus,omitempty"` + + // Last seen at timestamp. + // Format: date-time + LastSeenAt strfmt.DateTime `json:"lastSeenAt,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api get device response +func (m *APIGetDeviceResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClassEnabled(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDevice(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDeviceStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastSeenAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceResponse) validateClassEnabled(formats strfmt.Registry) error { + if swag.IsZero(m.ClassEnabled) { // not required + return nil + } + + if m.ClassEnabled != nil { + if err := m.ClassEnabled.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classEnabled") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classEnabled") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceResponse) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetDeviceResponse) validateDevice(formats strfmt.Registry) error { + if swag.IsZero(m.Device) { // not required + return nil + } + + if m.Device != nil { + if err := m.Device.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("device") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("device") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceResponse) validateDeviceStatus(formats strfmt.Registry) error { + if swag.IsZero(m.DeviceStatus) { // not required + return nil + } + + if m.DeviceStatus != nil { + if err := m.DeviceStatus.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceStatus") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceStatus") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceResponse) validateLastSeenAt(formats strfmt.Registry) error { + if swag.IsZero(m.LastSeenAt) { // not required + return nil + } + + if err := validate.FormatOf("lastSeenAt", "body", "date-time", m.LastSeenAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetDeviceResponse) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api get device response based on the context it is used +func (m *APIGetDeviceResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClassEnabled(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDevice(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDeviceStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetDeviceResponse) contextValidateClassEnabled(ctx context.Context, formats strfmt.Registry) error { + + if m.ClassEnabled != nil { + + if swag.IsZero(m.ClassEnabled) { // not required + return nil + } + + if err := m.ClassEnabled.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classEnabled") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classEnabled") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceResponse) contextValidateDevice(ctx context.Context, formats strfmt.Registry) error { + + if m.Device != nil { + + if swag.IsZero(m.Device) { // not required + return nil + } + + if err := m.Device.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("device") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("device") + } + return err + } + } + + return nil +} + +func (m *APIGetDeviceResponse) contextValidateDeviceStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.DeviceStatus != nil { + + if swag.IsZero(m.DeviceStatus) { // not required + return nil + } + + if err := m.DeviceStatus.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deviceStatus") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deviceStatus") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetDeviceResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetDeviceResponse) UnmarshalBinary(b []byte) error { + var res APIGetDeviceResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_gateway_duty_cycle_metrics_response.go b/internal/app/service/lora/chirp_stack/models/api_get_gateway_duty_cycle_metrics_response.go new file mode 100644 index 0000000..0fb3219 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_gateway_duty_cycle_metrics_response.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetGatewayDutyCycleMetricsResponse api get gateway duty cycle metrics response +// +// swagger:model apiGetGatewayDutyCycleMetricsResponse +type APIGetGatewayDutyCycleMetricsResponse struct { + + // Percentage relative to max load. + MaxLoadPercentage *CommonMetric `json:"maxLoadPercentage,omitempty"` + + // Percentage relative to tracking window. + WindowPercentage *CommonMetric `json:"windowPercentage,omitempty"` +} + +// Validate validates this api get gateway duty cycle metrics response +func (m *APIGetGatewayDutyCycleMetricsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMaxLoadPercentage(formats); err != nil { + res = append(res, err) + } + + if err := m.validateWindowPercentage(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetGatewayDutyCycleMetricsResponse) validateMaxLoadPercentage(formats strfmt.Registry) error { + if swag.IsZero(m.MaxLoadPercentage) { // not required + return nil + } + + if m.MaxLoadPercentage != nil { + if err := m.MaxLoadPercentage.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxLoadPercentage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxLoadPercentage") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayDutyCycleMetricsResponse) validateWindowPercentage(formats strfmt.Registry) error { + if swag.IsZero(m.WindowPercentage) { // not required + return nil + } + + if m.WindowPercentage != nil { + if err := m.WindowPercentage.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("windowPercentage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("windowPercentage") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get gateway duty cycle metrics response based on the context it is used +func (m *APIGetGatewayDutyCycleMetricsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMaxLoadPercentage(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateWindowPercentage(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetGatewayDutyCycleMetricsResponse) contextValidateMaxLoadPercentage(ctx context.Context, formats strfmt.Registry) error { + + if m.MaxLoadPercentage != nil { + + if swag.IsZero(m.MaxLoadPercentage) { // not required + return nil + } + + if err := m.MaxLoadPercentage.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxLoadPercentage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxLoadPercentage") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayDutyCycleMetricsResponse) contextValidateWindowPercentage(ctx context.Context, formats strfmt.Registry) error { + + if m.WindowPercentage != nil { + + if swag.IsZero(m.WindowPercentage) { // not required + return nil + } + + if err := m.WindowPercentage.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("windowPercentage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("windowPercentage") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetGatewayDutyCycleMetricsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetGatewayDutyCycleMetricsResponse) UnmarshalBinary(b []byte) error { + var res APIGetGatewayDutyCycleMetricsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_gateway_metrics_response.go b/internal/app/service/lora/chirp_stack/models/api_get_gateway_metrics_response.go new file mode 100644 index 0000000..4238bf0 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_gateway_metrics_response.go @@ -0,0 +1,415 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetGatewayMetricsResponse api get gateway metrics response +// +// swagger:model apiGetGatewayMetricsResponse +type APIGetGatewayMetricsResponse struct { + + // RX packets. + RxPackets *CommonMetric `json:"rxPackets,omitempty"` + + // RX packets / DR. + RxPacketsPerDr *CommonMetric `json:"rxPacketsPerDr,omitempty"` + + // RX packets / frequency. + RxPacketsPerFreq *CommonMetric `json:"rxPacketsPerFreq,omitempty"` + + // TX packets. + TxPackets *CommonMetric `json:"txPackets,omitempty"` + + // TX packets / DR. + TxPacketsPerDr *CommonMetric `json:"txPacketsPerDr,omitempty"` + + // TX packets / frequency. + TxPacketsPerFreq *CommonMetric `json:"txPacketsPerFreq,omitempty"` + + // TX packets per status. + TxPacketsPerStatus *CommonMetric `json:"txPacketsPerStatus,omitempty"` +} + +// Validate validates this api get gateway metrics response +func (m *APIGetGatewayMetricsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRxPackets(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRxPacketsPerDr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRxPacketsPerFreq(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTxPackets(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTxPacketsPerDr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTxPacketsPerFreq(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTxPacketsPerStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetGatewayMetricsResponse) validateRxPackets(formats strfmt.Registry) error { + if swag.IsZero(m.RxPackets) { // not required + return nil + } + + if m.RxPackets != nil { + if err := m.RxPackets.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rxPackets") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rxPackets") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayMetricsResponse) validateRxPacketsPerDr(formats strfmt.Registry) error { + if swag.IsZero(m.RxPacketsPerDr) { // not required + return nil + } + + if m.RxPacketsPerDr != nil { + if err := m.RxPacketsPerDr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rxPacketsPerDr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rxPacketsPerDr") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayMetricsResponse) validateRxPacketsPerFreq(formats strfmt.Registry) error { + if swag.IsZero(m.RxPacketsPerFreq) { // not required + return nil + } + + if m.RxPacketsPerFreq != nil { + if err := m.RxPacketsPerFreq.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rxPacketsPerFreq") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rxPacketsPerFreq") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayMetricsResponse) validateTxPackets(formats strfmt.Registry) error { + if swag.IsZero(m.TxPackets) { // not required + return nil + } + + if m.TxPackets != nil { + if err := m.TxPackets.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("txPackets") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("txPackets") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayMetricsResponse) validateTxPacketsPerDr(formats strfmt.Registry) error { + if swag.IsZero(m.TxPacketsPerDr) { // not required + return nil + } + + if m.TxPacketsPerDr != nil { + if err := m.TxPacketsPerDr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("txPacketsPerDr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("txPacketsPerDr") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayMetricsResponse) validateTxPacketsPerFreq(formats strfmt.Registry) error { + if swag.IsZero(m.TxPacketsPerFreq) { // not required + return nil + } + + if m.TxPacketsPerFreq != nil { + if err := m.TxPacketsPerFreq.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("txPacketsPerFreq") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("txPacketsPerFreq") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayMetricsResponse) validateTxPacketsPerStatus(formats strfmt.Registry) error { + if swag.IsZero(m.TxPacketsPerStatus) { // not required + return nil + } + + if m.TxPacketsPerStatus != nil { + if err := m.TxPacketsPerStatus.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("txPacketsPerStatus") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("txPacketsPerStatus") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get gateway metrics response based on the context it is used +func (m *APIGetGatewayMetricsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRxPackets(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRxPacketsPerDr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRxPacketsPerFreq(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTxPackets(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTxPacketsPerDr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTxPacketsPerFreq(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTxPacketsPerStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetGatewayMetricsResponse) contextValidateRxPackets(ctx context.Context, formats strfmt.Registry) error { + + if m.RxPackets != nil { + + if swag.IsZero(m.RxPackets) { // not required + return nil + } + + if err := m.RxPackets.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rxPackets") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rxPackets") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayMetricsResponse) contextValidateRxPacketsPerDr(ctx context.Context, formats strfmt.Registry) error { + + if m.RxPacketsPerDr != nil { + + if swag.IsZero(m.RxPacketsPerDr) { // not required + return nil + } + + if err := m.RxPacketsPerDr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rxPacketsPerDr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rxPacketsPerDr") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayMetricsResponse) contextValidateRxPacketsPerFreq(ctx context.Context, formats strfmt.Registry) error { + + if m.RxPacketsPerFreq != nil { + + if swag.IsZero(m.RxPacketsPerFreq) { // not required + return nil + } + + if err := m.RxPacketsPerFreq.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rxPacketsPerFreq") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rxPacketsPerFreq") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayMetricsResponse) contextValidateTxPackets(ctx context.Context, formats strfmt.Registry) error { + + if m.TxPackets != nil { + + if swag.IsZero(m.TxPackets) { // not required + return nil + } + + if err := m.TxPackets.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("txPackets") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("txPackets") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayMetricsResponse) contextValidateTxPacketsPerDr(ctx context.Context, formats strfmt.Registry) error { + + if m.TxPacketsPerDr != nil { + + if swag.IsZero(m.TxPacketsPerDr) { // not required + return nil + } + + if err := m.TxPacketsPerDr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("txPacketsPerDr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("txPacketsPerDr") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayMetricsResponse) contextValidateTxPacketsPerFreq(ctx context.Context, formats strfmt.Registry) error { + + if m.TxPacketsPerFreq != nil { + + if swag.IsZero(m.TxPacketsPerFreq) { // not required + return nil + } + + if err := m.TxPacketsPerFreq.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("txPacketsPerFreq") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("txPacketsPerFreq") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayMetricsResponse) contextValidateTxPacketsPerStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.TxPacketsPerStatus != nil { + + if swag.IsZero(m.TxPacketsPerStatus) { // not required + return nil + } + + if err := m.TxPacketsPerStatus.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("txPacketsPerStatus") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("txPacketsPerStatus") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetGatewayMetricsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetGatewayMetricsResponse) UnmarshalBinary(b []byte) error { + var res APIGetGatewayMetricsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_gateway_response.go b/internal/app/service/lora/chirp_stack/models/api_get_gateway_response.go new file mode 100644 index 0000000..dbfa9bd --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_gateway_response.go @@ -0,0 +1,170 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGetGatewayResponse api get gateway response +// +// swagger:model apiGetGatewayResponse +type APIGetGatewayResponse struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Gateway object. + Gateway *APIGateway `json:"gateway,omitempty"` + + // Last seen at timestamp. + // Format: date-time + LastSeenAt strfmt.DateTime `json:"lastSeenAt,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api get gateway response +func (m *APIGetGatewayResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGateway(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastSeenAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetGatewayResponse) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetGatewayResponse) validateGateway(formats strfmt.Registry) error { + if swag.IsZero(m.Gateway) { // not required + return nil + } + + if m.Gateway != nil { + if err := m.Gateway.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gateway") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gateway") + } + return err + } + } + + return nil +} + +func (m *APIGetGatewayResponse) validateLastSeenAt(formats strfmt.Registry) error { + if swag.IsZero(m.LastSeenAt) { // not required + return nil + } + + if err := validate.FormatOf("lastSeenAt", "body", "date-time", m.LastSeenAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetGatewayResponse) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api get gateway response based on the context it is used +func (m *APIGetGatewayResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGateway(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetGatewayResponse) contextValidateGateway(ctx context.Context, formats strfmt.Registry) error { + + if m.Gateway != nil { + + if swag.IsZero(m.Gateway) { // not required + return nil + } + + if err := m.Gateway.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gateway") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gateway") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetGatewayResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetGatewayResponse) UnmarshalBinary(b []byte) error { + var res APIGetGatewayResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_gcp_pub_sub_integration_response.go b/internal/app/service/lora/chirp_stack/models/api_get_gcp_pub_sub_integration_response.go new file mode 100644 index 0000000..b277353 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_gcp_pub_sub_integration_response.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetGcpPubSubIntegrationResponse api get gcp pub sub integration response +// +// swagger:model apiGetGcpPubSubIntegrationResponse +type APIGetGcpPubSubIntegrationResponse struct { + + // Integration object. + Integration *APIGcpPubSubIntegration `json:"integration,omitempty"` +} + +// Validate validates this api get gcp pub sub integration response +func (m *APIGetGcpPubSubIntegrationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetGcpPubSubIntegrationResponse) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(m.Integration) { // not required + return nil + } + + if m.Integration != nil { + if err := m.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get gcp pub sub integration response based on the context it is used +func (m *APIGetGcpPubSubIntegrationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetGcpPubSubIntegrationResponse) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if m.Integration != nil { + + if swag.IsZero(m.Integration) { // not required + return nil + } + + if err := m.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetGcpPubSubIntegrationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetGcpPubSubIntegrationResponse) UnmarshalBinary(b []byte) error { + var res APIGetGcpPubSubIntegrationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_http_integration_response.go b/internal/app/service/lora/chirp_stack/models/api_get_http_integration_response.go new file mode 100644 index 0000000..2cf6d97 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_http_integration_response.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetHTTPIntegrationResponse api get Http integration response +// +// swagger:model apiGetHttpIntegrationResponse +type APIGetHTTPIntegrationResponse struct { + + // Integration object. + Integration *APIHTTPIntegration `json:"integration,omitempty"` +} + +// Validate validates this api get Http integration response +func (m *APIGetHTTPIntegrationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetHTTPIntegrationResponse) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(m.Integration) { // not required + return nil + } + + if m.Integration != nil { + if err := m.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get Http integration response based on the context it is used +func (m *APIGetHTTPIntegrationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetHTTPIntegrationResponse) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if m.Integration != nil { + + if swag.IsZero(m.Integration) { // not required + return nil + } + + if err := m.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetHTTPIntegrationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetHTTPIntegrationResponse) UnmarshalBinary(b []byte) error { + var res APIGetHTTPIntegrationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_ifttt_integration_response.go b/internal/app/service/lora/chirp_stack/models/api_get_ifttt_integration_response.go new file mode 100644 index 0000000..ebc5f95 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_ifttt_integration_response.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetIftttIntegrationResponse api get ifttt integration response +// +// swagger:model apiGetIftttIntegrationResponse +type APIGetIftttIntegrationResponse struct { + + // Integration object. + Integration *APIIftttIntegration `json:"integration,omitempty"` +} + +// Validate validates this api get ifttt integration response +func (m *APIGetIftttIntegrationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetIftttIntegrationResponse) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(m.Integration) { // not required + return nil + } + + if m.Integration != nil { + if err := m.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get ifttt integration response based on the context it is used +func (m *APIGetIftttIntegrationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetIftttIntegrationResponse) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if m.Integration != nil { + + if swag.IsZero(m.Integration) { // not required + return nil + } + + if err := m.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetIftttIntegrationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetIftttIntegrationResponse) UnmarshalBinary(b []byte) error { + var res APIGetIftttIntegrationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_influx_db_integration_response.go b/internal/app/service/lora/chirp_stack/models/api_get_influx_db_integration_response.go new file mode 100644 index 0000000..d90df6a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_influx_db_integration_response.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetInfluxDbIntegrationResponse api get influx db integration response +// +// swagger:model apiGetInfluxDbIntegrationResponse +type APIGetInfluxDbIntegrationResponse struct { + + // Integration object. + Integration *APIInfluxDbIntegration `json:"integration,omitempty"` +} + +// Validate validates this api get influx db integration response +func (m *APIGetInfluxDbIntegrationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetInfluxDbIntegrationResponse) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(m.Integration) { // not required + return nil + } + + if m.Integration != nil { + if err := m.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get influx db integration response based on the context it is used +func (m *APIGetInfluxDbIntegrationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetInfluxDbIntegrationResponse) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if m.Integration != nil { + + if swag.IsZero(m.Integration) { // not required + return nil + } + + if err := m.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetInfluxDbIntegrationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetInfluxDbIntegrationResponse) UnmarshalBinary(b []byte) error { + var res APIGetInfluxDbIntegrationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_multicast_group_response.go b/internal/app/service/lora/chirp_stack/models/api_get_multicast_group_response.go new file mode 100644 index 0000000..dfe26a7 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_multicast_group_response.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGetMulticastGroupResponse api get multicast group response +// +// swagger:model apiGetMulticastGroupResponse +type APIGetMulticastGroupResponse struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Multicast group object. + MulticastGroup *APIMulticastGroup `json:"multicastGroup,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api get multicast group response +func (m *APIGetMulticastGroupResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMulticastGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetMulticastGroupResponse) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetMulticastGroupResponse) validateMulticastGroup(formats strfmt.Registry) error { + if swag.IsZero(m.MulticastGroup) { // not required + return nil + } + + if m.MulticastGroup != nil { + if err := m.MulticastGroup.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("multicastGroup") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("multicastGroup") + } + return err + } + } + + return nil +} + +func (m *APIGetMulticastGroupResponse) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api get multicast group response based on the context it is used +func (m *APIGetMulticastGroupResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMulticastGroup(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetMulticastGroupResponse) contextValidateMulticastGroup(ctx context.Context, formats strfmt.Registry) error { + + if m.MulticastGroup != nil { + + if swag.IsZero(m.MulticastGroup) { // not required + return nil + } + + if err := m.MulticastGroup.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("multicastGroup") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("multicastGroup") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetMulticastGroupResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetMulticastGroupResponse) UnmarshalBinary(b []byte) error { + var res APIGetMulticastGroupResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_my_devices_integration_response.go b/internal/app/service/lora/chirp_stack/models/api_get_my_devices_integration_response.go new file mode 100644 index 0000000..a892269 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_my_devices_integration_response.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetMyDevicesIntegrationResponse api get my devices integration response +// +// swagger:model apiGetMyDevicesIntegrationResponse +type APIGetMyDevicesIntegrationResponse struct { + + // Integration object. + Integration *APIMyDevicesIntegration `json:"integration,omitempty"` +} + +// Validate validates this api get my devices integration response +func (m *APIGetMyDevicesIntegrationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetMyDevicesIntegrationResponse) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(m.Integration) { // not required + return nil + } + + if m.Integration != nil { + if err := m.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get my devices integration response based on the context it is used +func (m *APIGetMyDevicesIntegrationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetMyDevicesIntegrationResponse) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if m.Integration != nil { + + if swag.IsZero(m.Integration) { // not required + return nil + } + + if err := m.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetMyDevicesIntegrationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetMyDevicesIntegrationResponse) UnmarshalBinary(b []byte) error { + var res APIGetMyDevicesIntegrationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_pilot_things_integration_response.go b/internal/app/service/lora/chirp_stack/models/api_get_pilot_things_integration_response.go new file mode 100644 index 0000000..e08a799 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_pilot_things_integration_response.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetPilotThingsIntegrationResponse api get pilot things integration response +// +// swagger:model apiGetPilotThingsIntegrationResponse +type APIGetPilotThingsIntegrationResponse struct { + + // Integration object. + Integration *APIPilotThingsIntegration `json:"integration,omitempty"` +} + +// Validate validates this api get pilot things integration response +func (m *APIGetPilotThingsIntegrationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetPilotThingsIntegrationResponse) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(m.Integration) { // not required + return nil + } + + if m.Integration != nil { + if err := m.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get pilot things integration response based on the context it is used +func (m *APIGetPilotThingsIntegrationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetPilotThingsIntegrationResponse) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if m.Integration != nil { + + if swag.IsZero(m.Integration) { // not required + return nil + } + + if err := m.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetPilotThingsIntegrationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetPilotThingsIntegrationResponse) UnmarshalBinary(b []byte) error { + var res APIGetPilotThingsIntegrationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_random_dev_addr_response.go b/internal/app/service/lora/chirp_stack/models/api_get_random_dev_addr_response.go new file mode 100644 index 0000000..be8a23b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_random_dev_addr_response.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetRandomDevAddrResponse api get random dev addr response +// +// swagger:model apiGetRandomDevAddrResponse +type APIGetRandomDevAddrResponse struct { + + // DevAddr. + DevAddr string `json:"devAddr,omitempty"` +} + +// Validate validates this api get random dev addr response +func (m *APIGetRandomDevAddrResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api get random dev addr response based on context it is used +func (m *APIGetRandomDevAddrResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetRandomDevAddrResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetRandomDevAddrResponse) UnmarshalBinary(b []byte) error { + var res APIGetRandomDevAddrResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_relay_gateway_response.go b/internal/app/service/lora/chirp_stack/models/api_get_relay_gateway_response.go new file mode 100644 index 0000000..5565c2d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_relay_gateway_response.go @@ -0,0 +1,170 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGetRelayGatewayResponse api get relay gateway response +// +// swagger:model apiGetRelayGatewayResponse +type APIGetRelayGatewayResponse struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Last seen at timestamp. + // Format: date-time + LastSeenAt strfmt.DateTime `json:"lastSeenAt,omitempty"` + + // Relay Gateway object. + RelayGateway *APIRelayGateway `json:"relayGateway,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api get relay gateway response +func (m *APIGetRelayGatewayResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastSeenAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRelayGateway(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetRelayGatewayResponse) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetRelayGatewayResponse) validateLastSeenAt(formats strfmt.Registry) error { + if swag.IsZero(m.LastSeenAt) { // not required + return nil + } + + if err := validate.FormatOf("lastSeenAt", "body", "date-time", m.LastSeenAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetRelayGatewayResponse) validateRelayGateway(formats strfmt.Registry) error { + if swag.IsZero(m.RelayGateway) { // not required + return nil + } + + if m.RelayGateway != nil { + if err := m.RelayGateway.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relayGateway") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relayGateway") + } + return err + } + } + + return nil +} + +func (m *APIGetRelayGatewayResponse) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api get relay gateway response based on the context it is used +func (m *APIGetRelayGatewayResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRelayGateway(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetRelayGatewayResponse) contextValidateRelayGateway(ctx context.Context, formats strfmt.Registry) error { + + if m.RelayGateway != nil { + + if swag.IsZero(m.RelayGateway) { // not required + return nil + } + + if err := m.RelayGateway.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("relayGateway") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("relayGateway") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetRelayGatewayResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetRelayGatewayResponse) UnmarshalBinary(b []byte) error { + var res APIGetRelayGatewayResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_tenant_response.go b/internal/app/service/lora/chirp_stack/models/api_get_tenant_response.go new file mode 100644 index 0000000..12ecdde --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_tenant_response.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGetTenantResponse api get tenant response +// +// swagger:model apiGetTenantResponse +type APIGetTenantResponse struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Tenant object. + Tenant *APITenant `json:"tenant,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api get tenant response +func (m *APIGetTenantResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTenant(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetTenantResponse) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetTenantResponse) validateTenant(formats strfmt.Registry) error { + if swag.IsZero(m.Tenant) { // not required + return nil + } + + if m.Tenant != nil { + if err := m.Tenant.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tenant") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tenant") + } + return err + } + } + + return nil +} + +func (m *APIGetTenantResponse) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api get tenant response based on the context it is used +func (m *APIGetTenantResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTenant(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetTenantResponse) contextValidateTenant(ctx context.Context, formats strfmt.Registry) error { + + if m.Tenant != nil { + + if swag.IsZero(m.Tenant) { // not required + return nil + } + + if err := m.Tenant.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tenant") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tenant") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetTenantResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetTenantResponse) UnmarshalBinary(b []byte) error { + var res APIGetTenantResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_tenant_user_response.go b/internal/app/service/lora/chirp_stack/models/api_get_tenant_user_response.go new file mode 100644 index 0000000..01033f0 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_tenant_user_response.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGetTenantUserResponse api get tenant user response +// +// swagger:model apiGetTenantUserResponse +type APIGetTenantUserResponse struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Tenant user object. + TenantUser *APITenantUser `json:"tenantUser,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api get tenant user response +func (m *APIGetTenantUserResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTenantUser(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetTenantUserResponse) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetTenantUserResponse) validateTenantUser(formats strfmt.Registry) error { + if swag.IsZero(m.TenantUser) { // not required + return nil + } + + if m.TenantUser != nil { + if err := m.TenantUser.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tenantUser") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tenantUser") + } + return err + } + } + + return nil +} + +func (m *APIGetTenantUserResponse) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api get tenant user response based on the context it is used +func (m *APIGetTenantUserResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTenantUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetTenantUserResponse) contextValidateTenantUser(ctx context.Context, formats strfmt.Registry) error { + + if m.TenantUser != nil { + + if swag.IsZero(m.TenantUser) { // not required + return nil + } + + if err := m.TenantUser.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tenantUser") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tenantUser") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetTenantUserResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetTenantUserResponse) UnmarshalBinary(b []byte) error { + var res APIGetTenantUserResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_things_board_integration_response.go b/internal/app/service/lora/chirp_stack/models/api_get_things_board_integration_response.go new file mode 100644 index 0000000..7b2987b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_things_board_integration_response.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIGetThingsBoardIntegrationResponse api get things board integration response +// +// swagger:model apiGetThingsBoardIntegrationResponse +type APIGetThingsBoardIntegrationResponse struct { + + // Integration object. + Integration *APIThingsBoardIntegration `json:"integration,omitempty"` +} + +// Validate validates this api get things board integration response +func (m *APIGetThingsBoardIntegrationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIntegration(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetThingsBoardIntegrationResponse) validateIntegration(formats strfmt.Registry) error { + if swag.IsZero(m.Integration) { // not required + return nil + } + + if m.Integration != nil { + if err := m.Integration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get things board integration response based on the context it is used +func (m *APIGetThingsBoardIntegrationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIntegration(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetThingsBoardIntegrationResponse) contextValidateIntegration(ctx context.Context, formats strfmt.Registry) error { + + if m.Integration != nil { + + if swag.IsZero(m.Integration) { // not required + return nil + } + + if err := m.Integration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("integration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("integration") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetThingsBoardIntegrationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetThingsBoardIntegrationResponse) UnmarshalBinary(b []byte) error { + var res APIGetThingsBoardIntegrationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_get_user_response.go b/internal/app/service/lora/chirp_stack/models/api_get_user_response.go new file mode 100644 index 0000000..71273ec --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_get_user_response.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIGetUserResponse api get user response +// +// swagger:model apiGetUserResponse +type APIGetUserResponse struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` + + // User object. + User *APIUser `json:"user,omitempty"` +} + +// Validate validates this api get user response +func (m *APIGetUserResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetUserResponse) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetUserResponse) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIGetUserResponse) validateUser(formats strfmt.Registry) error { + if swag.IsZero(m.User) { // not required + return nil + } + + if m.User != nil { + if err := m.User.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api get user response based on the context it is used +func (m *APIGetUserResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIGetUserResponse) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { + + if m.User != nil { + + if swag.IsZero(m.User) { // not required + return nil + } + + if err := m.User.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIGetUserResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIGetUserResponse) UnmarshalBinary(b []byte) error { + var res APIGetUserResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_http_integration.go b/internal/app/service/lora/chirp_stack/models/api_http_integration.go new file mode 100644 index 0000000..8d8f99e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_http_integration.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIHTTPIntegration api Http integration +// +// swagger:model apiHttpIntegration +type APIHTTPIntegration struct { + + // Application ID (UUID). + ApplicationID string `json:"applicationId,omitempty"` + + // Payload encoding. + Encoding *APIEncoding `json:"encoding,omitempty"` + + // Event endpoint URL. + // The HTTP integration will POST all events to this enpoint. The request + // will contain a query parameters "event" containing the type of the + // event. + EventEndpointURL string `json:"eventEndpointUrl,omitempty"` + + // HTTP headers to set when making requests. + Headers map[string]string `json:"headers,omitempty"` +} + +// Validate validates this api Http integration +func (m *APIHTTPIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEncoding(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIHTTPIntegration) validateEncoding(formats strfmt.Registry) error { + if swag.IsZero(m.Encoding) { // not required + return nil + } + + if m.Encoding != nil { + if err := m.Encoding.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encoding") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api Http integration based on the context it is used +func (m *APIHTTPIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEncoding(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIHTTPIntegration) contextValidateEncoding(ctx context.Context, formats strfmt.Registry) error { + + if m.Encoding != nil { + + if swag.IsZero(m.Encoding) { // not required + return nil + } + + if err := m.Encoding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encoding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encoding") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIHTTPIntegration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIHTTPIntegration) UnmarshalBinary(b []byte) error { + var res APIHTTPIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_ifttt_integration.go b/internal/app/service/lora/chirp_stack/models/api_ifttt_integration.go new file mode 100644 index 0000000..498e866 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_ifttt_integration.go @@ -0,0 +1,77 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIIftttIntegration api ifttt integration +// +// swagger:model apiIftttIntegration +type APIIftttIntegration struct { + + // Application ID (UUID). + ApplicationID string `json:"applicationId,omitempty"` + + // Arbitrary JSON. + // If set to true, ChirpStack events will be sent as-is as arbitrary JSON + // payload. If set to false (default), the 3 JSON values format will be used. + ArbitraryJSON bool `json:"arbitraryJson,omitempty"` + + // Event prefix. + // If set, the event name will be PREFIX_EVENT. For example if event_prefix + // is set to weatherstation, and uplink event will be sent as + // weatherstation_up to the IFTTT webhook. + // Note: Only characters in the A-Z, a-z and 0-9 range are allowed. + EventPrefix string `json:"eventPrefix,omitempty"` + + // Key. + // This key can be obtained from the IFTTT Webhooks documentation page. + Key string `json:"key,omitempty"` + + // Values. + // Up to 2 values can be forwarded to IFTTT. These values must map to the + // decoded payload keys. For example: + // { + // "batteryLevel": 75.3, + // "buttons": [{"pressed": false}, {"pressed": true}] + // } + // You would specify the following fields: + // uplink_values = ["batteryLevel", "buttons_0_pressed"] + UplinkValues []string `json:"uplinkValues"` +} + +// Validate validates this api ifttt integration +func (m *APIIftttIntegration) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api ifttt integration based on context it is used +func (m *APIIftttIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIIftttIntegration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIIftttIntegration) UnmarshalBinary(b []byte) error { + var res APIIftttIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_influx_db_integration.go b/internal/app/service/lora/chirp_stack/models/api_influx_db_integration.go new file mode 100644 index 0000000..5c68a78 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_influx_db_integration.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIInfluxDbIntegration api influx db integration +// +// swagger:model apiInfluxDbIntegration +type APIInfluxDbIntegration struct { + + // Application ID (UUID). + ApplicationID string `json:"applicationId,omitempty"` + + // Bucket. (InfluxDb v2) + Bucket string `json:"bucket,omitempty"` + + // InfluxDb database name. (InfluxDb v1) + Db string `json:"db,omitempty"` + + // InfluxDb API write endpoint (e.g. http://localhost:8086/write). + Endpoint string `json:"endpoint,omitempty"` + + // Organization. (InfluxDb v2) + Organization string `json:"organization,omitempty"` + + // InfluxDb password. (InfluxDb v1) + Password string `json:"password,omitempty"` + + // InfluxDb timestamp precision (InfluxDb v1). + Precision *APIInfluxDbPrecision `json:"precision,omitempty"` + + // InfluxDb retention policy name. (InfluxDb v1) + RetentionPolicyName string `json:"retentionPolicyName,omitempty"` + + // Token. (InfluxDb v2) + Token string `json:"token,omitempty"` + + // InfluxDb username. (InfluxDb v1) + Username string `json:"username,omitempty"` + + // InfluxDb version. + Version *APIInfluxDbVersion `json:"version,omitempty"` +} + +// Validate validates this api influx db integration +func (m *APIInfluxDbIntegration) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePrecision(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVersion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIInfluxDbIntegration) validatePrecision(formats strfmt.Registry) error { + if swag.IsZero(m.Precision) { // not required + return nil + } + + if m.Precision != nil { + if err := m.Precision.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("precision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("precision") + } + return err + } + } + + return nil +} + +func (m *APIInfluxDbIntegration) validateVersion(formats strfmt.Registry) error { + if swag.IsZero(m.Version) { // not required + return nil + } + + if m.Version != nil { + if err := m.Version.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("version") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("version") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api influx db integration based on the context it is used +func (m *APIInfluxDbIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePrecision(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVersion(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIInfluxDbIntegration) contextValidatePrecision(ctx context.Context, formats strfmt.Registry) error { + + if m.Precision != nil { + + if swag.IsZero(m.Precision) { // not required + return nil + } + + if err := m.Precision.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("precision") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("precision") + } + return err + } + } + + return nil +} + +func (m *APIInfluxDbIntegration) contextValidateVersion(ctx context.Context, formats strfmt.Registry) error { + + if m.Version != nil { + + if swag.IsZero(m.Version) { // not required + return nil + } + + if err := m.Version.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("version") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("version") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIInfluxDbIntegration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIInfluxDbIntegration) UnmarshalBinary(b []byte) error { + var res APIInfluxDbIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_influx_db_precision.go b/internal/app/service/lora/chirp_stack/models/api_influx_db_precision.go new file mode 100644 index 0000000..46b1845 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_influx_db_precision.go @@ -0,0 +1,90 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APIInfluxDbPrecision api influx db precision +// +// swagger:model apiInfluxDbPrecision +type APIInfluxDbPrecision string + +func NewAPIInfluxDbPrecision(value APIInfluxDbPrecision) *APIInfluxDbPrecision { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APIInfluxDbPrecision. +func (m APIInfluxDbPrecision) Pointer() *APIInfluxDbPrecision { + return &m +} + +const ( + + // APIInfluxDbPrecisionNS captures enum value "NS" + APIInfluxDbPrecisionNS APIInfluxDbPrecision = "NS" + + // APIInfluxDbPrecisionU captures enum value "U" + APIInfluxDbPrecisionU APIInfluxDbPrecision = "U" + + // APIInfluxDbPrecisionMS captures enum value "MS" + APIInfluxDbPrecisionMS APIInfluxDbPrecision = "MS" + + // APIInfluxDbPrecisionS captures enum value "S" + APIInfluxDbPrecisionS APIInfluxDbPrecision = "S" + + // APIInfluxDbPrecisionM captures enum value "M" + APIInfluxDbPrecisionM APIInfluxDbPrecision = "M" + + // APIInfluxDbPrecisionH captures enum value "H" + APIInfluxDbPrecisionH APIInfluxDbPrecision = "H" +) + +// for schema +var apiInfluxDbPrecisionEnum []interface{} + +func init() { + var res []APIInfluxDbPrecision + if err := json.Unmarshal([]byte(`["NS","U","MS","S","M","H"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiInfluxDbPrecisionEnum = append(apiInfluxDbPrecisionEnum, v) + } +} + +func (m APIInfluxDbPrecision) validateAPIInfluxDbPrecisionEnum(path, location string, value APIInfluxDbPrecision) error { + if err := validate.EnumCase(path, location, value, apiInfluxDbPrecisionEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api influx db precision +func (m APIInfluxDbPrecision) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPIInfluxDbPrecisionEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api influx db precision based on context it is used +func (m APIInfluxDbPrecision) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_influx_db_version.go b/internal/app/service/lora/chirp_stack/models/api_influx_db_version.go new file mode 100644 index 0000000..7a865b8 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_influx_db_version.go @@ -0,0 +1,78 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APIInfluxDbVersion api influx db version +// +// swagger:model apiInfluxDbVersion +type APIInfluxDbVersion string + +func NewAPIInfluxDbVersion(value APIInfluxDbVersion) *APIInfluxDbVersion { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APIInfluxDbVersion. +func (m APIInfluxDbVersion) Pointer() *APIInfluxDbVersion { + return &m +} + +const ( + + // APIInfluxDbVersionINFLUXDB1 captures enum value "INFLUXDB_1" + APIInfluxDbVersionINFLUXDB1 APIInfluxDbVersion = "INFLUXDB_1" + + // APIInfluxDbVersionINFLUXDB2 captures enum value "INFLUXDB_2" + APIInfluxDbVersionINFLUXDB2 APIInfluxDbVersion = "INFLUXDB_2" +) + +// for schema +var apiInfluxDbVersionEnum []interface{} + +func init() { + var res []APIInfluxDbVersion + if err := json.Unmarshal([]byte(`["INFLUXDB_1","INFLUXDB_2"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiInfluxDbVersionEnum = append(apiInfluxDbVersionEnum, v) + } +} + +func (m APIInfluxDbVersion) validateAPIInfluxDbVersionEnum(path, location string, value APIInfluxDbVersion) error { + if err := validate.EnumCase(path, location, value, apiInfluxDbVersionEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api influx db version +func (m APIInfluxDbVersion) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPIInfluxDbVersionEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api influx db version based on context it is used +func (m APIInfluxDbVersion) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_integration_kind.go b/internal/app/service/lora/chirp_stack/models/api_integration_kind.go new file mode 100644 index 0000000..9f40e85 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_integration_kind.go @@ -0,0 +1,102 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APIIntegrationKind api integration kind +// +// swagger:model apiIntegrationKind +type APIIntegrationKind string + +func NewAPIIntegrationKind(value APIIntegrationKind) *APIIntegrationKind { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APIIntegrationKind. +func (m APIIntegrationKind) Pointer() *APIIntegrationKind { + return &m +} + +const ( + + // APIIntegrationKindHTTP captures enum value "HTTP" + APIIntegrationKindHTTP APIIntegrationKind = "HTTP" + + // APIIntegrationKindINFLUXDB captures enum value "INFLUX_DB" + APIIntegrationKindINFLUXDB APIIntegrationKind = "INFLUX_DB" + + // APIIntegrationKindTHINGSBOARD captures enum value "THINGS_BOARD" + APIIntegrationKindTHINGSBOARD APIIntegrationKind = "THINGS_BOARD" + + // APIIntegrationKindMYDEVICES captures enum value "MY_DEVICES" + APIIntegrationKindMYDEVICES APIIntegrationKind = "MY_DEVICES" + + // APIIntegrationKindGCPPUBSUB captures enum value "GCP_PUB_SUB" + APIIntegrationKindGCPPUBSUB APIIntegrationKind = "GCP_PUB_SUB" + + // APIIntegrationKindAWSSNS captures enum value "AWS_SNS" + APIIntegrationKindAWSSNS APIIntegrationKind = "AWS_SNS" + + // APIIntegrationKindAZURESERVICEBUS captures enum value "AZURE_SERVICE_BUS" + APIIntegrationKindAZURESERVICEBUS APIIntegrationKind = "AZURE_SERVICE_BUS" + + // APIIntegrationKindPILOTTHINGS captures enum value "PILOT_THINGS" + APIIntegrationKindPILOTTHINGS APIIntegrationKind = "PILOT_THINGS" + + // APIIntegrationKindMQTTGLOBAL captures enum value "MQTT_GLOBAL" + APIIntegrationKindMQTTGLOBAL APIIntegrationKind = "MQTT_GLOBAL" + + // APIIntegrationKindIFTTT captures enum value "IFTTT" + APIIntegrationKindIFTTT APIIntegrationKind = "IFTTT" +) + +// for schema +var apiIntegrationKindEnum []interface{} + +func init() { + var res []APIIntegrationKind + if err := json.Unmarshal([]byte(`["HTTP","INFLUX_DB","THINGS_BOARD","MY_DEVICES","GCP_PUB_SUB","AWS_SNS","AZURE_SERVICE_BUS","PILOT_THINGS","MQTT_GLOBAL","IFTTT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiIntegrationKindEnum = append(apiIntegrationKindEnum, v) + } +} + +func (m APIIntegrationKind) validateAPIIntegrationKindEnum(path, location string, value APIIntegrationKind) error { + if err := validate.EnumCase(path, location, value, apiIntegrationKindEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api integration kind +func (m APIIntegrationKind) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPIIntegrationKindEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api integration kind based on context it is used +func (m APIIntegrationKind) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_integration_list_item.go b/internal/app/service/lora/chirp_stack/models/api_integration_list_item.go new file mode 100644 index 0000000..6bc12b8 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_integration_list_item.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIIntegrationListItem api integration list item +// +// swagger:model apiIntegrationListItem +type APIIntegrationListItem struct { + + // Integration kind. + Kind *APIIntegrationKind `json:"kind,omitempty"` +} + +// Validate validates this api integration list item +func (m *APIIntegrationListItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateKind(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIIntegrationListItem) validateKind(formats strfmt.Registry) error { + if swag.IsZero(m.Kind) { // not required + return nil + } + + if m.Kind != nil { + if err := m.Kind.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("kind") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("kind") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api integration list item based on the context it is used +func (m *APIIntegrationListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateKind(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIIntegrationListItem) contextValidateKind(ctx context.Context, formats strfmt.Registry) error { + + if m.Kind != nil { + + if swag.IsZero(m.Kind) { // not required + return nil + } + + if err := m.Kind.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("kind") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("kind") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIIntegrationListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIIntegrationListItem) UnmarshalBinary(b []byte) error { + var res APIIntegrationListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_application_device_profiles_response.go b/internal/app/service/lora/chirp_stack/models/api_list_application_device_profiles_response.go new file mode 100644 index 0000000..100b07f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_application_device_profiles_response.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListApplicationDeviceProfilesResponse api list application device profiles response +// +// swagger:model apiListApplicationDeviceProfilesResponse +type APIListApplicationDeviceProfilesResponse struct { + + // Device-profiles. + Result []*APIApplicationDeviceProfileListItem `json:"result"` +} + +// Validate validates this api list application device profiles response +func (m *APIListApplicationDeviceProfilesResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListApplicationDeviceProfilesResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list application device profiles response based on the context it is used +func (m *APIListApplicationDeviceProfilesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListApplicationDeviceProfilesResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListApplicationDeviceProfilesResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListApplicationDeviceProfilesResponse) UnmarshalBinary(b []byte) error { + var res APIListApplicationDeviceProfilesResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_application_device_tags_response.go b/internal/app/service/lora/chirp_stack/models/api_list_application_device_tags_response.go new file mode 100644 index 0000000..8b73017 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_application_device_tags_response.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListApplicationDeviceTagsResponse api list application device tags response +// +// swagger:model apiListApplicationDeviceTagsResponse +type APIListApplicationDeviceTagsResponse struct { + + // Device tags. + Result []*APIApplicationDeviceTagListItem `json:"result"` +} + +// Validate validates this api list application device tags response +func (m *APIListApplicationDeviceTagsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListApplicationDeviceTagsResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list application device tags response based on the context it is used +func (m *APIListApplicationDeviceTagsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListApplicationDeviceTagsResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListApplicationDeviceTagsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListApplicationDeviceTagsResponse) UnmarshalBinary(b []byte) error { + var res APIListApplicationDeviceTagsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_applications_response.go b/internal/app/service/lora/chirp_stack/models/api_list_applications_response.go new file mode 100644 index 0000000..c953f04 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_applications_response.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListApplicationsResponse api list applications response +// +// swagger:model apiListApplicationsResponse +type APIListApplicationsResponse struct { + + // Result-set. + Result []*APIApplicationListItem `json:"result"` + + // Total number of applications. + TotalCount int64 `json:"totalCount,omitempty"` +} + +// Validate validates this api list applications response +func (m *APIListApplicationsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListApplicationsResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list applications response based on the context it is used +func (m *APIListApplicationsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListApplicationsResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListApplicationsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListApplicationsResponse) UnmarshalBinary(b []byte) error { + var res APIListApplicationsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_device_profile_adr_algorithms_response.go b/internal/app/service/lora/chirp_stack/models/api_list_device_profile_adr_algorithms_response.go new file mode 100644 index 0000000..2bdda18 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_device_profile_adr_algorithms_response.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListDeviceProfileAdrAlgorithmsResponse api list device profile adr algorithms response +// +// swagger:model apiListDeviceProfileAdrAlgorithmsResponse +type APIListDeviceProfileAdrAlgorithmsResponse struct { + + // Result-set. + Result []*APIAdrAlgorithmListItem `json:"result"` + + // Total number of algorithms. + TotalCount int64 `json:"totalCount,omitempty"` +} + +// Validate validates this api list device profile adr algorithms response +func (m *APIListDeviceProfileAdrAlgorithmsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListDeviceProfileAdrAlgorithmsResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list device profile adr algorithms response based on the context it is used +func (m *APIListDeviceProfileAdrAlgorithmsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListDeviceProfileAdrAlgorithmsResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListDeviceProfileAdrAlgorithmsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListDeviceProfileAdrAlgorithmsResponse) UnmarshalBinary(b []byte) error { + var res APIListDeviceProfileAdrAlgorithmsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_device_profile_templates_response.go b/internal/app/service/lora/chirp_stack/models/api_list_device_profile_templates_response.go new file mode 100644 index 0000000..c56dfe1 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_device_profile_templates_response.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListDeviceProfileTemplatesResponse api list device profile templates response +// +// swagger:model apiListDeviceProfileTemplatesResponse +type APIListDeviceProfileTemplatesResponse struct { + + // Result-set. + Result []*APIDeviceProfileTemplateListItem `json:"result"` + + // Total number of device-profile templates. + TotalCount int64 `json:"totalCount,omitempty"` +} + +// Validate validates this api list device profile templates response +func (m *APIListDeviceProfileTemplatesResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListDeviceProfileTemplatesResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list device profile templates response based on the context it is used +func (m *APIListDeviceProfileTemplatesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListDeviceProfileTemplatesResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListDeviceProfileTemplatesResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListDeviceProfileTemplatesResponse) UnmarshalBinary(b []byte) error { + var res APIListDeviceProfileTemplatesResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_device_profiles_response.go b/internal/app/service/lora/chirp_stack/models/api_list_device_profiles_response.go new file mode 100644 index 0000000..fbd76b2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_device_profiles_response.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListDeviceProfilesResponse api list device profiles response +// +// swagger:model apiListDeviceProfilesResponse +type APIListDeviceProfilesResponse struct { + + // Result-set. + Result []*APIDeviceProfileListItem `json:"result"` + + // Total number of device-profiles. + TotalCount int64 `json:"totalCount,omitempty"` +} + +// Validate validates this api list device profiles response +func (m *APIListDeviceProfilesResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListDeviceProfilesResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list device profiles response based on the context it is used +func (m *APIListDeviceProfilesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListDeviceProfilesResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListDeviceProfilesResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListDeviceProfilesResponse) UnmarshalBinary(b []byte) error { + var res APIListDeviceProfilesResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_devices_response.go b/internal/app/service/lora/chirp_stack/models/api_list_devices_response.go new file mode 100644 index 0000000..d8baf9a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_devices_response.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListDevicesResponse api list devices response +// +// swagger:model apiListDevicesResponse +type APIListDevicesResponse struct { + + // Result-set. + Result []*APIDeviceListItem `json:"result"` + + // Total number of devices. + TotalCount int64 `json:"totalCount,omitempty"` +} + +// Validate validates this api list devices response +func (m *APIListDevicesResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListDevicesResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list devices response based on the context it is used +func (m *APIListDevicesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListDevicesResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListDevicesResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListDevicesResponse) UnmarshalBinary(b []byte) error { + var res APIListDevicesResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_gateways_response.go b/internal/app/service/lora/chirp_stack/models/api_list_gateways_response.go new file mode 100644 index 0000000..cbc2331 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_gateways_response.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListGatewaysResponse api list gateways response +// +// swagger:model apiListGatewaysResponse +type APIListGatewaysResponse struct { + + // Result-set. + Result []*APIGatewayListItem `json:"result"` + + // Total number of gateways. + TotalCount int64 `json:"totalCount,omitempty"` +} + +// Validate validates this api list gateways response +func (m *APIListGatewaysResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListGatewaysResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list gateways response based on the context it is used +func (m *APIListGatewaysResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListGatewaysResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListGatewaysResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListGatewaysResponse) UnmarshalBinary(b []byte) error { + var res APIListGatewaysResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_integrations_response.go b/internal/app/service/lora/chirp_stack/models/api_list_integrations_response.go new file mode 100644 index 0000000..b91512f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_integrations_response.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListIntegrationsResponse api list integrations response +// +// swagger:model apiListIntegrationsResponse +type APIListIntegrationsResponse struct { + + // Integrations within result-set. + Result []*APIIntegrationListItem `json:"result"` + + // Total number of integrations available within the result-set. + TotalCount int64 `json:"totalCount,omitempty"` +} + +// Validate validates this api list integrations response +func (m *APIListIntegrationsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListIntegrationsResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list integrations response based on the context it is used +func (m *APIListIntegrationsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListIntegrationsResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListIntegrationsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListIntegrationsResponse) UnmarshalBinary(b []byte) error { + var res APIListIntegrationsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_multicast_group_queue_response.go b/internal/app/service/lora/chirp_stack/models/api_list_multicast_group_queue_response.go new file mode 100644 index 0000000..8de6beb --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_multicast_group_queue_response.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListMulticastGroupQueueResponse api list multicast group queue response +// +// swagger:model apiListMulticastGroupQueueResponse +type APIListMulticastGroupQueueResponse struct { + + // items + Items []*APIMulticastGroupQueueItem `json:"items"` +} + +// Validate validates this api list multicast group queue response +func (m *APIListMulticastGroupQueueResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateItems(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListMulticastGroupQueueResponse) validateItems(formats strfmt.Registry) error { + if swag.IsZero(m.Items) { // not required + return nil + } + + for i := 0; i < len(m.Items); i++ { + if swag.IsZero(m.Items[i]) { // not required + continue + } + + if m.Items[i] != nil { + if err := m.Items[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("items" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list multicast group queue response based on the context it is used +func (m *APIListMulticastGroupQueueResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateItems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListMulticastGroupQueueResponse) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Items); i++ { + + if m.Items[i] != nil { + + if swag.IsZero(m.Items[i]) { // not required + return nil + } + + if err := m.Items[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("items" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("items" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListMulticastGroupQueueResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListMulticastGroupQueueResponse) UnmarshalBinary(b []byte) error { + var res APIListMulticastGroupQueueResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_multicast_groups_response.go b/internal/app/service/lora/chirp_stack/models/api_list_multicast_groups_response.go new file mode 100644 index 0000000..d4cfaa3 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_multicast_groups_response.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListMulticastGroupsResponse api list multicast groups response +// +// swagger:model apiListMulticastGroupsResponse +type APIListMulticastGroupsResponse struct { + + // Result-test. + Result []*APIMulticastGroupListItem `json:"result"` + + // Total number of multicast groups. + TotalCount int64 `json:"totalCount,omitempty"` +} + +// Validate validates this api list multicast groups response +func (m *APIListMulticastGroupsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListMulticastGroupsResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list multicast groups response based on the context it is used +func (m *APIListMulticastGroupsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListMulticastGroupsResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListMulticastGroupsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListMulticastGroupsResponse) UnmarshalBinary(b []byte) error { + var res APIListMulticastGroupsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_relay_gateways_response.go b/internal/app/service/lora/chirp_stack/models/api_list_relay_gateways_response.go new file mode 100644 index 0000000..a8dee67 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_relay_gateways_response.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListRelayGatewaysResponse api list relay gateways response +// +// swagger:model apiListRelayGatewaysResponse +type APIListRelayGatewaysResponse struct { + + // Result-set. + Result []*APIRelayGatewayListItem `json:"result"` + + // Total number of relay-gateways. + TotalCount int64 `json:"totalCount,omitempty"` +} + +// Validate validates this api list relay gateways response +func (m *APIListRelayGatewaysResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListRelayGatewaysResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list relay gateways response based on the context it is used +func (m *APIListRelayGatewaysResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListRelayGatewaysResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListRelayGatewaysResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListRelayGatewaysResponse) UnmarshalBinary(b []byte) error { + var res APIListRelayGatewaysResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_tenant_users_response.go b/internal/app/service/lora/chirp_stack/models/api_list_tenant_users_response.go new file mode 100644 index 0000000..3df10b7 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_tenant_users_response.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListTenantUsersResponse api list tenant users response +// +// swagger:model apiListTenantUsersResponse +type APIListTenantUsersResponse struct { + + // Result-set. + Result []*APITenantUserListItem `json:"result"` + + // Total number of tenants. + TotalCount int64 `json:"totalCount,omitempty"` +} + +// Validate validates this api list tenant users response +func (m *APIListTenantUsersResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListTenantUsersResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list tenant users response based on the context it is used +func (m *APIListTenantUsersResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListTenantUsersResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListTenantUsersResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListTenantUsersResponse) UnmarshalBinary(b []byte) error { + var res APIListTenantUsersResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_tenants_response.go b/internal/app/service/lora/chirp_stack/models/api_list_tenants_response.go new file mode 100644 index 0000000..1b7cc7f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_tenants_response.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListTenantsResponse api list tenants response +// +// swagger:model apiListTenantsResponse +type APIListTenantsResponse struct { + + // Result-set. + Result []*APITenantListItem `json:"result"` + + // Total number of tenants. + TotalCount int64 `json:"totalCount,omitempty"` +} + +// Validate validates this api list tenants response +func (m *APIListTenantsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListTenantsResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list tenants response based on the context it is used +func (m *APIListTenantsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListTenantsResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListTenantsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListTenantsResponse) UnmarshalBinary(b []byte) error { + var res APIListTenantsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_list_users_response.go b/internal/app/service/lora/chirp_stack/models/api_list_users_response.go new file mode 100644 index 0000000..913de5d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_list_users_response.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIListUsersResponse api list users response +// +// swagger:model apiListUsersResponse +type APIListUsersResponse struct { + + // Result-set. + Result []*APIUserListItem `json:"result"` + + // Total number of users. + TotalCount int64 `json:"totalCount,omitempty"` +} + +// Validate validates this api list users response +func (m *APIListUsersResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListUsersResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + for i := 0; i < len(m.Result); i++ { + if swag.IsZero(m.Result[i]) { // not required + continue + } + + if m.Result[i] != nil { + if err := m.Result[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this api list users response based on the context it is used +func (m *APIListUsersResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIListUsersResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Result); i++ { + + if m.Result[i] != nil { + + if swag.IsZero(m.Result[i]) { // not required + return nil + } + + if err := m.Result[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIListUsersResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIListUsersResponse) UnmarshalBinary(b []byte) error { + var res APIListUsersResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_measurement.go b/internal/app/service/lora/chirp_stack/models/api_measurement.go new file mode 100644 index 0000000..83dc96b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_measurement.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIMeasurement api measurement +// +// swagger:model apiMeasurement +type APIMeasurement struct { + + // Kind. + Kind *APIMeasurementKind `json:"kind,omitempty"` + + // Name (user defined). + Name string `json:"name,omitempty"` +} + +// Validate validates this api measurement +func (m *APIMeasurement) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateKind(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIMeasurement) validateKind(formats strfmt.Registry) error { + if swag.IsZero(m.Kind) { // not required + return nil + } + + if m.Kind != nil { + if err := m.Kind.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("kind") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("kind") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api measurement based on the context it is used +func (m *APIMeasurement) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateKind(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIMeasurement) contextValidateKind(ctx context.Context, formats strfmt.Registry) error { + + if m.Kind != nil { + + if swag.IsZero(m.Kind) { // not required + return nil + } + + if err := m.Kind.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("kind") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("kind") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIMeasurement) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIMeasurement) UnmarshalBinary(b []byte) error { + var res APIMeasurement + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_measurement_kind.go b/internal/app/service/lora/chirp_stack/models/api_measurement_kind.go new file mode 100644 index 0000000..9c172d9 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_measurement_kind.go @@ -0,0 +1,93 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APIMeasurementKind - UNKNOWN: Unknown (in which case it is not tracked). +// - COUNTER: Incrementing counters that never decrease (these are not reset on each +// +// reading). +// - ABSOLUTE: Counters that do get reset upon reading. +// - GAUGE: E.g. a temperature value. +// - STRING: E.g. a firmware version, true / false value. +// +// swagger:model apiMeasurementKind +type APIMeasurementKind string + +func NewAPIMeasurementKind(value APIMeasurementKind) *APIMeasurementKind { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APIMeasurementKind. +func (m APIMeasurementKind) Pointer() *APIMeasurementKind { + return &m +} + +const ( + + // APIMeasurementKindUNKNOWN captures enum value "UNKNOWN" + APIMeasurementKindUNKNOWN APIMeasurementKind = "UNKNOWN" + + // APIMeasurementKindCOUNTER captures enum value "COUNTER" + APIMeasurementKindCOUNTER APIMeasurementKind = "COUNTER" + + // APIMeasurementKindABSOLUTE captures enum value "ABSOLUTE" + APIMeasurementKindABSOLUTE APIMeasurementKind = "ABSOLUTE" + + // APIMeasurementKindGAUGE captures enum value "GAUGE" + APIMeasurementKindGAUGE APIMeasurementKind = "GAUGE" + + // APIMeasurementKindSTRING captures enum value "STRING" + APIMeasurementKindSTRING APIMeasurementKind = "STRING" +) + +// for schema +var apiMeasurementKindEnum []interface{} + +func init() { + var res []APIMeasurementKind + if err := json.Unmarshal([]byte(`["UNKNOWN","COUNTER","ABSOLUTE","GAUGE","STRING"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiMeasurementKindEnum = append(apiMeasurementKindEnum, v) + } +} + +func (m APIMeasurementKind) validateAPIMeasurementKindEnum(path, location string, value APIMeasurementKind) error { + if err := validate.EnumCase(path, location, value, apiMeasurementKindEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api measurement kind +func (m APIMeasurementKind) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPIMeasurementKindEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api measurement kind based on context it is used +func (m APIMeasurementKind) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_multicast_group.go b/internal/app/service/lora/chirp_stack/models/api_multicast_group.go new file mode 100644 index 0000000..717b227 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_multicast_group.go @@ -0,0 +1,250 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIMulticastGroup api multicast group +// +// swagger:model apiMulticastGroup +type APIMulticastGroup struct { + + // Application ID. + // After creation, this can not be updated. + ApplicationID string `json:"applicationId,omitempty"` + + // Class-B ping-slot periodicity (only for Class-B). + // Valid options are: 0 - 7. + // + // Number of ping-slots per beacon-period: + // pingNb = 2^(7-periodicity) + // + // Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec + // Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec + ClassBPingSlotPeriodicity int64 `json:"classBPingSlotPeriodicity,omitempty"` + + // Scheduling type (only for Class-C). + ClassCSchedulingType *APIMulticastGroupSchedulingType `json:"classCSchedulingType,omitempty"` + + // Data-rate. + Dr int64 `json:"dr,omitempty"` + + // Frame-counter. + FCnt int64 `json:"fCnt,omitempty"` + + // Frequency (Hz). + Frequency int64 `json:"frequency,omitempty"` + + // Multicast group type. + GroupType *APIMulticastGroupType `json:"groupType,omitempty"` + + // ID (UUID). + // This will be generated automatically on create. + ID string `json:"id,omitempty"` + + // Multicast address (HEX encoded DevAddr). + McAddr string `json:"mcAddr,omitempty"` + + // Multicast application session key (HEX encoded AES128 key). + McAppSKey string `json:"mcAppSKey,omitempty"` + + // Multicast network session key (HEX encoded AES128 key). + McNwkSKey string `json:"mcNwkSKey,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Region. + Region *CommonRegion `json:"region,omitempty"` +} + +// Validate validates this api multicast group +func (m *APIMulticastGroup) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClassCSchedulingType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGroupType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIMulticastGroup) validateClassCSchedulingType(formats strfmt.Registry) error { + if swag.IsZero(m.ClassCSchedulingType) { // not required + return nil + } + + if m.ClassCSchedulingType != nil { + if err := m.ClassCSchedulingType.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classCSchedulingType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classCSchedulingType") + } + return err + } + } + + return nil +} + +func (m *APIMulticastGroup) validateGroupType(formats strfmt.Registry) error { + if swag.IsZero(m.GroupType) { // not required + return nil + } + + if m.GroupType != nil { + if err := m.GroupType.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("groupType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("groupType") + } + return err + } + } + + return nil +} + +func (m *APIMulticastGroup) validateRegion(formats strfmt.Registry) error { + if swag.IsZero(m.Region) { // not required + return nil + } + + if m.Region != nil { + if err := m.Region.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +// ContextValidate validate this api multicast group based on the context it is used +func (m *APIMulticastGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClassCSchedulingType(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGroupType(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRegion(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIMulticastGroup) contextValidateClassCSchedulingType(ctx context.Context, formats strfmt.Registry) error { + + if m.ClassCSchedulingType != nil { + + if swag.IsZero(m.ClassCSchedulingType) { // not required + return nil + } + + if err := m.ClassCSchedulingType.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classCSchedulingType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classCSchedulingType") + } + return err + } + } + + return nil +} + +func (m *APIMulticastGroup) contextValidateGroupType(ctx context.Context, formats strfmt.Registry) error { + + if m.GroupType != nil { + + if swag.IsZero(m.GroupType) { // not required + return nil + } + + if err := m.GroupType.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("groupType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("groupType") + } + return err + } + } + + return nil +} + +func (m *APIMulticastGroup) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error { + + if m.Region != nil { + + if swag.IsZero(m.Region) { // not required + return nil + } + + if err := m.Region.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIMulticastGroup) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIMulticastGroup) UnmarshalBinary(b []byte) error { + var res APIMulticastGroup + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_multicast_group_list_item.go b/internal/app/service/lora/chirp_stack/models/api_multicast_group_list_item.go new file mode 100644 index 0000000..e57cdac --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_multicast_group_list_item.go @@ -0,0 +1,207 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIMulticastGroupListItem api multicast group list item +// +// swagger:model apiMulticastGroupListItem +type APIMulticastGroupListItem struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Multicast group type. + GroupType *APIMulticastGroupType `json:"groupType,omitempty"` + + // ID. + ID string `json:"id,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Region. + Region *CommonRegion `json:"region,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api multicast group list item +func (m *APIMulticastGroupListItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGroupType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIMulticastGroupListItem) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIMulticastGroupListItem) validateGroupType(formats strfmt.Registry) error { + if swag.IsZero(m.GroupType) { // not required + return nil + } + + if m.GroupType != nil { + if err := m.GroupType.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("groupType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("groupType") + } + return err + } + } + + return nil +} + +func (m *APIMulticastGroupListItem) validateRegion(formats strfmt.Registry) error { + if swag.IsZero(m.Region) { // not required + return nil + } + + if m.Region != nil { + if err := m.Region.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +func (m *APIMulticastGroupListItem) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api multicast group list item based on the context it is used +func (m *APIMulticastGroupListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGroupType(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRegion(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIMulticastGroupListItem) contextValidateGroupType(ctx context.Context, formats strfmt.Registry) error { + + if m.GroupType != nil { + + if swag.IsZero(m.GroupType) { // not required + return nil + } + + if err := m.GroupType.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("groupType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("groupType") + } + return err + } + } + + return nil +} + +func (m *APIMulticastGroupListItem) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error { + + if m.Region != nil { + + if swag.IsZero(m.Region) { // not required + return nil + } + + if err := m.Region.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIMulticastGroupListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIMulticastGroupListItem) UnmarshalBinary(b []byte) error { + var res APIMulticastGroupListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_multicast_group_queue_item.go b/internal/app/service/lora/chirp_stack/models/api_multicast_group_queue_item.go new file mode 100644 index 0000000..81739fb --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_multicast_group_queue_item.go @@ -0,0 +1,89 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIMulticastGroupQueueItem api multicast group queue item +// +// swagger:model apiMulticastGroupQueueItem +type APIMulticastGroupQueueItem struct { + + // Payload. + // Format: byte + Data strfmt.Base64 `json:"data,omitempty"` + + // Expires at (optional). + // Expired queue-items will be automatically removed from the queue. + // Format: date-time + ExpiresAt strfmt.DateTime `json:"expiresAt,omitempty"` + + // Downlink frame-counter. + // This will be automatically set on enqueue. + FCnt int64 `json:"fCnt,omitempty"` + + // FPort (must be > 0). + FPort int64 `json:"fPort,omitempty"` + + // Multicast group ID. + MulticastGroupID string `json:"multicastGroupId,omitempty"` +} + +// Validate validates this api multicast group queue item +func (m *APIMulticastGroupQueueItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateExpiresAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIMulticastGroupQueueItem) validateExpiresAt(formats strfmt.Registry) error { + if swag.IsZero(m.ExpiresAt) { // not required + return nil + } + + if err := validate.FormatOf("expiresAt", "body", "date-time", m.ExpiresAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this api multicast group queue item based on context it is used +func (m *APIMulticastGroupQueueItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIMulticastGroupQueueItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIMulticastGroupQueueItem) UnmarshalBinary(b []byte) error { + var res APIMulticastGroupQueueItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_multicast_group_scheduling_type.go b/internal/app/service/lora/chirp_stack/models/api_multicast_group_scheduling_type.go new file mode 100644 index 0000000..dfdfb27 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_multicast_group_scheduling_type.go @@ -0,0 +1,85 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APIMulticastGroupSchedulingType - DELAY: Delay. +// If multicast downlinks must be sent through multiple gateways, then +// these will be sent one by one with a delay between each gateway. +// - GPS_TIME: Time. +// +// If multicast downlinks must be sent through multiple gateways, then +// these will be sent simultaneously using GPS time synchronization. +// Note that this does require GPS time-synchronized LoRa gateways. +// +// swagger:model apiMulticastGroupSchedulingType +type APIMulticastGroupSchedulingType string + +func NewAPIMulticastGroupSchedulingType(value APIMulticastGroupSchedulingType) *APIMulticastGroupSchedulingType { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APIMulticastGroupSchedulingType. +func (m APIMulticastGroupSchedulingType) Pointer() *APIMulticastGroupSchedulingType { + return &m +} + +const ( + + // APIMulticastGroupSchedulingTypeDELAY captures enum value "DELAY" + APIMulticastGroupSchedulingTypeDELAY APIMulticastGroupSchedulingType = "DELAY" + + // APIMulticastGroupSchedulingTypeGPSTIME captures enum value "GPS_TIME" + APIMulticastGroupSchedulingTypeGPSTIME APIMulticastGroupSchedulingType = "GPS_TIME" +) + +// for schema +var apiMulticastGroupSchedulingTypeEnum []interface{} + +func init() { + var res []APIMulticastGroupSchedulingType + if err := json.Unmarshal([]byte(`["DELAY","GPS_TIME"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiMulticastGroupSchedulingTypeEnum = append(apiMulticastGroupSchedulingTypeEnum, v) + } +} + +func (m APIMulticastGroupSchedulingType) validateAPIMulticastGroupSchedulingTypeEnum(path, location string, value APIMulticastGroupSchedulingType) error { + if err := validate.EnumCase(path, location, value, apiMulticastGroupSchedulingTypeEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api multicast group scheduling type +func (m APIMulticastGroupSchedulingType) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPIMulticastGroupSchedulingTypeEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api multicast group scheduling type based on context it is used +func (m APIMulticastGroupSchedulingType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_multicast_group_type.go b/internal/app/service/lora/chirp_stack/models/api_multicast_group_type.go new file mode 100644 index 0000000..46741e5 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_multicast_group_type.go @@ -0,0 +1,79 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APIMulticastGroupType - CLASS_C: Class C. +// - CLASS_B: Class-B. +// +// swagger:model apiMulticastGroupType +type APIMulticastGroupType string + +func NewAPIMulticastGroupType(value APIMulticastGroupType) *APIMulticastGroupType { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APIMulticastGroupType. +func (m APIMulticastGroupType) Pointer() *APIMulticastGroupType { + return &m +} + +const ( + + // APIMulticastGroupTypeCLASSC captures enum value "CLASS_C" + APIMulticastGroupTypeCLASSC APIMulticastGroupType = "CLASS_C" + + // APIMulticastGroupTypeCLASSB captures enum value "CLASS_B" + APIMulticastGroupTypeCLASSB APIMulticastGroupType = "CLASS_B" +) + +// for schema +var apiMulticastGroupTypeEnum []interface{} + +func init() { + var res []APIMulticastGroupType + if err := json.Unmarshal([]byte(`["CLASS_C","CLASS_B"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiMulticastGroupTypeEnum = append(apiMulticastGroupTypeEnum, v) + } +} + +func (m APIMulticastGroupType) validateAPIMulticastGroupTypeEnum(path, location string, value APIMulticastGroupType) error { + if err := validate.EnumCase(path, location, value, apiMulticastGroupTypeEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api multicast group type +func (m APIMulticastGroupType) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPIMulticastGroupTypeEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api multicast group type based on context it is used +func (m APIMulticastGroupType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_my_devices_integration.go b/internal/app/service/lora/chirp_stack/models/api_my_devices_integration.go new file mode 100644 index 0000000..db5fc2f --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_my_devices_integration.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIMyDevicesIntegration api my devices integration +// +// swagger:model apiMyDevicesIntegration +type APIMyDevicesIntegration struct { + + // Application ID (UUID). + ApplicationID string `json:"applicationId,omitempty"` + + // myDevices API endpoint. + Endpoint string `json:"endpoint,omitempty"` +} + +// Validate validates this api my devices integration +func (m *APIMyDevicesIntegration) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api my devices integration based on context it is used +func (m *APIMyDevicesIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIMyDevicesIntegration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIMyDevicesIntegration) UnmarshalBinary(b []byte) error { + var res APIMyDevicesIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_pilot_things_integration.go b/internal/app/service/lora/chirp_stack/models/api_pilot_things_integration.go new file mode 100644 index 0000000..a1281d3 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_pilot_things_integration.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIPilotThingsIntegration api pilot things integration +// +// swagger:model apiPilotThingsIntegration +type APIPilotThingsIntegration struct { + + // Application ID (UUID). + ApplicationID string `json:"applicationId,omitempty"` + + // Server URL. + Server string `json:"server,omitempty"` + + // Authentication token. + Token string `json:"token,omitempty"` +} + +// Validate validates this api pilot things integration +func (m *APIPilotThingsIntegration) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api pilot things integration based on context it is used +func (m *APIPilotThingsIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIPilotThingsIntegration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIPilotThingsIntegration) UnmarshalBinary(b []byte) error { + var res APIPilotThingsIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_relay_gateway.go b/internal/app/service/lora/chirp_stack/models/api_relay_gateway.go new file mode 100644 index 0000000..cf9879c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_relay_gateway.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIRelayGateway api relay gateway +// +// swagger:model apiRelayGateway +type APIRelayGateway struct { + + // Description. + Description string `json:"description,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Region configuration ID. + RegionConfigID string `json:"regionConfigId,omitempty"` + + // Relay ID (4 byte HEX). + RelayID string `json:"relayId,omitempty"` + + // Stats interval (seconds). + // This defines the expected interval in which the gateway sends its + // statistics. + StatsInterval int64 `json:"statsInterval,omitempty"` + + // Tenant ID. + TenantID string `json:"tenantId,omitempty"` +} + +// Validate validates this api relay gateway +func (m *APIRelayGateway) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api relay gateway based on context it is used +func (m *APIRelayGateway) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIRelayGateway) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIRelayGateway) UnmarshalBinary(b []byte) error { + var res APIRelayGateway + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_relay_gateway_list_item.go b/internal/app/service/lora/chirp_stack/models/api_relay_gateway_list_item.go new file mode 100644 index 0000000..ff19f14 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_relay_gateway_list_item.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIRelayGatewayListItem api relay gateway list item +// +// swagger:model apiRelayGatewayListItem +type APIRelayGatewayListItem struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Description. + Description string `json:"description,omitempty"` + + // Last seen at timestamp. + // Format: date-time + LastSeenAt strfmt.DateTime `json:"lastSeenAt,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Region configuration ID. + RegionConfigID string `json:"regionConfigId,omitempty"` + + // Relay ID (4 byte HEX). + RelayID string `json:"relayId,omitempty"` + + // Gateway state. + // Please note that the state of the relay is driven by the last + // received stats packet sent by the relay-gateway. + State *APIGatewayState `json:"state,omitempty"` + + // Tenant ID. + TenantID string `json:"tenantId,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api relay gateway list item +func (m *APIRelayGatewayListItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastSeenAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIRelayGatewayListItem) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIRelayGatewayListItem) validateLastSeenAt(formats strfmt.Registry) error { + if swag.IsZero(m.LastSeenAt) { // not required + return nil + } + + if err := validate.FormatOf("lastSeenAt", "body", "date-time", m.LastSeenAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIRelayGatewayListItem) validateState(formats strfmt.Registry) error { + if swag.IsZero(m.State) { // not required + return nil + } + + if m.State != nil { + if err := m.State.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("state") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("state") + } + return err + } + } + + return nil +} + +func (m *APIRelayGatewayListItem) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this api relay gateway list item based on the context it is used +func (m *APIRelayGatewayListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateState(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIRelayGatewayListItem) contextValidateState(ctx context.Context, formats strfmt.Registry) error { + + if m.State != nil { + + if swag.IsZero(m.State) { // not required + return nil + } + + if err := m.State.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("state") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("state") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *APIRelayGatewayListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIRelayGatewayListItem) UnmarshalBinary(b []byte) error { + var res APIRelayGatewayListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_relay_mode_activation.go b/internal/app/service/lora/chirp_stack/models/api_relay_mode_activation.go new file mode 100644 index 0000000..0874e46 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_relay_mode_activation.go @@ -0,0 +1,87 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APIRelayModeActivation - DISABLE_RELAY_MODE: Disable the relay mode. +// - ENABLE_RELAY_MODE: Enable the relay model. +// - DYNAMIC: Dynamic. +// - END_DEVICE_CONTROLLED: End-device controlled. +// +// swagger:model apiRelayModeActivation +type APIRelayModeActivation string + +func NewAPIRelayModeActivation(value APIRelayModeActivation) *APIRelayModeActivation { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APIRelayModeActivation. +func (m APIRelayModeActivation) Pointer() *APIRelayModeActivation { + return &m +} + +const ( + + // APIRelayModeActivationDISABLERELAYMODE captures enum value "DISABLE_RELAY_MODE" + APIRelayModeActivationDISABLERELAYMODE APIRelayModeActivation = "DISABLE_RELAY_MODE" + + // APIRelayModeActivationENABLERELAYMODE captures enum value "ENABLE_RELAY_MODE" + APIRelayModeActivationENABLERELAYMODE APIRelayModeActivation = "ENABLE_RELAY_MODE" + + // APIRelayModeActivationDYNAMIC captures enum value "DYNAMIC" + APIRelayModeActivationDYNAMIC APIRelayModeActivation = "DYNAMIC" + + // APIRelayModeActivationENDDEVICECONTROLLED captures enum value "END_DEVICE_CONTROLLED" + APIRelayModeActivationENDDEVICECONTROLLED APIRelayModeActivation = "END_DEVICE_CONTROLLED" +) + +// for schema +var apiRelayModeActivationEnum []interface{} + +func init() { + var res []APIRelayModeActivation + if err := json.Unmarshal([]byte(`["DISABLE_RELAY_MODE","ENABLE_RELAY_MODE","DYNAMIC","END_DEVICE_CONTROLLED"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiRelayModeActivationEnum = append(apiRelayModeActivationEnum, v) + } +} + +func (m APIRelayModeActivation) validateAPIRelayModeActivationEnum(path, location string, value APIRelayModeActivation) error { + if err := validate.EnumCase(path, location, value, apiRelayModeActivationEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api relay mode activation +func (m APIRelayModeActivation) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPIRelayModeActivationEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api relay mode activation based on context it is used +func (m APIRelayModeActivation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_second_ch_ack_offset.go b/internal/app/service/lora/chirp_stack/models/api_second_ch_ack_offset.go new file mode 100644 index 0000000..59050ee --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_second_ch_ack_offset.go @@ -0,0 +1,95 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APISecondChAckOffset - KHZ_0: 0 kHz. +// - KHZ_200: 200 kHz. +// - KHZ_400: 400 kHz. +// - KHZ_800: 800 kHz. +// - KHZ_1600: 1600 kHz. +// - KHZ_3200: 3200 kHz. +// +// swagger:model apiSecondChAckOffset +type APISecondChAckOffset string + +func NewAPISecondChAckOffset(value APISecondChAckOffset) *APISecondChAckOffset { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APISecondChAckOffset. +func (m APISecondChAckOffset) Pointer() *APISecondChAckOffset { + return &m +} + +const ( + + // APISecondChAckOffsetKHZ0 captures enum value "KHZ_0" + APISecondChAckOffsetKHZ0 APISecondChAckOffset = "KHZ_0" + + // APISecondChAckOffsetKHZ200 captures enum value "KHZ_200" + APISecondChAckOffsetKHZ200 APISecondChAckOffset = "KHZ_200" + + // APISecondChAckOffsetKHZ400 captures enum value "KHZ_400" + APISecondChAckOffsetKHZ400 APISecondChAckOffset = "KHZ_400" + + // APISecondChAckOffsetKHZ800 captures enum value "KHZ_800" + APISecondChAckOffsetKHZ800 APISecondChAckOffset = "KHZ_800" + + // APISecondChAckOffsetKHZ1600 captures enum value "KHZ_1600" + APISecondChAckOffsetKHZ1600 APISecondChAckOffset = "KHZ_1600" + + // APISecondChAckOffsetKHZ3200 captures enum value "KHZ_3200" + APISecondChAckOffsetKHZ3200 APISecondChAckOffset = "KHZ_3200" +) + +// for schema +var apiSecondChAckOffsetEnum []interface{} + +func init() { + var res []APISecondChAckOffset + if err := json.Unmarshal([]byte(`["KHZ_0","KHZ_200","KHZ_400","KHZ_800","KHZ_1600","KHZ_3200"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiSecondChAckOffsetEnum = append(apiSecondChAckOffsetEnum, v) + } +} + +func (m APISecondChAckOffset) validateAPISecondChAckOffsetEnum(path, location string, value APISecondChAckOffset) error { + if err := validate.EnumCase(path, location, value, apiSecondChAckOffsetEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api second ch ack offset +func (m APISecondChAckOffset) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPISecondChAckOffsetEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api second ch ack offset based on context it is used +func (m APISecondChAckOffset) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_tenant.go b/internal/app/service/lora/chirp_stack/models/api_tenant.go new file mode 100644 index 0000000..1ca39f5 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_tenant.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APITenant api tenant +// +// swagger:model apiTenant +type APITenant struct { + + // Can the tenant create and "own" Gateways? + CanHaveGateways bool `json:"canHaveGateways,omitempty"` + + // Tenant description. + Description string `json:"description,omitempty"` + + // Tenant ID (UUID). + // Note: this value will be automatically generated on create. + ID string `json:"id,omitempty"` + + // Max. device count for tenant. + // When set to 0, the tenant can have unlimited devices. + MaxDeviceCount int64 `json:"maxDeviceCount,omitempty"` + + // Max. gateway count for tenant. + // When set to 0, the tenant can have unlimited gateways. + MaxGatewayCount int64 `json:"maxGatewayCount,omitempty"` + + // Tenant name, + Name string `json:"name,omitempty"` + + // Private gateways (downlink). + // If enabled, then other tenants will not be able to schedule downlink + // messages through the gateways of this tenant. For example, in case you + // do want to share uplinks with other tenants (private_gateways_up=false), + // but you want to prevent other tenants from using gateway airtime. + PrivateGatewaysDown bool `json:"privateGatewaysDown,omitempty"` + + // Private gateways (uplink). + // If enabled, then uplink messages will not be shared with other tenants. + PrivateGatewaysUp bool `json:"privateGatewaysUp,omitempty"` + + // Tags (user defined). + // These tags can be used to add additional information to the tenant. These + // tags are NOT exposed in the integration events. + Tags map[string]string `json:"tags,omitempty"` +} + +// Validate validates this api tenant +func (m *APITenant) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api tenant based on context it is used +func (m *APITenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APITenant) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APITenant) UnmarshalBinary(b []byte) error { + var res APITenant + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_tenant_list_item.go b/internal/app/service/lora/chirp_stack/models/api_tenant_list_item.go new file mode 100644 index 0000000..5eea49e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_tenant_list_item.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APITenantListItem api tenant list item +// +// swagger:model apiTenantListItem +type APITenantListItem struct { + + // Can the tenant create and "own" Gateways? + CanHaveGateways bool `json:"canHaveGateways,omitempty"` + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Tenant ID (UUID). + ID string `json:"id,omitempty"` + + // Max device count. + // 0 = unlimited. + MaxDeviceCount int64 `json:"maxDeviceCount,omitempty"` + + // Max gateway count. + // 0 = unlimited. + MaxGatewayCount int64 `json:"maxGatewayCount,omitempty"` + + // Tenant name. + Name string `json:"name,omitempty"` + + // Private gateways (downlink). + PrivateGatewaysDown bool `json:"privateGatewaysDown,omitempty"` + + // Private gateways (uplink). + PrivateGatewaysUp bool `json:"privateGatewaysUp,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api tenant list item +func (m *APITenantListItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APITenantListItem) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APITenantListItem) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this api tenant list item based on context it is used +func (m *APITenantListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APITenantListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APITenantListItem) UnmarshalBinary(b []byte) error { + var res APITenantListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_tenant_user.go b/internal/app/service/lora/chirp_stack/models/api_tenant_user.go new file mode 100644 index 0000000..ebbad4c --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_tenant_user.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APITenantUser api tenant user +// +// swagger:model apiTenantUser +type APITenantUser struct { + + // Email (only used on get and when adding a user to a tenant). + Email string `json:"email,omitempty"` + + // User is admin within the context of the tenant. + // There is no need to set the is_device_admin and is_gateway_admin flags. + IsAdmin bool `json:"isAdmin,omitempty"` + + // User is able to modify device related resources (applications, + // device-profiles, devices, multicast-groups). + IsDeviceAdmin bool `json:"isDeviceAdmin,omitempty"` + + // User is able to modify gateways. + IsGatewayAdmin bool `json:"isGatewayAdmin,omitempty"` + + // Tenant ID (UUID). + TenantID string `json:"tenantId,omitempty"` + + // User ID (UUID). + UserID string `json:"userId,omitempty"` +} + +// Validate validates this api tenant user +func (m *APITenantUser) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api tenant user based on context it is used +func (m *APITenantUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APITenantUser) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APITenantUser) UnmarshalBinary(b []byte) error { + var res APITenantUser + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_tenant_user_list_item.go b/internal/app/service/lora/chirp_stack/models/api_tenant_user_list_item.go new file mode 100644 index 0000000..3b7fa8b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_tenant_user_list_item.go @@ -0,0 +1,114 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APITenantUserListItem api tenant user list item +// +// swagger:model apiTenantUserListItem +type APITenantUserListItem struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Email. + Email string `json:"email,omitempty"` + + // User is admin within the context of the tenant. + // There is no need to set the is_device_admin and is_gateway_admin flags. + IsAdmin bool `json:"isAdmin,omitempty"` + + // User is able to modify device related resources (applications, + // device-profiles, devices, multicast-groups). + IsDeviceAdmin bool `json:"isDeviceAdmin,omitempty"` + + // User is able to modify gateways. + IsGatewayAdmin bool `json:"isGatewayAdmin,omitempty"` + + // Tenant ID (UUID). + TenantID string `json:"tenantId,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` + + // User ID (UUID). + UserID string `json:"userId,omitempty"` +} + +// Validate validates this api tenant user list item +func (m *APITenantUserListItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APITenantUserListItem) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APITenantUserListItem) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this api tenant user list item based on context it is used +func (m *APITenantUserListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APITenantUserListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APITenantUserListItem) UnmarshalBinary(b []byte) error { + var res APITenantUserListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_things_board_integration.go b/internal/app/service/lora/chirp_stack/models/api_things_board_integration.go new file mode 100644 index 0000000..bbfa2e1 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_things_board_integration.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIThingsBoardIntegration api things board integration +// +// swagger:model apiThingsBoardIntegration +type APIThingsBoardIntegration struct { + + // Application ID (UUID). + ApplicationID string `json:"applicationId,omitempty"` + + // ThingsBoard server endpoint, e.g. https://example.com + Server string `json:"server,omitempty"` +} + +// Validate validates this api things board integration +func (m *APIThingsBoardIntegration) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api things board integration based on context it is used +func (m *APIThingsBoardIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIThingsBoardIntegration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIThingsBoardIntegration) UnmarshalBinary(b []byte) error { + var res APIThingsBoardIntegration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_ts003_version.go b/internal/app/service/lora/chirp_stack/models/api_ts003_version.go new file mode 100644 index 0000000..5dfd4e3 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_ts003_version.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APITs003Version - TS003_NOT_IMPLEMENTED: Not implemented. +// - TS003_V100: v1.0.0. +// - TS003_v200: v2.0.0 +// +// swagger:model apiTs003Version +type APITs003Version string + +func NewAPITs003Version(value APITs003Version) *APITs003Version { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APITs003Version. +func (m APITs003Version) Pointer() *APITs003Version { + return &m +} + +const ( + + // APITs003VersionTS003NOTIMPLEMENTED captures enum value "TS003_NOT_IMPLEMENTED" + APITs003VersionTS003NOTIMPLEMENTED APITs003Version = "TS003_NOT_IMPLEMENTED" + + // APITs003VersionTS003V100 captures enum value "TS003_V100" + APITs003VersionTS003V100 APITs003Version = "TS003_V100" + + // APITs003VersionTS003V200 captures enum value "TS003_v200" + APITs003VersionTS003V200 APITs003Version = "TS003_v200" +) + +// for schema +var apiTs003VersionEnum []interface{} + +func init() { + var res []APITs003Version + if err := json.Unmarshal([]byte(`["TS003_NOT_IMPLEMENTED","TS003_V100","TS003_v200"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiTs003VersionEnum = append(apiTs003VersionEnum, v) + } +} + +func (m APITs003Version) validateAPITs003VersionEnum(path, location string, value APITs003Version) error { + if err := validate.EnumCase(path, location, value, apiTs003VersionEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api ts003 version +func (m APITs003Version) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPITs003VersionEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api ts003 version based on context it is used +func (m APITs003Version) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_ts004_version.go b/internal/app/service/lora/chirp_stack/models/api_ts004_version.go new file mode 100644 index 0000000..72fec2b --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_ts004_version.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APITs004Version - TS004_NOT_IMPLEMENTED: Not implemented. +// - TS004_V100: v1.0.0. +// - TS004_V200: v2.0.0 +// +// swagger:model apiTs004Version +type APITs004Version string + +func NewAPITs004Version(value APITs004Version) *APITs004Version { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APITs004Version. +func (m APITs004Version) Pointer() *APITs004Version { + return &m +} + +const ( + + // APITs004VersionTS004NOTIMPLEMENTED captures enum value "TS004_NOT_IMPLEMENTED" + APITs004VersionTS004NOTIMPLEMENTED APITs004Version = "TS004_NOT_IMPLEMENTED" + + // APITs004VersionTS004V100 captures enum value "TS004_V100" + APITs004VersionTS004V100 APITs004Version = "TS004_V100" + + // APITs004VersionTS004V200 captures enum value "TS004_V200" + APITs004VersionTS004V200 APITs004Version = "TS004_V200" +) + +// for schema +var apiTs004VersionEnum []interface{} + +func init() { + var res []APITs004Version + if err := json.Unmarshal([]byte(`["TS004_NOT_IMPLEMENTED","TS004_V100","TS004_V200"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiTs004VersionEnum = append(apiTs004VersionEnum, v) + } +} + +func (m APITs004Version) validateAPITs004VersionEnum(path, location string, value APITs004Version) error { + if err := validate.EnumCase(path, location, value, apiTs004VersionEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api ts004 version +func (m APITs004Version) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPITs004VersionEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api ts004 version based on context it is used +func (m APITs004Version) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_ts005_version.go b/internal/app/service/lora/chirp_stack/models/api_ts005_version.go new file mode 100644 index 0000000..564fd7a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_ts005_version.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// APITs005Version - TS005_NOT_IMPLEMENTED: Not implemented. +// - TS005_V100: v1.0.0. +// - TS005_V200: v2.0.0 +// +// swagger:model apiTs005Version +type APITs005Version string + +func NewAPITs005Version(value APITs005Version) *APITs005Version { + return &value +} + +// Pointer returns a pointer to a freshly-allocated APITs005Version. +func (m APITs005Version) Pointer() *APITs005Version { + return &m +} + +const ( + + // APITs005VersionTS005NOTIMPLEMENTED captures enum value "TS005_NOT_IMPLEMENTED" + APITs005VersionTS005NOTIMPLEMENTED APITs005Version = "TS005_NOT_IMPLEMENTED" + + // APITs005VersionTS005V100 captures enum value "TS005_V100" + APITs005VersionTS005V100 APITs005Version = "TS005_V100" + + // APITs005VersionTS005V200 captures enum value "TS005_V200" + APITs005VersionTS005V200 APITs005Version = "TS005_V200" +) + +// for schema +var apiTs005VersionEnum []interface{} + +func init() { + var res []APITs005Version + if err := json.Unmarshal([]byte(`["TS005_NOT_IMPLEMENTED","TS005_V100","TS005_V200"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + apiTs005VersionEnum = append(apiTs005VersionEnum, v) + } +} + +func (m APITs005Version) validateAPITs005VersionEnum(path, location string, value APITs005Version) error { + if err := validate.EnumCase(path, location, value, apiTs005VersionEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this api ts005 version +func (m APITs005Version) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAPITs005VersionEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this api ts005 version based on context it is used +func (m APITs005Version) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_user.go b/internal/app/service/lora/chirp_stack/models/api_user.go new file mode 100644 index 0000000..c2c3ab2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_user.go @@ -0,0 +1,63 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIUser api user +// +// swagger:model apiUser +type APIUser struct { + + // E-mail of the user. + Email string `json:"email,omitempty"` + + // User ID (UUID). + // Will be set automatically on create. + ID string `json:"id,omitempty"` + + // Set to false to disable the user. + IsActive bool `json:"isActive,omitempty"` + + // Set to true to make the user a global administrator. + IsAdmin bool `json:"isAdmin,omitempty"` + + // Optional note to store with the user. + Note string `json:"note,omitempty"` +} + +// Validate validates this api user +func (m *APIUser) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api user based on context it is used +func (m *APIUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIUser) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIUser) UnmarshalBinary(b []byte) error { + var res APIUser + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_user_list_item.go b/internal/app/service/lora/chirp_stack/models/api_user_list_item.go new file mode 100644 index 0000000..da63d26 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_user_list_item.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// APIUserListItem api user list item +// +// swagger:model apiUserListItem +type APIUserListItem struct { + + // Created at timestamp. + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // Email of the user. + Email string `json:"email,omitempty"` + + // User ID (UUID). + ID string `json:"id,omitempty"` + + // Set to false to disable the user. + IsActive bool `json:"isActive,omitempty"` + + // Set to true to make the user a global administrator. + IsAdmin bool `json:"isAdmin,omitempty"` + + // Last update timestamp. + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this api user list item +func (m *APIUserListItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *APIUserListItem) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *APIUserListItem) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this api user list item based on context it is used +func (m *APIUserListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIUserListItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIUserListItem) UnmarshalBinary(b []byte) error { + var res APIUserListItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/api_user_tenant.go b/internal/app/service/lora/chirp_stack/models/api_user_tenant.go new file mode 100644 index 0000000..11db13d --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/api_user_tenant.go @@ -0,0 +1,61 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// APIUserTenant api user tenant +// +// swagger:model apiUserTenant +type APIUserTenant struct { + + // User is admin within the context of the tenant. + // There is no need to set the is_device_admin and is_gateway_admin flags. + IsAdmin bool `json:"isAdmin,omitempty"` + + // User is able to modify device related resources (applications, + // device-profiles, devices, multicast-groups). + IsDeviceAdmin bool `json:"isDeviceAdmin,omitempty"` + + // User is able to modify gateways. + IsGatewayAdmin bool `json:"isGatewayAdmin,omitempty"` + + // Tenant ID. + TenantID string `json:"tenantId,omitempty"` +} + +// Validate validates this api user tenant +func (m *APIUserTenant) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this api user tenant based on context it is used +func (m *APIUserTenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *APIUserTenant) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *APIUserTenant) UnmarshalBinary(b []byte) error { + var res APIUserTenant + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/common_aggregation.go b/internal/app/service/lora/chirp_stack/models/common_aggregation.go new file mode 100644 index 0000000..626c7b2 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/common_aggregation.go @@ -0,0 +1,87 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// CommonAggregation - HOUR: Hour. +// - DAY: Day. +// - MONTH: Month. +// - MINUTE: Minute. +// +// swagger:model commonAggregation +type CommonAggregation string + +func NewCommonAggregation(value CommonAggregation) *CommonAggregation { + return &value +} + +// Pointer returns a pointer to a freshly-allocated CommonAggregation. +func (m CommonAggregation) Pointer() *CommonAggregation { + return &m +} + +const ( + + // CommonAggregationHOUR captures enum value "HOUR" + CommonAggregationHOUR CommonAggregation = "HOUR" + + // CommonAggregationDAY captures enum value "DAY" + CommonAggregationDAY CommonAggregation = "DAY" + + // CommonAggregationMONTH captures enum value "MONTH" + CommonAggregationMONTH CommonAggregation = "MONTH" + + // CommonAggregationMINUTE captures enum value "MINUTE" + CommonAggregationMINUTE CommonAggregation = "MINUTE" +) + +// for schema +var commonAggregationEnum []interface{} + +func init() { + var res []CommonAggregation + if err := json.Unmarshal([]byte(`["HOUR","DAY","MONTH","MINUTE"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + commonAggregationEnum = append(commonAggregationEnum, v) + } +} + +func (m CommonAggregation) validateCommonAggregationEnum(path, location string, value CommonAggregation) error { + if err := validate.EnumCase(path, location, value, commonAggregationEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this common aggregation +func (m CommonAggregation) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateCommonAggregationEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this common aggregation based on context it is used +func (m CommonAggregation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/common_device_class.go b/internal/app/service/lora/chirp_stack/models/common_device_class.go new file mode 100644 index 0000000..25a6b81 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/common_device_class.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// CommonDeviceClass - CLASS_A: Class-A. +// - CLASS_B: Class-B. +// - CLASS_C: Class-C. +// +// swagger:model commonDeviceClass +type CommonDeviceClass string + +func NewCommonDeviceClass(value CommonDeviceClass) *CommonDeviceClass { + return &value +} + +// Pointer returns a pointer to a freshly-allocated CommonDeviceClass. +func (m CommonDeviceClass) Pointer() *CommonDeviceClass { + return &m +} + +const ( + + // CommonDeviceClassCLASSA captures enum value "CLASS_A" + CommonDeviceClassCLASSA CommonDeviceClass = "CLASS_A" + + // CommonDeviceClassCLASSB captures enum value "CLASS_B" + CommonDeviceClassCLASSB CommonDeviceClass = "CLASS_B" + + // CommonDeviceClassCLASSC captures enum value "CLASS_C" + CommonDeviceClassCLASSC CommonDeviceClass = "CLASS_C" +) + +// for schema +var commonDeviceClassEnum []interface{} + +func init() { + var res []CommonDeviceClass + if err := json.Unmarshal([]byte(`["CLASS_A","CLASS_B","CLASS_C"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + commonDeviceClassEnum = append(commonDeviceClassEnum, v) + } +} + +func (m CommonDeviceClass) validateCommonDeviceClassEnum(path, location string, value CommonDeviceClass) error { + if err := validate.EnumCase(path, location, value, commonDeviceClassEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this common device class +func (m CommonDeviceClass) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateCommonDeviceClassEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this common device class based on context it is used +func (m CommonDeviceClass) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/common_join_server_context.go b/internal/app/service/lora/chirp_stack/models/common_join_server_context.go new file mode 100644 index 0000000..9506951 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/common_join_server_context.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CommonJoinServerContext Join-Server context. +// +// swagger:model commonJoinServerContext +type CommonJoinServerContext struct { + + // AppSKey envelope. + AppSKey *CommonKeyEnvelope `json:"appSKey,omitempty"` + + // Session-key ID. + SessionKeyID string `json:"sessionKeyId,omitempty"` +} + +// Validate validates this common join server context +func (m *CommonJoinServerContext) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAppSKey(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CommonJoinServerContext) validateAppSKey(formats strfmt.Registry) error { + if swag.IsZero(m.AppSKey) { // not required + return nil + } + + if m.AppSKey != nil { + if err := m.AppSKey.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("appSKey") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("appSKey") + } + return err + } + } + + return nil +} + +// ContextValidate validate this common join server context based on the context it is used +func (m *CommonJoinServerContext) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAppSKey(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CommonJoinServerContext) contextValidateAppSKey(ctx context.Context, formats strfmt.Registry) error { + + if m.AppSKey != nil { + + if swag.IsZero(m.AppSKey) { // not required + return nil + } + + if err := m.AppSKey.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("appSKey") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("appSKey") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CommonJoinServerContext) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CommonJoinServerContext) UnmarshalBinary(b []byte) error { + var res CommonJoinServerContext + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/common_key_envelope.go b/internal/app/service/lora/chirp_stack/models/common_key_envelope.go new file mode 100644 index 0000000..f7a401a --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/common_key_envelope.go @@ -0,0 +1,54 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CommonKeyEnvelope common key envelope +// +// swagger:model commonKeyEnvelope +type CommonKeyEnvelope struct { + + // AES key (when the kek_label is set, this value must first be decrypted). + // Format: byte + AesKey strfmt.Base64 `json:"aesKey,omitempty"` + + // KEK label. + KekLabel string `json:"kekLabel,omitempty"` +} + +// Validate validates this common key envelope +func (m *CommonKeyEnvelope) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this common key envelope based on context it is used +func (m *CommonKeyEnvelope) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CommonKeyEnvelope) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CommonKeyEnvelope) UnmarshalBinary(b []byte) error { + var res CommonKeyEnvelope + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/common_location.go b/internal/app/service/lora/chirp_stack/models/common_location.go new file mode 100644 index 0000000..4bd2af0 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/common_location.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CommonLocation common location +// +// swagger:model commonLocation +type CommonLocation struct { + + // Accuracy. + Accuracy float32 `json:"accuracy,omitempty"` + + // Altitude. + Altitude float64 `json:"altitude,omitempty"` + + // Latitude. + Latitude float64 `json:"latitude,omitempty"` + + // Longitude. + Longitude float64 `json:"longitude,omitempty"` + + // Location source. + Source *CommonLocationSource `json:"source,omitempty"` +} + +// Validate validates this common location +func (m *CommonLocation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CommonLocation) validateSource(formats strfmt.Registry) error { + if swag.IsZero(m.Source) { // not required + return nil + } + + if m.Source != nil { + if err := m.Source.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// ContextValidate validate this common location based on the context it is used +func (m *CommonLocation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSource(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CommonLocation) contextValidateSource(ctx context.Context, formats strfmt.Registry) error { + + if m.Source != nil { + + if swag.IsZero(m.Source) { // not required + return nil + } + + if err := m.Source.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CommonLocation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CommonLocation) UnmarshalBinary(b []byte) error { + var res CommonLocation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/common_location_source.go b/internal/app/service/lora/chirp_stack/models/common_location_source.go new file mode 100644 index 0000000..1430601 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/common_location_source.go @@ -0,0 +1,99 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// CommonLocationSource - UNKNOWN: Unknown. +// - GPS: GPS. +// - CONFIG: Manually configured. +// - GEO_RESOLVER_TDOA: Geo resolver (TDOA). +// - GEO_RESOLVER_RSSI: Geo resolver (RSSI). +// - GEO_RESOLVER_GNSS: Geo resolver (GNSS). +// - GEO_RESOLVER_WIFI: Geo resolver (WIFI). +// +// swagger:model commonLocationSource +type CommonLocationSource string + +func NewCommonLocationSource(value CommonLocationSource) *CommonLocationSource { + return &value +} + +// Pointer returns a pointer to a freshly-allocated CommonLocationSource. +func (m CommonLocationSource) Pointer() *CommonLocationSource { + return &m +} + +const ( + + // CommonLocationSourceUNKNOWN captures enum value "UNKNOWN" + CommonLocationSourceUNKNOWN CommonLocationSource = "UNKNOWN" + + // CommonLocationSourceGPS captures enum value "GPS" + CommonLocationSourceGPS CommonLocationSource = "GPS" + + // CommonLocationSourceCONFIG captures enum value "CONFIG" + CommonLocationSourceCONFIG CommonLocationSource = "CONFIG" + + // CommonLocationSourceGEORESOLVERTDOA captures enum value "GEO_RESOLVER_TDOA" + CommonLocationSourceGEORESOLVERTDOA CommonLocationSource = "GEO_RESOLVER_TDOA" + + // CommonLocationSourceGEORESOLVERRSSI captures enum value "GEO_RESOLVER_RSSI" + CommonLocationSourceGEORESOLVERRSSI CommonLocationSource = "GEO_RESOLVER_RSSI" + + // CommonLocationSourceGEORESOLVERGNSS captures enum value "GEO_RESOLVER_GNSS" + CommonLocationSourceGEORESOLVERGNSS CommonLocationSource = "GEO_RESOLVER_GNSS" + + // CommonLocationSourceGEORESOLVERWIFI captures enum value "GEO_RESOLVER_WIFI" + CommonLocationSourceGEORESOLVERWIFI CommonLocationSource = "GEO_RESOLVER_WIFI" +) + +// for schema +var commonLocationSourceEnum []interface{} + +func init() { + var res []CommonLocationSource + if err := json.Unmarshal([]byte(`["UNKNOWN","GPS","CONFIG","GEO_RESOLVER_TDOA","GEO_RESOLVER_RSSI","GEO_RESOLVER_GNSS","GEO_RESOLVER_WIFI"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + commonLocationSourceEnum = append(commonLocationSourceEnum, v) + } +} + +func (m CommonLocationSource) validateCommonLocationSourceEnum(path, location string, value CommonLocationSource) error { + if err := validate.EnumCase(path, location, value, commonLocationSourceEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this common location source +func (m CommonLocationSource) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateCommonLocationSourceEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this common location source based on context it is used +func (m CommonLocationSource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/common_mac_version.go b/internal/app/service/lora/chirp_stack/models/common_mac_version.go new file mode 100644 index 0000000..d6c6b9e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/common_mac_version.go @@ -0,0 +1,90 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// CommonMacVersion common mac version +// +// swagger:model commonMacVersion +type CommonMacVersion string + +func NewCommonMacVersion(value CommonMacVersion) *CommonMacVersion { + return &value +} + +// Pointer returns a pointer to a freshly-allocated CommonMacVersion. +func (m CommonMacVersion) Pointer() *CommonMacVersion { + return &m +} + +const ( + + // CommonMacVersionLORAWAN100 captures enum value "LORAWAN_1_0_0" + CommonMacVersionLORAWAN100 CommonMacVersion = "LORAWAN_1_0_0" + + // CommonMacVersionLORAWAN101 captures enum value "LORAWAN_1_0_1" + CommonMacVersionLORAWAN101 CommonMacVersion = "LORAWAN_1_0_1" + + // CommonMacVersionLORAWAN102 captures enum value "LORAWAN_1_0_2" + CommonMacVersionLORAWAN102 CommonMacVersion = "LORAWAN_1_0_2" + + // CommonMacVersionLORAWAN103 captures enum value "LORAWAN_1_0_3" + CommonMacVersionLORAWAN103 CommonMacVersion = "LORAWAN_1_0_3" + + // CommonMacVersionLORAWAN104 captures enum value "LORAWAN_1_0_4" + CommonMacVersionLORAWAN104 CommonMacVersion = "LORAWAN_1_0_4" + + // CommonMacVersionLORAWAN110 captures enum value "LORAWAN_1_1_0" + CommonMacVersionLORAWAN110 CommonMacVersion = "LORAWAN_1_1_0" +) + +// for schema +var commonMacVersionEnum []interface{} + +func init() { + var res []CommonMacVersion + if err := json.Unmarshal([]byte(`["LORAWAN_1_0_0","LORAWAN_1_0_1","LORAWAN_1_0_2","LORAWAN_1_0_3","LORAWAN_1_0_4","LORAWAN_1_1_0"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + commonMacVersionEnum = append(commonMacVersionEnum, v) + } +} + +func (m CommonMacVersion) validateCommonMacVersionEnum(path, location string, value CommonMacVersion) error { + if err := validate.EnumCase(path, location, value, commonMacVersionEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this common mac version +func (m CommonMacVersion) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateCommonMacVersionEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this common mac version based on context it is used +func (m CommonMacVersion) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/common_metric.go b/internal/app/service/lora/chirp_stack/models/common_metric.go new file mode 100644 index 0000000..a220094 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/common_metric.go @@ -0,0 +1,199 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CommonMetric common metric +// +// swagger:model commonMetric +type CommonMetric struct { + + // Datasets. + Datasets []*CommonMetricDataset `json:"datasets"` + + // Kind. + Kind *CommonMetricKind `json:"kind,omitempty"` + + // Name. + Name string `json:"name,omitempty"` + + // Timestamps. + Timestamps []strfmt.DateTime `json:"timestamps"` +} + +// Validate validates this common metric +func (m *CommonMetric) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDatasets(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKind(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimestamps(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CommonMetric) validateDatasets(formats strfmt.Registry) error { + if swag.IsZero(m.Datasets) { // not required + return nil + } + + for i := 0; i < len(m.Datasets); i++ { + if swag.IsZero(m.Datasets[i]) { // not required + continue + } + + if m.Datasets[i] != nil { + if err := m.Datasets[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("datasets" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("datasets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CommonMetric) validateKind(formats strfmt.Registry) error { + if swag.IsZero(m.Kind) { // not required + return nil + } + + if m.Kind != nil { + if err := m.Kind.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("kind") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("kind") + } + return err + } + } + + return nil +} + +func (m *CommonMetric) validateTimestamps(formats strfmt.Registry) error { + if swag.IsZero(m.Timestamps) { // not required + return nil + } + + for i := 0; i < len(m.Timestamps); i++ { + + if err := validate.FormatOf("timestamps"+"."+strconv.Itoa(i), "body", "date-time", m.Timestamps[i].String(), formats); err != nil { + return err + } + + } + + return nil +} + +// ContextValidate validate this common metric based on the context it is used +func (m *CommonMetric) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDatasets(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKind(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CommonMetric) contextValidateDatasets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Datasets); i++ { + + if m.Datasets[i] != nil { + + if swag.IsZero(m.Datasets[i]) { // not required + return nil + } + + if err := m.Datasets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("datasets" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("datasets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CommonMetric) contextValidateKind(ctx context.Context, formats strfmt.Registry) error { + + if m.Kind != nil { + + if swag.IsZero(m.Kind) { // not required + return nil + } + + if err := m.Kind.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("kind") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("kind") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CommonMetric) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CommonMetric) UnmarshalBinary(b []byte) error { + var res CommonMetric + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/common_metric_dataset.go b/internal/app/service/lora/chirp_stack/models/common_metric_dataset.go new file mode 100644 index 0000000..089f085 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/common_metric_dataset.go @@ -0,0 +1,54 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CommonMetricDataset common metric dataset +// +// swagger:model commonMetricDataset +type CommonMetricDataset struct { + + // Data. + // Each value index corresponds with the same timestamp index of the Metric. + Data []float32 `json:"data"` + + // Label. + Label string `json:"label,omitempty"` +} + +// Validate validates this common metric dataset +func (m *CommonMetricDataset) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this common metric dataset based on context it is used +func (m *CommonMetricDataset) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CommonMetricDataset) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CommonMetricDataset) UnmarshalBinary(b []byte) error { + var res CommonMetricDataset + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/common_metric_kind.go b/internal/app/service/lora/chirp_stack/models/common_metric_kind.go new file mode 100644 index 0000000..f5c92ad --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/common_metric_kind.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// CommonMetricKind - COUNTER: Incrementing counters that never decrease (these are not reset on each +// reading). +// - ABSOLUTE: Counters that do get reset upon reading. +// - GAUGE: E.g. a temperature value. +// +// swagger:model commonMetricKind +type CommonMetricKind string + +func NewCommonMetricKind(value CommonMetricKind) *CommonMetricKind { + return &value +} + +// Pointer returns a pointer to a freshly-allocated CommonMetricKind. +func (m CommonMetricKind) Pointer() *CommonMetricKind { + return &m +} + +const ( + + // CommonMetricKindCOUNTER captures enum value "COUNTER" + CommonMetricKindCOUNTER CommonMetricKind = "COUNTER" + + // CommonMetricKindABSOLUTE captures enum value "ABSOLUTE" + CommonMetricKindABSOLUTE CommonMetricKind = "ABSOLUTE" + + // CommonMetricKindGAUGE captures enum value "GAUGE" + CommonMetricKindGAUGE CommonMetricKind = "GAUGE" +) + +// for schema +var commonMetricKindEnum []interface{} + +func init() { + var res []CommonMetricKind + if err := json.Unmarshal([]byte(`["COUNTER","ABSOLUTE","GAUGE"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + commonMetricKindEnum = append(commonMetricKindEnum, v) + } +} + +func (m CommonMetricKind) validateCommonMetricKindEnum(path, location string, value CommonMetricKind) error { + if err := validate.EnumCase(path, location, value, commonMetricKindEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this common metric kind +func (m CommonMetricKind) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateCommonMetricKindEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this common metric kind based on context it is used +func (m CommonMetricKind) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/common_reg_params_revision.go b/internal/app/service/lora/chirp_stack/models/common_reg_params_revision.go new file mode 100644 index 0000000..29c5398 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/common_reg_params_revision.go @@ -0,0 +1,93 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// CommonRegParamsRevision common reg params revision +// +// swagger:model commonRegParamsRevision +type CommonRegParamsRevision string + +func NewCommonRegParamsRevision(value CommonRegParamsRevision) *CommonRegParamsRevision { + return &value +} + +// Pointer returns a pointer to a freshly-allocated CommonRegParamsRevision. +func (m CommonRegParamsRevision) Pointer() *CommonRegParamsRevision { + return &m +} + +const ( + + // CommonRegParamsRevisionA captures enum value "A" + CommonRegParamsRevisionA CommonRegParamsRevision = "A" + + // CommonRegParamsRevisionB captures enum value "B" + CommonRegParamsRevisionB CommonRegParamsRevision = "B" + + // CommonRegParamsRevisionRP002100 captures enum value "RP002_1_0_0" + CommonRegParamsRevisionRP002100 CommonRegParamsRevision = "RP002_1_0_0" + + // CommonRegParamsRevisionRP002101 captures enum value "RP002_1_0_1" + CommonRegParamsRevisionRP002101 CommonRegParamsRevision = "RP002_1_0_1" + + // CommonRegParamsRevisionRP002102 captures enum value "RP002_1_0_2" + CommonRegParamsRevisionRP002102 CommonRegParamsRevision = "RP002_1_0_2" + + // CommonRegParamsRevisionRP002103 captures enum value "RP002_1_0_3" + CommonRegParamsRevisionRP002103 CommonRegParamsRevision = "RP002_1_0_3" + + // CommonRegParamsRevisionRP002104 captures enum value "RP002_1_0_4" + CommonRegParamsRevisionRP002104 CommonRegParamsRevision = "RP002_1_0_4" +) + +// for schema +var commonRegParamsRevisionEnum []interface{} + +func init() { + var res []CommonRegParamsRevision + if err := json.Unmarshal([]byte(`["A","B","RP002_1_0_0","RP002_1_0_1","RP002_1_0_2","RP002_1_0_3","RP002_1_0_4"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + commonRegParamsRevisionEnum = append(commonRegParamsRevisionEnum, v) + } +} + +func (m CommonRegParamsRevision) validateCommonRegParamsRevisionEnum(path, location string, value CommonRegParamsRevision) error { + if err := validate.EnumCase(path, location, value, commonRegParamsRevisionEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this common reg params revision +func (m CommonRegParamsRevision) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateCommonRegParamsRevisionEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this common reg params revision based on context it is used +func (m CommonRegParamsRevision) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/common_region.go b/internal/app/service/lora/chirp_stack/models/common_region.go new file mode 100644 index 0000000..36073fb --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/common_region.go @@ -0,0 +1,127 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// CommonRegion - EU868: EU868 +// - US915: US915 +// - CN779: CN779 +// - EU433: EU433 +// - AU915: AU915 +// - CN470: CN470 +// - AS923: AS923 +// - AS923_2: AS923 with -1.80 MHz frequency offset +// - AS923_3: AS923 with -6.60 MHz frequency offset +// - AS923_4: (AS923 with -5.90 MHz frequency offset). +// - KR920: KR920 +// - IN865: IN865 +// - RU864: RU864 +// - ISM2400: ISM2400 (LoRaWAN 2.4 GHz) +// +// swagger:model commonRegion +type CommonRegion string + +func NewCommonRegion(value CommonRegion) *CommonRegion { + return &value +} + +// Pointer returns a pointer to a freshly-allocated CommonRegion. +func (m CommonRegion) Pointer() *CommonRegion { + return &m +} + +const ( + + // CommonRegionEU868 captures enum value "EU868" + CommonRegionEU868 CommonRegion = "EU868" + + // CommonRegionUS915 captures enum value "US915" + CommonRegionUS915 CommonRegion = "US915" + + // CommonRegionCN779 captures enum value "CN779" + CommonRegionCN779 CommonRegion = "CN779" + + // CommonRegionEU433 captures enum value "EU433" + CommonRegionEU433 CommonRegion = "EU433" + + // CommonRegionAU915 captures enum value "AU915" + CommonRegionAU915 CommonRegion = "AU915" + + // CommonRegionCN470 captures enum value "CN470" + CommonRegionCN470 CommonRegion = "CN470" + + // CommonRegionAS923 captures enum value "AS923" + CommonRegionAS923 CommonRegion = "AS923" + + // CommonRegionAS9232 captures enum value "AS923_2" + CommonRegionAS9232 CommonRegion = "AS923_2" + + // CommonRegionAS9233 captures enum value "AS923_3" + CommonRegionAS9233 CommonRegion = "AS923_3" + + // CommonRegionAS9234 captures enum value "AS923_4" + CommonRegionAS9234 CommonRegion = "AS923_4" + + // CommonRegionKR920 captures enum value "KR920" + CommonRegionKR920 CommonRegion = "KR920" + + // CommonRegionIN865 captures enum value "IN865" + CommonRegionIN865 CommonRegion = "IN865" + + // CommonRegionRU864 captures enum value "RU864" + CommonRegionRU864 CommonRegion = "RU864" + + // CommonRegionISM2400 captures enum value "ISM2400" + CommonRegionISM2400 CommonRegion = "ISM2400" +) + +// for schema +var commonRegionEnum []interface{} + +func init() { + var res []CommonRegion + if err := json.Unmarshal([]byte(`["EU868","US915","CN779","EU433","AU915","CN470","AS923","AS923_2","AS923_3","AS923_4","KR920","IN865","RU864","ISM2400"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + commonRegionEnum = append(commonRegionEnum, v) + } +} + +func (m CommonRegion) validateCommonRegionEnum(path, location string, value CommonRegion) error { + if err := validate.EnumCase(path, location, value, commonRegionEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this common region +func (m CommonRegion) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateCommonRegionEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this common region based on context it is used +func (m CommonRegion) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/list_devices_request_order_by.go b/internal/app/service/lora/chirp_stack/models/list_devices_request_order_by.go new file mode 100644 index 0000000..67acfc4 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/list_devices_request_order_by.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// ListDevicesRequestOrderBy list devices request order by +// +// swagger:model ListDevicesRequestOrderBy +type ListDevicesRequestOrderBy string + +func NewListDevicesRequestOrderBy(value ListDevicesRequestOrderBy) *ListDevicesRequestOrderBy { + return &value +} + +// Pointer returns a pointer to a freshly-allocated ListDevicesRequestOrderBy. +func (m ListDevicesRequestOrderBy) Pointer() *ListDevicesRequestOrderBy { + return &m +} + +const ( + + // ListDevicesRequestOrderByNAME captures enum value "NAME" + ListDevicesRequestOrderByNAME ListDevicesRequestOrderBy = "NAME" + + // ListDevicesRequestOrderByDEVEUI captures enum value "DEV_EUI" + ListDevicesRequestOrderByDEVEUI ListDevicesRequestOrderBy = "DEV_EUI" + + // ListDevicesRequestOrderByLASTSEENAT captures enum value "LAST_SEEN_AT" + ListDevicesRequestOrderByLASTSEENAT ListDevicesRequestOrderBy = "LAST_SEEN_AT" + + // ListDevicesRequestOrderByDEVICEPROFILENAME captures enum value "DEVICE_PROFILE_NAME" + ListDevicesRequestOrderByDEVICEPROFILENAME ListDevicesRequestOrderBy = "DEVICE_PROFILE_NAME" +) + +// for schema +var listDevicesRequestOrderByEnum []interface{} + +func init() { + var res []ListDevicesRequestOrderBy + if err := json.Unmarshal([]byte(`["NAME","DEV_EUI","LAST_SEEN_AT","DEVICE_PROFILE_NAME"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + listDevicesRequestOrderByEnum = append(listDevicesRequestOrderByEnum, v) + } +} + +func (m ListDevicesRequestOrderBy) validateListDevicesRequestOrderByEnum(path, location string, value ListDevicesRequestOrderBy) error { + if err := validate.EnumCase(path, location, value, listDevicesRequestOrderByEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this list devices request order by +func (m ListDevicesRequestOrderBy) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateListDevicesRequestOrderByEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this list devices request order by based on context it is used +func (m ListDevicesRequestOrderBy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/list_gateways_request_order_by.go b/internal/app/service/lora/chirp_stack/models/list_gateways_request_order_by.go new file mode 100644 index 0000000..445e4bd --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/list_gateways_request_order_by.go @@ -0,0 +1,81 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// ListGatewaysRequestOrderBy list gateways request order by +// +// swagger:model ListGatewaysRequestOrderBy +type ListGatewaysRequestOrderBy string + +func NewListGatewaysRequestOrderBy(value ListGatewaysRequestOrderBy) *ListGatewaysRequestOrderBy { + return &value +} + +// Pointer returns a pointer to a freshly-allocated ListGatewaysRequestOrderBy. +func (m ListGatewaysRequestOrderBy) Pointer() *ListGatewaysRequestOrderBy { + return &m +} + +const ( + + // ListGatewaysRequestOrderByNAME captures enum value "NAME" + ListGatewaysRequestOrderByNAME ListGatewaysRequestOrderBy = "NAME" + + // ListGatewaysRequestOrderByGATEWAYID captures enum value "GATEWAY_ID" + ListGatewaysRequestOrderByGATEWAYID ListGatewaysRequestOrderBy = "GATEWAY_ID" + + // ListGatewaysRequestOrderByLASTSEENAT captures enum value "LAST_SEEN_AT" + ListGatewaysRequestOrderByLASTSEENAT ListGatewaysRequestOrderBy = "LAST_SEEN_AT" +) + +// for schema +var listGatewaysRequestOrderByEnum []interface{} + +func init() { + var res []ListGatewaysRequestOrderBy + if err := json.Unmarshal([]byte(`["NAME","GATEWAY_ID","LAST_SEEN_AT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + listGatewaysRequestOrderByEnum = append(listGatewaysRequestOrderByEnum, v) + } +} + +func (m ListGatewaysRequestOrderBy) validateListGatewaysRequestOrderByEnum(path, location string, value ListGatewaysRequestOrderBy) error { + if err := validate.EnumCase(path, location, value, listGatewaysRequestOrderByEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this list gateways request order by +func (m ListGatewaysRequestOrderBy) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateListGatewaysRequestOrderByEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this list gateways request order by based on context it is used +func (m ListGatewaysRequestOrderBy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/protobuf_any.go b/internal/app/service/lora/chirp_stack/models/protobuf_any.go new file mode 100644 index 0000000..f25b51e --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/protobuf_any.go @@ -0,0 +1,127 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// ProtobufAny protobuf any +// +// swagger:model protobufAny +type ProtobufAny struct { + + // at type + AtType string `json:"@type,omitempty"` + + // protobuf any + ProtobufAny map[string]interface{} `json:"-"` +} + +// UnmarshalJSON unmarshals this object with additional properties from JSON +func (m *ProtobufAny) UnmarshalJSON(data []byte) error { + // stage 1, bind the properties + var stage1 struct { + + // at type + AtType string `json:"@type,omitempty"` + } + if err := json.Unmarshal(data, &stage1); err != nil { + return err + } + var rcv ProtobufAny + + rcv.AtType = stage1.AtType + *m = rcv + + // stage 2, remove properties and add to map + stage2 := make(map[string]json.RawMessage) + if err := json.Unmarshal(data, &stage2); err != nil { + return err + } + + delete(stage2, "@type") + // stage 3, add additional properties values + if len(stage2) > 0 { + result := make(map[string]interface{}) + for k, v := range stage2 { + var toadd interface{} + if err := json.Unmarshal(v, &toadd); err != nil { + return err + } + result[k] = toadd + } + m.ProtobufAny = result + } + + return nil +} + +// MarshalJSON marshals this object with additional properties into a JSON object +func (m ProtobufAny) MarshalJSON() ([]byte, error) { + var stage1 struct { + + // at type + AtType string `json:"@type,omitempty"` + } + + stage1.AtType = m.AtType + + // make JSON object for known properties + props, err := json.Marshal(stage1) + if err != nil { + return nil, err + } + + if len(m.ProtobufAny) == 0 { // no additional properties + return props, nil + } + + // make JSON object for the additional properties + additional, err := json.Marshal(m.ProtobufAny) + if err != nil { + return nil, err + } + + if len(props) < 3 { // "{}": only additional properties + return additional, nil + } + + // concatenate the 2 objects + return swag.ConcatJSON(props, additional), nil +} + +// Validate validates this protobuf any +func (m *ProtobufAny) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this protobuf any based on context it is used +func (m *ProtobufAny) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ProtobufAny) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ProtobufAny) UnmarshalBinary(b []byte) error { + var res ProtobufAny + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/protobuf_null_value.go b/internal/app/service/lora/chirp_stack/models/protobuf_null_value.go new file mode 100644 index 0000000..b309962 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/protobuf_null_value.go @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// ProtobufNullValue `NullValue` is a singleton enumeration to represent the null value for the +// `Value` type union. +// +// The JSON representation for `NullValue` is JSON `null`. +// +// - NULL_VALUE: Null value. +// +// swagger:model protobufNullValue +type ProtobufNullValue string + +func NewProtobufNullValue(value ProtobufNullValue) *ProtobufNullValue { + return &value +} + +// Pointer returns a pointer to a freshly-allocated ProtobufNullValue. +func (m ProtobufNullValue) Pointer() *ProtobufNullValue { + return &m +} + +const ( + + // ProtobufNullValueNULLVALUE captures enum value "NULL_VALUE" + ProtobufNullValueNULLVALUE ProtobufNullValue = "NULL_VALUE" +) + +// for schema +var protobufNullValueEnum []interface{} + +func init() { + var res []ProtobufNullValue + if err := json.Unmarshal([]byte(`["NULL_VALUE"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + protobufNullValueEnum = append(protobufNullValueEnum, v) + } +} + +func (m ProtobufNullValue) validateProtobufNullValueEnum(path, location string, value ProtobufNullValue) error { + if err := validate.EnumCase(path, location, value, protobufNullValueEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this protobuf null value +func (m ProtobufNullValue) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateProtobufNullValueEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this protobuf null value based on context it is used +func (m ProtobufNullValue) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/app/service/lora/chirp_stack/models/rpc_status.go b/internal/app/service/lora/chirp_stack/models/rpc_status.go new file mode 100644 index 0000000..922eaa8 --- /dev/null +++ b/internal/app/service/lora/chirp_stack/models/rpc_status.go @@ -0,0 +1,127 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// RPCStatus rpc status +// +// swagger:model rpcStatus +type RPCStatus struct { + + // code + Code int32 `json:"code,omitempty"` + + // details + Details []*ProtobufAny `json:"details"` + + // message + Message string `json:"message,omitempty"` +} + +// Validate validates this rpc status +func (m *RPCStatus) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDetails(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RPCStatus) validateDetails(formats strfmt.Registry) error { + if swag.IsZero(m.Details) { // not required + return nil + } + + for i := 0; i < len(m.Details); i++ { + if swag.IsZero(m.Details[i]) { // not required + continue + } + + if m.Details[i] != nil { + if err := m.Details[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("details" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("details" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this rpc status based on the context it is used +func (m *RPCStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDetails(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RPCStatus) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Details); i++ { + + if m.Details[i] != nil { + + if swag.IsZero(m.Details[i]) { // not required + return nil + } + + if err := m.Details[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("details" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("details" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *RPCStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RPCStatus) UnmarshalBinary(b []byte) error { + var res RPCStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}