From 159fdbed0ec08185ecdcda625d3c1e58640d441d Mon Sep 17 00:00:00 2001 From: "Simen A. W. Olsen" Date: Mon, 28 Sep 2020 19:23:21 +0200 Subject: [PATCH] feat: Add path, fix method names --- client/aws_accounts/aws_accounts_client.go | 16 +- .../update_aws_accounts_parameters.go | 154 ++++++++++++++ .../update_aws_accounts_responses.go | 69 +++++++ client/clients/clients_client.go | 76 +++---- client/clients/create_clients_parameters.go | 135 ++++++++++++ client/clients/create_clients_responses.go | 69 +++++++ client/clients/update_clients_parameters.go | 153 ++++++++++++++ client/clients/update_clients_responses.go | 69 +++++++ .../crayon_accounts/crayon_accounts_client.go | 74 +++---- .../create_crayon_accounts_parameters.go | 135 ++++++++++++ .../create_crayon_accounts_responses.go | 69 +++++++ .../update_crayon_accounts_parameters.go | 154 ++++++++++++++ .../update_crayon_accounts_responses.go | 69 +++++++ .../create_customer_tenants_parameters.go | 135 ++++++++++++ .../create_customer_tenants_responses.go | 69 +++++++ .../customer_tenants_client.go | 90 ++++---- .../update_customer_tenants_parameters.go | 154 ++++++++++++++ .../update_customer_tenants_responses.go | 69 +++++++ .../create_customer_token_parameters.go | 190 +++++++++++++++++ .../create_customer_token_responses.go | 69 +++++++ .../customer_token/customer_token_client.go | 16 +- .../post_customer_token_parameters.go | 86 +++++++- .../groupings/create_groupings_parameters.go | 135 ++++++++++++ .../groupings/create_groupings_responses.go | 69 +++++++ client/groupings/groupings_client.go | 80 +++---- .../groupings/update_groupings_parameters.go | 154 ++++++++++++++ .../groupings/update_groupings_responses.go | 69 +++++++ .../create_invoice_profiles_parameters.go | 135 ++++++++++++ .../create_invoice_profiles_responses.go | 69 +++++++ .../invoice_profiles_client.go | 76 +++---- .../update_invoice_profiles_parameters.go | 154 ++++++++++++++ .../update_invoice_profiles_responses.go | 69 +++++++ .../organization_access_client.go | 16 +- .../update_organization_access_parameters.go | 135 ++++++++++++ .../update_organization_access_responses.go | 67 ++++++ .../product_containers_client.go | 16 +- .../update_product_containers_parameters.go | 195 ++++++++++++++++++ .../update_product_containers_responses.go | 69 +++++++ client/secrets/create_secrets_parameters.go | 135 ++++++++++++ client/secrets/create_secrets_responses.go | 69 +++++++ client/secrets/secrets_client.go | 40 ++-- .../create_subscriptions_parameters.go | 135 ++++++++++++ .../create_subscriptions_responses.go | 69 +++++++ client/subscriptions/subscriptions_client.go | 148 ++++++------- .../update_subscriptions_parameters.go | 154 ++++++++++++++ .../update_subscriptions_responses.go | 69 +++++++ internal/cmd/convert-swagger/main.go | 54 ++++- swagger.json | 56 +++-- 48 files changed, 4210 insertions(+), 347 deletions(-) create mode 100644 client/aws_accounts/update_aws_accounts_parameters.go create mode 100644 client/aws_accounts/update_aws_accounts_responses.go create mode 100644 client/clients/create_clients_parameters.go create mode 100644 client/clients/create_clients_responses.go create mode 100644 client/clients/update_clients_parameters.go create mode 100644 client/clients/update_clients_responses.go create mode 100644 client/crayon_accounts/create_crayon_accounts_parameters.go create mode 100644 client/crayon_accounts/create_crayon_accounts_responses.go create mode 100644 client/crayon_accounts/update_crayon_accounts_parameters.go create mode 100644 client/crayon_accounts/update_crayon_accounts_responses.go create mode 100644 client/customer_tenants/create_customer_tenants_parameters.go create mode 100644 client/customer_tenants/create_customer_tenants_responses.go create mode 100644 client/customer_tenants/update_customer_tenants_parameters.go create mode 100644 client/customer_tenants/update_customer_tenants_responses.go create mode 100644 client/customer_token/create_customer_token_parameters.go create mode 100644 client/customer_token/create_customer_token_responses.go create mode 100644 client/groupings/create_groupings_parameters.go create mode 100644 client/groupings/create_groupings_responses.go create mode 100644 client/groupings/update_groupings_parameters.go create mode 100644 client/groupings/update_groupings_responses.go create mode 100644 client/invoice_profiles/create_invoice_profiles_parameters.go create mode 100644 client/invoice_profiles/create_invoice_profiles_responses.go create mode 100644 client/invoice_profiles/update_invoice_profiles_parameters.go create mode 100644 client/invoice_profiles/update_invoice_profiles_responses.go create mode 100644 client/organization_access/update_organization_access_parameters.go create mode 100644 client/organization_access/update_organization_access_responses.go create mode 100644 client/product_containers/update_product_containers_parameters.go create mode 100644 client/product_containers/update_product_containers_responses.go create mode 100644 client/secrets/create_secrets_parameters.go create mode 100644 client/secrets/create_secrets_responses.go create mode 100644 client/subscriptions/create_subscriptions_parameters.go create mode 100644 client/subscriptions/create_subscriptions_responses.go create mode 100644 client/subscriptions/update_subscriptions_parameters.go create mode 100644 client/subscriptions/update_subscriptions_responses.go diff --git a/client/aws_accounts/aws_accounts_client.go b/client/aws_accounts/aws_accounts_client.go index fb27a84..9759d49 100644 --- a/client/aws_accounts/aws_accounts_client.go +++ b/client/aws_accounts/aws_accounts_client.go @@ -31,7 +31,7 @@ type ClientService interface { GetAwsAccounts(params *GetAwsAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAwsAccountsOK, error) - PutAwsAccounts(params *PutAwsAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PutAwsAccountsOK, error) + UpdateAwsAccounts(params *UpdateAwsAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateAwsAccountsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -107,23 +107,23 @@ func (a *Client) GetAwsAccounts(params *GetAwsAccountsParams, authInfo runtime.C } /* - PutAwsAccounts put aws accounts API + UpdateAwsAccounts update aws accounts API */ -func (a *Client) PutAwsAccounts(params *PutAwsAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PutAwsAccountsOK, error) { +func (a *Client) UpdateAwsAccounts(params *UpdateAwsAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateAwsAccountsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPutAwsAccountsParams() + params = NewUpdateAwsAccountsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PutAwsAccounts", + ID: "UpdateAwsAccounts", Method: "PUT", PathPattern: "/api/v1/AwsAccounts/{id}", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PutAwsAccountsReader{formats: a.formats}, + Reader: &UpdateAwsAccountsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -131,13 +131,13 @@ func (a *Client) PutAwsAccounts(params *PutAwsAccountsParams, authInfo runtime.C if err != nil { return nil, err } - success, ok := result.(*PutAwsAccountsOK) + success, ok := result.(*UpdateAwsAccountsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PutAwsAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for UpdateAwsAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } diff --git a/client/aws_accounts/update_aws_accounts_parameters.go b/client/aws_accounts/update_aws_accounts_parameters.go new file mode 100644 index 0000000..7c53319 --- /dev/null +++ b/client/aws_accounts/update_aws_accounts_parameters.go @@ -0,0 +1,154 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package aws_accounts + +// 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" + + "github.com/bjerkio/crayon-api-go/models" +) + +// NewUpdateAwsAccountsParams creates a new UpdateAwsAccountsParams object +// with the default values initialized. +func NewUpdateAwsAccountsParams() *UpdateAwsAccountsParams { + var () + return &UpdateAwsAccountsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateAwsAccountsParamsWithTimeout creates a new UpdateAwsAccountsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewUpdateAwsAccountsParamsWithTimeout(timeout time.Duration) *UpdateAwsAccountsParams { + var () + return &UpdateAwsAccountsParams{ + + timeout: timeout, + } +} + +// NewUpdateAwsAccountsParamsWithContext creates a new UpdateAwsAccountsParams object +// with the default values initialized, and the ability to set a context for a request +func NewUpdateAwsAccountsParamsWithContext(ctx context.Context) *UpdateAwsAccountsParams { + var () + return &UpdateAwsAccountsParams{ + + Context: ctx, + } +} + +// NewUpdateAwsAccountsParamsWithHTTPClient creates a new UpdateAwsAccountsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewUpdateAwsAccountsParamsWithHTTPClient(client *http.Client) *UpdateAwsAccountsParams { + var () + return &UpdateAwsAccountsParams{ + HTTPClient: client, + } +} + +/*UpdateAwsAccountsParams contains all the parameters to send to the API endpoint +for the update aws accounts operation typically these are written to a http.Request +*/ +type UpdateAwsAccountsParams struct { + + /*AwsAccount*/ + AwsAccount *models.AwsAccount + /*ID*/ + ID int32 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the update aws accounts params +func (o *UpdateAwsAccountsParams) WithTimeout(timeout time.Duration) *UpdateAwsAccountsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update aws accounts params +func (o *UpdateAwsAccountsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update aws accounts params +func (o *UpdateAwsAccountsParams) WithContext(ctx context.Context) *UpdateAwsAccountsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update aws accounts params +func (o *UpdateAwsAccountsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update aws accounts params +func (o *UpdateAwsAccountsParams) WithHTTPClient(client *http.Client) *UpdateAwsAccountsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update aws accounts params +func (o *UpdateAwsAccountsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAwsAccount adds the awsAccount to the update aws accounts params +func (o *UpdateAwsAccountsParams) WithAwsAccount(awsAccount *models.AwsAccount) *UpdateAwsAccountsParams { + o.SetAwsAccount(awsAccount) + return o +} + +// SetAwsAccount adds the awsAccount to the update aws accounts params +func (o *UpdateAwsAccountsParams) SetAwsAccount(awsAccount *models.AwsAccount) { + o.AwsAccount = awsAccount +} + +// WithID adds the id to the update aws accounts params +func (o *UpdateAwsAccountsParams) WithID(id int32) *UpdateAwsAccountsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the update aws accounts params +func (o *UpdateAwsAccountsParams) SetID(id int32) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateAwsAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AwsAccount != nil { + if err := r.SetBodyParam(o.AwsAccount); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt32(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/aws_accounts/update_aws_accounts_responses.go b/client/aws_accounts/update_aws_accounts_responses.go new file mode 100644 index 0000000..451dff5 --- /dev/null +++ b/client/aws_accounts/update_aws_accounts_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package aws_accounts + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// UpdateAwsAccountsReader is a Reader for the UpdateAwsAccounts structure. +type UpdateAwsAccountsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateAwsAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateAwsAccountsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewUpdateAwsAccountsOK creates a UpdateAwsAccountsOK with default headers values +func NewUpdateAwsAccountsOK() *UpdateAwsAccountsOK { + return &UpdateAwsAccountsOK{} +} + +/*UpdateAwsAccountsOK handles this case with default header values. + +Success +*/ +type UpdateAwsAccountsOK struct { + Payload *models.AwsAccount +} + +func (o *UpdateAwsAccountsOK) Error() string { + return fmt.Sprintf("[PUT /api/v1/AwsAccounts/{id}][%d] updateAwsAccountsOK %+v", 200, o.Payload) +} + +func (o *UpdateAwsAccountsOK) GetPayload() *models.AwsAccount { + return o.Payload +} + +func (o *UpdateAwsAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AwsAccount) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/clients/clients_client.go b/client/clients/clients_client.go index 85c36d3..02febe9 100644 --- a/client/clients/clients_client.go +++ b/client/clients/clients_client.go @@ -27,35 +27,35 @@ type Client struct { // ClientService is the interface for Client methods type ClientService interface { + CreateClients(params *CreateClientsParams, authInfo runtime.ClientAuthInfoWriter) (*CreateClientsOK, error) + DeleteClients(params *DeleteClientsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteClientsOK, error) GetClients(params *GetClientsParams, authInfo runtime.ClientAuthInfoWriter) (*GetClientsOK, error) - PostClients(params *PostClientsParams, authInfo runtime.ClientAuthInfoWriter) (*PostClientsOK, error) - - PutClients(params *PutClientsParams, authInfo runtime.ClientAuthInfoWriter) (*PutClientsOK, error) + UpdateClients(params *UpdateClientsParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateClientsOK, error) SetTransport(transport runtime.ClientTransport) } /* - DeleteClients delete clients API + CreateClients create clients API */ -func (a *Client) DeleteClients(params *DeleteClientsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteClientsOK, error) { +func (a *Client) CreateClients(params *CreateClientsParams, authInfo runtime.ClientAuthInfoWriter) (*CreateClientsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewDeleteClientsParams() + params = NewCreateClientsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "DeleteClients", - Method: "DELETE", - PathPattern: "/api/v1/Clients/{clientId}", + ID: "CreateClients", + Method: "POST", + PathPattern: "/api/v1/Clients", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, - ConsumesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, Schemes: []string{"http"}, Params: params, - Reader: &DeleteClientsReader{formats: a.formats}, + Reader: &CreateClientsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -63,34 +63,34 @@ func (a *Client) DeleteClients(params *DeleteClientsParams, authInfo runtime.Cli if err != nil { return nil, err } - success, ok := result.(*DeleteClientsOK) + success, ok := result.(*CreateClientsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for DeleteClients: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for CreateClients: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - GetClients get clients API + DeleteClients delete clients API */ -func (a *Client) GetClients(params *GetClientsParams, authInfo runtime.ClientAuthInfoWriter) (*GetClientsOK, error) { +func (a *Client) DeleteClients(params *DeleteClientsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteClientsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetClientsParams() + params = NewDeleteClientsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "GetClients", - Method: "GET", - PathPattern: "/api/v1/Clients", + ID: "DeleteClients", + Method: "DELETE", + PathPattern: "/api/v1/Clients/{clientId}", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &GetClientsReader{formats: a.formats}, + Reader: &DeleteClientsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -98,34 +98,34 @@ func (a *Client) GetClients(params *GetClientsParams, authInfo runtime.ClientAut if err != nil { return nil, err } - success, ok := result.(*GetClientsOK) + success, ok := result.(*DeleteClientsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetClients: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for DeleteClients: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - PostClients post clients API + GetClients get clients API */ -func (a *Client) PostClients(params *PostClientsParams, authInfo runtime.ClientAuthInfoWriter) (*PostClientsOK, error) { +func (a *Client) GetClients(params *GetClientsParams, authInfo runtime.ClientAuthInfoWriter) (*GetClientsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPostClientsParams() + params = NewGetClientsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PostClients", - Method: "POST", + ID: "GetClients", + Method: "GET", PathPattern: "/api/v1/Clients", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, - ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PostClientsReader{formats: a.formats}, + Reader: &GetClientsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -133,34 +133,34 @@ func (a *Client) PostClients(params *PostClientsParams, authInfo runtime.ClientA if err != nil { return nil, err } - success, ok := result.(*PostClientsOK) + success, ok := result.(*GetClientsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PostClients: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for GetClients: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - PutClients put clients API + UpdateClients update clients API */ -func (a *Client) PutClients(params *PutClientsParams, authInfo runtime.ClientAuthInfoWriter) (*PutClientsOK, error) { +func (a *Client) UpdateClients(params *UpdateClientsParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateClientsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPutClientsParams() + params = NewUpdateClientsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PutClients", + ID: "UpdateClients", Method: "PUT", PathPattern: "/api/v1/Clients/{clientId}", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PutClientsReader{formats: a.formats}, + Reader: &UpdateClientsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -168,13 +168,13 @@ func (a *Client) PutClients(params *PutClientsParams, authInfo runtime.ClientAut if err != nil { return nil, err } - success, ok := result.(*PutClientsOK) + success, ok := result.(*UpdateClientsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PutClients: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for UpdateClients: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } diff --git a/client/clients/create_clients_parameters.go b/client/clients/create_clients_parameters.go new file mode 100644 index 0000000..5112498 --- /dev/null +++ b/client/clients/create_clients_parameters.go @@ -0,0 +1,135 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clients + +// 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/bjerkio/crayon-api-go/models" +) + +// NewCreateClientsParams creates a new CreateClientsParams object +// with the default values initialized. +func NewCreateClientsParams() *CreateClientsParams { + var () + return &CreateClientsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCreateClientsParamsWithTimeout creates a new CreateClientsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCreateClientsParamsWithTimeout(timeout time.Duration) *CreateClientsParams { + var () + return &CreateClientsParams{ + + timeout: timeout, + } +} + +// NewCreateClientsParamsWithContext creates a new CreateClientsParams object +// with the default values initialized, and the ability to set a context for a request +func NewCreateClientsParamsWithContext(ctx context.Context) *CreateClientsParams { + var () + return &CreateClientsParams{ + + Context: ctx, + } +} + +// NewCreateClientsParamsWithHTTPClient creates a new CreateClientsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCreateClientsParamsWithHTTPClient(client *http.Client) *CreateClientsParams { + var () + return &CreateClientsParams{ + HTTPClient: client, + } +} + +/*CreateClientsParams contains all the parameters to send to the API endpoint +for the create clients operation typically these are written to a http.Request +*/ +type CreateClientsParams struct { + + /*Client*/ + Client *models.Client + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the create clients params +func (o *CreateClientsParams) WithTimeout(timeout time.Duration) *CreateClientsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create clients params +func (o *CreateClientsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create clients params +func (o *CreateClientsParams) WithContext(ctx context.Context) *CreateClientsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create clients params +func (o *CreateClientsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create clients params +func (o *CreateClientsParams) WithHTTPClient(client *http.Client) *CreateClientsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create clients params +func (o *CreateClientsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithClient adds the client to the create clients params +func (o *CreateClientsParams) WithClient(client *models.Client) *CreateClientsParams { + o.SetClient(client) + return o +} + +// SetClient adds the client to the create clients params +func (o *CreateClientsParams) SetClient(client *models.Client) { + o.Client = client +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateClientsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Client != nil { + if err := r.SetBodyParam(o.Client); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/clients/create_clients_responses.go b/client/clients/create_clients_responses.go new file mode 100644 index 0000000..2fab4bf --- /dev/null +++ b/client/clients/create_clients_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clients + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// CreateClientsReader is a Reader for the CreateClients structure. +type CreateClientsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateClientsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateClientsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewCreateClientsOK creates a CreateClientsOK with default headers values +func NewCreateClientsOK() *CreateClientsOK { + return &CreateClientsOK{} +} + +/*CreateClientsOK handles this case with default header values. + +Success +*/ +type CreateClientsOK struct { + Payload *models.Client +} + +func (o *CreateClientsOK) Error() string { + return fmt.Sprintf("[POST /api/v1/Clients][%d] createClientsOK %+v", 200, o.Payload) +} + +func (o *CreateClientsOK) GetPayload() *models.Client { + return o.Payload +} + +func (o *CreateClientsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Client) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/clients/update_clients_parameters.go b/client/clients/update_clients_parameters.go new file mode 100644 index 0000000..a640f88 --- /dev/null +++ b/client/clients/update_clients_parameters.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clients + +// 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/bjerkio/crayon-api-go/models" +) + +// NewUpdateClientsParams creates a new UpdateClientsParams object +// with the default values initialized. +func NewUpdateClientsParams() *UpdateClientsParams { + var () + return &UpdateClientsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateClientsParamsWithTimeout creates a new UpdateClientsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewUpdateClientsParamsWithTimeout(timeout time.Duration) *UpdateClientsParams { + var () + return &UpdateClientsParams{ + + timeout: timeout, + } +} + +// NewUpdateClientsParamsWithContext creates a new UpdateClientsParams object +// with the default values initialized, and the ability to set a context for a request +func NewUpdateClientsParamsWithContext(ctx context.Context) *UpdateClientsParams { + var () + return &UpdateClientsParams{ + + Context: ctx, + } +} + +// NewUpdateClientsParamsWithHTTPClient creates a new UpdateClientsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewUpdateClientsParamsWithHTTPClient(client *http.Client) *UpdateClientsParams { + var () + return &UpdateClientsParams{ + HTTPClient: client, + } +} + +/*UpdateClientsParams contains all the parameters to send to the API endpoint +for the update clients operation typically these are written to a http.Request +*/ +type UpdateClientsParams struct { + + /*Client*/ + Client *models.Client + /*ClientID*/ + ClientID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the update clients params +func (o *UpdateClientsParams) WithTimeout(timeout time.Duration) *UpdateClientsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update clients params +func (o *UpdateClientsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update clients params +func (o *UpdateClientsParams) WithContext(ctx context.Context) *UpdateClientsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update clients params +func (o *UpdateClientsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update clients params +func (o *UpdateClientsParams) WithHTTPClient(client *http.Client) *UpdateClientsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update clients params +func (o *UpdateClientsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithClient adds the client to the update clients params +func (o *UpdateClientsParams) WithClient(client *models.Client) *UpdateClientsParams { + o.SetClient(client) + return o +} + +// SetClient adds the client to the update clients params +func (o *UpdateClientsParams) SetClient(client *models.Client) { + o.Client = client +} + +// WithClientID adds the clientID to the update clients params +func (o *UpdateClientsParams) WithClientID(clientID string) *UpdateClientsParams { + o.SetClientID(clientID) + return o +} + +// SetClientID adds the clientId to the update clients params +func (o *UpdateClientsParams) SetClientID(clientID string) { + o.ClientID = clientID +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateClientsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Client != nil { + if err := r.SetBodyParam(o.Client); err != nil { + return err + } + } + + // path param clientId + if err := r.SetPathParam("clientId", o.ClientID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/clients/update_clients_responses.go b/client/clients/update_clients_responses.go new file mode 100644 index 0000000..6c8ab51 --- /dev/null +++ b/client/clients/update_clients_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clients + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// UpdateClientsReader is a Reader for the UpdateClients structure. +type UpdateClientsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateClientsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateClientsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewUpdateClientsOK creates a UpdateClientsOK with default headers values +func NewUpdateClientsOK() *UpdateClientsOK { + return &UpdateClientsOK{} +} + +/*UpdateClientsOK handles this case with default header values. + +Success +*/ +type UpdateClientsOK struct { + Payload *models.Client +} + +func (o *UpdateClientsOK) Error() string { + return fmt.Sprintf("[PUT /api/v1/Clients/{clientId}][%d] updateClientsOK %+v", 200, o.Payload) +} + +func (o *UpdateClientsOK) GetPayload() *models.Client { + return o.Payload +} + +func (o *UpdateClientsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Client) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/crayon_accounts/crayon_accounts_client.go b/client/crayon_accounts/crayon_accounts_client.go index feca43c..12a10e4 100644 --- a/client/crayon_accounts/crayon_accounts_client.go +++ b/client/crayon_accounts/crayon_accounts_client.go @@ -27,35 +27,35 @@ type Client struct { // ClientService is the interface for Client methods type ClientService interface { + CreateCrayonAccounts(params *CreateCrayonAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*CreateCrayonAccountsOK, error) + GetCrayonAccountByID(params *GetCrayonAccountByIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetCrayonAccountByIDOK, error) GetCrayonAccounts(params *GetCrayonAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetCrayonAccountsOK, error) - PostCrayonAccounts(params *PostCrayonAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostCrayonAccountsOK, error) - - PutCrayonAccounts(params *PutCrayonAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PutCrayonAccountsOK, error) + UpdateCrayonAccounts(params *UpdateCrayonAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateCrayonAccountsOK, error) SetTransport(transport runtime.ClientTransport) } /* - GetCrayonAccountByID get crayon account by Id API + CreateCrayonAccounts create crayon accounts API */ -func (a *Client) GetCrayonAccountByID(params *GetCrayonAccountByIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetCrayonAccountByIDOK, error) { +func (a *Client) CreateCrayonAccounts(params *CreateCrayonAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*CreateCrayonAccountsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetCrayonAccountByIDParams() + params = NewCreateCrayonAccountsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "GetCrayonAccountById", - Method: "GET", - PathPattern: "/api/v1/CrayonAccounts/{id}", + ID: "CreateCrayonAccounts", + Method: "POST", + PathPattern: "/api/v1/CrayonAccounts", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, - ConsumesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, Schemes: []string{"http"}, Params: params, - Reader: &GetCrayonAccountByIDReader{formats: a.formats}, + Reader: &CreateCrayonAccountsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -63,34 +63,34 @@ func (a *Client) GetCrayonAccountByID(params *GetCrayonAccountByIDParams, authIn if err != nil { return nil, err } - success, ok := result.(*GetCrayonAccountByIDOK) + success, ok := result.(*CreateCrayonAccountsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetCrayonAccountById: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for CreateCrayonAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - GetCrayonAccounts get crayon accounts API + GetCrayonAccountByID get crayon account by Id API */ -func (a *Client) GetCrayonAccounts(params *GetCrayonAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetCrayonAccountsOK, error) { +func (a *Client) GetCrayonAccountByID(params *GetCrayonAccountByIDParams, authInfo runtime.ClientAuthInfoWriter) (*GetCrayonAccountByIDOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetCrayonAccountsParams() + params = NewGetCrayonAccountByIDParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "GetCrayonAccounts", + ID: "GetCrayonAccountById", Method: "GET", - PathPattern: "/api/v1/CrayonAccounts", + PathPattern: "/api/v1/CrayonAccounts/{id}", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &GetCrayonAccountsReader{formats: a.formats}, + Reader: &GetCrayonAccountByIDReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -98,34 +98,34 @@ func (a *Client) GetCrayonAccounts(params *GetCrayonAccountsParams, authInfo run if err != nil { return nil, err } - success, ok := result.(*GetCrayonAccountsOK) + success, ok := result.(*GetCrayonAccountByIDOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetCrayonAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for GetCrayonAccountById: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - PostCrayonAccounts post crayon accounts API + GetCrayonAccounts get crayon accounts API */ -func (a *Client) PostCrayonAccounts(params *PostCrayonAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PostCrayonAccountsOK, error) { +func (a *Client) GetCrayonAccounts(params *GetCrayonAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*GetCrayonAccountsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPostCrayonAccountsParams() + params = NewGetCrayonAccountsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PostCrayonAccounts", - Method: "POST", + ID: "GetCrayonAccounts", + Method: "GET", PathPattern: "/api/v1/CrayonAccounts", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, - ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PostCrayonAccountsReader{formats: a.formats}, + Reader: &GetCrayonAccountsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -133,34 +133,34 @@ func (a *Client) PostCrayonAccounts(params *PostCrayonAccountsParams, authInfo r if err != nil { return nil, err } - success, ok := result.(*PostCrayonAccountsOK) + success, ok := result.(*GetCrayonAccountsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PostCrayonAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for GetCrayonAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - PutCrayonAccounts put crayon accounts API + UpdateCrayonAccounts update crayon accounts API */ -func (a *Client) PutCrayonAccounts(params *PutCrayonAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*PutCrayonAccountsOK, error) { +func (a *Client) UpdateCrayonAccounts(params *UpdateCrayonAccountsParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateCrayonAccountsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPutCrayonAccountsParams() + params = NewUpdateCrayonAccountsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PutCrayonAccounts", + ID: "UpdateCrayonAccounts", Method: "PUT", PathPattern: "/api/v1/CrayonAccounts/{id}", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PutCrayonAccountsReader{formats: a.formats}, + Reader: &UpdateCrayonAccountsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -168,13 +168,13 @@ func (a *Client) PutCrayonAccounts(params *PutCrayonAccountsParams, authInfo run if err != nil { return nil, err } - success, ok := result.(*PutCrayonAccountsOK) + success, ok := result.(*UpdateCrayonAccountsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PutCrayonAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for UpdateCrayonAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } diff --git a/client/crayon_accounts/create_crayon_accounts_parameters.go b/client/crayon_accounts/create_crayon_accounts_parameters.go new file mode 100644 index 0000000..c468823 --- /dev/null +++ b/client/crayon_accounts/create_crayon_accounts_parameters.go @@ -0,0 +1,135 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package crayon_accounts + +// 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/bjerkio/crayon-api-go/models" +) + +// NewCreateCrayonAccountsParams creates a new CreateCrayonAccountsParams object +// with the default values initialized. +func NewCreateCrayonAccountsParams() *CreateCrayonAccountsParams { + var () + return &CreateCrayonAccountsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCreateCrayonAccountsParamsWithTimeout creates a new CreateCrayonAccountsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCreateCrayonAccountsParamsWithTimeout(timeout time.Duration) *CreateCrayonAccountsParams { + var () + return &CreateCrayonAccountsParams{ + + timeout: timeout, + } +} + +// NewCreateCrayonAccountsParamsWithContext creates a new CreateCrayonAccountsParams object +// with the default values initialized, and the ability to set a context for a request +func NewCreateCrayonAccountsParamsWithContext(ctx context.Context) *CreateCrayonAccountsParams { + var () + return &CreateCrayonAccountsParams{ + + Context: ctx, + } +} + +// NewCreateCrayonAccountsParamsWithHTTPClient creates a new CreateCrayonAccountsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCreateCrayonAccountsParamsWithHTTPClient(client *http.Client) *CreateCrayonAccountsParams { + var () + return &CreateCrayonAccountsParams{ + HTTPClient: client, + } +} + +/*CreateCrayonAccountsParams contains all the parameters to send to the API endpoint +for the create crayon accounts operation typically these are written to a http.Request +*/ +type CreateCrayonAccountsParams struct { + + /*CrayonAccount*/ + CrayonAccount *models.CrayonAccount + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the create crayon accounts params +func (o *CreateCrayonAccountsParams) WithTimeout(timeout time.Duration) *CreateCrayonAccountsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create crayon accounts params +func (o *CreateCrayonAccountsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create crayon accounts params +func (o *CreateCrayonAccountsParams) WithContext(ctx context.Context) *CreateCrayonAccountsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create crayon accounts params +func (o *CreateCrayonAccountsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create crayon accounts params +func (o *CreateCrayonAccountsParams) WithHTTPClient(client *http.Client) *CreateCrayonAccountsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create crayon accounts params +func (o *CreateCrayonAccountsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCrayonAccount adds the crayonAccount to the create crayon accounts params +func (o *CreateCrayonAccountsParams) WithCrayonAccount(crayonAccount *models.CrayonAccount) *CreateCrayonAccountsParams { + o.SetCrayonAccount(crayonAccount) + return o +} + +// SetCrayonAccount adds the crayonAccount to the create crayon accounts params +func (o *CreateCrayonAccountsParams) SetCrayonAccount(crayonAccount *models.CrayonAccount) { + o.CrayonAccount = crayonAccount +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateCrayonAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.CrayonAccount != nil { + if err := r.SetBodyParam(o.CrayonAccount); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/crayon_accounts/create_crayon_accounts_responses.go b/client/crayon_accounts/create_crayon_accounts_responses.go new file mode 100644 index 0000000..90c0320 --- /dev/null +++ b/client/crayon_accounts/create_crayon_accounts_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package crayon_accounts + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// CreateCrayonAccountsReader is a Reader for the CreateCrayonAccounts structure. +type CreateCrayonAccountsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateCrayonAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateCrayonAccountsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewCreateCrayonAccountsOK creates a CreateCrayonAccountsOK with default headers values +func NewCreateCrayonAccountsOK() *CreateCrayonAccountsOK { + return &CreateCrayonAccountsOK{} +} + +/*CreateCrayonAccountsOK handles this case with default header values. + +Success +*/ +type CreateCrayonAccountsOK struct { + Payload *models.CrayonAccount +} + +func (o *CreateCrayonAccountsOK) Error() string { + return fmt.Sprintf("[POST /api/v1/CrayonAccounts][%d] createCrayonAccountsOK %+v", 200, o.Payload) +} + +func (o *CreateCrayonAccountsOK) GetPayload() *models.CrayonAccount { + return o.Payload +} + +func (o *CreateCrayonAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CrayonAccount) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/crayon_accounts/update_crayon_accounts_parameters.go b/client/crayon_accounts/update_crayon_accounts_parameters.go new file mode 100644 index 0000000..dc17697 --- /dev/null +++ b/client/crayon_accounts/update_crayon_accounts_parameters.go @@ -0,0 +1,154 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package crayon_accounts + +// 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" + + "github.com/bjerkio/crayon-api-go/models" +) + +// NewUpdateCrayonAccountsParams creates a new UpdateCrayonAccountsParams object +// with the default values initialized. +func NewUpdateCrayonAccountsParams() *UpdateCrayonAccountsParams { + var () + return &UpdateCrayonAccountsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateCrayonAccountsParamsWithTimeout creates a new UpdateCrayonAccountsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewUpdateCrayonAccountsParamsWithTimeout(timeout time.Duration) *UpdateCrayonAccountsParams { + var () + return &UpdateCrayonAccountsParams{ + + timeout: timeout, + } +} + +// NewUpdateCrayonAccountsParamsWithContext creates a new UpdateCrayonAccountsParams object +// with the default values initialized, and the ability to set a context for a request +func NewUpdateCrayonAccountsParamsWithContext(ctx context.Context) *UpdateCrayonAccountsParams { + var () + return &UpdateCrayonAccountsParams{ + + Context: ctx, + } +} + +// NewUpdateCrayonAccountsParamsWithHTTPClient creates a new UpdateCrayonAccountsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewUpdateCrayonAccountsParamsWithHTTPClient(client *http.Client) *UpdateCrayonAccountsParams { + var () + return &UpdateCrayonAccountsParams{ + HTTPClient: client, + } +} + +/*UpdateCrayonAccountsParams contains all the parameters to send to the API endpoint +for the update crayon accounts operation typically these are written to a http.Request +*/ +type UpdateCrayonAccountsParams struct { + + /*CrayonAccount*/ + CrayonAccount *models.CrayonAccount + /*ID*/ + ID int32 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the update crayon accounts params +func (o *UpdateCrayonAccountsParams) WithTimeout(timeout time.Duration) *UpdateCrayonAccountsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update crayon accounts params +func (o *UpdateCrayonAccountsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update crayon accounts params +func (o *UpdateCrayonAccountsParams) WithContext(ctx context.Context) *UpdateCrayonAccountsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update crayon accounts params +func (o *UpdateCrayonAccountsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update crayon accounts params +func (o *UpdateCrayonAccountsParams) WithHTTPClient(client *http.Client) *UpdateCrayonAccountsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update crayon accounts params +func (o *UpdateCrayonAccountsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCrayonAccount adds the crayonAccount to the update crayon accounts params +func (o *UpdateCrayonAccountsParams) WithCrayonAccount(crayonAccount *models.CrayonAccount) *UpdateCrayonAccountsParams { + o.SetCrayonAccount(crayonAccount) + return o +} + +// SetCrayonAccount adds the crayonAccount to the update crayon accounts params +func (o *UpdateCrayonAccountsParams) SetCrayonAccount(crayonAccount *models.CrayonAccount) { + o.CrayonAccount = crayonAccount +} + +// WithID adds the id to the update crayon accounts params +func (o *UpdateCrayonAccountsParams) WithID(id int32) *UpdateCrayonAccountsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the update crayon accounts params +func (o *UpdateCrayonAccountsParams) SetID(id int32) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateCrayonAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.CrayonAccount != nil { + if err := r.SetBodyParam(o.CrayonAccount); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt32(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/crayon_accounts/update_crayon_accounts_responses.go b/client/crayon_accounts/update_crayon_accounts_responses.go new file mode 100644 index 0000000..7ceb90f --- /dev/null +++ b/client/crayon_accounts/update_crayon_accounts_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package crayon_accounts + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// UpdateCrayonAccountsReader is a Reader for the UpdateCrayonAccounts structure. +type UpdateCrayonAccountsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateCrayonAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateCrayonAccountsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewUpdateCrayonAccountsOK creates a UpdateCrayonAccountsOK with default headers values +func NewUpdateCrayonAccountsOK() *UpdateCrayonAccountsOK { + return &UpdateCrayonAccountsOK{} +} + +/*UpdateCrayonAccountsOK handles this case with default header values. + +Success +*/ +type UpdateCrayonAccountsOK struct { + Payload *models.CrayonAccount +} + +func (o *UpdateCrayonAccountsOK) Error() string { + return fmt.Sprintf("[PUT /api/v1/CrayonAccounts/{id}][%d] updateCrayonAccountsOK %+v", 200, o.Payload) +} + +func (o *UpdateCrayonAccountsOK) GetPayload() *models.CrayonAccount { + return o.Payload +} + +func (o *UpdateCrayonAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CrayonAccount) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/customer_tenants/create_customer_tenants_parameters.go b/client/customer_tenants/create_customer_tenants_parameters.go new file mode 100644 index 0000000..92a06d1 --- /dev/null +++ b/client/customer_tenants/create_customer_tenants_parameters.go @@ -0,0 +1,135 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer_tenants + +// 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/bjerkio/crayon-api-go/models" +) + +// NewCreateCustomerTenantsParams creates a new CreateCustomerTenantsParams object +// with the default values initialized. +func NewCreateCustomerTenantsParams() *CreateCustomerTenantsParams { + var () + return &CreateCustomerTenantsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCreateCustomerTenantsParamsWithTimeout creates a new CreateCustomerTenantsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCreateCustomerTenantsParamsWithTimeout(timeout time.Duration) *CreateCustomerTenantsParams { + var () + return &CreateCustomerTenantsParams{ + + timeout: timeout, + } +} + +// NewCreateCustomerTenantsParamsWithContext creates a new CreateCustomerTenantsParams object +// with the default values initialized, and the ability to set a context for a request +func NewCreateCustomerTenantsParamsWithContext(ctx context.Context) *CreateCustomerTenantsParams { + var () + return &CreateCustomerTenantsParams{ + + Context: ctx, + } +} + +// NewCreateCustomerTenantsParamsWithHTTPClient creates a new CreateCustomerTenantsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCreateCustomerTenantsParamsWithHTTPClient(client *http.Client) *CreateCustomerTenantsParams { + var () + return &CreateCustomerTenantsParams{ + HTTPClient: client, + } +} + +/*CreateCustomerTenantsParams contains all the parameters to send to the API endpoint +for the create customer tenants operation typically these are written to a http.Request +*/ +type CreateCustomerTenantsParams struct { + + /*CustomerTenant*/ + CustomerTenant *models.CustomerTenantDetailed + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the create customer tenants params +func (o *CreateCustomerTenantsParams) WithTimeout(timeout time.Duration) *CreateCustomerTenantsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create customer tenants params +func (o *CreateCustomerTenantsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create customer tenants params +func (o *CreateCustomerTenantsParams) WithContext(ctx context.Context) *CreateCustomerTenantsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create customer tenants params +func (o *CreateCustomerTenantsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create customer tenants params +func (o *CreateCustomerTenantsParams) WithHTTPClient(client *http.Client) *CreateCustomerTenantsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create customer tenants params +func (o *CreateCustomerTenantsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCustomerTenant adds the customerTenant to the create customer tenants params +func (o *CreateCustomerTenantsParams) WithCustomerTenant(customerTenant *models.CustomerTenantDetailed) *CreateCustomerTenantsParams { + o.SetCustomerTenant(customerTenant) + return o +} + +// SetCustomerTenant adds the customerTenant to the create customer tenants params +func (o *CreateCustomerTenantsParams) SetCustomerTenant(customerTenant *models.CustomerTenantDetailed) { + o.CustomerTenant = customerTenant +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateCustomerTenantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.CustomerTenant != nil { + if err := r.SetBodyParam(o.CustomerTenant); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/customer_tenants/create_customer_tenants_responses.go b/client/customer_tenants/create_customer_tenants_responses.go new file mode 100644 index 0000000..fdb5f73 --- /dev/null +++ b/client/customer_tenants/create_customer_tenants_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer_tenants + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// CreateCustomerTenantsReader is a Reader for the CreateCustomerTenants structure. +type CreateCustomerTenantsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateCustomerTenantsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateCustomerTenantsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewCreateCustomerTenantsOK creates a CreateCustomerTenantsOK with default headers values +func NewCreateCustomerTenantsOK() *CreateCustomerTenantsOK { + return &CreateCustomerTenantsOK{} +} + +/*CreateCustomerTenantsOK handles this case with default header values. + +Success +*/ +type CreateCustomerTenantsOK struct { + Payload *models.CustomerTenantDetailed +} + +func (o *CreateCustomerTenantsOK) Error() string { + return fmt.Sprintf("[POST /api/v1/CustomerTenants][%d] createCustomerTenantsOK %+v", 200, o.Payload) +} + +func (o *CreateCustomerTenantsOK) GetPayload() *models.CustomerTenantDetailed { + return o.Payload +} + +func (o *CreateCustomerTenantsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CustomerTenantDetailed) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/customer_tenants/customer_tenants_client.go b/client/customer_tenants/customer_tenants_client.go index db4af21..af85f9f 100644 --- a/client/customer_tenants/customer_tenants_client.go +++ b/client/customer_tenants/customer_tenants_client.go @@ -29,6 +29,8 @@ type Client struct { type ClientService interface { AddExisting(params *AddExistingParams, authInfo runtime.ClientAuthInfoWriter) (*AddExistingOK, error) + CreateCustomerTenants(params *CreateCustomerTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*CreateCustomerTenantsOK, error) + DeleteCustomerByID(params *DeleteCustomerByIDParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCustomerByIDOK, error) GetAzurePlan(params *GetAzurePlanParams, authInfo runtime.ClientAuthInfoWriter) (*GetAzurePlanOK, error) @@ -39,9 +41,7 @@ type ClientService interface { GetCustomerTenants(params *GetCustomerTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*GetCustomerTenantsOK, error) - PostCustomerTenants(params *PostCustomerTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*PostCustomerTenantsOK, error) - - PutCustomerTenants(params *PutCustomerTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*PutCustomerTenantsOK, error) + UpdateCustomerTenants(params *UpdateCustomerTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateCustomerTenantsOK, error) SetTransport(transport runtime.ClientTransport) } @@ -81,6 +81,41 @@ func (a *Client) AddExisting(params *AddExistingParams, authInfo runtime.ClientA panic(msg) } +/* + CreateCustomerTenants create customer tenants API +*/ +func (a *Client) CreateCustomerTenants(params *CreateCustomerTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*CreateCustomerTenantsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateCustomerTenantsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "CreateCustomerTenants", + Method: "POST", + PathPattern: "/api/v1/CustomerTenants", + ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, + ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &CreateCustomerTenantsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*CreateCustomerTenantsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for CreateCustomerTenants: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* DeleteCustomerByID delete customer by Id API */ @@ -257,58 +292,23 @@ func (a *Client) GetCustomerTenants(params *GetCustomerTenantsParams, authInfo r } /* - PostCustomerTenants post customer tenants API -*/ -func (a *Client) PostCustomerTenants(params *PostCustomerTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*PostCustomerTenantsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPostCustomerTenantsParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PostCustomerTenants", - Method: "POST", - PathPattern: "/api/v1/CustomerTenants", - ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, - ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PostCustomerTenantsReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - success, ok := result.(*PostCustomerTenantsOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PostCustomerTenants: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - PutCustomerTenants put customer tenants API + UpdateCustomerTenants update customer tenants API */ -func (a *Client) PutCustomerTenants(params *PutCustomerTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*PutCustomerTenantsOK, error) { +func (a *Client) UpdateCustomerTenants(params *UpdateCustomerTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateCustomerTenantsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPutCustomerTenantsParams() + params = NewUpdateCustomerTenantsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PutCustomerTenants", + ID: "UpdateCustomerTenants", Method: "PUT", PathPattern: "/api/v1/CustomerTenants/{id}", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PutCustomerTenantsReader{formats: a.formats}, + Reader: &UpdateCustomerTenantsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -316,13 +316,13 @@ func (a *Client) PutCustomerTenants(params *PutCustomerTenantsParams, authInfo r if err != nil { return nil, err } - success, ok := result.(*PutCustomerTenantsOK) + success, ok := result.(*UpdateCustomerTenantsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PutCustomerTenants: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for UpdateCustomerTenants: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } diff --git a/client/customer_tenants/update_customer_tenants_parameters.go b/client/customer_tenants/update_customer_tenants_parameters.go new file mode 100644 index 0000000..cf8fd20 --- /dev/null +++ b/client/customer_tenants/update_customer_tenants_parameters.go @@ -0,0 +1,154 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer_tenants + +// 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" + + "github.com/bjerkio/crayon-api-go/models" +) + +// NewUpdateCustomerTenantsParams creates a new UpdateCustomerTenantsParams object +// with the default values initialized. +func NewUpdateCustomerTenantsParams() *UpdateCustomerTenantsParams { + var () + return &UpdateCustomerTenantsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateCustomerTenantsParamsWithTimeout creates a new UpdateCustomerTenantsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewUpdateCustomerTenantsParamsWithTimeout(timeout time.Duration) *UpdateCustomerTenantsParams { + var () + return &UpdateCustomerTenantsParams{ + + timeout: timeout, + } +} + +// NewUpdateCustomerTenantsParamsWithContext creates a new UpdateCustomerTenantsParams object +// with the default values initialized, and the ability to set a context for a request +func NewUpdateCustomerTenantsParamsWithContext(ctx context.Context) *UpdateCustomerTenantsParams { + var () + return &UpdateCustomerTenantsParams{ + + Context: ctx, + } +} + +// NewUpdateCustomerTenantsParamsWithHTTPClient creates a new UpdateCustomerTenantsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewUpdateCustomerTenantsParamsWithHTTPClient(client *http.Client) *UpdateCustomerTenantsParams { + var () + return &UpdateCustomerTenantsParams{ + HTTPClient: client, + } +} + +/*UpdateCustomerTenantsParams contains all the parameters to send to the API endpoint +for the update customer tenants operation typically these are written to a http.Request +*/ +type UpdateCustomerTenantsParams struct { + + /*CustomerTenant*/ + CustomerTenant *models.CustomerTenantDetailed + /*ID*/ + ID int32 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the update customer tenants params +func (o *UpdateCustomerTenantsParams) WithTimeout(timeout time.Duration) *UpdateCustomerTenantsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update customer tenants params +func (o *UpdateCustomerTenantsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update customer tenants params +func (o *UpdateCustomerTenantsParams) WithContext(ctx context.Context) *UpdateCustomerTenantsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update customer tenants params +func (o *UpdateCustomerTenantsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update customer tenants params +func (o *UpdateCustomerTenantsParams) WithHTTPClient(client *http.Client) *UpdateCustomerTenantsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update customer tenants params +func (o *UpdateCustomerTenantsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCustomerTenant adds the customerTenant to the update customer tenants params +func (o *UpdateCustomerTenantsParams) WithCustomerTenant(customerTenant *models.CustomerTenantDetailed) *UpdateCustomerTenantsParams { + o.SetCustomerTenant(customerTenant) + return o +} + +// SetCustomerTenant adds the customerTenant to the update customer tenants params +func (o *UpdateCustomerTenantsParams) SetCustomerTenant(customerTenant *models.CustomerTenantDetailed) { + o.CustomerTenant = customerTenant +} + +// WithID adds the id to the update customer tenants params +func (o *UpdateCustomerTenantsParams) WithID(id int32) *UpdateCustomerTenantsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the update customer tenants params +func (o *UpdateCustomerTenantsParams) SetID(id int32) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateCustomerTenantsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.CustomerTenant != nil { + if err := r.SetBodyParam(o.CustomerTenant); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt32(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/customer_tenants/update_customer_tenants_responses.go b/client/customer_tenants/update_customer_tenants_responses.go new file mode 100644 index 0000000..1f77958 --- /dev/null +++ b/client/customer_tenants/update_customer_tenants_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer_tenants + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// UpdateCustomerTenantsReader is a Reader for the UpdateCustomerTenants structure. +type UpdateCustomerTenantsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateCustomerTenantsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateCustomerTenantsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewUpdateCustomerTenantsOK creates a UpdateCustomerTenantsOK with default headers values +func NewUpdateCustomerTenantsOK() *UpdateCustomerTenantsOK { + return &UpdateCustomerTenantsOK{} +} + +/*UpdateCustomerTenantsOK handles this case with default header values. + +Success +*/ +type UpdateCustomerTenantsOK struct { + Payload *models.CustomerTenantDetailed +} + +func (o *UpdateCustomerTenantsOK) Error() string { + return fmt.Sprintf("[PUT /api/v1/CustomerTenants/{id}][%d] updateCustomerTenantsOK %+v", 200, o.Payload) +} + +func (o *UpdateCustomerTenantsOK) GetPayload() *models.CustomerTenantDetailed { + return o.Payload +} + +func (o *UpdateCustomerTenantsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CustomerTenantDetailed) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/customer_token/create_customer_token_parameters.go b/client/customer_token/create_customer_token_parameters.go new file mode 100644 index 0000000..4dcec8c --- /dev/null +++ b/client/customer_token/create_customer_token_parameters.go @@ -0,0 +1,190 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer_token + +// 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" +) + +// NewCreateCustomerTokenParams creates a new CreateCustomerTokenParams object +// with the default values initialized. +func NewCreateCustomerTokenParams() *CreateCustomerTokenParams { + var () + return &CreateCustomerTokenParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCreateCustomerTokenParamsWithTimeout creates a new CreateCustomerTokenParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCreateCustomerTokenParamsWithTimeout(timeout time.Duration) *CreateCustomerTokenParams { + var () + return &CreateCustomerTokenParams{ + + timeout: timeout, + } +} + +// NewCreateCustomerTokenParamsWithContext creates a new CreateCustomerTokenParams object +// with the default values initialized, and the ability to set a context for a request +func NewCreateCustomerTokenParamsWithContext(ctx context.Context) *CreateCustomerTokenParams { + var () + return &CreateCustomerTokenParams{ + + Context: ctx, + } +} + +// NewCreateCustomerTokenParamsWithHTTPClient creates a new CreateCustomerTokenParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCreateCustomerTokenParamsWithHTTPClient(client *http.Client) *CreateCustomerTokenParams { + var () + return &CreateCustomerTokenParams{ + HTTPClient: client, + } +} + +/*CreateCustomerTokenParams contains all the parameters to send to the API endpoint +for the create customer token operation typically these are written to a http.Request +*/ +type CreateCustomerTokenParams struct { + + /*GrantType*/ + GrantType interface{} + /*Password*/ + Password interface{} + /*Scope*/ + Scope interface{} + /*Username*/ + Username interface{} + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the create customer token params +func (o *CreateCustomerTokenParams) WithTimeout(timeout time.Duration) *CreateCustomerTokenParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create customer token params +func (o *CreateCustomerTokenParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create customer token params +func (o *CreateCustomerTokenParams) WithContext(ctx context.Context) *CreateCustomerTokenParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create customer token params +func (o *CreateCustomerTokenParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create customer token params +func (o *CreateCustomerTokenParams) WithHTTPClient(client *http.Client) *CreateCustomerTokenParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create customer token params +func (o *CreateCustomerTokenParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGrantType adds the grantType to the create customer token params +func (o *CreateCustomerTokenParams) WithGrantType(grantType interface{}) *CreateCustomerTokenParams { + o.SetGrantType(grantType) + return o +} + +// SetGrantType adds the grantType to the create customer token params +func (o *CreateCustomerTokenParams) SetGrantType(grantType interface{}) { + o.GrantType = grantType +} + +// WithPassword adds the password to the create customer token params +func (o *CreateCustomerTokenParams) WithPassword(password interface{}) *CreateCustomerTokenParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the create customer token params +func (o *CreateCustomerTokenParams) SetPassword(password interface{}) { + o.Password = password +} + +// WithScope adds the scope to the create customer token params +func (o *CreateCustomerTokenParams) WithScope(scope interface{}) *CreateCustomerTokenParams { + o.SetScope(scope) + return o +} + +// SetScope adds the scope to the create customer token params +func (o *CreateCustomerTokenParams) SetScope(scope interface{}) { + o.Scope = scope +} + +// WithUsername adds the username to the create customer token params +func (o *CreateCustomerTokenParams) WithUsername(username interface{}) *CreateCustomerTokenParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the create customer token params +func (o *CreateCustomerTokenParams) SetUsername(username interface{}) { + o.Username = username +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateCustomerTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.GrantType != nil { + if err := r.SetBodyParam(o.GrantType); err != nil { + return err + } + } + + if o.Password != nil { + if err := r.SetBodyParam(o.Password); err != nil { + return err + } + } + + if o.Scope != nil { + if err := r.SetBodyParam(o.Scope); err != nil { + return err + } + } + + if o.Username != nil { + if err := r.SetBodyParam(o.Username); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/customer_token/create_customer_token_responses.go b/client/customer_token/create_customer_token_responses.go new file mode 100644 index 0000000..e7d3a83 --- /dev/null +++ b/client/customer_token/create_customer_token_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer_token + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// CreateCustomerTokenReader is a Reader for the CreateCustomerToken structure. +type CreateCustomerTokenReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateCustomerTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateCustomerTokenOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewCreateCustomerTokenOK creates a CreateCustomerTokenOK with default headers values +func NewCreateCustomerTokenOK() *CreateCustomerTokenOK { + return &CreateCustomerTokenOK{} +} + +/*CreateCustomerTokenOK handles this case with default header values. + +Success +*/ +type CreateCustomerTokenOK struct { + Payload *models.Token +} + +func (o *CreateCustomerTokenOK) Error() string { + return fmt.Sprintf("[POST /api/v1/connect/token][%d] createCustomerTokenOK %+v", 200, o.Payload) +} + +func (o *CreateCustomerTokenOK) GetPayload() *models.Token { + return o.Payload +} + +func (o *CreateCustomerTokenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Token) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/customer_token/customer_token_client.go b/client/customer_token/customer_token_client.go index 9c835f2..2ae389d 100644 --- a/client/customer_token/customer_token_client.go +++ b/client/customer_token/customer_token_client.go @@ -27,29 +27,29 @@ type Client struct { // ClientService is the interface for Client methods type ClientService interface { - PostCustomerToken(params *PostCustomerTokenParams, authInfo runtime.ClientAuthInfoWriter) (*PostCustomerTokenOK, error) + CreateCustomerToken(params *CreateCustomerTokenParams, authInfo runtime.ClientAuthInfoWriter) (*CreateCustomerTokenOK, error) SetTransport(transport runtime.ClientTransport) } /* - PostCustomerToken post customer token API + CreateCustomerToken create customer token API */ -func (a *Client) PostCustomerToken(params *PostCustomerTokenParams, authInfo runtime.ClientAuthInfoWriter) (*PostCustomerTokenOK, error) { +func (a *Client) CreateCustomerToken(params *CreateCustomerTokenParams, authInfo runtime.ClientAuthInfoWriter) (*CreateCustomerTokenOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPostCustomerTokenParams() + params = NewCreateCustomerTokenParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PostCustomerToken", + ID: "CreateCustomerToken", Method: "POST", PathPattern: "/api/v1/connect/token", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PostCustomerTokenReader{formats: a.formats}, + Reader: &CreateCustomerTokenReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -57,13 +57,13 @@ func (a *Client) PostCustomerToken(params *PostCustomerTokenParams, authInfo run if err != nil { return nil, err } - success, ok := result.(*PostCustomerTokenOK) + success, ok := result.(*CreateCustomerTokenOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PostCustomerToken: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for CreateCustomerToken: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } diff --git a/client/customer_token/post_customer_token_parameters.go b/client/customer_token/post_customer_token_parameters.go index ccde43a..03d804b 100644 --- a/client/customer_token/post_customer_token_parameters.go +++ b/client/customer_token/post_customer_token_parameters.go @@ -19,7 +19,7 @@ import ( // NewPostCustomerTokenParams creates a new PostCustomerTokenParams object // with the default values initialized. func NewPostCustomerTokenParams() *PostCustomerTokenParams { - + var () return &PostCustomerTokenParams{ timeout: cr.DefaultTimeout, @@ -29,7 +29,7 @@ func NewPostCustomerTokenParams() *PostCustomerTokenParams { // NewPostCustomerTokenParamsWithTimeout creates a new PostCustomerTokenParams object // with the default values initialized, and the ability to set a timeout on a request func NewPostCustomerTokenParamsWithTimeout(timeout time.Duration) *PostCustomerTokenParams { - + var () return &PostCustomerTokenParams{ timeout: timeout, @@ -39,7 +39,7 @@ func NewPostCustomerTokenParamsWithTimeout(timeout time.Duration) *PostCustomerT // NewPostCustomerTokenParamsWithContext creates a new PostCustomerTokenParams object // with the default values initialized, and the ability to set a context for a request func NewPostCustomerTokenParamsWithContext(ctx context.Context) *PostCustomerTokenParams { - + var () return &PostCustomerTokenParams{ Context: ctx, @@ -49,7 +49,7 @@ func NewPostCustomerTokenParamsWithContext(ctx context.Context) *PostCustomerTok // NewPostCustomerTokenParamsWithHTTPClient creates a new PostCustomerTokenParams object // with the default values initialized, and the ability to set a custom HTTPClient for a request func NewPostCustomerTokenParamsWithHTTPClient(client *http.Client) *PostCustomerTokenParams { - + var () return &PostCustomerTokenParams{ HTTPClient: client, } @@ -59,6 +59,16 @@ func NewPostCustomerTokenParamsWithHTTPClient(client *http.Client) *PostCustomer for the post customer token operation typically these are written to a http.Request */ type PostCustomerTokenParams struct { + + /*GrantType*/ + GrantType interface{} + /*Password*/ + Password interface{} + /*Scope*/ + Scope interface{} + /*Username*/ + Username interface{} + timeout time.Duration Context context.Context HTTPClient *http.Client @@ -97,6 +107,50 @@ func (o *PostCustomerTokenParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } +// WithGrantType adds the grantType to the post customer token params +func (o *PostCustomerTokenParams) WithGrantType(grantType interface{}) *PostCustomerTokenParams { + o.SetGrantType(grantType) + return o +} + +// SetGrantType adds the grantType to the post customer token params +func (o *PostCustomerTokenParams) SetGrantType(grantType interface{}) { + o.GrantType = grantType +} + +// WithPassword adds the password to the post customer token params +func (o *PostCustomerTokenParams) WithPassword(password interface{}) *PostCustomerTokenParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the post customer token params +func (o *PostCustomerTokenParams) SetPassword(password interface{}) { + o.Password = password +} + +// WithScope adds the scope to the post customer token params +func (o *PostCustomerTokenParams) WithScope(scope interface{}) *PostCustomerTokenParams { + o.SetScope(scope) + return o +} + +// SetScope adds the scope to the post customer token params +func (o *PostCustomerTokenParams) SetScope(scope interface{}) { + o.Scope = scope +} + +// WithUsername adds the username to the post customer token params +func (o *PostCustomerTokenParams) WithUsername(username interface{}) *PostCustomerTokenParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the post customer token params +func (o *PostCustomerTokenParams) SetUsername(username interface{}) { + o.Username = username +} + // WriteToRequest writes these params to a swagger request func (o *PostCustomerTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { @@ -105,6 +159,30 @@ func (o *PostCustomerTokenParams) WriteToRequest(r runtime.ClientRequest, reg st } var res []error + if o.GrantType != nil { + if err := r.SetBodyParam(o.GrantType); err != nil { + return err + } + } + + if o.Password != nil { + if err := r.SetBodyParam(o.Password); err != nil { + return err + } + } + + if o.Scope != nil { + if err := r.SetBodyParam(o.Scope); err != nil { + return err + } + } + + if o.Username != nil { + if err := r.SetBodyParam(o.Username); err != nil { + return err + } + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } diff --git a/client/groupings/create_groupings_parameters.go b/client/groupings/create_groupings_parameters.go new file mode 100644 index 0000000..44bf8d7 --- /dev/null +++ b/client/groupings/create_groupings_parameters.go @@ -0,0 +1,135 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groupings + +// 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/bjerkio/crayon-api-go/models" +) + +// NewCreateGroupingsParams creates a new CreateGroupingsParams object +// with the default values initialized. +func NewCreateGroupingsParams() *CreateGroupingsParams { + var () + return &CreateGroupingsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCreateGroupingsParamsWithTimeout creates a new CreateGroupingsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCreateGroupingsParamsWithTimeout(timeout time.Duration) *CreateGroupingsParams { + var () + return &CreateGroupingsParams{ + + timeout: timeout, + } +} + +// NewCreateGroupingsParamsWithContext creates a new CreateGroupingsParams object +// with the default values initialized, and the ability to set a context for a request +func NewCreateGroupingsParamsWithContext(ctx context.Context) *CreateGroupingsParams { + var () + return &CreateGroupingsParams{ + + Context: ctx, + } +} + +// NewCreateGroupingsParamsWithHTTPClient creates a new CreateGroupingsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCreateGroupingsParamsWithHTTPClient(client *http.Client) *CreateGroupingsParams { + var () + return &CreateGroupingsParams{ + HTTPClient: client, + } +} + +/*CreateGroupingsParams contains all the parameters to send to the API endpoint +for the create groupings operation typically these are written to a http.Request +*/ +type CreateGroupingsParams struct { + + /*Grouping*/ + Grouping *models.Grouping + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the create groupings params +func (o *CreateGroupingsParams) WithTimeout(timeout time.Duration) *CreateGroupingsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create groupings params +func (o *CreateGroupingsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create groupings params +func (o *CreateGroupingsParams) WithContext(ctx context.Context) *CreateGroupingsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create groupings params +func (o *CreateGroupingsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create groupings params +func (o *CreateGroupingsParams) WithHTTPClient(client *http.Client) *CreateGroupingsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create groupings params +func (o *CreateGroupingsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGrouping adds the grouping to the create groupings params +func (o *CreateGroupingsParams) WithGrouping(grouping *models.Grouping) *CreateGroupingsParams { + o.SetGrouping(grouping) + return o +} + +// SetGrouping adds the grouping to the create groupings params +func (o *CreateGroupingsParams) SetGrouping(grouping *models.Grouping) { + o.Grouping = grouping +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateGroupingsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Grouping != nil { + if err := r.SetBodyParam(o.Grouping); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/groupings/create_groupings_responses.go b/client/groupings/create_groupings_responses.go new file mode 100644 index 0000000..647fb63 --- /dev/null +++ b/client/groupings/create_groupings_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groupings + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// CreateGroupingsReader is a Reader for the CreateGroupings structure. +type CreateGroupingsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateGroupingsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateGroupingsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewCreateGroupingsOK creates a CreateGroupingsOK with default headers values +func NewCreateGroupingsOK() *CreateGroupingsOK { + return &CreateGroupingsOK{} +} + +/*CreateGroupingsOK handles this case with default header values. + +Success +*/ +type CreateGroupingsOK struct { + Payload *models.Grouping +} + +func (o *CreateGroupingsOK) Error() string { + return fmt.Sprintf("[POST /api/v1/Groupings][%d] createGroupingsOK %+v", 200, o.Payload) +} + +func (o *CreateGroupingsOK) GetPayload() *models.Grouping { + return o.Payload +} + +func (o *CreateGroupingsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Grouping) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/groupings/groupings_client.go b/client/groupings/groupings_client.go index 1f9f64c..8cb47ff 100644 --- a/client/groupings/groupings_client.go +++ b/client/groupings/groupings_client.go @@ -27,35 +27,35 @@ type Client struct { // ClientService is the interface for Client methods type ClientService interface { + CreateGroupings(params *CreateGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*CreateGroupingsOK, error) + DeleteGroupings(params *DeleteGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteGroupingsOK, error) GetGroupings(params *GetGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*GetGroupingsOK, error) - PostGroupings(params *PostGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*PostGroupingsOK, error) - - PutGroupings(params *PutGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*PutGroupingsOK, error) + UpdateGroupings(params *UpdateGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateGroupingsOK, error) SetTransport(transport runtime.ClientTransport) } /* - DeleteGroupings delete groupings API + CreateGroupings create groupings API */ -func (a *Client) DeleteGroupings(params *DeleteGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteGroupingsOK, error) { +func (a *Client) CreateGroupings(params *CreateGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*CreateGroupingsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewDeleteGroupingsParams() + params = NewCreateGroupingsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "DeleteGroupings", - Method: "DELETE", - PathPattern: "/api/v1/Groupings/{id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, + ID: "CreateGroupings", + Method: "POST", + PathPattern: "/api/v1/Groupings", + ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, + ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, Schemes: []string{"http"}, Params: params, - Reader: &DeleteGroupingsReader{formats: a.formats}, + Reader: &CreateGroupingsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -63,34 +63,34 @@ func (a *Client) DeleteGroupings(params *DeleteGroupingsParams, authInfo runtime if err != nil { return nil, err } - success, ok := result.(*DeleteGroupingsOK) + success, ok := result.(*CreateGroupingsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for DeleteGroupings: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for CreateGroupings: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - GetGroupings get groupings API + DeleteGroupings delete groupings API */ -func (a *Client) GetGroupings(params *GetGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*GetGroupingsOK, error) { +func (a *Client) DeleteGroupings(params *DeleteGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteGroupingsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetGroupingsParams() + params = NewDeleteGroupingsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "GetGroupings", - Method: "GET", - PathPattern: "/api/v1/Groupings", - ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, + ID: "DeleteGroupings", + Method: "DELETE", + PathPattern: "/api/v1/Groupings/{id}", + ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &GetGroupingsReader{formats: a.formats}, + Reader: &DeleteGroupingsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -98,34 +98,34 @@ func (a *Client) GetGroupings(params *GetGroupingsParams, authInfo runtime.Clien if err != nil { return nil, err } - success, ok := result.(*GetGroupingsOK) + success, ok := result.(*DeleteGroupingsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetGroupings: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for DeleteGroupings: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - PostGroupings post groupings API + GetGroupings get groupings API */ -func (a *Client) PostGroupings(params *PostGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*PostGroupingsOK, error) { +func (a *Client) GetGroupings(params *GetGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*GetGroupingsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPostGroupingsParams() + params = NewGetGroupingsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PostGroupings", - Method: "POST", + ID: "GetGroupings", + Method: "GET", PathPattern: "/api/v1/Groupings", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, - ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PostGroupingsReader{formats: a.formats}, + Reader: &GetGroupingsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -133,34 +133,34 @@ func (a *Client) PostGroupings(params *PostGroupingsParams, authInfo runtime.Cli if err != nil { return nil, err } - success, ok := result.(*PostGroupingsOK) + success, ok := result.(*GetGroupingsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PostGroupings: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for GetGroupings: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - PutGroupings put groupings API + UpdateGroupings update groupings API */ -func (a *Client) PutGroupings(params *PutGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*PutGroupingsOK, error) { +func (a *Client) UpdateGroupings(params *UpdateGroupingsParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateGroupingsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPutGroupingsParams() + params = NewUpdateGroupingsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PutGroupings", + ID: "UpdateGroupings", Method: "PUT", PathPattern: "/api/v1/Groupings/{id}", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PutGroupingsReader{formats: a.formats}, + Reader: &UpdateGroupingsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -168,13 +168,13 @@ func (a *Client) PutGroupings(params *PutGroupingsParams, authInfo runtime.Clien if err != nil { return nil, err } - success, ok := result.(*PutGroupingsOK) + success, ok := result.(*UpdateGroupingsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PutGroupings: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for UpdateGroupings: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } diff --git a/client/groupings/update_groupings_parameters.go b/client/groupings/update_groupings_parameters.go new file mode 100644 index 0000000..2f9d4d7 --- /dev/null +++ b/client/groupings/update_groupings_parameters.go @@ -0,0 +1,154 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groupings + +// 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" + + "github.com/bjerkio/crayon-api-go/models" +) + +// NewUpdateGroupingsParams creates a new UpdateGroupingsParams object +// with the default values initialized. +func NewUpdateGroupingsParams() *UpdateGroupingsParams { + var () + return &UpdateGroupingsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateGroupingsParamsWithTimeout creates a new UpdateGroupingsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewUpdateGroupingsParamsWithTimeout(timeout time.Duration) *UpdateGroupingsParams { + var () + return &UpdateGroupingsParams{ + + timeout: timeout, + } +} + +// NewUpdateGroupingsParamsWithContext creates a new UpdateGroupingsParams object +// with the default values initialized, and the ability to set a context for a request +func NewUpdateGroupingsParamsWithContext(ctx context.Context) *UpdateGroupingsParams { + var () + return &UpdateGroupingsParams{ + + Context: ctx, + } +} + +// NewUpdateGroupingsParamsWithHTTPClient creates a new UpdateGroupingsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewUpdateGroupingsParamsWithHTTPClient(client *http.Client) *UpdateGroupingsParams { + var () + return &UpdateGroupingsParams{ + HTTPClient: client, + } +} + +/*UpdateGroupingsParams contains all the parameters to send to the API endpoint +for the update groupings operation typically these are written to a http.Request +*/ +type UpdateGroupingsParams struct { + + /*Grouping*/ + Grouping *models.Grouping + /*ID*/ + ID int32 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the update groupings params +func (o *UpdateGroupingsParams) WithTimeout(timeout time.Duration) *UpdateGroupingsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update groupings params +func (o *UpdateGroupingsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update groupings params +func (o *UpdateGroupingsParams) WithContext(ctx context.Context) *UpdateGroupingsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update groupings params +func (o *UpdateGroupingsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update groupings params +func (o *UpdateGroupingsParams) WithHTTPClient(client *http.Client) *UpdateGroupingsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update groupings params +func (o *UpdateGroupingsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGrouping adds the grouping to the update groupings params +func (o *UpdateGroupingsParams) WithGrouping(grouping *models.Grouping) *UpdateGroupingsParams { + o.SetGrouping(grouping) + return o +} + +// SetGrouping adds the grouping to the update groupings params +func (o *UpdateGroupingsParams) SetGrouping(grouping *models.Grouping) { + o.Grouping = grouping +} + +// WithID adds the id to the update groupings params +func (o *UpdateGroupingsParams) WithID(id int32) *UpdateGroupingsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the update groupings params +func (o *UpdateGroupingsParams) SetID(id int32) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateGroupingsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Grouping != nil { + if err := r.SetBodyParam(o.Grouping); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt32(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/groupings/update_groupings_responses.go b/client/groupings/update_groupings_responses.go new file mode 100644 index 0000000..ed6dee5 --- /dev/null +++ b/client/groupings/update_groupings_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groupings + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// UpdateGroupingsReader is a Reader for the UpdateGroupings structure. +type UpdateGroupingsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateGroupingsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateGroupingsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewUpdateGroupingsOK creates a UpdateGroupingsOK with default headers values +func NewUpdateGroupingsOK() *UpdateGroupingsOK { + return &UpdateGroupingsOK{} +} + +/*UpdateGroupingsOK handles this case with default header values. + +Success +*/ +type UpdateGroupingsOK struct { + Payload *models.Grouping +} + +func (o *UpdateGroupingsOK) Error() string { + return fmt.Sprintf("[PUT /api/v1/Groupings/{id}][%d] updateGroupingsOK %+v", 200, o.Payload) +} + +func (o *UpdateGroupingsOK) GetPayload() *models.Grouping { + return o.Payload +} + +func (o *UpdateGroupingsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Grouping) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/invoice_profiles/create_invoice_profiles_parameters.go b/client/invoice_profiles/create_invoice_profiles_parameters.go new file mode 100644 index 0000000..34ed855 --- /dev/null +++ b/client/invoice_profiles/create_invoice_profiles_parameters.go @@ -0,0 +1,135 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package invoice_profiles + +// 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/bjerkio/crayon-api-go/models" +) + +// NewCreateInvoiceProfilesParams creates a new CreateInvoiceProfilesParams object +// with the default values initialized. +func NewCreateInvoiceProfilesParams() *CreateInvoiceProfilesParams { + var () + return &CreateInvoiceProfilesParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCreateInvoiceProfilesParamsWithTimeout creates a new CreateInvoiceProfilesParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCreateInvoiceProfilesParamsWithTimeout(timeout time.Duration) *CreateInvoiceProfilesParams { + var () + return &CreateInvoiceProfilesParams{ + + timeout: timeout, + } +} + +// NewCreateInvoiceProfilesParamsWithContext creates a new CreateInvoiceProfilesParams object +// with the default values initialized, and the ability to set a context for a request +func NewCreateInvoiceProfilesParamsWithContext(ctx context.Context) *CreateInvoiceProfilesParams { + var () + return &CreateInvoiceProfilesParams{ + + Context: ctx, + } +} + +// NewCreateInvoiceProfilesParamsWithHTTPClient creates a new CreateInvoiceProfilesParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCreateInvoiceProfilesParamsWithHTTPClient(client *http.Client) *CreateInvoiceProfilesParams { + var () + return &CreateInvoiceProfilesParams{ + HTTPClient: client, + } +} + +/*CreateInvoiceProfilesParams contains all the parameters to send to the API endpoint +for the create invoice profiles operation typically these are written to a http.Request +*/ +type CreateInvoiceProfilesParams struct { + + /*InvoiceProfile*/ + InvoiceProfile *models.InvoiceProfile + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the create invoice profiles params +func (o *CreateInvoiceProfilesParams) WithTimeout(timeout time.Duration) *CreateInvoiceProfilesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create invoice profiles params +func (o *CreateInvoiceProfilesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create invoice profiles params +func (o *CreateInvoiceProfilesParams) WithContext(ctx context.Context) *CreateInvoiceProfilesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create invoice profiles params +func (o *CreateInvoiceProfilesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create invoice profiles params +func (o *CreateInvoiceProfilesParams) WithHTTPClient(client *http.Client) *CreateInvoiceProfilesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create invoice profiles params +func (o *CreateInvoiceProfilesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithInvoiceProfile adds the invoiceProfile to the create invoice profiles params +func (o *CreateInvoiceProfilesParams) WithInvoiceProfile(invoiceProfile *models.InvoiceProfile) *CreateInvoiceProfilesParams { + o.SetInvoiceProfile(invoiceProfile) + return o +} + +// SetInvoiceProfile adds the invoiceProfile to the create invoice profiles params +func (o *CreateInvoiceProfilesParams) SetInvoiceProfile(invoiceProfile *models.InvoiceProfile) { + o.InvoiceProfile = invoiceProfile +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateInvoiceProfilesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.InvoiceProfile != nil { + if err := r.SetBodyParam(o.InvoiceProfile); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/invoice_profiles/create_invoice_profiles_responses.go b/client/invoice_profiles/create_invoice_profiles_responses.go new file mode 100644 index 0000000..6613d13 --- /dev/null +++ b/client/invoice_profiles/create_invoice_profiles_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package invoice_profiles + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// CreateInvoiceProfilesReader is a Reader for the CreateInvoiceProfiles structure. +type CreateInvoiceProfilesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateInvoiceProfilesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateInvoiceProfilesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewCreateInvoiceProfilesOK creates a CreateInvoiceProfilesOK with default headers values +func NewCreateInvoiceProfilesOK() *CreateInvoiceProfilesOK { + return &CreateInvoiceProfilesOK{} +} + +/*CreateInvoiceProfilesOK handles this case with default header values. + +Success +*/ +type CreateInvoiceProfilesOK struct { + Payload *models.InvoiceProfile +} + +func (o *CreateInvoiceProfilesOK) Error() string { + return fmt.Sprintf("[POST /api/v1/InvoiceProfiles][%d] createInvoiceProfilesOK %+v", 200, o.Payload) +} + +func (o *CreateInvoiceProfilesOK) GetPayload() *models.InvoiceProfile { + return o.Payload +} + +func (o *CreateInvoiceProfilesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InvoiceProfile) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/invoice_profiles/invoice_profiles_client.go b/client/invoice_profiles/invoice_profiles_client.go index 01320d5..6a8183d 100644 --- a/client/invoice_profiles/invoice_profiles_client.go +++ b/client/invoice_profiles/invoice_profiles_client.go @@ -27,35 +27,35 @@ type Client struct { // ClientService is the interface for Client methods type ClientService interface { + CreateInvoiceProfiles(params *CreateInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*CreateInvoiceProfilesOK, error) + DeleteInvoiceProfiles(params *DeleteInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteInvoiceProfilesOK, error) GetInvoiceProfiles(params *GetInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*GetInvoiceProfilesOK, error) - PostInvoiceProfiles(params *PostInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*PostInvoiceProfilesOK, error) - - PutInvoiceProfiles(params *PutInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*PutInvoiceProfilesOK, error) + UpdateInvoiceProfiles(params *UpdateInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateInvoiceProfilesOK, error) SetTransport(transport runtime.ClientTransport) } /* - DeleteInvoiceProfiles delete invoice profiles API + CreateInvoiceProfiles create invoice profiles API */ -func (a *Client) DeleteInvoiceProfiles(params *DeleteInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteInvoiceProfilesOK, error) { +func (a *Client) CreateInvoiceProfiles(params *CreateInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*CreateInvoiceProfilesOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewDeleteInvoiceProfilesParams() + params = NewCreateInvoiceProfilesParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "DeleteInvoiceProfiles", - Method: "DELETE", - PathPattern: "/api/v1/InvoiceProfiles/{id}", + ID: "CreateInvoiceProfiles", + Method: "POST", + PathPattern: "/api/v1/InvoiceProfiles", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, - ConsumesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, Schemes: []string{"http"}, Params: params, - Reader: &DeleteInvoiceProfilesReader{formats: a.formats}, + Reader: &CreateInvoiceProfilesReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -63,34 +63,34 @@ func (a *Client) DeleteInvoiceProfiles(params *DeleteInvoiceProfilesParams, auth if err != nil { return nil, err } - success, ok := result.(*DeleteInvoiceProfilesOK) + success, ok := result.(*CreateInvoiceProfilesOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for DeleteInvoiceProfiles: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for CreateInvoiceProfiles: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - GetInvoiceProfiles get invoice profiles API + DeleteInvoiceProfiles delete invoice profiles API */ -func (a *Client) GetInvoiceProfiles(params *GetInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*GetInvoiceProfilesOK, error) { +func (a *Client) DeleteInvoiceProfiles(params *DeleteInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteInvoiceProfilesOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetInvoiceProfilesParams() + params = NewDeleteInvoiceProfilesParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "GetInvoiceProfiles", - Method: "GET", - PathPattern: "/api/v1/InvoiceProfiles", + ID: "DeleteInvoiceProfiles", + Method: "DELETE", + PathPattern: "/api/v1/InvoiceProfiles/{id}", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &GetInvoiceProfilesReader{formats: a.formats}, + Reader: &DeleteInvoiceProfilesReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -98,34 +98,34 @@ func (a *Client) GetInvoiceProfiles(params *GetInvoiceProfilesParams, authInfo r if err != nil { return nil, err } - success, ok := result.(*GetInvoiceProfilesOK) + success, ok := result.(*DeleteInvoiceProfilesOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetInvoiceProfiles: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for DeleteInvoiceProfiles: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - PostInvoiceProfiles post invoice profiles API + GetInvoiceProfiles get invoice profiles API */ -func (a *Client) PostInvoiceProfiles(params *PostInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*PostInvoiceProfilesOK, error) { +func (a *Client) GetInvoiceProfiles(params *GetInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*GetInvoiceProfilesOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPostInvoiceProfilesParams() + params = NewGetInvoiceProfilesParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PostInvoiceProfiles", - Method: "POST", + ID: "GetInvoiceProfiles", + Method: "GET", PathPattern: "/api/v1/InvoiceProfiles", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, - ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PostInvoiceProfilesReader{formats: a.formats}, + Reader: &GetInvoiceProfilesReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -133,34 +133,34 @@ func (a *Client) PostInvoiceProfiles(params *PostInvoiceProfilesParams, authInfo if err != nil { return nil, err } - success, ok := result.(*PostInvoiceProfilesOK) + success, ok := result.(*GetInvoiceProfilesOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PostInvoiceProfiles: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for GetInvoiceProfiles: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - PutInvoiceProfiles put invoice profiles API + UpdateInvoiceProfiles update invoice profiles API */ -func (a *Client) PutInvoiceProfiles(params *PutInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*PutInvoiceProfilesOK, error) { +func (a *Client) UpdateInvoiceProfiles(params *UpdateInvoiceProfilesParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateInvoiceProfilesOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPutInvoiceProfilesParams() + params = NewUpdateInvoiceProfilesParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PutInvoiceProfiles", + ID: "UpdateInvoiceProfiles", Method: "PUT", PathPattern: "/api/v1/InvoiceProfiles/{id}", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PutInvoiceProfilesReader{formats: a.formats}, + Reader: &UpdateInvoiceProfilesReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -168,13 +168,13 @@ func (a *Client) PutInvoiceProfiles(params *PutInvoiceProfilesParams, authInfo r if err != nil { return nil, err } - success, ok := result.(*PutInvoiceProfilesOK) + success, ok := result.(*UpdateInvoiceProfilesOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PutInvoiceProfiles: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for UpdateInvoiceProfiles: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } diff --git a/client/invoice_profiles/update_invoice_profiles_parameters.go b/client/invoice_profiles/update_invoice_profiles_parameters.go new file mode 100644 index 0000000..3471fd6 --- /dev/null +++ b/client/invoice_profiles/update_invoice_profiles_parameters.go @@ -0,0 +1,154 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package invoice_profiles + +// 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" + + "github.com/bjerkio/crayon-api-go/models" +) + +// NewUpdateInvoiceProfilesParams creates a new UpdateInvoiceProfilesParams object +// with the default values initialized. +func NewUpdateInvoiceProfilesParams() *UpdateInvoiceProfilesParams { + var () + return &UpdateInvoiceProfilesParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateInvoiceProfilesParamsWithTimeout creates a new UpdateInvoiceProfilesParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewUpdateInvoiceProfilesParamsWithTimeout(timeout time.Duration) *UpdateInvoiceProfilesParams { + var () + return &UpdateInvoiceProfilesParams{ + + timeout: timeout, + } +} + +// NewUpdateInvoiceProfilesParamsWithContext creates a new UpdateInvoiceProfilesParams object +// with the default values initialized, and the ability to set a context for a request +func NewUpdateInvoiceProfilesParamsWithContext(ctx context.Context) *UpdateInvoiceProfilesParams { + var () + return &UpdateInvoiceProfilesParams{ + + Context: ctx, + } +} + +// NewUpdateInvoiceProfilesParamsWithHTTPClient creates a new UpdateInvoiceProfilesParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewUpdateInvoiceProfilesParamsWithHTTPClient(client *http.Client) *UpdateInvoiceProfilesParams { + var () + return &UpdateInvoiceProfilesParams{ + HTTPClient: client, + } +} + +/*UpdateInvoiceProfilesParams contains all the parameters to send to the API endpoint +for the update invoice profiles operation typically these are written to a http.Request +*/ +type UpdateInvoiceProfilesParams struct { + + /*ID*/ + ID int32 + /*InvoiceProfile*/ + InvoiceProfile *models.InvoiceProfile + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the update invoice profiles params +func (o *UpdateInvoiceProfilesParams) WithTimeout(timeout time.Duration) *UpdateInvoiceProfilesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update invoice profiles params +func (o *UpdateInvoiceProfilesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update invoice profiles params +func (o *UpdateInvoiceProfilesParams) WithContext(ctx context.Context) *UpdateInvoiceProfilesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update invoice profiles params +func (o *UpdateInvoiceProfilesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update invoice profiles params +func (o *UpdateInvoiceProfilesParams) WithHTTPClient(client *http.Client) *UpdateInvoiceProfilesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update invoice profiles params +func (o *UpdateInvoiceProfilesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the update invoice profiles params +func (o *UpdateInvoiceProfilesParams) WithID(id int32) *UpdateInvoiceProfilesParams { + o.SetID(id) + return o +} + +// SetID adds the id to the update invoice profiles params +func (o *UpdateInvoiceProfilesParams) SetID(id int32) { + o.ID = id +} + +// WithInvoiceProfile adds the invoiceProfile to the update invoice profiles params +func (o *UpdateInvoiceProfilesParams) WithInvoiceProfile(invoiceProfile *models.InvoiceProfile) *UpdateInvoiceProfilesParams { + o.SetInvoiceProfile(invoiceProfile) + return o +} + +// SetInvoiceProfile adds the invoiceProfile to the update invoice profiles params +func (o *UpdateInvoiceProfilesParams) SetInvoiceProfile(invoiceProfile *models.InvoiceProfile) { + o.InvoiceProfile = invoiceProfile +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateInvoiceProfilesParams) 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", swag.FormatInt32(o.ID)); err != nil { + return err + } + + if o.InvoiceProfile != nil { + if err := r.SetBodyParam(o.InvoiceProfile); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/invoice_profiles/update_invoice_profiles_responses.go b/client/invoice_profiles/update_invoice_profiles_responses.go new file mode 100644 index 0000000..e10d2a2 --- /dev/null +++ b/client/invoice_profiles/update_invoice_profiles_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package invoice_profiles + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// UpdateInvoiceProfilesReader is a Reader for the UpdateInvoiceProfiles structure. +type UpdateInvoiceProfilesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateInvoiceProfilesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateInvoiceProfilesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewUpdateInvoiceProfilesOK creates a UpdateInvoiceProfilesOK with default headers values +func NewUpdateInvoiceProfilesOK() *UpdateInvoiceProfilesOK { + return &UpdateInvoiceProfilesOK{} +} + +/*UpdateInvoiceProfilesOK handles this case with default header values. + +Success +*/ +type UpdateInvoiceProfilesOK struct { + Payload *models.InvoiceProfile +} + +func (o *UpdateInvoiceProfilesOK) Error() string { + return fmt.Sprintf("[PUT /api/v1/InvoiceProfiles/{id}][%d] updateInvoiceProfilesOK %+v", 200, o.Payload) +} + +func (o *UpdateInvoiceProfilesOK) GetPayload() *models.InvoiceProfile { + return o.Payload +} + +func (o *UpdateInvoiceProfilesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InvoiceProfile) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/organization_access/organization_access_client.go b/client/organization_access/organization_access_client.go index a6b6671..67b3956 100644 --- a/client/organization_access/organization_access_client.go +++ b/client/organization_access/organization_access_client.go @@ -29,7 +29,7 @@ type Client struct { type ClientService interface { GetOrganizationAccess(params *GetOrganizationAccessParams, authInfo runtime.ClientAuthInfoWriter) (*GetOrganizationAccessOK, error) - PutOrganizationAccess(params *PutOrganizationAccessParams, authInfo runtime.ClientAuthInfoWriter) (*PutOrganizationAccessOK, error) + UpdateOrganizationAccess(params *UpdateOrganizationAccessParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateOrganizationAccessOK, error) SetTransport(transport runtime.ClientTransport) } @@ -70,23 +70,23 @@ func (a *Client) GetOrganizationAccess(params *GetOrganizationAccessParams, auth } /* - PutOrganizationAccess put organization access API + UpdateOrganizationAccess update organization access API */ -func (a *Client) PutOrganizationAccess(params *PutOrganizationAccessParams, authInfo runtime.ClientAuthInfoWriter) (*PutOrganizationAccessOK, error) { +func (a *Client) UpdateOrganizationAccess(params *UpdateOrganizationAccessParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateOrganizationAccessOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPutOrganizationAccessParams() + params = NewUpdateOrganizationAccessParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PutOrganizationAccess", + ID: "UpdateOrganizationAccess", Method: "PUT", PathPattern: "/api/v1/OrganizationAccess", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PutOrganizationAccessReader{formats: a.formats}, + Reader: &UpdateOrganizationAccessReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -94,13 +94,13 @@ func (a *Client) PutOrganizationAccess(params *PutOrganizationAccessParams, auth if err != nil { return nil, err } - success, ok := result.(*PutOrganizationAccessOK) + success, ok := result.(*UpdateOrganizationAccessOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PutOrganizationAccess: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for UpdateOrganizationAccess: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } diff --git a/client/organization_access/update_organization_access_parameters.go b/client/organization_access/update_organization_access_parameters.go new file mode 100644 index 0000000..4d94c6d --- /dev/null +++ b/client/organization_access/update_organization_access_parameters.go @@ -0,0 +1,135 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package organization_access + +// 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/bjerkio/crayon-api-go/models" +) + +// NewUpdateOrganizationAccessParams creates a new UpdateOrganizationAccessParams object +// with the default values initialized. +func NewUpdateOrganizationAccessParams() *UpdateOrganizationAccessParams { + var () + return &UpdateOrganizationAccessParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateOrganizationAccessParamsWithTimeout creates a new UpdateOrganizationAccessParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewUpdateOrganizationAccessParamsWithTimeout(timeout time.Duration) *UpdateOrganizationAccessParams { + var () + return &UpdateOrganizationAccessParams{ + + timeout: timeout, + } +} + +// NewUpdateOrganizationAccessParamsWithContext creates a new UpdateOrganizationAccessParams object +// with the default values initialized, and the ability to set a context for a request +func NewUpdateOrganizationAccessParamsWithContext(ctx context.Context) *UpdateOrganizationAccessParams { + var () + return &UpdateOrganizationAccessParams{ + + Context: ctx, + } +} + +// NewUpdateOrganizationAccessParamsWithHTTPClient creates a new UpdateOrganizationAccessParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewUpdateOrganizationAccessParamsWithHTTPClient(client *http.Client) *UpdateOrganizationAccessParams { + var () + return &UpdateOrganizationAccessParams{ + HTTPClient: client, + } +} + +/*UpdateOrganizationAccessParams contains all the parameters to send to the API endpoint +for the update organization access operation typically these are written to a http.Request +*/ +type UpdateOrganizationAccessParams struct { + + /*List*/ + List []*models.OrganizationAccess + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the update organization access params +func (o *UpdateOrganizationAccessParams) WithTimeout(timeout time.Duration) *UpdateOrganizationAccessParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update organization access params +func (o *UpdateOrganizationAccessParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update organization access params +func (o *UpdateOrganizationAccessParams) WithContext(ctx context.Context) *UpdateOrganizationAccessParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update organization access params +func (o *UpdateOrganizationAccessParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update organization access params +func (o *UpdateOrganizationAccessParams) WithHTTPClient(client *http.Client) *UpdateOrganizationAccessParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update organization access params +func (o *UpdateOrganizationAccessParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithList adds the list to the update organization access params +func (o *UpdateOrganizationAccessParams) WithList(list []*models.OrganizationAccess) *UpdateOrganizationAccessParams { + o.SetList(list) + return o +} + +// SetList adds the list to the update organization access params +func (o *UpdateOrganizationAccessParams) SetList(list []*models.OrganizationAccess) { + o.List = list +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateOrganizationAccessParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.List != nil { + if err := r.SetBodyParam(o.List); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/organization_access/update_organization_access_responses.go b/client/organization_access/update_organization_access_responses.go new file mode 100644 index 0000000..a85753b --- /dev/null +++ b/client/organization_access/update_organization_access_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package organization_access + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// UpdateOrganizationAccessReader is a Reader for the UpdateOrganizationAccess structure. +type UpdateOrganizationAccessReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateOrganizationAccessReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateOrganizationAccessOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewUpdateOrganizationAccessOK creates a UpdateOrganizationAccessOK with default headers values +func NewUpdateOrganizationAccessOK() *UpdateOrganizationAccessOK { + return &UpdateOrganizationAccessOK{} +} + +/*UpdateOrganizationAccessOK handles this case with default header values. + +Success +*/ +type UpdateOrganizationAccessOK struct { + Payload []*models.OrganizationAccess +} + +func (o *UpdateOrganizationAccessOK) Error() string { + return fmt.Sprintf("[PUT /api/v1/OrganizationAccess][%d] updateOrganizationAccessOK %+v", 200, o.Payload) +} + +func (o *UpdateOrganizationAccessOK) GetPayload() []*models.OrganizationAccess { + return o.Payload +} + +func (o *UpdateOrganizationAccessOK) 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 +} diff --git a/client/product_containers/product_containers_client.go b/client/product_containers/product_containers_client.go index dbf79df..0811ae1 100644 --- a/client/product_containers/product_containers_client.go +++ b/client/product_containers/product_containers_client.go @@ -39,7 +39,7 @@ type ClientService interface { PatchProductRow(params *PatchProductRowParams, authInfo runtime.ClientAuthInfoWriter) (*PatchProductRowOK, error) - PutProductContainers(params *PutProductContainersParams, authInfo runtime.ClientAuthInfoWriter) (*PutProductContainersOK, error) + UpdateProductContainers(params *UpdateProductContainersParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateProductContainersOK, error) SetTransport(transport runtime.ClientTransport) } @@ -255,23 +255,23 @@ func (a *Client) PatchProductRow(params *PatchProductRowParams, authInfo runtime } /* - PutProductContainers put product containers API + UpdateProductContainers update product containers API */ -func (a *Client) PutProductContainers(params *PutProductContainersParams, authInfo runtime.ClientAuthInfoWriter) (*PutProductContainersOK, error) { +func (a *Client) UpdateProductContainers(params *UpdateProductContainersParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateProductContainersOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPutProductContainersParams() + params = NewUpdateProductContainersParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PutProductContainers", + ID: "UpdateProductContainers", Method: "PUT", PathPattern: "/api/v1/ProductContainers/{id}", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PutProductContainersReader{formats: a.formats}, + Reader: &UpdateProductContainersReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -279,13 +279,13 @@ func (a *Client) PutProductContainers(params *PutProductContainersParams, authIn if err != nil { return nil, err } - success, ok := result.(*PutProductContainersOK) + success, ok := result.(*UpdateProductContainersOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PutProductContainers: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for UpdateProductContainers: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } diff --git a/client/product_containers/update_product_containers_parameters.go b/client/product_containers/update_product_containers_parameters.go new file mode 100644 index 0000000..086784a --- /dev/null +++ b/client/product_containers/update_product_containers_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package product_containers + +// 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" + + "github.com/bjerkio/crayon-api-go/models" +) + +// NewUpdateProductContainersParams creates a new UpdateProductContainersParams object +// with the default values initialized. +func NewUpdateProductContainersParams() *UpdateProductContainersParams { + var ( + requireEulaAnalysisDefault = bool(false) + ) + return &UpdateProductContainersParams{ + RequireEulaAnalysis: &requireEulaAnalysisDefault, + + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateProductContainersParamsWithTimeout creates a new UpdateProductContainersParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewUpdateProductContainersParamsWithTimeout(timeout time.Duration) *UpdateProductContainersParams { + var ( + requireEulaAnalysisDefault = bool(false) + ) + return &UpdateProductContainersParams{ + RequireEulaAnalysis: &requireEulaAnalysisDefault, + + timeout: timeout, + } +} + +// NewUpdateProductContainersParamsWithContext creates a new UpdateProductContainersParams object +// with the default values initialized, and the ability to set a context for a request +func NewUpdateProductContainersParamsWithContext(ctx context.Context) *UpdateProductContainersParams { + var ( + requireEulaAnalysisDefault = bool(false) + ) + return &UpdateProductContainersParams{ + RequireEulaAnalysis: &requireEulaAnalysisDefault, + + Context: ctx, + } +} + +// NewUpdateProductContainersParamsWithHTTPClient creates a new UpdateProductContainersParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewUpdateProductContainersParamsWithHTTPClient(client *http.Client) *UpdateProductContainersParams { + var ( + requireEulaAnalysisDefault = bool(false) + ) + return &UpdateProductContainersParams{ + RequireEulaAnalysis: &requireEulaAnalysisDefault, + HTTPClient: client, + } +} + +/*UpdateProductContainersParams contains all the parameters to send to the API endpoint +for the update product containers operation typically these are written to a http.Request +*/ +type UpdateProductContainersParams struct { + + /*ID*/ + ID int32 + /*ProductContainer*/ + ProductContainer *models.ProductContainer + /*RequireEulaAnalysis*/ + RequireEulaAnalysis *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the update product containers params +func (o *UpdateProductContainersParams) WithTimeout(timeout time.Duration) *UpdateProductContainersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update product containers params +func (o *UpdateProductContainersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update product containers params +func (o *UpdateProductContainersParams) WithContext(ctx context.Context) *UpdateProductContainersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update product containers params +func (o *UpdateProductContainersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update product containers params +func (o *UpdateProductContainersParams) WithHTTPClient(client *http.Client) *UpdateProductContainersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update product containers params +func (o *UpdateProductContainersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the update product containers params +func (o *UpdateProductContainersParams) WithID(id int32) *UpdateProductContainersParams { + o.SetID(id) + return o +} + +// SetID adds the id to the update product containers params +func (o *UpdateProductContainersParams) SetID(id int32) { + o.ID = id +} + +// WithProductContainer adds the productContainer to the update product containers params +func (o *UpdateProductContainersParams) WithProductContainer(productContainer *models.ProductContainer) *UpdateProductContainersParams { + o.SetProductContainer(productContainer) + return o +} + +// SetProductContainer adds the productContainer to the update product containers params +func (o *UpdateProductContainersParams) SetProductContainer(productContainer *models.ProductContainer) { + o.ProductContainer = productContainer +} + +// WithRequireEulaAnalysis adds the requireEulaAnalysis to the update product containers params +func (o *UpdateProductContainersParams) WithRequireEulaAnalysis(requireEulaAnalysis *bool) *UpdateProductContainersParams { + o.SetRequireEulaAnalysis(requireEulaAnalysis) + return o +} + +// SetRequireEulaAnalysis adds the requireEulaAnalysis to the update product containers params +func (o *UpdateProductContainersParams) SetRequireEulaAnalysis(requireEulaAnalysis *bool) { + o.RequireEulaAnalysis = requireEulaAnalysis +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateProductContainersParams) 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", swag.FormatInt32(o.ID)); err != nil { + return err + } + + if o.ProductContainer != nil { + if err := r.SetBodyParam(o.ProductContainer); err != nil { + return err + } + } + + if o.RequireEulaAnalysis != nil { + + // query param requireEulaAnalysis + var qrRequireEulaAnalysis bool + if o.RequireEulaAnalysis != nil { + qrRequireEulaAnalysis = *o.RequireEulaAnalysis + } + qRequireEulaAnalysis := swag.FormatBool(qrRequireEulaAnalysis) + if qRequireEulaAnalysis != "" { + if err := r.SetQueryParam("requireEulaAnalysis", qRequireEulaAnalysis); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/product_containers/update_product_containers_responses.go b/client/product_containers/update_product_containers_responses.go new file mode 100644 index 0000000..753a415 --- /dev/null +++ b/client/product_containers/update_product_containers_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package product_containers + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// UpdateProductContainersReader is a Reader for the UpdateProductContainers structure. +type UpdateProductContainersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateProductContainersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateProductContainersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewUpdateProductContainersOK creates a UpdateProductContainersOK with default headers values +func NewUpdateProductContainersOK() *UpdateProductContainersOK { + return &UpdateProductContainersOK{} +} + +/*UpdateProductContainersOK handles this case with default header values. + +Success +*/ +type UpdateProductContainersOK struct { + Payload *models.ProductContainer +} + +func (o *UpdateProductContainersOK) Error() string { + return fmt.Sprintf("[PUT /api/v1/ProductContainers/{id}][%d] updateProductContainersOK %+v", 200, o.Payload) +} + +func (o *UpdateProductContainersOK) GetPayload() *models.ProductContainer { + return o.Payload +} + +func (o *UpdateProductContainersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ProductContainer) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/secrets/create_secrets_parameters.go b/client/secrets/create_secrets_parameters.go new file mode 100644 index 0000000..b08387a --- /dev/null +++ b/client/secrets/create_secrets_parameters.go @@ -0,0 +1,135 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package secrets + +// 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/bjerkio/crayon-api-go/models" +) + +// NewCreateSecretsParams creates a new CreateSecretsParams object +// with the default values initialized. +func NewCreateSecretsParams() *CreateSecretsParams { + var () + return &CreateSecretsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCreateSecretsParamsWithTimeout creates a new CreateSecretsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCreateSecretsParamsWithTimeout(timeout time.Duration) *CreateSecretsParams { + var () + return &CreateSecretsParams{ + + timeout: timeout, + } +} + +// NewCreateSecretsParamsWithContext creates a new CreateSecretsParams object +// with the default values initialized, and the ability to set a context for a request +func NewCreateSecretsParamsWithContext(ctx context.Context) *CreateSecretsParams { + var () + return &CreateSecretsParams{ + + Context: ctx, + } +} + +// NewCreateSecretsParamsWithHTTPClient creates a new CreateSecretsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCreateSecretsParamsWithHTTPClient(client *http.Client) *CreateSecretsParams { + var () + return &CreateSecretsParams{ + HTTPClient: client, + } +} + +/*CreateSecretsParams contains all the parameters to send to the API endpoint +for the create secrets operation typically these are written to a http.Request +*/ +type CreateSecretsParams struct { + + /*Secret*/ + Secret *models.Secret + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the create secrets params +func (o *CreateSecretsParams) WithTimeout(timeout time.Duration) *CreateSecretsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create secrets params +func (o *CreateSecretsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create secrets params +func (o *CreateSecretsParams) WithContext(ctx context.Context) *CreateSecretsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create secrets params +func (o *CreateSecretsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create secrets params +func (o *CreateSecretsParams) WithHTTPClient(client *http.Client) *CreateSecretsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create secrets params +func (o *CreateSecretsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithSecret adds the secret to the create secrets params +func (o *CreateSecretsParams) WithSecret(secret *models.Secret) *CreateSecretsParams { + o.SetSecret(secret) + return o +} + +// SetSecret adds the secret to the create secrets params +func (o *CreateSecretsParams) SetSecret(secret *models.Secret) { + o.Secret = secret +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateSecretsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Secret != nil { + if err := r.SetBodyParam(o.Secret); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/secrets/create_secrets_responses.go b/client/secrets/create_secrets_responses.go new file mode 100644 index 0000000..a450205 --- /dev/null +++ b/client/secrets/create_secrets_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package secrets + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// CreateSecretsReader is a Reader for the CreateSecrets structure. +type CreateSecretsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateSecretsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateSecretsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewCreateSecretsOK creates a CreateSecretsOK with default headers values +func NewCreateSecretsOK() *CreateSecretsOK { + return &CreateSecretsOK{} +} + +/*CreateSecretsOK handles this case with default header values. + +Success +*/ +type CreateSecretsOK struct { + Payload *models.Secret +} + +func (o *CreateSecretsOK) Error() string { + return fmt.Sprintf("[POST /api/v1/Secrets][%d] createSecretsOK %+v", 200, o.Payload) +} + +func (o *CreateSecretsOK) GetPayload() *models.Secret { + return o.Payload +} + +func (o *CreateSecretsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Secret) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/secrets/secrets_client.go b/client/secrets/secrets_client.go index af35f0f..dac648b 100644 --- a/client/secrets/secrets_client.go +++ b/client/secrets/secrets_client.go @@ -27,31 +27,31 @@ type Client struct { // ClientService is the interface for Client methods type ClientService interface { - DeleteSecrets(params *DeleteSecretsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSecretsOK, error) + CreateSecrets(params *CreateSecretsParams, authInfo runtime.ClientAuthInfoWriter) (*CreateSecretsOK, error) - PostSecrets(params *PostSecretsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSecretsOK, error) + DeleteSecrets(params *DeleteSecretsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSecretsOK, error) SetTransport(transport runtime.ClientTransport) } /* - DeleteSecrets delete secrets API + CreateSecrets create secrets API */ -func (a *Client) DeleteSecrets(params *DeleteSecretsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSecretsOK, error) { +func (a *Client) CreateSecrets(params *CreateSecretsParams, authInfo runtime.ClientAuthInfoWriter) (*CreateSecretsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewDeleteSecretsParams() + params = NewCreateSecretsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "DeleteSecrets", - Method: "DELETE", + ID: "CreateSecrets", + Method: "POST", PathPattern: "/api/v1/Secrets", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, - ConsumesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, Schemes: []string{"http"}, Params: params, - Reader: &DeleteSecretsReader{formats: a.formats}, + Reader: &CreateSecretsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -59,34 +59,34 @@ func (a *Client) DeleteSecrets(params *DeleteSecretsParams, authInfo runtime.Cli if err != nil { return nil, err } - success, ok := result.(*DeleteSecretsOK) + success, ok := result.(*CreateSecretsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for DeleteSecrets: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for CreateSecrets: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } /* - PostSecrets post secrets API + DeleteSecrets delete secrets API */ -func (a *Client) PostSecrets(params *PostSecretsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSecretsOK, error) { +func (a *Client) DeleteSecrets(params *DeleteSecretsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSecretsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPostSecretsParams() + params = NewDeleteSecretsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PostSecrets", - Method: "POST", + ID: "DeleteSecrets", + Method: "DELETE", PathPattern: "/api/v1/Secrets", ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, - ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PostSecretsReader{formats: a.formats}, + Reader: &DeleteSecretsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -94,13 +94,13 @@ func (a *Client) PostSecrets(params *PostSecretsParams, authInfo runtime.ClientA if err != nil { return nil, err } - success, ok := result.(*PostSecretsOK) + success, ok := result.(*DeleteSecretsOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PostSecrets: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for DeleteSecrets: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } diff --git a/client/subscriptions/create_subscriptions_parameters.go b/client/subscriptions/create_subscriptions_parameters.go new file mode 100644 index 0000000..01ee1f0 --- /dev/null +++ b/client/subscriptions/create_subscriptions_parameters.go @@ -0,0 +1,135 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package subscriptions + +// 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/bjerkio/crayon-api-go/models" +) + +// NewCreateSubscriptionsParams creates a new CreateSubscriptionsParams object +// with the default values initialized. +func NewCreateSubscriptionsParams() *CreateSubscriptionsParams { + var () + return &CreateSubscriptionsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCreateSubscriptionsParamsWithTimeout creates a new CreateSubscriptionsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCreateSubscriptionsParamsWithTimeout(timeout time.Duration) *CreateSubscriptionsParams { + var () + return &CreateSubscriptionsParams{ + + timeout: timeout, + } +} + +// NewCreateSubscriptionsParamsWithContext creates a new CreateSubscriptionsParams object +// with the default values initialized, and the ability to set a context for a request +func NewCreateSubscriptionsParamsWithContext(ctx context.Context) *CreateSubscriptionsParams { + var () + return &CreateSubscriptionsParams{ + + Context: ctx, + } +} + +// NewCreateSubscriptionsParamsWithHTTPClient creates a new CreateSubscriptionsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCreateSubscriptionsParamsWithHTTPClient(client *http.Client) *CreateSubscriptionsParams { + var () + return &CreateSubscriptionsParams{ + HTTPClient: client, + } +} + +/*CreateSubscriptionsParams contains all the parameters to send to the API endpoint +for the create subscriptions operation typically these are written to a http.Request +*/ +type CreateSubscriptionsParams struct { + + /*Subscription*/ + Subscription *models.SubscriptionDetailed + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the create subscriptions params +func (o *CreateSubscriptionsParams) WithTimeout(timeout time.Duration) *CreateSubscriptionsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create subscriptions params +func (o *CreateSubscriptionsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create subscriptions params +func (o *CreateSubscriptionsParams) WithContext(ctx context.Context) *CreateSubscriptionsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create subscriptions params +func (o *CreateSubscriptionsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create subscriptions params +func (o *CreateSubscriptionsParams) WithHTTPClient(client *http.Client) *CreateSubscriptionsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create subscriptions params +func (o *CreateSubscriptionsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithSubscription adds the subscription to the create subscriptions params +func (o *CreateSubscriptionsParams) WithSubscription(subscription *models.SubscriptionDetailed) *CreateSubscriptionsParams { + o.SetSubscription(subscription) + return o +} + +// SetSubscription adds the subscription to the create subscriptions params +func (o *CreateSubscriptionsParams) SetSubscription(subscription *models.SubscriptionDetailed) { + o.Subscription = subscription +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateSubscriptionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Subscription != nil { + if err := r.SetBodyParam(o.Subscription); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/subscriptions/create_subscriptions_responses.go b/client/subscriptions/create_subscriptions_responses.go new file mode 100644 index 0000000..0e1de89 --- /dev/null +++ b/client/subscriptions/create_subscriptions_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package subscriptions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// CreateSubscriptionsReader is a Reader for the CreateSubscriptions structure. +type CreateSubscriptionsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateSubscriptionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateSubscriptionsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewCreateSubscriptionsOK creates a CreateSubscriptionsOK with default headers values +func NewCreateSubscriptionsOK() *CreateSubscriptionsOK { + return &CreateSubscriptionsOK{} +} + +/*CreateSubscriptionsOK handles this case with default header values. + +Success +*/ +type CreateSubscriptionsOK struct { + Payload *models.SubscriptionDetailed +} + +func (o *CreateSubscriptionsOK) Error() string { + return fmt.Sprintf("[POST /api/v1/Subscriptions][%d] createSubscriptionsOK %+v", 200, o.Payload) +} + +func (o *CreateSubscriptionsOK) GetPayload() *models.SubscriptionDetailed { + return o.Payload +} + +func (o *CreateSubscriptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SubscriptionDetailed) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/subscriptions/subscriptions_client.go b/client/subscriptions/subscriptions_client.go index 1a43fad..152c21a 100644 --- a/client/subscriptions/subscriptions_client.go +++ b/client/subscriptions/subscriptions_client.go @@ -27,6 +27,8 @@ type Client struct { // ClientService is the interface for Client methods type ClientService interface { + CreateSubscriptions(params *CreateSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*CreateSubscriptionsOK, error) + DeleteSubscriptionTags(params *DeleteSubscriptionTagsParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSubscriptionTagsOK, error) GetActivationLinkAsync(params *GetActivationLinkAsyncParams, authInfo runtime.ClientAuthInfoWriter) (*GetActivationLinkAsyncOK, error) @@ -45,10 +47,6 @@ type ClientService interface { PostSubscriptionConversion(params *PostSubscriptionConversionParams, authInfo runtime.ClientAuthInfoWriter) (*PostSubscriptionConversionOK, error) - PostSubscriptions(params *PostSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSubscriptionsOK, error) - - PutSubscriptions(params *PutSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*PutSubscriptionsOK, error) - RegisterReservedInstance(params *RegisterReservedInstanceParams, authInfo runtime.ClientAuthInfoWriter) (*RegisterReservedInstanceOK, error) SetSubscriptionAddon(params *SetSubscriptionAddonParams, authInfo runtime.ClientAuthInfoWriter) (*SetSubscriptionAddonOK, error) @@ -57,9 +55,46 @@ type ClientService interface { Subscription(params *SubscriptionParams, authInfo runtime.ClientAuthInfoWriter) (*SubscriptionOK, error) + UpdateSubscriptions(params *UpdateSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateSubscriptionsOK, error) + SetTransport(transport runtime.ClientTransport) } +/* + CreateSubscriptions create subscriptions API +*/ +func (a *Client) CreateSubscriptions(params *CreateSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*CreateSubscriptionsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateSubscriptionsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "CreateSubscriptions", + Method: "POST", + PathPattern: "/api/v1/Subscriptions", + ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, + ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &CreateSubscriptionsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*CreateSubscriptionsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for CreateSubscriptions: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* DeleteSubscriptionTags delete subscription tags API */ @@ -375,76 +410,6 @@ func (a *Client) PostSubscriptionConversion(params *PostSubscriptionConversionPa panic(msg) } -/* - PostSubscriptions post subscriptions API -*/ -func (a *Client) PostSubscriptions(params *PostSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*PostSubscriptionsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPostSubscriptionsParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PostSubscriptions", - Method: "POST", - PathPattern: "/api/v1/Subscriptions", - ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, - ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PostSubscriptionsReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - success, ok := result.(*PostSubscriptionsOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PostSubscriptions: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - -/* - PutSubscriptions put subscriptions API -*/ -func (a *Client) PutSubscriptions(params *PutSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*PutSubscriptionsOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewPutSubscriptionsParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "PutSubscriptions", - Method: "PUT", - PathPattern: "/api/v1/Subscriptions/{id}", - ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, - ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &PutSubscriptionsReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - success, ok := result.(*PutSubscriptionsOK) - if ok { - return success, nil - } - // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for PutSubscriptions: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - /* RegisterReservedInstance register reserved instance API */ @@ -585,6 +550,41 @@ func (a *Client) Subscription(params *SubscriptionParams, authInfo runtime.Clien panic(msg) } +/* + UpdateSubscriptions update subscriptions API +*/ +func (a *Client) UpdateSubscriptions(params *UpdateSubscriptionsParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateSubscriptionsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateSubscriptionsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "UpdateSubscriptions", + Method: "PUT", + PathPattern: "/api/v1/Subscriptions/{id}", + ProducesMediaTypes: []string{"application/json", "text/json", "text/plain"}, + ConsumesMediaTypes: []string{"application/*+json", "application/json", "application/json-patch+json", "text/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &UpdateSubscriptionsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*UpdateSubscriptionsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for UpdateSubscriptions: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + // SetTransport changes the transport on the client func (a *Client) SetTransport(transport runtime.ClientTransport) { a.transport = transport diff --git a/client/subscriptions/update_subscriptions_parameters.go b/client/subscriptions/update_subscriptions_parameters.go new file mode 100644 index 0000000..202e636 --- /dev/null +++ b/client/subscriptions/update_subscriptions_parameters.go @@ -0,0 +1,154 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package subscriptions + +// 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" + + "github.com/bjerkio/crayon-api-go/models" +) + +// NewUpdateSubscriptionsParams creates a new UpdateSubscriptionsParams object +// with the default values initialized. +func NewUpdateSubscriptionsParams() *UpdateSubscriptionsParams { + var () + return &UpdateSubscriptionsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateSubscriptionsParamsWithTimeout creates a new UpdateSubscriptionsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewUpdateSubscriptionsParamsWithTimeout(timeout time.Duration) *UpdateSubscriptionsParams { + var () + return &UpdateSubscriptionsParams{ + + timeout: timeout, + } +} + +// NewUpdateSubscriptionsParamsWithContext creates a new UpdateSubscriptionsParams object +// with the default values initialized, and the ability to set a context for a request +func NewUpdateSubscriptionsParamsWithContext(ctx context.Context) *UpdateSubscriptionsParams { + var () + return &UpdateSubscriptionsParams{ + + Context: ctx, + } +} + +// NewUpdateSubscriptionsParamsWithHTTPClient creates a new UpdateSubscriptionsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewUpdateSubscriptionsParamsWithHTTPClient(client *http.Client) *UpdateSubscriptionsParams { + var () + return &UpdateSubscriptionsParams{ + HTTPClient: client, + } +} + +/*UpdateSubscriptionsParams contains all the parameters to send to the API endpoint +for the update subscriptions operation typically these are written to a http.Request +*/ +type UpdateSubscriptionsParams struct { + + /*ID*/ + ID int32 + /*Subscription*/ + Subscription *models.SubscriptionDetailed + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the update subscriptions params +func (o *UpdateSubscriptionsParams) WithTimeout(timeout time.Duration) *UpdateSubscriptionsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update subscriptions params +func (o *UpdateSubscriptionsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update subscriptions params +func (o *UpdateSubscriptionsParams) WithContext(ctx context.Context) *UpdateSubscriptionsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update subscriptions params +func (o *UpdateSubscriptionsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update subscriptions params +func (o *UpdateSubscriptionsParams) WithHTTPClient(client *http.Client) *UpdateSubscriptionsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update subscriptions params +func (o *UpdateSubscriptionsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the update subscriptions params +func (o *UpdateSubscriptionsParams) WithID(id int32) *UpdateSubscriptionsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the update subscriptions params +func (o *UpdateSubscriptionsParams) SetID(id int32) { + o.ID = id +} + +// WithSubscription adds the subscription to the update subscriptions params +func (o *UpdateSubscriptionsParams) WithSubscription(subscription *models.SubscriptionDetailed) *UpdateSubscriptionsParams { + o.SetSubscription(subscription) + return o +} + +// SetSubscription adds the subscription to the update subscriptions params +func (o *UpdateSubscriptionsParams) SetSubscription(subscription *models.SubscriptionDetailed) { + o.Subscription = subscription +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateSubscriptionsParams) 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", swag.FormatInt32(o.ID)); err != nil { + return err + } + + if o.Subscription != nil { + if err := r.SetBodyParam(o.Subscription); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/subscriptions/update_subscriptions_responses.go b/client/subscriptions/update_subscriptions_responses.go new file mode 100644 index 0000000..26f296f --- /dev/null +++ b/client/subscriptions/update_subscriptions_responses.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package subscriptions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/bjerkio/crayon-api-go/models" +) + +// UpdateSubscriptionsReader is a Reader for the UpdateSubscriptions structure. +type UpdateSubscriptionsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateSubscriptionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateSubscriptionsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewUpdateSubscriptionsOK creates a UpdateSubscriptionsOK with default headers values +func NewUpdateSubscriptionsOK() *UpdateSubscriptionsOK { + return &UpdateSubscriptionsOK{} +} + +/*UpdateSubscriptionsOK handles this case with default header values. + +Success +*/ +type UpdateSubscriptionsOK struct { + Payload *models.SubscriptionDetailed +} + +func (o *UpdateSubscriptionsOK) Error() string { + return fmt.Sprintf("[PUT /api/v1/Subscriptions/{id}][%d] updateSubscriptionsOK %+v", 200, o.Payload) +} + +func (o *UpdateSubscriptionsOK) GetPayload() *models.SubscriptionDetailed { + return o.Payload +} + +func (o *UpdateSubscriptionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SubscriptionDetailed) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/cmd/convert-swagger/main.go b/internal/cmd/convert-swagger/main.go index a0399af..adcc096 100644 --- a/internal/cmd/convert-swagger/main.go +++ b/internal/cmd/convert-swagger/main.go @@ -12,11 +12,28 @@ import ( "github.com/go-openapi/spec" ) +func replaceMethodName(from string) string { + methods := map[string]string{ + "post": "Create", + "put": "Update", + "patch": "Update", + "get": "Get", + "delete": "Delete", + } + + if methods[from] != "" { + return methods[from] + } + + return from +} + func fixMethod(path string, op *spec.Operation) { if op != nil { r := regexp.MustCompile(`(delete|get|head|options|patch|post|put)\b`) - if r.MatchString(strings.ToLower(op.ID)) { - op.ID = fmt.Sprintf("%s%s", op.ID, op.Tags[0]) + id := strings.ToLower(op.ID) + if r.MatchString(id) { + op.ID = fmt.Sprintf("%s%s", replaceMethodName(id), op.Tags[0]) } } } @@ -37,6 +54,39 @@ func main() { panic(err) } + parameters := []spec.Parameter{ + { + ParamProps: spec.ParamProps{ + Name: "username", + In: "body", + Required: true, + }, + }, + { + ParamProps: spec.ParamProps{ + Name: "password", + In: "body", + Required: true, + }, + }, + { + ParamProps: spec.ParamProps{ + Name: "grant_type", + In: "body", + Required: true, + }, + }, + { + ParamProps: spec.ParamProps{ + Name: "scope", + In: "body", + Required: true, + }, + }, + } + + api.Paths.Paths["/api/v1/connect/token"].Post.Parameters = parameters + for i, h := range api.Paths.Paths { fixMethod(i, h.Delete) fixMethod(i, h.Get) diff --git a/swagger.json b/swagger.json index f616593..422d4b1 100644 --- a/swagger.json +++ b/swagger.json @@ -1365,7 +1365,7 @@ "tags": [ "AwsAccounts" ], - "operationId": "PutAwsAccounts", + "operationId": "UpdateAwsAccounts", "parameters": [ { "type": "integer", @@ -2145,7 +2145,7 @@ "tags": [ "Clients" ], - "operationId": "PostClients", + "operationId": "CreateClients", "parameters": [ { "name": "client", @@ -2208,7 +2208,7 @@ "tags": [ "Clients" ], - "operationId": "PutClients", + "operationId": "UpdateClients", "parameters": [ { "type": "string", @@ -2522,7 +2522,7 @@ "tags": [ "CrayonAccounts" ], - "operationId": "PostCrayonAccounts", + "operationId": "CreateCrayonAccounts", "parameters": [ { "name": "crayonAccount", @@ -2586,7 +2586,7 @@ "tags": [ "CrayonAccounts" ], - "operationId": "PutCrayonAccounts", + "operationId": "UpdateCrayonAccounts", "parameters": [ { "type": "integer", @@ -2717,7 +2717,7 @@ "tags": [ "CustomerTenants" ], - "operationId": "PostCustomerTenants", + "operationId": "CreateCustomerTenants", "parameters": [ { "name": "customerTenant", @@ -2853,7 +2853,7 @@ "tags": [ "CustomerTenants" ], - "operationId": "PutCustomerTenants", + "operationId": "UpdateCustomerTenants", "parameters": [ { "type": "integer", @@ -3051,7 +3051,7 @@ "tags": [ "Groupings" ], - "operationId": "PostGroupings", + "operationId": "CreateGroupings", "parameters": [ { "name": "grouping", @@ -3115,7 +3115,7 @@ "tags": [ "Groupings" ], - "operationId": "PutGroupings", + "operationId": "UpdateGroupings", "parameters": [ { "type": "integer", @@ -3222,7 +3222,7 @@ "tags": [ "InvoiceProfiles" ], - "operationId": "PostInvoiceProfiles", + "operationId": "CreateInvoiceProfiles", "parameters": [ { "name": "invoiceProfile", @@ -3286,7 +3286,7 @@ "tags": [ "InvoiceProfiles" ], - "operationId": "PutInvoiceProfiles", + "operationId": "UpdateInvoiceProfiles", "parameters": [ { "type": "integer", @@ -3535,7 +3535,7 @@ "tags": [ "OrganizationAccess" ], - "operationId": "PutOrganizationAccess", + "operationId": "UpdateOrganizationAccess", "parameters": [ { "name": "list", @@ -4032,7 +4032,7 @@ "tags": [ "ProductContainers" ], - "operationId": "PutProductContainers", + "operationId": "UpdateProductContainers", "parameters": [ { "type": "integer", @@ -4705,7 +4705,7 @@ "tags": [ "Secrets" ], - "operationId": "PostSecrets", + "operationId": "CreateSecrets", "parameters": [ { "name": "secret", @@ -4859,7 +4859,7 @@ "tags": [ "Subscriptions" ], - "operationId": "PostSubscriptions", + "operationId": "CreateSubscriptions", "parameters": [ { "name": "subscription", @@ -4944,7 +4944,7 @@ "tags": [ "Subscriptions" ], - "operationId": "PutSubscriptions", + "operationId": "UpdateSubscriptions", "parameters": [ { "type": "integer", @@ -6092,7 +6092,29 @@ "tags": [ "CustomerToken" ], - "operationId": "PostCustomerToken", + "operationId": "CreateCustomerToken", + "parameters": [ + { + "name": "username", + "in": "body", + "required": true + }, + { + "name": "password", + "in": "body", + "required": true + }, + { + "name": "grant_type", + "in": "body", + "required": true + }, + { + "name": "scope", + "in": "body", + "required": true + } + ], "responses": { "200": { "description": "Success",