commit f44e2acbaf2c8d8901c62d5d8112c5f675822b8e Author: decentral1se Date: Sat Jan 14 15:14:06 2023 +0100 feat: init diff --git a/.envrc.example b/.envrc.example new file mode 100644 index 0000000..1c56b68 --- /dev/null +++ b/.envrc.example @@ -0,0 +1,3 @@ +export GO_KIMAI_USER=... +export GO_KIMAI_TOKEN=... +export GO_KIMAI_DOMAIN=... diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..799ec83 --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +go-kimai: Go Kimai client, generated with go-swagger +Copyright (C) 2023 decentral1se + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . diff --git a/README.md b/README.md new file mode 100644 index 0000000..fd1436b --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# `go-kimai` + +> **EXPERIMENTAL** + +Go Kimai client, generated with [`go-swagger`](https://github.com/go-swagger/go-swagger) 🐢 + +## Usage + +See [`example.go`](./example.go), also [`.envrc.sample`](./.envrc.example). + +## Generate + +`swagger generate client --skip-validation -f doc.json -A go-kimai` + +## Known issues + +- [`kimai#3720`](https://github.com/kimai/kimai/issues/3720) + +## License + + diff --git a/client/activity/activity_client.go b/client/activity/activity_client.go new file mode 100644 index 0000000..ff4ade9 --- /dev/null +++ b/client/activity/activity_client.go @@ -0,0 +1,371 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new activity API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for activity API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPIActivitiesIDRatesRateID(params *DeleteAPIActivitiesIDRatesRateIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIActivitiesIDRatesRateIDNoContent, error) + + GetAPIActivities(params *GetAPIActivitiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIActivitiesOK, error) + + GetAPIActivitiesID(params *GetAPIActivitiesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIActivitiesIDOK, error) + + GetAPIActivitiesIDRates(params *GetAPIActivitiesIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIActivitiesIDRatesOK, error) + + PatchAPIActivitiesID(params *PatchAPIActivitiesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIActivitiesIDOK, error) + + PatchAPIActivitiesIDMeta(params *PatchAPIActivitiesIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIActivitiesIDMetaOK, error) + + PostAPIActivities(params *PostAPIActivitiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIActivitiesOK, error) + + PostAPIActivitiesIDRates(params *PostAPIActivitiesIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIActivitiesIDRatesOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPIActivitiesIDRatesRateID deletes one rate for an activity +*/ +func (a *Client) DeleteAPIActivitiesIDRatesRateID(params *DeleteAPIActivitiesIDRatesRateIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIActivitiesIDRatesRateIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPIActivitiesIDRatesRateIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPIActivitiesIDRatesRateID", + Method: "DELETE", + PathPattern: "/api/activities/{id}/rates/{rateId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPIActivitiesIDRatesRateIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPIActivitiesIDRatesRateIDNoContent) + 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 DeleteAPIActivitiesIDRatesRateID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIActivities returns a collection of activities +*/ +func (a *Client) GetAPIActivities(params *GetAPIActivitiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIActivitiesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIActivitiesParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIActivities", + Method: "GET", + PathPattern: "/api/activities", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIActivitiesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIActivitiesOK) + 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 GetAPIActivities: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIActivitiesID returns one activity +*/ +func (a *Client) GetAPIActivitiesID(params *GetAPIActivitiesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIActivitiesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIActivitiesIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIActivitiesID", + Method: "GET", + PathPattern: "/api/activities/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIActivitiesIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIActivitiesIDOK) + 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 GetAPIActivitiesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIActivitiesIDRates returns a collection of all rates for one activity +*/ +func (a *Client) GetAPIActivitiesIDRates(params *GetAPIActivitiesIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIActivitiesIDRatesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIActivitiesIDRatesParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIActivitiesIDRates", + Method: "GET", + PathPattern: "/api/activities/{id}/rates", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIActivitiesIDRatesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIActivitiesIDRatesOK) + 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 GetAPIActivitiesIDRates: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIActivitiesID updates an existing activity + +Update an existing activity, you can pass all or just a subset of all attributes +*/ +func (a *Client) PatchAPIActivitiesID(params *PatchAPIActivitiesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIActivitiesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIActivitiesIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIActivitiesID", + Method: "PATCH", + PathPattern: "/api/activities/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIActivitiesIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIActivitiesIDOK) + 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 PatchAPIActivitiesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIActivitiesIDMeta sets the value of a meta field for an existing activity +*/ +func (a *Client) PatchAPIActivitiesIDMeta(params *PatchAPIActivitiesIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIActivitiesIDMetaOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIActivitiesIDMetaParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIActivitiesIDMeta", + Method: "PATCH", + PathPattern: "/api/activities/{id}/meta", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIActivitiesIDMetaReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIActivitiesIDMetaOK) + 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 PatchAPIActivitiesIDMeta: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIActivities creates a new activity + +Creates a new activity and returns it afterwards +*/ +func (a *Client) PostAPIActivities(params *PostAPIActivitiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIActivitiesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIActivitiesParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIActivities", + Method: "POST", + PathPattern: "/api/activities", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIActivitiesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIActivitiesOK) + 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 PostAPIActivities: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIActivitiesIDRates adds a new rate to an activity +*/ +func (a *Client) PostAPIActivitiesIDRates(params *PostAPIActivitiesIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIActivitiesIDRatesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIActivitiesIDRatesParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIActivitiesIDRates", + Method: "POST", + PathPattern: "/api/activities/{id}/rates", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIActivitiesIDRatesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIActivitiesIDRatesOK) + 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 PostAPIActivitiesIDRates: 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/activity/delete_api_activities_id_rates_rate_id_parameters.go b/client/activity/delete_api_activities_id_rates_rate_id_parameters.go new file mode 100644 index 0000000..463bf5a --- /dev/null +++ b/client/activity/delete_api_activities_id_rates_rate_id_parameters.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" +) + +// NewDeleteAPIActivitiesIDRatesRateIDParams creates a new DeleteAPIActivitiesIDRatesRateIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPIActivitiesIDRatesRateIDParams() *DeleteAPIActivitiesIDRatesRateIDParams { + return &DeleteAPIActivitiesIDRatesRateIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPIActivitiesIDRatesRateIDParamsWithTimeout creates a new DeleteAPIActivitiesIDRatesRateIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPIActivitiesIDRatesRateIDParamsWithTimeout(timeout time.Duration) *DeleteAPIActivitiesIDRatesRateIDParams { + return &DeleteAPIActivitiesIDRatesRateIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPIActivitiesIDRatesRateIDParamsWithContext creates a new DeleteAPIActivitiesIDRatesRateIDParams object +// with the ability to set a context for a request. +func NewDeleteAPIActivitiesIDRatesRateIDParamsWithContext(ctx context.Context) *DeleteAPIActivitiesIDRatesRateIDParams { + return &DeleteAPIActivitiesIDRatesRateIDParams{ + Context: ctx, + } +} + +// NewDeleteAPIActivitiesIDRatesRateIDParamsWithHTTPClient creates a new DeleteAPIActivitiesIDRatesRateIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPIActivitiesIDRatesRateIDParamsWithHTTPClient(client *http.Client) *DeleteAPIActivitiesIDRatesRateIDParams { + return &DeleteAPIActivitiesIDRatesRateIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPIActivitiesIDRatesRateIDParams contains all the parameters to send to the API endpoint + + for the delete API activities ID rates rate ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPIActivitiesIDRatesRateIDParams struct { + + /* ID. + + The activity whose rate will be removed + */ + ID int64 + + /* RateID. + + The rate to remove + */ + RateID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API activities ID rates rate ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIActivitiesIDRatesRateIDParams) WithDefaults() *DeleteAPIActivitiesIDRatesRateIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API activities ID rates rate ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIActivitiesIDRatesRateIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API activities ID rates rate ID params +func (o *DeleteAPIActivitiesIDRatesRateIDParams) WithTimeout(timeout time.Duration) *DeleteAPIActivitiesIDRatesRateIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API activities ID rates rate ID params +func (o *DeleteAPIActivitiesIDRatesRateIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API activities ID rates rate ID params +func (o *DeleteAPIActivitiesIDRatesRateIDParams) WithContext(ctx context.Context) *DeleteAPIActivitiesIDRatesRateIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API activities ID rates rate ID params +func (o *DeleteAPIActivitiesIDRatesRateIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API activities ID rates rate ID params +func (o *DeleteAPIActivitiesIDRatesRateIDParams) WithHTTPClient(client *http.Client) *DeleteAPIActivitiesIDRatesRateIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API activities ID rates rate ID params +func (o *DeleteAPIActivitiesIDRatesRateIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete API activities ID rates rate ID params +func (o *DeleteAPIActivitiesIDRatesRateIDParams) WithID(id int64) *DeleteAPIActivitiesIDRatesRateIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API activities ID rates rate ID params +func (o *DeleteAPIActivitiesIDRatesRateIDParams) SetID(id int64) { + o.ID = id +} + +// WithRateID adds the rateID to the delete API activities ID rates rate ID params +func (o *DeleteAPIActivitiesIDRatesRateIDParams) WithRateID(rateID int64) *DeleteAPIActivitiesIDRatesRateIDParams { + o.SetRateID(rateID) + return o +} + +// SetRateID adds the rateId to the delete API activities ID rates rate ID params +func (o *DeleteAPIActivitiesIDRatesRateIDParams) SetRateID(rateID int64) { + o.RateID = rateID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPIActivitiesIDRatesRateIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + // path param rateId + if err := r.SetPathParam("rateId", swag.FormatInt64(o.RateID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/activity/delete_api_activities_id_rates_rate_id_responses.go b/client/activity/delete_api_activities_id_rates_rate_id_responses.go new file mode 100644 index 0000000..bfbed50 --- /dev/null +++ b/client/activity/delete_api_activities_id_rates_rate_id_responses.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// DeleteAPIActivitiesIDRatesRateIDReader is a Reader for the DeleteAPIActivitiesIDRatesRateID structure. +type DeleteAPIActivitiesIDRatesRateIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPIActivitiesIDRatesRateIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 204: + result := NewDeleteAPIActivitiesIDRatesRateIDNoContent() + 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()) + } +} + +// NewDeleteAPIActivitiesIDRatesRateIDNoContent creates a DeleteAPIActivitiesIDRatesRateIDNoContent with default headers values +func NewDeleteAPIActivitiesIDRatesRateIDNoContent() *DeleteAPIActivitiesIDRatesRateIDNoContent { + return &DeleteAPIActivitiesIDRatesRateIDNoContent{} +} + +/* +DeleteAPIActivitiesIDRatesRateIDNoContent describes a response with status code 204, with default header values. + +Returns no content: 204 on successful delete +*/ +type DeleteAPIActivitiesIDRatesRateIDNoContent struct { +} + +// IsSuccess returns true when this delete Api activities Id rates rate Id no content response has a 2xx status code +func (o *DeleteAPIActivitiesIDRatesRateIDNoContent) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api activities Id rates rate Id no content response has a 3xx status code +func (o *DeleteAPIActivitiesIDRatesRateIDNoContent) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api activities Id rates rate Id no content response has a 4xx status code +func (o *DeleteAPIActivitiesIDRatesRateIDNoContent) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api activities Id rates rate Id no content response has a 5xx status code +func (o *DeleteAPIActivitiesIDRatesRateIDNoContent) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api activities Id rates rate Id no content response a status code equal to that given +func (o *DeleteAPIActivitiesIDRatesRateIDNoContent) IsCode(code int) bool { + return code == 204 +} + +func (o *DeleteAPIActivitiesIDRatesRateIDNoContent) Error() string { + return fmt.Sprintf("[DELETE /api/activities/{id}/rates/{rateId}][%d] deleteApiActivitiesIdRatesRateIdNoContent ", 204) +} + +func (o *DeleteAPIActivitiesIDRatesRateIDNoContent) String() string { + return fmt.Sprintf("[DELETE /api/activities/{id}/rates/{rateId}][%d] deleteApiActivitiesIdRatesRateIdNoContent ", 204) +} + +func (o *DeleteAPIActivitiesIDRatesRateIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/activity/get_api_activities_id_parameters.go b/client/activity/get_api_activities_id_parameters.go new file mode 100644 index 0000000..760baaf --- /dev/null +++ b/client/activity/get_api_activities_id_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" +) + +// NewGetAPIActivitiesIDParams creates a new GetAPIActivitiesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIActivitiesIDParams() *GetAPIActivitiesIDParams { + return &GetAPIActivitiesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIActivitiesIDParamsWithTimeout creates a new GetAPIActivitiesIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIActivitiesIDParamsWithTimeout(timeout time.Duration) *GetAPIActivitiesIDParams { + return &GetAPIActivitiesIDParams{ + timeout: timeout, + } +} + +// NewGetAPIActivitiesIDParamsWithContext creates a new GetAPIActivitiesIDParams object +// with the ability to set a context for a request. +func NewGetAPIActivitiesIDParamsWithContext(ctx context.Context) *GetAPIActivitiesIDParams { + return &GetAPIActivitiesIDParams{ + Context: ctx, + } +} + +// NewGetAPIActivitiesIDParamsWithHTTPClient creates a new GetAPIActivitiesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIActivitiesIDParamsWithHTTPClient(client *http.Client) *GetAPIActivitiesIDParams { + return &GetAPIActivitiesIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIActivitiesIDParams contains all the parameters to send to the API endpoint + + for the get API activities ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIActivitiesIDParams struct { + + /* ID. + + Activity ID to fetch + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API activities ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIActivitiesIDParams) WithDefaults() *GetAPIActivitiesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API activities ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIActivitiesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API activities ID params +func (o *GetAPIActivitiesIDParams) WithTimeout(timeout time.Duration) *GetAPIActivitiesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API activities ID params +func (o *GetAPIActivitiesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API activities ID params +func (o *GetAPIActivitiesIDParams) WithContext(ctx context.Context) *GetAPIActivitiesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API activities ID params +func (o *GetAPIActivitiesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API activities ID params +func (o *GetAPIActivitiesIDParams) WithHTTPClient(client *http.Client) *GetAPIActivitiesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API activities ID params +func (o *GetAPIActivitiesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get API activities ID params +func (o *GetAPIActivitiesIDParams) WithID(id int64) *GetAPIActivitiesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API activities ID params +func (o *GetAPIActivitiesIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIActivitiesIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/activity/get_api_activities_id_rates_parameters.go b/client/activity/get_api_activities_id_rates_parameters.go new file mode 100644 index 0000000..73995c7 --- /dev/null +++ b/client/activity/get_api_activities_id_rates_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" +) + +// NewGetAPIActivitiesIDRatesParams creates a new GetAPIActivitiesIDRatesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIActivitiesIDRatesParams() *GetAPIActivitiesIDRatesParams { + return &GetAPIActivitiesIDRatesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIActivitiesIDRatesParamsWithTimeout creates a new GetAPIActivitiesIDRatesParams object +// with the ability to set a timeout on a request. +func NewGetAPIActivitiesIDRatesParamsWithTimeout(timeout time.Duration) *GetAPIActivitiesIDRatesParams { + return &GetAPIActivitiesIDRatesParams{ + timeout: timeout, + } +} + +// NewGetAPIActivitiesIDRatesParamsWithContext creates a new GetAPIActivitiesIDRatesParams object +// with the ability to set a context for a request. +func NewGetAPIActivitiesIDRatesParamsWithContext(ctx context.Context) *GetAPIActivitiesIDRatesParams { + return &GetAPIActivitiesIDRatesParams{ + Context: ctx, + } +} + +// NewGetAPIActivitiesIDRatesParamsWithHTTPClient creates a new GetAPIActivitiesIDRatesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIActivitiesIDRatesParamsWithHTTPClient(client *http.Client) *GetAPIActivitiesIDRatesParams { + return &GetAPIActivitiesIDRatesParams{ + HTTPClient: client, + } +} + +/* +GetAPIActivitiesIDRatesParams contains all the parameters to send to the API endpoint + + for the get API activities ID rates operation. + + Typically these are written to a http.Request. +*/ +type GetAPIActivitiesIDRatesParams struct { + + /* ID. + + The activity whose rates will be returned + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API activities ID rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIActivitiesIDRatesParams) WithDefaults() *GetAPIActivitiesIDRatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API activities ID rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIActivitiesIDRatesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API activities ID rates params +func (o *GetAPIActivitiesIDRatesParams) WithTimeout(timeout time.Duration) *GetAPIActivitiesIDRatesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API activities ID rates params +func (o *GetAPIActivitiesIDRatesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API activities ID rates params +func (o *GetAPIActivitiesIDRatesParams) WithContext(ctx context.Context) *GetAPIActivitiesIDRatesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API activities ID rates params +func (o *GetAPIActivitiesIDRatesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API activities ID rates params +func (o *GetAPIActivitiesIDRatesParams) WithHTTPClient(client *http.Client) *GetAPIActivitiesIDRatesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API activities ID rates params +func (o *GetAPIActivitiesIDRatesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get API activities ID rates params +func (o *GetAPIActivitiesIDRatesParams) WithID(id int64) *GetAPIActivitiesIDRatesParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API activities ID rates params +func (o *GetAPIActivitiesIDRatesParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIActivitiesIDRatesParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/activity/get_api_activities_id_rates_responses.go b/client/activity/get_api_activities_id_rates_responses.go new file mode 100644 index 0000000..7c02ff9 --- /dev/null +++ b/client/activity/get_api_activities_id_rates_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIActivitiesIDRatesReader is a Reader for the GetAPIActivitiesIDRates structure. +type GetAPIActivitiesIDRatesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIActivitiesIDRatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIActivitiesIDRatesOK() + 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()) + } +} + +// NewGetAPIActivitiesIDRatesOK creates a GetAPIActivitiesIDRatesOK with default headers values +func NewGetAPIActivitiesIDRatesOK() *GetAPIActivitiesIDRatesOK { + return &GetAPIActivitiesIDRatesOK{} +} + +/* +GetAPIActivitiesIDRatesOK describes a response with status code 200, with default header values. + +Returns a collection of activity rate entities +*/ +type GetAPIActivitiesIDRatesOK struct { + Payload []*models.ActivityRate +} + +// IsSuccess returns true when this get Api activities Id rates o k response has a 2xx status code +func (o *GetAPIActivitiesIDRatesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api activities Id rates o k response has a 3xx status code +func (o *GetAPIActivitiesIDRatesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api activities Id rates o k response has a 4xx status code +func (o *GetAPIActivitiesIDRatesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api activities Id rates o k response has a 5xx status code +func (o *GetAPIActivitiesIDRatesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api activities Id rates o k response a status code equal to that given +func (o *GetAPIActivitiesIDRatesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIActivitiesIDRatesOK) Error() string { + return fmt.Sprintf("[GET /api/activities/{id}/rates][%d] getApiActivitiesIdRatesOK %+v", 200, o.Payload) +} + +func (o *GetAPIActivitiesIDRatesOK) String() string { + return fmt.Sprintf("[GET /api/activities/{id}/rates][%d] getApiActivitiesIdRatesOK %+v", 200, o.Payload) +} + +func (o *GetAPIActivitiesIDRatesOK) GetPayload() []*models.ActivityRate { + return o.Payload +} + +func (o *GetAPIActivitiesIDRatesOK) 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/activity/get_api_activities_id_responses.go b/client/activity/get_api_activities_id_responses.go new file mode 100644 index 0000000..46d6015 --- /dev/null +++ b/client/activity/get_api_activities_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIActivitiesIDReader is a Reader for the GetAPIActivitiesID structure. +type GetAPIActivitiesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIActivitiesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIActivitiesIDOK() + 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()) + } +} + +// NewGetAPIActivitiesIDOK creates a GetAPIActivitiesIDOK with default headers values +func NewGetAPIActivitiesIDOK() *GetAPIActivitiesIDOK { + return &GetAPIActivitiesIDOK{} +} + +/* +GetAPIActivitiesIDOK describes a response with status code 200, with default header values. + +Returns one activity entity +*/ +type GetAPIActivitiesIDOK struct { + Payload *models.ActivityEntity +} + +// IsSuccess returns true when this get Api activities Id o k response has a 2xx status code +func (o *GetAPIActivitiesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api activities Id o k response has a 3xx status code +func (o *GetAPIActivitiesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api activities Id o k response has a 4xx status code +func (o *GetAPIActivitiesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api activities Id o k response has a 5xx status code +func (o *GetAPIActivitiesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api activities Id o k response a status code equal to that given +func (o *GetAPIActivitiesIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIActivitiesIDOK) Error() string { + return fmt.Sprintf("[GET /api/activities/{id}][%d] getApiActivitiesIdOK %+v", 200, o.Payload) +} + +func (o *GetAPIActivitiesIDOK) String() string { + return fmt.Sprintf("[GET /api/activities/{id}][%d] getApiActivitiesIdOK %+v", 200, o.Payload) +} + +func (o *GetAPIActivitiesIDOK) GetPayload() *models.ActivityEntity { + return o.Payload +} + +func (o *GetAPIActivitiesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ActivityEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/activity/get_api_activities_parameters.go b/client/activity/get_api_activities_parameters.go new file mode 100644 index 0000000..9ac5d10 --- /dev/null +++ b/client/activity/get_api_activities_parameters.go @@ -0,0 +1,338 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" +) + +// NewGetAPIActivitiesParams creates a new GetAPIActivitiesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIActivitiesParams() *GetAPIActivitiesParams { + return &GetAPIActivitiesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIActivitiesParamsWithTimeout creates a new GetAPIActivitiesParams object +// with the ability to set a timeout on a request. +func NewGetAPIActivitiesParamsWithTimeout(timeout time.Duration) *GetAPIActivitiesParams { + return &GetAPIActivitiesParams{ + timeout: timeout, + } +} + +// NewGetAPIActivitiesParamsWithContext creates a new GetAPIActivitiesParams object +// with the ability to set a context for a request. +func NewGetAPIActivitiesParamsWithContext(ctx context.Context) *GetAPIActivitiesParams { + return &GetAPIActivitiesParams{ + Context: ctx, + } +} + +// NewGetAPIActivitiesParamsWithHTTPClient creates a new GetAPIActivitiesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIActivitiesParamsWithHTTPClient(client *http.Client) *GetAPIActivitiesParams { + return &GetAPIActivitiesParams{ + HTTPClient: client, + } +} + +/* +GetAPIActivitiesParams contains all the parameters to send to the API endpoint + + for the get API activities operation. + + Typically these are written to a http.Request. +*/ +type GetAPIActivitiesParams struct { + + /* Globals. + + Use if you want to fetch only global activities. Allowed values: true (default: false) + */ + Globals string + + /* GlobalsFirst. + + Deprecated parameter, value is not used any more + */ + GlobalsFirst string + + /* Order. + + The result order. Allowed values: ASC, DESC (default: ASC) + */ + Order string + + /* OrderBy. + + The field by which results will be ordered. Allowed values: id, name, project (default: name) + */ + OrderBy string + + /* Project. + + Project ID to filter activities + */ + Project string + + /* Projects. + + Comma separated list of project IDs to filter activities + */ + Projects string + + /* Term. + + Free search term + */ + Term *string + + /* Visible. + + Visibility status to filter activities. Allowed values: 1=visible, 2=hidden, 3=all (default: 1) + */ + Visible string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API activities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIActivitiesParams) WithDefaults() *GetAPIActivitiesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API activities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIActivitiesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API activities params +func (o *GetAPIActivitiesParams) WithTimeout(timeout time.Duration) *GetAPIActivitiesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API activities params +func (o *GetAPIActivitiesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API activities params +func (o *GetAPIActivitiesParams) WithContext(ctx context.Context) *GetAPIActivitiesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API activities params +func (o *GetAPIActivitiesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API activities params +func (o *GetAPIActivitiesParams) WithHTTPClient(client *http.Client) *GetAPIActivitiesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API activities params +func (o *GetAPIActivitiesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGlobals adds the globals to the get API activities params +func (o *GetAPIActivitiesParams) WithGlobals(globals string) *GetAPIActivitiesParams { + o.SetGlobals(globals) + return o +} + +// SetGlobals adds the globals to the get API activities params +func (o *GetAPIActivitiesParams) SetGlobals(globals string) { + o.Globals = globals +} + +// WithGlobalsFirst adds the globalsFirst to the get API activities params +func (o *GetAPIActivitiesParams) WithGlobalsFirst(globalsFirst string) *GetAPIActivitiesParams { + o.SetGlobalsFirst(globalsFirst) + return o +} + +// SetGlobalsFirst adds the globalsFirst to the get API activities params +func (o *GetAPIActivitiesParams) SetGlobalsFirst(globalsFirst string) { + o.GlobalsFirst = globalsFirst +} + +// WithOrder adds the order to the get API activities params +func (o *GetAPIActivitiesParams) WithOrder(order string) *GetAPIActivitiesParams { + o.SetOrder(order) + return o +} + +// SetOrder adds the order to the get API activities params +func (o *GetAPIActivitiesParams) SetOrder(order string) { + o.Order = order +} + +// WithOrderBy adds the orderBy to the get API activities params +func (o *GetAPIActivitiesParams) WithOrderBy(orderBy string) *GetAPIActivitiesParams { + o.SetOrderBy(orderBy) + return o +} + +// SetOrderBy adds the orderBy to the get API activities params +func (o *GetAPIActivitiesParams) SetOrderBy(orderBy string) { + o.OrderBy = orderBy +} + +// WithProject adds the project to the get API activities params +func (o *GetAPIActivitiesParams) WithProject(project string) *GetAPIActivitiesParams { + o.SetProject(project) + return o +} + +// SetProject adds the project to the get API activities params +func (o *GetAPIActivitiesParams) SetProject(project string) { + o.Project = project +} + +// WithProjects adds the projects to the get API activities params +func (o *GetAPIActivitiesParams) WithProjects(projects string) *GetAPIActivitiesParams { + o.SetProjects(projects) + return o +} + +// SetProjects adds the projects to the get API activities params +func (o *GetAPIActivitiesParams) SetProjects(projects string) { + o.Projects = projects +} + +// WithTerm adds the term to the get API activities params +func (o *GetAPIActivitiesParams) WithTerm(term *string) *GetAPIActivitiesParams { + o.SetTerm(term) + return o +} + +// SetTerm adds the term to the get API activities params +func (o *GetAPIActivitiesParams) SetTerm(term *string) { + o.Term = term +} + +// WithVisible adds the visible to the get API activities params +func (o *GetAPIActivitiesParams) WithVisible(visible string) *GetAPIActivitiesParams { + o.SetVisible(visible) + return o +} + +// SetVisible adds the visible to the get API activities params +func (o *GetAPIActivitiesParams) SetVisible(visible string) { + o.Visible = visible +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIActivitiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param globals + qrGlobals := o.Globals + qGlobals := qrGlobals + + if err := r.SetQueryParam("globals", qGlobals); err != nil { + return err + } + + // query param globalsFirst + qrGlobalsFirst := o.GlobalsFirst + qGlobalsFirst := qrGlobalsFirst + + if err := r.SetQueryParam("globalsFirst", qGlobalsFirst); err != nil { + return err + } + + // query param order + qrOrder := o.Order + qOrder := qrOrder + + if err := r.SetQueryParam("order", qOrder); err != nil { + return err + } + + // query param orderBy + qrOrderBy := o.OrderBy + qOrderBy := qrOrderBy + + if err := r.SetQueryParam("orderBy", qOrderBy); err != nil { + return err + } + + // query param project + qrProject := o.Project + qProject := qrProject + + if err := r.SetQueryParam("project", qProject); err != nil { + return err + } + + // query param projects + qrProjects := o.Projects + qProjects := qrProjects + + if err := r.SetQueryParam("projects", qProjects); err != nil { + return err + } + + if o.Term != nil { + + // query param term + var qrTerm string + + if o.Term != nil { + qrTerm = *o.Term + } + qTerm := qrTerm + if qTerm != "" { + + if err := r.SetQueryParam("term", qTerm); err != nil { + return err + } + } + } + + // query param visible + qrVisible := o.Visible + qVisible := qrVisible + + if err := r.SetQueryParam("visible", qVisible); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/activity/get_api_activities_responses.go b/client/activity/get_api_activities_responses.go new file mode 100644 index 0000000..7dd3425 --- /dev/null +++ b/client/activity/get_api_activities_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIActivitiesReader is a Reader for the GetAPIActivities structure. +type GetAPIActivitiesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIActivitiesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIActivitiesOK() + 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()) + } +} + +// NewGetAPIActivitiesOK creates a GetAPIActivitiesOK with default headers values +func NewGetAPIActivitiesOK() *GetAPIActivitiesOK { + return &GetAPIActivitiesOK{} +} + +/* +GetAPIActivitiesOK describes a response with status code 200, with default header values. + +Returns a collection of activity entities +*/ +type GetAPIActivitiesOK struct { + Payload []*models.ActivityCollection +} + +// IsSuccess returns true when this get Api activities o k response has a 2xx status code +func (o *GetAPIActivitiesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api activities o k response has a 3xx status code +func (o *GetAPIActivitiesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api activities o k response has a 4xx status code +func (o *GetAPIActivitiesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api activities o k response has a 5xx status code +func (o *GetAPIActivitiesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api activities o k response a status code equal to that given +func (o *GetAPIActivitiesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIActivitiesOK) Error() string { + return fmt.Sprintf("[GET /api/activities][%d] getApiActivitiesOK %+v", 200, o.Payload) +} + +func (o *GetAPIActivitiesOK) String() string { + return fmt.Sprintf("[GET /api/activities][%d] getApiActivitiesOK %+v", 200, o.Payload) +} + +func (o *GetAPIActivitiesOK) GetPayload() []*models.ActivityCollection { + return o.Payload +} + +func (o *GetAPIActivitiesOK) 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/activity/patch_api_activities_id_meta_parameters.go b/client/activity/patch_api_activities_id_meta_parameters.go new file mode 100644 index 0000000..de395ae --- /dev/null +++ b/client/activity/patch_api_activities_id_meta_parameters.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" +) + +// NewPatchAPIActivitiesIDMetaParams creates a new PatchAPIActivitiesIDMetaParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIActivitiesIDMetaParams() *PatchAPIActivitiesIDMetaParams { + return &PatchAPIActivitiesIDMetaParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIActivitiesIDMetaParamsWithTimeout creates a new PatchAPIActivitiesIDMetaParams object +// with the ability to set a timeout on a request. +func NewPatchAPIActivitiesIDMetaParamsWithTimeout(timeout time.Duration) *PatchAPIActivitiesIDMetaParams { + return &PatchAPIActivitiesIDMetaParams{ + timeout: timeout, + } +} + +// NewPatchAPIActivitiesIDMetaParamsWithContext creates a new PatchAPIActivitiesIDMetaParams object +// with the ability to set a context for a request. +func NewPatchAPIActivitiesIDMetaParamsWithContext(ctx context.Context) *PatchAPIActivitiesIDMetaParams { + return &PatchAPIActivitiesIDMetaParams{ + Context: ctx, + } +} + +// NewPatchAPIActivitiesIDMetaParamsWithHTTPClient creates a new PatchAPIActivitiesIDMetaParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIActivitiesIDMetaParamsWithHTTPClient(client *http.Client) *PatchAPIActivitiesIDMetaParams { + return &PatchAPIActivitiesIDMetaParams{ + HTTPClient: client, + } +} + +/* +PatchAPIActivitiesIDMetaParams contains all the parameters to send to the API endpoint + + for the patch API activities ID meta operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIActivitiesIDMetaParams struct { + + // Body. + Body PatchAPIActivitiesIDMetaBody + + /* ID. + + Activity record ID to set the meta-field value for + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API activities ID meta params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIActivitiesIDMetaParams) WithDefaults() *PatchAPIActivitiesIDMetaParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API activities ID meta params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIActivitiesIDMetaParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API activities ID meta params +func (o *PatchAPIActivitiesIDMetaParams) WithTimeout(timeout time.Duration) *PatchAPIActivitiesIDMetaParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API activities ID meta params +func (o *PatchAPIActivitiesIDMetaParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API activities ID meta params +func (o *PatchAPIActivitiesIDMetaParams) WithContext(ctx context.Context) *PatchAPIActivitiesIDMetaParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API activities ID meta params +func (o *PatchAPIActivitiesIDMetaParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API activities ID meta params +func (o *PatchAPIActivitiesIDMetaParams) WithHTTPClient(client *http.Client) *PatchAPIActivitiesIDMetaParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API activities ID meta params +func (o *PatchAPIActivitiesIDMetaParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API activities ID meta params +func (o *PatchAPIActivitiesIDMetaParams) WithBody(body PatchAPIActivitiesIDMetaBody) *PatchAPIActivitiesIDMetaParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API activities ID meta params +func (o *PatchAPIActivitiesIDMetaParams) SetBody(body PatchAPIActivitiesIDMetaBody) { + o.Body = body +} + +// WithID adds the id to the patch API activities ID meta params +func (o *PatchAPIActivitiesIDMetaParams) WithID(id int64) *PatchAPIActivitiesIDMetaParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API activities ID meta params +func (o *PatchAPIActivitiesIDMetaParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIActivitiesIDMetaParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/activity/patch_api_activities_id_meta_responses.go b/client/activity/patch_api_activities_id_meta_responses.go new file mode 100644 index 0000000..25bb5c1 --- /dev/null +++ b/client/activity/patch_api_activities_id_meta_responses.go @@ -0,0 +1,176 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + + "decentral1se/go-kimai/models" +) + +// PatchAPIActivitiesIDMetaReader is a Reader for the PatchAPIActivitiesIDMeta structure. +type PatchAPIActivitiesIDMetaReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIActivitiesIDMetaReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIActivitiesIDMetaOK() + 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()) + } +} + +// NewPatchAPIActivitiesIDMetaOK creates a PatchAPIActivitiesIDMetaOK with default headers values +func NewPatchAPIActivitiesIDMetaOK() *PatchAPIActivitiesIDMetaOK { + return &PatchAPIActivitiesIDMetaOK{} +} + +/* +PatchAPIActivitiesIDMetaOK describes a response with status code 200, with default header values. + +Sets the value of an existing/configured meta-field. You cannot create unknown meta-fields, if the given name is not a configured meta-field, this will return an exception. +*/ +type PatchAPIActivitiesIDMetaOK struct { + Payload *models.ActivityEntity +} + +// IsSuccess returns true when this patch Api activities Id meta o k response has a 2xx status code +func (o *PatchAPIActivitiesIDMetaOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api activities Id meta o k response has a 3xx status code +func (o *PatchAPIActivitiesIDMetaOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api activities Id meta o k response has a 4xx status code +func (o *PatchAPIActivitiesIDMetaOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api activities Id meta o k response has a 5xx status code +func (o *PatchAPIActivitiesIDMetaOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api activities Id meta o k response a status code equal to that given +func (o *PatchAPIActivitiesIDMetaOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPIActivitiesIDMetaOK) Error() string { + return fmt.Sprintf("[PATCH /api/activities/{id}/meta][%d] patchApiActivitiesIdMetaOK %+v", 200, o.Payload) +} + +func (o *PatchAPIActivitiesIDMetaOK) String() string { + return fmt.Sprintf("[PATCH /api/activities/{id}/meta][%d] patchApiActivitiesIdMetaOK %+v", 200, o.Payload) +} + +func (o *PatchAPIActivitiesIDMetaOK) GetPayload() *models.ActivityEntity { + return o.Payload +} + +func (o *PatchAPIActivitiesIDMetaOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ActivityEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +PatchAPIActivitiesIDMetaBody patch API activities ID meta body +swagger:model PatchAPIActivitiesIDMetaBody +*/ +type PatchAPIActivitiesIDMetaBody struct { + + // The meta-field name + // Required: true + Name *string `json:"name"` + + // The meta-field value + // Required: true + Value *string `json:"value"` +} + +// Validate validates this patch API activities ID meta body +func (o *PatchAPIActivitiesIDMetaBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateName(formats); err != nil { + res = append(res, err) + } + + if err := o.validateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *PatchAPIActivitiesIDMetaBody) validateName(formats strfmt.Registry) error { + + if err := validate.Required("body"+"."+"name", "body", o.Name); err != nil { + return err + } + + return nil +} + +func (o *PatchAPIActivitiesIDMetaBody) validateValue(formats strfmt.Registry) error { + + if err := validate.Required("body"+"."+"value", "body", o.Value); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this patch API activities ID meta body based on context it is used +func (o *PatchAPIActivitiesIDMetaBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *PatchAPIActivitiesIDMetaBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *PatchAPIActivitiesIDMetaBody) UnmarshalBinary(b []byte) error { + var res PatchAPIActivitiesIDMetaBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/client/activity/patch_api_activities_id_parameters.go b/client/activity/patch_api_activities_id_parameters.go new file mode 100644 index 0000000..7edbd9e --- /dev/null +++ b/client/activity/patch_api_activities_id_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPatchAPIActivitiesIDParams creates a new PatchAPIActivitiesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIActivitiesIDParams() *PatchAPIActivitiesIDParams { + return &PatchAPIActivitiesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIActivitiesIDParamsWithTimeout creates a new PatchAPIActivitiesIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPIActivitiesIDParamsWithTimeout(timeout time.Duration) *PatchAPIActivitiesIDParams { + return &PatchAPIActivitiesIDParams{ + timeout: timeout, + } +} + +// NewPatchAPIActivitiesIDParamsWithContext creates a new PatchAPIActivitiesIDParams object +// with the ability to set a context for a request. +func NewPatchAPIActivitiesIDParamsWithContext(ctx context.Context) *PatchAPIActivitiesIDParams { + return &PatchAPIActivitiesIDParams{ + Context: ctx, + } +} + +// NewPatchAPIActivitiesIDParamsWithHTTPClient creates a new PatchAPIActivitiesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIActivitiesIDParamsWithHTTPClient(client *http.Client) *PatchAPIActivitiesIDParams { + return &PatchAPIActivitiesIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPIActivitiesIDParams contains all the parameters to send to the API endpoint + + for the patch API activities ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIActivitiesIDParams struct { + + // Body. + Body *models.ActivityEditForm + + /* ID. + + Activity ID to update + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API activities ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIActivitiesIDParams) WithDefaults() *PatchAPIActivitiesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API activities ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIActivitiesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API activities ID params +func (o *PatchAPIActivitiesIDParams) WithTimeout(timeout time.Duration) *PatchAPIActivitiesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API activities ID params +func (o *PatchAPIActivitiesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API activities ID params +func (o *PatchAPIActivitiesIDParams) WithContext(ctx context.Context) *PatchAPIActivitiesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API activities ID params +func (o *PatchAPIActivitiesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API activities ID params +func (o *PatchAPIActivitiesIDParams) WithHTTPClient(client *http.Client) *PatchAPIActivitiesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API activities ID params +func (o *PatchAPIActivitiesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API activities ID params +func (o *PatchAPIActivitiesIDParams) WithBody(body *models.ActivityEditForm) *PatchAPIActivitiesIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API activities ID params +func (o *PatchAPIActivitiesIDParams) SetBody(body *models.ActivityEditForm) { + o.Body = body +} + +// WithID adds the id to the patch API activities ID params +func (o *PatchAPIActivitiesIDParams) WithID(id int64) *PatchAPIActivitiesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API activities ID params +func (o *PatchAPIActivitiesIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIActivitiesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/activity/patch_api_activities_id_responses.go b/client/activity/patch_api_activities_id_responses.go new file mode 100644 index 0000000..98acb65 --- /dev/null +++ b/client/activity/patch_api_activities_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPIActivitiesIDReader is a Reader for the PatchAPIActivitiesID structure. +type PatchAPIActivitiesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIActivitiesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIActivitiesIDOK() + 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()) + } +} + +// NewPatchAPIActivitiesIDOK creates a PatchAPIActivitiesIDOK with default headers values +func NewPatchAPIActivitiesIDOK() *PatchAPIActivitiesIDOK { + return &PatchAPIActivitiesIDOK{} +} + +/* +PatchAPIActivitiesIDOK describes a response with status code 200, with default header values. + +Returns the updated activity +*/ +type PatchAPIActivitiesIDOK struct { + Payload *models.ActivityEntity +} + +// IsSuccess returns true when this patch Api activities Id o k response has a 2xx status code +func (o *PatchAPIActivitiesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api activities Id o k response has a 3xx status code +func (o *PatchAPIActivitiesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api activities Id o k response has a 4xx status code +func (o *PatchAPIActivitiesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api activities Id o k response has a 5xx status code +func (o *PatchAPIActivitiesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api activities Id o k response a status code equal to that given +func (o *PatchAPIActivitiesIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPIActivitiesIDOK) Error() string { + return fmt.Sprintf("[PATCH /api/activities/{id}][%d] patchApiActivitiesIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPIActivitiesIDOK) String() string { + return fmt.Sprintf("[PATCH /api/activities/{id}][%d] patchApiActivitiesIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPIActivitiesIDOK) GetPayload() *models.ActivityEntity { + return o.Payload +} + +func (o *PatchAPIActivitiesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ActivityEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/activity/post_api_activities_id_rates_parameters.go b/client/activity/post_api_activities_id_rates_parameters.go new file mode 100644 index 0000000..7e24011 --- /dev/null +++ b/client/activity/post_api_activities_id_rates_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPostAPIActivitiesIDRatesParams creates a new PostAPIActivitiesIDRatesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIActivitiesIDRatesParams() *PostAPIActivitiesIDRatesParams { + return &PostAPIActivitiesIDRatesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIActivitiesIDRatesParamsWithTimeout creates a new PostAPIActivitiesIDRatesParams object +// with the ability to set a timeout on a request. +func NewPostAPIActivitiesIDRatesParamsWithTimeout(timeout time.Duration) *PostAPIActivitiesIDRatesParams { + return &PostAPIActivitiesIDRatesParams{ + timeout: timeout, + } +} + +// NewPostAPIActivitiesIDRatesParamsWithContext creates a new PostAPIActivitiesIDRatesParams object +// with the ability to set a context for a request. +func NewPostAPIActivitiesIDRatesParamsWithContext(ctx context.Context) *PostAPIActivitiesIDRatesParams { + return &PostAPIActivitiesIDRatesParams{ + Context: ctx, + } +} + +// NewPostAPIActivitiesIDRatesParamsWithHTTPClient creates a new PostAPIActivitiesIDRatesParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIActivitiesIDRatesParamsWithHTTPClient(client *http.Client) *PostAPIActivitiesIDRatesParams { + return &PostAPIActivitiesIDRatesParams{ + HTTPClient: client, + } +} + +/* +PostAPIActivitiesIDRatesParams contains all the parameters to send to the API endpoint + + for the post API activities ID rates operation. + + Typically these are written to a http.Request. +*/ +type PostAPIActivitiesIDRatesParams struct { + + // Body. + Body *models.ActivityRateForm + + /* ID. + + The activity to add the rate for + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API activities ID rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIActivitiesIDRatesParams) WithDefaults() *PostAPIActivitiesIDRatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API activities ID rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIActivitiesIDRatesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API activities ID rates params +func (o *PostAPIActivitiesIDRatesParams) WithTimeout(timeout time.Duration) *PostAPIActivitiesIDRatesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API activities ID rates params +func (o *PostAPIActivitiesIDRatesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API activities ID rates params +func (o *PostAPIActivitiesIDRatesParams) WithContext(ctx context.Context) *PostAPIActivitiesIDRatesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API activities ID rates params +func (o *PostAPIActivitiesIDRatesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API activities ID rates params +func (o *PostAPIActivitiesIDRatesParams) WithHTTPClient(client *http.Client) *PostAPIActivitiesIDRatesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API activities ID rates params +func (o *PostAPIActivitiesIDRatesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API activities ID rates params +func (o *PostAPIActivitiesIDRatesParams) WithBody(body *models.ActivityRateForm) *PostAPIActivitiesIDRatesParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API activities ID rates params +func (o *PostAPIActivitiesIDRatesParams) SetBody(body *models.ActivityRateForm) { + o.Body = body +} + +// WithID adds the id to the post API activities ID rates params +func (o *PostAPIActivitiesIDRatesParams) WithID(id int64) *PostAPIActivitiesIDRatesParams { + o.SetID(id) + return o +} + +// SetID adds the id to the post API activities ID rates params +func (o *PostAPIActivitiesIDRatesParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIActivitiesIDRatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/activity/post_api_activities_id_rates_responses.go b/client/activity/post_api_activities_id_rates_responses.go new file mode 100644 index 0000000..1224f24 --- /dev/null +++ b/client/activity/post_api_activities_id_rates_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPIActivitiesIDRatesReader is a Reader for the PostAPIActivitiesIDRates structure. +type PostAPIActivitiesIDRatesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIActivitiesIDRatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIActivitiesIDRatesOK() + 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()) + } +} + +// NewPostAPIActivitiesIDRatesOK creates a PostAPIActivitiesIDRatesOK with default headers values +func NewPostAPIActivitiesIDRatesOK() *PostAPIActivitiesIDRatesOK { + return &PostAPIActivitiesIDRatesOK{} +} + +/* +PostAPIActivitiesIDRatesOK describes a response with status code 200, with default header values. + +Returns the new created rate +*/ +type PostAPIActivitiesIDRatesOK struct { + Payload *models.ActivityRate +} + +// IsSuccess returns true when this post Api activities Id rates o k response has a 2xx status code +func (o *PostAPIActivitiesIDRatesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api activities Id rates o k response has a 3xx status code +func (o *PostAPIActivitiesIDRatesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api activities Id rates o k response has a 4xx status code +func (o *PostAPIActivitiesIDRatesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api activities Id rates o k response has a 5xx status code +func (o *PostAPIActivitiesIDRatesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api activities Id rates o k response a status code equal to that given +func (o *PostAPIActivitiesIDRatesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPIActivitiesIDRatesOK) Error() string { + return fmt.Sprintf("[POST /api/activities/{id}/rates][%d] postApiActivitiesIdRatesOK %+v", 200, o.Payload) +} + +func (o *PostAPIActivitiesIDRatesOK) String() string { + return fmt.Sprintf("[POST /api/activities/{id}/rates][%d] postApiActivitiesIdRatesOK %+v", 200, o.Payload) +} + +func (o *PostAPIActivitiesIDRatesOK) GetPayload() *models.ActivityRate { + return o.Payload +} + +func (o *PostAPIActivitiesIDRatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ActivityRate) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/activity/post_api_activities_parameters.go b/client/activity/post_api_activities_parameters.go new file mode 100644 index 0000000..c86e06a --- /dev/null +++ b/client/activity/post_api_activities_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPostAPIActivitiesParams creates a new PostAPIActivitiesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIActivitiesParams() *PostAPIActivitiesParams { + return &PostAPIActivitiesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIActivitiesParamsWithTimeout creates a new PostAPIActivitiesParams object +// with the ability to set a timeout on a request. +func NewPostAPIActivitiesParamsWithTimeout(timeout time.Duration) *PostAPIActivitiesParams { + return &PostAPIActivitiesParams{ + timeout: timeout, + } +} + +// NewPostAPIActivitiesParamsWithContext creates a new PostAPIActivitiesParams object +// with the ability to set a context for a request. +func NewPostAPIActivitiesParamsWithContext(ctx context.Context) *PostAPIActivitiesParams { + return &PostAPIActivitiesParams{ + Context: ctx, + } +} + +// NewPostAPIActivitiesParamsWithHTTPClient creates a new PostAPIActivitiesParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIActivitiesParamsWithHTTPClient(client *http.Client) *PostAPIActivitiesParams { + return &PostAPIActivitiesParams{ + HTTPClient: client, + } +} + +/* +PostAPIActivitiesParams contains all the parameters to send to the API endpoint + + for the post API activities operation. + + Typically these are written to a http.Request. +*/ +type PostAPIActivitiesParams struct { + + // Body. + Body *models.ActivityEditForm + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API activities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIActivitiesParams) WithDefaults() *PostAPIActivitiesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API activities params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIActivitiesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API activities params +func (o *PostAPIActivitiesParams) WithTimeout(timeout time.Duration) *PostAPIActivitiesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API activities params +func (o *PostAPIActivitiesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API activities params +func (o *PostAPIActivitiesParams) WithContext(ctx context.Context) *PostAPIActivitiesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API activities params +func (o *PostAPIActivitiesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API activities params +func (o *PostAPIActivitiesParams) WithHTTPClient(client *http.Client) *PostAPIActivitiesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API activities params +func (o *PostAPIActivitiesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API activities params +func (o *PostAPIActivitiesParams) WithBody(body *models.ActivityEditForm) *PostAPIActivitiesParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API activities params +func (o *PostAPIActivitiesParams) SetBody(body *models.ActivityEditForm) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIActivitiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/activity/post_api_activities_responses.go b/client/activity/post_api_activities_responses.go new file mode 100644 index 0000000..e53d7e4 --- /dev/null +++ b/client/activity/post_api_activities_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package activity + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPIActivitiesReader is a Reader for the PostAPIActivities structure. +type PostAPIActivitiesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIActivitiesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIActivitiesOK() + 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()) + } +} + +// NewPostAPIActivitiesOK creates a PostAPIActivitiesOK with default headers values +func NewPostAPIActivitiesOK() *PostAPIActivitiesOK { + return &PostAPIActivitiesOK{} +} + +/* +PostAPIActivitiesOK describes a response with status code 200, with default header values. + +Returns the new created activity +*/ +type PostAPIActivitiesOK struct { + Payload *models.ActivityEntity +} + +// IsSuccess returns true when this post Api activities o k response has a 2xx status code +func (o *PostAPIActivitiesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api activities o k response has a 3xx status code +func (o *PostAPIActivitiesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api activities o k response has a 4xx status code +func (o *PostAPIActivitiesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api activities o k response has a 5xx status code +func (o *PostAPIActivitiesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api activities o k response a status code equal to that given +func (o *PostAPIActivitiesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPIActivitiesOK) Error() string { + return fmt.Sprintf("[POST /api/activities][%d] postApiActivitiesOK %+v", 200, o.Payload) +} + +func (o *PostAPIActivitiesOK) String() string { + return fmt.Sprintf("[POST /api/activities][%d] postApiActivitiesOK %+v", 200, o.Payload) +} + +func (o *PostAPIActivitiesOK) GetPayload() *models.ActivityEntity { + return o.Payload +} + +func (o *PostAPIActivitiesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ActivityEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/customer/customer_client.go b/client/customer/customer_client.go new file mode 100644 index 0000000..ec1f4ee --- /dev/null +++ b/client/customer/customer_client.go @@ -0,0 +1,371 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new customer API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for customer API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPICustomersIDRatesRateID(params *DeleteAPICustomersIDRatesRateIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPICustomersIDRatesRateIDNoContent, error) + + GetAPICustomers(params *GetAPICustomersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPICustomersOK, error) + + GetAPICustomersID(params *GetAPICustomersIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPICustomersIDOK, error) + + GetAPICustomersIDRates(params *GetAPICustomersIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPICustomersIDRatesOK, error) + + PatchAPICustomersID(params *PatchAPICustomersIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPICustomersIDOK, error) + + PatchAPICustomersIDMeta(params *PatchAPICustomersIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPICustomersIDMetaOK, error) + + PostAPICustomers(params *PostAPICustomersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPICustomersOK, error) + + PostAPICustomersIDRates(params *PostAPICustomersIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPICustomersIDRatesOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPICustomersIDRatesRateID deletes one rate for an customer +*/ +func (a *Client) DeleteAPICustomersIDRatesRateID(params *DeleteAPICustomersIDRatesRateIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPICustomersIDRatesRateIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPICustomersIDRatesRateIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPICustomersIDRatesRateID", + Method: "DELETE", + PathPattern: "/api/customers/{id}/rates/{rateId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPICustomersIDRatesRateIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPICustomersIDRatesRateIDNoContent) + 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 DeleteAPICustomersIDRatesRateID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPICustomers returns a collection of customers +*/ +func (a *Client) GetAPICustomers(params *GetAPICustomersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPICustomersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPICustomersParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPICustomers", + Method: "GET", + PathPattern: "/api/customers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPICustomersReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPICustomersOK) + 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 GetAPICustomers: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPICustomersID returns one customer +*/ +func (a *Client) GetAPICustomersID(params *GetAPICustomersIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPICustomersIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPICustomersIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPICustomersID", + Method: "GET", + PathPattern: "/api/customers/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPICustomersIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPICustomersIDOK) + 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 GetAPICustomersID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPICustomersIDRates returns a collection of all rates for one customer +*/ +func (a *Client) GetAPICustomersIDRates(params *GetAPICustomersIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPICustomersIDRatesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPICustomersIDRatesParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPICustomersIDRates", + Method: "GET", + PathPattern: "/api/customers/{id}/rates", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPICustomersIDRatesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPICustomersIDRatesOK) + 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 GetAPICustomersIDRates: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPICustomersID updates an existing customer + +Update an existing customer, you can pass all or just a subset of all attributes +*/ +func (a *Client) PatchAPICustomersID(params *PatchAPICustomersIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPICustomersIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPICustomersIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPICustomersID", + Method: "PATCH", + PathPattern: "/api/customers/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPICustomersIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPICustomersIDOK) + 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 PatchAPICustomersID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPICustomersIDMeta sets the value of a meta field for an existing customer +*/ +func (a *Client) PatchAPICustomersIDMeta(params *PatchAPICustomersIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPICustomersIDMetaOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPICustomersIDMetaParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPICustomersIDMeta", + Method: "PATCH", + PathPattern: "/api/customers/{id}/meta", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPICustomersIDMetaReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPICustomersIDMetaOK) + 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 PatchAPICustomersIDMeta: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPICustomers creates a new customer + +Creates a new customer and returns it afterwards +*/ +func (a *Client) PostAPICustomers(params *PostAPICustomersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPICustomersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPICustomersParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPICustomers", + Method: "POST", + PathPattern: "/api/customers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPICustomersReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPICustomersOK) + 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 PostAPICustomers: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPICustomersIDRates adds a new rate to a customer +*/ +func (a *Client) PostAPICustomersIDRates(params *PostAPICustomersIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPICustomersIDRatesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPICustomersIDRatesParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPICustomersIDRates", + Method: "POST", + PathPattern: "/api/customers/{id}/rates", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPICustomersIDRatesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPICustomersIDRatesOK) + 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 PostAPICustomersIDRates: 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/customer/delete_api_customers_id_rates_rate_id_parameters.go b/client/customer/delete_api_customers_id_rates_rate_id_parameters.go new file mode 100644 index 0000000..be1d743 --- /dev/null +++ b/client/customer/delete_api_customers_id_rates_rate_id_parameters.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" +) + +// NewDeleteAPICustomersIDRatesRateIDParams creates a new DeleteAPICustomersIDRatesRateIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPICustomersIDRatesRateIDParams() *DeleteAPICustomersIDRatesRateIDParams { + return &DeleteAPICustomersIDRatesRateIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPICustomersIDRatesRateIDParamsWithTimeout creates a new DeleteAPICustomersIDRatesRateIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPICustomersIDRatesRateIDParamsWithTimeout(timeout time.Duration) *DeleteAPICustomersIDRatesRateIDParams { + return &DeleteAPICustomersIDRatesRateIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPICustomersIDRatesRateIDParamsWithContext creates a new DeleteAPICustomersIDRatesRateIDParams object +// with the ability to set a context for a request. +func NewDeleteAPICustomersIDRatesRateIDParamsWithContext(ctx context.Context) *DeleteAPICustomersIDRatesRateIDParams { + return &DeleteAPICustomersIDRatesRateIDParams{ + Context: ctx, + } +} + +// NewDeleteAPICustomersIDRatesRateIDParamsWithHTTPClient creates a new DeleteAPICustomersIDRatesRateIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPICustomersIDRatesRateIDParamsWithHTTPClient(client *http.Client) *DeleteAPICustomersIDRatesRateIDParams { + return &DeleteAPICustomersIDRatesRateIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPICustomersIDRatesRateIDParams contains all the parameters to send to the API endpoint + + for the delete API customers ID rates rate ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPICustomersIDRatesRateIDParams struct { + + /* ID. + + The customer whose rate will be removed + */ + ID int64 + + /* RateID. + + The rate to remove + */ + RateID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API customers ID rates rate ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPICustomersIDRatesRateIDParams) WithDefaults() *DeleteAPICustomersIDRatesRateIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API customers ID rates rate ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPICustomersIDRatesRateIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API customers ID rates rate ID params +func (o *DeleteAPICustomersIDRatesRateIDParams) WithTimeout(timeout time.Duration) *DeleteAPICustomersIDRatesRateIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API customers ID rates rate ID params +func (o *DeleteAPICustomersIDRatesRateIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API customers ID rates rate ID params +func (o *DeleteAPICustomersIDRatesRateIDParams) WithContext(ctx context.Context) *DeleteAPICustomersIDRatesRateIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API customers ID rates rate ID params +func (o *DeleteAPICustomersIDRatesRateIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API customers ID rates rate ID params +func (o *DeleteAPICustomersIDRatesRateIDParams) WithHTTPClient(client *http.Client) *DeleteAPICustomersIDRatesRateIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API customers ID rates rate ID params +func (o *DeleteAPICustomersIDRatesRateIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete API customers ID rates rate ID params +func (o *DeleteAPICustomersIDRatesRateIDParams) WithID(id int64) *DeleteAPICustomersIDRatesRateIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API customers ID rates rate ID params +func (o *DeleteAPICustomersIDRatesRateIDParams) SetID(id int64) { + o.ID = id +} + +// WithRateID adds the rateID to the delete API customers ID rates rate ID params +func (o *DeleteAPICustomersIDRatesRateIDParams) WithRateID(rateID int64) *DeleteAPICustomersIDRatesRateIDParams { + o.SetRateID(rateID) + return o +} + +// SetRateID adds the rateId to the delete API customers ID rates rate ID params +func (o *DeleteAPICustomersIDRatesRateIDParams) SetRateID(rateID int64) { + o.RateID = rateID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPICustomersIDRatesRateIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + // path param rateId + if err := r.SetPathParam("rateId", swag.FormatInt64(o.RateID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/customer/delete_api_customers_id_rates_rate_id_responses.go b/client/customer/delete_api_customers_id_rates_rate_id_responses.go new file mode 100644 index 0000000..8c9d7cc --- /dev/null +++ b/client/customer/delete_api_customers_id_rates_rate_id_responses.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// DeleteAPICustomersIDRatesRateIDReader is a Reader for the DeleteAPICustomersIDRatesRateID structure. +type DeleteAPICustomersIDRatesRateIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPICustomersIDRatesRateIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 204: + result := NewDeleteAPICustomersIDRatesRateIDNoContent() + 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()) + } +} + +// NewDeleteAPICustomersIDRatesRateIDNoContent creates a DeleteAPICustomersIDRatesRateIDNoContent with default headers values +func NewDeleteAPICustomersIDRatesRateIDNoContent() *DeleteAPICustomersIDRatesRateIDNoContent { + return &DeleteAPICustomersIDRatesRateIDNoContent{} +} + +/* +DeleteAPICustomersIDRatesRateIDNoContent describes a response with status code 204, with default header values. + +Returns no content: 204 on successful delete +*/ +type DeleteAPICustomersIDRatesRateIDNoContent struct { +} + +// IsSuccess returns true when this delete Api customers Id rates rate Id no content response has a 2xx status code +func (o *DeleteAPICustomersIDRatesRateIDNoContent) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api customers Id rates rate Id no content response has a 3xx status code +func (o *DeleteAPICustomersIDRatesRateIDNoContent) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api customers Id rates rate Id no content response has a 4xx status code +func (o *DeleteAPICustomersIDRatesRateIDNoContent) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api customers Id rates rate Id no content response has a 5xx status code +func (o *DeleteAPICustomersIDRatesRateIDNoContent) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api customers Id rates rate Id no content response a status code equal to that given +func (o *DeleteAPICustomersIDRatesRateIDNoContent) IsCode(code int) bool { + return code == 204 +} + +func (o *DeleteAPICustomersIDRatesRateIDNoContent) Error() string { + return fmt.Sprintf("[DELETE /api/customers/{id}/rates/{rateId}][%d] deleteApiCustomersIdRatesRateIdNoContent ", 204) +} + +func (o *DeleteAPICustomersIDRatesRateIDNoContent) String() string { + return fmt.Sprintf("[DELETE /api/customers/{id}/rates/{rateId}][%d] deleteApiCustomersIdRatesRateIdNoContent ", 204) +} + +func (o *DeleteAPICustomersIDRatesRateIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/customer/get_api_customers_id_parameters.go b/client/customer/get_api_customers_id_parameters.go new file mode 100644 index 0000000..43a6c4e --- /dev/null +++ b/client/customer/get_api_customers_id_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" +) + +// NewGetAPICustomersIDParams creates a new GetAPICustomersIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPICustomersIDParams() *GetAPICustomersIDParams { + return &GetAPICustomersIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPICustomersIDParamsWithTimeout creates a new GetAPICustomersIDParams object +// with the ability to set a timeout on a request. +func NewGetAPICustomersIDParamsWithTimeout(timeout time.Duration) *GetAPICustomersIDParams { + return &GetAPICustomersIDParams{ + timeout: timeout, + } +} + +// NewGetAPICustomersIDParamsWithContext creates a new GetAPICustomersIDParams object +// with the ability to set a context for a request. +func NewGetAPICustomersIDParamsWithContext(ctx context.Context) *GetAPICustomersIDParams { + return &GetAPICustomersIDParams{ + Context: ctx, + } +} + +// NewGetAPICustomersIDParamsWithHTTPClient creates a new GetAPICustomersIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPICustomersIDParamsWithHTTPClient(client *http.Client) *GetAPICustomersIDParams { + return &GetAPICustomersIDParams{ + HTTPClient: client, + } +} + +/* +GetAPICustomersIDParams contains all the parameters to send to the API endpoint + + for the get API customers ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPICustomersIDParams struct { + + // ID. + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API customers ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPICustomersIDParams) WithDefaults() *GetAPICustomersIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API customers ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPICustomersIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API customers ID params +func (o *GetAPICustomersIDParams) WithTimeout(timeout time.Duration) *GetAPICustomersIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API customers ID params +func (o *GetAPICustomersIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API customers ID params +func (o *GetAPICustomersIDParams) WithContext(ctx context.Context) *GetAPICustomersIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API customers ID params +func (o *GetAPICustomersIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API customers ID params +func (o *GetAPICustomersIDParams) WithHTTPClient(client *http.Client) *GetAPICustomersIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API customers ID params +func (o *GetAPICustomersIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get API customers ID params +func (o *GetAPICustomersIDParams) WithID(id string) *GetAPICustomersIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API customers ID params +func (o *GetAPICustomersIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPICustomersIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/customer/get_api_customers_id_rates_parameters.go b/client/customer/get_api_customers_id_rates_parameters.go new file mode 100644 index 0000000..7aab277 --- /dev/null +++ b/client/customer/get_api_customers_id_rates_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" +) + +// NewGetAPICustomersIDRatesParams creates a new GetAPICustomersIDRatesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPICustomersIDRatesParams() *GetAPICustomersIDRatesParams { + return &GetAPICustomersIDRatesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPICustomersIDRatesParamsWithTimeout creates a new GetAPICustomersIDRatesParams object +// with the ability to set a timeout on a request. +func NewGetAPICustomersIDRatesParamsWithTimeout(timeout time.Duration) *GetAPICustomersIDRatesParams { + return &GetAPICustomersIDRatesParams{ + timeout: timeout, + } +} + +// NewGetAPICustomersIDRatesParamsWithContext creates a new GetAPICustomersIDRatesParams object +// with the ability to set a context for a request. +func NewGetAPICustomersIDRatesParamsWithContext(ctx context.Context) *GetAPICustomersIDRatesParams { + return &GetAPICustomersIDRatesParams{ + Context: ctx, + } +} + +// NewGetAPICustomersIDRatesParamsWithHTTPClient creates a new GetAPICustomersIDRatesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPICustomersIDRatesParamsWithHTTPClient(client *http.Client) *GetAPICustomersIDRatesParams { + return &GetAPICustomersIDRatesParams{ + HTTPClient: client, + } +} + +/* +GetAPICustomersIDRatesParams contains all the parameters to send to the API endpoint + + for the get API customers ID rates operation. + + Typically these are written to a http.Request. +*/ +type GetAPICustomersIDRatesParams struct { + + /* ID. + + The customer whose rates will be returned + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API customers ID rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPICustomersIDRatesParams) WithDefaults() *GetAPICustomersIDRatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API customers ID rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPICustomersIDRatesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API customers ID rates params +func (o *GetAPICustomersIDRatesParams) WithTimeout(timeout time.Duration) *GetAPICustomersIDRatesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API customers ID rates params +func (o *GetAPICustomersIDRatesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API customers ID rates params +func (o *GetAPICustomersIDRatesParams) WithContext(ctx context.Context) *GetAPICustomersIDRatesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API customers ID rates params +func (o *GetAPICustomersIDRatesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API customers ID rates params +func (o *GetAPICustomersIDRatesParams) WithHTTPClient(client *http.Client) *GetAPICustomersIDRatesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API customers ID rates params +func (o *GetAPICustomersIDRatesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get API customers ID rates params +func (o *GetAPICustomersIDRatesParams) WithID(id int64) *GetAPICustomersIDRatesParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API customers ID rates params +func (o *GetAPICustomersIDRatesParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPICustomersIDRatesParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/customer/get_api_customers_id_rates_responses.go b/client/customer/get_api_customers_id_rates_responses.go new file mode 100644 index 0000000..3980a6d --- /dev/null +++ b/client/customer/get_api_customers_id_rates_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPICustomersIDRatesReader is a Reader for the GetAPICustomersIDRates structure. +type GetAPICustomersIDRatesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPICustomersIDRatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPICustomersIDRatesOK() + 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()) + } +} + +// NewGetAPICustomersIDRatesOK creates a GetAPICustomersIDRatesOK with default headers values +func NewGetAPICustomersIDRatesOK() *GetAPICustomersIDRatesOK { + return &GetAPICustomersIDRatesOK{} +} + +/* +GetAPICustomersIDRatesOK describes a response with status code 200, with default header values. + +Returns a collection of customer rate entities +*/ +type GetAPICustomersIDRatesOK struct { + Payload []*models.CustomerRate +} + +// IsSuccess returns true when this get Api customers Id rates o k response has a 2xx status code +func (o *GetAPICustomersIDRatesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api customers Id rates o k response has a 3xx status code +func (o *GetAPICustomersIDRatesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api customers Id rates o k response has a 4xx status code +func (o *GetAPICustomersIDRatesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api customers Id rates o k response has a 5xx status code +func (o *GetAPICustomersIDRatesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api customers Id rates o k response a status code equal to that given +func (o *GetAPICustomersIDRatesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPICustomersIDRatesOK) Error() string { + return fmt.Sprintf("[GET /api/customers/{id}/rates][%d] getApiCustomersIdRatesOK %+v", 200, o.Payload) +} + +func (o *GetAPICustomersIDRatesOK) String() string { + return fmt.Sprintf("[GET /api/customers/{id}/rates][%d] getApiCustomersIdRatesOK %+v", 200, o.Payload) +} + +func (o *GetAPICustomersIDRatesOK) GetPayload() []*models.CustomerRate { + return o.Payload +} + +func (o *GetAPICustomersIDRatesOK) 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/customer/get_api_customers_id_responses.go b/client/customer/get_api_customers_id_responses.go new file mode 100644 index 0000000..89e6c01 --- /dev/null +++ b/client/customer/get_api_customers_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPICustomersIDReader is a Reader for the GetAPICustomersID structure. +type GetAPICustomersIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPICustomersIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPICustomersIDOK() + 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()) + } +} + +// NewGetAPICustomersIDOK creates a GetAPICustomersIDOK with default headers values +func NewGetAPICustomersIDOK() *GetAPICustomersIDOK { + return &GetAPICustomersIDOK{} +} + +/* +GetAPICustomersIDOK describes a response with status code 200, with default header values. + +Returns one customer entity +*/ +type GetAPICustomersIDOK struct { + Payload *models.CustomerEntity +} + +// IsSuccess returns true when this get Api customers Id o k response has a 2xx status code +func (o *GetAPICustomersIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api customers Id o k response has a 3xx status code +func (o *GetAPICustomersIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api customers Id o k response has a 4xx status code +func (o *GetAPICustomersIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api customers Id o k response has a 5xx status code +func (o *GetAPICustomersIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api customers Id o k response a status code equal to that given +func (o *GetAPICustomersIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPICustomersIDOK) Error() string { + return fmt.Sprintf("[GET /api/customers/{id}][%d] getApiCustomersIdOK %+v", 200, o.Payload) +} + +func (o *GetAPICustomersIDOK) String() string { + return fmt.Sprintf("[GET /api/customers/{id}][%d] getApiCustomersIdOK %+v", 200, o.Payload) +} + +func (o *GetAPICustomersIDOK) GetPayload() *models.CustomerEntity { + return o.Payload +} + +func (o *GetAPICustomersIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CustomerEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/customer/get_api_customers_parameters.go b/client/customer/get_api_customers_parameters.go new file mode 100644 index 0000000..1f66419 --- /dev/null +++ b/client/customer/get_api_customers_parameters.go @@ -0,0 +1,238 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" +) + +// NewGetAPICustomersParams creates a new GetAPICustomersParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPICustomersParams() *GetAPICustomersParams { + return &GetAPICustomersParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPICustomersParamsWithTimeout creates a new GetAPICustomersParams object +// with the ability to set a timeout on a request. +func NewGetAPICustomersParamsWithTimeout(timeout time.Duration) *GetAPICustomersParams { + return &GetAPICustomersParams{ + timeout: timeout, + } +} + +// NewGetAPICustomersParamsWithContext creates a new GetAPICustomersParams object +// with the ability to set a context for a request. +func NewGetAPICustomersParamsWithContext(ctx context.Context) *GetAPICustomersParams { + return &GetAPICustomersParams{ + Context: ctx, + } +} + +// NewGetAPICustomersParamsWithHTTPClient creates a new GetAPICustomersParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPICustomersParamsWithHTTPClient(client *http.Client) *GetAPICustomersParams { + return &GetAPICustomersParams{ + HTTPClient: client, + } +} + +/* +GetAPICustomersParams contains all the parameters to send to the API endpoint + + for the get API customers operation. + + Typically these are written to a http.Request. +*/ +type GetAPICustomersParams struct { + + /* Order. + + The result order. Allowed values: ASC, DESC (default: ASC) + */ + Order string + + /* OrderBy. + + The field by which results will be ordered. Allowed values: id, name (default: name) + */ + OrderBy string + + /* Term. + + Free search term + */ + Term *string + + /* Visible. + + Visibility status to filter activities (1=visible, 2=hidden, 3=both) + */ + Visible string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API customers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPICustomersParams) WithDefaults() *GetAPICustomersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API customers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPICustomersParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API customers params +func (o *GetAPICustomersParams) WithTimeout(timeout time.Duration) *GetAPICustomersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API customers params +func (o *GetAPICustomersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API customers params +func (o *GetAPICustomersParams) WithContext(ctx context.Context) *GetAPICustomersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API customers params +func (o *GetAPICustomersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API customers params +func (o *GetAPICustomersParams) WithHTTPClient(client *http.Client) *GetAPICustomersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API customers params +func (o *GetAPICustomersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithOrder adds the order to the get API customers params +func (o *GetAPICustomersParams) WithOrder(order string) *GetAPICustomersParams { + o.SetOrder(order) + return o +} + +// SetOrder adds the order to the get API customers params +func (o *GetAPICustomersParams) SetOrder(order string) { + o.Order = order +} + +// WithOrderBy adds the orderBy to the get API customers params +func (o *GetAPICustomersParams) WithOrderBy(orderBy string) *GetAPICustomersParams { + o.SetOrderBy(orderBy) + return o +} + +// SetOrderBy adds the orderBy to the get API customers params +func (o *GetAPICustomersParams) SetOrderBy(orderBy string) { + o.OrderBy = orderBy +} + +// WithTerm adds the term to the get API customers params +func (o *GetAPICustomersParams) WithTerm(term *string) *GetAPICustomersParams { + o.SetTerm(term) + return o +} + +// SetTerm adds the term to the get API customers params +func (o *GetAPICustomersParams) SetTerm(term *string) { + o.Term = term +} + +// WithVisible adds the visible to the get API customers params +func (o *GetAPICustomersParams) WithVisible(visible string) *GetAPICustomersParams { + o.SetVisible(visible) + return o +} + +// SetVisible adds the visible to the get API customers params +func (o *GetAPICustomersParams) SetVisible(visible string) { + o.Visible = visible +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPICustomersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param order + qrOrder := o.Order + qOrder := qrOrder + + if err := r.SetQueryParam("order", qOrder); err != nil { + return err + } + + // query param orderBy + qrOrderBy := o.OrderBy + qOrderBy := qrOrderBy + + if err := r.SetQueryParam("orderBy", qOrderBy); err != nil { + return err + } + + if o.Term != nil { + + // query param term + var qrTerm string + + if o.Term != nil { + qrTerm = *o.Term + } + qTerm := qrTerm + if qTerm != "" { + + if err := r.SetQueryParam("term", qTerm); err != nil { + return err + } + } + } + + // query param visible + qrVisible := o.Visible + qVisible := qrVisible + + if err := r.SetQueryParam("visible", qVisible); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/customer/get_api_customers_responses.go b/client/customer/get_api_customers_responses.go new file mode 100644 index 0000000..f78b36d --- /dev/null +++ b/client/customer/get_api_customers_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPICustomersReader is a Reader for the GetAPICustomers structure. +type GetAPICustomersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPICustomersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPICustomersOK() + 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()) + } +} + +// NewGetAPICustomersOK creates a GetAPICustomersOK with default headers values +func NewGetAPICustomersOK() *GetAPICustomersOK { + return &GetAPICustomersOK{} +} + +/* +GetAPICustomersOK describes a response with status code 200, with default header values. + +Returns a collection of customer entities +*/ +type GetAPICustomersOK struct { + Payload []*models.CustomerCollection +} + +// IsSuccess returns true when this get Api customers o k response has a 2xx status code +func (o *GetAPICustomersOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api customers o k response has a 3xx status code +func (o *GetAPICustomersOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api customers o k response has a 4xx status code +func (o *GetAPICustomersOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api customers o k response has a 5xx status code +func (o *GetAPICustomersOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api customers o k response a status code equal to that given +func (o *GetAPICustomersOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPICustomersOK) Error() string { + return fmt.Sprintf("[GET /api/customers][%d] getApiCustomersOK %+v", 200, o.Payload) +} + +func (o *GetAPICustomersOK) String() string { + return fmt.Sprintf("[GET /api/customers][%d] getApiCustomersOK %+v", 200, o.Payload) +} + +func (o *GetAPICustomersOK) GetPayload() []*models.CustomerCollection { + return o.Payload +} + +func (o *GetAPICustomersOK) 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/customer/patch_api_customers_id_meta_parameters.go b/client/customer/patch_api_customers_id_meta_parameters.go new file mode 100644 index 0000000..0b49c70 --- /dev/null +++ b/client/customer/patch_api_customers_id_meta_parameters.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" +) + +// NewPatchAPICustomersIDMetaParams creates a new PatchAPICustomersIDMetaParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPICustomersIDMetaParams() *PatchAPICustomersIDMetaParams { + return &PatchAPICustomersIDMetaParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPICustomersIDMetaParamsWithTimeout creates a new PatchAPICustomersIDMetaParams object +// with the ability to set a timeout on a request. +func NewPatchAPICustomersIDMetaParamsWithTimeout(timeout time.Duration) *PatchAPICustomersIDMetaParams { + return &PatchAPICustomersIDMetaParams{ + timeout: timeout, + } +} + +// NewPatchAPICustomersIDMetaParamsWithContext creates a new PatchAPICustomersIDMetaParams object +// with the ability to set a context for a request. +func NewPatchAPICustomersIDMetaParamsWithContext(ctx context.Context) *PatchAPICustomersIDMetaParams { + return &PatchAPICustomersIDMetaParams{ + Context: ctx, + } +} + +// NewPatchAPICustomersIDMetaParamsWithHTTPClient creates a new PatchAPICustomersIDMetaParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPICustomersIDMetaParamsWithHTTPClient(client *http.Client) *PatchAPICustomersIDMetaParams { + return &PatchAPICustomersIDMetaParams{ + HTTPClient: client, + } +} + +/* +PatchAPICustomersIDMetaParams contains all the parameters to send to the API endpoint + + for the patch API customers ID meta operation. + + Typically these are written to a http.Request. +*/ +type PatchAPICustomersIDMetaParams struct { + + // Body. + Body PatchAPICustomersIDMetaBody + + /* ID. + + Customer record ID to set the meta-field value for + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API customers ID meta params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPICustomersIDMetaParams) WithDefaults() *PatchAPICustomersIDMetaParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API customers ID meta params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPICustomersIDMetaParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API customers ID meta params +func (o *PatchAPICustomersIDMetaParams) WithTimeout(timeout time.Duration) *PatchAPICustomersIDMetaParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API customers ID meta params +func (o *PatchAPICustomersIDMetaParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API customers ID meta params +func (o *PatchAPICustomersIDMetaParams) WithContext(ctx context.Context) *PatchAPICustomersIDMetaParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API customers ID meta params +func (o *PatchAPICustomersIDMetaParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API customers ID meta params +func (o *PatchAPICustomersIDMetaParams) WithHTTPClient(client *http.Client) *PatchAPICustomersIDMetaParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API customers ID meta params +func (o *PatchAPICustomersIDMetaParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API customers ID meta params +func (o *PatchAPICustomersIDMetaParams) WithBody(body PatchAPICustomersIDMetaBody) *PatchAPICustomersIDMetaParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API customers ID meta params +func (o *PatchAPICustomersIDMetaParams) SetBody(body PatchAPICustomersIDMetaBody) { + o.Body = body +} + +// WithID adds the id to the patch API customers ID meta params +func (o *PatchAPICustomersIDMetaParams) WithID(id int64) *PatchAPICustomersIDMetaParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API customers ID meta params +func (o *PatchAPICustomersIDMetaParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPICustomersIDMetaParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/customer/patch_api_customers_id_meta_responses.go b/client/customer/patch_api_customers_id_meta_responses.go new file mode 100644 index 0000000..53549fa --- /dev/null +++ b/client/customer/patch_api_customers_id_meta_responses.go @@ -0,0 +1,176 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + + "decentral1se/go-kimai/models" +) + +// PatchAPICustomersIDMetaReader is a Reader for the PatchAPICustomersIDMeta structure. +type PatchAPICustomersIDMetaReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPICustomersIDMetaReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPICustomersIDMetaOK() + 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()) + } +} + +// NewPatchAPICustomersIDMetaOK creates a PatchAPICustomersIDMetaOK with default headers values +func NewPatchAPICustomersIDMetaOK() *PatchAPICustomersIDMetaOK { + return &PatchAPICustomersIDMetaOK{} +} + +/* +PatchAPICustomersIDMetaOK describes a response with status code 200, with default header values. + +Sets the value of an existing/configured meta-field. You cannot create unknown meta-fields, if the given name is not a configured meta-field, this will return an exception. +*/ +type PatchAPICustomersIDMetaOK struct { + Payload *models.CustomerEntity +} + +// IsSuccess returns true when this patch Api customers Id meta o k response has a 2xx status code +func (o *PatchAPICustomersIDMetaOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api customers Id meta o k response has a 3xx status code +func (o *PatchAPICustomersIDMetaOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api customers Id meta o k response has a 4xx status code +func (o *PatchAPICustomersIDMetaOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api customers Id meta o k response has a 5xx status code +func (o *PatchAPICustomersIDMetaOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api customers Id meta o k response a status code equal to that given +func (o *PatchAPICustomersIDMetaOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPICustomersIDMetaOK) Error() string { + return fmt.Sprintf("[PATCH /api/customers/{id}/meta][%d] patchApiCustomersIdMetaOK %+v", 200, o.Payload) +} + +func (o *PatchAPICustomersIDMetaOK) String() string { + return fmt.Sprintf("[PATCH /api/customers/{id}/meta][%d] patchApiCustomersIdMetaOK %+v", 200, o.Payload) +} + +func (o *PatchAPICustomersIDMetaOK) GetPayload() *models.CustomerEntity { + return o.Payload +} + +func (o *PatchAPICustomersIDMetaOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CustomerEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +PatchAPICustomersIDMetaBody patch API customers ID meta body +swagger:model PatchAPICustomersIDMetaBody +*/ +type PatchAPICustomersIDMetaBody struct { + + // The meta-field name + // Required: true + Name *string `json:"name"` + + // The meta-field value + // Required: true + Value *string `json:"value"` +} + +// Validate validates this patch API customers ID meta body +func (o *PatchAPICustomersIDMetaBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateName(formats); err != nil { + res = append(res, err) + } + + if err := o.validateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *PatchAPICustomersIDMetaBody) validateName(formats strfmt.Registry) error { + + if err := validate.Required("body"+"."+"name", "body", o.Name); err != nil { + return err + } + + return nil +} + +func (o *PatchAPICustomersIDMetaBody) validateValue(formats strfmt.Registry) error { + + if err := validate.Required("body"+"."+"value", "body", o.Value); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this patch API customers ID meta body based on context it is used +func (o *PatchAPICustomersIDMetaBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *PatchAPICustomersIDMetaBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *PatchAPICustomersIDMetaBody) UnmarshalBinary(b []byte) error { + var res PatchAPICustomersIDMetaBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/client/customer/patch_api_customers_id_parameters.go b/client/customer/patch_api_customers_id_parameters.go new file mode 100644 index 0000000..140ecf6 --- /dev/null +++ b/client/customer/patch_api_customers_id_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPatchAPICustomersIDParams creates a new PatchAPICustomersIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPICustomersIDParams() *PatchAPICustomersIDParams { + return &PatchAPICustomersIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPICustomersIDParamsWithTimeout creates a new PatchAPICustomersIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPICustomersIDParamsWithTimeout(timeout time.Duration) *PatchAPICustomersIDParams { + return &PatchAPICustomersIDParams{ + timeout: timeout, + } +} + +// NewPatchAPICustomersIDParamsWithContext creates a new PatchAPICustomersIDParams object +// with the ability to set a context for a request. +func NewPatchAPICustomersIDParamsWithContext(ctx context.Context) *PatchAPICustomersIDParams { + return &PatchAPICustomersIDParams{ + Context: ctx, + } +} + +// NewPatchAPICustomersIDParamsWithHTTPClient creates a new PatchAPICustomersIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPICustomersIDParamsWithHTTPClient(client *http.Client) *PatchAPICustomersIDParams { + return &PatchAPICustomersIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPICustomersIDParams contains all the parameters to send to the API endpoint + + for the patch API customers ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPICustomersIDParams struct { + + // Body. + Body *models.CustomerEditForm + + /* ID. + + Customer ID to update + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API customers ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPICustomersIDParams) WithDefaults() *PatchAPICustomersIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API customers ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPICustomersIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API customers ID params +func (o *PatchAPICustomersIDParams) WithTimeout(timeout time.Duration) *PatchAPICustomersIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API customers ID params +func (o *PatchAPICustomersIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API customers ID params +func (o *PatchAPICustomersIDParams) WithContext(ctx context.Context) *PatchAPICustomersIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API customers ID params +func (o *PatchAPICustomersIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API customers ID params +func (o *PatchAPICustomersIDParams) WithHTTPClient(client *http.Client) *PatchAPICustomersIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API customers ID params +func (o *PatchAPICustomersIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API customers ID params +func (o *PatchAPICustomersIDParams) WithBody(body *models.CustomerEditForm) *PatchAPICustomersIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API customers ID params +func (o *PatchAPICustomersIDParams) SetBody(body *models.CustomerEditForm) { + o.Body = body +} + +// WithID adds the id to the patch API customers ID params +func (o *PatchAPICustomersIDParams) WithID(id int64) *PatchAPICustomersIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API customers ID params +func (o *PatchAPICustomersIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPICustomersIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/customer/patch_api_customers_id_responses.go b/client/customer/patch_api_customers_id_responses.go new file mode 100644 index 0000000..50c7103 --- /dev/null +++ b/client/customer/patch_api_customers_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPICustomersIDReader is a Reader for the PatchAPICustomersID structure. +type PatchAPICustomersIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPICustomersIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPICustomersIDOK() + 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()) + } +} + +// NewPatchAPICustomersIDOK creates a PatchAPICustomersIDOK with default headers values +func NewPatchAPICustomersIDOK() *PatchAPICustomersIDOK { + return &PatchAPICustomersIDOK{} +} + +/* +PatchAPICustomersIDOK describes a response with status code 200, with default header values. + +Returns the updated customer +*/ +type PatchAPICustomersIDOK struct { + Payload *models.CustomerEntity +} + +// IsSuccess returns true when this patch Api customers Id o k response has a 2xx status code +func (o *PatchAPICustomersIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api customers Id o k response has a 3xx status code +func (o *PatchAPICustomersIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api customers Id o k response has a 4xx status code +func (o *PatchAPICustomersIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api customers Id o k response has a 5xx status code +func (o *PatchAPICustomersIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api customers Id o k response a status code equal to that given +func (o *PatchAPICustomersIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPICustomersIDOK) Error() string { + return fmt.Sprintf("[PATCH /api/customers/{id}][%d] patchApiCustomersIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPICustomersIDOK) String() string { + return fmt.Sprintf("[PATCH /api/customers/{id}][%d] patchApiCustomersIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPICustomersIDOK) GetPayload() *models.CustomerEntity { + return o.Payload +} + +func (o *PatchAPICustomersIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CustomerEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/customer/post_api_customers_id_rates_parameters.go b/client/customer/post_api_customers_id_rates_parameters.go new file mode 100644 index 0000000..d9c6081 --- /dev/null +++ b/client/customer/post_api_customers_id_rates_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPostAPICustomersIDRatesParams creates a new PostAPICustomersIDRatesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPICustomersIDRatesParams() *PostAPICustomersIDRatesParams { + return &PostAPICustomersIDRatesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPICustomersIDRatesParamsWithTimeout creates a new PostAPICustomersIDRatesParams object +// with the ability to set a timeout on a request. +func NewPostAPICustomersIDRatesParamsWithTimeout(timeout time.Duration) *PostAPICustomersIDRatesParams { + return &PostAPICustomersIDRatesParams{ + timeout: timeout, + } +} + +// NewPostAPICustomersIDRatesParamsWithContext creates a new PostAPICustomersIDRatesParams object +// with the ability to set a context for a request. +func NewPostAPICustomersIDRatesParamsWithContext(ctx context.Context) *PostAPICustomersIDRatesParams { + return &PostAPICustomersIDRatesParams{ + Context: ctx, + } +} + +// NewPostAPICustomersIDRatesParamsWithHTTPClient creates a new PostAPICustomersIDRatesParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPICustomersIDRatesParamsWithHTTPClient(client *http.Client) *PostAPICustomersIDRatesParams { + return &PostAPICustomersIDRatesParams{ + HTTPClient: client, + } +} + +/* +PostAPICustomersIDRatesParams contains all the parameters to send to the API endpoint + + for the post API customers ID rates operation. + + Typically these are written to a http.Request. +*/ +type PostAPICustomersIDRatesParams struct { + + // Body. + Body *models.CustomerRateForm + + /* ID. + + The customer to add the rate for + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API customers ID rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPICustomersIDRatesParams) WithDefaults() *PostAPICustomersIDRatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API customers ID rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPICustomersIDRatesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API customers ID rates params +func (o *PostAPICustomersIDRatesParams) WithTimeout(timeout time.Duration) *PostAPICustomersIDRatesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API customers ID rates params +func (o *PostAPICustomersIDRatesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API customers ID rates params +func (o *PostAPICustomersIDRatesParams) WithContext(ctx context.Context) *PostAPICustomersIDRatesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API customers ID rates params +func (o *PostAPICustomersIDRatesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API customers ID rates params +func (o *PostAPICustomersIDRatesParams) WithHTTPClient(client *http.Client) *PostAPICustomersIDRatesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API customers ID rates params +func (o *PostAPICustomersIDRatesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API customers ID rates params +func (o *PostAPICustomersIDRatesParams) WithBody(body *models.CustomerRateForm) *PostAPICustomersIDRatesParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API customers ID rates params +func (o *PostAPICustomersIDRatesParams) SetBody(body *models.CustomerRateForm) { + o.Body = body +} + +// WithID adds the id to the post API customers ID rates params +func (o *PostAPICustomersIDRatesParams) WithID(id int64) *PostAPICustomersIDRatesParams { + o.SetID(id) + return o +} + +// SetID adds the id to the post API customers ID rates params +func (o *PostAPICustomersIDRatesParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPICustomersIDRatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/customer/post_api_customers_id_rates_responses.go b/client/customer/post_api_customers_id_rates_responses.go new file mode 100644 index 0000000..501d05e --- /dev/null +++ b/client/customer/post_api_customers_id_rates_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPICustomersIDRatesReader is a Reader for the PostAPICustomersIDRates structure. +type PostAPICustomersIDRatesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPICustomersIDRatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPICustomersIDRatesOK() + 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()) + } +} + +// NewPostAPICustomersIDRatesOK creates a PostAPICustomersIDRatesOK with default headers values +func NewPostAPICustomersIDRatesOK() *PostAPICustomersIDRatesOK { + return &PostAPICustomersIDRatesOK{} +} + +/* +PostAPICustomersIDRatesOK describes a response with status code 200, with default header values. + +Returns the new created rate +*/ +type PostAPICustomersIDRatesOK struct { + Payload *models.CustomerRate +} + +// IsSuccess returns true when this post Api customers Id rates o k response has a 2xx status code +func (o *PostAPICustomersIDRatesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api customers Id rates o k response has a 3xx status code +func (o *PostAPICustomersIDRatesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api customers Id rates o k response has a 4xx status code +func (o *PostAPICustomersIDRatesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api customers Id rates o k response has a 5xx status code +func (o *PostAPICustomersIDRatesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api customers Id rates o k response a status code equal to that given +func (o *PostAPICustomersIDRatesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPICustomersIDRatesOK) Error() string { + return fmt.Sprintf("[POST /api/customers/{id}/rates][%d] postApiCustomersIdRatesOK %+v", 200, o.Payload) +} + +func (o *PostAPICustomersIDRatesOK) String() string { + return fmt.Sprintf("[POST /api/customers/{id}/rates][%d] postApiCustomersIdRatesOK %+v", 200, o.Payload) +} + +func (o *PostAPICustomersIDRatesOK) GetPayload() *models.CustomerRate { + return o.Payload +} + +func (o *PostAPICustomersIDRatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CustomerRate) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/customer/post_api_customers_parameters.go b/client/customer/post_api_customers_parameters.go new file mode 100644 index 0000000..5f20d39 --- /dev/null +++ b/client/customer/post_api_customers_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPostAPICustomersParams creates a new PostAPICustomersParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPICustomersParams() *PostAPICustomersParams { + return &PostAPICustomersParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPICustomersParamsWithTimeout creates a new PostAPICustomersParams object +// with the ability to set a timeout on a request. +func NewPostAPICustomersParamsWithTimeout(timeout time.Duration) *PostAPICustomersParams { + return &PostAPICustomersParams{ + timeout: timeout, + } +} + +// NewPostAPICustomersParamsWithContext creates a new PostAPICustomersParams object +// with the ability to set a context for a request. +func NewPostAPICustomersParamsWithContext(ctx context.Context) *PostAPICustomersParams { + return &PostAPICustomersParams{ + Context: ctx, + } +} + +// NewPostAPICustomersParamsWithHTTPClient creates a new PostAPICustomersParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPICustomersParamsWithHTTPClient(client *http.Client) *PostAPICustomersParams { + return &PostAPICustomersParams{ + HTTPClient: client, + } +} + +/* +PostAPICustomersParams contains all the parameters to send to the API endpoint + + for the post API customers operation. + + Typically these are written to a http.Request. +*/ +type PostAPICustomersParams struct { + + // Body. + Body *models.CustomerEditForm + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API customers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPICustomersParams) WithDefaults() *PostAPICustomersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API customers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPICustomersParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API customers params +func (o *PostAPICustomersParams) WithTimeout(timeout time.Duration) *PostAPICustomersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API customers params +func (o *PostAPICustomersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API customers params +func (o *PostAPICustomersParams) WithContext(ctx context.Context) *PostAPICustomersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API customers params +func (o *PostAPICustomersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API customers params +func (o *PostAPICustomersParams) WithHTTPClient(client *http.Client) *PostAPICustomersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API customers params +func (o *PostAPICustomersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API customers params +func (o *PostAPICustomersParams) WithBody(body *models.CustomerEditForm) *PostAPICustomersParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API customers params +func (o *PostAPICustomersParams) SetBody(body *models.CustomerEditForm) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPICustomersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/customer/post_api_customers_responses.go b/client/customer/post_api_customers_responses.go new file mode 100644 index 0000000..375008c --- /dev/null +++ b/client/customer/post_api_customers_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package customer + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPICustomersReader is a Reader for the PostAPICustomers structure. +type PostAPICustomersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPICustomersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPICustomersOK() + 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()) + } +} + +// NewPostAPICustomersOK creates a PostAPICustomersOK with default headers values +func NewPostAPICustomersOK() *PostAPICustomersOK { + return &PostAPICustomersOK{} +} + +/* +PostAPICustomersOK describes a response with status code 200, with default header values. + +Returns the new created customer +*/ +type PostAPICustomersOK struct { + Payload *models.CustomerEntity +} + +// IsSuccess returns true when this post Api customers o k response has a 2xx status code +func (o *PostAPICustomersOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api customers o k response has a 3xx status code +func (o *PostAPICustomersOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api customers o k response has a 4xx status code +func (o *PostAPICustomersOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api customers o k response has a 5xx status code +func (o *PostAPICustomersOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api customers o k response a status code equal to that given +func (o *PostAPICustomersOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPICustomersOK) Error() string { + return fmt.Sprintf("[POST /api/customers][%d] postApiCustomersOK %+v", 200, o.Payload) +} + +func (o *PostAPICustomersOK) String() string { + return fmt.Sprintf("[POST /api/customers][%d] postApiCustomersOK %+v", 200, o.Payload) +} + +func (o *PostAPICustomersOK) GetPayload() *models.CustomerEntity { + return o.Payload +} + +func (o *PostAPICustomersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CustomerEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/default_operations/default_operations_client.go b/client/default_operations/default_operations_client.go new file mode 100644 index 0000000..b1f2e4c --- /dev/null +++ b/client/default_operations/default_operations_client.go @@ -0,0 +1,237 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package default_operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new default operations API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for default operations API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetAPIConfigI18n(params *GetAPIConfigI18nParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIConfigI18nOK, error) + + GetAPIConfigTimesheet(params *GetAPIConfigTimesheetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIConfigTimesheetOK, error) + + GetAPIPing(params *GetAPIPingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error + + GetAPIPlugins(params *GetAPIPluginsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIPluginsOK, error) + + GetAPIVersion(params *GetAPIVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIVersionOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetAPIConfigI18n returns the user specific locale configuration +*/ +func (a *Client) GetAPIConfigI18n(params *GetAPIConfigI18nParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIConfigI18nOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIConfigI18nParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIConfigI18n", + Method: "GET", + PathPattern: "/api/config/i18n", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIConfigI18nReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIConfigI18nOK) + 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 GetAPIConfigI18n: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIConfigTimesheet returns the timesheet configuration +*/ +func (a *Client) GetAPIConfigTimesheet(params *GetAPIConfigTimesheetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIConfigTimesheetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIConfigTimesheetParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIConfigTimesheet", + Method: "GET", + PathPattern: "/api/config/timesheet", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIConfigTimesheetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIConfigTimesheetOK) + 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 GetAPIConfigTimesheet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIPing as testing route for the API +*/ +func (a *Client) GetAPIPing(params *GetAPIPingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIPingParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIPing", + Method: "GET", + PathPattern: "/api/ping", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIPingReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + _, err := a.transport.Submit(op) + if err != nil { + return err + } + return nil +} + +/* +GetAPIPlugins returns information about installed plugins +*/ +func (a *Client) GetAPIPlugins(params *GetAPIPluginsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIPluginsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIPluginsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIPlugins", + Method: "GET", + PathPattern: "/api/plugins", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIPluginsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIPluginsOK) + 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 GetAPIPlugins: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIVersion returns information about the kimai release +*/ +func (a *Client) GetAPIVersion(params *GetAPIVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIVersionOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIVersionParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIVersion", + Method: "GET", + PathPattern: "/api/version", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIVersionReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIVersionOK) + 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 GetAPIVersion: 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/default_operations/get_api_config_i18n_parameters.go b/client/default_operations/get_api_config_i18n_parameters.go new file mode 100644 index 0000000..171f1ed --- /dev/null +++ b/client/default_operations/get_api_config_i18n_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package default_operations + +// 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" +) + +// NewGetAPIConfigI18nParams creates a new GetAPIConfigI18nParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIConfigI18nParams() *GetAPIConfigI18nParams { + return &GetAPIConfigI18nParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIConfigI18nParamsWithTimeout creates a new GetAPIConfigI18nParams object +// with the ability to set a timeout on a request. +func NewGetAPIConfigI18nParamsWithTimeout(timeout time.Duration) *GetAPIConfigI18nParams { + return &GetAPIConfigI18nParams{ + timeout: timeout, + } +} + +// NewGetAPIConfigI18nParamsWithContext creates a new GetAPIConfigI18nParams object +// with the ability to set a context for a request. +func NewGetAPIConfigI18nParamsWithContext(ctx context.Context) *GetAPIConfigI18nParams { + return &GetAPIConfigI18nParams{ + Context: ctx, + } +} + +// NewGetAPIConfigI18nParamsWithHTTPClient creates a new GetAPIConfigI18nParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIConfigI18nParamsWithHTTPClient(client *http.Client) *GetAPIConfigI18nParams { + return &GetAPIConfigI18nParams{ + HTTPClient: client, + } +} + +/* +GetAPIConfigI18nParams contains all the parameters to send to the API endpoint + + for the get API config i18n operation. + + Typically these are written to a http.Request. +*/ +type GetAPIConfigI18nParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API config i18n params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIConfigI18nParams) WithDefaults() *GetAPIConfigI18nParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API config i18n params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIConfigI18nParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API config i18n params +func (o *GetAPIConfigI18nParams) WithTimeout(timeout time.Duration) *GetAPIConfigI18nParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API config i18n params +func (o *GetAPIConfigI18nParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API config i18n params +func (o *GetAPIConfigI18nParams) WithContext(ctx context.Context) *GetAPIConfigI18nParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API config i18n params +func (o *GetAPIConfigI18nParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API config i18n params +func (o *GetAPIConfigI18nParams) WithHTTPClient(client *http.Client) *GetAPIConfigI18nParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API config i18n params +func (o *GetAPIConfigI18nParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIConfigI18nParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/default_operations/get_api_config_i18n_responses.go b/client/default_operations/get_api_config_i18n_responses.go new file mode 100644 index 0000000..e3f2070 --- /dev/null +++ b/client/default_operations/get_api_config_i18n_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package default_operations + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIConfigI18nReader is a Reader for the GetAPIConfigI18n structure. +type GetAPIConfigI18nReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIConfigI18nReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIConfigI18nOK() + 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()) + } +} + +// NewGetAPIConfigI18nOK creates a GetAPIConfigI18nOK with default headers values +func NewGetAPIConfigI18nOK() *GetAPIConfigI18nOK { + return &GetAPIConfigI18nOK{} +} + +/* +GetAPIConfigI18nOK describes a response with status code 200, with default header values. + +Returns the locale specific configurations for this user +*/ +type GetAPIConfigI18nOK struct { + Payload *models.I18nConfig +} + +// IsSuccess returns true when this get Api config i18n o k response has a 2xx status code +func (o *GetAPIConfigI18nOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api config i18n o k response has a 3xx status code +func (o *GetAPIConfigI18nOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api config i18n o k response has a 4xx status code +func (o *GetAPIConfigI18nOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api config i18n o k response has a 5xx status code +func (o *GetAPIConfigI18nOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api config i18n o k response a status code equal to that given +func (o *GetAPIConfigI18nOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIConfigI18nOK) Error() string { + return fmt.Sprintf("[GET /api/config/i18n][%d] getApiConfigI18nOK %+v", 200, o.Payload) +} + +func (o *GetAPIConfigI18nOK) String() string { + return fmt.Sprintf("[GET /api/config/i18n][%d] getApiConfigI18nOK %+v", 200, o.Payload) +} + +func (o *GetAPIConfigI18nOK) GetPayload() *models.I18nConfig { + return o.Payload +} + +func (o *GetAPIConfigI18nOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.I18nConfig) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/default_operations/get_api_config_timesheet_parameters.go b/client/default_operations/get_api_config_timesheet_parameters.go new file mode 100644 index 0000000..d31be9c --- /dev/null +++ b/client/default_operations/get_api_config_timesheet_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package default_operations + +// 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" +) + +// NewGetAPIConfigTimesheetParams creates a new GetAPIConfigTimesheetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIConfigTimesheetParams() *GetAPIConfigTimesheetParams { + return &GetAPIConfigTimesheetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIConfigTimesheetParamsWithTimeout creates a new GetAPIConfigTimesheetParams object +// with the ability to set a timeout on a request. +func NewGetAPIConfigTimesheetParamsWithTimeout(timeout time.Duration) *GetAPIConfigTimesheetParams { + return &GetAPIConfigTimesheetParams{ + timeout: timeout, + } +} + +// NewGetAPIConfigTimesheetParamsWithContext creates a new GetAPIConfigTimesheetParams object +// with the ability to set a context for a request. +func NewGetAPIConfigTimesheetParamsWithContext(ctx context.Context) *GetAPIConfigTimesheetParams { + return &GetAPIConfigTimesheetParams{ + Context: ctx, + } +} + +// NewGetAPIConfigTimesheetParamsWithHTTPClient creates a new GetAPIConfigTimesheetParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIConfigTimesheetParamsWithHTTPClient(client *http.Client) *GetAPIConfigTimesheetParams { + return &GetAPIConfigTimesheetParams{ + HTTPClient: client, + } +} + +/* +GetAPIConfigTimesheetParams contains all the parameters to send to the API endpoint + + for the get API config timesheet operation. + + Typically these are written to a http.Request. +*/ +type GetAPIConfigTimesheetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API config timesheet params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIConfigTimesheetParams) WithDefaults() *GetAPIConfigTimesheetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API config timesheet params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIConfigTimesheetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API config timesheet params +func (o *GetAPIConfigTimesheetParams) WithTimeout(timeout time.Duration) *GetAPIConfigTimesheetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API config timesheet params +func (o *GetAPIConfigTimesheetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API config timesheet params +func (o *GetAPIConfigTimesheetParams) WithContext(ctx context.Context) *GetAPIConfigTimesheetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API config timesheet params +func (o *GetAPIConfigTimesheetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API config timesheet params +func (o *GetAPIConfigTimesheetParams) WithHTTPClient(client *http.Client) *GetAPIConfigTimesheetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API config timesheet params +func (o *GetAPIConfigTimesheetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIConfigTimesheetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/default_operations/get_api_config_timesheet_responses.go b/client/default_operations/get_api_config_timesheet_responses.go new file mode 100644 index 0000000..7e58cf7 --- /dev/null +++ b/client/default_operations/get_api_config_timesheet_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package default_operations + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIConfigTimesheetReader is a Reader for the GetAPIConfigTimesheet structure. +type GetAPIConfigTimesheetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIConfigTimesheetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIConfigTimesheetOK() + 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()) + } +} + +// NewGetAPIConfigTimesheetOK creates a GetAPIConfigTimesheetOK with default headers values +func NewGetAPIConfigTimesheetOK() *GetAPIConfigTimesheetOK { + return &GetAPIConfigTimesheetOK{} +} + +/* +GetAPIConfigTimesheetOK describes a response with status code 200, with default header values. + +Returns the instance specific timesheet configuration +*/ +type GetAPIConfigTimesheetOK struct { + Payload *models.TimesheetConfig +} + +// IsSuccess returns true when this get Api config timesheet o k response has a 2xx status code +func (o *GetAPIConfigTimesheetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api config timesheet o k response has a 3xx status code +func (o *GetAPIConfigTimesheetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api config timesheet o k response has a 4xx status code +func (o *GetAPIConfigTimesheetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api config timesheet o k response has a 5xx status code +func (o *GetAPIConfigTimesheetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api config timesheet o k response a status code equal to that given +func (o *GetAPIConfigTimesheetOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIConfigTimesheetOK) Error() string { + return fmt.Sprintf("[GET /api/config/timesheet][%d] getApiConfigTimesheetOK %+v", 200, o.Payload) +} + +func (o *GetAPIConfigTimesheetOK) String() string { + return fmt.Sprintf("[GET /api/config/timesheet][%d] getApiConfigTimesheetOK %+v", 200, o.Payload) +} + +func (o *GetAPIConfigTimesheetOK) GetPayload() *models.TimesheetConfig { + return o.Payload +} + +func (o *GetAPIConfigTimesheetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TimesheetConfig) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/default_operations/get_api_ping_parameters.go b/client/default_operations/get_api_ping_parameters.go new file mode 100644 index 0000000..2490bc9 --- /dev/null +++ b/client/default_operations/get_api_ping_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package default_operations + +// 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" +) + +// NewGetAPIPingParams creates a new GetAPIPingParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIPingParams() *GetAPIPingParams { + return &GetAPIPingParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIPingParamsWithTimeout creates a new GetAPIPingParams object +// with the ability to set a timeout on a request. +func NewGetAPIPingParamsWithTimeout(timeout time.Duration) *GetAPIPingParams { + return &GetAPIPingParams{ + timeout: timeout, + } +} + +// NewGetAPIPingParamsWithContext creates a new GetAPIPingParams object +// with the ability to set a context for a request. +func NewGetAPIPingParamsWithContext(ctx context.Context) *GetAPIPingParams { + return &GetAPIPingParams{ + Context: ctx, + } +} + +// NewGetAPIPingParamsWithHTTPClient creates a new GetAPIPingParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIPingParamsWithHTTPClient(client *http.Client) *GetAPIPingParams { + return &GetAPIPingParams{ + HTTPClient: client, + } +} + +/* +GetAPIPingParams contains all the parameters to send to the API endpoint + + for the get API ping operation. + + Typically these are written to a http.Request. +*/ +type GetAPIPingParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API ping params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIPingParams) WithDefaults() *GetAPIPingParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API ping params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIPingParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API ping params +func (o *GetAPIPingParams) WithTimeout(timeout time.Duration) *GetAPIPingParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API ping params +func (o *GetAPIPingParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API ping params +func (o *GetAPIPingParams) WithContext(ctx context.Context) *GetAPIPingParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API ping params +func (o *GetAPIPingParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API ping params +func (o *GetAPIPingParams) WithHTTPClient(client *http.Client) *GetAPIPingParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API ping params +func (o *GetAPIPingParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIPingParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/default_operations/get_api_ping_responses.go b/client/default_operations/get_api_ping_responses.go new file mode 100644 index 0000000..9b1549e --- /dev/null +++ b/client/default_operations/get_api_ping_responses.go @@ -0,0 +1,89 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package default_operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// GetAPIPingReader is a Reader for the GetAPIPing structure. +type GetAPIPingReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIPingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + result := NewGetAPIPingDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result +} + +// NewGetAPIPingDefault creates a GetAPIPingDefault with default headers values +func NewGetAPIPingDefault(code int) *GetAPIPingDefault { + return &GetAPIPingDefault{ + _statusCode: code, + } +} + +/* +GetAPIPingDefault describes a response with status code -1, with default header values. + +GetAPIPingDefault get API ping default +*/ +type GetAPIPingDefault struct { + _statusCode int +} + +// Code gets the status code for the get API ping default response +func (o *GetAPIPingDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this get API ping default response has a 2xx status code +func (o *GetAPIPingDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get API ping default response has a 3xx status code +func (o *GetAPIPingDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get API ping default response has a 4xx status code +func (o *GetAPIPingDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get API ping default response has a 5xx status code +func (o *GetAPIPingDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get API ping default response a status code equal to that given +func (o *GetAPIPingDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *GetAPIPingDefault) Error() string { + return fmt.Sprintf("[GET /api/ping][%d] GetAPIPing default ", o._statusCode) +} + +func (o *GetAPIPingDefault) String() string { + return fmt.Sprintf("[GET /api/ping][%d] GetAPIPing default ", o._statusCode) +} + +func (o *GetAPIPingDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/default_operations/get_api_plugins_parameters.go b/client/default_operations/get_api_plugins_parameters.go new file mode 100644 index 0000000..6509440 --- /dev/null +++ b/client/default_operations/get_api_plugins_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package default_operations + +// 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" +) + +// NewGetAPIPluginsParams creates a new GetAPIPluginsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIPluginsParams() *GetAPIPluginsParams { + return &GetAPIPluginsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIPluginsParamsWithTimeout creates a new GetAPIPluginsParams object +// with the ability to set a timeout on a request. +func NewGetAPIPluginsParamsWithTimeout(timeout time.Duration) *GetAPIPluginsParams { + return &GetAPIPluginsParams{ + timeout: timeout, + } +} + +// NewGetAPIPluginsParamsWithContext creates a new GetAPIPluginsParams object +// with the ability to set a context for a request. +func NewGetAPIPluginsParamsWithContext(ctx context.Context) *GetAPIPluginsParams { + return &GetAPIPluginsParams{ + Context: ctx, + } +} + +// NewGetAPIPluginsParamsWithHTTPClient creates a new GetAPIPluginsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIPluginsParamsWithHTTPClient(client *http.Client) *GetAPIPluginsParams { + return &GetAPIPluginsParams{ + HTTPClient: client, + } +} + +/* +GetAPIPluginsParams contains all the parameters to send to the API endpoint + + for the get API plugins operation. + + Typically these are written to a http.Request. +*/ +type GetAPIPluginsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API plugins params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIPluginsParams) WithDefaults() *GetAPIPluginsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API plugins params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIPluginsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API plugins params +func (o *GetAPIPluginsParams) WithTimeout(timeout time.Duration) *GetAPIPluginsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API plugins params +func (o *GetAPIPluginsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API plugins params +func (o *GetAPIPluginsParams) WithContext(ctx context.Context) *GetAPIPluginsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API plugins params +func (o *GetAPIPluginsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API plugins params +func (o *GetAPIPluginsParams) WithHTTPClient(client *http.Client) *GetAPIPluginsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API plugins params +func (o *GetAPIPluginsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIPluginsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/default_operations/get_api_plugins_responses.go b/client/default_operations/get_api_plugins_responses.go new file mode 100644 index 0000000..9922b46 --- /dev/null +++ b/client/default_operations/get_api_plugins_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package default_operations + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIPluginsReader is a Reader for the GetAPIPlugins structure. +type GetAPIPluginsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIPluginsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIPluginsOK() + 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()) + } +} + +// NewGetAPIPluginsOK creates a GetAPIPluginsOK with default headers values +func NewGetAPIPluginsOK() *GetAPIPluginsOK { + return &GetAPIPluginsOK{} +} + +/* +GetAPIPluginsOK describes a response with status code 200, with default header values. + +Returns a list of plugin names and versions +*/ +type GetAPIPluginsOK struct { + Payload []*models.Plugin +} + +// IsSuccess returns true when this get Api plugins o k response has a 2xx status code +func (o *GetAPIPluginsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api plugins o k response has a 3xx status code +func (o *GetAPIPluginsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api plugins o k response has a 4xx status code +func (o *GetAPIPluginsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api plugins o k response has a 5xx status code +func (o *GetAPIPluginsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api plugins o k response a status code equal to that given +func (o *GetAPIPluginsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIPluginsOK) Error() string { + return fmt.Sprintf("[GET /api/plugins][%d] getApiPluginsOK %+v", 200, o.Payload) +} + +func (o *GetAPIPluginsOK) String() string { + return fmt.Sprintf("[GET /api/plugins][%d] getApiPluginsOK %+v", 200, o.Payload) +} + +func (o *GetAPIPluginsOK) GetPayload() []*models.Plugin { + return o.Payload +} + +func (o *GetAPIPluginsOK) 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/default_operations/get_api_version_parameters.go b/client/default_operations/get_api_version_parameters.go new file mode 100644 index 0000000..6b5f0ba --- /dev/null +++ b/client/default_operations/get_api_version_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package default_operations + +// 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" +) + +// NewGetAPIVersionParams creates a new GetAPIVersionParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIVersionParams() *GetAPIVersionParams { + return &GetAPIVersionParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIVersionParamsWithTimeout creates a new GetAPIVersionParams object +// with the ability to set a timeout on a request. +func NewGetAPIVersionParamsWithTimeout(timeout time.Duration) *GetAPIVersionParams { + return &GetAPIVersionParams{ + timeout: timeout, + } +} + +// NewGetAPIVersionParamsWithContext creates a new GetAPIVersionParams object +// with the ability to set a context for a request. +func NewGetAPIVersionParamsWithContext(ctx context.Context) *GetAPIVersionParams { + return &GetAPIVersionParams{ + Context: ctx, + } +} + +// NewGetAPIVersionParamsWithHTTPClient creates a new GetAPIVersionParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIVersionParamsWithHTTPClient(client *http.Client) *GetAPIVersionParams { + return &GetAPIVersionParams{ + HTTPClient: client, + } +} + +/* +GetAPIVersionParams contains all the parameters to send to the API endpoint + + for the get API version operation. + + Typically these are written to a http.Request. +*/ +type GetAPIVersionParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIVersionParams) WithDefaults() *GetAPIVersionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIVersionParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API version params +func (o *GetAPIVersionParams) WithTimeout(timeout time.Duration) *GetAPIVersionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API version params +func (o *GetAPIVersionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API version params +func (o *GetAPIVersionParams) WithContext(ctx context.Context) *GetAPIVersionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API version params +func (o *GetAPIVersionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API version params +func (o *GetAPIVersionParams) WithHTTPClient(client *http.Client) *GetAPIVersionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API version params +func (o *GetAPIVersionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIVersionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/default_operations/get_api_version_responses.go b/client/default_operations/get_api_version_responses.go new file mode 100644 index 0000000..82fab41 --- /dev/null +++ b/client/default_operations/get_api_version_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package default_operations + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIVersionReader is a Reader for the GetAPIVersion structure. +type GetAPIVersionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIVersionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIVersionOK() + 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()) + } +} + +// NewGetAPIVersionOK creates a GetAPIVersionOK with default headers values +func NewGetAPIVersionOK() *GetAPIVersionOK { + return &GetAPIVersionOK{} +} + +/* +GetAPIVersionOK describes a response with status code 200, with default header values. + +Returns version information about the current release +*/ +type GetAPIVersionOK struct { + Payload *models.Version +} + +// IsSuccess returns true when this get Api version o k response has a 2xx status code +func (o *GetAPIVersionOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api version o k response has a 3xx status code +func (o *GetAPIVersionOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api version o k response has a 4xx status code +func (o *GetAPIVersionOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api version o k response has a 5xx status code +func (o *GetAPIVersionOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api version o k response a status code equal to that given +func (o *GetAPIVersionOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIVersionOK) Error() string { + return fmt.Sprintf("[GET /api/version][%d] getApiVersionOK %+v", 200, o.Payload) +} + +func (o *GetAPIVersionOK) String() string { + return fmt.Sprintf("[GET /api/version][%d] getApiVersionOK %+v", 200, o.Payload) +} + +func (o *GetAPIVersionOK) GetPayload() *models.Version { + return o.Payload +} + +func (o *GetAPIVersionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Version) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/expense/delete_api_expenses_id_parameters.go b/client/expense/delete_api_expenses_id_parameters.go new file mode 100644 index 0000000..822da4d --- /dev/null +++ b/client/expense/delete_api_expenses_id_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// 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" +) + +// NewDeleteAPIExpensesIDParams creates a new DeleteAPIExpensesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPIExpensesIDParams() *DeleteAPIExpensesIDParams { + return &DeleteAPIExpensesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPIExpensesIDParamsWithTimeout creates a new DeleteAPIExpensesIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPIExpensesIDParamsWithTimeout(timeout time.Duration) *DeleteAPIExpensesIDParams { + return &DeleteAPIExpensesIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPIExpensesIDParamsWithContext creates a new DeleteAPIExpensesIDParams object +// with the ability to set a context for a request. +func NewDeleteAPIExpensesIDParamsWithContext(ctx context.Context) *DeleteAPIExpensesIDParams { + return &DeleteAPIExpensesIDParams{ + Context: ctx, + } +} + +// NewDeleteAPIExpensesIDParamsWithHTTPClient creates a new DeleteAPIExpensesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPIExpensesIDParamsWithHTTPClient(client *http.Client) *DeleteAPIExpensesIDParams { + return &DeleteAPIExpensesIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPIExpensesIDParams contains all the parameters to send to the API endpoint + + for the delete API expenses ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPIExpensesIDParams struct { + + /* ID. + + Expense record ID to delete + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API expenses ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIExpensesIDParams) WithDefaults() *DeleteAPIExpensesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API expenses ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIExpensesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API expenses ID params +func (o *DeleteAPIExpensesIDParams) WithTimeout(timeout time.Duration) *DeleteAPIExpensesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API expenses ID params +func (o *DeleteAPIExpensesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API expenses ID params +func (o *DeleteAPIExpensesIDParams) WithContext(ctx context.Context) *DeleteAPIExpensesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API expenses ID params +func (o *DeleteAPIExpensesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API expenses ID params +func (o *DeleteAPIExpensesIDParams) WithHTTPClient(client *http.Client) *DeleteAPIExpensesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API expenses ID params +func (o *DeleteAPIExpensesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete API expenses ID params +func (o *DeleteAPIExpensesIDParams) WithID(id int64) *DeleteAPIExpensesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API expenses ID params +func (o *DeleteAPIExpensesIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPIExpensesIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/expense/delete_api_expenses_id_responses.go b/client/expense/delete_api_expenses_id_responses.go new file mode 100644 index 0000000..6f84751 --- /dev/null +++ b/client/expense/delete_api_expenses_id_responses.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// DeleteAPIExpensesIDReader is a Reader for the DeleteAPIExpensesID structure. +type DeleteAPIExpensesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPIExpensesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 204: + result := NewDeleteAPIExpensesIDNoContent() + 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()) + } +} + +// NewDeleteAPIExpensesIDNoContent creates a DeleteAPIExpensesIDNoContent with default headers values +func NewDeleteAPIExpensesIDNoContent() *DeleteAPIExpensesIDNoContent { + return &DeleteAPIExpensesIDNoContent{} +} + +/* +DeleteAPIExpensesIDNoContent describes a response with status code 204, with default header values. + +Delete one expense record +*/ +type DeleteAPIExpensesIDNoContent struct { +} + +// IsSuccess returns true when this delete Api expenses Id no content response has a 2xx status code +func (o *DeleteAPIExpensesIDNoContent) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api expenses Id no content response has a 3xx status code +func (o *DeleteAPIExpensesIDNoContent) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api expenses Id no content response has a 4xx status code +func (o *DeleteAPIExpensesIDNoContent) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api expenses Id no content response has a 5xx status code +func (o *DeleteAPIExpensesIDNoContent) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api expenses Id no content response a status code equal to that given +func (o *DeleteAPIExpensesIDNoContent) IsCode(code int) bool { + return code == 204 +} + +func (o *DeleteAPIExpensesIDNoContent) Error() string { + return fmt.Sprintf("[DELETE /api/expenses/{id}][%d] deleteApiExpensesIdNoContent ", 204) +} + +func (o *DeleteAPIExpensesIDNoContent) String() string { + return fmt.Sprintf("[DELETE /api/expenses/{id}][%d] deleteApiExpensesIdNoContent ", 204) +} + +func (o *DeleteAPIExpensesIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/expense/expense_client.go b/client/expense/expense_client.go new file mode 100644 index 0000000..5a477a8 --- /dev/null +++ b/client/expense/expense_client.go @@ -0,0 +1,330 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new expense API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for expense API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPIExpensesID(params *DeleteAPIExpensesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIExpensesIDNoContent, error) + + GetAPIExpenses(params *GetAPIExpensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIExpensesOK, error) + + GetAPIExpensesID(params *GetAPIExpensesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIExpensesIDOK, error) + + PatchAPIExpensesID(params *PatchAPIExpensesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIExpensesIDOK, error) + + PatchAPIExpensesIDDuplicate(params *PatchAPIExpensesIDDuplicateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIExpensesIDDuplicateOK, error) + + PatchAPIExpensesIDMeta(params *PatchAPIExpensesIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIExpensesIDMetaOK, error) + + PostAPIExpenses(params *PostAPIExpensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIExpensesOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPIExpensesID deletes an existing expense record +*/ +func (a *Client) DeleteAPIExpensesID(params *DeleteAPIExpensesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIExpensesIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPIExpensesIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPIExpensesID", + Method: "DELETE", + PathPattern: "/api/expenses/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPIExpensesIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPIExpensesIDNoContent) + 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 DeleteAPIExpensesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIExpenses returns a collection of expenses +*/ +func (a *Client) GetAPIExpenses(params *GetAPIExpensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIExpensesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIExpensesParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIExpenses", + Method: "GET", + PathPattern: "/api/expenses", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIExpensesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIExpensesOK) + 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 GetAPIExpenses: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIExpensesID returns one expense +*/ +func (a *Client) GetAPIExpensesID(params *GetAPIExpensesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIExpensesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIExpensesIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIExpensesID", + Method: "GET", + PathPattern: "/api/expenses/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIExpensesIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIExpensesIDOK) + 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 GetAPIExpensesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIExpensesID updates an existing expense + +Update an existing expense, you can pass all or just a subset of all attributes +*/ +func (a *Client) PatchAPIExpensesID(params *PatchAPIExpensesIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIExpensesIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIExpensesIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIExpensesID", + Method: "PATCH", + PathPattern: "/api/expenses/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIExpensesIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIExpensesIDOK) + 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 PatchAPIExpensesID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIExpensesIDDuplicate duplicates an existing expense record +*/ +func (a *Client) PatchAPIExpensesIDDuplicate(params *PatchAPIExpensesIDDuplicateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIExpensesIDDuplicateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIExpensesIDDuplicateParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIExpensesIDDuplicate", + Method: "PATCH", + PathPattern: "/api/expenses/{id}/duplicate", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIExpensesIDDuplicateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIExpensesIDDuplicateOK) + 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 PatchAPIExpensesIDDuplicate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIExpensesIDMeta sets the value of a meta field for an existing expense +*/ +func (a *Client) PatchAPIExpensesIDMeta(params *PatchAPIExpensesIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIExpensesIDMetaOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIExpensesIDMetaParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIExpensesIDMeta", + Method: "PATCH", + PathPattern: "/api/expenses/{id}/meta", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIExpensesIDMetaReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIExpensesIDMetaOK) + 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 PatchAPIExpensesIDMeta: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIExpenses creates a new expense + +Creates a new expense and returns it afterwards +*/ +func (a *Client) PostAPIExpenses(params *PostAPIExpensesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIExpensesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIExpensesParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIExpenses", + Method: "POST", + PathPattern: "/api/expenses", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIExpensesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIExpensesOK) + 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 PostAPIExpenses: 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/expense/get_api_expenses_id_parameters.go b/client/expense/get_api_expenses_id_parameters.go new file mode 100644 index 0000000..7c7331a --- /dev/null +++ b/client/expense/get_api_expenses_id_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// 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" +) + +// NewGetAPIExpensesIDParams creates a new GetAPIExpensesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIExpensesIDParams() *GetAPIExpensesIDParams { + return &GetAPIExpensesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIExpensesIDParamsWithTimeout creates a new GetAPIExpensesIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIExpensesIDParamsWithTimeout(timeout time.Duration) *GetAPIExpensesIDParams { + return &GetAPIExpensesIDParams{ + timeout: timeout, + } +} + +// NewGetAPIExpensesIDParamsWithContext creates a new GetAPIExpensesIDParams object +// with the ability to set a context for a request. +func NewGetAPIExpensesIDParamsWithContext(ctx context.Context) *GetAPIExpensesIDParams { + return &GetAPIExpensesIDParams{ + Context: ctx, + } +} + +// NewGetAPIExpensesIDParamsWithHTTPClient creates a new GetAPIExpensesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIExpensesIDParamsWithHTTPClient(client *http.Client) *GetAPIExpensesIDParams { + return &GetAPIExpensesIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIExpensesIDParams contains all the parameters to send to the API endpoint + + for the get API expenses ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIExpensesIDParams struct { + + /* ID. + + Expense ID to fetch + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API expenses ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIExpensesIDParams) WithDefaults() *GetAPIExpensesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API expenses ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIExpensesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API expenses ID params +func (o *GetAPIExpensesIDParams) WithTimeout(timeout time.Duration) *GetAPIExpensesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API expenses ID params +func (o *GetAPIExpensesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API expenses ID params +func (o *GetAPIExpensesIDParams) WithContext(ctx context.Context) *GetAPIExpensesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API expenses ID params +func (o *GetAPIExpensesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API expenses ID params +func (o *GetAPIExpensesIDParams) WithHTTPClient(client *http.Client) *GetAPIExpensesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API expenses ID params +func (o *GetAPIExpensesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get API expenses ID params +func (o *GetAPIExpensesIDParams) WithID(id int64) *GetAPIExpensesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API expenses ID params +func (o *GetAPIExpensesIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIExpensesIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/expense/get_api_expenses_id_responses.go b/client/expense/get_api_expenses_id_responses.go new file mode 100644 index 0000000..8f99063 --- /dev/null +++ b/client/expense/get_api_expenses_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIExpensesIDReader is a Reader for the GetAPIExpensesID structure. +type GetAPIExpensesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIExpensesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIExpensesIDOK() + 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()) + } +} + +// NewGetAPIExpensesIDOK creates a GetAPIExpensesIDOK with default headers values +func NewGetAPIExpensesIDOK() *GetAPIExpensesIDOK { + return &GetAPIExpensesIDOK{} +} + +/* +GetAPIExpensesIDOK describes a response with status code 200, with default header values. + +Returns one expense entity +*/ +type GetAPIExpensesIDOK struct { + Payload *models.ExpenseEntity +} + +// IsSuccess returns true when this get Api expenses Id o k response has a 2xx status code +func (o *GetAPIExpensesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api expenses Id o k response has a 3xx status code +func (o *GetAPIExpensesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api expenses Id o k response has a 4xx status code +func (o *GetAPIExpensesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api expenses Id o k response has a 5xx status code +func (o *GetAPIExpensesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api expenses Id o k response a status code equal to that given +func (o *GetAPIExpensesIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIExpensesIDOK) Error() string { + return fmt.Sprintf("[GET /api/expenses/{id}][%d] getApiExpensesIdOK %+v", 200, o.Payload) +} + +func (o *GetAPIExpensesIDOK) String() string { + return fmt.Sprintf("[GET /api/expenses/{id}][%d] getApiExpensesIdOK %+v", 200, o.Payload) +} + +func (o *GetAPIExpensesIDOK) GetPayload() *models.ExpenseEntity { + return o.Payload +} + +func (o *GetAPIExpensesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ExpenseEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/expense/get_api_expenses_parameters.go b/client/expense/get_api_expenses_parameters.go new file mode 100644 index 0000000..4184e88 --- /dev/null +++ b/client/expense/get_api_expenses_parameters.go @@ -0,0 +1,358 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// 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" +) + +// NewGetAPIExpensesParams creates a new GetAPIExpensesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIExpensesParams() *GetAPIExpensesParams { + return &GetAPIExpensesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIExpensesParamsWithTimeout creates a new GetAPIExpensesParams object +// with the ability to set a timeout on a request. +func NewGetAPIExpensesParamsWithTimeout(timeout time.Duration) *GetAPIExpensesParams { + return &GetAPIExpensesParams{ + timeout: timeout, + } +} + +// NewGetAPIExpensesParamsWithContext creates a new GetAPIExpensesParams object +// with the ability to set a context for a request. +func NewGetAPIExpensesParamsWithContext(ctx context.Context) *GetAPIExpensesParams { + return &GetAPIExpensesParams{ + Context: ctx, + } +} + +// NewGetAPIExpensesParamsWithHTTPClient creates a new GetAPIExpensesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIExpensesParamsWithHTTPClient(client *http.Client) *GetAPIExpensesParams { + return &GetAPIExpensesParams{ + HTTPClient: client, + } +} + +/* +GetAPIExpensesParams contains all the parameters to send to the API endpoint + + for the get API expenses operation. + + Typically these are written to a http.Request. +*/ +type GetAPIExpensesParams struct { + + /* Begin. + + Only records after this date will be included (format: HTML5) + + Format: DateTime + */ + Begin string + + /* End. + + Only records before this date will be included (format: HTML5) + + Format: DateTime + */ + End string + + /* Exported. + + Use this flag if you want to filter for export state. Allowed values: 0=not exported, 1=exported (default: all) + */ + Exported string + + /* Order. + + The result order. Allowed values: ASC, DESC (default: DESC) + */ + Order string + + /* OrderBy. + + The field by which results will be ordered. Allowed values: begin, end, duration, total, category, cost, user, customer, project, activity, description, exported, refundable, multiplier (default: begin) + */ + OrderBy string + + /* Page. + + The page to display, renders a 404 if not found (default: 1) + */ + Page string + + /* Refundable. + + Use this flag if you want to filter for refundable expenses. Allowed values: 0=not refundable, 1=refundable (default: all) + */ + Refundable string + + /* Size. + + The amount of entries for each page (default: 50) + */ + Size string + + /* Term. + + Free search term + */ + Term string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API expenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIExpensesParams) WithDefaults() *GetAPIExpensesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API expenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIExpensesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API expenses params +func (o *GetAPIExpensesParams) WithTimeout(timeout time.Duration) *GetAPIExpensesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API expenses params +func (o *GetAPIExpensesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API expenses params +func (o *GetAPIExpensesParams) WithContext(ctx context.Context) *GetAPIExpensesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API expenses params +func (o *GetAPIExpensesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API expenses params +func (o *GetAPIExpensesParams) WithHTTPClient(client *http.Client) *GetAPIExpensesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API expenses params +func (o *GetAPIExpensesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBegin adds the begin to the get API expenses params +func (o *GetAPIExpensesParams) WithBegin(begin string) *GetAPIExpensesParams { + o.SetBegin(begin) + return o +} + +// SetBegin adds the begin to the get API expenses params +func (o *GetAPIExpensesParams) SetBegin(begin string) { + o.Begin = begin +} + +// WithEnd adds the end to the get API expenses params +func (o *GetAPIExpensesParams) WithEnd(end string) *GetAPIExpensesParams { + o.SetEnd(end) + return o +} + +// SetEnd adds the end to the get API expenses params +func (o *GetAPIExpensesParams) SetEnd(end string) { + o.End = end +} + +// WithExported adds the exported to the get API expenses params +func (o *GetAPIExpensesParams) WithExported(exported string) *GetAPIExpensesParams { + o.SetExported(exported) + return o +} + +// SetExported adds the exported to the get API expenses params +func (o *GetAPIExpensesParams) SetExported(exported string) { + o.Exported = exported +} + +// WithOrder adds the order to the get API expenses params +func (o *GetAPIExpensesParams) WithOrder(order string) *GetAPIExpensesParams { + o.SetOrder(order) + return o +} + +// SetOrder adds the order to the get API expenses params +func (o *GetAPIExpensesParams) SetOrder(order string) { + o.Order = order +} + +// WithOrderBy adds the orderBy to the get API expenses params +func (o *GetAPIExpensesParams) WithOrderBy(orderBy string) *GetAPIExpensesParams { + o.SetOrderBy(orderBy) + return o +} + +// SetOrderBy adds the orderBy to the get API expenses params +func (o *GetAPIExpensesParams) SetOrderBy(orderBy string) { + o.OrderBy = orderBy +} + +// WithPage adds the page to the get API expenses params +func (o *GetAPIExpensesParams) WithPage(page string) *GetAPIExpensesParams { + o.SetPage(page) + return o +} + +// SetPage adds the page to the get API expenses params +func (o *GetAPIExpensesParams) SetPage(page string) { + o.Page = page +} + +// WithRefundable adds the refundable to the get API expenses params +func (o *GetAPIExpensesParams) WithRefundable(refundable string) *GetAPIExpensesParams { + o.SetRefundable(refundable) + return o +} + +// SetRefundable adds the refundable to the get API expenses params +func (o *GetAPIExpensesParams) SetRefundable(refundable string) { + o.Refundable = refundable +} + +// WithSize adds the size to the get API expenses params +func (o *GetAPIExpensesParams) WithSize(size string) *GetAPIExpensesParams { + o.SetSize(size) + return o +} + +// SetSize adds the size to the get API expenses params +func (o *GetAPIExpensesParams) SetSize(size string) { + o.Size = size +} + +// WithTerm adds the term to the get API expenses params +func (o *GetAPIExpensesParams) WithTerm(term string) *GetAPIExpensesParams { + o.SetTerm(term) + return o +} + +// SetTerm adds the term to the get API expenses params +func (o *GetAPIExpensesParams) SetTerm(term string) { + o.Term = term +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIExpensesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param begin + qrBegin := o.Begin + qBegin := qrBegin + + if err := r.SetQueryParam("begin", qBegin); err != nil { + return err + } + + // query param end + qrEnd := o.End + qEnd := qrEnd + + if err := r.SetQueryParam("end", qEnd); err != nil { + return err + } + + // query param exported + qrExported := o.Exported + qExported := qrExported + + if err := r.SetQueryParam("exported", qExported); err != nil { + return err + } + + // query param order + qrOrder := o.Order + qOrder := qrOrder + + if err := r.SetQueryParam("order", qOrder); err != nil { + return err + } + + // query param orderBy + qrOrderBy := o.OrderBy + qOrderBy := qrOrderBy + + if err := r.SetQueryParam("orderBy", qOrderBy); err != nil { + return err + } + + // query param page + qrPage := o.Page + qPage := qrPage + + if err := r.SetQueryParam("page", qPage); err != nil { + return err + } + + // query param refundable + qrRefundable := o.Refundable + qRefundable := qrRefundable + + if err := r.SetQueryParam("refundable", qRefundable); err != nil { + return err + } + + // query param size + qrSize := o.Size + qSize := qrSize + + if err := r.SetQueryParam("size", qSize); err != nil { + return err + } + + // query param term + qrTerm := o.Term + qTerm := qrTerm + + if err := r.SetQueryParam("term", qTerm); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/expense/get_api_expenses_responses.go b/client/expense/get_api_expenses_responses.go new file mode 100644 index 0000000..88ede57 --- /dev/null +++ b/client/expense/get_api_expenses_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIExpensesReader is a Reader for the GetAPIExpenses structure. +type GetAPIExpensesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIExpensesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIExpensesOK() + 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()) + } +} + +// NewGetAPIExpensesOK creates a GetAPIExpensesOK with default headers values +func NewGetAPIExpensesOK() *GetAPIExpensesOK { + return &GetAPIExpensesOK{} +} + +/* +GetAPIExpensesOK describes a response with status code 200, with default header values. + +Returns a collection of expense entities +*/ +type GetAPIExpensesOK struct { + Payload []*models.ExpenseEntity +} + +// IsSuccess returns true when this get Api expenses o k response has a 2xx status code +func (o *GetAPIExpensesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api expenses o k response has a 3xx status code +func (o *GetAPIExpensesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api expenses o k response has a 4xx status code +func (o *GetAPIExpensesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api expenses o k response has a 5xx status code +func (o *GetAPIExpensesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api expenses o k response a status code equal to that given +func (o *GetAPIExpensesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIExpensesOK) Error() string { + return fmt.Sprintf("[GET /api/expenses][%d] getApiExpensesOK %+v", 200, o.Payload) +} + +func (o *GetAPIExpensesOK) String() string { + return fmt.Sprintf("[GET /api/expenses][%d] getApiExpensesOK %+v", 200, o.Payload) +} + +func (o *GetAPIExpensesOK) GetPayload() []*models.ExpenseEntity { + return o.Payload +} + +func (o *GetAPIExpensesOK) 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/expense/patch_api_expenses_id_duplicate_parameters.go b/client/expense/patch_api_expenses_id_duplicate_parameters.go new file mode 100644 index 0000000..a88a6c7 --- /dev/null +++ b/client/expense/patch_api_expenses_id_duplicate_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// 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" +) + +// NewPatchAPIExpensesIDDuplicateParams creates a new PatchAPIExpensesIDDuplicateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIExpensesIDDuplicateParams() *PatchAPIExpensesIDDuplicateParams { + return &PatchAPIExpensesIDDuplicateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIExpensesIDDuplicateParamsWithTimeout creates a new PatchAPIExpensesIDDuplicateParams object +// with the ability to set a timeout on a request. +func NewPatchAPIExpensesIDDuplicateParamsWithTimeout(timeout time.Duration) *PatchAPIExpensesIDDuplicateParams { + return &PatchAPIExpensesIDDuplicateParams{ + timeout: timeout, + } +} + +// NewPatchAPIExpensesIDDuplicateParamsWithContext creates a new PatchAPIExpensesIDDuplicateParams object +// with the ability to set a context for a request. +func NewPatchAPIExpensesIDDuplicateParamsWithContext(ctx context.Context) *PatchAPIExpensesIDDuplicateParams { + return &PatchAPIExpensesIDDuplicateParams{ + Context: ctx, + } +} + +// NewPatchAPIExpensesIDDuplicateParamsWithHTTPClient creates a new PatchAPIExpensesIDDuplicateParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIExpensesIDDuplicateParamsWithHTTPClient(client *http.Client) *PatchAPIExpensesIDDuplicateParams { + return &PatchAPIExpensesIDDuplicateParams{ + HTTPClient: client, + } +} + +/* +PatchAPIExpensesIDDuplicateParams contains all the parameters to send to the API endpoint + + for the patch API expenses ID duplicate operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIExpensesIDDuplicateParams struct { + + /* ID. + + Expense record ID to duplicate + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API expenses ID duplicate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIExpensesIDDuplicateParams) WithDefaults() *PatchAPIExpensesIDDuplicateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API expenses ID duplicate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIExpensesIDDuplicateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API expenses ID duplicate params +func (o *PatchAPIExpensesIDDuplicateParams) WithTimeout(timeout time.Duration) *PatchAPIExpensesIDDuplicateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API expenses ID duplicate params +func (o *PatchAPIExpensesIDDuplicateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API expenses ID duplicate params +func (o *PatchAPIExpensesIDDuplicateParams) WithContext(ctx context.Context) *PatchAPIExpensesIDDuplicateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API expenses ID duplicate params +func (o *PatchAPIExpensesIDDuplicateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API expenses ID duplicate params +func (o *PatchAPIExpensesIDDuplicateParams) WithHTTPClient(client *http.Client) *PatchAPIExpensesIDDuplicateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API expenses ID duplicate params +func (o *PatchAPIExpensesIDDuplicateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the patch API expenses ID duplicate params +func (o *PatchAPIExpensesIDDuplicateParams) WithID(id int64) *PatchAPIExpensesIDDuplicateParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API expenses ID duplicate params +func (o *PatchAPIExpensesIDDuplicateParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIExpensesIDDuplicateParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/expense/patch_api_expenses_id_duplicate_responses.go b/client/expense/patch_api_expenses_id_duplicate_responses.go new file mode 100644 index 0000000..19181ab --- /dev/null +++ b/client/expense/patch_api_expenses_id_duplicate_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPIExpensesIDDuplicateReader is a Reader for the PatchAPIExpensesIDDuplicate structure. +type PatchAPIExpensesIDDuplicateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIExpensesIDDuplicateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIExpensesIDDuplicateOK() + 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()) + } +} + +// NewPatchAPIExpensesIDDuplicateOK creates a PatchAPIExpensesIDDuplicateOK with default headers values +func NewPatchAPIExpensesIDDuplicateOK() *PatchAPIExpensesIDDuplicateOK { + return &PatchAPIExpensesIDDuplicateOK{} +} + +/* +PatchAPIExpensesIDDuplicateOK describes a response with status code 200, with default header values. + +Duplicates a expense record, resetting the export state only. +*/ +type PatchAPIExpensesIDDuplicateOK struct { + Payload *models.ExpenseEntity +} + +// IsSuccess returns true when this patch Api expenses Id duplicate o k response has a 2xx status code +func (o *PatchAPIExpensesIDDuplicateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api expenses Id duplicate o k response has a 3xx status code +func (o *PatchAPIExpensesIDDuplicateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api expenses Id duplicate o k response has a 4xx status code +func (o *PatchAPIExpensesIDDuplicateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api expenses Id duplicate o k response has a 5xx status code +func (o *PatchAPIExpensesIDDuplicateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api expenses Id duplicate o k response a status code equal to that given +func (o *PatchAPIExpensesIDDuplicateOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPIExpensesIDDuplicateOK) Error() string { + return fmt.Sprintf("[PATCH /api/expenses/{id}/duplicate][%d] patchApiExpensesIdDuplicateOK %+v", 200, o.Payload) +} + +func (o *PatchAPIExpensesIDDuplicateOK) String() string { + return fmt.Sprintf("[PATCH /api/expenses/{id}/duplicate][%d] patchApiExpensesIdDuplicateOK %+v", 200, o.Payload) +} + +func (o *PatchAPIExpensesIDDuplicateOK) GetPayload() *models.ExpenseEntity { + return o.Payload +} + +func (o *PatchAPIExpensesIDDuplicateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ExpenseEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/expense/patch_api_expenses_id_meta_parameters.go b/client/expense/patch_api_expenses_id_meta_parameters.go new file mode 100644 index 0000000..d72d061 --- /dev/null +++ b/client/expense/patch_api_expenses_id_meta_parameters.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// 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" +) + +// NewPatchAPIExpensesIDMetaParams creates a new PatchAPIExpensesIDMetaParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIExpensesIDMetaParams() *PatchAPIExpensesIDMetaParams { + return &PatchAPIExpensesIDMetaParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIExpensesIDMetaParamsWithTimeout creates a new PatchAPIExpensesIDMetaParams object +// with the ability to set a timeout on a request. +func NewPatchAPIExpensesIDMetaParamsWithTimeout(timeout time.Duration) *PatchAPIExpensesIDMetaParams { + return &PatchAPIExpensesIDMetaParams{ + timeout: timeout, + } +} + +// NewPatchAPIExpensesIDMetaParamsWithContext creates a new PatchAPIExpensesIDMetaParams object +// with the ability to set a context for a request. +func NewPatchAPIExpensesIDMetaParamsWithContext(ctx context.Context) *PatchAPIExpensesIDMetaParams { + return &PatchAPIExpensesIDMetaParams{ + Context: ctx, + } +} + +// NewPatchAPIExpensesIDMetaParamsWithHTTPClient creates a new PatchAPIExpensesIDMetaParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIExpensesIDMetaParamsWithHTTPClient(client *http.Client) *PatchAPIExpensesIDMetaParams { + return &PatchAPIExpensesIDMetaParams{ + HTTPClient: client, + } +} + +/* +PatchAPIExpensesIDMetaParams contains all the parameters to send to the API endpoint + + for the patch API expenses ID meta operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIExpensesIDMetaParams struct { + + // Body. + Body PatchAPIExpensesIDMetaBody + + /* ID. + + Expense record ID to set the meta-field value for + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API expenses ID meta params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIExpensesIDMetaParams) WithDefaults() *PatchAPIExpensesIDMetaParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API expenses ID meta params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIExpensesIDMetaParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API expenses ID meta params +func (o *PatchAPIExpensesIDMetaParams) WithTimeout(timeout time.Duration) *PatchAPIExpensesIDMetaParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API expenses ID meta params +func (o *PatchAPIExpensesIDMetaParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API expenses ID meta params +func (o *PatchAPIExpensesIDMetaParams) WithContext(ctx context.Context) *PatchAPIExpensesIDMetaParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API expenses ID meta params +func (o *PatchAPIExpensesIDMetaParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API expenses ID meta params +func (o *PatchAPIExpensesIDMetaParams) WithHTTPClient(client *http.Client) *PatchAPIExpensesIDMetaParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API expenses ID meta params +func (o *PatchAPIExpensesIDMetaParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API expenses ID meta params +func (o *PatchAPIExpensesIDMetaParams) WithBody(body PatchAPIExpensesIDMetaBody) *PatchAPIExpensesIDMetaParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API expenses ID meta params +func (o *PatchAPIExpensesIDMetaParams) SetBody(body PatchAPIExpensesIDMetaBody) { + o.Body = body +} + +// WithID adds the id to the patch API expenses ID meta params +func (o *PatchAPIExpensesIDMetaParams) WithID(id int64) *PatchAPIExpensesIDMetaParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API expenses ID meta params +func (o *PatchAPIExpensesIDMetaParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIExpensesIDMetaParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/expense/patch_api_expenses_id_meta_responses.go b/client/expense/patch_api_expenses_id_meta_responses.go new file mode 100644 index 0000000..5c786cb --- /dev/null +++ b/client/expense/patch_api_expenses_id_meta_responses.go @@ -0,0 +1,176 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + + "decentral1se/go-kimai/models" +) + +// PatchAPIExpensesIDMetaReader is a Reader for the PatchAPIExpensesIDMeta structure. +type PatchAPIExpensesIDMetaReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIExpensesIDMetaReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIExpensesIDMetaOK() + 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()) + } +} + +// NewPatchAPIExpensesIDMetaOK creates a PatchAPIExpensesIDMetaOK with default headers values +func NewPatchAPIExpensesIDMetaOK() *PatchAPIExpensesIDMetaOK { + return &PatchAPIExpensesIDMetaOK{} +} + +/* +PatchAPIExpensesIDMetaOK describes a response with status code 200, with default header values. + +Sets the value of an existing/configured meta-field. You cannot create unknown meta-fields, if the given name is not a configured meta-field, this will return an exception. +*/ +type PatchAPIExpensesIDMetaOK struct { + Payload *models.ExpenseEntity +} + +// IsSuccess returns true when this patch Api expenses Id meta o k response has a 2xx status code +func (o *PatchAPIExpensesIDMetaOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api expenses Id meta o k response has a 3xx status code +func (o *PatchAPIExpensesIDMetaOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api expenses Id meta o k response has a 4xx status code +func (o *PatchAPIExpensesIDMetaOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api expenses Id meta o k response has a 5xx status code +func (o *PatchAPIExpensesIDMetaOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api expenses Id meta o k response a status code equal to that given +func (o *PatchAPIExpensesIDMetaOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPIExpensesIDMetaOK) Error() string { + return fmt.Sprintf("[PATCH /api/expenses/{id}/meta][%d] patchApiExpensesIdMetaOK %+v", 200, o.Payload) +} + +func (o *PatchAPIExpensesIDMetaOK) String() string { + return fmt.Sprintf("[PATCH /api/expenses/{id}/meta][%d] patchApiExpensesIdMetaOK %+v", 200, o.Payload) +} + +func (o *PatchAPIExpensesIDMetaOK) GetPayload() *models.ExpenseEntity { + return o.Payload +} + +func (o *PatchAPIExpensesIDMetaOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ExpenseEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +PatchAPIExpensesIDMetaBody patch API expenses ID meta body +swagger:model PatchAPIExpensesIDMetaBody +*/ +type PatchAPIExpensesIDMetaBody struct { + + // The meta-field name + // Required: true + Name *string `json:"name"` + + // The meta-field value + // Required: true + Value *string `json:"value"` +} + +// Validate validates this patch API expenses ID meta body +func (o *PatchAPIExpensesIDMetaBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateName(formats); err != nil { + res = append(res, err) + } + + if err := o.validateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *PatchAPIExpensesIDMetaBody) validateName(formats strfmt.Registry) error { + + if err := validate.Required("body"+"."+"name", "body", o.Name); err != nil { + return err + } + + return nil +} + +func (o *PatchAPIExpensesIDMetaBody) validateValue(formats strfmt.Registry) error { + + if err := validate.Required("body"+"."+"value", "body", o.Value); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this patch API expenses ID meta body based on context it is used +func (o *PatchAPIExpensesIDMetaBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *PatchAPIExpensesIDMetaBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *PatchAPIExpensesIDMetaBody) UnmarshalBinary(b []byte) error { + var res PatchAPIExpensesIDMetaBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/client/expense/patch_api_expenses_id_parameters.go b/client/expense/patch_api_expenses_id_parameters.go new file mode 100644 index 0000000..6a5a788 --- /dev/null +++ b/client/expense/patch_api_expenses_id_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPatchAPIExpensesIDParams creates a new PatchAPIExpensesIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIExpensesIDParams() *PatchAPIExpensesIDParams { + return &PatchAPIExpensesIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIExpensesIDParamsWithTimeout creates a new PatchAPIExpensesIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPIExpensesIDParamsWithTimeout(timeout time.Duration) *PatchAPIExpensesIDParams { + return &PatchAPIExpensesIDParams{ + timeout: timeout, + } +} + +// NewPatchAPIExpensesIDParamsWithContext creates a new PatchAPIExpensesIDParams object +// with the ability to set a context for a request. +func NewPatchAPIExpensesIDParamsWithContext(ctx context.Context) *PatchAPIExpensesIDParams { + return &PatchAPIExpensesIDParams{ + Context: ctx, + } +} + +// NewPatchAPIExpensesIDParamsWithHTTPClient creates a new PatchAPIExpensesIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIExpensesIDParamsWithHTTPClient(client *http.Client) *PatchAPIExpensesIDParams { + return &PatchAPIExpensesIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPIExpensesIDParams contains all the parameters to send to the API endpoint + + for the patch API expenses ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIExpensesIDParams struct { + + // Body. + Body *models.ExpenseEditForm + + /* ID. + + Expense ID to update + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API expenses ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIExpensesIDParams) WithDefaults() *PatchAPIExpensesIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API expenses ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIExpensesIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API expenses ID params +func (o *PatchAPIExpensesIDParams) WithTimeout(timeout time.Duration) *PatchAPIExpensesIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API expenses ID params +func (o *PatchAPIExpensesIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API expenses ID params +func (o *PatchAPIExpensesIDParams) WithContext(ctx context.Context) *PatchAPIExpensesIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API expenses ID params +func (o *PatchAPIExpensesIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API expenses ID params +func (o *PatchAPIExpensesIDParams) WithHTTPClient(client *http.Client) *PatchAPIExpensesIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API expenses ID params +func (o *PatchAPIExpensesIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API expenses ID params +func (o *PatchAPIExpensesIDParams) WithBody(body *models.ExpenseEditForm) *PatchAPIExpensesIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API expenses ID params +func (o *PatchAPIExpensesIDParams) SetBody(body *models.ExpenseEditForm) { + o.Body = body +} + +// WithID adds the id to the patch API expenses ID params +func (o *PatchAPIExpensesIDParams) WithID(id int64) *PatchAPIExpensesIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API expenses ID params +func (o *PatchAPIExpensesIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIExpensesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/expense/patch_api_expenses_id_responses.go b/client/expense/patch_api_expenses_id_responses.go new file mode 100644 index 0000000..cec59bb --- /dev/null +++ b/client/expense/patch_api_expenses_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPIExpensesIDReader is a Reader for the PatchAPIExpensesID structure. +type PatchAPIExpensesIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIExpensesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIExpensesIDOK() + 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()) + } +} + +// NewPatchAPIExpensesIDOK creates a PatchAPIExpensesIDOK with default headers values +func NewPatchAPIExpensesIDOK() *PatchAPIExpensesIDOK { + return &PatchAPIExpensesIDOK{} +} + +/* +PatchAPIExpensesIDOK describes a response with status code 200, with default header values. + +Returns the updated expense +*/ +type PatchAPIExpensesIDOK struct { + Payload *models.ExpenseEntity +} + +// IsSuccess returns true when this patch Api expenses Id o k response has a 2xx status code +func (o *PatchAPIExpensesIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api expenses Id o k response has a 3xx status code +func (o *PatchAPIExpensesIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api expenses Id o k response has a 4xx status code +func (o *PatchAPIExpensesIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api expenses Id o k response has a 5xx status code +func (o *PatchAPIExpensesIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api expenses Id o k response a status code equal to that given +func (o *PatchAPIExpensesIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPIExpensesIDOK) Error() string { + return fmt.Sprintf("[PATCH /api/expenses/{id}][%d] patchApiExpensesIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPIExpensesIDOK) String() string { + return fmt.Sprintf("[PATCH /api/expenses/{id}][%d] patchApiExpensesIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPIExpensesIDOK) GetPayload() *models.ExpenseEntity { + return o.Payload +} + +func (o *PatchAPIExpensesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ExpenseEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/expense/post_api_expenses_parameters.go b/client/expense/post_api_expenses_parameters.go new file mode 100644 index 0000000..26b1d45 --- /dev/null +++ b/client/expense/post_api_expenses_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPostAPIExpensesParams creates a new PostAPIExpensesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIExpensesParams() *PostAPIExpensesParams { + return &PostAPIExpensesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIExpensesParamsWithTimeout creates a new PostAPIExpensesParams object +// with the ability to set a timeout on a request. +func NewPostAPIExpensesParamsWithTimeout(timeout time.Duration) *PostAPIExpensesParams { + return &PostAPIExpensesParams{ + timeout: timeout, + } +} + +// NewPostAPIExpensesParamsWithContext creates a new PostAPIExpensesParams object +// with the ability to set a context for a request. +func NewPostAPIExpensesParamsWithContext(ctx context.Context) *PostAPIExpensesParams { + return &PostAPIExpensesParams{ + Context: ctx, + } +} + +// NewPostAPIExpensesParamsWithHTTPClient creates a new PostAPIExpensesParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIExpensesParamsWithHTTPClient(client *http.Client) *PostAPIExpensesParams { + return &PostAPIExpensesParams{ + HTTPClient: client, + } +} + +/* +PostAPIExpensesParams contains all the parameters to send to the API endpoint + + for the post API expenses operation. + + Typically these are written to a http.Request. +*/ +type PostAPIExpensesParams struct { + + // Body. + Body *models.ExpenseEditForm + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API expenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIExpensesParams) WithDefaults() *PostAPIExpensesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API expenses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIExpensesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API expenses params +func (o *PostAPIExpensesParams) WithTimeout(timeout time.Duration) *PostAPIExpensesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API expenses params +func (o *PostAPIExpensesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API expenses params +func (o *PostAPIExpensesParams) WithContext(ctx context.Context) *PostAPIExpensesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API expenses params +func (o *PostAPIExpensesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API expenses params +func (o *PostAPIExpensesParams) WithHTTPClient(client *http.Client) *PostAPIExpensesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API expenses params +func (o *PostAPIExpensesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API expenses params +func (o *PostAPIExpensesParams) WithBody(body *models.ExpenseEditForm) *PostAPIExpensesParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API expenses params +func (o *PostAPIExpensesParams) SetBody(body *models.ExpenseEditForm) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIExpensesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/expense/post_api_expenses_responses.go b/client/expense/post_api_expenses_responses.go new file mode 100644 index 0000000..3041256 --- /dev/null +++ b/client/expense/post_api_expenses_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package expense + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPIExpensesReader is a Reader for the PostAPIExpenses structure. +type PostAPIExpensesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIExpensesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIExpensesOK() + 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()) + } +} + +// NewPostAPIExpensesOK creates a PostAPIExpensesOK with default headers values +func NewPostAPIExpensesOK() *PostAPIExpensesOK { + return &PostAPIExpensesOK{} +} + +/* +PostAPIExpensesOK describes a response with status code 200, with default header values. + +Returns the new created expense +*/ +type PostAPIExpensesOK struct { + Payload *models.ExpenseEntity +} + +// IsSuccess returns true when this post Api expenses o k response has a 2xx status code +func (o *PostAPIExpensesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api expenses o k response has a 3xx status code +func (o *PostAPIExpensesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api expenses o k response has a 4xx status code +func (o *PostAPIExpensesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api expenses o k response has a 5xx status code +func (o *PostAPIExpensesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api expenses o k response a status code equal to that given +func (o *PostAPIExpensesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPIExpensesOK) Error() string { + return fmt.Sprintf("[POST /api/expenses][%d] postApiExpensesOK %+v", 200, o.Payload) +} + +func (o *PostAPIExpensesOK) String() string { + return fmt.Sprintf("[POST /api/expenses][%d] postApiExpensesOK %+v", 200, o.Payload) +} + +func (o *PostAPIExpensesOK) GetPayload() *models.ExpenseEntity { + return o.Payload +} + +func (o *PostAPIExpensesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ExpenseEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/go_kimai_client.go b/client/go_kimai_client.go new file mode 100644 index 0000000..7c88e81 --- /dev/null +++ b/client/go_kimai_client.go @@ -0,0 +1,167 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package client + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "decentral1se/go-kimai/client/activity" + "decentral1se/go-kimai/client/customer" + "decentral1se/go-kimai/client/default_operations" + "decentral1se/go-kimai/client/expense" + "decentral1se/go-kimai/client/kiosk" + "decentral1se/go-kimai/client/meta_field" + "decentral1se/go-kimai/client/project" + "decentral1se/go-kimai/client/tag" + "decentral1se/go-kimai/client/task" + "decentral1se/go-kimai/client/team" + "decentral1se/go-kimai/client/timesheet" + "decentral1se/go-kimai/client/user" +) + +// Default go kimai HTTP client. +var Default = NewHTTPClient(nil) + +const ( + // DefaultHost is the default Host + // found in Meta (info) section of spec file + DefaultHost string = "demo.kimai.org" + // DefaultBasePath is the default BasePath + // found in Meta (info) section of spec file + DefaultBasePath string = "/" +) + +// DefaultSchemes are the default schemes found in Meta (info) section of spec file +var DefaultSchemes = []string{"http"} + +// NewHTTPClient creates a new go kimai HTTP client. +func NewHTTPClient(formats strfmt.Registry) *GoKimai { + return NewHTTPClientWithConfig(formats, nil) +} + +// NewHTTPClientWithConfig creates a new go kimai HTTP client, +// using a customizable transport config. +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *GoKimai { + // ensure nullable parameters have default + if cfg == nil { + cfg = DefaultTransportConfig() + } + + // create transport and client + transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) + return New(transport, formats) +} + +// New creates a new go kimai client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *GoKimai { + // ensure nullable parameters have default + if formats == nil { + formats = strfmt.Default + } + + cli := new(GoKimai) + cli.Transport = transport + cli.Activity = activity.New(transport, formats) + cli.Customer = customer.New(transport, formats) + cli.DefaultOperations = default_operations.New(transport, formats) + cli.Expense = expense.New(transport, formats) + cli.Kiosk = kiosk.New(transport, formats) + cli.MetaField = meta_field.New(transport, formats) + cli.Project = project.New(transport, formats) + cli.Tag = tag.New(transport, formats) + cli.Task = task.New(transport, formats) + cli.Team = team.New(transport, formats) + cli.Timesheet = timesheet.New(transport, formats) + cli.User = user.New(transport, formats) + return cli +} + +// DefaultTransportConfig creates a TransportConfig with the +// default settings taken from the meta section of the spec file. +func DefaultTransportConfig() *TransportConfig { + return &TransportConfig{ + Host: DefaultHost, + BasePath: DefaultBasePath, + Schemes: DefaultSchemes, + } +} + +// TransportConfig contains the transport related info, +// found in the meta section of the spec file. +type TransportConfig struct { + Host string + BasePath string + Schemes []string +} + +// WithHost overrides the default host, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithHost(host string) *TransportConfig { + cfg.Host = host + return cfg +} + +// WithBasePath overrides the default basePath, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { + cfg.BasePath = basePath + return cfg +} + +// WithSchemes overrides the default schemes, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { + cfg.Schemes = schemes + return cfg +} + +// GoKimai is a client for go kimai +type GoKimai struct { + Activity activity.ClientService + + Customer customer.ClientService + + DefaultOperations default_operations.ClientService + + Expense expense.ClientService + + Kiosk kiosk.ClientService + + MetaField meta_field.ClientService + + Project project.ClientService + + Tag tag.ClientService + + Task task.ClientService + + Team team.ClientService + + Timesheet timesheet.ClientService + + User user.ClientService + + Transport runtime.ClientTransport +} + +// SetTransport changes the transport on the client and all its subresources +func (c *GoKimai) SetTransport(transport runtime.ClientTransport) { + c.Transport = transport + c.Activity.SetTransport(transport) + c.Customer.SetTransport(transport) + c.DefaultOperations.SetTransport(transport) + c.Expense.SetTransport(transport) + c.Kiosk.SetTransport(transport) + c.MetaField.SetTransport(transport) + c.Project.SetTransport(transport) + c.Tag.SetTransport(transport) + c.Task.SetTransport(transport) + c.Team.SetTransport(transport) + c.Timesheet.SetTransport(transport) + c.User.SetTransport(transport) +} diff --git a/client/kiosk/get_api_kiosks_id_parameters.go b/client/kiosk/get_api_kiosks_id_parameters.go new file mode 100644 index 0000000..e76903f --- /dev/null +++ b/client/kiosk/get_api_kiosks_id_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package kiosk + +// 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" +) + +// NewGetAPIKiosksIDParams creates a new GetAPIKiosksIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIKiosksIDParams() *GetAPIKiosksIDParams { + return &GetAPIKiosksIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIKiosksIDParamsWithTimeout creates a new GetAPIKiosksIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIKiosksIDParamsWithTimeout(timeout time.Duration) *GetAPIKiosksIDParams { + return &GetAPIKiosksIDParams{ + timeout: timeout, + } +} + +// NewGetAPIKiosksIDParamsWithContext creates a new GetAPIKiosksIDParams object +// with the ability to set a context for a request. +func NewGetAPIKiosksIDParamsWithContext(ctx context.Context) *GetAPIKiosksIDParams { + return &GetAPIKiosksIDParams{ + Context: ctx, + } +} + +// NewGetAPIKiosksIDParamsWithHTTPClient creates a new GetAPIKiosksIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIKiosksIDParamsWithHTTPClient(client *http.Client) *GetAPIKiosksIDParams { + return &GetAPIKiosksIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIKiosksIDParams contains all the parameters to send to the API endpoint + + for the get API kiosks ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIKiosksIDParams struct { + + /* ID. + + User ID to fetch + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API kiosks ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIKiosksIDParams) WithDefaults() *GetAPIKiosksIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API kiosks ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIKiosksIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API kiosks ID params +func (o *GetAPIKiosksIDParams) WithTimeout(timeout time.Duration) *GetAPIKiosksIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API kiosks ID params +func (o *GetAPIKiosksIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API kiosks ID params +func (o *GetAPIKiosksIDParams) WithContext(ctx context.Context) *GetAPIKiosksIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API kiosks ID params +func (o *GetAPIKiosksIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API kiosks ID params +func (o *GetAPIKiosksIDParams) WithHTTPClient(client *http.Client) *GetAPIKiosksIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API kiosks ID params +func (o *GetAPIKiosksIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get API kiosks ID params +func (o *GetAPIKiosksIDParams) WithID(id int64) *GetAPIKiosksIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API kiosks ID params +func (o *GetAPIKiosksIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIKiosksIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/kiosk/get_api_kiosks_id_responses.go b/client/kiosk/get_api_kiosks_id_responses.go new file mode 100644 index 0000000..4d32f4d --- /dev/null +++ b/client/kiosk/get_api_kiosks_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package kiosk + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIKiosksIDReader is a Reader for the GetAPIKiosksID structure. +type GetAPIKiosksIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIKiosksIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIKiosksIDOK() + 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()) + } +} + +// NewGetAPIKiosksIDOK creates a GetAPIKiosksIDOK with default headers values +func NewGetAPIKiosksIDOK() *GetAPIKiosksIDOK { + return &GetAPIKiosksIDOK{} +} + +/* +GetAPIKiosksIDOK describes a response with status code 200, with default header values. + +Returns one UserAuthCodes entity +*/ +type GetAPIKiosksIDOK struct { + Payload *models.UserAuthCodes +} + +// IsSuccess returns true when this get Api kiosks Id o k response has a 2xx status code +func (o *GetAPIKiosksIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api kiosks Id o k response has a 3xx status code +func (o *GetAPIKiosksIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api kiosks Id o k response has a 4xx status code +func (o *GetAPIKiosksIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api kiosks Id o k response has a 5xx status code +func (o *GetAPIKiosksIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api kiosks Id o k response a status code equal to that given +func (o *GetAPIKiosksIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIKiosksIDOK) Error() string { + return fmt.Sprintf("[GET /api/kiosks/{id}][%d] getApiKiosksIdOK %+v", 200, o.Payload) +} + +func (o *GetAPIKiosksIDOK) String() string { + return fmt.Sprintf("[GET /api/kiosks/{id}][%d] getApiKiosksIdOK %+v", 200, o.Payload) +} + +func (o *GetAPIKiosksIDOK) GetPayload() *models.UserAuthCodes { + return o.Payload +} + +func (o *GetAPIKiosksIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.UserAuthCodes) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/kiosk/get_api_kiosks_parameters.go b/client/kiosk/get_api_kiosks_parameters.go new file mode 100644 index 0000000..7aa27ce --- /dev/null +++ b/client/kiosk/get_api_kiosks_parameters.go @@ -0,0 +1,229 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package kiosk + +// 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" +) + +// NewGetAPIKiosksParams creates a new GetAPIKiosksParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIKiosksParams() *GetAPIKiosksParams { + return &GetAPIKiosksParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIKiosksParamsWithTimeout creates a new GetAPIKiosksParams object +// with the ability to set a timeout on a request. +func NewGetAPIKiosksParamsWithTimeout(timeout time.Duration) *GetAPIKiosksParams { + return &GetAPIKiosksParams{ + timeout: timeout, + } +} + +// NewGetAPIKiosksParamsWithContext creates a new GetAPIKiosksParams object +// with the ability to set a context for a request. +func NewGetAPIKiosksParamsWithContext(ctx context.Context) *GetAPIKiosksParams { + return &GetAPIKiosksParams{ + Context: ctx, + } +} + +// NewGetAPIKiosksParamsWithHTTPClient creates a new GetAPIKiosksParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIKiosksParamsWithHTTPClient(client *http.Client) *GetAPIKiosksParams { + return &GetAPIKiosksParams{ + HTTPClient: client, + } +} + +/* +GetAPIKiosksParams contains all the parameters to send to the API endpoint + + for the get API kiosks operation. + + Typically these are written to a http.Request. +*/ +type GetAPIKiosksParams struct { + + /* Order. + + The result order. Allowed values: ASC, DESC (default: DESC) + */ + Order string + + /* OrderBy. + + The field by which results will be ordered. Allowed values: id, user, type, code (default: id) + */ + OrderBy string + + /* Page. + + The page to display, renders a 404 if not found (default: 1) + */ + Page string + + /* Size. + + The amount of entries for each page (default: 50) + */ + Size string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API kiosks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIKiosksParams) WithDefaults() *GetAPIKiosksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API kiosks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIKiosksParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API kiosks params +func (o *GetAPIKiosksParams) WithTimeout(timeout time.Duration) *GetAPIKiosksParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API kiosks params +func (o *GetAPIKiosksParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API kiosks params +func (o *GetAPIKiosksParams) WithContext(ctx context.Context) *GetAPIKiosksParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API kiosks params +func (o *GetAPIKiosksParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API kiosks params +func (o *GetAPIKiosksParams) WithHTTPClient(client *http.Client) *GetAPIKiosksParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API kiosks params +func (o *GetAPIKiosksParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithOrder adds the order to the get API kiosks params +func (o *GetAPIKiosksParams) WithOrder(order string) *GetAPIKiosksParams { + o.SetOrder(order) + return o +} + +// SetOrder adds the order to the get API kiosks params +func (o *GetAPIKiosksParams) SetOrder(order string) { + o.Order = order +} + +// WithOrderBy adds the orderBy to the get API kiosks params +func (o *GetAPIKiosksParams) WithOrderBy(orderBy string) *GetAPIKiosksParams { + o.SetOrderBy(orderBy) + return o +} + +// SetOrderBy adds the orderBy to the get API kiosks params +func (o *GetAPIKiosksParams) SetOrderBy(orderBy string) { + o.OrderBy = orderBy +} + +// WithPage adds the page to the get API kiosks params +func (o *GetAPIKiosksParams) WithPage(page string) *GetAPIKiosksParams { + o.SetPage(page) + return o +} + +// SetPage adds the page to the get API kiosks params +func (o *GetAPIKiosksParams) SetPage(page string) { + o.Page = page +} + +// WithSize adds the size to the get API kiosks params +func (o *GetAPIKiosksParams) WithSize(size string) *GetAPIKiosksParams { + o.SetSize(size) + return o +} + +// SetSize adds the size to the get API kiosks params +func (o *GetAPIKiosksParams) SetSize(size string) { + o.Size = size +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIKiosksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param order + qrOrder := o.Order + qOrder := qrOrder + + if err := r.SetQueryParam("order", qOrder); err != nil { + return err + } + + // query param orderBy + qrOrderBy := o.OrderBy + qOrderBy := qrOrderBy + + if err := r.SetQueryParam("orderBy", qOrderBy); err != nil { + return err + } + + // query param page + qrPage := o.Page + qPage := qrPage + + if err := r.SetQueryParam("page", qPage); err != nil { + return err + } + + // query param size + qrSize := o.Size + qSize := qrSize + + if err := r.SetQueryParam("size", qSize); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/kiosk/get_api_kiosks_responses.go b/client/kiosk/get_api_kiosks_responses.go new file mode 100644 index 0000000..559df6e --- /dev/null +++ b/client/kiosk/get_api_kiosks_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package kiosk + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIKiosksReader is a Reader for the GetAPIKiosks structure. +type GetAPIKiosksReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIKiosksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIKiosksOK() + 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()) + } +} + +// NewGetAPIKiosksOK creates a GetAPIKiosksOK with default headers values +func NewGetAPIKiosksOK() *GetAPIKiosksOK { + return &GetAPIKiosksOK{} +} + +/* +GetAPIKiosksOK describes a response with status code 200, with default header values. + +Returns a collection of UserAuthCodes +*/ +type GetAPIKiosksOK struct { + Payload []*models.UserAuthCodes +} + +// IsSuccess returns true when this get Api kiosks o k response has a 2xx status code +func (o *GetAPIKiosksOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api kiosks o k response has a 3xx status code +func (o *GetAPIKiosksOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api kiosks o k response has a 4xx status code +func (o *GetAPIKiosksOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api kiosks o k response has a 5xx status code +func (o *GetAPIKiosksOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api kiosks o k response a status code equal to that given +func (o *GetAPIKiosksOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIKiosksOK) Error() string { + return fmt.Sprintf("[GET /api/kiosks][%d] getApiKiosksOK %+v", 200, o.Payload) +} + +func (o *GetAPIKiosksOK) String() string { + return fmt.Sprintf("[GET /api/kiosks][%d] getApiKiosksOK %+v", 200, o.Payload) +} + +func (o *GetAPIKiosksOK) GetPayload() []*models.UserAuthCodes { + return o.Payload +} + +func (o *GetAPIKiosksOK) 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/kiosk/kiosk_client.go b/client/kiosk/kiosk_client.go new file mode 100644 index 0000000..accf5f4 --- /dev/null +++ b/client/kiosk/kiosk_client.go @@ -0,0 +1,123 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package kiosk + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new kiosk API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for kiosk API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetAPIKiosks(params *GetAPIKiosksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIKiosksOK, error) + + GetAPIKiosksID(params *GetAPIKiosksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIKiosksIDOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetAPIKiosks returns a collection of user auth codes objects +*/ +func (a *Client) GetAPIKiosks(params *GetAPIKiosksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIKiosksOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIKiosksParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIKiosks", + Method: "GET", + PathPattern: "/api/kiosks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIKiosksReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIKiosksOK) + 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 GetAPIKiosks: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIKiosksID returns one user auth codes entity + +Creates the code for the configured default type (if not yet existing). +*/ +func (a *Client) GetAPIKiosksID(params *GetAPIKiosksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIKiosksIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIKiosksIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIKiosksID", + Method: "GET", + PathPattern: "/api/kiosks/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIKiosksIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIKiosksIDOK) + 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 GetAPIKiosksID: 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/meta_field/get_api_metafields_parameters.go b/client/meta_field/get_api_metafields_parameters.go new file mode 100644 index 0000000..8cbc343 --- /dev/null +++ b/client/meta_field/get_api_metafields_parameters.go @@ -0,0 +1,156 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package meta_field + +// 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" +) + +// NewGetAPIMetafieldsParams creates a new GetAPIMetafieldsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIMetafieldsParams() *GetAPIMetafieldsParams { + return &GetAPIMetafieldsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIMetafieldsParamsWithTimeout creates a new GetAPIMetafieldsParams object +// with the ability to set a timeout on a request. +func NewGetAPIMetafieldsParamsWithTimeout(timeout time.Duration) *GetAPIMetafieldsParams { + return &GetAPIMetafieldsParams{ + timeout: timeout, + } +} + +// NewGetAPIMetafieldsParamsWithContext creates a new GetAPIMetafieldsParams object +// with the ability to set a context for a request. +func NewGetAPIMetafieldsParamsWithContext(ctx context.Context) *GetAPIMetafieldsParams { + return &GetAPIMetafieldsParams{ + Context: ctx, + } +} + +// NewGetAPIMetafieldsParamsWithHTTPClient creates a new GetAPIMetafieldsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIMetafieldsParamsWithHTTPClient(client *http.Client) *GetAPIMetafieldsParams { + return &GetAPIMetafieldsParams{ + HTTPClient: client, + } +} + +/* +GetAPIMetafieldsParams contains all the parameters to send to the API endpoint + + for the get API metafields operation. + + Typically these are written to a http.Request. +*/ +type GetAPIMetafieldsParams struct { + + /* Entity. + + The type of object to fetch meta-fields for. Allowed values: timesheet, customer, project, activity, user, expense - returns all if not given (default: all) + + Format: MetaFieldExternalType + */ + Entity string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API metafields params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIMetafieldsParams) WithDefaults() *GetAPIMetafieldsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API metafields params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIMetafieldsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API metafields params +func (o *GetAPIMetafieldsParams) WithTimeout(timeout time.Duration) *GetAPIMetafieldsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API metafields params +func (o *GetAPIMetafieldsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API metafields params +func (o *GetAPIMetafieldsParams) WithContext(ctx context.Context) *GetAPIMetafieldsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API metafields params +func (o *GetAPIMetafieldsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API metafields params +func (o *GetAPIMetafieldsParams) WithHTTPClient(client *http.Client) *GetAPIMetafieldsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API metafields params +func (o *GetAPIMetafieldsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithEntity adds the entity to the get API metafields params +func (o *GetAPIMetafieldsParams) WithEntity(entity string) *GetAPIMetafieldsParams { + o.SetEntity(entity) + return o +} + +// SetEntity adds the entity to the get API metafields params +func (o *GetAPIMetafieldsParams) SetEntity(entity string) { + o.Entity = entity +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIMetafieldsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param entity + qrEntity := o.Entity + qEntity := qrEntity + + if err := r.SetQueryParam("entity", qEntity); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/meta_field/get_api_metafields_responses.go b/client/meta_field/get_api_metafields_responses.go new file mode 100644 index 0000000..f75dc56 --- /dev/null +++ b/client/meta_field/get_api_metafields_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package meta_field + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIMetafieldsReader is a Reader for the GetAPIMetafields structure. +type GetAPIMetafieldsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIMetafieldsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIMetafieldsOK() + 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()) + } +} + +// NewGetAPIMetafieldsOK creates a GetAPIMetafieldsOK with default headers values +func NewGetAPIMetafieldsOK() *GetAPIMetafieldsOK { + return &GetAPIMetafieldsOK{} +} + +/* +GetAPIMetafieldsOK describes a response with status code 200, with default header values. + +Returns a collection of meta-fields +*/ +type GetAPIMetafieldsOK struct { + Payload []*models.MetaFieldRule +} + +// IsSuccess returns true when this get Api metafields o k response has a 2xx status code +func (o *GetAPIMetafieldsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api metafields o k response has a 3xx status code +func (o *GetAPIMetafieldsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api metafields o k response has a 4xx status code +func (o *GetAPIMetafieldsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api metafields o k response has a 5xx status code +func (o *GetAPIMetafieldsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api metafields o k response a status code equal to that given +func (o *GetAPIMetafieldsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIMetafieldsOK) Error() string { + return fmt.Sprintf("[GET /api/metafields][%d] getApiMetafieldsOK %+v", 200, o.Payload) +} + +func (o *GetAPIMetafieldsOK) String() string { + return fmt.Sprintf("[GET /api/metafields][%d] getApiMetafieldsOK %+v", 200, o.Payload) +} + +func (o *GetAPIMetafieldsOK) GetPayload() []*models.MetaFieldRule { + return o.Payload +} + +func (o *GetAPIMetafieldsOK) 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/meta_field/meta_field_client.go b/client/meta_field/meta_field_client.go new file mode 100644 index 0000000..27efdfe --- /dev/null +++ b/client/meta_field/meta_field_client.go @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package meta_field + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new meta field API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for meta field API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetAPIMetafields(params *GetAPIMetafieldsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIMetafieldsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetAPIMetafields returns a collection of meta fields +*/ +func (a *Client) GetAPIMetafields(params *GetAPIMetafieldsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIMetafieldsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIMetafieldsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIMetafields", + Method: "GET", + PathPattern: "/api/metafields", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIMetafieldsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIMetafieldsOK) + 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 GetAPIMetafields: 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/project/delete_api_projects_id_rates_rate_id_parameters.go b/client/project/delete_api_projects_id_rates_rate_id_parameters.go new file mode 100644 index 0000000..8bea20a --- /dev/null +++ b/client/project/delete_api_projects_id_rates_rate_id_parameters.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" +) + +// NewDeleteAPIProjectsIDRatesRateIDParams creates a new DeleteAPIProjectsIDRatesRateIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPIProjectsIDRatesRateIDParams() *DeleteAPIProjectsIDRatesRateIDParams { + return &DeleteAPIProjectsIDRatesRateIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPIProjectsIDRatesRateIDParamsWithTimeout creates a new DeleteAPIProjectsIDRatesRateIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPIProjectsIDRatesRateIDParamsWithTimeout(timeout time.Duration) *DeleteAPIProjectsIDRatesRateIDParams { + return &DeleteAPIProjectsIDRatesRateIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPIProjectsIDRatesRateIDParamsWithContext creates a new DeleteAPIProjectsIDRatesRateIDParams object +// with the ability to set a context for a request. +func NewDeleteAPIProjectsIDRatesRateIDParamsWithContext(ctx context.Context) *DeleteAPIProjectsIDRatesRateIDParams { + return &DeleteAPIProjectsIDRatesRateIDParams{ + Context: ctx, + } +} + +// NewDeleteAPIProjectsIDRatesRateIDParamsWithHTTPClient creates a new DeleteAPIProjectsIDRatesRateIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPIProjectsIDRatesRateIDParamsWithHTTPClient(client *http.Client) *DeleteAPIProjectsIDRatesRateIDParams { + return &DeleteAPIProjectsIDRatesRateIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPIProjectsIDRatesRateIDParams contains all the parameters to send to the API endpoint + + for the delete API projects ID rates rate ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPIProjectsIDRatesRateIDParams struct { + + /* ID. + + The project whose rate will be removed + */ + ID int64 + + /* RateID. + + The rate to remove + */ + RateID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API projects ID rates rate ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIProjectsIDRatesRateIDParams) WithDefaults() *DeleteAPIProjectsIDRatesRateIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API projects ID rates rate ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPIProjectsIDRatesRateIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API projects ID rates rate ID params +func (o *DeleteAPIProjectsIDRatesRateIDParams) WithTimeout(timeout time.Duration) *DeleteAPIProjectsIDRatesRateIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API projects ID rates rate ID params +func (o *DeleteAPIProjectsIDRatesRateIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API projects ID rates rate ID params +func (o *DeleteAPIProjectsIDRatesRateIDParams) WithContext(ctx context.Context) *DeleteAPIProjectsIDRatesRateIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API projects ID rates rate ID params +func (o *DeleteAPIProjectsIDRatesRateIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API projects ID rates rate ID params +func (o *DeleteAPIProjectsIDRatesRateIDParams) WithHTTPClient(client *http.Client) *DeleteAPIProjectsIDRatesRateIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API projects ID rates rate ID params +func (o *DeleteAPIProjectsIDRatesRateIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete API projects ID rates rate ID params +func (o *DeleteAPIProjectsIDRatesRateIDParams) WithID(id int64) *DeleteAPIProjectsIDRatesRateIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API projects ID rates rate ID params +func (o *DeleteAPIProjectsIDRatesRateIDParams) SetID(id int64) { + o.ID = id +} + +// WithRateID adds the rateID to the delete API projects ID rates rate ID params +func (o *DeleteAPIProjectsIDRatesRateIDParams) WithRateID(rateID int64) *DeleteAPIProjectsIDRatesRateIDParams { + o.SetRateID(rateID) + return o +} + +// SetRateID adds the rateId to the delete API projects ID rates rate ID params +func (o *DeleteAPIProjectsIDRatesRateIDParams) SetRateID(rateID int64) { + o.RateID = rateID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPIProjectsIDRatesRateIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + // path param rateId + if err := r.SetPathParam("rateId", swag.FormatInt64(o.RateID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/project/delete_api_projects_id_rates_rate_id_responses.go b/client/project/delete_api_projects_id_rates_rate_id_responses.go new file mode 100644 index 0000000..20ff932 --- /dev/null +++ b/client/project/delete_api_projects_id_rates_rate_id_responses.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// DeleteAPIProjectsIDRatesRateIDReader is a Reader for the DeleteAPIProjectsIDRatesRateID structure. +type DeleteAPIProjectsIDRatesRateIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPIProjectsIDRatesRateIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 204: + result := NewDeleteAPIProjectsIDRatesRateIDNoContent() + 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()) + } +} + +// NewDeleteAPIProjectsIDRatesRateIDNoContent creates a DeleteAPIProjectsIDRatesRateIDNoContent with default headers values +func NewDeleteAPIProjectsIDRatesRateIDNoContent() *DeleteAPIProjectsIDRatesRateIDNoContent { + return &DeleteAPIProjectsIDRatesRateIDNoContent{} +} + +/* +DeleteAPIProjectsIDRatesRateIDNoContent describes a response with status code 204, with default header values. + +Returns no content: 204 on successful delete +*/ +type DeleteAPIProjectsIDRatesRateIDNoContent struct { +} + +// IsSuccess returns true when this delete Api projects Id rates rate Id no content response has a 2xx status code +func (o *DeleteAPIProjectsIDRatesRateIDNoContent) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api projects Id rates rate Id no content response has a 3xx status code +func (o *DeleteAPIProjectsIDRatesRateIDNoContent) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api projects Id rates rate Id no content response has a 4xx status code +func (o *DeleteAPIProjectsIDRatesRateIDNoContent) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api projects Id rates rate Id no content response has a 5xx status code +func (o *DeleteAPIProjectsIDRatesRateIDNoContent) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api projects Id rates rate Id no content response a status code equal to that given +func (o *DeleteAPIProjectsIDRatesRateIDNoContent) IsCode(code int) bool { + return code == 204 +} + +func (o *DeleteAPIProjectsIDRatesRateIDNoContent) Error() string { + return fmt.Sprintf("[DELETE /api/projects/{id}/rates/{rateId}][%d] deleteApiProjectsIdRatesRateIdNoContent ", 204) +} + +func (o *DeleteAPIProjectsIDRatesRateIDNoContent) String() string { + return fmt.Sprintf("[DELETE /api/projects/{id}/rates/{rateId}][%d] deleteApiProjectsIdRatesRateIdNoContent ", 204) +} + +func (o *DeleteAPIProjectsIDRatesRateIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/project/get_api_projects_id_parameters.go b/client/project/get_api_projects_id_parameters.go new file mode 100644 index 0000000..9cf7c01 --- /dev/null +++ b/client/project/get_api_projects_id_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" +) + +// NewGetAPIProjectsIDParams creates a new GetAPIProjectsIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIProjectsIDParams() *GetAPIProjectsIDParams { + return &GetAPIProjectsIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIProjectsIDParamsWithTimeout creates a new GetAPIProjectsIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIProjectsIDParamsWithTimeout(timeout time.Duration) *GetAPIProjectsIDParams { + return &GetAPIProjectsIDParams{ + timeout: timeout, + } +} + +// NewGetAPIProjectsIDParamsWithContext creates a new GetAPIProjectsIDParams object +// with the ability to set a context for a request. +func NewGetAPIProjectsIDParamsWithContext(ctx context.Context) *GetAPIProjectsIDParams { + return &GetAPIProjectsIDParams{ + Context: ctx, + } +} + +// NewGetAPIProjectsIDParamsWithHTTPClient creates a new GetAPIProjectsIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIProjectsIDParamsWithHTTPClient(client *http.Client) *GetAPIProjectsIDParams { + return &GetAPIProjectsIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIProjectsIDParams contains all the parameters to send to the API endpoint + + for the get API projects ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIProjectsIDParams struct { + + // ID. + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API projects ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIProjectsIDParams) WithDefaults() *GetAPIProjectsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API projects ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIProjectsIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API projects ID params +func (o *GetAPIProjectsIDParams) WithTimeout(timeout time.Duration) *GetAPIProjectsIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API projects ID params +func (o *GetAPIProjectsIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API projects ID params +func (o *GetAPIProjectsIDParams) WithContext(ctx context.Context) *GetAPIProjectsIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API projects ID params +func (o *GetAPIProjectsIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API projects ID params +func (o *GetAPIProjectsIDParams) WithHTTPClient(client *http.Client) *GetAPIProjectsIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API projects ID params +func (o *GetAPIProjectsIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get API projects ID params +func (o *GetAPIProjectsIDParams) WithID(id string) *GetAPIProjectsIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API projects ID params +func (o *GetAPIProjectsIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIProjectsIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/project/get_api_projects_id_rates_parameters.go b/client/project/get_api_projects_id_rates_parameters.go new file mode 100644 index 0000000..a6f7791 --- /dev/null +++ b/client/project/get_api_projects_id_rates_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" +) + +// NewGetAPIProjectsIDRatesParams creates a new GetAPIProjectsIDRatesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIProjectsIDRatesParams() *GetAPIProjectsIDRatesParams { + return &GetAPIProjectsIDRatesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIProjectsIDRatesParamsWithTimeout creates a new GetAPIProjectsIDRatesParams object +// with the ability to set a timeout on a request. +func NewGetAPIProjectsIDRatesParamsWithTimeout(timeout time.Duration) *GetAPIProjectsIDRatesParams { + return &GetAPIProjectsIDRatesParams{ + timeout: timeout, + } +} + +// NewGetAPIProjectsIDRatesParamsWithContext creates a new GetAPIProjectsIDRatesParams object +// with the ability to set a context for a request. +func NewGetAPIProjectsIDRatesParamsWithContext(ctx context.Context) *GetAPIProjectsIDRatesParams { + return &GetAPIProjectsIDRatesParams{ + Context: ctx, + } +} + +// NewGetAPIProjectsIDRatesParamsWithHTTPClient creates a new GetAPIProjectsIDRatesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIProjectsIDRatesParamsWithHTTPClient(client *http.Client) *GetAPIProjectsIDRatesParams { + return &GetAPIProjectsIDRatesParams{ + HTTPClient: client, + } +} + +/* +GetAPIProjectsIDRatesParams contains all the parameters to send to the API endpoint + + for the get API projects ID rates operation. + + Typically these are written to a http.Request. +*/ +type GetAPIProjectsIDRatesParams struct { + + /* ID. + + The project whose rates will be returned + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API projects ID rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIProjectsIDRatesParams) WithDefaults() *GetAPIProjectsIDRatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API projects ID rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIProjectsIDRatesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API projects ID rates params +func (o *GetAPIProjectsIDRatesParams) WithTimeout(timeout time.Duration) *GetAPIProjectsIDRatesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API projects ID rates params +func (o *GetAPIProjectsIDRatesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API projects ID rates params +func (o *GetAPIProjectsIDRatesParams) WithContext(ctx context.Context) *GetAPIProjectsIDRatesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API projects ID rates params +func (o *GetAPIProjectsIDRatesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API projects ID rates params +func (o *GetAPIProjectsIDRatesParams) WithHTTPClient(client *http.Client) *GetAPIProjectsIDRatesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API projects ID rates params +func (o *GetAPIProjectsIDRatesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get API projects ID rates params +func (o *GetAPIProjectsIDRatesParams) WithID(id int64) *GetAPIProjectsIDRatesParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API projects ID rates params +func (o *GetAPIProjectsIDRatesParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIProjectsIDRatesParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/project/get_api_projects_id_rates_responses.go b/client/project/get_api_projects_id_rates_responses.go new file mode 100644 index 0000000..f68d717 --- /dev/null +++ b/client/project/get_api_projects_id_rates_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIProjectsIDRatesReader is a Reader for the GetAPIProjectsIDRates structure. +type GetAPIProjectsIDRatesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIProjectsIDRatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIProjectsIDRatesOK() + 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()) + } +} + +// NewGetAPIProjectsIDRatesOK creates a GetAPIProjectsIDRatesOK with default headers values +func NewGetAPIProjectsIDRatesOK() *GetAPIProjectsIDRatesOK { + return &GetAPIProjectsIDRatesOK{} +} + +/* +GetAPIProjectsIDRatesOK describes a response with status code 200, with default header values. + +Returns a collection of project rate entities +*/ +type GetAPIProjectsIDRatesOK struct { + Payload []*models.ProjectRate +} + +// IsSuccess returns true when this get Api projects Id rates o k response has a 2xx status code +func (o *GetAPIProjectsIDRatesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api projects Id rates o k response has a 3xx status code +func (o *GetAPIProjectsIDRatesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api projects Id rates o k response has a 4xx status code +func (o *GetAPIProjectsIDRatesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api projects Id rates o k response has a 5xx status code +func (o *GetAPIProjectsIDRatesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api projects Id rates o k response a status code equal to that given +func (o *GetAPIProjectsIDRatesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIProjectsIDRatesOK) Error() string { + return fmt.Sprintf("[GET /api/projects/{id}/rates][%d] getApiProjectsIdRatesOK %+v", 200, o.Payload) +} + +func (o *GetAPIProjectsIDRatesOK) String() string { + return fmt.Sprintf("[GET /api/projects/{id}/rates][%d] getApiProjectsIdRatesOK %+v", 200, o.Payload) +} + +func (o *GetAPIProjectsIDRatesOK) GetPayload() []*models.ProjectRate { + return o.Payload +} + +func (o *GetAPIProjectsIDRatesOK) 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/project/get_api_projects_id_responses.go b/client/project/get_api_projects_id_responses.go new file mode 100644 index 0000000..9a53aff --- /dev/null +++ b/client/project/get_api_projects_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIProjectsIDReader is a Reader for the GetAPIProjectsID structure. +type GetAPIProjectsIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIProjectsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIProjectsIDOK() + 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()) + } +} + +// NewGetAPIProjectsIDOK creates a GetAPIProjectsIDOK with default headers values +func NewGetAPIProjectsIDOK() *GetAPIProjectsIDOK { + return &GetAPIProjectsIDOK{} +} + +/* +GetAPIProjectsIDOK describes a response with status code 200, with default header values. + +Returns one project entity +*/ +type GetAPIProjectsIDOK struct { + Payload *models.ProjectEntity +} + +// IsSuccess returns true when this get Api projects Id o k response has a 2xx status code +func (o *GetAPIProjectsIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api projects Id o k response has a 3xx status code +func (o *GetAPIProjectsIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api projects Id o k response has a 4xx status code +func (o *GetAPIProjectsIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api projects Id o k response has a 5xx status code +func (o *GetAPIProjectsIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api projects Id o k response a status code equal to that given +func (o *GetAPIProjectsIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIProjectsIDOK) Error() string { + return fmt.Sprintf("[GET /api/projects/{id}][%d] getApiProjectsIdOK %+v", 200, o.Payload) +} + +func (o *GetAPIProjectsIDOK) String() string { + return fmt.Sprintf("[GET /api/projects/{id}][%d] getApiProjectsIdOK %+v", 200, o.Payload) +} + +func (o *GetAPIProjectsIDOK) GetPayload() *models.ProjectEntity { + return o.Payload +} + +func (o *GetAPIProjectsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ProjectEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/project/get_api_projects_parameters.go b/client/project/get_api_projects_parameters.go new file mode 100644 index 0000000..caa2c9a --- /dev/null +++ b/client/project/get_api_projects_parameters.go @@ -0,0 +1,392 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" +) + +// NewGetAPIProjectsParams creates a new GetAPIProjectsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIProjectsParams() *GetAPIProjectsParams { + return &GetAPIProjectsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIProjectsParamsWithTimeout creates a new GetAPIProjectsParams object +// with the ability to set a timeout on a request. +func NewGetAPIProjectsParamsWithTimeout(timeout time.Duration) *GetAPIProjectsParams { + return &GetAPIProjectsParams{ + timeout: timeout, + } +} + +// NewGetAPIProjectsParamsWithContext creates a new GetAPIProjectsParams object +// with the ability to set a context for a request. +func NewGetAPIProjectsParamsWithContext(ctx context.Context) *GetAPIProjectsParams { + return &GetAPIProjectsParams{ + Context: ctx, + } +} + +// NewGetAPIProjectsParamsWithHTTPClient creates a new GetAPIProjectsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIProjectsParamsWithHTTPClient(client *http.Client) *GetAPIProjectsParams { + return &GetAPIProjectsParams{ + HTTPClient: client, + } +} + +/* +GetAPIProjectsParams contains all the parameters to send to the API endpoint + + for the get API projects operation. + + Typically these are written to a http.Request. +*/ +type GetAPIProjectsParams struct { + + /* Customer. + + Customer ID to filter projects + */ + Customer string + + /* Customers. + + Comma separated list of customer IDs to filter projects + */ + Customers string + + /* End. + + Only projects that ended after this date will be included. Allowed format: HTML5 (default: now, if start is also empty) + + Format: DateTime + */ + End string + + /* GlobalActivities. + + If given, filters projects by their 'global activity' support. Allowed values: 1 (supports global activities) and 0 (without global activities) (default: all) + */ + GlobalActivities string + + /* IgnoreDates. + + If set, start and end are completely ignored. Allowed values: 1 (default: off) + */ + IgnoreDates string + + /* Order. + + The result order. Allowed values: ASC, DESC (default: ASC) + */ + Order string + + /* OrderBy. + + The field by which results will be ordered. Allowed values: id, name, customer (default: name) + */ + OrderBy string + + /* Start. + + Only projects that started before this date will be included. Allowed format: HTML5 (default: now, if end is also empty) + + Format: DateTime + */ + Start string + + /* Term. + + Free search term + */ + Term *string + + /* Visible. + + Visibility status to filter projects. Allowed values: 1=visible, 2=hidden, 3=both (default: 1) + */ + Visible string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API projects params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIProjectsParams) WithDefaults() *GetAPIProjectsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API projects params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIProjectsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API projects params +func (o *GetAPIProjectsParams) WithTimeout(timeout time.Duration) *GetAPIProjectsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API projects params +func (o *GetAPIProjectsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API projects params +func (o *GetAPIProjectsParams) WithContext(ctx context.Context) *GetAPIProjectsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API projects params +func (o *GetAPIProjectsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API projects params +func (o *GetAPIProjectsParams) WithHTTPClient(client *http.Client) *GetAPIProjectsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API projects params +func (o *GetAPIProjectsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCustomer adds the customer to the get API projects params +func (o *GetAPIProjectsParams) WithCustomer(customer string) *GetAPIProjectsParams { + o.SetCustomer(customer) + return o +} + +// SetCustomer adds the customer to the get API projects params +func (o *GetAPIProjectsParams) SetCustomer(customer string) { + o.Customer = customer +} + +// WithCustomers adds the customers to the get API projects params +func (o *GetAPIProjectsParams) WithCustomers(customers string) *GetAPIProjectsParams { + o.SetCustomers(customers) + return o +} + +// SetCustomers adds the customers to the get API projects params +func (o *GetAPIProjectsParams) SetCustomers(customers string) { + o.Customers = customers +} + +// WithEnd adds the end to the get API projects params +func (o *GetAPIProjectsParams) WithEnd(end string) *GetAPIProjectsParams { + o.SetEnd(end) + return o +} + +// SetEnd adds the end to the get API projects params +func (o *GetAPIProjectsParams) SetEnd(end string) { + o.End = end +} + +// WithGlobalActivities adds the globalActivities to the get API projects params +func (o *GetAPIProjectsParams) WithGlobalActivities(globalActivities string) *GetAPIProjectsParams { + o.SetGlobalActivities(globalActivities) + return o +} + +// SetGlobalActivities adds the globalActivities to the get API projects params +func (o *GetAPIProjectsParams) SetGlobalActivities(globalActivities string) { + o.GlobalActivities = globalActivities +} + +// WithIgnoreDates adds the ignoreDates to the get API projects params +func (o *GetAPIProjectsParams) WithIgnoreDates(ignoreDates string) *GetAPIProjectsParams { + o.SetIgnoreDates(ignoreDates) + return o +} + +// SetIgnoreDates adds the ignoreDates to the get API projects params +func (o *GetAPIProjectsParams) SetIgnoreDates(ignoreDates string) { + o.IgnoreDates = ignoreDates +} + +// WithOrder adds the order to the get API projects params +func (o *GetAPIProjectsParams) WithOrder(order string) *GetAPIProjectsParams { + o.SetOrder(order) + return o +} + +// SetOrder adds the order to the get API projects params +func (o *GetAPIProjectsParams) SetOrder(order string) { + o.Order = order +} + +// WithOrderBy adds the orderBy to the get API projects params +func (o *GetAPIProjectsParams) WithOrderBy(orderBy string) *GetAPIProjectsParams { + o.SetOrderBy(orderBy) + return o +} + +// SetOrderBy adds the orderBy to the get API projects params +func (o *GetAPIProjectsParams) SetOrderBy(orderBy string) { + o.OrderBy = orderBy +} + +// WithStart adds the start to the get API projects params +func (o *GetAPIProjectsParams) WithStart(start string) *GetAPIProjectsParams { + o.SetStart(start) + return o +} + +// SetStart adds the start to the get API projects params +func (o *GetAPIProjectsParams) SetStart(start string) { + o.Start = start +} + +// WithTerm adds the term to the get API projects params +func (o *GetAPIProjectsParams) WithTerm(term *string) *GetAPIProjectsParams { + o.SetTerm(term) + return o +} + +// SetTerm adds the term to the get API projects params +func (o *GetAPIProjectsParams) SetTerm(term *string) { + o.Term = term +} + +// WithVisible adds the visible to the get API projects params +func (o *GetAPIProjectsParams) WithVisible(visible string) *GetAPIProjectsParams { + o.SetVisible(visible) + return o +} + +// SetVisible adds the visible to the get API projects params +func (o *GetAPIProjectsParams) SetVisible(visible string) { + o.Visible = visible +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIProjectsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param customer + qrCustomer := o.Customer + qCustomer := qrCustomer + + if err := r.SetQueryParam("customer", qCustomer); err != nil { + return err + } + + // query param customers + qrCustomers := o.Customers + qCustomers := qrCustomers + + if err := r.SetQueryParam("customers", qCustomers); err != nil { + return err + } + + // query param end + qrEnd := o.End + qEnd := qrEnd + + if err := r.SetQueryParam("end", qEnd); err != nil { + return err + } + + // query param globalActivities + qrGlobalActivities := o.GlobalActivities + qGlobalActivities := qrGlobalActivities + + if err := r.SetQueryParam("globalActivities", qGlobalActivities); err != nil { + return err + } + + // query param ignoreDates + qrIgnoreDates := o.IgnoreDates + qIgnoreDates := qrIgnoreDates + + if err := r.SetQueryParam("ignoreDates", qIgnoreDates); err != nil { + return err + } + + // query param order + qrOrder := o.Order + qOrder := qrOrder + + if err := r.SetQueryParam("order", qOrder); err != nil { + return err + } + + // query param orderBy + qrOrderBy := o.OrderBy + qOrderBy := qrOrderBy + + if err := r.SetQueryParam("orderBy", qOrderBy); err != nil { + return err + } + + // query param start + qrStart := o.Start + qStart := qrStart + + if err := r.SetQueryParam("start", qStart); err != nil { + return err + } + + if o.Term != nil { + + // query param term + var qrTerm string + + if o.Term != nil { + qrTerm = *o.Term + } + qTerm := qrTerm + if qTerm != "" { + + if err := r.SetQueryParam("term", qTerm); err != nil { + return err + } + } + } + + // query param visible + qrVisible := o.Visible + qVisible := qrVisible + + if err := r.SetQueryParam("visible", qVisible); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/project/get_api_projects_responses.go b/client/project/get_api_projects_responses.go new file mode 100644 index 0000000..3e650bf --- /dev/null +++ b/client/project/get_api_projects_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIProjectsReader is a Reader for the GetAPIProjects structure. +type GetAPIProjectsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIProjectsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIProjectsOK() + 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()) + } +} + +// NewGetAPIProjectsOK creates a GetAPIProjectsOK with default headers values +func NewGetAPIProjectsOK() *GetAPIProjectsOK { + return &GetAPIProjectsOK{} +} + +/* +GetAPIProjectsOK describes a response with status code 200, with default header values. + +Returns a collection of project entities +*/ +type GetAPIProjectsOK struct { + Payload []*models.ProjectCollection +} + +// IsSuccess returns true when this get Api projects o k response has a 2xx status code +func (o *GetAPIProjectsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api projects o k response has a 3xx status code +func (o *GetAPIProjectsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api projects o k response has a 4xx status code +func (o *GetAPIProjectsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api projects o k response has a 5xx status code +func (o *GetAPIProjectsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api projects o k response a status code equal to that given +func (o *GetAPIProjectsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIProjectsOK) Error() string { + return fmt.Sprintf("[GET /api/projects][%d] getApiProjectsOK %+v", 200, o.Payload) +} + +func (o *GetAPIProjectsOK) String() string { + return fmt.Sprintf("[GET /api/projects][%d] getApiProjectsOK %+v", 200, o.Payload) +} + +func (o *GetAPIProjectsOK) GetPayload() []*models.ProjectCollection { + return o.Payload +} + +func (o *GetAPIProjectsOK) 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/project/patch_api_projects_id_meta_parameters.go b/client/project/patch_api_projects_id_meta_parameters.go new file mode 100644 index 0000000..be69a20 --- /dev/null +++ b/client/project/patch_api_projects_id_meta_parameters.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" +) + +// NewPatchAPIProjectsIDMetaParams creates a new PatchAPIProjectsIDMetaParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIProjectsIDMetaParams() *PatchAPIProjectsIDMetaParams { + return &PatchAPIProjectsIDMetaParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIProjectsIDMetaParamsWithTimeout creates a new PatchAPIProjectsIDMetaParams object +// with the ability to set a timeout on a request. +func NewPatchAPIProjectsIDMetaParamsWithTimeout(timeout time.Duration) *PatchAPIProjectsIDMetaParams { + return &PatchAPIProjectsIDMetaParams{ + timeout: timeout, + } +} + +// NewPatchAPIProjectsIDMetaParamsWithContext creates a new PatchAPIProjectsIDMetaParams object +// with the ability to set a context for a request. +func NewPatchAPIProjectsIDMetaParamsWithContext(ctx context.Context) *PatchAPIProjectsIDMetaParams { + return &PatchAPIProjectsIDMetaParams{ + Context: ctx, + } +} + +// NewPatchAPIProjectsIDMetaParamsWithHTTPClient creates a new PatchAPIProjectsIDMetaParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIProjectsIDMetaParamsWithHTTPClient(client *http.Client) *PatchAPIProjectsIDMetaParams { + return &PatchAPIProjectsIDMetaParams{ + HTTPClient: client, + } +} + +/* +PatchAPIProjectsIDMetaParams contains all the parameters to send to the API endpoint + + for the patch API projects ID meta operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIProjectsIDMetaParams struct { + + // Body. + Body PatchAPIProjectsIDMetaBody + + /* ID. + + Project record ID to set the meta-field value for + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API projects ID meta params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIProjectsIDMetaParams) WithDefaults() *PatchAPIProjectsIDMetaParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API projects ID meta params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIProjectsIDMetaParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API projects ID meta params +func (o *PatchAPIProjectsIDMetaParams) WithTimeout(timeout time.Duration) *PatchAPIProjectsIDMetaParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API projects ID meta params +func (o *PatchAPIProjectsIDMetaParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API projects ID meta params +func (o *PatchAPIProjectsIDMetaParams) WithContext(ctx context.Context) *PatchAPIProjectsIDMetaParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API projects ID meta params +func (o *PatchAPIProjectsIDMetaParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API projects ID meta params +func (o *PatchAPIProjectsIDMetaParams) WithHTTPClient(client *http.Client) *PatchAPIProjectsIDMetaParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API projects ID meta params +func (o *PatchAPIProjectsIDMetaParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API projects ID meta params +func (o *PatchAPIProjectsIDMetaParams) WithBody(body PatchAPIProjectsIDMetaBody) *PatchAPIProjectsIDMetaParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API projects ID meta params +func (o *PatchAPIProjectsIDMetaParams) SetBody(body PatchAPIProjectsIDMetaBody) { + o.Body = body +} + +// WithID adds the id to the patch API projects ID meta params +func (o *PatchAPIProjectsIDMetaParams) WithID(id int64) *PatchAPIProjectsIDMetaParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API projects ID meta params +func (o *PatchAPIProjectsIDMetaParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIProjectsIDMetaParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/project/patch_api_projects_id_meta_responses.go b/client/project/patch_api_projects_id_meta_responses.go new file mode 100644 index 0000000..7a6b408 --- /dev/null +++ b/client/project/patch_api_projects_id_meta_responses.go @@ -0,0 +1,176 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + + "decentral1se/go-kimai/models" +) + +// PatchAPIProjectsIDMetaReader is a Reader for the PatchAPIProjectsIDMeta structure. +type PatchAPIProjectsIDMetaReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIProjectsIDMetaReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIProjectsIDMetaOK() + 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()) + } +} + +// NewPatchAPIProjectsIDMetaOK creates a PatchAPIProjectsIDMetaOK with default headers values +func NewPatchAPIProjectsIDMetaOK() *PatchAPIProjectsIDMetaOK { + return &PatchAPIProjectsIDMetaOK{} +} + +/* +PatchAPIProjectsIDMetaOK describes a response with status code 200, with default header values. + +Sets the value of an existing/configured meta-field. You cannot create unknown meta-fields, if the given name is not a configured meta-field, this will return an exception. +*/ +type PatchAPIProjectsIDMetaOK struct { + Payload *models.ProjectEntity +} + +// IsSuccess returns true when this patch Api projects Id meta o k response has a 2xx status code +func (o *PatchAPIProjectsIDMetaOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api projects Id meta o k response has a 3xx status code +func (o *PatchAPIProjectsIDMetaOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api projects Id meta o k response has a 4xx status code +func (o *PatchAPIProjectsIDMetaOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api projects Id meta o k response has a 5xx status code +func (o *PatchAPIProjectsIDMetaOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api projects Id meta o k response a status code equal to that given +func (o *PatchAPIProjectsIDMetaOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPIProjectsIDMetaOK) Error() string { + return fmt.Sprintf("[PATCH /api/projects/{id}/meta][%d] patchApiProjectsIdMetaOK %+v", 200, o.Payload) +} + +func (o *PatchAPIProjectsIDMetaOK) String() string { + return fmt.Sprintf("[PATCH /api/projects/{id}/meta][%d] patchApiProjectsIdMetaOK %+v", 200, o.Payload) +} + +func (o *PatchAPIProjectsIDMetaOK) GetPayload() *models.ProjectEntity { + return o.Payload +} + +func (o *PatchAPIProjectsIDMetaOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ProjectEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +PatchAPIProjectsIDMetaBody patch API projects ID meta body +swagger:model PatchAPIProjectsIDMetaBody +*/ +type PatchAPIProjectsIDMetaBody struct { + + // The meta-field name + // Required: true + Name *string `json:"name"` + + // The meta-field value + // Required: true + Value *string `json:"value"` +} + +// Validate validates this patch API projects ID meta body +func (o *PatchAPIProjectsIDMetaBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateName(formats); err != nil { + res = append(res, err) + } + + if err := o.validateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *PatchAPIProjectsIDMetaBody) validateName(formats strfmt.Registry) error { + + if err := validate.Required("body"+"."+"name", "body", o.Name); err != nil { + return err + } + + return nil +} + +func (o *PatchAPIProjectsIDMetaBody) validateValue(formats strfmt.Registry) error { + + if err := validate.Required("body"+"."+"value", "body", o.Value); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this patch API projects ID meta body based on context it is used +func (o *PatchAPIProjectsIDMetaBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *PatchAPIProjectsIDMetaBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *PatchAPIProjectsIDMetaBody) UnmarshalBinary(b []byte) error { + var res PatchAPIProjectsIDMetaBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/client/project/patch_api_projects_id_parameters.go b/client/project/patch_api_projects_id_parameters.go new file mode 100644 index 0000000..db8625b --- /dev/null +++ b/client/project/patch_api_projects_id_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPatchAPIProjectsIDParams creates a new PatchAPIProjectsIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIProjectsIDParams() *PatchAPIProjectsIDParams { + return &PatchAPIProjectsIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIProjectsIDParamsWithTimeout creates a new PatchAPIProjectsIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPIProjectsIDParamsWithTimeout(timeout time.Duration) *PatchAPIProjectsIDParams { + return &PatchAPIProjectsIDParams{ + timeout: timeout, + } +} + +// NewPatchAPIProjectsIDParamsWithContext creates a new PatchAPIProjectsIDParams object +// with the ability to set a context for a request. +func NewPatchAPIProjectsIDParamsWithContext(ctx context.Context) *PatchAPIProjectsIDParams { + return &PatchAPIProjectsIDParams{ + Context: ctx, + } +} + +// NewPatchAPIProjectsIDParamsWithHTTPClient creates a new PatchAPIProjectsIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIProjectsIDParamsWithHTTPClient(client *http.Client) *PatchAPIProjectsIDParams { + return &PatchAPIProjectsIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPIProjectsIDParams contains all the parameters to send to the API endpoint + + for the patch API projects ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIProjectsIDParams struct { + + // Body. + Body *models.ProjectEditForm + + /* ID. + + Project ID to update + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API projects ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIProjectsIDParams) WithDefaults() *PatchAPIProjectsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API projects ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIProjectsIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API projects ID params +func (o *PatchAPIProjectsIDParams) WithTimeout(timeout time.Duration) *PatchAPIProjectsIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API projects ID params +func (o *PatchAPIProjectsIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API projects ID params +func (o *PatchAPIProjectsIDParams) WithContext(ctx context.Context) *PatchAPIProjectsIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API projects ID params +func (o *PatchAPIProjectsIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API projects ID params +func (o *PatchAPIProjectsIDParams) WithHTTPClient(client *http.Client) *PatchAPIProjectsIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API projects ID params +func (o *PatchAPIProjectsIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API projects ID params +func (o *PatchAPIProjectsIDParams) WithBody(body *models.ProjectEditForm) *PatchAPIProjectsIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API projects ID params +func (o *PatchAPIProjectsIDParams) SetBody(body *models.ProjectEditForm) { + o.Body = body +} + +// WithID adds the id to the patch API projects ID params +func (o *PatchAPIProjectsIDParams) WithID(id int64) *PatchAPIProjectsIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API projects ID params +func (o *PatchAPIProjectsIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIProjectsIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/project/patch_api_projects_id_responses.go b/client/project/patch_api_projects_id_responses.go new file mode 100644 index 0000000..01bbde6 --- /dev/null +++ b/client/project/patch_api_projects_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPIProjectsIDReader is a Reader for the PatchAPIProjectsID structure. +type PatchAPIProjectsIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIProjectsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIProjectsIDOK() + 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()) + } +} + +// NewPatchAPIProjectsIDOK creates a PatchAPIProjectsIDOK with default headers values +func NewPatchAPIProjectsIDOK() *PatchAPIProjectsIDOK { + return &PatchAPIProjectsIDOK{} +} + +/* +PatchAPIProjectsIDOK describes a response with status code 200, with default header values. + +Returns the updated project +*/ +type PatchAPIProjectsIDOK struct { + Payload *models.ProjectEntity +} + +// IsSuccess returns true when this patch Api projects Id o k response has a 2xx status code +func (o *PatchAPIProjectsIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api projects Id o k response has a 3xx status code +func (o *PatchAPIProjectsIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api projects Id o k response has a 4xx status code +func (o *PatchAPIProjectsIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api projects Id o k response has a 5xx status code +func (o *PatchAPIProjectsIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api projects Id o k response a status code equal to that given +func (o *PatchAPIProjectsIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPIProjectsIDOK) Error() string { + return fmt.Sprintf("[PATCH /api/projects/{id}][%d] patchApiProjectsIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPIProjectsIDOK) String() string { + return fmt.Sprintf("[PATCH /api/projects/{id}][%d] patchApiProjectsIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPIProjectsIDOK) GetPayload() *models.ProjectEntity { + return o.Payload +} + +func (o *PatchAPIProjectsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ProjectEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/project/post_api_projects_id_rates_parameters.go b/client/project/post_api_projects_id_rates_parameters.go new file mode 100644 index 0000000..1c8025a --- /dev/null +++ b/client/project/post_api_projects_id_rates_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPostAPIProjectsIDRatesParams creates a new PostAPIProjectsIDRatesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIProjectsIDRatesParams() *PostAPIProjectsIDRatesParams { + return &PostAPIProjectsIDRatesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIProjectsIDRatesParamsWithTimeout creates a new PostAPIProjectsIDRatesParams object +// with the ability to set a timeout on a request. +func NewPostAPIProjectsIDRatesParamsWithTimeout(timeout time.Duration) *PostAPIProjectsIDRatesParams { + return &PostAPIProjectsIDRatesParams{ + timeout: timeout, + } +} + +// NewPostAPIProjectsIDRatesParamsWithContext creates a new PostAPIProjectsIDRatesParams object +// with the ability to set a context for a request. +func NewPostAPIProjectsIDRatesParamsWithContext(ctx context.Context) *PostAPIProjectsIDRatesParams { + return &PostAPIProjectsIDRatesParams{ + Context: ctx, + } +} + +// NewPostAPIProjectsIDRatesParamsWithHTTPClient creates a new PostAPIProjectsIDRatesParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIProjectsIDRatesParamsWithHTTPClient(client *http.Client) *PostAPIProjectsIDRatesParams { + return &PostAPIProjectsIDRatesParams{ + HTTPClient: client, + } +} + +/* +PostAPIProjectsIDRatesParams contains all the parameters to send to the API endpoint + + for the post API projects ID rates operation. + + Typically these are written to a http.Request. +*/ +type PostAPIProjectsIDRatesParams struct { + + // Body. + Body *models.ProjectRateForm + + /* ID. + + The project to add the rate for + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API projects ID rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIProjectsIDRatesParams) WithDefaults() *PostAPIProjectsIDRatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API projects ID rates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIProjectsIDRatesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API projects ID rates params +func (o *PostAPIProjectsIDRatesParams) WithTimeout(timeout time.Duration) *PostAPIProjectsIDRatesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API projects ID rates params +func (o *PostAPIProjectsIDRatesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API projects ID rates params +func (o *PostAPIProjectsIDRatesParams) WithContext(ctx context.Context) *PostAPIProjectsIDRatesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API projects ID rates params +func (o *PostAPIProjectsIDRatesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API projects ID rates params +func (o *PostAPIProjectsIDRatesParams) WithHTTPClient(client *http.Client) *PostAPIProjectsIDRatesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API projects ID rates params +func (o *PostAPIProjectsIDRatesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API projects ID rates params +func (o *PostAPIProjectsIDRatesParams) WithBody(body *models.ProjectRateForm) *PostAPIProjectsIDRatesParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API projects ID rates params +func (o *PostAPIProjectsIDRatesParams) SetBody(body *models.ProjectRateForm) { + o.Body = body +} + +// WithID adds the id to the post API projects ID rates params +func (o *PostAPIProjectsIDRatesParams) WithID(id int64) *PostAPIProjectsIDRatesParams { + o.SetID(id) + return o +} + +// SetID adds the id to the post API projects ID rates params +func (o *PostAPIProjectsIDRatesParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIProjectsIDRatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/project/post_api_projects_id_rates_responses.go b/client/project/post_api_projects_id_rates_responses.go new file mode 100644 index 0000000..745f7e6 --- /dev/null +++ b/client/project/post_api_projects_id_rates_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPIProjectsIDRatesReader is a Reader for the PostAPIProjectsIDRates structure. +type PostAPIProjectsIDRatesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIProjectsIDRatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIProjectsIDRatesOK() + 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()) + } +} + +// NewPostAPIProjectsIDRatesOK creates a PostAPIProjectsIDRatesOK with default headers values +func NewPostAPIProjectsIDRatesOK() *PostAPIProjectsIDRatesOK { + return &PostAPIProjectsIDRatesOK{} +} + +/* +PostAPIProjectsIDRatesOK describes a response with status code 200, with default header values. + +Returns the new created rate +*/ +type PostAPIProjectsIDRatesOK struct { + Payload *models.ProjectRate +} + +// IsSuccess returns true when this post Api projects Id rates o k response has a 2xx status code +func (o *PostAPIProjectsIDRatesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api projects Id rates o k response has a 3xx status code +func (o *PostAPIProjectsIDRatesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api projects Id rates o k response has a 4xx status code +func (o *PostAPIProjectsIDRatesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api projects Id rates o k response has a 5xx status code +func (o *PostAPIProjectsIDRatesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api projects Id rates o k response a status code equal to that given +func (o *PostAPIProjectsIDRatesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPIProjectsIDRatesOK) Error() string { + return fmt.Sprintf("[POST /api/projects/{id}/rates][%d] postApiProjectsIdRatesOK %+v", 200, o.Payload) +} + +func (o *PostAPIProjectsIDRatesOK) String() string { + return fmt.Sprintf("[POST /api/projects/{id}/rates][%d] postApiProjectsIdRatesOK %+v", 200, o.Payload) +} + +func (o *PostAPIProjectsIDRatesOK) GetPayload() *models.ProjectRate { + return o.Payload +} + +func (o *PostAPIProjectsIDRatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ProjectRate) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/project/post_api_projects_parameters.go b/client/project/post_api_projects_parameters.go new file mode 100644 index 0000000..5dbd048 --- /dev/null +++ b/client/project/post_api_projects_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPostAPIProjectsParams creates a new PostAPIProjectsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIProjectsParams() *PostAPIProjectsParams { + return &PostAPIProjectsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIProjectsParamsWithTimeout creates a new PostAPIProjectsParams object +// with the ability to set a timeout on a request. +func NewPostAPIProjectsParamsWithTimeout(timeout time.Duration) *PostAPIProjectsParams { + return &PostAPIProjectsParams{ + timeout: timeout, + } +} + +// NewPostAPIProjectsParamsWithContext creates a new PostAPIProjectsParams object +// with the ability to set a context for a request. +func NewPostAPIProjectsParamsWithContext(ctx context.Context) *PostAPIProjectsParams { + return &PostAPIProjectsParams{ + Context: ctx, + } +} + +// NewPostAPIProjectsParamsWithHTTPClient creates a new PostAPIProjectsParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIProjectsParamsWithHTTPClient(client *http.Client) *PostAPIProjectsParams { + return &PostAPIProjectsParams{ + HTTPClient: client, + } +} + +/* +PostAPIProjectsParams contains all the parameters to send to the API endpoint + + for the post API projects operation. + + Typically these are written to a http.Request. +*/ +type PostAPIProjectsParams struct { + + // Body. + Body *models.ProjectEditForm + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API projects params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIProjectsParams) WithDefaults() *PostAPIProjectsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API projects params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIProjectsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API projects params +func (o *PostAPIProjectsParams) WithTimeout(timeout time.Duration) *PostAPIProjectsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API projects params +func (o *PostAPIProjectsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API projects params +func (o *PostAPIProjectsParams) WithContext(ctx context.Context) *PostAPIProjectsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API projects params +func (o *PostAPIProjectsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API projects params +func (o *PostAPIProjectsParams) WithHTTPClient(client *http.Client) *PostAPIProjectsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API projects params +func (o *PostAPIProjectsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API projects params +func (o *PostAPIProjectsParams) WithBody(body *models.ProjectEditForm) *PostAPIProjectsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API projects params +func (o *PostAPIProjectsParams) SetBody(body *models.ProjectEditForm) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIProjectsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/project/post_api_projects_responses.go b/client/project/post_api_projects_responses.go new file mode 100644 index 0000000..d335d8a --- /dev/null +++ b/client/project/post_api_projects_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPIProjectsReader is a Reader for the PostAPIProjects structure. +type PostAPIProjectsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIProjectsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIProjectsOK() + 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()) + } +} + +// NewPostAPIProjectsOK creates a PostAPIProjectsOK with default headers values +func NewPostAPIProjectsOK() *PostAPIProjectsOK { + return &PostAPIProjectsOK{} +} + +/* +PostAPIProjectsOK describes a response with status code 200, with default header values. + +Returns the new created project +*/ +type PostAPIProjectsOK struct { + Payload *models.ProjectEntity +} + +// IsSuccess returns true when this post Api projects o k response has a 2xx status code +func (o *PostAPIProjectsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api projects o k response has a 3xx status code +func (o *PostAPIProjectsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api projects o k response has a 4xx status code +func (o *PostAPIProjectsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api projects o k response has a 5xx status code +func (o *PostAPIProjectsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api projects o k response a status code equal to that given +func (o *PostAPIProjectsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPIProjectsOK) Error() string { + return fmt.Sprintf("[POST /api/projects][%d] postApiProjectsOK %+v", 200, o.Payload) +} + +func (o *PostAPIProjectsOK) String() string { + return fmt.Sprintf("[POST /api/projects][%d] postApiProjectsOK %+v", 200, o.Payload) +} + +func (o *PostAPIProjectsOK) GetPayload() *models.ProjectEntity { + return o.Payload +} + +func (o *PostAPIProjectsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ProjectEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/project/project_client.go b/client/project/project_client.go new file mode 100644 index 0000000..0967213 --- /dev/null +++ b/client/project/project_client.go @@ -0,0 +1,371 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new project API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for project API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPIProjectsIDRatesRateID(params *DeleteAPIProjectsIDRatesRateIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIProjectsIDRatesRateIDNoContent, error) + + GetAPIProjects(params *GetAPIProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsOK, error) + + GetAPIProjectsID(params *GetAPIProjectsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsIDOK, error) + + GetAPIProjectsIDRates(params *GetAPIProjectsIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsIDRatesOK, error) + + PatchAPIProjectsID(params *PatchAPIProjectsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIProjectsIDOK, error) + + PatchAPIProjectsIDMeta(params *PatchAPIProjectsIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIProjectsIDMetaOK, error) + + PostAPIProjects(params *PostAPIProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIProjectsOK, error) + + PostAPIProjectsIDRates(params *PostAPIProjectsIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIProjectsIDRatesOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPIProjectsIDRatesRateID deletes one rate for an project +*/ +func (a *Client) DeleteAPIProjectsIDRatesRateID(params *DeleteAPIProjectsIDRatesRateIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIProjectsIDRatesRateIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPIProjectsIDRatesRateIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPIProjectsIDRatesRateID", + Method: "DELETE", + PathPattern: "/api/projects/{id}/rates/{rateId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPIProjectsIDRatesRateIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPIProjectsIDRatesRateIDNoContent) + 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 DeleteAPIProjectsIDRatesRateID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIProjects returns a collection of projects +*/ +func (a *Client) GetAPIProjects(params *GetAPIProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIProjectsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIProjects", + Method: "GET", + PathPattern: "/api/projects", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIProjectsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIProjectsOK) + 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 GetAPIProjects: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIProjectsID returns one project +*/ +func (a *Client) GetAPIProjectsID(params *GetAPIProjectsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIProjectsIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIProjectsID", + Method: "GET", + PathPattern: "/api/projects/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIProjectsIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIProjectsIDOK) + 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 GetAPIProjectsID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIProjectsIDRates returns a collection of all rates for one project +*/ +func (a *Client) GetAPIProjectsIDRates(params *GetAPIProjectsIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsIDRatesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIProjectsIDRatesParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIProjectsIDRates", + Method: "GET", + PathPattern: "/api/projects/{id}/rates", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIProjectsIDRatesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIProjectsIDRatesOK) + 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 GetAPIProjectsIDRates: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIProjectsID updates an existing project + +Update an existing project, you can pass all or just a subset of all attributes +*/ +func (a *Client) PatchAPIProjectsID(params *PatchAPIProjectsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIProjectsIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIProjectsIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIProjectsID", + Method: "PATCH", + PathPattern: "/api/projects/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIProjectsIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIProjectsIDOK) + 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 PatchAPIProjectsID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIProjectsIDMeta sets the value of a meta field for an existing project +*/ +func (a *Client) PatchAPIProjectsIDMeta(params *PatchAPIProjectsIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIProjectsIDMetaOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIProjectsIDMetaParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIProjectsIDMeta", + Method: "PATCH", + PathPattern: "/api/projects/{id}/meta", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIProjectsIDMetaReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIProjectsIDMetaOK) + 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 PatchAPIProjectsIDMeta: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIProjects creates a new project + +Creates a new project and returns it afterwards +*/ +func (a *Client) PostAPIProjects(params *PostAPIProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIProjectsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIProjectsParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIProjects", + Method: "POST", + PathPattern: "/api/projects", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIProjectsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIProjectsOK) + 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 PostAPIProjects: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIProjectsIDRates adds a new rate to an project +*/ +func (a *Client) PostAPIProjectsIDRates(params *PostAPIProjectsIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIProjectsIDRatesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIProjectsIDRatesParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIProjectsIDRates", + Method: "POST", + PathPattern: "/api/projects/{id}/rates", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIProjectsIDRatesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIProjectsIDRatesOK) + 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 PostAPIProjectsIDRates: 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/tag/delete_api_tags_id_parameters.go b/client/tag/delete_api_tags_id_parameters.go new file mode 100644 index 0000000..6aedc18 --- /dev/null +++ b/client/tag/delete_api_tags_id_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tag + +// 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" +) + +// NewDeleteAPITagsIDParams creates a new DeleteAPITagsIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPITagsIDParams() *DeleteAPITagsIDParams { + return &DeleteAPITagsIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPITagsIDParamsWithTimeout creates a new DeleteAPITagsIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPITagsIDParamsWithTimeout(timeout time.Duration) *DeleteAPITagsIDParams { + return &DeleteAPITagsIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPITagsIDParamsWithContext creates a new DeleteAPITagsIDParams object +// with the ability to set a context for a request. +func NewDeleteAPITagsIDParamsWithContext(ctx context.Context) *DeleteAPITagsIDParams { + return &DeleteAPITagsIDParams{ + Context: ctx, + } +} + +// NewDeleteAPITagsIDParamsWithHTTPClient creates a new DeleteAPITagsIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPITagsIDParamsWithHTTPClient(client *http.Client) *DeleteAPITagsIDParams { + return &DeleteAPITagsIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPITagsIDParams contains all the parameters to send to the API endpoint + + for the delete API tags ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPITagsIDParams struct { + + /* ID. + + Tag ID to delete + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API tags ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITagsIDParams) WithDefaults() *DeleteAPITagsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API tags ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITagsIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API tags ID params +func (o *DeleteAPITagsIDParams) WithTimeout(timeout time.Duration) *DeleteAPITagsIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API tags ID params +func (o *DeleteAPITagsIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API tags ID params +func (o *DeleteAPITagsIDParams) WithContext(ctx context.Context) *DeleteAPITagsIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API tags ID params +func (o *DeleteAPITagsIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API tags ID params +func (o *DeleteAPITagsIDParams) WithHTTPClient(client *http.Client) *DeleteAPITagsIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API tags ID params +func (o *DeleteAPITagsIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete API tags ID params +func (o *DeleteAPITagsIDParams) WithID(id int64) *DeleteAPITagsIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API tags ID params +func (o *DeleteAPITagsIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPITagsIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/tag/delete_api_tags_id_responses.go b/client/tag/delete_api_tags_id_responses.go new file mode 100644 index 0000000..2efb98e --- /dev/null +++ b/client/tag/delete_api_tags_id_responses.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tag + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// DeleteAPITagsIDReader is a Reader for the DeleteAPITagsID structure. +type DeleteAPITagsIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPITagsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 204: + result := NewDeleteAPITagsIDNoContent() + 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()) + } +} + +// NewDeleteAPITagsIDNoContent creates a DeleteAPITagsIDNoContent with default headers values +func NewDeleteAPITagsIDNoContent() *DeleteAPITagsIDNoContent { + return &DeleteAPITagsIDNoContent{} +} + +/* +DeleteAPITagsIDNoContent describes a response with status code 204, with default header values. + +HTTP code 204 for a successful delete +*/ +type DeleteAPITagsIDNoContent struct { +} + +// IsSuccess returns true when this delete Api tags Id no content response has a 2xx status code +func (o *DeleteAPITagsIDNoContent) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api tags Id no content response has a 3xx status code +func (o *DeleteAPITagsIDNoContent) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api tags Id no content response has a 4xx status code +func (o *DeleteAPITagsIDNoContent) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api tags Id no content response has a 5xx status code +func (o *DeleteAPITagsIDNoContent) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api tags Id no content response a status code equal to that given +func (o *DeleteAPITagsIDNoContent) IsCode(code int) bool { + return code == 204 +} + +func (o *DeleteAPITagsIDNoContent) Error() string { + return fmt.Sprintf("[DELETE /api/tags/{id}][%d] deleteApiTagsIdNoContent ", 204) +} + +func (o *DeleteAPITagsIDNoContent) String() string { + return fmt.Sprintf("[DELETE /api/tags/{id}][%d] deleteApiTagsIdNoContent ", 204) +} + +func (o *DeleteAPITagsIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/tag/get_api_tags_parameters.go b/client/tag/get_api_tags_parameters.go new file mode 100644 index 0000000..64578f6 --- /dev/null +++ b/client/tag/get_api_tags_parameters.go @@ -0,0 +1,154 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tag + +// 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" +) + +// NewGetAPITagsParams creates a new GetAPITagsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPITagsParams() *GetAPITagsParams { + return &GetAPITagsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPITagsParamsWithTimeout creates a new GetAPITagsParams object +// with the ability to set a timeout on a request. +func NewGetAPITagsParamsWithTimeout(timeout time.Duration) *GetAPITagsParams { + return &GetAPITagsParams{ + timeout: timeout, + } +} + +// NewGetAPITagsParamsWithContext creates a new GetAPITagsParams object +// with the ability to set a context for a request. +func NewGetAPITagsParamsWithContext(ctx context.Context) *GetAPITagsParams { + return &GetAPITagsParams{ + Context: ctx, + } +} + +// NewGetAPITagsParamsWithHTTPClient creates a new GetAPITagsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPITagsParamsWithHTTPClient(client *http.Client) *GetAPITagsParams { + return &GetAPITagsParams{ + HTTPClient: client, + } +} + +/* +GetAPITagsParams contains all the parameters to send to the API endpoint + + for the get API tags operation. + + Typically these are written to a http.Request. +*/ +type GetAPITagsParams struct { + + /* Name. + + Search term to filter tag list + */ + Name string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API tags params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITagsParams) WithDefaults() *GetAPITagsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API tags params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITagsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API tags params +func (o *GetAPITagsParams) WithTimeout(timeout time.Duration) *GetAPITagsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API tags params +func (o *GetAPITagsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API tags params +func (o *GetAPITagsParams) WithContext(ctx context.Context) *GetAPITagsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API tags params +func (o *GetAPITagsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API tags params +func (o *GetAPITagsParams) WithHTTPClient(client *http.Client) *GetAPITagsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API tags params +func (o *GetAPITagsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithName adds the name to the get API tags params +func (o *GetAPITagsParams) WithName(name string) *GetAPITagsParams { + o.SetName(name) + return o +} + +// SetName adds the name to the get API tags params +func (o *GetAPITagsParams) SetName(name string) { + o.Name = name +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPITagsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param name + qrName := o.Name + qName := qrName + + if err := r.SetQueryParam("name", qName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/tag/get_api_tags_responses.go b/client/tag/get_api_tags_responses.go new file mode 100644 index 0000000..7925161 --- /dev/null +++ b/client/tag/get_api_tags_responses.go @@ -0,0 +1,94 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tag + +// 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" +) + +// GetAPITagsReader is a Reader for the GetAPITags structure. +type GetAPITagsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPITagsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPITagsOK() + 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()) + } +} + +// NewGetAPITagsOK creates a GetAPITagsOK with default headers values +func NewGetAPITagsOK() *GetAPITagsOK { + return &GetAPITagsOK{} +} + +/* +GetAPITagsOK describes a response with status code 200, with default header values. + +Returns the collection of all existing tags as string array +*/ +type GetAPITagsOK struct { + Payload []string +} + +// IsSuccess returns true when this get Api tags o k response has a 2xx status code +func (o *GetAPITagsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api tags o k response has a 3xx status code +func (o *GetAPITagsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api tags o k response has a 4xx status code +func (o *GetAPITagsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api tags o k response has a 5xx status code +func (o *GetAPITagsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api tags o k response a status code equal to that given +func (o *GetAPITagsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPITagsOK) Error() string { + return fmt.Sprintf("[GET /api/tags][%d] getApiTagsOK %+v", 200, o.Payload) +} + +func (o *GetAPITagsOK) String() string { + return fmt.Sprintf("[GET /api/tags][%d] getApiTagsOK %+v", 200, o.Payload) +} + +func (o *GetAPITagsOK) GetPayload() []string { + return o.Payload +} + +func (o *GetAPITagsOK) 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/tag/post_api_tags_parameters.go b/client/tag/post_api_tags_parameters.go new file mode 100644 index 0000000..ab62d24 --- /dev/null +++ b/client/tag/post_api_tags_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tag + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPostAPITagsParams creates a new PostAPITagsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPITagsParams() *PostAPITagsParams { + return &PostAPITagsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPITagsParamsWithTimeout creates a new PostAPITagsParams object +// with the ability to set a timeout on a request. +func NewPostAPITagsParamsWithTimeout(timeout time.Duration) *PostAPITagsParams { + return &PostAPITagsParams{ + timeout: timeout, + } +} + +// NewPostAPITagsParamsWithContext creates a new PostAPITagsParams object +// with the ability to set a context for a request. +func NewPostAPITagsParamsWithContext(ctx context.Context) *PostAPITagsParams { + return &PostAPITagsParams{ + Context: ctx, + } +} + +// NewPostAPITagsParamsWithHTTPClient creates a new PostAPITagsParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPITagsParamsWithHTTPClient(client *http.Client) *PostAPITagsParams { + return &PostAPITagsParams{ + HTTPClient: client, + } +} + +/* +PostAPITagsParams contains all the parameters to send to the API endpoint + + for the post API tags operation. + + Typically these are written to a http.Request. +*/ +type PostAPITagsParams struct { + + // Body. + Body *models.TagEditForm + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API tags params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITagsParams) WithDefaults() *PostAPITagsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API tags params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITagsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API tags params +func (o *PostAPITagsParams) WithTimeout(timeout time.Duration) *PostAPITagsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API tags params +func (o *PostAPITagsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API tags params +func (o *PostAPITagsParams) WithContext(ctx context.Context) *PostAPITagsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API tags params +func (o *PostAPITagsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API tags params +func (o *PostAPITagsParams) WithHTTPClient(client *http.Client) *PostAPITagsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API tags params +func (o *PostAPITagsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API tags params +func (o *PostAPITagsParams) WithBody(body *models.TagEditForm) *PostAPITagsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API tags params +func (o *PostAPITagsParams) SetBody(body *models.TagEditForm) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPITagsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/tag/post_api_tags_responses.go b/client/tag/post_api_tags_responses.go new file mode 100644 index 0000000..0a2a471 --- /dev/null +++ b/client/tag/post_api_tags_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tag + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPITagsReader is a Reader for the PostAPITags structure. +type PostAPITagsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPITagsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPITagsOK() + 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()) + } +} + +// NewPostAPITagsOK creates a PostAPITagsOK with default headers values +func NewPostAPITagsOK() *PostAPITagsOK { + return &PostAPITagsOK{} +} + +/* +PostAPITagsOK describes a response with status code 200, with default header values. + +Returns the new created tag +*/ +type PostAPITagsOK struct { + Payload *models.TagEntity +} + +// IsSuccess returns true when this post Api tags o k response has a 2xx status code +func (o *PostAPITagsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api tags o k response has a 3xx status code +func (o *PostAPITagsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api tags o k response has a 4xx status code +func (o *PostAPITagsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api tags o k response has a 5xx status code +func (o *PostAPITagsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api tags o k response a status code equal to that given +func (o *PostAPITagsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPITagsOK) Error() string { + return fmt.Sprintf("[POST /api/tags][%d] postApiTagsOK %+v", 200, o.Payload) +} + +func (o *PostAPITagsOK) String() string { + return fmt.Sprintf("[POST /api/tags][%d] postApiTagsOK %+v", 200, o.Payload) +} + +func (o *PostAPITagsOK) GetPayload() *models.TagEntity { + return o.Payload +} + +func (o *PostAPITagsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TagEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/tag/tag_client.go b/client/tag/tag_client.go new file mode 100644 index 0000000..72671c5 --- /dev/null +++ b/client/tag/tag_client.go @@ -0,0 +1,164 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package tag + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new tag API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for tag API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPITagsID(params *DeleteAPITagsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITagsIDNoContent, error) + + GetAPITags(params *GetAPITagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITagsOK, error) + + PostAPITags(params *PostAPITagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITagsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPITagsID deletes a tag +*/ +func (a *Client) DeleteAPITagsID(params *DeleteAPITagsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITagsIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPITagsIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPITagsID", + Method: "DELETE", + PathPattern: "/api/tags/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPITagsIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPITagsIDNoContent) + 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 DeleteAPITagsID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPITags fetches all existing tags +*/ +func (a *Client) GetAPITags(params *GetAPITagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITagsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPITagsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPITags", + Method: "GET", + PathPattern: "/api/tags", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPITagsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPITagsOK) + 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 GetAPITags: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPITags creates a new tag + +Creates a new tag and returns it afterwards +*/ +func (a *Client) PostAPITags(params *PostAPITagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITagsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPITagsParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPITags", + Method: "POST", + PathPattern: "/api/tags", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPITagsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPITagsOK) + 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 PostAPITags: 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/task/delete_api_tasks_id_parameters.go b/client/task/delete_api_tasks_id_parameters.go new file mode 100644 index 0000000..23345dd --- /dev/null +++ b/client/task/delete_api_tasks_id_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" +) + +// NewDeleteAPITasksIDParams creates a new DeleteAPITasksIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPITasksIDParams() *DeleteAPITasksIDParams { + return &DeleteAPITasksIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPITasksIDParamsWithTimeout creates a new DeleteAPITasksIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPITasksIDParamsWithTimeout(timeout time.Duration) *DeleteAPITasksIDParams { + return &DeleteAPITasksIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPITasksIDParamsWithContext creates a new DeleteAPITasksIDParams object +// with the ability to set a context for a request. +func NewDeleteAPITasksIDParamsWithContext(ctx context.Context) *DeleteAPITasksIDParams { + return &DeleteAPITasksIDParams{ + Context: ctx, + } +} + +// NewDeleteAPITasksIDParamsWithHTTPClient creates a new DeleteAPITasksIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPITasksIDParamsWithHTTPClient(client *http.Client) *DeleteAPITasksIDParams { + return &DeleteAPITasksIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPITasksIDParams contains all the parameters to send to the API endpoint + + for the delete API tasks ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPITasksIDParams struct { + + /* ID. + + Task record ID to delete + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API tasks ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITasksIDParams) WithDefaults() *DeleteAPITasksIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API tasks ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITasksIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API tasks ID params +func (o *DeleteAPITasksIDParams) WithTimeout(timeout time.Duration) *DeleteAPITasksIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API tasks ID params +func (o *DeleteAPITasksIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API tasks ID params +func (o *DeleteAPITasksIDParams) WithContext(ctx context.Context) *DeleteAPITasksIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API tasks ID params +func (o *DeleteAPITasksIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API tasks ID params +func (o *DeleteAPITasksIDParams) WithHTTPClient(client *http.Client) *DeleteAPITasksIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API tasks ID params +func (o *DeleteAPITasksIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete API tasks ID params +func (o *DeleteAPITasksIDParams) WithID(id int64) *DeleteAPITasksIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API tasks ID params +func (o *DeleteAPITasksIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPITasksIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/task/delete_api_tasks_id_responses.go b/client/task/delete_api_tasks_id_responses.go new file mode 100644 index 0000000..957fb85 --- /dev/null +++ b/client/task/delete_api_tasks_id_responses.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// DeleteAPITasksIDReader is a Reader for the DeleteAPITasksID structure. +type DeleteAPITasksIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPITasksIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 204: + result := NewDeleteAPITasksIDNoContent() + 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()) + } +} + +// NewDeleteAPITasksIDNoContent creates a DeleteAPITasksIDNoContent with default headers values +func NewDeleteAPITasksIDNoContent() *DeleteAPITasksIDNoContent { + return &DeleteAPITasksIDNoContent{} +} + +/* +DeleteAPITasksIDNoContent describes a response with status code 204, with default header values. + +Delete one task record +*/ +type DeleteAPITasksIDNoContent struct { +} + +// IsSuccess returns true when this delete Api tasks Id no content response has a 2xx status code +func (o *DeleteAPITasksIDNoContent) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api tasks Id no content response has a 3xx status code +func (o *DeleteAPITasksIDNoContent) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api tasks Id no content response has a 4xx status code +func (o *DeleteAPITasksIDNoContent) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api tasks Id no content response has a 5xx status code +func (o *DeleteAPITasksIDNoContent) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api tasks Id no content response a status code equal to that given +func (o *DeleteAPITasksIDNoContent) IsCode(code int) bool { + return code == 204 +} + +func (o *DeleteAPITasksIDNoContent) Error() string { + return fmt.Sprintf("[DELETE /api/tasks/{id}][%d] deleteApiTasksIdNoContent ", 204) +} + +func (o *DeleteAPITasksIDNoContent) String() string { + return fmt.Sprintf("[DELETE /api/tasks/{id}][%d] deleteApiTasksIdNoContent ", 204) +} + +func (o *DeleteAPITasksIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/task/get_api_tasks_id_parameters.go b/client/task/get_api_tasks_id_parameters.go new file mode 100644 index 0000000..d196e11 --- /dev/null +++ b/client/task/get_api_tasks_id_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" +) + +// NewGetAPITasksIDParams creates a new GetAPITasksIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPITasksIDParams() *GetAPITasksIDParams { + return &GetAPITasksIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPITasksIDParamsWithTimeout creates a new GetAPITasksIDParams object +// with the ability to set a timeout on a request. +func NewGetAPITasksIDParamsWithTimeout(timeout time.Duration) *GetAPITasksIDParams { + return &GetAPITasksIDParams{ + timeout: timeout, + } +} + +// NewGetAPITasksIDParamsWithContext creates a new GetAPITasksIDParams object +// with the ability to set a context for a request. +func NewGetAPITasksIDParamsWithContext(ctx context.Context) *GetAPITasksIDParams { + return &GetAPITasksIDParams{ + Context: ctx, + } +} + +// NewGetAPITasksIDParamsWithHTTPClient creates a new GetAPITasksIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPITasksIDParamsWithHTTPClient(client *http.Client) *GetAPITasksIDParams { + return &GetAPITasksIDParams{ + HTTPClient: client, + } +} + +/* +GetAPITasksIDParams contains all the parameters to send to the API endpoint + + for the get API tasks ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPITasksIDParams struct { + + /* ID. + + Task ID to fetch + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API tasks ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITasksIDParams) WithDefaults() *GetAPITasksIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API tasks ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITasksIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API tasks ID params +func (o *GetAPITasksIDParams) WithTimeout(timeout time.Duration) *GetAPITasksIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API tasks ID params +func (o *GetAPITasksIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API tasks ID params +func (o *GetAPITasksIDParams) WithContext(ctx context.Context) *GetAPITasksIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API tasks ID params +func (o *GetAPITasksIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API tasks ID params +func (o *GetAPITasksIDParams) WithHTTPClient(client *http.Client) *GetAPITasksIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API tasks ID params +func (o *GetAPITasksIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get API tasks ID params +func (o *GetAPITasksIDParams) WithID(id int64) *GetAPITasksIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API tasks ID params +func (o *GetAPITasksIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPITasksIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/task/get_api_tasks_id_responses.go b/client/task/get_api_tasks_id_responses.go new file mode 100644 index 0000000..e8b7eac --- /dev/null +++ b/client/task/get_api_tasks_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPITasksIDReader is a Reader for the GetAPITasksID structure. +type GetAPITasksIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPITasksIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPITasksIDOK() + 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()) + } +} + +// NewGetAPITasksIDOK creates a GetAPITasksIDOK with default headers values +func NewGetAPITasksIDOK() *GetAPITasksIDOK { + return &GetAPITasksIDOK{} +} + +/* +GetAPITasksIDOK describes a response with status code 200, with default header values. + +Returns one task entity +*/ +type GetAPITasksIDOK struct { + Payload *models.Task +} + +// IsSuccess returns true when this get Api tasks Id o k response has a 2xx status code +func (o *GetAPITasksIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api tasks Id o k response has a 3xx status code +func (o *GetAPITasksIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api tasks Id o k response has a 4xx status code +func (o *GetAPITasksIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api tasks Id o k response has a 5xx status code +func (o *GetAPITasksIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api tasks Id o k response a status code equal to that given +func (o *GetAPITasksIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPITasksIDOK) Error() string { + return fmt.Sprintf("[GET /api/tasks/{id}][%d] getApiTasksIdOK %+v", 200, o.Payload) +} + +func (o *GetAPITasksIDOK) String() string { + return fmt.Sprintf("[GET /api/tasks/{id}][%d] getApiTasksIdOK %+v", 200, o.Payload) +} + +func (o *GetAPITasksIDOK) GetPayload() *models.Task { + return o.Payload +} + +func (o *GetAPITasksIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Task) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/task/get_api_tasks_parameters.go b/client/task/get_api_tasks_parameters.go new file mode 100644 index 0000000..6dcacc6 --- /dev/null +++ b/client/task/get_api_tasks_parameters.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewGetAPITasksParams creates a new GetAPITasksParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPITasksParams() *GetAPITasksParams { + return &GetAPITasksParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPITasksParamsWithTimeout creates a new GetAPITasksParams object +// with the ability to set a timeout on a request. +func NewGetAPITasksParamsWithTimeout(timeout time.Duration) *GetAPITasksParams { + return &GetAPITasksParams{ + timeout: timeout, + } +} + +// NewGetAPITasksParamsWithContext creates a new GetAPITasksParams object +// with the ability to set a context for a request. +func NewGetAPITasksParamsWithContext(ctx context.Context) *GetAPITasksParams { + return &GetAPITasksParams{ + Context: ctx, + } +} + +// NewGetAPITasksParamsWithHTTPClient creates a new GetAPITasksParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPITasksParamsWithHTTPClient(client *http.Client) *GetAPITasksParams { + return &GetAPITasksParams{ + HTTPClient: client, + } +} + +/* +GetAPITasksParams contains all the parameters to send to the API endpoint + + for the get API tasks operation. + + Typically these are written to a http.Request. +*/ +type GetAPITasksParams struct { + + /* Query. + + Attention: This is a GET request and you can pass in every field of the form as query parameter. + */ + Query *models.TaskQuery + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API tasks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITasksParams) WithDefaults() *GetAPITasksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API tasks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITasksParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API tasks params +func (o *GetAPITasksParams) WithTimeout(timeout time.Duration) *GetAPITasksParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API tasks params +func (o *GetAPITasksParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API tasks params +func (o *GetAPITasksParams) WithContext(ctx context.Context) *GetAPITasksParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API tasks params +func (o *GetAPITasksParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API tasks params +func (o *GetAPITasksParams) WithHTTPClient(client *http.Client) *GetAPITasksParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API tasks params +func (o *GetAPITasksParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithQuery adds the query to the get API tasks params +func (o *GetAPITasksParams) WithQuery(query *models.TaskQuery) *GetAPITasksParams { + o.SetQuery(query) + return o +} + +// SetQuery adds the query to the get API tasks params +func (o *GetAPITasksParams) SetQuery(query *models.TaskQuery) { + o.Query = query +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPITasksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Query != nil { + if err := r.SetBodyParam(o.Query); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/task/get_api_tasks_responses.go b/client/task/get_api_tasks_responses.go new file mode 100644 index 0000000..591ecff --- /dev/null +++ b/client/task/get_api_tasks_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPITasksReader is a Reader for the GetAPITasks structure. +type GetAPITasksReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPITasksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPITasksOK() + 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()) + } +} + +// NewGetAPITasksOK creates a GetAPITasksOK with default headers values +func NewGetAPITasksOK() *GetAPITasksOK { + return &GetAPITasksOK{} +} + +/* +GetAPITasksOK describes a response with status code 200, with default header values. + +Returns a collection of task entities +*/ +type GetAPITasksOK struct { + Payload []*models.Task +} + +// IsSuccess returns true when this get Api tasks o k response has a 2xx status code +func (o *GetAPITasksOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api tasks o k response has a 3xx status code +func (o *GetAPITasksOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api tasks o k response has a 4xx status code +func (o *GetAPITasksOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api tasks o k response has a 5xx status code +func (o *GetAPITasksOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api tasks o k response a status code equal to that given +func (o *GetAPITasksOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPITasksOK) Error() string { + return fmt.Sprintf("[GET /api/tasks][%d] getApiTasksOK %+v", 200, o.Payload) +} + +func (o *GetAPITasksOK) String() string { + return fmt.Sprintf("[GET /api/tasks][%d] getApiTasksOK %+v", 200, o.Payload) +} + +func (o *GetAPITasksOK) GetPayload() []*models.Task { + return o.Payload +} + +func (o *GetAPITasksOK) 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/task/patch_api_tasks_id_assign_parameters.go b/client/task/patch_api_tasks_id_assign_parameters.go new file mode 100644 index 0000000..9f96a78 --- /dev/null +++ b/client/task/patch_api_tasks_id_assign_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" +) + +// NewPatchAPITasksIDAssignParams creates a new PatchAPITasksIDAssignParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITasksIDAssignParams() *PatchAPITasksIDAssignParams { + return &PatchAPITasksIDAssignParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITasksIDAssignParamsWithTimeout creates a new PatchAPITasksIDAssignParams object +// with the ability to set a timeout on a request. +func NewPatchAPITasksIDAssignParamsWithTimeout(timeout time.Duration) *PatchAPITasksIDAssignParams { + return &PatchAPITasksIDAssignParams{ + timeout: timeout, + } +} + +// NewPatchAPITasksIDAssignParamsWithContext creates a new PatchAPITasksIDAssignParams object +// with the ability to set a context for a request. +func NewPatchAPITasksIDAssignParamsWithContext(ctx context.Context) *PatchAPITasksIDAssignParams { + return &PatchAPITasksIDAssignParams{ + Context: ctx, + } +} + +// NewPatchAPITasksIDAssignParamsWithHTTPClient creates a new PatchAPITasksIDAssignParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITasksIDAssignParamsWithHTTPClient(client *http.Client) *PatchAPITasksIDAssignParams { + return &PatchAPITasksIDAssignParams{ + HTTPClient: client, + } +} + +/* +PatchAPITasksIDAssignParams contains all the parameters to send to the API endpoint + + for the patch API tasks ID assign operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITasksIDAssignParams struct { + + /* ID. + + Task ID to update + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API tasks ID assign params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDAssignParams) WithDefaults() *PatchAPITasksIDAssignParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API tasks ID assign params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDAssignParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API tasks ID assign params +func (o *PatchAPITasksIDAssignParams) WithTimeout(timeout time.Duration) *PatchAPITasksIDAssignParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API tasks ID assign params +func (o *PatchAPITasksIDAssignParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API tasks ID assign params +func (o *PatchAPITasksIDAssignParams) WithContext(ctx context.Context) *PatchAPITasksIDAssignParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API tasks ID assign params +func (o *PatchAPITasksIDAssignParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API tasks ID assign params +func (o *PatchAPITasksIDAssignParams) WithHTTPClient(client *http.Client) *PatchAPITasksIDAssignParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API tasks ID assign params +func (o *PatchAPITasksIDAssignParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the patch API tasks ID assign params +func (o *PatchAPITasksIDAssignParams) WithID(id int64) *PatchAPITasksIDAssignParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API tasks ID assign params +func (o *PatchAPITasksIDAssignParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITasksIDAssignParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/task/patch_api_tasks_id_assign_responses.go b/client/task/patch_api_tasks_id_assign_responses.go new file mode 100644 index 0000000..9586328 --- /dev/null +++ b/client/task/patch_api_tasks_id_assign_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPITasksIDAssignReader is a Reader for the PatchAPITasksIDAssign structure. +type PatchAPITasksIDAssignReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITasksIDAssignReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITasksIDAssignOK() + 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()) + } +} + +// NewPatchAPITasksIDAssignOK creates a PatchAPITasksIDAssignOK with default headers values +func NewPatchAPITasksIDAssignOK() *PatchAPITasksIDAssignOK { + return &PatchAPITasksIDAssignOK{} +} + +/* +PatchAPITasksIDAssignOK describes a response with status code 200, with default header values. + +Returns the updated task +*/ +type PatchAPITasksIDAssignOK struct { + Payload *models.Task +} + +// IsSuccess returns true when this patch Api tasks Id assign o k response has a 2xx status code +func (o *PatchAPITasksIDAssignOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api tasks Id assign o k response has a 3xx status code +func (o *PatchAPITasksIDAssignOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api tasks Id assign o k response has a 4xx status code +func (o *PatchAPITasksIDAssignOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api tasks Id assign o k response has a 5xx status code +func (o *PatchAPITasksIDAssignOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api tasks Id assign o k response a status code equal to that given +func (o *PatchAPITasksIDAssignOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITasksIDAssignOK) Error() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/assign][%d] patchApiTasksIdAssignOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDAssignOK) String() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/assign][%d] patchApiTasksIdAssignOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDAssignOK) GetPayload() *models.Task { + return o.Payload +} + +func (o *PatchAPITasksIDAssignOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Task) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/task/patch_api_tasks_id_close_parameters.go b/client/task/patch_api_tasks_id_close_parameters.go new file mode 100644 index 0000000..2affdaa --- /dev/null +++ b/client/task/patch_api_tasks_id_close_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" +) + +// NewPatchAPITasksIDCloseParams creates a new PatchAPITasksIDCloseParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITasksIDCloseParams() *PatchAPITasksIDCloseParams { + return &PatchAPITasksIDCloseParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITasksIDCloseParamsWithTimeout creates a new PatchAPITasksIDCloseParams object +// with the ability to set a timeout on a request. +func NewPatchAPITasksIDCloseParamsWithTimeout(timeout time.Duration) *PatchAPITasksIDCloseParams { + return &PatchAPITasksIDCloseParams{ + timeout: timeout, + } +} + +// NewPatchAPITasksIDCloseParamsWithContext creates a new PatchAPITasksIDCloseParams object +// with the ability to set a context for a request. +func NewPatchAPITasksIDCloseParamsWithContext(ctx context.Context) *PatchAPITasksIDCloseParams { + return &PatchAPITasksIDCloseParams{ + Context: ctx, + } +} + +// NewPatchAPITasksIDCloseParamsWithHTTPClient creates a new PatchAPITasksIDCloseParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITasksIDCloseParamsWithHTTPClient(client *http.Client) *PatchAPITasksIDCloseParams { + return &PatchAPITasksIDCloseParams{ + HTTPClient: client, + } +} + +/* +PatchAPITasksIDCloseParams contains all the parameters to send to the API endpoint + + for the patch API tasks ID close operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITasksIDCloseParams struct { + + /* ID. + + Task ID to close + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API tasks ID close params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDCloseParams) WithDefaults() *PatchAPITasksIDCloseParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API tasks ID close params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDCloseParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API tasks ID close params +func (o *PatchAPITasksIDCloseParams) WithTimeout(timeout time.Duration) *PatchAPITasksIDCloseParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API tasks ID close params +func (o *PatchAPITasksIDCloseParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API tasks ID close params +func (o *PatchAPITasksIDCloseParams) WithContext(ctx context.Context) *PatchAPITasksIDCloseParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API tasks ID close params +func (o *PatchAPITasksIDCloseParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API tasks ID close params +func (o *PatchAPITasksIDCloseParams) WithHTTPClient(client *http.Client) *PatchAPITasksIDCloseParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API tasks ID close params +func (o *PatchAPITasksIDCloseParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the patch API tasks ID close params +func (o *PatchAPITasksIDCloseParams) WithID(id int64) *PatchAPITasksIDCloseParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API tasks ID close params +func (o *PatchAPITasksIDCloseParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITasksIDCloseParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/task/patch_api_tasks_id_close_responses.go b/client/task/patch_api_tasks_id_close_responses.go new file mode 100644 index 0000000..6679956 --- /dev/null +++ b/client/task/patch_api_tasks_id_close_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPITasksIDCloseReader is a Reader for the PatchAPITasksIDClose structure. +type PatchAPITasksIDCloseReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITasksIDCloseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITasksIDCloseOK() + 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()) + } +} + +// NewPatchAPITasksIDCloseOK creates a PatchAPITasksIDCloseOK with default headers values +func NewPatchAPITasksIDCloseOK() *PatchAPITasksIDCloseOK { + return &PatchAPITasksIDCloseOK{} +} + +/* +PatchAPITasksIDCloseOK describes a response with status code 200, with default header values. + +Returns the closed task +*/ +type PatchAPITasksIDCloseOK struct { + Payload *models.Task +} + +// IsSuccess returns true when this patch Api tasks Id close o k response has a 2xx status code +func (o *PatchAPITasksIDCloseOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api tasks Id close o k response has a 3xx status code +func (o *PatchAPITasksIDCloseOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api tasks Id close o k response has a 4xx status code +func (o *PatchAPITasksIDCloseOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api tasks Id close o k response has a 5xx status code +func (o *PatchAPITasksIDCloseOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api tasks Id close o k response a status code equal to that given +func (o *PatchAPITasksIDCloseOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITasksIDCloseOK) Error() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/close][%d] patchApiTasksIdCloseOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDCloseOK) String() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/close][%d] patchApiTasksIdCloseOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDCloseOK) GetPayload() *models.Task { + return o.Payload +} + +func (o *PatchAPITasksIDCloseOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Task) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/task/patch_api_tasks_id_log_parameters.go b/client/task/patch_api_tasks_id_log_parameters.go new file mode 100644 index 0000000..c43dc66 --- /dev/null +++ b/client/task/patch_api_tasks_id_log_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPatchAPITasksIDLogParams creates a new PatchAPITasksIDLogParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITasksIDLogParams() *PatchAPITasksIDLogParams { + return &PatchAPITasksIDLogParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITasksIDLogParamsWithTimeout creates a new PatchAPITasksIDLogParams object +// with the ability to set a timeout on a request. +func NewPatchAPITasksIDLogParamsWithTimeout(timeout time.Duration) *PatchAPITasksIDLogParams { + return &PatchAPITasksIDLogParams{ + timeout: timeout, + } +} + +// NewPatchAPITasksIDLogParamsWithContext creates a new PatchAPITasksIDLogParams object +// with the ability to set a context for a request. +func NewPatchAPITasksIDLogParamsWithContext(ctx context.Context) *PatchAPITasksIDLogParams { + return &PatchAPITasksIDLogParams{ + Context: ctx, + } +} + +// NewPatchAPITasksIDLogParamsWithHTTPClient creates a new PatchAPITasksIDLogParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITasksIDLogParamsWithHTTPClient(client *http.Client) *PatchAPITasksIDLogParams { + return &PatchAPITasksIDLogParams{ + HTTPClient: client, + } +} + +/* +PatchAPITasksIDLogParams contains all the parameters to send to the API endpoint + + for the patch API tasks ID log operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITasksIDLogParams struct { + + // Body. + Body *models.TaskLogWorkForm + + /* ID. + + Task ID to log times for + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API tasks ID log params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDLogParams) WithDefaults() *PatchAPITasksIDLogParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API tasks ID log params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDLogParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API tasks ID log params +func (o *PatchAPITasksIDLogParams) WithTimeout(timeout time.Duration) *PatchAPITasksIDLogParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API tasks ID log params +func (o *PatchAPITasksIDLogParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API tasks ID log params +func (o *PatchAPITasksIDLogParams) WithContext(ctx context.Context) *PatchAPITasksIDLogParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API tasks ID log params +func (o *PatchAPITasksIDLogParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API tasks ID log params +func (o *PatchAPITasksIDLogParams) WithHTTPClient(client *http.Client) *PatchAPITasksIDLogParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API tasks ID log params +func (o *PatchAPITasksIDLogParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API tasks ID log params +func (o *PatchAPITasksIDLogParams) WithBody(body *models.TaskLogWorkForm) *PatchAPITasksIDLogParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API tasks ID log params +func (o *PatchAPITasksIDLogParams) SetBody(body *models.TaskLogWorkForm) { + o.Body = body +} + +// WithID adds the id to the patch API tasks ID log params +func (o *PatchAPITasksIDLogParams) WithID(id int64) *PatchAPITasksIDLogParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API tasks ID log params +func (o *PatchAPITasksIDLogParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITasksIDLogParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/task/patch_api_tasks_id_log_responses.go b/client/task/patch_api_tasks_id_log_responses.go new file mode 100644 index 0000000..524521f --- /dev/null +++ b/client/task/patch_api_tasks_id_log_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPITasksIDLogReader is a Reader for the PatchAPITasksIDLog structure. +type PatchAPITasksIDLogReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITasksIDLogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITasksIDLogOK() + 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()) + } +} + +// NewPatchAPITasksIDLogOK creates a PatchAPITasksIDLogOK with default headers values +func NewPatchAPITasksIDLogOK() *PatchAPITasksIDLogOK { + return &PatchAPITasksIDLogOK{} +} + +/* +PatchAPITasksIDLogOK describes a response with status code 200, with default header values. + +Logs already performed work on a task +*/ +type PatchAPITasksIDLogOK struct { + Payload *models.TimesheetEntityExpanded +} + +// IsSuccess returns true when this patch Api tasks Id log o k response has a 2xx status code +func (o *PatchAPITasksIDLogOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api tasks Id log o k response has a 3xx status code +func (o *PatchAPITasksIDLogOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api tasks Id log o k response has a 4xx status code +func (o *PatchAPITasksIDLogOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api tasks Id log o k response has a 5xx status code +func (o *PatchAPITasksIDLogOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api tasks Id log o k response a status code equal to that given +func (o *PatchAPITasksIDLogOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITasksIDLogOK) Error() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/log][%d] patchApiTasksIdLogOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDLogOK) String() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/log][%d] patchApiTasksIdLogOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDLogOK) GetPayload() *models.TimesheetEntityExpanded { + return o.Payload +} + +func (o *PatchAPITasksIDLogOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TimesheetEntityExpanded) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/task/patch_api_tasks_id_parameters.go b/client/task/patch_api_tasks_id_parameters.go new file mode 100644 index 0000000..1147a3e --- /dev/null +++ b/client/task/patch_api_tasks_id_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPatchAPITasksIDParams creates a new PatchAPITasksIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITasksIDParams() *PatchAPITasksIDParams { + return &PatchAPITasksIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITasksIDParamsWithTimeout creates a new PatchAPITasksIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPITasksIDParamsWithTimeout(timeout time.Duration) *PatchAPITasksIDParams { + return &PatchAPITasksIDParams{ + timeout: timeout, + } +} + +// NewPatchAPITasksIDParamsWithContext creates a new PatchAPITasksIDParams object +// with the ability to set a context for a request. +func NewPatchAPITasksIDParamsWithContext(ctx context.Context) *PatchAPITasksIDParams { + return &PatchAPITasksIDParams{ + Context: ctx, + } +} + +// NewPatchAPITasksIDParamsWithHTTPClient creates a new PatchAPITasksIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITasksIDParamsWithHTTPClient(client *http.Client) *PatchAPITasksIDParams { + return &PatchAPITasksIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPITasksIDParams contains all the parameters to send to the API endpoint + + for the patch API tasks ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITasksIDParams struct { + + // Body. + Body *models.TaskEditForm + + /* ID. + + Task ID to update + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API tasks ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDParams) WithDefaults() *PatchAPITasksIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API tasks ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API tasks ID params +func (o *PatchAPITasksIDParams) WithTimeout(timeout time.Duration) *PatchAPITasksIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API tasks ID params +func (o *PatchAPITasksIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API tasks ID params +func (o *PatchAPITasksIDParams) WithContext(ctx context.Context) *PatchAPITasksIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API tasks ID params +func (o *PatchAPITasksIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API tasks ID params +func (o *PatchAPITasksIDParams) WithHTTPClient(client *http.Client) *PatchAPITasksIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API tasks ID params +func (o *PatchAPITasksIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API tasks ID params +func (o *PatchAPITasksIDParams) WithBody(body *models.TaskEditForm) *PatchAPITasksIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API tasks ID params +func (o *PatchAPITasksIDParams) SetBody(body *models.TaskEditForm) { + o.Body = body +} + +// WithID adds the id to the patch API tasks ID params +func (o *PatchAPITasksIDParams) WithID(id int64) *PatchAPITasksIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API tasks ID params +func (o *PatchAPITasksIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITasksIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/task/patch_api_tasks_id_reopen_parameters.go b/client/task/patch_api_tasks_id_reopen_parameters.go new file mode 100644 index 0000000..0db6409 --- /dev/null +++ b/client/task/patch_api_tasks_id_reopen_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" +) + +// NewPatchAPITasksIDReopenParams creates a new PatchAPITasksIDReopenParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITasksIDReopenParams() *PatchAPITasksIDReopenParams { + return &PatchAPITasksIDReopenParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITasksIDReopenParamsWithTimeout creates a new PatchAPITasksIDReopenParams object +// with the ability to set a timeout on a request. +func NewPatchAPITasksIDReopenParamsWithTimeout(timeout time.Duration) *PatchAPITasksIDReopenParams { + return &PatchAPITasksIDReopenParams{ + timeout: timeout, + } +} + +// NewPatchAPITasksIDReopenParamsWithContext creates a new PatchAPITasksIDReopenParams object +// with the ability to set a context for a request. +func NewPatchAPITasksIDReopenParamsWithContext(ctx context.Context) *PatchAPITasksIDReopenParams { + return &PatchAPITasksIDReopenParams{ + Context: ctx, + } +} + +// NewPatchAPITasksIDReopenParamsWithHTTPClient creates a new PatchAPITasksIDReopenParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITasksIDReopenParamsWithHTTPClient(client *http.Client) *PatchAPITasksIDReopenParams { + return &PatchAPITasksIDReopenParams{ + HTTPClient: client, + } +} + +/* +PatchAPITasksIDReopenParams contains all the parameters to send to the API endpoint + + for the patch API tasks ID reopen operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITasksIDReopenParams struct { + + /* ID. + + Task ID to reopen + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API tasks ID reopen params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDReopenParams) WithDefaults() *PatchAPITasksIDReopenParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API tasks ID reopen params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDReopenParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API tasks ID reopen params +func (o *PatchAPITasksIDReopenParams) WithTimeout(timeout time.Duration) *PatchAPITasksIDReopenParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API tasks ID reopen params +func (o *PatchAPITasksIDReopenParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API tasks ID reopen params +func (o *PatchAPITasksIDReopenParams) WithContext(ctx context.Context) *PatchAPITasksIDReopenParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API tasks ID reopen params +func (o *PatchAPITasksIDReopenParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API tasks ID reopen params +func (o *PatchAPITasksIDReopenParams) WithHTTPClient(client *http.Client) *PatchAPITasksIDReopenParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API tasks ID reopen params +func (o *PatchAPITasksIDReopenParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the patch API tasks ID reopen params +func (o *PatchAPITasksIDReopenParams) WithID(id int64) *PatchAPITasksIDReopenParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API tasks ID reopen params +func (o *PatchAPITasksIDReopenParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITasksIDReopenParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/task/patch_api_tasks_id_reopen_responses.go b/client/task/patch_api_tasks_id_reopen_responses.go new file mode 100644 index 0000000..df15df0 --- /dev/null +++ b/client/task/patch_api_tasks_id_reopen_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPITasksIDReopenReader is a Reader for the PatchAPITasksIDReopen structure. +type PatchAPITasksIDReopenReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITasksIDReopenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITasksIDReopenOK() + 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()) + } +} + +// NewPatchAPITasksIDReopenOK creates a PatchAPITasksIDReopenOK with default headers values +func NewPatchAPITasksIDReopenOK() *PatchAPITasksIDReopenOK { + return &PatchAPITasksIDReopenOK{} +} + +/* +PatchAPITasksIDReopenOK describes a response with status code 200, with default header values. + +Returns the reopened task +*/ +type PatchAPITasksIDReopenOK struct { + Payload *models.Task +} + +// IsSuccess returns true when this patch Api tasks Id reopen o k response has a 2xx status code +func (o *PatchAPITasksIDReopenOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api tasks Id reopen o k response has a 3xx status code +func (o *PatchAPITasksIDReopenOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api tasks Id reopen o k response has a 4xx status code +func (o *PatchAPITasksIDReopenOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api tasks Id reopen o k response has a 5xx status code +func (o *PatchAPITasksIDReopenOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api tasks Id reopen o k response a status code equal to that given +func (o *PatchAPITasksIDReopenOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITasksIDReopenOK) Error() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/reopen][%d] patchApiTasksIdReopenOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDReopenOK) String() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/reopen][%d] patchApiTasksIdReopenOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDReopenOK) GetPayload() *models.Task { + return o.Payload +} + +func (o *PatchAPITasksIDReopenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Task) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/task/patch_api_tasks_id_responses.go b/client/task/patch_api_tasks_id_responses.go new file mode 100644 index 0000000..00b7a6d --- /dev/null +++ b/client/task/patch_api_tasks_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPITasksIDReader is a Reader for the PatchAPITasksID structure. +type PatchAPITasksIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITasksIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITasksIDOK() + 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()) + } +} + +// NewPatchAPITasksIDOK creates a PatchAPITasksIDOK with default headers values +func NewPatchAPITasksIDOK() *PatchAPITasksIDOK { + return &PatchAPITasksIDOK{} +} + +/* +PatchAPITasksIDOK describes a response with status code 200, with default header values. + +Returns the updated task +*/ +type PatchAPITasksIDOK struct { + Payload *models.Task +} + +// IsSuccess returns true when this patch Api tasks Id o k response has a 2xx status code +func (o *PatchAPITasksIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api tasks Id o k response has a 3xx status code +func (o *PatchAPITasksIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api tasks Id o k response has a 4xx status code +func (o *PatchAPITasksIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api tasks Id o k response has a 5xx status code +func (o *PatchAPITasksIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api tasks Id o k response a status code equal to that given +func (o *PatchAPITasksIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITasksIDOK) Error() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}][%d] patchApiTasksIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDOK) String() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}][%d] patchApiTasksIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDOK) GetPayload() *models.Task { + return o.Payload +} + +func (o *PatchAPITasksIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Task) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/task/patch_api_tasks_id_start_parameters.go b/client/task/patch_api_tasks_id_start_parameters.go new file mode 100644 index 0000000..e1d161e --- /dev/null +++ b/client/task/patch_api_tasks_id_start_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" +) + +// NewPatchAPITasksIDStartParams creates a new PatchAPITasksIDStartParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITasksIDStartParams() *PatchAPITasksIDStartParams { + return &PatchAPITasksIDStartParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITasksIDStartParamsWithTimeout creates a new PatchAPITasksIDStartParams object +// with the ability to set a timeout on a request. +func NewPatchAPITasksIDStartParamsWithTimeout(timeout time.Duration) *PatchAPITasksIDStartParams { + return &PatchAPITasksIDStartParams{ + timeout: timeout, + } +} + +// NewPatchAPITasksIDStartParamsWithContext creates a new PatchAPITasksIDStartParams object +// with the ability to set a context for a request. +func NewPatchAPITasksIDStartParamsWithContext(ctx context.Context) *PatchAPITasksIDStartParams { + return &PatchAPITasksIDStartParams{ + Context: ctx, + } +} + +// NewPatchAPITasksIDStartParamsWithHTTPClient creates a new PatchAPITasksIDStartParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITasksIDStartParamsWithHTTPClient(client *http.Client) *PatchAPITasksIDStartParams { + return &PatchAPITasksIDStartParams{ + HTTPClient: client, + } +} + +/* +PatchAPITasksIDStartParams contains all the parameters to send to the API endpoint + + for the patch API tasks ID start operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITasksIDStartParams struct { + + /* ID. + + Task ID to start + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API tasks ID start params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDStartParams) WithDefaults() *PatchAPITasksIDStartParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API tasks ID start params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDStartParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API tasks ID start params +func (o *PatchAPITasksIDStartParams) WithTimeout(timeout time.Duration) *PatchAPITasksIDStartParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API tasks ID start params +func (o *PatchAPITasksIDStartParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API tasks ID start params +func (o *PatchAPITasksIDStartParams) WithContext(ctx context.Context) *PatchAPITasksIDStartParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API tasks ID start params +func (o *PatchAPITasksIDStartParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API tasks ID start params +func (o *PatchAPITasksIDStartParams) WithHTTPClient(client *http.Client) *PatchAPITasksIDStartParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API tasks ID start params +func (o *PatchAPITasksIDStartParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the patch API tasks ID start params +func (o *PatchAPITasksIDStartParams) WithID(id int64) *PatchAPITasksIDStartParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API tasks ID start params +func (o *PatchAPITasksIDStartParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITasksIDStartParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/task/patch_api_tasks_id_start_responses.go b/client/task/patch_api_tasks_id_start_responses.go new file mode 100644 index 0000000..33e63de --- /dev/null +++ b/client/task/patch_api_tasks_id_start_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPITasksIDStartReader is a Reader for the PatchAPITasksIDStart structure. +type PatchAPITasksIDStartReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITasksIDStartReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITasksIDStartOK() + 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()) + } +} + +// NewPatchAPITasksIDStartOK creates a PatchAPITasksIDStartOK with default headers values +func NewPatchAPITasksIDStartOK() *PatchAPITasksIDStartOK { + return &PatchAPITasksIDStartOK{} +} + +/* +PatchAPITasksIDStartOK describes a response with status code 200, with default header values. + +Start working on a task +*/ +type PatchAPITasksIDStartOK struct { + Payload *models.Task +} + +// IsSuccess returns true when this patch Api tasks Id start o k response has a 2xx status code +func (o *PatchAPITasksIDStartOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api tasks Id start o k response has a 3xx status code +func (o *PatchAPITasksIDStartOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api tasks Id start o k response has a 4xx status code +func (o *PatchAPITasksIDStartOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api tasks Id start o k response has a 5xx status code +func (o *PatchAPITasksIDStartOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api tasks Id start o k response a status code equal to that given +func (o *PatchAPITasksIDStartOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITasksIDStartOK) Error() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/start][%d] patchApiTasksIdStartOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDStartOK) String() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/start][%d] patchApiTasksIdStartOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDStartOK) GetPayload() *models.Task { + return o.Payload +} + +func (o *PatchAPITasksIDStartOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Task) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/task/patch_api_tasks_id_stop_parameters.go b/client/task/patch_api_tasks_id_stop_parameters.go new file mode 100644 index 0000000..7c286ed --- /dev/null +++ b/client/task/patch_api_tasks_id_stop_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" +) + +// NewPatchAPITasksIDStopParams creates a new PatchAPITasksIDStopParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITasksIDStopParams() *PatchAPITasksIDStopParams { + return &PatchAPITasksIDStopParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITasksIDStopParamsWithTimeout creates a new PatchAPITasksIDStopParams object +// with the ability to set a timeout on a request. +func NewPatchAPITasksIDStopParamsWithTimeout(timeout time.Duration) *PatchAPITasksIDStopParams { + return &PatchAPITasksIDStopParams{ + timeout: timeout, + } +} + +// NewPatchAPITasksIDStopParamsWithContext creates a new PatchAPITasksIDStopParams object +// with the ability to set a context for a request. +func NewPatchAPITasksIDStopParamsWithContext(ctx context.Context) *PatchAPITasksIDStopParams { + return &PatchAPITasksIDStopParams{ + Context: ctx, + } +} + +// NewPatchAPITasksIDStopParamsWithHTTPClient creates a new PatchAPITasksIDStopParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITasksIDStopParamsWithHTTPClient(client *http.Client) *PatchAPITasksIDStopParams { + return &PatchAPITasksIDStopParams{ + HTTPClient: client, + } +} + +/* +PatchAPITasksIDStopParams contains all the parameters to send to the API endpoint + + for the patch API tasks ID stop operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITasksIDStopParams struct { + + /* ID. + + Task ID to stop + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API tasks ID stop params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDStopParams) WithDefaults() *PatchAPITasksIDStopParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API tasks ID stop params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDStopParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API tasks ID stop params +func (o *PatchAPITasksIDStopParams) WithTimeout(timeout time.Duration) *PatchAPITasksIDStopParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API tasks ID stop params +func (o *PatchAPITasksIDStopParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API tasks ID stop params +func (o *PatchAPITasksIDStopParams) WithContext(ctx context.Context) *PatchAPITasksIDStopParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API tasks ID stop params +func (o *PatchAPITasksIDStopParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API tasks ID stop params +func (o *PatchAPITasksIDStopParams) WithHTTPClient(client *http.Client) *PatchAPITasksIDStopParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API tasks ID stop params +func (o *PatchAPITasksIDStopParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the patch API tasks ID stop params +func (o *PatchAPITasksIDStopParams) WithID(id int64) *PatchAPITasksIDStopParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API tasks ID stop params +func (o *PatchAPITasksIDStopParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITasksIDStopParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/task/patch_api_tasks_id_stop_responses.go b/client/task/patch_api_tasks_id_stop_responses.go new file mode 100644 index 0000000..2432c1d --- /dev/null +++ b/client/task/patch_api_tasks_id_stop_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPITasksIDStopReader is a Reader for the PatchAPITasksIDStop structure. +type PatchAPITasksIDStopReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITasksIDStopReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITasksIDStopOK() + 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()) + } +} + +// NewPatchAPITasksIDStopOK creates a PatchAPITasksIDStopOK with default headers values +func NewPatchAPITasksIDStopOK() *PatchAPITasksIDStopOK { + return &PatchAPITasksIDStopOK{} +} + +/* +PatchAPITasksIDStopOK describes a response with status code 200, with default header values. + +Stop working on a task +*/ +type PatchAPITasksIDStopOK struct { + Payload *models.Task +} + +// IsSuccess returns true when this patch Api tasks Id stop o k response has a 2xx status code +func (o *PatchAPITasksIDStopOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api tasks Id stop o k response has a 3xx status code +func (o *PatchAPITasksIDStopOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api tasks Id stop o k response has a 4xx status code +func (o *PatchAPITasksIDStopOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api tasks Id stop o k response has a 5xx status code +func (o *PatchAPITasksIDStopOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api tasks Id stop o k response a status code equal to that given +func (o *PatchAPITasksIDStopOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITasksIDStopOK) Error() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/stop][%d] patchApiTasksIdStopOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDStopOK) String() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/stop][%d] patchApiTasksIdStopOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDStopOK) GetPayload() *models.Task { + return o.Payload +} + +func (o *PatchAPITasksIDStopOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Task) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/task/patch_api_tasks_id_unassign_parameters.go b/client/task/patch_api_tasks_id_unassign_parameters.go new file mode 100644 index 0000000..c639ff3 --- /dev/null +++ b/client/task/patch_api_tasks_id_unassign_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" +) + +// NewPatchAPITasksIDUnassignParams creates a new PatchAPITasksIDUnassignParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITasksIDUnassignParams() *PatchAPITasksIDUnassignParams { + return &PatchAPITasksIDUnassignParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITasksIDUnassignParamsWithTimeout creates a new PatchAPITasksIDUnassignParams object +// with the ability to set a timeout on a request. +func NewPatchAPITasksIDUnassignParamsWithTimeout(timeout time.Duration) *PatchAPITasksIDUnassignParams { + return &PatchAPITasksIDUnassignParams{ + timeout: timeout, + } +} + +// NewPatchAPITasksIDUnassignParamsWithContext creates a new PatchAPITasksIDUnassignParams object +// with the ability to set a context for a request. +func NewPatchAPITasksIDUnassignParamsWithContext(ctx context.Context) *PatchAPITasksIDUnassignParams { + return &PatchAPITasksIDUnassignParams{ + Context: ctx, + } +} + +// NewPatchAPITasksIDUnassignParamsWithHTTPClient creates a new PatchAPITasksIDUnassignParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITasksIDUnassignParamsWithHTTPClient(client *http.Client) *PatchAPITasksIDUnassignParams { + return &PatchAPITasksIDUnassignParams{ + HTTPClient: client, + } +} + +/* +PatchAPITasksIDUnassignParams contains all the parameters to send to the API endpoint + + for the patch API tasks ID unassign operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITasksIDUnassignParams struct { + + /* ID. + + Task ID to update + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API tasks ID unassign params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDUnassignParams) WithDefaults() *PatchAPITasksIDUnassignParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API tasks ID unassign params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITasksIDUnassignParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API tasks ID unassign params +func (o *PatchAPITasksIDUnassignParams) WithTimeout(timeout time.Duration) *PatchAPITasksIDUnassignParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API tasks ID unassign params +func (o *PatchAPITasksIDUnassignParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API tasks ID unassign params +func (o *PatchAPITasksIDUnassignParams) WithContext(ctx context.Context) *PatchAPITasksIDUnassignParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API tasks ID unassign params +func (o *PatchAPITasksIDUnassignParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API tasks ID unassign params +func (o *PatchAPITasksIDUnassignParams) WithHTTPClient(client *http.Client) *PatchAPITasksIDUnassignParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API tasks ID unassign params +func (o *PatchAPITasksIDUnassignParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the patch API tasks ID unassign params +func (o *PatchAPITasksIDUnassignParams) WithID(id int64) *PatchAPITasksIDUnassignParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API tasks ID unassign params +func (o *PatchAPITasksIDUnassignParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITasksIDUnassignParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/task/patch_api_tasks_id_unassign_responses.go b/client/task/patch_api_tasks_id_unassign_responses.go new file mode 100644 index 0000000..b7cee4a --- /dev/null +++ b/client/task/patch_api_tasks_id_unassign_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPITasksIDUnassignReader is a Reader for the PatchAPITasksIDUnassign structure. +type PatchAPITasksIDUnassignReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITasksIDUnassignReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITasksIDUnassignOK() + 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()) + } +} + +// NewPatchAPITasksIDUnassignOK creates a PatchAPITasksIDUnassignOK with default headers values +func NewPatchAPITasksIDUnassignOK() *PatchAPITasksIDUnassignOK { + return &PatchAPITasksIDUnassignOK{} +} + +/* +PatchAPITasksIDUnassignOK describes a response with status code 200, with default header values. + +Returns the updated task +*/ +type PatchAPITasksIDUnassignOK struct { + Payload *models.Task +} + +// IsSuccess returns true when this patch Api tasks Id unassign o k response has a 2xx status code +func (o *PatchAPITasksIDUnassignOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api tasks Id unassign o k response has a 3xx status code +func (o *PatchAPITasksIDUnassignOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api tasks Id unassign o k response has a 4xx status code +func (o *PatchAPITasksIDUnassignOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api tasks Id unassign o k response has a 5xx status code +func (o *PatchAPITasksIDUnassignOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api tasks Id unassign o k response a status code equal to that given +func (o *PatchAPITasksIDUnassignOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITasksIDUnassignOK) Error() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/unassign][%d] patchApiTasksIdUnassignOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDUnassignOK) String() string { + return fmt.Sprintf("[PATCH /api/tasks/{id}/unassign][%d] patchApiTasksIdUnassignOK %+v", 200, o.Payload) +} + +func (o *PatchAPITasksIDUnassignOK) GetPayload() *models.Task { + return o.Payload +} + +func (o *PatchAPITasksIDUnassignOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Task) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/task/post_api_tasks_parameters.go b/client/task/post_api_tasks_parameters.go new file mode 100644 index 0000000..71abc6e --- /dev/null +++ b/client/task/post_api_tasks_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPostAPITasksParams creates a new PostAPITasksParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPITasksParams() *PostAPITasksParams { + return &PostAPITasksParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPITasksParamsWithTimeout creates a new PostAPITasksParams object +// with the ability to set a timeout on a request. +func NewPostAPITasksParamsWithTimeout(timeout time.Duration) *PostAPITasksParams { + return &PostAPITasksParams{ + timeout: timeout, + } +} + +// NewPostAPITasksParamsWithContext creates a new PostAPITasksParams object +// with the ability to set a context for a request. +func NewPostAPITasksParamsWithContext(ctx context.Context) *PostAPITasksParams { + return &PostAPITasksParams{ + Context: ctx, + } +} + +// NewPostAPITasksParamsWithHTTPClient creates a new PostAPITasksParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPITasksParamsWithHTTPClient(client *http.Client) *PostAPITasksParams { + return &PostAPITasksParams{ + HTTPClient: client, + } +} + +/* +PostAPITasksParams contains all the parameters to send to the API endpoint + + for the post API tasks operation. + + Typically these are written to a http.Request. +*/ +type PostAPITasksParams struct { + + // Body. + Body *models.TaskEditForm + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API tasks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITasksParams) WithDefaults() *PostAPITasksParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API tasks params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITasksParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API tasks params +func (o *PostAPITasksParams) WithTimeout(timeout time.Duration) *PostAPITasksParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API tasks params +func (o *PostAPITasksParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API tasks params +func (o *PostAPITasksParams) WithContext(ctx context.Context) *PostAPITasksParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API tasks params +func (o *PostAPITasksParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API tasks params +func (o *PostAPITasksParams) WithHTTPClient(client *http.Client) *PostAPITasksParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API tasks params +func (o *PostAPITasksParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API tasks params +func (o *PostAPITasksParams) WithBody(body *models.TaskEditForm) *PostAPITasksParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API tasks params +func (o *PostAPITasksParams) SetBody(body *models.TaskEditForm) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPITasksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/task/post_api_tasks_responses.go b/client/task/post_api_tasks_responses.go new file mode 100644 index 0000000..8c40643 --- /dev/null +++ b/client/task/post_api_tasks_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPITasksReader is a Reader for the PostAPITasks structure. +type PostAPITasksReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPITasksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPITasksOK() + 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()) + } +} + +// NewPostAPITasksOK creates a PostAPITasksOK with default headers values +func NewPostAPITasksOK() *PostAPITasksOK { + return &PostAPITasksOK{} +} + +/* +PostAPITasksOK describes a response with status code 200, with default header values. + +Returns the new created task +*/ +type PostAPITasksOK struct { + Payload *models.Task +} + +// IsSuccess returns true when this post Api tasks o k response has a 2xx status code +func (o *PostAPITasksOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api tasks o k response has a 3xx status code +func (o *PostAPITasksOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api tasks o k response has a 4xx status code +func (o *PostAPITasksOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api tasks o k response has a 5xx status code +func (o *PostAPITasksOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api tasks o k response a status code equal to that given +func (o *PostAPITasksOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPITasksOK) Error() string { + return fmt.Sprintf("[POST /api/tasks][%d] postApiTasksOK %+v", 200, o.Payload) +} + +func (o *PostAPITasksOK) String() string { + return fmt.Sprintf("[POST /api/tasks][%d] postApiTasksOK %+v", 200, o.Payload) +} + +func (o *PostAPITasksOK) GetPayload() *models.Task { + return o.Payload +} + +func (o *PostAPITasksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Task) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/task/task_client.go b/client/task/task_client.go new file mode 100644 index 0000000..1813b1d --- /dev/null +++ b/client/task/task_client.go @@ -0,0 +1,547 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package task + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new task API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for task API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPITasksID(params *DeleteAPITasksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITasksIDNoContent, error) + + GetAPITasks(params *GetAPITasksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITasksOK, error) + + GetAPITasksID(params *GetAPITasksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITasksIDOK, error) + + PatchAPITasksID(params *PatchAPITasksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDOK, error) + + PatchAPITasksIDAssign(params *PatchAPITasksIDAssignParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDAssignOK, error) + + PatchAPITasksIDClose(params *PatchAPITasksIDCloseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDCloseOK, error) + + PatchAPITasksIDLog(params *PatchAPITasksIDLogParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDLogOK, error) + + PatchAPITasksIDReopen(params *PatchAPITasksIDReopenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDReopenOK, error) + + PatchAPITasksIDStart(params *PatchAPITasksIDStartParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDStartOK, error) + + PatchAPITasksIDStop(params *PatchAPITasksIDStopParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDStopOK, error) + + PatchAPITasksIDUnassign(params *PatchAPITasksIDUnassignParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDUnassignOK, error) + + PostAPITasks(params *PostAPITasksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITasksOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPITasksID deletes an existing task record +*/ +func (a *Client) DeleteAPITasksID(params *DeleteAPITasksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITasksIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPITasksIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPITasksID", + Method: "DELETE", + PathPattern: "/api/tasks/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPITasksIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPITasksIDNoContent) + 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 DeleteAPITasksID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + GetAPITasks returns a collection of tasks + + Attention: This is a GET request and you can pass in every field of the form as query parameter. + +Array values need to be written like this: /api/tasks?projects[]=1&projects[]=2 +*/ +func (a *Client) GetAPITasks(params *GetAPITasksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITasksOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPITasksParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPITasks", + Method: "GET", + PathPattern: "/api/tasks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPITasksReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPITasksOK) + 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 GetAPITasks: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPITasksID returns one task +*/ +func (a *Client) GetAPITasksID(params *GetAPITasksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITasksIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPITasksIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPITasksID", + Method: "GET", + PathPattern: "/api/tasks/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPITasksIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPITasksIDOK) + 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 GetAPITasksID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITasksID updates an existing task + +Update an existing task, you can pass all or just a subset of all attributes +*/ +func (a *Client) PatchAPITasksID(params *PatchAPITasksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITasksIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITasksID", + Method: "PATCH", + PathPattern: "/api/tasks/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITasksIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITasksIDOK) + 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 PatchAPITasksID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITasksIDAssign assigns a task to the current user + +Assign a currently unassigned task to the current user +*/ +func (a *Client) PatchAPITasksIDAssign(params *PatchAPITasksIDAssignParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDAssignOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITasksIDAssignParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITasksIDAssign", + Method: "PATCH", + PathPattern: "/api/tasks/{id}/assign", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITasksIDAssignReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITasksIDAssignOK) + 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 PatchAPITasksIDAssign: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITasksIDClose closes a task for the current user + +Closes an assigned task for the current user +*/ +func (a *Client) PatchAPITasksIDClose(params *PatchAPITasksIDCloseParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDCloseOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITasksIDCloseParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITasksIDClose", + Method: "PATCH", + PathPattern: "/api/tasks/{id}/close", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITasksIDCloseReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITasksIDCloseOK) + 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 PatchAPITasksIDClose: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITasksIDLog logs work for a task record +*/ +func (a *Client) PatchAPITasksIDLog(params *PatchAPITasksIDLogParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDLogOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITasksIDLogParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITasksIDLog", + Method: "PATCH", + PathPattern: "/api/tasks/{id}/log", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITasksIDLogReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITasksIDLogOK) + 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 PatchAPITasksIDLog: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITasksIDReopen reopens a task for the current user + +Reopens an assigned task for the current user +*/ +func (a *Client) PatchAPITasksIDReopen(params *PatchAPITasksIDReopenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDReopenOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITasksIDReopenParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITasksIDReopen", + Method: "PATCH", + PathPattern: "/api/tasks/{id}/reopen", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITasksIDReopenReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITasksIDReopenOK) + 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 PatchAPITasksIDReopen: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITasksIDStart starts a task record +*/ +func (a *Client) PatchAPITasksIDStart(params *PatchAPITasksIDStartParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDStartOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITasksIDStartParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITasksIDStart", + Method: "PATCH", + PathPattern: "/api/tasks/{id}/start", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITasksIDStartReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITasksIDStartOK) + 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 PatchAPITasksIDStart: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITasksIDStop stops a task record for the current user +*/ +func (a *Client) PatchAPITasksIDStop(params *PatchAPITasksIDStopParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDStopOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITasksIDStopParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITasksIDStop", + Method: "PATCH", + PathPattern: "/api/tasks/{id}/stop", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITasksIDStopReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITasksIDStopOK) + 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 PatchAPITasksIDStop: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITasksIDUnassign unassigns a task from the current user + +Unassign a currently assigned task from the current user +*/ +func (a *Client) PatchAPITasksIDUnassign(params *PatchAPITasksIDUnassignParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITasksIDUnassignOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITasksIDUnassignParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITasksIDUnassign", + Method: "PATCH", + PathPattern: "/api/tasks/{id}/unassign", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITasksIDUnassignReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITasksIDUnassignOK) + 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 PatchAPITasksIDUnassign: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPITasks creates a new task + +Creates a new task and returns it afterwards +*/ +func (a *Client) PostAPITasks(params *PostAPITasksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITasksOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPITasksParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPITasks", + Method: "POST", + PathPattern: "/api/tasks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPITasksReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPITasksOK) + 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 PostAPITasks: 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/team/delete_api_teams_id_activities_activity_id_parameters.go b/client/team/delete_api_teams_id_activities_activity_id_parameters.go new file mode 100644 index 0000000..d4c7912 --- /dev/null +++ b/client/team/delete_api_teams_id_activities_activity_id_parameters.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" +) + +// NewDeleteAPITeamsIDActivitiesActivityIDParams creates a new DeleteAPITeamsIDActivitiesActivityIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPITeamsIDActivitiesActivityIDParams() *DeleteAPITeamsIDActivitiesActivityIDParams { + return &DeleteAPITeamsIDActivitiesActivityIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPITeamsIDActivitiesActivityIDParamsWithTimeout creates a new DeleteAPITeamsIDActivitiesActivityIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPITeamsIDActivitiesActivityIDParamsWithTimeout(timeout time.Duration) *DeleteAPITeamsIDActivitiesActivityIDParams { + return &DeleteAPITeamsIDActivitiesActivityIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPITeamsIDActivitiesActivityIDParamsWithContext creates a new DeleteAPITeamsIDActivitiesActivityIDParams object +// with the ability to set a context for a request. +func NewDeleteAPITeamsIDActivitiesActivityIDParamsWithContext(ctx context.Context) *DeleteAPITeamsIDActivitiesActivityIDParams { + return &DeleteAPITeamsIDActivitiesActivityIDParams{ + Context: ctx, + } +} + +// NewDeleteAPITeamsIDActivitiesActivityIDParamsWithHTTPClient creates a new DeleteAPITeamsIDActivitiesActivityIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPITeamsIDActivitiesActivityIDParamsWithHTTPClient(client *http.Client) *DeleteAPITeamsIDActivitiesActivityIDParams { + return &DeleteAPITeamsIDActivitiesActivityIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPITeamsIDActivitiesActivityIDParams contains all the parameters to send to the API endpoint + + for the delete API teams ID activities activity ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPITeamsIDActivitiesActivityIDParams struct { + + /* ActivityID. + + The activity to remove (Activity ID) + */ + ActivityID int64 + + /* ID. + + The team whose permission will be revoked + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API teams ID activities activity ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITeamsIDActivitiesActivityIDParams) WithDefaults() *DeleteAPITeamsIDActivitiesActivityIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API teams ID activities activity ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITeamsIDActivitiesActivityIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API teams ID activities activity ID params +func (o *DeleteAPITeamsIDActivitiesActivityIDParams) WithTimeout(timeout time.Duration) *DeleteAPITeamsIDActivitiesActivityIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API teams ID activities activity ID params +func (o *DeleteAPITeamsIDActivitiesActivityIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API teams ID activities activity ID params +func (o *DeleteAPITeamsIDActivitiesActivityIDParams) WithContext(ctx context.Context) *DeleteAPITeamsIDActivitiesActivityIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API teams ID activities activity ID params +func (o *DeleteAPITeamsIDActivitiesActivityIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API teams ID activities activity ID params +func (o *DeleteAPITeamsIDActivitiesActivityIDParams) WithHTTPClient(client *http.Client) *DeleteAPITeamsIDActivitiesActivityIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API teams ID activities activity ID params +func (o *DeleteAPITeamsIDActivitiesActivityIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithActivityID adds the activityID to the delete API teams ID activities activity ID params +func (o *DeleteAPITeamsIDActivitiesActivityIDParams) WithActivityID(activityID int64) *DeleteAPITeamsIDActivitiesActivityIDParams { + o.SetActivityID(activityID) + return o +} + +// SetActivityID adds the activityId to the delete API teams ID activities activity ID params +func (o *DeleteAPITeamsIDActivitiesActivityIDParams) SetActivityID(activityID int64) { + o.ActivityID = activityID +} + +// WithID adds the id to the delete API teams ID activities activity ID params +func (o *DeleteAPITeamsIDActivitiesActivityIDParams) WithID(id int64) *DeleteAPITeamsIDActivitiesActivityIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API teams ID activities activity ID params +func (o *DeleteAPITeamsIDActivitiesActivityIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPITeamsIDActivitiesActivityIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param activityId + if err := r.SetPathParam("activityId", swag.FormatInt64(o.ActivityID)); err != nil { + return err + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/team/delete_api_teams_id_activities_activity_id_responses.go b/client/team/delete_api_teams_id_activities_activity_id_responses.go new file mode 100644 index 0000000..0f6251a --- /dev/null +++ b/client/team/delete_api_teams_id_activities_activity_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// DeleteAPITeamsIDActivitiesActivityIDReader is a Reader for the DeleteAPITeamsIDActivitiesActivityID structure. +type DeleteAPITeamsIDActivitiesActivityIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPITeamsIDActivitiesActivityIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteAPITeamsIDActivitiesActivityIDOK() + 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()) + } +} + +// NewDeleteAPITeamsIDActivitiesActivityIDOK creates a DeleteAPITeamsIDActivitiesActivityIDOK with default headers values +func NewDeleteAPITeamsIDActivitiesActivityIDOK() *DeleteAPITeamsIDActivitiesActivityIDOK { + return &DeleteAPITeamsIDActivitiesActivityIDOK{} +} + +/* +DeleteAPITeamsIDActivitiesActivityIDOK describes a response with status code 200, with default header values. + +Removes a activity from the team. +*/ +type DeleteAPITeamsIDActivitiesActivityIDOK struct { + Payload *models.Team +} + +// IsSuccess returns true when this delete Api teams Id activities activity Id o k response has a 2xx status code +func (o *DeleteAPITeamsIDActivitiesActivityIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api teams Id activities activity Id o k response has a 3xx status code +func (o *DeleteAPITeamsIDActivitiesActivityIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api teams Id activities activity Id o k response has a 4xx status code +func (o *DeleteAPITeamsIDActivitiesActivityIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api teams Id activities activity Id o k response has a 5xx status code +func (o *DeleteAPITeamsIDActivitiesActivityIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api teams Id activities activity Id o k response a status code equal to that given +func (o *DeleteAPITeamsIDActivitiesActivityIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *DeleteAPITeamsIDActivitiesActivityIDOK) Error() string { + return fmt.Sprintf("[DELETE /api/teams/{id}/activities/{activityId}][%d] deleteApiTeamsIdActivitiesActivityIdOK %+v", 200, o.Payload) +} + +func (o *DeleteAPITeamsIDActivitiesActivityIDOK) String() string { + return fmt.Sprintf("[DELETE /api/teams/{id}/activities/{activityId}][%d] deleteApiTeamsIdActivitiesActivityIdOK %+v", 200, o.Payload) +} + +func (o *DeleteAPITeamsIDActivitiesActivityIDOK) GetPayload() *models.Team { + return o.Payload +} + +func (o *DeleteAPITeamsIDActivitiesActivityIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Team) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/team/delete_api_teams_id_customers_customer_id_parameters.go b/client/team/delete_api_teams_id_customers_customer_id_parameters.go new file mode 100644 index 0000000..a2df2c2 --- /dev/null +++ b/client/team/delete_api_teams_id_customers_customer_id_parameters.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" +) + +// NewDeleteAPITeamsIDCustomersCustomerIDParams creates a new DeleteAPITeamsIDCustomersCustomerIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPITeamsIDCustomersCustomerIDParams() *DeleteAPITeamsIDCustomersCustomerIDParams { + return &DeleteAPITeamsIDCustomersCustomerIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPITeamsIDCustomersCustomerIDParamsWithTimeout creates a new DeleteAPITeamsIDCustomersCustomerIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPITeamsIDCustomersCustomerIDParamsWithTimeout(timeout time.Duration) *DeleteAPITeamsIDCustomersCustomerIDParams { + return &DeleteAPITeamsIDCustomersCustomerIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPITeamsIDCustomersCustomerIDParamsWithContext creates a new DeleteAPITeamsIDCustomersCustomerIDParams object +// with the ability to set a context for a request. +func NewDeleteAPITeamsIDCustomersCustomerIDParamsWithContext(ctx context.Context) *DeleteAPITeamsIDCustomersCustomerIDParams { + return &DeleteAPITeamsIDCustomersCustomerIDParams{ + Context: ctx, + } +} + +// NewDeleteAPITeamsIDCustomersCustomerIDParamsWithHTTPClient creates a new DeleteAPITeamsIDCustomersCustomerIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPITeamsIDCustomersCustomerIDParamsWithHTTPClient(client *http.Client) *DeleteAPITeamsIDCustomersCustomerIDParams { + return &DeleteAPITeamsIDCustomersCustomerIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPITeamsIDCustomersCustomerIDParams contains all the parameters to send to the API endpoint + + for the delete API teams ID customers customer ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPITeamsIDCustomersCustomerIDParams struct { + + /* CustomerID. + + The customer to remove (Customer ID) + */ + CustomerID int64 + + /* ID. + + The team whose permission will be revoked + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API teams ID customers customer ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITeamsIDCustomersCustomerIDParams) WithDefaults() *DeleteAPITeamsIDCustomersCustomerIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API teams ID customers customer ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITeamsIDCustomersCustomerIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API teams ID customers customer ID params +func (o *DeleteAPITeamsIDCustomersCustomerIDParams) WithTimeout(timeout time.Duration) *DeleteAPITeamsIDCustomersCustomerIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API teams ID customers customer ID params +func (o *DeleteAPITeamsIDCustomersCustomerIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API teams ID customers customer ID params +func (o *DeleteAPITeamsIDCustomersCustomerIDParams) WithContext(ctx context.Context) *DeleteAPITeamsIDCustomersCustomerIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API teams ID customers customer ID params +func (o *DeleteAPITeamsIDCustomersCustomerIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API teams ID customers customer ID params +func (o *DeleteAPITeamsIDCustomersCustomerIDParams) WithHTTPClient(client *http.Client) *DeleteAPITeamsIDCustomersCustomerIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API teams ID customers customer ID params +func (o *DeleteAPITeamsIDCustomersCustomerIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCustomerID adds the customerID to the delete API teams ID customers customer ID params +func (o *DeleteAPITeamsIDCustomersCustomerIDParams) WithCustomerID(customerID int64) *DeleteAPITeamsIDCustomersCustomerIDParams { + o.SetCustomerID(customerID) + return o +} + +// SetCustomerID adds the customerId to the delete API teams ID customers customer ID params +func (o *DeleteAPITeamsIDCustomersCustomerIDParams) SetCustomerID(customerID int64) { + o.CustomerID = customerID +} + +// WithID adds the id to the delete API teams ID customers customer ID params +func (o *DeleteAPITeamsIDCustomersCustomerIDParams) WithID(id int64) *DeleteAPITeamsIDCustomersCustomerIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API teams ID customers customer ID params +func (o *DeleteAPITeamsIDCustomersCustomerIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPITeamsIDCustomersCustomerIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param customerId + if err := r.SetPathParam("customerId", swag.FormatInt64(o.CustomerID)); err != nil { + return err + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/team/delete_api_teams_id_customers_customer_id_responses.go b/client/team/delete_api_teams_id_customers_customer_id_responses.go new file mode 100644 index 0000000..faa5fac --- /dev/null +++ b/client/team/delete_api_teams_id_customers_customer_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// DeleteAPITeamsIDCustomersCustomerIDReader is a Reader for the DeleteAPITeamsIDCustomersCustomerID structure. +type DeleteAPITeamsIDCustomersCustomerIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPITeamsIDCustomersCustomerIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteAPITeamsIDCustomersCustomerIDOK() + 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()) + } +} + +// NewDeleteAPITeamsIDCustomersCustomerIDOK creates a DeleteAPITeamsIDCustomersCustomerIDOK with default headers values +func NewDeleteAPITeamsIDCustomersCustomerIDOK() *DeleteAPITeamsIDCustomersCustomerIDOK { + return &DeleteAPITeamsIDCustomersCustomerIDOK{} +} + +/* +DeleteAPITeamsIDCustomersCustomerIDOK describes a response with status code 200, with default header values. + +Removes a customer from the team. +*/ +type DeleteAPITeamsIDCustomersCustomerIDOK struct { + Payload *models.Team +} + +// IsSuccess returns true when this delete Api teams Id customers customer Id o k response has a 2xx status code +func (o *DeleteAPITeamsIDCustomersCustomerIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api teams Id customers customer Id o k response has a 3xx status code +func (o *DeleteAPITeamsIDCustomersCustomerIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api teams Id customers customer Id o k response has a 4xx status code +func (o *DeleteAPITeamsIDCustomersCustomerIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api teams Id customers customer Id o k response has a 5xx status code +func (o *DeleteAPITeamsIDCustomersCustomerIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api teams Id customers customer Id o k response a status code equal to that given +func (o *DeleteAPITeamsIDCustomersCustomerIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *DeleteAPITeamsIDCustomersCustomerIDOK) Error() string { + return fmt.Sprintf("[DELETE /api/teams/{id}/customers/{customerId}][%d] deleteApiTeamsIdCustomersCustomerIdOK %+v", 200, o.Payload) +} + +func (o *DeleteAPITeamsIDCustomersCustomerIDOK) String() string { + return fmt.Sprintf("[DELETE /api/teams/{id}/customers/{customerId}][%d] deleteApiTeamsIdCustomersCustomerIdOK %+v", 200, o.Payload) +} + +func (o *DeleteAPITeamsIDCustomersCustomerIDOK) GetPayload() *models.Team { + return o.Payload +} + +func (o *DeleteAPITeamsIDCustomersCustomerIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Team) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/team/delete_api_teams_id_members_user_id_parameters.go b/client/team/delete_api_teams_id_members_user_id_parameters.go new file mode 100644 index 0000000..3a8196b --- /dev/null +++ b/client/team/delete_api_teams_id_members_user_id_parameters.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" +) + +// NewDeleteAPITeamsIDMembersUserIDParams creates a new DeleteAPITeamsIDMembersUserIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPITeamsIDMembersUserIDParams() *DeleteAPITeamsIDMembersUserIDParams { + return &DeleteAPITeamsIDMembersUserIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPITeamsIDMembersUserIDParamsWithTimeout creates a new DeleteAPITeamsIDMembersUserIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPITeamsIDMembersUserIDParamsWithTimeout(timeout time.Duration) *DeleteAPITeamsIDMembersUserIDParams { + return &DeleteAPITeamsIDMembersUserIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPITeamsIDMembersUserIDParamsWithContext creates a new DeleteAPITeamsIDMembersUserIDParams object +// with the ability to set a context for a request. +func NewDeleteAPITeamsIDMembersUserIDParamsWithContext(ctx context.Context) *DeleteAPITeamsIDMembersUserIDParams { + return &DeleteAPITeamsIDMembersUserIDParams{ + Context: ctx, + } +} + +// NewDeleteAPITeamsIDMembersUserIDParamsWithHTTPClient creates a new DeleteAPITeamsIDMembersUserIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPITeamsIDMembersUserIDParamsWithHTTPClient(client *http.Client) *DeleteAPITeamsIDMembersUserIDParams { + return &DeleteAPITeamsIDMembersUserIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPITeamsIDMembersUserIDParams contains all the parameters to send to the API endpoint + + for the delete API teams ID members user ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPITeamsIDMembersUserIDParams struct { + + /* ID. + + The team from which the member will be removed + */ + ID int64 + + /* UserID. + + The team member to remove (User ID) + */ + UserID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API teams ID members user ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITeamsIDMembersUserIDParams) WithDefaults() *DeleteAPITeamsIDMembersUserIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API teams ID members user ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITeamsIDMembersUserIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API teams ID members user ID params +func (o *DeleteAPITeamsIDMembersUserIDParams) WithTimeout(timeout time.Duration) *DeleteAPITeamsIDMembersUserIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API teams ID members user ID params +func (o *DeleteAPITeamsIDMembersUserIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API teams ID members user ID params +func (o *DeleteAPITeamsIDMembersUserIDParams) WithContext(ctx context.Context) *DeleteAPITeamsIDMembersUserIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API teams ID members user ID params +func (o *DeleteAPITeamsIDMembersUserIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API teams ID members user ID params +func (o *DeleteAPITeamsIDMembersUserIDParams) WithHTTPClient(client *http.Client) *DeleteAPITeamsIDMembersUserIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API teams ID members user ID params +func (o *DeleteAPITeamsIDMembersUserIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete API teams ID members user ID params +func (o *DeleteAPITeamsIDMembersUserIDParams) WithID(id int64) *DeleteAPITeamsIDMembersUserIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API teams ID members user ID params +func (o *DeleteAPITeamsIDMembersUserIDParams) SetID(id int64) { + o.ID = id +} + +// WithUserID adds the userID to the delete API teams ID members user ID params +func (o *DeleteAPITeamsIDMembersUserIDParams) WithUserID(userID int64) *DeleteAPITeamsIDMembersUserIDParams { + o.SetUserID(userID) + return o +} + +// SetUserID adds the userId to the delete API teams ID members user ID params +func (o *DeleteAPITeamsIDMembersUserIDParams) SetUserID(userID int64) { + o.UserID = userID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPITeamsIDMembersUserIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + // path param userId + if err := r.SetPathParam("userId", swag.FormatInt64(o.UserID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/team/delete_api_teams_id_members_user_id_responses.go b/client/team/delete_api_teams_id_members_user_id_responses.go new file mode 100644 index 0000000..9faec49 --- /dev/null +++ b/client/team/delete_api_teams_id_members_user_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// DeleteAPITeamsIDMembersUserIDReader is a Reader for the DeleteAPITeamsIDMembersUserID structure. +type DeleteAPITeamsIDMembersUserIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPITeamsIDMembersUserIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteAPITeamsIDMembersUserIDOK() + 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()) + } +} + +// NewDeleteAPITeamsIDMembersUserIDOK creates a DeleteAPITeamsIDMembersUserIDOK with default headers values +func NewDeleteAPITeamsIDMembersUserIDOK() *DeleteAPITeamsIDMembersUserIDOK { + return &DeleteAPITeamsIDMembersUserIDOK{} +} + +/* +DeleteAPITeamsIDMembersUserIDOK describes a response with status code 200, with default header values. + +Removes a user from the team. The teamlead cannot be removed. +*/ +type DeleteAPITeamsIDMembersUserIDOK struct { + Payload *models.Team +} + +// IsSuccess returns true when this delete Api teams Id members user Id o k response has a 2xx status code +func (o *DeleteAPITeamsIDMembersUserIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api teams Id members user Id o k response has a 3xx status code +func (o *DeleteAPITeamsIDMembersUserIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api teams Id members user Id o k response has a 4xx status code +func (o *DeleteAPITeamsIDMembersUserIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api teams Id members user Id o k response has a 5xx status code +func (o *DeleteAPITeamsIDMembersUserIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api teams Id members user Id o k response a status code equal to that given +func (o *DeleteAPITeamsIDMembersUserIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *DeleteAPITeamsIDMembersUserIDOK) Error() string { + return fmt.Sprintf("[DELETE /api/teams/{id}/members/{userId}][%d] deleteApiTeamsIdMembersUserIdOK %+v", 200, o.Payload) +} + +func (o *DeleteAPITeamsIDMembersUserIDOK) String() string { + return fmt.Sprintf("[DELETE /api/teams/{id}/members/{userId}][%d] deleteApiTeamsIdMembersUserIdOK %+v", 200, o.Payload) +} + +func (o *DeleteAPITeamsIDMembersUserIDOK) GetPayload() *models.Team { + return o.Payload +} + +func (o *DeleteAPITeamsIDMembersUserIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Team) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/team/delete_api_teams_id_parameters.go b/client/team/delete_api_teams_id_parameters.go new file mode 100644 index 0000000..8c7d422 --- /dev/null +++ b/client/team/delete_api_teams_id_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" +) + +// NewDeleteAPITeamsIDParams creates a new DeleteAPITeamsIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPITeamsIDParams() *DeleteAPITeamsIDParams { + return &DeleteAPITeamsIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPITeamsIDParamsWithTimeout creates a new DeleteAPITeamsIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPITeamsIDParamsWithTimeout(timeout time.Duration) *DeleteAPITeamsIDParams { + return &DeleteAPITeamsIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPITeamsIDParamsWithContext creates a new DeleteAPITeamsIDParams object +// with the ability to set a context for a request. +func NewDeleteAPITeamsIDParamsWithContext(ctx context.Context) *DeleteAPITeamsIDParams { + return &DeleteAPITeamsIDParams{ + Context: ctx, + } +} + +// NewDeleteAPITeamsIDParamsWithHTTPClient creates a new DeleteAPITeamsIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPITeamsIDParamsWithHTTPClient(client *http.Client) *DeleteAPITeamsIDParams { + return &DeleteAPITeamsIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPITeamsIDParams contains all the parameters to send to the API endpoint + + for the delete API teams ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPITeamsIDParams struct { + + /* ID. + + Team ID to delete + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API teams ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITeamsIDParams) WithDefaults() *DeleteAPITeamsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API teams ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITeamsIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API teams ID params +func (o *DeleteAPITeamsIDParams) WithTimeout(timeout time.Duration) *DeleteAPITeamsIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API teams ID params +func (o *DeleteAPITeamsIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API teams ID params +func (o *DeleteAPITeamsIDParams) WithContext(ctx context.Context) *DeleteAPITeamsIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API teams ID params +func (o *DeleteAPITeamsIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API teams ID params +func (o *DeleteAPITeamsIDParams) WithHTTPClient(client *http.Client) *DeleteAPITeamsIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API teams ID params +func (o *DeleteAPITeamsIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete API teams ID params +func (o *DeleteAPITeamsIDParams) WithID(id int64) *DeleteAPITeamsIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API teams ID params +func (o *DeleteAPITeamsIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPITeamsIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/team/delete_api_teams_id_projects_project_id_parameters.go b/client/team/delete_api_teams_id_projects_project_id_parameters.go new file mode 100644 index 0000000..65c8b9a --- /dev/null +++ b/client/team/delete_api_teams_id_projects_project_id_parameters.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" +) + +// NewDeleteAPITeamsIDProjectsProjectIDParams creates a new DeleteAPITeamsIDProjectsProjectIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPITeamsIDProjectsProjectIDParams() *DeleteAPITeamsIDProjectsProjectIDParams { + return &DeleteAPITeamsIDProjectsProjectIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPITeamsIDProjectsProjectIDParamsWithTimeout creates a new DeleteAPITeamsIDProjectsProjectIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPITeamsIDProjectsProjectIDParamsWithTimeout(timeout time.Duration) *DeleteAPITeamsIDProjectsProjectIDParams { + return &DeleteAPITeamsIDProjectsProjectIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPITeamsIDProjectsProjectIDParamsWithContext creates a new DeleteAPITeamsIDProjectsProjectIDParams object +// with the ability to set a context for a request. +func NewDeleteAPITeamsIDProjectsProjectIDParamsWithContext(ctx context.Context) *DeleteAPITeamsIDProjectsProjectIDParams { + return &DeleteAPITeamsIDProjectsProjectIDParams{ + Context: ctx, + } +} + +// NewDeleteAPITeamsIDProjectsProjectIDParamsWithHTTPClient creates a new DeleteAPITeamsIDProjectsProjectIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPITeamsIDProjectsProjectIDParamsWithHTTPClient(client *http.Client) *DeleteAPITeamsIDProjectsProjectIDParams { + return &DeleteAPITeamsIDProjectsProjectIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPITeamsIDProjectsProjectIDParams contains all the parameters to send to the API endpoint + + for the delete API teams ID projects project ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPITeamsIDProjectsProjectIDParams struct { + + /* ID. + + The team whose permission will be revoked + */ + ID int64 + + /* ProjectID. + + The project to remove (Project ID) + */ + ProjectID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API teams ID projects project ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITeamsIDProjectsProjectIDParams) WithDefaults() *DeleteAPITeamsIDProjectsProjectIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API teams ID projects project ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITeamsIDProjectsProjectIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API teams ID projects project ID params +func (o *DeleteAPITeamsIDProjectsProjectIDParams) WithTimeout(timeout time.Duration) *DeleteAPITeamsIDProjectsProjectIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API teams ID projects project ID params +func (o *DeleteAPITeamsIDProjectsProjectIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API teams ID projects project ID params +func (o *DeleteAPITeamsIDProjectsProjectIDParams) WithContext(ctx context.Context) *DeleteAPITeamsIDProjectsProjectIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API teams ID projects project ID params +func (o *DeleteAPITeamsIDProjectsProjectIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API teams ID projects project ID params +func (o *DeleteAPITeamsIDProjectsProjectIDParams) WithHTTPClient(client *http.Client) *DeleteAPITeamsIDProjectsProjectIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API teams ID projects project ID params +func (o *DeleteAPITeamsIDProjectsProjectIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete API teams ID projects project ID params +func (o *DeleteAPITeamsIDProjectsProjectIDParams) WithID(id int64) *DeleteAPITeamsIDProjectsProjectIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API teams ID projects project ID params +func (o *DeleteAPITeamsIDProjectsProjectIDParams) SetID(id int64) { + o.ID = id +} + +// WithProjectID adds the projectID to the delete API teams ID projects project ID params +func (o *DeleteAPITeamsIDProjectsProjectIDParams) WithProjectID(projectID int64) *DeleteAPITeamsIDProjectsProjectIDParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the delete API teams ID projects project ID params +func (o *DeleteAPITeamsIDProjectsProjectIDParams) SetProjectID(projectID int64) { + o.ProjectID = projectID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPITeamsIDProjectsProjectIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + // path param projectId + if err := r.SetPathParam("projectId", swag.FormatInt64(o.ProjectID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/team/delete_api_teams_id_projects_project_id_responses.go b/client/team/delete_api_teams_id_projects_project_id_responses.go new file mode 100644 index 0000000..03025b8 --- /dev/null +++ b/client/team/delete_api_teams_id_projects_project_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// DeleteAPITeamsIDProjectsProjectIDReader is a Reader for the DeleteAPITeamsIDProjectsProjectID structure. +type DeleteAPITeamsIDProjectsProjectIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPITeamsIDProjectsProjectIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteAPITeamsIDProjectsProjectIDOK() + 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()) + } +} + +// NewDeleteAPITeamsIDProjectsProjectIDOK creates a DeleteAPITeamsIDProjectsProjectIDOK with default headers values +func NewDeleteAPITeamsIDProjectsProjectIDOK() *DeleteAPITeamsIDProjectsProjectIDOK { + return &DeleteAPITeamsIDProjectsProjectIDOK{} +} + +/* +DeleteAPITeamsIDProjectsProjectIDOK describes a response with status code 200, with default header values. + +Removes a project from the team. +*/ +type DeleteAPITeamsIDProjectsProjectIDOK struct { + Payload *models.Team +} + +// IsSuccess returns true when this delete Api teams Id projects project Id o k response has a 2xx status code +func (o *DeleteAPITeamsIDProjectsProjectIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api teams Id projects project Id o k response has a 3xx status code +func (o *DeleteAPITeamsIDProjectsProjectIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api teams Id projects project Id o k response has a 4xx status code +func (o *DeleteAPITeamsIDProjectsProjectIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api teams Id projects project Id o k response has a 5xx status code +func (o *DeleteAPITeamsIDProjectsProjectIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api teams Id projects project Id o k response a status code equal to that given +func (o *DeleteAPITeamsIDProjectsProjectIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *DeleteAPITeamsIDProjectsProjectIDOK) Error() string { + return fmt.Sprintf("[DELETE /api/teams/{id}/projects/{projectId}][%d] deleteApiTeamsIdProjectsProjectIdOK %+v", 200, o.Payload) +} + +func (o *DeleteAPITeamsIDProjectsProjectIDOK) String() string { + return fmt.Sprintf("[DELETE /api/teams/{id}/projects/{projectId}][%d] deleteApiTeamsIdProjectsProjectIdOK %+v", 200, o.Payload) +} + +func (o *DeleteAPITeamsIDProjectsProjectIDOK) GetPayload() *models.Team { + return o.Payload +} + +func (o *DeleteAPITeamsIDProjectsProjectIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Team) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/team/delete_api_teams_id_responses.go b/client/team/delete_api_teams_id_responses.go new file mode 100644 index 0000000..e5110b7 --- /dev/null +++ b/client/team/delete_api_teams_id_responses.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// DeleteAPITeamsIDReader is a Reader for the DeleteAPITeamsID structure. +type DeleteAPITeamsIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPITeamsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 204: + result := NewDeleteAPITeamsIDNoContent() + 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()) + } +} + +// NewDeleteAPITeamsIDNoContent creates a DeleteAPITeamsIDNoContent with default headers values +func NewDeleteAPITeamsIDNoContent() *DeleteAPITeamsIDNoContent { + return &DeleteAPITeamsIDNoContent{} +} + +/* +DeleteAPITeamsIDNoContent describes a response with status code 204, with default header values. + +Delete one team +*/ +type DeleteAPITeamsIDNoContent struct { +} + +// IsSuccess returns true when this delete Api teams Id no content response has a 2xx status code +func (o *DeleteAPITeamsIDNoContent) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api teams Id no content response has a 3xx status code +func (o *DeleteAPITeamsIDNoContent) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api teams Id no content response has a 4xx status code +func (o *DeleteAPITeamsIDNoContent) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api teams Id no content response has a 5xx status code +func (o *DeleteAPITeamsIDNoContent) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api teams Id no content response a status code equal to that given +func (o *DeleteAPITeamsIDNoContent) IsCode(code int) bool { + return code == 204 +} + +func (o *DeleteAPITeamsIDNoContent) Error() string { + return fmt.Sprintf("[DELETE /api/teams/{id}][%d] deleteApiTeamsIdNoContent ", 204) +} + +func (o *DeleteAPITeamsIDNoContent) String() string { + return fmt.Sprintf("[DELETE /api/teams/{id}][%d] deleteApiTeamsIdNoContent ", 204) +} + +func (o *DeleteAPITeamsIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/team/get_api_teams_id_parameters.go b/client/team/get_api_teams_id_parameters.go new file mode 100644 index 0000000..9cbcae7 --- /dev/null +++ b/client/team/get_api_teams_id_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" +) + +// NewGetAPITeamsIDParams creates a new GetAPITeamsIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPITeamsIDParams() *GetAPITeamsIDParams { + return &GetAPITeamsIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPITeamsIDParamsWithTimeout creates a new GetAPITeamsIDParams object +// with the ability to set a timeout on a request. +func NewGetAPITeamsIDParamsWithTimeout(timeout time.Duration) *GetAPITeamsIDParams { + return &GetAPITeamsIDParams{ + timeout: timeout, + } +} + +// NewGetAPITeamsIDParamsWithContext creates a new GetAPITeamsIDParams object +// with the ability to set a context for a request. +func NewGetAPITeamsIDParamsWithContext(ctx context.Context) *GetAPITeamsIDParams { + return &GetAPITeamsIDParams{ + Context: ctx, + } +} + +// NewGetAPITeamsIDParamsWithHTTPClient creates a new GetAPITeamsIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPITeamsIDParamsWithHTTPClient(client *http.Client) *GetAPITeamsIDParams { + return &GetAPITeamsIDParams{ + HTTPClient: client, + } +} + +/* +GetAPITeamsIDParams contains all the parameters to send to the API endpoint + + for the get API teams ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPITeamsIDParams struct { + + // ID. + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API teams ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITeamsIDParams) WithDefaults() *GetAPITeamsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API teams ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITeamsIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API teams ID params +func (o *GetAPITeamsIDParams) WithTimeout(timeout time.Duration) *GetAPITeamsIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API teams ID params +func (o *GetAPITeamsIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API teams ID params +func (o *GetAPITeamsIDParams) WithContext(ctx context.Context) *GetAPITeamsIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API teams ID params +func (o *GetAPITeamsIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API teams ID params +func (o *GetAPITeamsIDParams) WithHTTPClient(client *http.Client) *GetAPITeamsIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API teams ID params +func (o *GetAPITeamsIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get API teams ID params +func (o *GetAPITeamsIDParams) WithID(id string) *GetAPITeamsIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API teams ID params +func (o *GetAPITeamsIDParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPITeamsIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/team/get_api_teams_id_responses.go b/client/team/get_api_teams_id_responses.go new file mode 100644 index 0000000..bca04d5 --- /dev/null +++ b/client/team/get_api_teams_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPITeamsIDReader is a Reader for the GetAPITeamsID structure. +type GetAPITeamsIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPITeamsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPITeamsIDOK() + 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()) + } +} + +// NewGetAPITeamsIDOK creates a GetAPITeamsIDOK with default headers values +func NewGetAPITeamsIDOK() *GetAPITeamsIDOK { + return &GetAPITeamsIDOK{} +} + +/* +GetAPITeamsIDOK describes a response with status code 200, with default header values. + +Returns one team entity +*/ +type GetAPITeamsIDOK struct { + Payload *models.Team +} + +// IsSuccess returns true when this get Api teams Id o k response has a 2xx status code +func (o *GetAPITeamsIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api teams Id o k response has a 3xx status code +func (o *GetAPITeamsIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api teams Id o k response has a 4xx status code +func (o *GetAPITeamsIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api teams Id o k response has a 5xx status code +func (o *GetAPITeamsIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api teams Id o k response a status code equal to that given +func (o *GetAPITeamsIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPITeamsIDOK) Error() string { + return fmt.Sprintf("[GET /api/teams/{id}][%d] getApiTeamsIdOK %+v", 200, o.Payload) +} + +func (o *GetAPITeamsIDOK) String() string { + return fmt.Sprintf("[GET /api/teams/{id}][%d] getApiTeamsIdOK %+v", 200, o.Payload) +} + +func (o *GetAPITeamsIDOK) GetPayload() *models.Team { + return o.Payload +} + +func (o *GetAPITeamsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Team) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/team/get_api_teams_parameters.go b/client/team/get_api_teams_parameters.go new file mode 100644 index 0000000..14c12f3 --- /dev/null +++ b/client/team/get_api_teams_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" +) + +// NewGetAPITeamsParams creates a new GetAPITeamsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPITeamsParams() *GetAPITeamsParams { + return &GetAPITeamsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPITeamsParamsWithTimeout creates a new GetAPITeamsParams object +// with the ability to set a timeout on a request. +func NewGetAPITeamsParamsWithTimeout(timeout time.Duration) *GetAPITeamsParams { + return &GetAPITeamsParams{ + timeout: timeout, + } +} + +// NewGetAPITeamsParamsWithContext creates a new GetAPITeamsParams object +// with the ability to set a context for a request. +func NewGetAPITeamsParamsWithContext(ctx context.Context) *GetAPITeamsParams { + return &GetAPITeamsParams{ + Context: ctx, + } +} + +// NewGetAPITeamsParamsWithHTTPClient creates a new GetAPITeamsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPITeamsParamsWithHTTPClient(client *http.Client) *GetAPITeamsParams { + return &GetAPITeamsParams{ + HTTPClient: client, + } +} + +/* +GetAPITeamsParams contains all the parameters to send to the API endpoint + + for the get API teams operation. + + Typically these are written to a http.Request. +*/ +type GetAPITeamsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API teams params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITeamsParams) WithDefaults() *GetAPITeamsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API teams params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITeamsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API teams params +func (o *GetAPITeamsParams) WithTimeout(timeout time.Duration) *GetAPITeamsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API teams params +func (o *GetAPITeamsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API teams params +func (o *GetAPITeamsParams) WithContext(ctx context.Context) *GetAPITeamsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API teams params +func (o *GetAPITeamsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API teams params +func (o *GetAPITeamsParams) WithHTTPClient(client *http.Client) *GetAPITeamsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API teams params +func (o *GetAPITeamsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPITeamsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/team/get_api_teams_responses.go b/client/team/get_api_teams_responses.go new file mode 100644 index 0000000..0f16ed1 --- /dev/null +++ b/client/team/get_api_teams_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPITeamsReader is a Reader for the GetAPITeams structure. +type GetAPITeamsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPITeamsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPITeamsOK() + 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()) + } +} + +// NewGetAPITeamsOK creates a GetAPITeamsOK with default headers values +func NewGetAPITeamsOK() *GetAPITeamsOK { + return &GetAPITeamsOK{} +} + +/* +GetAPITeamsOK describes a response with status code 200, with default header values. + +Returns the collection of all existing teams +*/ +type GetAPITeamsOK struct { + Payload []*models.TeamCollection +} + +// IsSuccess returns true when this get Api teams o k response has a 2xx status code +func (o *GetAPITeamsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api teams o k response has a 3xx status code +func (o *GetAPITeamsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api teams o k response has a 4xx status code +func (o *GetAPITeamsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api teams o k response has a 5xx status code +func (o *GetAPITeamsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api teams o k response a status code equal to that given +func (o *GetAPITeamsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPITeamsOK) Error() string { + return fmt.Sprintf("[GET /api/teams][%d] getApiTeamsOK %+v", 200, o.Payload) +} + +func (o *GetAPITeamsOK) String() string { + return fmt.Sprintf("[GET /api/teams][%d] getApiTeamsOK %+v", 200, o.Payload) +} + +func (o *GetAPITeamsOK) GetPayload() []*models.TeamCollection { + return o.Payload +} + +func (o *GetAPITeamsOK) 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/team/patch_api_teams_id_parameters.go b/client/team/patch_api_teams_id_parameters.go new file mode 100644 index 0000000..74f241a --- /dev/null +++ b/client/team/patch_api_teams_id_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPatchAPITeamsIDParams creates a new PatchAPITeamsIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITeamsIDParams() *PatchAPITeamsIDParams { + return &PatchAPITeamsIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITeamsIDParamsWithTimeout creates a new PatchAPITeamsIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPITeamsIDParamsWithTimeout(timeout time.Duration) *PatchAPITeamsIDParams { + return &PatchAPITeamsIDParams{ + timeout: timeout, + } +} + +// NewPatchAPITeamsIDParamsWithContext creates a new PatchAPITeamsIDParams object +// with the ability to set a context for a request. +func NewPatchAPITeamsIDParamsWithContext(ctx context.Context) *PatchAPITeamsIDParams { + return &PatchAPITeamsIDParams{ + Context: ctx, + } +} + +// NewPatchAPITeamsIDParamsWithHTTPClient creates a new PatchAPITeamsIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITeamsIDParamsWithHTTPClient(client *http.Client) *PatchAPITeamsIDParams { + return &PatchAPITeamsIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPITeamsIDParams contains all the parameters to send to the API endpoint + + for the patch API teams ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITeamsIDParams struct { + + // Body. + Body *models.TeamEditForm + + /* ID. + + Team ID to update + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API teams ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITeamsIDParams) WithDefaults() *PatchAPITeamsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API teams ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITeamsIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API teams ID params +func (o *PatchAPITeamsIDParams) WithTimeout(timeout time.Duration) *PatchAPITeamsIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API teams ID params +func (o *PatchAPITeamsIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API teams ID params +func (o *PatchAPITeamsIDParams) WithContext(ctx context.Context) *PatchAPITeamsIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API teams ID params +func (o *PatchAPITeamsIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API teams ID params +func (o *PatchAPITeamsIDParams) WithHTTPClient(client *http.Client) *PatchAPITeamsIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API teams ID params +func (o *PatchAPITeamsIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API teams ID params +func (o *PatchAPITeamsIDParams) WithBody(body *models.TeamEditForm) *PatchAPITeamsIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API teams ID params +func (o *PatchAPITeamsIDParams) SetBody(body *models.TeamEditForm) { + o.Body = body +} + +// WithID adds the id to the patch API teams ID params +func (o *PatchAPITeamsIDParams) WithID(id int64) *PatchAPITeamsIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API teams ID params +func (o *PatchAPITeamsIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITeamsIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/team/patch_api_teams_id_responses.go b/client/team/patch_api_teams_id_responses.go new file mode 100644 index 0000000..d7d8d54 --- /dev/null +++ b/client/team/patch_api_teams_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPITeamsIDReader is a Reader for the PatchAPITeamsID structure. +type PatchAPITeamsIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITeamsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITeamsIDOK() + 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()) + } +} + +// NewPatchAPITeamsIDOK creates a PatchAPITeamsIDOK with default headers values +func NewPatchAPITeamsIDOK() *PatchAPITeamsIDOK { + return &PatchAPITeamsIDOK{} +} + +/* +PatchAPITeamsIDOK describes a response with status code 200, with default header values. + +Returns the updated team +*/ +type PatchAPITeamsIDOK struct { + Payload *models.Team +} + +// IsSuccess returns true when this patch Api teams Id o k response has a 2xx status code +func (o *PatchAPITeamsIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api teams Id o k response has a 3xx status code +func (o *PatchAPITeamsIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api teams Id o k response has a 4xx status code +func (o *PatchAPITeamsIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api teams Id o k response has a 5xx status code +func (o *PatchAPITeamsIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api teams Id o k response a status code equal to that given +func (o *PatchAPITeamsIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITeamsIDOK) Error() string { + return fmt.Sprintf("[PATCH /api/teams/{id}][%d] patchApiTeamsIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPITeamsIDOK) String() string { + return fmt.Sprintf("[PATCH /api/teams/{id}][%d] patchApiTeamsIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPITeamsIDOK) GetPayload() *models.Team { + return o.Payload +} + +func (o *PatchAPITeamsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Team) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/team/post_api_teams_id_activities_activity_id_parameters.go b/client/team/post_api_teams_id_activities_activity_id_parameters.go new file mode 100644 index 0000000..e08cd4b --- /dev/null +++ b/client/team/post_api_teams_id_activities_activity_id_parameters.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" +) + +// NewPostAPITeamsIDActivitiesActivityIDParams creates a new PostAPITeamsIDActivitiesActivityIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPITeamsIDActivitiesActivityIDParams() *PostAPITeamsIDActivitiesActivityIDParams { + return &PostAPITeamsIDActivitiesActivityIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPITeamsIDActivitiesActivityIDParamsWithTimeout creates a new PostAPITeamsIDActivitiesActivityIDParams object +// with the ability to set a timeout on a request. +func NewPostAPITeamsIDActivitiesActivityIDParamsWithTimeout(timeout time.Duration) *PostAPITeamsIDActivitiesActivityIDParams { + return &PostAPITeamsIDActivitiesActivityIDParams{ + timeout: timeout, + } +} + +// NewPostAPITeamsIDActivitiesActivityIDParamsWithContext creates a new PostAPITeamsIDActivitiesActivityIDParams object +// with the ability to set a context for a request. +func NewPostAPITeamsIDActivitiesActivityIDParamsWithContext(ctx context.Context) *PostAPITeamsIDActivitiesActivityIDParams { + return &PostAPITeamsIDActivitiesActivityIDParams{ + Context: ctx, + } +} + +// NewPostAPITeamsIDActivitiesActivityIDParamsWithHTTPClient creates a new PostAPITeamsIDActivitiesActivityIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPITeamsIDActivitiesActivityIDParamsWithHTTPClient(client *http.Client) *PostAPITeamsIDActivitiesActivityIDParams { + return &PostAPITeamsIDActivitiesActivityIDParams{ + HTTPClient: client, + } +} + +/* +PostAPITeamsIDActivitiesActivityIDParams contains all the parameters to send to the API endpoint + + for the post API teams ID activities activity ID operation. + + Typically these are written to a http.Request. +*/ +type PostAPITeamsIDActivitiesActivityIDParams struct { + + /* ActivityID. + + The activity to grant acecess to (Activity ID) + */ + ActivityID int64 + + /* ID. + + The team that is granted access + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API teams ID activities activity ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITeamsIDActivitiesActivityIDParams) WithDefaults() *PostAPITeamsIDActivitiesActivityIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API teams ID activities activity ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITeamsIDActivitiesActivityIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API teams ID activities activity ID params +func (o *PostAPITeamsIDActivitiesActivityIDParams) WithTimeout(timeout time.Duration) *PostAPITeamsIDActivitiesActivityIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API teams ID activities activity ID params +func (o *PostAPITeamsIDActivitiesActivityIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API teams ID activities activity ID params +func (o *PostAPITeamsIDActivitiesActivityIDParams) WithContext(ctx context.Context) *PostAPITeamsIDActivitiesActivityIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API teams ID activities activity ID params +func (o *PostAPITeamsIDActivitiesActivityIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API teams ID activities activity ID params +func (o *PostAPITeamsIDActivitiesActivityIDParams) WithHTTPClient(client *http.Client) *PostAPITeamsIDActivitiesActivityIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API teams ID activities activity ID params +func (o *PostAPITeamsIDActivitiesActivityIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithActivityID adds the activityID to the post API teams ID activities activity ID params +func (o *PostAPITeamsIDActivitiesActivityIDParams) WithActivityID(activityID int64) *PostAPITeamsIDActivitiesActivityIDParams { + o.SetActivityID(activityID) + return o +} + +// SetActivityID adds the activityId to the post API teams ID activities activity ID params +func (o *PostAPITeamsIDActivitiesActivityIDParams) SetActivityID(activityID int64) { + o.ActivityID = activityID +} + +// WithID adds the id to the post API teams ID activities activity ID params +func (o *PostAPITeamsIDActivitiesActivityIDParams) WithID(id int64) *PostAPITeamsIDActivitiesActivityIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the post API teams ID activities activity ID params +func (o *PostAPITeamsIDActivitiesActivityIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPITeamsIDActivitiesActivityIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param activityId + if err := r.SetPathParam("activityId", swag.FormatInt64(o.ActivityID)); err != nil { + return err + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/team/post_api_teams_id_activities_activity_id_responses.go b/client/team/post_api_teams_id_activities_activity_id_responses.go new file mode 100644 index 0000000..6851a34 --- /dev/null +++ b/client/team/post_api_teams_id_activities_activity_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPITeamsIDActivitiesActivityIDReader is a Reader for the PostAPITeamsIDActivitiesActivityID structure. +type PostAPITeamsIDActivitiesActivityIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPITeamsIDActivitiesActivityIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPITeamsIDActivitiesActivityIDOK() + 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()) + } +} + +// NewPostAPITeamsIDActivitiesActivityIDOK creates a PostAPITeamsIDActivitiesActivityIDOK with default headers values +func NewPostAPITeamsIDActivitiesActivityIDOK() *PostAPITeamsIDActivitiesActivityIDOK { + return &PostAPITeamsIDActivitiesActivityIDOK{} +} + +/* +PostAPITeamsIDActivitiesActivityIDOK describes a response with status code 200, with default header values. + +Adds a new activity to a team. +*/ +type PostAPITeamsIDActivitiesActivityIDOK struct { + Payload *models.Team +} + +// IsSuccess returns true when this post Api teams Id activities activity Id o k response has a 2xx status code +func (o *PostAPITeamsIDActivitiesActivityIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api teams Id activities activity Id o k response has a 3xx status code +func (o *PostAPITeamsIDActivitiesActivityIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api teams Id activities activity Id o k response has a 4xx status code +func (o *PostAPITeamsIDActivitiesActivityIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api teams Id activities activity Id o k response has a 5xx status code +func (o *PostAPITeamsIDActivitiesActivityIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api teams Id activities activity Id o k response a status code equal to that given +func (o *PostAPITeamsIDActivitiesActivityIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPITeamsIDActivitiesActivityIDOK) Error() string { + return fmt.Sprintf("[POST /api/teams/{id}/activities/{activityId}][%d] postApiTeamsIdActivitiesActivityIdOK %+v", 200, o.Payload) +} + +func (o *PostAPITeamsIDActivitiesActivityIDOK) String() string { + return fmt.Sprintf("[POST /api/teams/{id}/activities/{activityId}][%d] postApiTeamsIdActivitiesActivityIdOK %+v", 200, o.Payload) +} + +func (o *PostAPITeamsIDActivitiesActivityIDOK) GetPayload() *models.Team { + return o.Payload +} + +func (o *PostAPITeamsIDActivitiesActivityIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Team) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/team/post_api_teams_id_customers_customer_id_parameters.go b/client/team/post_api_teams_id_customers_customer_id_parameters.go new file mode 100644 index 0000000..06158fd --- /dev/null +++ b/client/team/post_api_teams_id_customers_customer_id_parameters.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" +) + +// NewPostAPITeamsIDCustomersCustomerIDParams creates a new PostAPITeamsIDCustomersCustomerIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPITeamsIDCustomersCustomerIDParams() *PostAPITeamsIDCustomersCustomerIDParams { + return &PostAPITeamsIDCustomersCustomerIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPITeamsIDCustomersCustomerIDParamsWithTimeout creates a new PostAPITeamsIDCustomersCustomerIDParams object +// with the ability to set a timeout on a request. +func NewPostAPITeamsIDCustomersCustomerIDParamsWithTimeout(timeout time.Duration) *PostAPITeamsIDCustomersCustomerIDParams { + return &PostAPITeamsIDCustomersCustomerIDParams{ + timeout: timeout, + } +} + +// NewPostAPITeamsIDCustomersCustomerIDParamsWithContext creates a new PostAPITeamsIDCustomersCustomerIDParams object +// with the ability to set a context for a request. +func NewPostAPITeamsIDCustomersCustomerIDParamsWithContext(ctx context.Context) *PostAPITeamsIDCustomersCustomerIDParams { + return &PostAPITeamsIDCustomersCustomerIDParams{ + Context: ctx, + } +} + +// NewPostAPITeamsIDCustomersCustomerIDParamsWithHTTPClient creates a new PostAPITeamsIDCustomersCustomerIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPITeamsIDCustomersCustomerIDParamsWithHTTPClient(client *http.Client) *PostAPITeamsIDCustomersCustomerIDParams { + return &PostAPITeamsIDCustomersCustomerIDParams{ + HTTPClient: client, + } +} + +/* +PostAPITeamsIDCustomersCustomerIDParams contains all the parameters to send to the API endpoint + + for the post API teams ID customers customer ID operation. + + Typically these are written to a http.Request. +*/ +type PostAPITeamsIDCustomersCustomerIDParams struct { + + /* CustomerID. + + The customer to grant acecess to (Customer ID) + */ + CustomerID int64 + + /* ID. + + The team that is granted access + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API teams ID customers customer ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITeamsIDCustomersCustomerIDParams) WithDefaults() *PostAPITeamsIDCustomersCustomerIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API teams ID customers customer ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITeamsIDCustomersCustomerIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API teams ID customers customer ID params +func (o *PostAPITeamsIDCustomersCustomerIDParams) WithTimeout(timeout time.Duration) *PostAPITeamsIDCustomersCustomerIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API teams ID customers customer ID params +func (o *PostAPITeamsIDCustomersCustomerIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API teams ID customers customer ID params +func (o *PostAPITeamsIDCustomersCustomerIDParams) WithContext(ctx context.Context) *PostAPITeamsIDCustomersCustomerIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API teams ID customers customer ID params +func (o *PostAPITeamsIDCustomersCustomerIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API teams ID customers customer ID params +func (o *PostAPITeamsIDCustomersCustomerIDParams) WithHTTPClient(client *http.Client) *PostAPITeamsIDCustomersCustomerIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API teams ID customers customer ID params +func (o *PostAPITeamsIDCustomersCustomerIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCustomerID adds the customerID to the post API teams ID customers customer ID params +func (o *PostAPITeamsIDCustomersCustomerIDParams) WithCustomerID(customerID int64) *PostAPITeamsIDCustomersCustomerIDParams { + o.SetCustomerID(customerID) + return o +} + +// SetCustomerID adds the customerId to the post API teams ID customers customer ID params +func (o *PostAPITeamsIDCustomersCustomerIDParams) SetCustomerID(customerID int64) { + o.CustomerID = customerID +} + +// WithID adds the id to the post API teams ID customers customer ID params +func (o *PostAPITeamsIDCustomersCustomerIDParams) WithID(id int64) *PostAPITeamsIDCustomersCustomerIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the post API teams ID customers customer ID params +func (o *PostAPITeamsIDCustomersCustomerIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPITeamsIDCustomersCustomerIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param customerId + if err := r.SetPathParam("customerId", swag.FormatInt64(o.CustomerID)); err != nil { + return err + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/team/post_api_teams_id_customers_customer_id_responses.go b/client/team/post_api_teams_id_customers_customer_id_responses.go new file mode 100644 index 0000000..74067f5 --- /dev/null +++ b/client/team/post_api_teams_id_customers_customer_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPITeamsIDCustomersCustomerIDReader is a Reader for the PostAPITeamsIDCustomersCustomerID structure. +type PostAPITeamsIDCustomersCustomerIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPITeamsIDCustomersCustomerIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPITeamsIDCustomersCustomerIDOK() + 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()) + } +} + +// NewPostAPITeamsIDCustomersCustomerIDOK creates a PostAPITeamsIDCustomersCustomerIDOK with default headers values +func NewPostAPITeamsIDCustomersCustomerIDOK() *PostAPITeamsIDCustomersCustomerIDOK { + return &PostAPITeamsIDCustomersCustomerIDOK{} +} + +/* +PostAPITeamsIDCustomersCustomerIDOK describes a response with status code 200, with default header values. + +Adds a new customer to a team. +*/ +type PostAPITeamsIDCustomersCustomerIDOK struct { + Payload *models.Team +} + +// IsSuccess returns true when this post Api teams Id customers customer Id o k response has a 2xx status code +func (o *PostAPITeamsIDCustomersCustomerIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api teams Id customers customer Id o k response has a 3xx status code +func (o *PostAPITeamsIDCustomersCustomerIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api teams Id customers customer Id o k response has a 4xx status code +func (o *PostAPITeamsIDCustomersCustomerIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api teams Id customers customer Id o k response has a 5xx status code +func (o *PostAPITeamsIDCustomersCustomerIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api teams Id customers customer Id o k response a status code equal to that given +func (o *PostAPITeamsIDCustomersCustomerIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPITeamsIDCustomersCustomerIDOK) Error() string { + return fmt.Sprintf("[POST /api/teams/{id}/customers/{customerId}][%d] postApiTeamsIdCustomersCustomerIdOK %+v", 200, o.Payload) +} + +func (o *PostAPITeamsIDCustomersCustomerIDOK) String() string { + return fmt.Sprintf("[POST /api/teams/{id}/customers/{customerId}][%d] postApiTeamsIdCustomersCustomerIdOK %+v", 200, o.Payload) +} + +func (o *PostAPITeamsIDCustomersCustomerIDOK) GetPayload() *models.Team { + return o.Payload +} + +func (o *PostAPITeamsIDCustomersCustomerIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Team) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/team/post_api_teams_id_members_user_id_parameters.go b/client/team/post_api_teams_id_members_user_id_parameters.go new file mode 100644 index 0000000..fa61b36 --- /dev/null +++ b/client/team/post_api_teams_id_members_user_id_parameters.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" +) + +// NewPostAPITeamsIDMembersUserIDParams creates a new PostAPITeamsIDMembersUserIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPITeamsIDMembersUserIDParams() *PostAPITeamsIDMembersUserIDParams { + return &PostAPITeamsIDMembersUserIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPITeamsIDMembersUserIDParamsWithTimeout creates a new PostAPITeamsIDMembersUserIDParams object +// with the ability to set a timeout on a request. +func NewPostAPITeamsIDMembersUserIDParamsWithTimeout(timeout time.Duration) *PostAPITeamsIDMembersUserIDParams { + return &PostAPITeamsIDMembersUserIDParams{ + timeout: timeout, + } +} + +// NewPostAPITeamsIDMembersUserIDParamsWithContext creates a new PostAPITeamsIDMembersUserIDParams object +// with the ability to set a context for a request. +func NewPostAPITeamsIDMembersUserIDParamsWithContext(ctx context.Context) *PostAPITeamsIDMembersUserIDParams { + return &PostAPITeamsIDMembersUserIDParams{ + Context: ctx, + } +} + +// NewPostAPITeamsIDMembersUserIDParamsWithHTTPClient creates a new PostAPITeamsIDMembersUserIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPITeamsIDMembersUserIDParamsWithHTTPClient(client *http.Client) *PostAPITeamsIDMembersUserIDParams { + return &PostAPITeamsIDMembersUserIDParams{ + HTTPClient: client, + } +} + +/* +PostAPITeamsIDMembersUserIDParams contains all the parameters to send to the API endpoint + + for the post API teams ID members user ID operation. + + Typically these are written to a http.Request. +*/ +type PostAPITeamsIDMembersUserIDParams struct { + + /* ID. + + The team which will receive the new member + */ + ID int64 + + /* UserID. + + The team member to add (User ID) + */ + UserID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API teams ID members user ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITeamsIDMembersUserIDParams) WithDefaults() *PostAPITeamsIDMembersUserIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API teams ID members user ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITeamsIDMembersUserIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API teams ID members user ID params +func (o *PostAPITeamsIDMembersUserIDParams) WithTimeout(timeout time.Duration) *PostAPITeamsIDMembersUserIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API teams ID members user ID params +func (o *PostAPITeamsIDMembersUserIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API teams ID members user ID params +func (o *PostAPITeamsIDMembersUserIDParams) WithContext(ctx context.Context) *PostAPITeamsIDMembersUserIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API teams ID members user ID params +func (o *PostAPITeamsIDMembersUserIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API teams ID members user ID params +func (o *PostAPITeamsIDMembersUserIDParams) WithHTTPClient(client *http.Client) *PostAPITeamsIDMembersUserIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API teams ID members user ID params +func (o *PostAPITeamsIDMembersUserIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the post API teams ID members user ID params +func (o *PostAPITeamsIDMembersUserIDParams) WithID(id int64) *PostAPITeamsIDMembersUserIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the post API teams ID members user ID params +func (o *PostAPITeamsIDMembersUserIDParams) SetID(id int64) { + o.ID = id +} + +// WithUserID adds the userID to the post API teams ID members user ID params +func (o *PostAPITeamsIDMembersUserIDParams) WithUserID(userID int64) *PostAPITeamsIDMembersUserIDParams { + o.SetUserID(userID) + return o +} + +// SetUserID adds the userId to the post API teams ID members user ID params +func (o *PostAPITeamsIDMembersUserIDParams) SetUserID(userID int64) { + o.UserID = userID +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPITeamsIDMembersUserIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + // path param userId + if err := r.SetPathParam("userId", swag.FormatInt64(o.UserID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/team/post_api_teams_id_members_user_id_responses.go b/client/team/post_api_teams_id_members_user_id_responses.go new file mode 100644 index 0000000..a413bfd --- /dev/null +++ b/client/team/post_api_teams_id_members_user_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPITeamsIDMembersUserIDReader is a Reader for the PostAPITeamsIDMembersUserID structure. +type PostAPITeamsIDMembersUserIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPITeamsIDMembersUserIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPITeamsIDMembersUserIDOK() + 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()) + } +} + +// NewPostAPITeamsIDMembersUserIDOK creates a PostAPITeamsIDMembersUserIDOK with default headers values +func NewPostAPITeamsIDMembersUserIDOK() *PostAPITeamsIDMembersUserIDOK { + return &PostAPITeamsIDMembersUserIDOK{} +} + +/* +PostAPITeamsIDMembersUserIDOK describes a response with status code 200, with default header values. + +Adds a new user to a team. +*/ +type PostAPITeamsIDMembersUserIDOK struct { + Payload *models.Team +} + +// IsSuccess returns true when this post Api teams Id members user Id o k response has a 2xx status code +func (o *PostAPITeamsIDMembersUserIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api teams Id members user Id o k response has a 3xx status code +func (o *PostAPITeamsIDMembersUserIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api teams Id members user Id o k response has a 4xx status code +func (o *PostAPITeamsIDMembersUserIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api teams Id members user Id o k response has a 5xx status code +func (o *PostAPITeamsIDMembersUserIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api teams Id members user Id o k response a status code equal to that given +func (o *PostAPITeamsIDMembersUserIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPITeamsIDMembersUserIDOK) Error() string { + return fmt.Sprintf("[POST /api/teams/{id}/members/{userId}][%d] postApiTeamsIdMembersUserIdOK %+v", 200, o.Payload) +} + +func (o *PostAPITeamsIDMembersUserIDOK) String() string { + return fmt.Sprintf("[POST /api/teams/{id}/members/{userId}][%d] postApiTeamsIdMembersUserIdOK %+v", 200, o.Payload) +} + +func (o *PostAPITeamsIDMembersUserIDOK) GetPayload() *models.Team { + return o.Payload +} + +func (o *PostAPITeamsIDMembersUserIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Team) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/team/post_api_teams_id_projects_project_id_parameters.go b/client/team/post_api_teams_id_projects_project_id_parameters.go new file mode 100644 index 0000000..0d191ec --- /dev/null +++ b/client/team/post_api_teams_id_projects_project_id_parameters.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" +) + +// NewPostAPITeamsIDProjectsProjectIDParams creates a new PostAPITeamsIDProjectsProjectIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPITeamsIDProjectsProjectIDParams() *PostAPITeamsIDProjectsProjectIDParams { + return &PostAPITeamsIDProjectsProjectIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPITeamsIDProjectsProjectIDParamsWithTimeout creates a new PostAPITeamsIDProjectsProjectIDParams object +// with the ability to set a timeout on a request. +func NewPostAPITeamsIDProjectsProjectIDParamsWithTimeout(timeout time.Duration) *PostAPITeamsIDProjectsProjectIDParams { + return &PostAPITeamsIDProjectsProjectIDParams{ + timeout: timeout, + } +} + +// NewPostAPITeamsIDProjectsProjectIDParamsWithContext creates a new PostAPITeamsIDProjectsProjectIDParams object +// with the ability to set a context for a request. +func NewPostAPITeamsIDProjectsProjectIDParamsWithContext(ctx context.Context) *PostAPITeamsIDProjectsProjectIDParams { + return &PostAPITeamsIDProjectsProjectIDParams{ + Context: ctx, + } +} + +// NewPostAPITeamsIDProjectsProjectIDParamsWithHTTPClient creates a new PostAPITeamsIDProjectsProjectIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPITeamsIDProjectsProjectIDParamsWithHTTPClient(client *http.Client) *PostAPITeamsIDProjectsProjectIDParams { + return &PostAPITeamsIDProjectsProjectIDParams{ + HTTPClient: client, + } +} + +/* +PostAPITeamsIDProjectsProjectIDParams contains all the parameters to send to the API endpoint + + for the post API teams ID projects project ID operation. + + Typically these are written to a http.Request. +*/ +type PostAPITeamsIDProjectsProjectIDParams struct { + + /* ID. + + The team that is granted access + */ + ID int64 + + /* ProjectID. + + The project to grant acecess to (Project ID) + */ + ProjectID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API teams ID projects project ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITeamsIDProjectsProjectIDParams) WithDefaults() *PostAPITeamsIDProjectsProjectIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API teams ID projects project ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITeamsIDProjectsProjectIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API teams ID projects project ID params +func (o *PostAPITeamsIDProjectsProjectIDParams) WithTimeout(timeout time.Duration) *PostAPITeamsIDProjectsProjectIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API teams ID projects project ID params +func (o *PostAPITeamsIDProjectsProjectIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API teams ID projects project ID params +func (o *PostAPITeamsIDProjectsProjectIDParams) WithContext(ctx context.Context) *PostAPITeamsIDProjectsProjectIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API teams ID projects project ID params +func (o *PostAPITeamsIDProjectsProjectIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API teams ID projects project ID params +func (o *PostAPITeamsIDProjectsProjectIDParams) WithHTTPClient(client *http.Client) *PostAPITeamsIDProjectsProjectIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API teams ID projects project ID params +func (o *PostAPITeamsIDProjectsProjectIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the post API teams ID projects project ID params +func (o *PostAPITeamsIDProjectsProjectIDParams) WithID(id int64) *PostAPITeamsIDProjectsProjectIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the post API teams ID projects project ID params +func (o *PostAPITeamsIDProjectsProjectIDParams) SetID(id int64) { + o.ID = id +} + +// WithProjectID adds the projectID to the post API teams ID projects project ID params +func (o *PostAPITeamsIDProjectsProjectIDParams) WithProjectID(projectID int64) *PostAPITeamsIDProjectsProjectIDParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the post API teams ID projects project ID params +func (o *PostAPITeamsIDProjectsProjectIDParams) SetProjectID(projectID int64) { + o.ProjectID = projectID +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPITeamsIDProjectsProjectIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + // path param projectId + if err := r.SetPathParam("projectId", swag.FormatInt64(o.ProjectID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/team/post_api_teams_id_projects_project_id_responses.go b/client/team/post_api_teams_id_projects_project_id_responses.go new file mode 100644 index 0000000..6eaf2bc --- /dev/null +++ b/client/team/post_api_teams_id_projects_project_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPITeamsIDProjectsProjectIDReader is a Reader for the PostAPITeamsIDProjectsProjectID structure. +type PostAPITeamsIDProjectsProjectIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPITeamsIDProjectsProjectIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPITeamsIDProjectsProjectIDOK() + 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()) + } +} + +// NewPostAPITeamsIDProjectsProjectIDOK creates a PostAPITeamsIDProjectsProjectIDOK with default headers values +func NewPostAPITeamsIDProjectsProjectIDOK() *PostAPITeamsIDProjectsProjectIDOK { + return &PostAPITeamsIDProjectsProjectIDOK{} +} + +/* +PostAPITeamsIDProjectsProjectIDOK describes a response with status code 200, with default header values. + +Adds a new project to a team. +*/ +type PostAPITeamsIDProjectsProjectIDOK struct { + Payload *models.Team +} + +// IsSuccess returns true when this post Api teams Id projects project Id o k response has a 2xx status code +func (o *PostAPITeamsIDProjectsProjectIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api teams Id projects project Id o k response has a 3xx status code +func (o *PostAPITeamsIDProjectsProjectIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api teams Id projects project Id o k response has a 4xx status code +func (o *PostAPITeamsIDProjectsProjectIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api teams Id projects project Id o k response has a 5xx status code +func (o *PostAPITeamsIDProjectsProjectIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api teams Id projects project Id o k response a status code equal to that given +func (o *PostAPITeamsIDProjectsProjectIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPITeamsIDProjectsProjectIDOK) Error() string { + return fmt.Sprintf("[POST /api/teams/{id}/projects/{projectId}][%d] postApiTeamsIdProjectsProjectIdOK %+v", 200, o.Payload) +} + +func (o *PostAPITeamsIDProjectsProjectIDOK) String() string { + return fmt.Sprintf("[POST /api/teams/{id}/projects/{projectId}][%d] postApiTeamsIdProjectsProjectIdOK %+v", 200, o.Payload) +} + +func (o *PostAPITeamsIDProjectsProjectIDOK) GetPayload() *models.Team { + return o.Payload +} + +func (o *PostAPITeamsIDProjectsProjectIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Team) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/team/post_api_teams_parameters.go b/client/team/post_api_teams_parameters.go new file mode 100644 index 0000000..138fe82 --- /dev/null +++ b/client/team/post_api_teams_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPostAPITeamsParams creates a new PostAPITeamsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPITeamsParams() *PostAPITeamsParams { + return &PostAPITeamsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPITeamsParamsWithTimeout creates a new PostAPITeamsParams object +// with the ability to set a timeout on a request. +func NewPostAPITeamsParamsWithTimeout(timeout time.Duration) *PostAPITeamsParams { + return &PostAPITeamsParams{ + timeout: timeout, + } +} + +// NewPostAPITeamsParamsWithContext creates a new PostAPITeamsParams object +// with the ability to set a context for a request. +func NewPostAPITeamsParamsWithContext(ctx context.Context) *PostAPITeamsParams { + return &PostAPITeamsParams{ + Context: ctx, + } +} + +// NewPostAPITeamsParamsWithHTTPClient creates a new PostAPITeamsParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPITeamsParamsWithHTTPClient(client *http.Client) *PostAPITeamsParams { + return &PostAPITeamsParams{ + HTTPClient: client, + } +} + +/* +PostAPITeamsParams contains all the parameters to send to the API endpoint + + for the post API teams operation. + + Typically these are written to a http.Request. +*/ +type PostAPITeamsParams struct { + + // Body. + Body *models.TeamEditForm + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API teams params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITeamsParams) WithDefaults() *PostAPITeamsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API teams params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITeamsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API teams params +func (o *PostAPITeamsParams) WithTimeout(timeout time.Duration) *PostAPITeamsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API teams params +func (o *PostAPITeamsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API teams params +func (o *PostAPITeamsParams) WithContext(ctx context.Context) *PostAPITeamsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API teams params +func (o *PostAPITeamsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API teams params +func (o *PostAPITeamsParams) WithHTTPClient(client *http.Client) *PostAPITeamsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API teams params +func (o *PostAPITeamsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API teams params +func (o *PostAPITeamsParams) WithBody(body *models.TeamEditForm) *PostAPITeamsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API teams params +func (o *PostAPITeamsParams) SetBody(body *models.TeamEditForm) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPITeamsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/team/post_api_teams_responses.go b/client/team/post_api_teams_responses.go new file mode 100644 index 0000000..ed0f694 --- /dev/null +++ b/client/team/post_api_teams_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPITeamsReader is a Reader for the PostAPITeams structure. +type PostAPITeamsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPITeamsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPITeamsOK() + 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()) + } +} + +// NewPostAPITeamsOK creates a PostAPITeamsOK with default headers values +func NewPostAPITeamsOK() *PostAPITeamsOK { + return &PostAPITeamsOK{} +} + +/* +PostAPITeamsOK describes a response with status code 200, with default header values. + +Returns the new created team +*/ +type PostAPITeamsOK struct { + Payload *models.Team +} + +// IsSuccess returns true when this post Api teams o k response has a 2xx status code +func (o *PostAPITeamsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api teams o k response has a 3xx status code +func (o *PostAPITeamsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api teams o k response has a 4xx status code +func (o *PostAPITeamsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api teams o k response has a 5xx status code +func (o *PostAPITeamsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api teams o k response a status code equal to that given +func (o *PostAPITeamsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPITeamsOK) Error() string { + return fmt.Sprintf("[POST /api/teams][%d] postApiTeamsOK %+v", 200, o.Payload) +} + +func (o *PostAPITeamsOK) String() string { + return fmt.Sprintf("[POST /api/teams][%d] postApiTeamsOK %+v", 200, o.Payload) +} + +func (o *PostAPITeamsOK) GetPayload() *models.Team { + return o.Payload +} + +func (o *PostAPITeamsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Team) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/team/team_client.go b/client/team/team_client.go new file mode 100644 index 0000000..d0bc817 --- /dev/null +++ b/client/team/team_client.go @@ -0,0 +1,576 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package team + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new team API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for team API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPITeamsID(params *DeleteAPITeamsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITeamsIDNoContent, error) + + DeleteAPITeamsIDActivitiesActivityID(params *DeleteAPITeamsIDActivitiesActivityIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITeamsIDActivitiesActivityIDOK, error) + + DeleteAPITeamsIDCustomersCustomerID(params *DeleteAPITeamsIDCustomersCustomerIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITeamsIDCustomersCustomerIDOK, error) + + DeleteAPITeamsIDMembersUserID(params *DeleteAPITeamsIDMembersUserIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITeamsIDMembersUserIDOK, error) + + DeleteAPITeamsIDProjectsProjectID(params *DeleteAPITeamsIDProjectsProjectIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITeamsIDProjectsProjectIDOK, error) + + GetAPITeams(params *GetAPITeamsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITeamsOK, error) + + GetAPITeamsID(params *GetAPITeamsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITeamsIDOK, error) + + PatchAPITeamsID(params *PatchAPITeamsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITeamsIDOK, error) + + PostAPITeams(params *PostAPITeamsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITeamsOK, error) + + PostAPITeamsIDActivitiesActivityID(params *PostAPITeamsIDActivitiesActivityIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITeamsIDActivitiesActivityIDOK, error) + + PostAPITeamsIDCustomersCustomerID(params *PostAPITeamsIDCustomersCustomerIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITeamsIDCustomersCustomerIDOK, error) + + PostAPITeamsIDMembersUserID(params *PostAPITeamsIDMembersUserIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITeamsIDMembersUserIDOK, error) + + PostAPITeamsIDProjectsProjectID(params *PostAPITeamsIDProjectsProjectIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITeamsIDProjectsProjectIDOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPITeamsID deletes a team +*/ +func (a *Client) DeleteAPITeamsID(params *DeleteAPITeamsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITeamsIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPITeamsIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPITeamsID", + Method: "DELETE", + PathPattern: "/api/teams/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPITeamsIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPITeamsIDNoContent) + 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 DeleteAPITeamsID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DeleteAPITeamsIDActivitiesActivityID revokes access for an activity from a team +*/ +func (a *Client) DeleteAPITeamsIDActivitiesActivityID(params *DeleteAPITeamsIDActivitiesActivityIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITeamsIDActivitiesActivityIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPITeamsIDActivitiesActivityIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPITeamsIDActivitiesActivityID", + Method: "DELETE", + PathPattern: "/api/teams/{id}/activities/{activityId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPITeamsIDActivitiesActivityIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPITeamsIDActivitiesActivityIDOK) + 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 DeleteAPITeamsIDActivitiesActivityID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DeleteAPITeamsIDCustomersCustomerID revokes access for a customer from a team +*/ +func (a *Client) DeleteAPITeamsIDCustomersCustomerID(params *DeleteAPITeamsIDCustomersCustomerIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITeamsIDCustomersCustomerIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPITeamsIDCustomersCustomerIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPITeamsIDCustomersCustomerID", + Method: "DELETE", + PathPattern: "/api/teams/{id}/customers/{customerId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPITeamsIDCustomersCustomerIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPITeamsIDCustomersCustomerIDOK) + 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 DeleteAPITeamsIDCustomersCustomerID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DeleteAPITeamsIDMembersUserID removes a member from the team +*/ +func (a *Client) DeleteAPITeamsIDMembersUserID(params *DeleteAPITeamsIDMembersUserIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITeamsIDMembersUserIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPITeamsIDMembersUserIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPITeamsIDMembersUserID", + Method: "DELETE", + PathPattern: "/api/teams/{id}/members/{userId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPITeamsIDMembersUserIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPITeamsIDMembersUserIDOK) + 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 DeleteAPITeamsIDMembersUserID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DeleteAPITeamsIDProjectsProjectID revokes access for a project from a team +*/ +func (a *Client) DeleteAPITeamsIDProjectsProjectID(params *DeleteAPITeamsIDProjectsProjectIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITeamsIDProjectsProjectIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPITeamsIDProjectsProjectIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPITeamsIDProjectsProjectID", + Method: "DELETE", + PathPattern: "/api/teams/{id}/projects/{projectId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPITeamsIDProjectsProjectIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPITeamsIDProjectsProjectIDOK) + 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 DeleteAPITeamsIDProjectsProjectID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPITeams fetches all existing teams +*/ +func (a *Client) GetAPITeams(params *GetAPITeamsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITeamsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPITeamsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPITeams", + Method: "GET", + PathPattern: "/api/teams", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPITeamsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPITeamsOK) + 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 GetAPITeams: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPITeamsID returns one team +*/ +func (a *Client) GetAPITeamsID(params *GetAPITeamsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITeamsIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPITeamsIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPITeamsID", + Method: "GET", + PathPattern: "/api/teams/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPITeamsIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPITeamsIDOK) + 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 GetAPITeamsID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITeamsID updates an existing team + +Update an existing team, you can pass all or just a subset of all attributes (passing members will replace all existing ones) +*/ +func (a *Client) PatchAPITeamsID(params *PatchAPITeamsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITeamsIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITeamsIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITeamsID", + Method: "PATCH", + PathPattern: "/api/teams/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITeamsIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITeamsIDOK) + 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 PatchAPITeamsID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPITeams creates a new team + +Creates a new team and returns it afterwards +*/ +func (a *Client) PostAPITeams(params *PostAPITeamsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITeamsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPITeamsParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPITeams", + Method: "POST", + PathPattern: "/api/teams", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPITeamsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPITeamsOK) + 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 PostAPITeams: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPITeamsIDActivitiesActivityID grants the team access to an activity +*/ +func (a *Client) PostAPITeamsIDActivitiesActivityID(params *PostAPITeamsIDActivitiesActivityIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITeamsIDActivitiesActivityIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPITeamsIDActivitiesActivityIDParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPITeamsIDActivitiesActivityID", + Method: "POST", + PathPattern: "/api/teams/{id}/activities/{activityId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPITeamsIDActivitiesActivityIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPITeamsIDActivitiesActivityIDOK) + 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 PostAPITeamsIDActivitiesActivityID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPITeamsIDCustomersCustomerID grants the team access to a customer +*/ +func (a *Client) PostAPITeamsIDCustomersCustomerID(params *PostAPITeamsIDCustomersCustomerIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITeamsIDCustomersCustomerIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPITeamsIDCustomersCustomerIDParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPITeamsIDCustomersCustomerID", + Method: "POST", + PathPattern: "/api/teams/{id}/customers/{customerId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPITeamsIDCustomersCustomerIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPITeamsIDCustomersCustomerIDOK) + 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 PostAPITeamsIDCustomersCustomerID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPITeamsIDMembersUserID adds a new member to a team +*/ +func (a *Client) PostAPITeamsIDMembersUserID(params *PostAPITeamsIDMembersUserIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITeamsIDMembersUserIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPITeamsIDMembersUserIDParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPITeamsIDMembersUserID", + Method: "POST", + PathPattern: "/api/teams/{id}/members/{userId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPITeamsIDMembersUserIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPITeamsIDMembersUserIDOK) + 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 PostAPITeamsIDMembersUserID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPITeamsIDProjectsProjectID grants the team access to a project +*/ +func (a *Client) PostAPITeamsIDProjectsProjectID(params *PostAPITeamsIDProjectsProjectIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITeamsIDProjectsProjectIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPITeamsIDProjectsProjectIDParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPITeamsIDProjectsProjectID", + Method: "POST", + PathPattern: "/api/teams/{id}/projects/{projectId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPITeamsIDProjectsProjectIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPITeamsIDProjectsProjectIDOK) + 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 PostAPITeamsIDProjectsProjectID: 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/timesheet/delete_api_timesheets_id_parameters.go b/client/timesheet/delete_api_timesheets_id_parameters.go new file mode 100644 index 0000000..024d64f --- /dev/null +++ b/client/timesheet/delete_api_timesheets_id_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" +) + +// NewDeleteAPITimesheetsIDParams creates a new DeleteAPITimesheetsIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteAPITimesheetsIDParams() *DeleteAPITimesheetsIDParams { + return &DeleteAPITimesheetsIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAPITimesheetsIDParamsWithTimeout creates a new DeleteAPITimesheetsIDParams object +// with the ability to set a timeout on a request. +func NewDeleteAPITimesheetsIDParamsWithTimeout(timeout time.Duration) *DeleteAPITimesheetsIDParams { + return &DeleteAPITimesheetsIDParams{ + timeout: timeout, + } +} + +// NewDeleteAPITimesheetsIDParamsWithContext creates a new DeleteAPITimesheetsIDParams object +// with the ability to set a context for a request. +func NewDeleteAPITimesheetsIDParamsWithContext(ctx context.Context) *DeleteAPITimesheetsIDParams { + return &DeleteAPITimesheetsIDParams{ + Context: ctx, + } +} + +// NewDeleteAPITimesheetsIDParamsWithHTTPClient creates a new DeleteAPITimesheetsIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteAPITimesheetsIDParamsWithHTTPClient(client *http.Client) *DeleteAPITimesheetsIDParams { + return &DeleteAPITimesheetsIDParams{ + HTTPClient: client, + } +} + +/* +DeleteAPITimesheetsIDParams contains all the parameters to send to the API endpoint + + for the delete API timesheets ID operation. + + Typically these are written to a http.Request. +*/ +type DeleteAPITimesheetsIDParams struct { + + /* ID. + + Timesheet record ID to delete + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete API timesheets ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITimesheetsIDParams) WithDefaults() *DeleteAPITimesheetsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete API timesheets ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteAPITimesheetsIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete API timesheets ID params +func (o *DeleteAPITimesheetsIDParams) WithTimeout(timeout time.Duration) *DeleteAPITimesheetsIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete API timesheets ID params +func (o *DeleteAPITimesheetsIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete API timesheets ID params +func (o *DeleteAPITimesheetsIDParams) WithContext(ctx context.Context) *DeleteAPITimesheetsIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete API timesheets ID params +func (o *DeleteAPITimesheetsIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete API timesheets ID params +func (o *DeleteAPITimesheetsIDParams) WithHTTPClient(client *http.Client) *DeleteAPITimesheetsIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete API timesheets ID params +func (o *DeleteAPITimesheetsIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete API timesheets ID params +func (o *DeleteAPITimesheetsIDParams) WithID(id int64) *DeleteAPITimesheetsIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete API timesheets ID params +func (o *DeleteAPITimesheetsIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAPITimesheetsIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/timesheet/delete_api_timesheets_id_responses.go b/client/timesheet/delete_api_timesheets_id_responses.go new file mode 100644 index 0000000..54e55ce --- /dev/null +++ b/client/timesheet/delete_api_timesheets_id_responses.go @@ -0,0 +1,83 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// DeleteAPITimesheetsIDReader is a Reader for the DeleteAPITimesheetsID structure. +type DeleteAPITimesheetsIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAPITimesheetsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 204: + result := NewDeleteAPITimesheetsIDNoContent() + 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()) + } +} + +// NewDeleteAPITimesheetsIDNoContent creates a DeleteAPITimesheetsIDNoContent with default headers values +func NewDeleteAPITimesheetsIDNoContent() *DeleteAPITimesheetsIDNoContent { + return &DeleteAPITimesheetsIDNoContent{} +} + +/* +DeleteAPITimesheetsIDNoContent describes a response with status code 204, with default header values. + +Delete one timesheet record +*/ +type DeleteAPITimesheetsIDNoContent struct { +} + +// IsSuccess returns true when this delete Api timesheets Id no content response has a 2xx status code +func (o *DeleteAPITimesheetsIDNoContent) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete Api timesheets Id no content response has a 3xx status code +func (o *DeleteAPITimesheetsIDNoContent) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete Api timesheets Id no content response has a 4xx status code +func (o *DeleteAPITimesheetsIDNoContent) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete Api timesheets Id no content response has a 5xx status code +func (o *DeleteAPITimesheetsIDNoContent) IsServerError() bool { + return false +} + +// IsCode returns true when this delete Api timesheets Id no content response a status code equal to that given +func (o *DeleteAPITimesheetsIDNoContent) IsCode(code int) bool { + return code == 204 +} + +func (o *DeleteAPITimesheetsIDNoContent) Error() string { + return fmt.Sprintf("[DELETE /api/timesheets/{id}][%d] deleteApiTimesheetsIdNoContent ", 204) +} + +func (o *DeleteAPITimesheetsIDNoContent) String() string { + return fmt.Sprintf("[DELETE /api/timesheets/{id}][%d] deleteApiTimesheetsIdNoContent ", 204) +} + +func (o *DeleteAPITimesheetsIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/timesheet/get_api_timesheets_active_parameters.go b/client/timesheet/get_api_timesheets_active_parameters.go new file mode 100644 index 0000000..7b9b87d --- /dev/null +++ b/client/timesheet/get_api_timesheets_active_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" +) + +// NewGetAPITimesheetsActiveParams creates a new GetAPITimesheetsActiveParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPITimesheetsActiveParams() *GetAPITimesheetsActiveParams { + return &GetAPITimesheetsActiveParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPITimesheetsActiveParamsWithTimeout creates a new GetAPITimesheetsActiveParams object +// with the ability to set a timeout on a request. +func NewGetAPITimesheetsActiveParamsWithTimeout(timeout time.Duration) *GetAPITimesheetsActiveParams { + return &GetAPITimesheetsActiveParams{ + timeout: timeout, + } +} + +// NewGetAPITimesheetsActiveParamsWithContext creates a new GetAPITimesheetsActiveParams object +// with the ability to set a context for a request. +func NewGetAPITimesheetsActiveParamsWithContext(ctx context.Context) *GetAPITimesheetsActiveParams { + return &GetAPITimesheetsActiveParams{ + Context: ctx, + } +} + +// NewGetAPITimesheetsActiveParamsWithHTTPClient creates a new GetAPITimesheetsActiveParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPITimesheetsActiveParamsWithHTTPClient(client *http.Client) *GetAPITimesheetsActiveParams { + return &GetAPITimesheetsActiveParams{ + HTTPClient: client, + } +} + +/* +GetAPITimesheetsActiveParams contains all the parameters to send to the API endpoint + + for the get API timesheets active operation. + + Typically these are written to a http.Request. +*/ +type GetAPITimesheetsActiveParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API timesheets active params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITimesheetsActiveParams) WithDefaults() *GetAPITimesheetsActiveParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API timesheets active params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITimesheetsActiveParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API timesheets active params +func (o *GetAPITimesheetsActiveParams) WithTimeout(timeout time.Duration) *GetAPITimesheetsActiveParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API timesheets active params +func (o *GetAPITimesheetsActiveParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API timesheets active params +func (o *GetAPITimesheetsActiveParams) WithContext(ctx context.Context) *GetAPITimesheetsActiveParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API timesheets active params +func (o *GetAPITimesheetsActiveParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API timesheets active params +func (o *GetAPITimesheetsActiveParams) WithHTTPClient(client *http.Client) *GetAPITimesheetsActiveParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API timesheets active params +func (o *GetAPITimesheetsActiveParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPITimesheetsActiveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/timesheet/get_api_timesheets_active_responses.go b/client/timesheet/get_api_timesheets_active_responses.go new file mode 100644 index 0000000..2cc5749 --- /dev/null +++ b/client/timesheet/get_api_timesheets_active_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPITimesheetsActiveReader is a Reader for the GetAPITimesheetsActive structure. +type GetAPITimesheetsActiveReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPITimesheetsActiveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPITimesheetsActiveOK() + 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()) + } +} + +// NewGetAPITimesheetsActiveOK creates a GetAPITimesheetsActiveOK with default headers values +func NewGetAPITimesheetsActiveOK() *GetAPITimesheetsActiveOK { + return &GetAPITimesheetsActiveOK{} +} + +/* +GetAPITimesheetsActiveOK describes a response with status code 200, with default header values. + +Returns the collection of active timesheet records for the current user +*/ +type GetAPITimesheetsActiveOK struct { + Payload []*models.TimesheetCollectionExpanded +} + +// IsSuccess returns true when this get Api timesheets active o k response has a 2xx status code +func (o *GetAPITimesheetsActiveOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api timesheets active o k response has a 3xx status code +func (o *GetAPITimesheetsActiveOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api timesheets active o k response has a 4xx status code +func (o *GetAPITimesheetsActiveOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api timesheets active o k response has a 5xx status code +func (o *GetAPITimesheetsActiveOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api timesheets active o k response a status code equal to that given +func (o *GetAPITimesheetsActiveOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPITimesheetsActiveOK) Error() string { + return fmt.Sprintf("[GET /api/timesheets/active][%d] getApiTimesheetsActiveOK %+v", 200, o.Payload) +} + +func (o *GetAPITimesheetsActiveOK) String() string { + return fmt.Sprintf("[GET /api/timesheets/active][%d] getApiTimesheetsActiveOK %+v", 200, o.Payload) +} + +func (o *GetAPITimesheetsActiveOK) GetPayload() []*models.TimesheetCollectionExpanded { + return o.Payload +} + +func (o *GetAPITimesheetsActiveOK) 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/timesheet/get_api_timesheets_id_parameters.go b/client/timesheet/get_api_timesheets_id_parameters.go new file mode 100644 index 0000000..5686cef --- /dev/null +++ b/client/timesheet/get_api_timesheets_id_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" +) + +// NewGetAPITimesheetsIDParams creates a new GetAPITimesheetsIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPITimesheetsIDParams() *GetAPITimesheetsIDParams { + return &GetAPITimesheetsIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPITimesheetsIDParamsWithTimeout creates a new GetAPITimesheetsIDParams object +// with the ability to set a timeout on a request. +func NewGetAPITimesheetsIDParamsWithTimeout(timeout time.Duration) *GetAPITimesheetsIDParams { + return &GetAPITimesheetsIDParams{ + timeout: timeout, + } +} + +// NewGetAPITimesheetsIDParamsWithContext creates a new GetAPITimesheetsIDParams object +// with the ability to set a context for a request. +func NewGetAPITimesheetsIDParamsWithContext(ctx context.Context) *GetAPITimesheetsIDParams { + return &GetAPITimesheetsIDParams{ + Context: ctx, + } +} + +// NewGetAPITimesheetsIDParamsWithHTTPClient creates a new GetAPITimesheetsIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPITimesheetsIDParamsWithHTTPClient(client *http.Client) *GetAPITimesheetsIDParams { + return &GetAPITimesheetsIDParams{ + HTTPClient: client, + } +} + +/* +GetAPITimesheetsIDParams contains all the parameters to send to the API endpoint + + for the get API timesheets ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPITimesheetsIDParams struct { + + /* ID. + + Timesheet record ID to fetch + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API timesheets ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITimesheetsIDParams) WithDefaults() *GetAPITimesheetsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API timesheets ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITimesheetsIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API timesheets ID params +func (o *GetAPITimesheetsIDParams) WithTimeout(timeout time.Duration) *GetAPITimesheetsIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API timesheets ID params +func (o *GetAPITimesheetsIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API timesheets ID params +func (o *GetAPITimesheetsIDParams) WithContext(ctx context.Context) *GetAPITimesheetsIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API timesheets ID params +func (o *GetAPITimesheetsIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API timesheets ID params +func (o *GetAPITimesheetsIDParams) WithHTTPClient(client *http.Client) *GetAPITimesheetsIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API timesheets ID params +func (o *GetAPITimesheetsIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get API timesheets ID params +func (o *GetAPITimesheetsIDParams) WithID(id int64) *GetAPITimesheetsIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API timesheets ID params +func (o *GetAPITimesheetsIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPITimesheetsIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/timesheet/get_api_timesheets_id_responses.go b/client/timesheet/get_api_timesheets_id_responses.go new file mode 100644 index 0000000..7b5906b --- /dev/null +++ b/client/timesheet/get_api_timesheets_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPITimesheetsIDReader is a Reader for the GetAPITimesheetsID structure. +type GetAPITimesheetsIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPITimesheetsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPITimesheetsIDOK() + 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()) + } +} + +// NewGetAPITimesheetsIDOK creates a GetAPITimesheetsIDOK with default headers values +func NewGetAPITimesheetsIDOK() *GetAPITimesheetsIDOK { + return &GetAPITimesheetsIDOK{} +} + +/* +GetAPITimesheetsIDOK describes a response with status code 200, with default header values. + +Returns one timesheet record. Be aware that the datetime fields are given in the users local time including the timezone offset via ISO 8601. +*/ +type GetAPITimesheetsIDOK struct { + Payload *models.TimesheetEntity +} + +// IsSuccess returns true when this get Api timesheets Id o k response has a 2xx status code +func (o *GetAPITimesheetsIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api timesheets Id o k response has a 3xx status code +func (o *GetAPITimesheetsIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api timesheets Id o k response has a 4xx status code +func (o *GetAPITimesheetsIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api timesheets Id o k response has a 5xx status code +func (o *GetAPITimesheetsIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api timesheets Id o k response a status code equal to that given +func (o *GetAPITimesheetsIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPITimesheetsIDOK) Error() string { + return fmt.Sprintf("[GET /api/timesheets/{id}][%d] getApiTimesheetsIdOK %+v", 200, o.Payload) +} + +func (o *GetAPITimesheetsIDOK) String() string { + return fmt.Sprintf("[GET /api/timesheets/{id}][%d] getApiTimesheetsIdOK %+v", 200, o.Payload) +} + +func (o *GetAPITimesheetsIDOK) GetPayload() *models.TimesheetEntity { + return o.Payload +} + +func (o *GetAPITimesheetsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TimesheetEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/timesheet/get_api_timesheets_parameters.go b/client/timesheet/get_api_timesheets_parameters.go new file mode 100644 index 0000000..a89c41e --- /dev/null +++ b/client/timesheet/get_api_timesheets_parameters.go @@ -0,0 +1,644 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" +) + +// NewGetAPITimesheetsParams creates a new GetAPITimesheetsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPITimesheetsParams() *GetAPITimesheetsParams { + return &GetAPITimesheetsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPITimesheetsParamsWithTimeout creates a new GetAPITimesheetsParams object +// with the ability to set a timeout on a request. +func NewGetAPITimesheetsParamsWithTimeout(timeout time.Duration) *GetAPITimesheetsParams { + return &GetAPITimesheetsParams{ + timeout: timeout, + } +} + +// NewGetAPITimesheetsParamsWithContext creates a new GetAPITimesheetsParams object +// with the ability to set a context for a request. +func NewGetAPITimesheetsParamsWithContext(ctx context.Context) *GetAPITimesheetsParams { + return &GetAPITimesheetsParams{ + Context: ctx, + } +} + +// NewGetAPITimesheetsParamsWithHTTPClient creates a new GetAPITimesheetsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPITimesheetsParamsWithHTTPClient(client *http.Client) *GetAPITimesheetsParams { + return &GetAPITimesheetsParams{ + HTTPClient: client, + } +} + +/* +GetAPITimesheetsParams contains all the parameters to send to the API endpoint + + for the get API timesheets operation. + + Typically these are written to a http.Request. +*/ +type GetAPITimesheetsParams struct { + + /* Active. + + Filter for running/active records. Allowed values: 0=stopped, 1=active (default: all) + */ + Active string + + /* Activities. + + Comma separated list of activity IDs to filter timesheets + */ + Activities string + + /* Activity. + + DEPRECATED: Activity ID to filter timesheets (will be removed with 2.0) + */ + Activity string + + /* Begin. + + Only records after this date will be included (format: HTML5) + + Format: DateTime + */ + Begin string + + /* Billable. + + Filter for non-/billable records. Allowed values: 0=non-billable, 1=billable (default: all) + */ + Billable string + + /* Customer. + + DEPRECATED: Customer ID to filter timesheets (will be removed with 2.0) + */ + Customer string + + /* Customers. + + Comma separated list of customer IDs to filter timesheets + */ + Customers string + + /* End. + + Only records before this date will be included (format: HTML5) + + Format: DateTime + */ + End string + + /* Exported. + + Use this flag if you want to filter for export state. Allowed values: 0=not exported, 1=exported (default: all) + */ + Exported string + + /* Full. + + Allows to fetch fully serialized objects including subresources. Allowed values: true (default: false) + */ + Full string + + /* ModifiedAfter. + + Only records changed after this date will be included (format: HTML5). Available since Kimai 1.10 and works only for records that were created/updated since then. + + Format: DateTime + */ + ModifiedAfter string + + /* Order. + + The result order. Allowed values: ASC, DESC (default: DESC) + */ + Order string + + /* OrderBy. + + The field by which results will be ordered. Allowed values: id, begin, end, rate (default: begin) + */ + OrderBy string + + /* Page. + + The page to display, renders a 404 if not found (default: 1) + */ + Page string + + /* Project. + + DEPRECATED: Project ID to filter timesheets (will be removed with 2.0) + */ + Project string + + /* Projects. + + Comma separated list of project IDs to filter timesheets + */ + Projects string + + /* Size. + + The amount of entries for each page (default: 50) + */ + Size string + + /* Tags. + + Comma separated list of tag names + */ + Tags string + + /* Term. + + Free search term + */ + Term *string + + /* User. + + User ID to filter timesheets. Needs permission 'view_other_timesheet', pass 'all' to fetch data for all user (default: current user) + */ + User string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API timesheets params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITimesheetsParams) WithDefaults() *GetAPITimesheetsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API timesheets params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITimesheetsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API timesheets params +func (o *GetAPITimesheetsParams) WithTimeout(timeout time.Duration) *GetAPITimesheetsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API timesheets params +func (o *GetAPITimesheetsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API timesheets params +func (o *GetAPITimesheetsParams) WithContext(ctx context.Context) *GetAPITimesheetsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API timesheets params +func (o *GetAPITimesheetsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API timesheets params +func (o *GetAPITimesheetsParams) WithHTTPClient(client *http.Client) *GetAPITimesheetsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API timesheets params +func (o *GetAPITimesheetsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithActive adds the active to the get API timesheets params +func (o *GetAPITimesheetsParams) WithActive(active string) *GetAPITimesheetsParams { + o.SetActive(active) + return o +} + +// SetActive adds the active to the get API timesheets params +func (o *GetAPITimesheetsParams) SetActive(active string) { + o.Active = active +} + +// WithActivities adds the activities to the get API timesheets params +func (o *GetAPITimesheetsParams) WithActivities(activities string) *GetAPITimesheetsParams { + o.SetActivities(activities) + return o +} + +// SetActivities adds the activities to the get API timesheets params +func (o *GetAPITimesheetsParams) SetActivities(activities string) { + o.Activities = activities +} + +// WithActivity adds the activity to the get API timesheets params +func (o *GetAPITimesheetsParams) WithActivity(activity string) *GetAPITimesheetsParams { + o.SetActivity(activity) + return o +} + +// SetActivity adds the activity to the get API timesheets params +func (o *GetAPITimesheetsParams) SetActivity(activity string) { + o.Activity = activity +} + +// WithBegin adds the begin to the get API timesheets params +func (o *GetAPITimesheetsParams) WithBegin(begin string) *GetAPITimesheetsParams { + o.SetBegin(begin) + return o +} + +// SetBegin adds the begin to the get API timesheets params +func (o *GetAPITimesheetsParams) SetBegin(begin string) { + o.Begin = begin +} + +// WithBillable adds the billable to the get API timesheets params +func (o *GetAPITimesheetsParams) WithBillable(billable string) *GetAPITimesheetsParams { + o.SetBillable(billable) + return o +} + +// SetBillable adds the billable to the get API timesheets params +func (o *GetAPITimesheetsParams) SetBillable(billable string) { + o.Billable = billable +} + +// WithCustomer adds the customer to the get API timesheets params +func (o *GetAPITimesheetsParams) WithCustomer(customer string) *GetAPITimesheetsParams { + o.SetCustomer(customer) + return o +} + +// SetCustomer adds the customer to the get API timesheets params +func (o *GetAPITimesheetsParams) SetCustomer(customer string) { + o.Customer = customer +} + +// WithCustomers adds the customers to the get API timesheets params +func (o *GetAPITimesheetsParams) WithCustomers(customers string) *GetAPITimesheetsParams { + o.SetCustomers(customers) + return o +} + +// SetCustomers adds the customers to the get API timesheets params +func (o *GetAPITimesheetsParams) SetCustomers(customers string) { + o.Customers = customers +} + +// WithEnd adds the end to the get API timesheets params +func (o *GetAPITimesheetsParams) WithEnd(end string) *GetAPITimesheetsParams { + o.SetEnd(end) + return o +} + +// SetEnd adds the end to the get API timesheets params +func (o *GetAPITimesheetsParams) SetEnd(end string) { + o.End = end +} + +// WithExported adds the exported to the get API timesheets params +func (o *GetAPITimesheetsParams) WithExported(exported string) *GetAPITimesheetsParams { + o.SetExported(exported) + return o +} + +// SetExported adds the exported to the get API timesheets params +func (o *GetAPITimesheetsParams) SetExported(exported string) { + o.Exported = exported +} + +// WithFull adds the full to the get API timesheets params +func (o *GetAPITimesheetsParams) WithFull(full string) *GetAPITimesheetsParams { + o.SetFull(full) + return o +} + +// SetFull adds the full to the get API timesheets params +func (o *GetAPITimesheetsParams) SetFull(full string) { + o.Full = full +} + +// WithModifiedAfter adds the modifiedAfter to the get API timesheets params +func (o *GetAPITimesheetsParams) WithModifiedAfter(modifiedAfter string) *GetAPITimesheetsParams { + o.SetModifiedAfter(modifiedAfter) + return o +} + +// SetModifiedAfter adds the modifiedAfter to the get API timesheets params +func (o *GetAPITimesheetsParams) SetModifiedAfter(modifiedAfter string) { + o.ModifiedAfter = modifiedAfter +} + +// WithOrder adds the order to the get API timesheets params +func (o *GetAPITimesheetsParams) WithOrder(order string) *GetAPITimesheetsParams { + o.SetOrder(order) + return o +} + +// SetOrder adds the order to the get API timesheets params +func (o *GetAPITimesheetsParams) SetOrder(order string) { + o.Order = order +} + +// WithOrderBy adds the orderBy to the get API timesheets params +func (o *GetAPITimesheetsParams) WithOrderBy(orderBy string) *GetAPITimesheetsParams { + o.SetOrderBy(orderBy) + return o +} + +// SetOrderBy adds the orderBy to the get API timesheets params +func (o *GetAPITimesheetsParams) SetOrderBy(orderBy string) { + o.OrderBy = orderBy +} + +// WithPage adds the page to the get API timesheets params +func (o *GetAPITimesheetsParams) WithPage(page string) *GetAPITimesheetsParams { + o.SetPage(page) + return o +} + +// SetPage adds the page to the get API timesheets params +func (o *GetAPITimesheetsParams) SetPage(page string) { + o.Page = page +} + +// WithProject adds the project to the get API timesheets params +func (o *GetAPITimesheetsParams) WithProject(project string) *GetAPITimesheetsParams { + o.SetProject(project) + return o +} + +// SetProject adds the project to the get API timesheets params +func (o *GetAPITimesheetsParams) SetProject(project string) { + o.Project = project +} + +// WithProjects adds the projects to the get API timesheets params +func (o *GetAPITimesheetsParams) WithProjects(projects string) *GetAPITimesheetsParams { + o.SetProjects(projects) + return o +} + +// SetProjects adds the projects to the get API timesheets params +func (o *GetAPITimesheetsParams) SetProjects(projects string) { + o.Projects = projects +} + +// WithSize adds the size to the get API timesheets params +func (o *GetAPITimesheetsParams) WithSize(size string) *GetAPITimesheetsParams { + o.SetSize(size) + return o +} + +// SetSize adds the size to the get API timesheets params +func (o *GetAPITimesheetsParams) SetSize(size string) { + o.Size = size +} + +// WithTags adds the tags to the get API timesheets params +func (o *GetAPITimesheetsParams) WithTags(tags string) *GetAPITimesheetsParams { + o.SetTags(tags) + return o +} + +// SetTags adds the tags to the get API timesheets params +func (o *GetAPITimesheetsParams) SetTags(tags string) { + o.Tags = tags +} + +// WithTerm adds the term to the get API timesheets params +func (o *GetAPITimesheetsParams) WithTerm(term *string) *GetAPITimesheetsParams { + o.SetTerm(term) + return o +} + +// SetTerm adds the term to the get API timesheets params +func (o *GetAPITimesheetsParams) SetTerm(term *string) { + o.Term = term +} + +// WithUser adds the user to the get API timesheets params +func (o *GetAPITimesheetsParams) WithUser(user string) *GetAPITimesheetsParams { + o.SetUser(user) + return o +} + +// SetUser adds the user to the get API timesheets params +func (o *GetAPITimesheetsParams) SetUser(user string) { + o.User = user +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPITimesheetsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param active + qrActive := o.Active + qActive := qrActive + + if err := r.SetQueryParam("active", qActive); err != nil { + return err + } + + // query param activities + qrActivities := o.Activities + qActivities := qrActivities + + if err := r.SetQueryParam("activities", qActivities); err != nil { + return err + } + + // query param activity + qrActivity := o.Activity + qActivity := qrActivity + + if err := r.SetQueryParam("activity", qActivity); err != nil { + return err + } + + // query param begin + qrBegin := o.Begin + qBegin := qrBegin + + if err := r.SetQueryParam("begin", qBegin); err != nil { + return err + } + + // query param billable + qrBillable := o.Billable + qBillable := qrBillable + + if err := r.SetQueryParam("billable", qBillable); err != nil { + return err + } + + // query param customer + qrCustomer := o.Customer + qCustomer := qrCustomer + + if err := r.SetQueryParam("customer", qCustomer); err != nil { + return err + } + + // query param customers + qrCustomers := o.Customers + qCustomers := qrCustomers + + if err := r.SetQueryParam("customers", qCustomers); err != nil { + return err + } + + // query param end + qrEnd := o.End + qEnd := qrEnd + + if err := r.SetQueryParam("end", qEnd); err != nil { + return err + } + + // query param exported + qrExported := o.Exported + qExported := qrExported + + if err := r.SetQueryParam("exported", qExported); err != nil { + return err + } + + // query param full + qrFull := o.Full + qFull := qrFull + + if err := r.SetQueryParam("full", qFull); err != nil { + return err + } + + // query param modified_after + qrModifiedAfter := o.ModifiedAfter + qModifiedAfter := qrModifiedAfter + + if err := r.SetQueryParam("modified_after", qModifiedAfter); err != nil { + return err + } + + // query param order + qrOrder := o.Order + qOrder := qrOrder + + if err := r.SetQueryParam("order", qOrder); err != nil { + return err + } + + // query param orderBy + qrOrderBy := o.OrderBy + qOrderBy := qrOrderBy + + if err := r.SetQueryParam("orderBy", qOrderBy); err != nil { + return err + } + + // query param page + qrPage := o.Page + qPage := qrPage + + if err := r.SetQueryParam("page", qPage); err != nil { + return err + } + + // query param project + qrProject := o.Project + qProject := qrProject + + if err := r.SetQueryParam("project", qProject); err != nil { + return err + } + + // query param projects + qrProjects := o.Projects + qProjects := qrProjects + + if err := r.SetQueryParam("projects", qProjects); err != nil { + return err + } + + // query param size + qrSize := o.Size + qSize := qrSize + + if err := r.SetQueryParam("size", qSize); err != nil { + return err + } + + // query param tags + qrTags := o.Tags + qTags := qrTags + + if err := r.SetQueryParam("tags", qTags); err != nil { + return err + } + + if o.Term != nil { + + // query param term + var qrTerm string + + if o.Term != nil { + qrTerm = *o.Term + } + qTerm := qrTerm + if qTerm != "" { + + if err := r.SetQueryParam("term", qTerm); err != nil { + return err + } + } + } + + // query param user + qrUser := o.User + qUser := qrUser + + if err := r.SetQueryParam("user", qUser); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/timesheet/get_api_timesheets_recent_parameters.go b/client/timesheet/get_api_timesheets_recent_parameters.go new file mode 100644 index 0000000..97cc6d7 --- /dev/null +++ b/client/timesheet/get_api_timesheets_recent_parameters.go @@ -0,0 +1,206 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" +) + +// NewGetAPITimesheetsRecentParams creates a new GetAPITimesheetsRecentParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPITimesheetsRecentParams() *GetAPITimesheetsRecentParams { + return &GetAPITimesheetsRecentParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPITimesheetsRecentParamsWithTimeout creates a new GetAPITimesheetsRecentParams object +// with the ability to set a timeout on a request. +func NewGetAPITimesheetsRecentParamsWithTimeout(timeout time.Duration) *GetAPITimesheetsRecentParams { + return &GetAPITimesheetsRecentParams{ + timeout: timeout, + } +} + +// NewGetAPITimesheetsRecentParamsWithContext creates a new GetAPITimesheetsRecentParams object +// with the ability to set a context for a request. +func NewGetAPITimesheetsRecentParamsWithContext(ctx context.Context) *GetAPITimesheetsRecentParams { + return &GetAPITimesheetsRecentParams{ + Context: ctx, + } +} + +// NewGetAPITimesheetsRecentParamsWithHTTPClient creates a new GetAPITimesheetsRecentParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPITimesheetsRecentParamsWithHTTPClient(client *http.Client) *GetAPITimesheetsRecentParams { + return &GetAPITimesheetsRecentParams{ + HTTPClient: client, + } +} + +/* +GetAPITimesheetsRecentParams contains all the parameters to send to the API endpoint + + for the get API timesheets recent operation. + + Typically these are written to a http.Request. +*/ +type GetAPITimesheetsRecentParams struct { + + /* Begin. + + Only records after this date will be included. Default: today - 1 year (format: HTML5) + + Format: DateTime + */ + Begin string + + /* Size. + + The amount of entries (default: 10) + */ + Size string + + /* User. + + User ID to filter timesheets. Needs permission 'view_other_timesheet', pass 'all' to fetch data for all user (default: current user) + */ + User string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API timesheets recent params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITimesheetsRecentParams) WithDefaults() *GetAPITimesheetsRecentParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API timesheets recent params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPITimesheetsRecentParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API timesheets recent params +func (o *GetAPITimesheetsRecentParams) WithTimeout(timeout time.Duration) *GetAPITimesheetsRecentParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API timesheets recent params +func (o *GetAPITimesheetsRecentParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API timesheets recent params +func (o *GetAPITimesheetsRecentParams) WithContext(ctx context.Context) *GetAPITimesheetsRecentParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API timesheets recent params +func (o *GetAPITimesheetsRecentParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API timesheets recent params +func (o *GetAPITimesheetsRecentParams) WithHTTPClient(client *http.Client) *GetAPITimesheetsRecentParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API timesheets recent params +func (o *GetAPITimesheetsRecentParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBegin adds the begin to the get API timesheets recent params +func (o *GetAPITimesheetsRecentParams) WithBegin(begin string) *GetAPITimesheetsRecentParams { + o.SetBegin(begin) + return o +} + +// SetBegin adds the begin to the get API timesheets recent params +func (o *GetAPITimesheetsRecentParams) SetBegin(begin string) { + o.Begin = begin +} + +// WithSize adds the size to the get API timesheets recent params +func (o *GetAPITimesheetsRecentParams) WithSize(size string) *GetAPITimesheetsRecentParams { + o.SetSize(size) + return o +} + +// SetSize adds the size to the get API timesheets recent params +func (o *GetAPITimesheetsRecentParams) SetSize(size string) { + o.Size = size +} + +// WithUser adds the user to the get API timesheets recent params +func (o *GetAPITimesheetsRecentParams) WithUser(user string) *GetAPITimesheetsRecentParams { + o.SetUser(user) + return o +} + +// SetUser adds the user to the get API timesheets recent params +func (o *GetAPITimesheetsRecentParams) SetUser(user string) { + o.User = user +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPITimesheetsRecentParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param begin + qrBegin := o.Begin + qBegin := qrBegin + + if err := r.SetQueryParam("begin", qBegin); err != nil { + return err + } + + // query param size + qrSize := o.Size + qSize := qrSize + + if err := r.SetQueryParam("size", qSize); err != nil { + return err + } + + // query param user + qrUser := o.User + qUser := qrUser + + if err := r.SetQueryParam("user", qUser); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/timesheet/get_api_timesheets_recent_responses.go b/client/timesheet/get_api_timesheets_recent_responses.go new file mode 100644 index 0000000..55fc206 --- /dev/null +++ b/client/timesheet/get_api_timesheets_recent_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPITimesheetsRecentReader is a Reader for the GetAPITimesheetsRecent structure. +type GetAPITimesheetsRecentReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPITimesheetsRecentReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPITimesheetsRecentOK() + 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()) + } +} + +// NewGetAPITimesheetsRecentOK creates a GetAPITimesheetsRecentOK with default headers values +func NewGetAPITimesheetsRecentOK() *GetAPITimesheetsRecentOK { + return &GetAPITimesheetsRecentOK{} +} + +/* +GetAPITimesheetsRecentOK describes a response with status code 200, with default header values. + +Returns the collection of recent user activities (always the latest entry of a unique working set grouped by customer, project and activity) +*/ +type GetAPITimesheetsRecentOK struct { + Payload []*models.TimesheetCollectionExpanded +} + +// IsSuccess returns true when this get Api timesheets recent o k response has a 2xx status code +func (o *GetAPITimesheetsRecentOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api timesheets recent o k response has a 3xx status code +func (o *GetAPITimesheetsRecentOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api timesheets recent o k response has a 4xx status code +func (o *GetAPITimesheetsRecentOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api timesheets recent o k response has a 5xx status code +func (o *GetAPITimesheetsRecentOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api timesheets recent o k response a status code equal to that given +func (o *GetAPITimesheetsRecentOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPITimesheetsRecentOK) Error() string { + return fmt.Sprintf("[GET /api/timesheets/recent][%d] getApiTimesheetsRecentOK %+v", 200, o.Payload) +} + +func (o *GetAPITimesheetsRecentOK) String() string { + return fmt.Sprintf("[GET /api/timesheets/recent][%d] getApiTimesheetsRecentOK %+v", 200, o.Payload) +} + +func (o *GetAPITimesheetsRecentOK) GetPayload() []*models.TimesheetCollectionExpanded { + return o.Payload +} + +func (o *GetAPITimesheetsRecentOK) 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/timesheet/get_api_timesheets_responses.go b/client/timesheet/get_api_timesheets_responses.go new file mode 100644 index 0000000..469ea32 --- /dev/null +++ b/client/timesheet/get_api_timesheets_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPITimesheetsReader is a Reader for the GetAPITimesheets structure. +type GetAPITimesheetsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPITimesheetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPITimesheetsOK() + 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()) + } +} + +// NewGetAPITimesheetsOK creates a GetAPITimesheetsOK with default headers values +func NewGetAPITimesheetsOK() *GetAPITimesheetsOK { + return &GetAPITimesheetsOK{} +} + +/* +GetAPITimesheetsOK describes a response with status code 200, with default header values. + +Returns a collection of timesheets records. Be aware that the datetime fields are given in the users local time including the timezone offset via ISO 8601. +*/ +type GetAPITimesheetsOK struct { + Payload []*models.TimesheetCollection +} + +// IsSuccess returns true when this get Api timesheets o k response has a 2xx status code +func (o *GetAPITimesheetsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api timesheets o k response has a 3xx status code +func (o *GetAPITimesheetsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api timesheets o k response has a 4xx status code +func (o *GetAPITimesheetsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api timesheets o k response has a 5xx status code +func (o *GetAPITimesheetsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api timesheets o k response a status code equal to that given +func (o *GetAPITimesheetsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPITimesheetsOK) Error() string { + return fmt.Sprintf("[GET /api/timesheets][%d] getApiTimesheetsOK %+v", 200, o.Payload) +} + +func (o *GetAPITimesheetsOK) String() string { + return fmt.Sprintf("[GET /api/timesheets][%d] getApiTimesheetsOK %+v", 200, o.Payload) +} + +func (o *GetAPITimesheetsOK) GetPayload() []*models.TimesheetCollection { + return o.Payload +} + +func (o *GetAPITimesheetsOK) 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/timesheet/patch_api_timesheets_id_duplicate_parameters.go b/client/timesheet/patch_api_timesheets_id_duplicate_parameters.go new file mode 100644 index 0000000..195dafe --- /dev/null +++ b/client/timesheet/patch_api_timesheets_id_duplicate_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" +) + +// NewPatchAPITimesheetsIDDuplicateParams creates a new PatchAPITimesheetsIDDuplicateParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITimesheetsIDDuplicateParams() *PatchAPITimesheetsIDDuplicateParams { + return &PatchAPITimesheetsIDDuplicateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITimesheetsIDDuplicateParamsWithTimeout creates a new PatchAPITimesheetsIDDuplicateParams object +// with the ability to set a timeout on a request. +func NewPatchAPITimesheetsIDDuplicateParamsWithTimeout(timeout time.Duration) *PatchAPITimesheetsIDDuplicateParams { + return &PatchAPITimesheetsIDDuplicateParams{ + timeout: timeout, + } +} + +// NewPatchAPITimesheetsIDDuplicateParamsWithContext creates a new PatchAPITimesheetsIDDuplicateParams object +// with the ability to set a context for a request. +func NewPatchAPITimesheetsIDDuplicateParamsWithContext(ctx context.Context) *PatchAPITimesheetsIDDuplicateParams { + return &PatchAPITimesheetsIDDuplicateParams{ + Context: ctx, + } +} + +// NewPatchAPITimesheetsIDDuplicateParamsWithHTTPClient creates a new PatchAPITimesheetsIDDuplicateParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITimesheetsIDDuplicateParamsWithHTTPClient(client *http.Client) *PatchAPITimesheetsIDDuplicateParams { + return &PatchAPITimesheetsIDDuplicateParams{ + HTTPClient: client, + } +} + +/* +PatchAPITimesheetsIDDuplicateParams contains all the parameters to send to the API endpoint + + for the patch API timesheets ID duplicate operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITimesheetsIDDuplicateParams struct { + + /* ID. + + Timesheet record ID to duplicate + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API timesheets ID duplicate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITimesheetsIDDuplicateParams) WithDefaults() *PatchAPITimesheetsIDDuplicateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API timesheets ID duplicate params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITimesheetsIDDuplicateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API timesheets ID duplicate params +func (o *PatchAPITimesheetsIDDuplicateParams) WithTimeout(timeout time.Duration) *PatchAPITimesheetsIDDuplicateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API timesheets ID duplicate params +func (o *PatchAPITimesheetsIDDuplicateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API timesheets ID duplicate params +func (o *PatchAPITimesheetsIDDuplicateParams) WithContext(ctx context.Context) *PatchAPITimesheetsIDDuplicateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API timesheets ID duplicate params +func (o *PatchAPITimesheetsIDDuplicateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API timesheets ID duplicate params +func (o *PatchAPITimesheetsIDDuplicateParams) WithHTTPClient(client *http.Client) *PatchAPITimesheetsIDDuplicateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API timesheets ID duplicate params +func (o *PatchAPITimesheetsIDDuplicateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the patch API timesheets ID duplicate params +func (o *PatchAPITimesheetsIDDuplicateParams) WithID(id int64) *PatchAPITimesheetsIDDuplicateParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API timesheets ID duplicate params +func (o *PatchAPITimesheetsIDDuplicateParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITimesheetsIDDuplicateParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/timesheet/patch_api_timesheets_id_duplicate_responses.go b/client/timesheet/patch_api_timesheets_id_duplicate_responses.go new file mode 100644 index 0000000..daea246 --- /dev/null +++ b/client/timesheet/patch_api_timesheets_id_duplicate_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPITimesheetsIDDuplicateReader is a Reader for the PatchAPITimesheetsIDDuplicate structure. +type PatchAPITimesheetsIDDuplicateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITimesheetsIDDuplicateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITimesheetsIDDuplicateOK() + 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()) + } +} + +// NewPatchAPITimesheetsIDDuplicateOK creates a PatchAPITimesheetsIDDuplicateOK with default headers values +func NewPatchAPITimesheetsIDDuplicateOK() *PatchAPITimesheetsIDDuplicateOK { + return &PatchAPITimesheetsIDDuplicateOK{} +} + +/* +PatchAPITimesheetsIDDuplicateOK describes a response with status code 200, with default header values. + +Duplicates a timesheet record, resetting the export state only. +*/ +type PatchAPITimesheetsIDDuplicateOK struct { + Payload *models.TimesheetEntity +} + +// IsSuccess returns true when this patch Api timesheets Id duplicate o k response has a 2xx status code +func (o *PatchAPITimesheetsIDDuplicateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api timesheets Id duplicate o k response has a 3xx status code +func (o *PatchAPITimesheetsIDDuplicateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api timesheets Id duplicate o k response has a 4xx status code +func (o *PatchAPITimesheetsIDDuplicateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api timesheets Id duplicate o k response has a 5xx status code +func (o *PatchAPITimesheetsIDDuplicateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api timesheets Id duplicate o k response a status code equal to that given +func (o *PatchAPITimesheetsIDDuplicateOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITimesheetsIDDuplicateOK) Error() string { + return fmt.Sprintf("[PATCH /api/timesheets/{id}/duplicate][%d] patchApiTimesheetsIdDuplicateOK %+v", 200, o.Payload) +} + +func (o *PatchAPITimesheetsIDDuplicateOK) String() string { + return fmt.Sprintf("[PATCH /api/timesheets/{id}/duplicate][%d] patchApiTimesheetsIdDuplicateOK %+v", 200, o.Payload) +} + +func (o *PatchAPITimesheetsIDDuplicateOK) GetPayload() *models.TimesheetEntity { + return o.Payload +} + +func (o *PatchAPITimesheetsIDDuplicateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TimesheetEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/timesheet/patch_api_timesheets_id_export_parameters.go b/client/timesheet/patch_api_timesheets_id_export_parameters.go new file mode 100644 index 0000000..33dd60d --- /dev/null +++ b/client/timesheet/patch_api_timesheets_id_export_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" +) + +// NewPatchAPITimesheetsIDExportParams creates a new PatchAPITimesheetsIDExportParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITimesheetsIDExportParams() *PatchAPITimesheetsIDExportParams { + return &PatchAPITimesheetsIDExportParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITimesheetsIDExportParamsWithTimeout creates a new PatchAPITimesheetsIDExportParams object +// with the ability to set a timeout on a request. +func NewPatchAPITimesheetsIDExportParamsWithTimeout(timeout time.Duration) *PatchAPITimesheetsIDExportParams { + return &PatchAPITimesheetsIDExportParams{ + timeout: timeout, + } +} + +// NewPatchAPITimesheetsIDExportParamsWithContext creates a new PatchAPITimesheetsIDExportParams object +// with the ability to set a context for a request. +func NewPatchAPITimesheetsIDExportParamsWithContext(ctx context.Context) *PatchAPITimesheetsIDExportParams { + return &PatchAPITimesheetsIDExportParams{ + Context: ctx, + } +} + +// NewPatchAPITimesheetsIDExportParamsWithHTTPClient creates a new PatchAPITimesheetsIDExportParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITimesheetsIDExportParamsWithHTTPClient(client *http.Client) *PatchAPITimesheetsIDExportParams { + return &PatchAPITimesheetsIDExportParams{ + HTTPClient: client, + } +} + +/* +PatchAPITimesheetsIDExportParams contains all the parameters to send to the API endpoint + + for the patch API timesheets ID export operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITimesheetsIDExportParams struct { + + /* ID. + + Timesheet record ID to switch export state + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API timesheets ID export params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITimesheetsIDExportParams) WithDefaults() *PatchAPITimesheetsIDExportParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API timesheets ID export params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITimesheetsIDExportParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API timesheets ID export params +func (o *PatchAPITimesheetsIDExportParams) WithTimeout(timeout time.Duration) *PatchAPITimesheetsIDExportParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API timesheets ID export params +func (o *PatchAPITimesheetsIDExportParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API timesheets ID export params +func (o *PatchAPITimesheetsIDExportParams) WithContext(ctx context.Context) *PatchAPITimesheetsIDExportParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API timesheets ID export params +func (o *PatchAPITimesheetsIDExportParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API timesheets ID export params +func (o *PatchAPITimesheetsIDExportParams) WithHTTPClient(client *http.Client) *PatchAPITimesheetsIDExportParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API timesheets ID export params +func (o *PatchAPITimesheetsIDExportParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the patch API timesheets ID export params +func (o *PatchAPITimesheetsIDExportParams) WithID(id int64) *PatchAPITimesheetsIDExportParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API timesheets ID export params +func (o *PatchAPITimesheetsIDExportParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITimesheetsIDExportParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/timesheet/patch_api_timesheets_id_export_responses.go b/client/timesheet/patch_api_timesheets_id_export_responses.go new file mode 100644 index 0000000..6540ebd --- /dev/null +++ b/client/timesheet/patch_api_timesheets_id_export_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPITimesheetsIDExportReader is a Reader for the PatchAPITimesheetsIDExport structure. +type PatchAPITimesheetsIDExportReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITimesheetsIDExportReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITimesheetsIDExportOK() + 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()) + } +} + +// NewPatchAPITimesheetsIDExportOK creates a PatchAPITimesheetsIDExportOK with default headers values +func NewPatchAPITimesheetsIDExportOK() *PatchAPITimesheetsIDExportOK { + return &PatchAPITimesheetsIDExportOK{} +} + +/* +PatchAPITimesheetsIDExportOK describes a response with status code 200, with default header values. + +Switches the exported state on the record and therefor locks / unlocks it for further updates. Needs edit_export_*_timesheet permission. +*/ +type PatchAPITimesheetsIDExportOK struct { + Payload *models.TimesheetEntity +} + +// IsSuccess returns true when this patch Api timesheets Id export o k response has a 2xx status code +func (o *PatchAPITimesheetsIDExportOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api timesheets Id export o k response has a 3xx status code +func (o *PatchAPITimesheetsIDExportOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api timesheets Id export o k response has a 4xx status code +func (o *PatchAPITimesheetsIDExportOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api timesheets Id export o k response has a 5xx status code +func (o *PatchAPITimesheetsIDExportOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api timesheets Id export o k response a status code equal to that given +func (o *PatchAPITimesheetsIDExportOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITimesheetsIDExportOK) Error() string { + return fmt.Sprintf("[PATCH /api/timesheets/{id}/export][%d] patchApiTimesheetsIdExportOK %+v", 200, o.Payload) +} + +func (o *PatchAPITimesheetsIDExportOK) String() string { + return fmt.Sprintf("[PATCH /api/timesheets/{id}/export][%d] patchApiTimesheetsIdExportOK %+v", 200, o.Payload) +} + +func (o *PatchAPITimesheetsIDExportOK) GetPayload() *models.TimesheetEntity { + return o.Payload +} + +func (o *PatchAPITimesheetsIDExportOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TimesheetEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/timesheet/patch_api_timesheets_id_meta_parameters.go b/client/timesheet/patch_api_timesheets_id_meta_parameters.go new file mode 100644 index 0000000..0ecd346 --- /dev/null +++ b/client/timesheet/patch_api_timesheets_id_meta_parameters.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" +) + +// NewPatchAPITimesheetsIDMetaParams creates a new PatchAPITimesheetsIDMetaParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITimesheetsIDMetaParams() *PatchAPITimesheetsIDMetaParams { + return &PatchAPITimesheetsIDMetaParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITimesheetsIDMetaParamsWithTimeout creates a new PatchAPITimesheetsIDMetaParams object +// with the ability to set a timeout on a request. +func NewPatchAPITimesheetsIDMetaParamsWithTimeout(timeout time.Duration) *PatchAPITimesheetsIDMetaParams { + return &PatchAPITimesheetsIDMetaParams{ + timeout: timeout, + } +} + +// NewPatchAPITimesheetsIDMetaParamsWithContext creates a new PatchAPITimesheetsIDMetaParams object +// with the ability to set a context for a request. +func NewPatchAPITimesheetsIDMetaParamsWithContext(ctx context.Context) *PatchAPITimesheetsIDMetaParams { + return &PatchAPITimesheetsIDMetaParams{ + Context: ctx, + } +} + +// NewPatchAPITimesheetsIDMetaParamsWithHTTPClient creates a new PatchAPITimesheetsIDMetaParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITimesheetsIDMetaParamsWithHTTPClient(client *http.Client) *PatchAPITimesheetsIDMetaParams { + return &PatchAPITimesheetsIDMetaParams{ + HTTPClient: client, + } +} + +/* +PatchAPITimesheetsIDMetaParams contains all the parameters to send to the API endpoint + + for the patch API timesheets ID meta operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITimesheetsIDMetaParams struct { + + // Body. + Body PatchAPITimesheetsIDMetaBody + + /* ID. + + Timesheet record ID to set the meta-field value for + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API timesheets ID meta params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITimesheetsIDMetaParams) WithDefaults() *PatchAPITimesheetsIDMetaParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API timesheets ID meta params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITimesheetsIDMetaParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API timesheets ID meta params +func (o *PatchAPITimesheetsIDMetaParams) WithTimeout(timeout time.Duration) *PatchAPITimesheetsIDMetaParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API timesheets ID meta params +func (o *PatchAPITimesheetsIDMetaParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API timesheets ID meta params +func (o *PatchAPITimesheetsIDMetaParams) WithContext(ctx context.Context) *PatchAPITimesheetsIDMetaParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API timesheets ID meta params +func (o *PatchAPITimesheetsIDMetaParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API timesheets ID meta params +func (o *PatchAPITimesheetsIDMetaParams) WithHTTPClient(client *http.Client) *PatchAPITimesheetsIDMetaParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API timesheets ID meta params +func (o *PatchAPITimesheetsIDMetaParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API timesheets ID meta params +func (o *PatchAPITimesheetsIDMetaParams) WithBody(body PatchAPITimesheetsIDMetaBody) *PatchAPITimesheetsIDMetaParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API timesheets ID meta params +func (o *PatchAPITimesheetsIDMetaParams) SetBody(body PatchAPITimesheetsIDMetaBody) { + o.Body = body +} + +// WithID adds the id to the patch API timesheets ID meta params +func (o *PatchAPITimesheetsIDMetaParams) WithID(id int64) *PatchAPITimesheetsIDMetaParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API timesheets ID meta params +func (o *PatchAPITimesheetsIDMetaParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITimesheetsIDMetaParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/timesheet/patch_api_timesheets_id_meta_responses.go b/client/timesheet/patch_api_timesheets_id_meta_responses.go new file mode 100644 index 0000000..1d2e83d --- /dev/null +++ b/client/timesheet/patch_api_timesheets_id_meta_responses.go @@ -0,0 +1,176 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + + "decentral1se/go-kimai/models" +) + +// PatchAPITimesheetsIDMetaReader is a Reader for the PatchAPITimesheetsIDMeta structure. +type PatchAPITimesheetsIDMetaReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITimesheetsIDMetaReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITimesheetsIDMetaOK() + 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()) + } +} + +// NewPatchAPITimesheetsIDMetaOK creates a PatchAPITimesheetsIDMetaOK with default headers values +func NewPatchAPITimesheetsIDMetaOK() *PatchAPITimesheetsIDMetaOK { + return &PatchAPITimesheetsIDMetaOK{} +} + +/* +PatchAPITimesheetsIDMetaOK describes a response with status code 200, with default header values. + +Sets the value of an existing/configured meta-field. You cannot create unknown meta-fields, if the given name is not a configured meta-field, this will return an exception. +*/ +type PatchAPITimesheetsIDMetaOK struct { + Payload *models.TimesheetEntity +} + +// IsSuccess returns true when this patch Api timesheets Id meta o k response has a 2xx status code +func (o *PatchAPITimesheetsIDMetaOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api timesheets Id meta o k response has a 3xx status code +func (o *PatchAPITimesheetsIDMetaOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api timesheets Id meta o k response has a 4xx status code +func (o *PatchAPITimesheetsIDMetaOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api timesheets Id meta o k response has a 5xx status code +func (o *PatchAPITimesheetsIDMetaOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api timesheets Id meta o k response a status code equal to that given +func (o *PatchAPITimesheetsIDMetaOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITimesheetsIDMetaOK) Error() string { + return fmt.Sprintf("[PATCH /api/timesheets/{id}/meta][%d] patchApiTimesheetsIdMetaOK %+v", 200, o.Payload) +} + +func (o *PatchAPITimesheetsIDMetaOK) String() string { + return fmt.Sprintf("[PATCH /api/timesheets/{id}/meta][%d] patchApiTimesheetsIdMetaOK %+v", 200, o.Payload) +} + +func (o *PatchAPITimesheetsIDMetaOK) GetPayload() *models.TimesheetEntity { + return o.Payload +} + +func (o *PatchAPITimesheetsIDMetaOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TimesheetEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +PatchAPITimesheetsIDMetaBody patch API timesheets ID meta body +swagger:model PatchAPITimesheetsIDMetaBody +*/ +type PatchAPITimesheetsIDMetaBody struct { + + // The meta-field name + // Required: true + Name *string `json:"name"` + + // The meta-field value + // Required: true + Value *string `json:"value"` +} + +// Validate validates this patch API timesheets ID meta body +func (o *PatchAPITimesheetsIDMetaBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateName(formats); err != nil { + res = append(res, err) + } + + if err := o.validateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *PatchAPITimesheetsIDMetaBody) validateName(formats strfmt.Registry) error { + + if err := validate.Required("body"+"."+"name", "body", o.Name); err != nil { + return err + } + + return nil +} + +func (o *PatchAPITimesheetsIDMetaBody) validateValue(formats strfmt.Registry) error { + + if err := validate.Required("body"+"."+"value", "body", o.Value); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this patch API timesheets ID meta body based on context it is used +func (o *PatchAPITimesheetsIDMetaBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *PatchAPITimesheetsIDMetaBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *PatchAPITimesheetsIDMetaBody) UnmarshalBinary(b []byte) error { + var res PatchAPITimesheetsIDMetaBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/client/timesheet/patch_api_timesheets_id_parameters.go b/client/timesheet/patch_api_timesheets_id_parameters.go new file mode 100644 index 0000000..55403eb --- /dev/null +++ b/client/timesheet/patch_api_timesheets_id_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPatchAPITimesheetsIDParams creates a new PatchAPITimesheetsIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITimesheetsIDParams() *PatchAPITimesheetsIDParams { + return &PatchAPITimesheetsIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITimesheetsIDParamsWithTimeout creates a new PatchAPITimesheetsIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPITimesheetsIDParamsWithTimeout(timeout time.Duration) *PatchAPITimesheetsIDParams { + return &PatchAPITimesheetsIDParams{ + timeout: timeout, + } +} + +// NewPatchAPITimesheetsIDParamsWithContext creates a new PatchAPITimesheetsIDParams object +// with the ability to set a context for a request. +func NewPatchAPITimesheetsIDParamsWithContext(ctx context.Context) *PatchAPITimesheetsIDParams { + return &PatchAPITimesheetsIDParams{ + Context: ctx, + } +} + +// NewPatchAPITimesheetsIDParamsWithHTTPClient creates a new PatchAPITimesheetsIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITimesheetsIDParamsWithHTTPClient(client *http.Client) *PatchAPITimesheetsIDParams { + return &PatchAPITimesheetsIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPITimesheetsIDParams contains all the parameters to send to the API endpoint + + for the patch API timesheets ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITimesheetsIDParams struct { + + // Body. + Body *models.TimesheetEditForm + + /* ID. + + Timesheet record ID to update + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API timesheets ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITimesheetsIDParams) WithDefaults() *PatchAPITimesheetsIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API timesheets ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITimesheetsIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API timesheets ID params +func (o *PatchAPITimesheetsIDParams) WithTimeout(timeout time.Duration) *PatchAPITimesheetsIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API timesheets ID params +func (o *PatchAPITimesheetsIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API timesheets ID params +func (o *PatchAPITimesheetsIDParams) WithContext(ctx context.Context) *PatchAPITimesheetsIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API timesheets ID params +func (o *PatchAPITimesheetsIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API timesheets ID params +func (o *PatchAPITimesheetsIDParams) WithHTTPClient(client *http.Client) *PatchAPITimesheetsIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API timesheets ID params +func (o *PatchAPITimesheetsIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API timesheets ID params +func (o *PatchAPITimesheetsIDParams) WithBody(body *models.TimesheetEditForm) *PatchAPITimesheetsIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API timesheets ID params +func (o *PatchAPITimesheetsIDParams) SetBody(body *models.TimesheetEditForm) { + o.Body = body +} + +// WithID adds the id to the patch API timesheets ID params +func (o *PatchAPITimesheetsIDParams) WithID(id int64) *PatchAPITimesheetsIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API timesheets ID params +func (o *PatchAPITimesheetsIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITimesheetsIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/timesheet/patch_api_timesheets_id_responses.go b/client/timesheet/patch_api_timesheets_id_responses.go new file mode 100644 index 0000000..3a007b0 --- /dev/null +++ b/client/timesheet/patch_api_timesheets_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPITimesheetsIDReader is a Reader for the PatchAPITimesheetsID structure. +type PatchAPITimesheetsIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITimesheetsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITimesheetsIDOK() + 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()) + } +} + +// NewPatchAPITimesheetsIDOK creates a PatchAPITimesheetsIDOK with default headers values +func NewPatchAPITimesheetsIDOK() *PatchAPITimesheetsIDOK { + return &PatchAPITimesheetsIDOK{} +} + +/* +PatchAPITimesheetsIDOK describes a response with status code 200, with default header values. + +Returns the updated timesheet +*/ +type PatchAPITimesheetsIDOK struct { + Payload *models.TimesheetEntity +} + +// IsSuccess returns true when this patch Api timesheets Id o k response has a 2xx status code +func (o *PatchAPITimesheetsIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api timesheets Id o k response has a 3xx status code +func (o *PatchAPITimesheetsIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api timesheets Id o k response has a 4xx status code +func (o *PatchAPITimesheetsIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api timesheets Id o k response has a 5xx status code +func (o *PatchAPITimesheetsIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api timesheets Id o k response a status code equal to that given +func (o *PatchAPITimesheetsIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITimesheetsIDOK) Error() string { + return fmt.Sprintf("[PATCH /api/timesheets/{id}][%d] patchApiTimesheetsIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPITimesheetsIDOK) String() string { + return fmt.Sprintf("[PATCH /api/timesheets/{id}][%d] patchApiTimesheetsIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPITimesheetsIDOK) GetPayload() *models.TimesheetEntity { + return o.Payload +} + +func (o *PatchAPITimesheetsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TimesheetEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/timesheet/patch_api_timesheets_id_restart_parameters.go b/client/timesheet/patch_api_timesheets_id_restart_parameters.go new file mode 100644 index 0000000..b8606d5 --- /dev/null +++ b/client/timesheet/patch_api_timesheets_id_restart_parameters.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" +) + +// NewPatchAPITimesheetsIDRestartParams creates a new PatchAPITimesheetsIDRestartParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITimesheetsIDRestartParams() *PatchAPITimesheetsIDRestartParams { + return &PatchAPITimesheetsIDRestartParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITimesheetsIDRestartParamsWithTimeout creates a new PatchAPITimesheetsIDRestartParams object +// with the ability to set a timeout on a request. +func NewPatchAPITimesheetsIDRestartParamsWithTimeout(timeout time.Duration) *PatchAPITimesheetsIDRestartParams { + return &PatchAPITimesheetsIDRestartParams{ + timeout: timeout, + } +} + +// NewPatchAPITimesheetsIDRestartParamsWithContext creates a new PatchAPITimesheetsIDRestartParams object +// with the ability to set a context for a request. +func NewPatchAPITimesheetsIDRestartParamsWithContext(ctx context.Context) *PatchAPITimesheetsIDRestartParams { + return &PatchAPITimesheetsIDRestartParams{ + Context: ctx, + } +} + +// NewPatchAPITimesheetsIDRestartParamsWithHTTPClient creates a new PatchAPITimesheetsIDRestartParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITimesheetsIDRestartParamsWithHTTPClient(client *http.Client) *PatchAPITimesheetsIDRestartParams { + return &PatchAPITimesheetsIDRestartParams{ + HTTPClient: client, + } +} + +/* +PatchAPITimesheetsIDRestartParams contains all the parameters to send to the API endpoint + + for the patch API timesheets ID restart operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITimesheetsIDRestartParams struct { + + // Body. + Body PatchAPITimesheetsIDRestartBody + + /* ID. + + Timesheet record ID to restart + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API timesheets ID restart params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITimesheetsIDRestartParams) WithDefaults() *PatchAPITimesheetsIDRestartParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API timesheets ID restart params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITimesheetsIDRestartParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API timesheets ID restart params +func (o *PatchAPITimesheetsIDRestartParams) WithTimeout(timeout time.Duration) *PatchAPITimesheetsIDRestartParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API timesheets ID restart params +func (o *PatchAPITimesheetsIDRestartParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API timesheets ID restart params +func (o *PatchAPITimesheetsIDRestartParams) WithContext(ctx context.Context) *PatchAPITimesheetsIDRestartParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API timesheets ID restart params +func (o *PatchAPITimesheetsIDRestartParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API timesheets ID restart params +func (o *PatchAPITimesheetsIDRestartParams) WithHTTPClient(client *http.Client) *PatchAPITimesheetsIDRestartParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API timesheets ID restart params +func (o *PatchAPITimesheetsIDRestartParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API timesheets ID restart params +func (o *PatchAPITimesheetsIDRestartParams) WithBody(body PatchAPITimesheetsIDRestartBody) *PatchAPITimesheetsIDRestartParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API timesheets ID restart params +func (o *PatchAPITimesheetsIDRestartParams) SetBody(body PatchAPITimesheetsIDRestartBody) { + o.Body = body +} + +// WithID adds the id to the patch API timesheets ID restart params +func (o *PatchAPITimesheetsIDRestartParams) WithID(id int64) *PatchAPITimesheetsIDRestartParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API timesheets ID restart params +func (o *PatchAPITimesheetsIDRestartParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITimesheetsIDRestartParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/timesheet/patch_api_timesheets_id_restart_responses.go b/client/timesheet/patch_api_timesheets_id_restart_responses.go new file mode 100644 index 0000000..495f08f --- /dev/null +++ b/client/timesheet/patch_api_timesheets_id_restart_responses.go @@ -0,0 +1,165 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + + "decentral1se/go-kimai/models" +) + +// PatchAPITimesheetsIDRestartReader is a Reader for the PatchAPITimesheetsIDRestart structure. +type PatchAPITimesheetsIDRestartReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITimesheetsIDRestartReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITimesheetsIDRestartOK() + 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()) + } +} + +// NewPatchAPITimesheetsIDRestartOK creates a PatchAPITimesheetsIDRestartOK with default headers values +func NewPatchAPITimesheetsIDRestartOK() *PatchAPITimesheetsIDRestartOK { + return &PatchAPITimesheetsIDRestartOK{} +} + +/* +PatchAPITimesheetsIDRestartOK describes a response with status code 200, with default header values. + +Restarts a timesheet record for the same customer, project, activity combination. The current user will be the owner of the new record. Kimai tries to stop running records, which is expected to fail depending on the configured rules. Data will be copied from the original record if requested. +*/ +type PatchAPITimesheetsIDRestartOK struct { + Payload *models.TimesheetEntity +} + +// IsSuccess returns true when this patch Api timesheets Id restart o k response has a 2xx status code +func (o *PatchAPITimesheetsIDRestartOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api timesheets Id restart o k response has a 3xx status code +func (o *PatchAPITimesheetsIDRestartOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api timesheets Id restart o k response has a 4xx status code +func (o *PatchAPITimesheetsIDRestartOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api timesheets Id restart o k response has a 5xx status code +func (o *PatchAPITimesheetsIDRestartOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api timesheets Id restart o k response a status code equal to that given +func (o *PatchAPITimesheetsIDRestartOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITimesheetsIDRestartOK) Error() string { + return fmt.Sprintf("[PATCH /api/timesheets/{id}/restart][%d] patchApiTimesheetsIdRestartOK %+v", 200, o.Payload) +} + +func (o *PatchAPITimesheetsIDRestartOK) String() string { + return fmt.Sprintf("[PATCH /api/timesheets/{id}/restart][%d] patchApiTimesheetsIdRestartOK %+v", 200, o.Payload) +} + +func (o *PatchAPITimesheetsIDRestartOK) GetPayload() *models.TimesheetEntity { + return o.Payload +} + +func (o *PatchAPITimesheetsIDRestartOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TimesheetEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +PatchAPITimesheetsIDRestartBody patch API timesheets ID restart body +swagger:model PatchAPITimesheetsIDRestartBody +*/ +type PatchAPITimesheetsIDRestartBody struct { + + // Changes the restart date to the given one (default: now) + Begin string `json:"begin,omitempty"` + + // Whether data should be copied to the new entry. Allowed values: all, tags (deprecated), rates (deprecated), description (deprecated), meta (deprecated) (default: nothing is copied) + // Pattern: all|tags|rates|meta|description + Copy string `json:"copy,omitempty"` +} + +// Validate validates this patch API timesheets ID restart body +func (o *PatchAPITimesheetsIDRestartBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateCopy(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *PatchAPITimesheetsIDRestartBody) validateCopy(formats strfmt.Registry) error { + if swag.IsZero(o.Copy) { // not required + return nil + } + + if err := validate.Pattern("body"+"."+"copy", "body", o.Copy, `all|tags|rates|meta|description`); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this patch API timesheets ID restart body based on context it is used +func (o *PatchAPITimesheetsIDRestartBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *PatchAPITimesheetsIDRestartBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *PatchAPITimesheetsIDRestartBody) UnmarshalBinary(b []byte) error { + var res PatchAPITimesheetsIDRestartBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/client/timesheet/patch_api_timesheets_id_stop_parameters.go b/client/timesheet/patch_api_timesheets_id_stop_parameters.go new file mode 100644 index 0000000..b4153ac --- /dev/null +++ b/client/timesheet/patch_api_timesheets_id_stop_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" +) + +// NewPatchAPITimesheetsIDStopParams creates a new PatchAPITimesheetsIDStopParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPITimesheetsIDStopParams() *PatchAPITimesheetsIDStopParams { + return &PatchAPITimesheetsIDStopParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPITimesheetsIDStopParamsWithTimeout creates a new PatchAPITimesheetsIDStopParams object +// with the ability to set a timeout on a request. +func NewPatchAPITimesheetsIDStopParamsWithTimeout(timeout time.Duration) *PatchAPITimesheetsIDStopParams { + return &PatchAPITimesheetsIDStopParams{ + timeout: timeout, + } +} + +// NewPatchAPITimesheetsIDStopParamsWithContext creates a new PatchAPITimesheetsIDStopParams object +// with the ability to set a context for a request. +func NewPatchAPITimesheetsIDStopParamsWithContext(ctx context.Context) *PatchAPITimesheetsIDStopParams { + return &PatchAPITimesheetsIDStopParams{ + Context: ctx, + } +} + +// NewPatchAPITimesheetsIDStopParamsWithHTTPClient creates a new PatchAPITimesheetsIDStopParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPITimesheetsIDStopParamsWithHTTPClient(client *http.Client) *PatchAPITimesheetsIDStopParams { + return &PatchAPITimesheetsIDStopParams{ + HTTPClient: client, + } +} + +/* +PatchAPITimesheetsIDStopParams contains all the parameters to send to the API endpoint + + for the patch API timesheets ID stop operation. + + Typically these are written to a http.Request. +*/ +type PatchAPITimesheetsIDStopParams struct { + + /* ID. + + Timesheet record ID to stop + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API timesheets ID stop params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITimesheetsIDStopParams) WithDefaults() *PatchAPITimesheetsIDStopParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API timesheets ID stop params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPITimesheetsIDStopParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API timesheets ID stop params +func (o *PatchAPITimesheetsIDStopParams) WithTimeout(timeout time.Duration) *PatchAPITimesheetsIDStopParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API timesheets ID stop params +func (o *PatchAPITimesheetsIDStopParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API timesheets ID stop params +func (o *PatchAPITimesheetsIDStopParams) WithContext(ctx context.Context) *PatchAPITimesheetsIDStopParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API timesheets ID stop params +func (o *PatchAPITimesheetsIDStopParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API timesheets ID stop params +func (o *PatchAPITimesheetsIDStopParams) WithHTTPClient(client *http.Client) *PatchAPITimesheetsIDStopParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API timesheets ID stop params +func (o *PatchAPITimesheetsIDStopParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the patch API timesheets ID stop params +func (o *PatchAPITimesheetsIDStopParams) WithID(id int64) *PatchAPITimesheetsIDStopParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API timesheets ID stop params +func (o *PatchAPITimesheetsIDStopParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPITimesheetsIDStopParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/timesheet/patch_api_timesheets_id_stop_responses.go b/client/timesheet/patch_api_timesheets_id_stop_responses.go new file mode 100644 index 0000000..dd8a0c0 --- /dev/null +++ b/client/timesheet/patch_api_timesheets_id_stop_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPITimesheetsIDStopReader is a Reader for the PatchAPITimesheetsIDStop structure. +type PatchAPITimesheetsIDStopReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPITimesheetsIDStopReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPITimesheetsIDStopOK() + 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()) + } +} + +// NewPatchAPITimesheetsIDStopOK creates a PatchAPITimesheetsIDStopOK with default headers values +func NewPatchAPITimesheetsIDStopOK() *PatchAPITimesheetsIDStopOK { + return &PatchAPITimesheetsIDStopOK{} +} + +/* +PatchAPITimesheetsIDStopOK describes a response with status code 200, with default header values. + +Stops an active timesheet record and returns it afterwards. +*/ +type PatchAPITimesheetsIDStopOK struct { + Payload *models.TimesheetEntity +} + +// IsSuccess returns true when this patch Api timesheets Id stop o k response has a 2xx status code +func (o *PatchAPITimesheetsIDStopOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api timesheets Id stop o k response has a 3xx status code +func (o *PatchAPITimesheetsIDStopOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api timesheets Id stop o k response has a 4xx status code +func (o *PatchAPITimesheetsIDStopOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api timesheets Id stop o k response has a 5xx status code +func (o *PatchAPITimesheetsIDStopOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api timesheets Id stop o k response a status code equal to that given +func (o *PatchAPITimesheetsIDStopOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPITimesheetsIDStopOK) Error() string { + return fmt.Sprintf("[PATCH /api/timesheets/{id}/stop][%d] patchApiTimesheetsIdStopOK %+v", 200, o.Payload) +} + +func (o *PatchAPITimesheetsIDStopOK) String() string { + return fmt.Sprintf("[PATCH /api/timesheets/{id}/stop][%d] patchApiTimesheetsIdStopOK %+v", 200, o.Payload) +} + +func (o *PatchAPITimesheetsIDStopOK) GetPayload() *models.TimesheetEntity { + return o.Payload +} + +func (o *PatchAPITimesheetsIDStopOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TimesheetEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/timesheet/post_api_timesheets_parameters.go b/client/timesheet/post_api_timesheets_parameters.go new file mode 100644 index 0000000..df75b79 --- /dev/null +++ b/client/timesheet/post_api_timesheets_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPostAPITimesheetsParams creates a new PostAPITimesheetsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPITimesheetsParams() *PostAPITimesheetsParams { + return &PostAPITimesheetsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPITimesheetsParamsWithTimeout creates a new PostAPITimesheetsParams object +// with the ability to set a timeout on a request. +func NewPostAPITimesheetsParamsWithTimeout(timeout time.Duration) *PostAPITimesheetsParams { + return &PostAPITimesheetsParams{ + timeout: timeout, + } +} + +// NewPostAPITimesheetsParamsWithContext creates a new PostAPITimesheetsParams object +// with the ability to set a context for a request. +func NewPostAPITimesheetsParamsWithContext(ctx context.Context) *PostAPITimesheetsParams { + return &PostAPITimesheetsParams{ + Context: ctx, + } +} + +// NewPostAPITimesheetsParamsWithHTTPClient creates a new PostAPITimesheetsParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPITimesheetsParamsWithHTTPClient(client *http.Client) *PostAPITimesheetsParams { + return &PostAPITimesheetsParams{ + HTTPClient: client, + } +} + +/* +PostAPITimesheetsParams contains all the parameters to send to the API endpoint + + for the post API timesheets operation. + + Typically these are written to a http.Request. +*/ +type PostAPITimesheetsParams struct { + + // Body. + Body *models.TimesheetEditForm + + /* Full. + + Allows to fetch fully serialized objects including subresources (TimesheetEntityExpanded). Allowed values: true (default: false) + */ + Full string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API timesheets params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITimesheetsParams) WithDefaults() *PostAPITimesheetsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API timesheets params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPITimesheetsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API timesheets params +func (o *PostAPITimesheetsParams) WithTimeout(timeout time.Duration) *PostAPITimesheetsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API timesheets params +func (o *PostAPITimesheetsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API timesheets params +func (o *PostAPITimesheetsParams) WithContext(ctx context.Context) *PostAPITimesheetsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API timesheets params +func (o *PostAPITimesheetsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API timesheets params +func (o *PostAPITimesheetsParams) WithHTTPClient(client *http.Client) *PostAPITimesheetsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API timesheets params +func (o *PostAPITimesheetsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API timesheets params +func (o *PostAPITimesheetsParams) WithBody(body *models.TimesheetEditForm) *PostAPITimesheetsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API timesheets params +func (o *PostAPITimesheetsParams) SetBody(body *models.TimesheetEditForm) { + o.Body = body +} + +// WithFull adds the full to the post API timesheets params +func (o *PostAPITimesheetsParams) WithFull(full string) *PostAPITimesheetsParams { + o.SetFull(full) + return o +} + +// SetFull adds the full to the post API timesheets params +func (o *PostAPITimesheetsParams) SetFull(full string) { + o.Full = full +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPITimesheetsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // query param full + qrFull := o.Full + qFull := qrFull + + if err := r.SetQueryParam("full", qFull); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/timesheet/post_api_timesheets_responses.go b/client/timesheet/post_api_timesheets_responses.go new file mode 100644 index 0000000..9637b9e --- /dev/null +++ b/client/timesheet/post_api_timesheets_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPITimesheetsReader is a Reader for the PostAPITimesheets structure. +type PostAPITimesheetsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPITimesheetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPITimesheetsOK() + 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()) + } +} + +// NewPostAPITimesheetsOK creates a PostAPITimesheetsOK with default headers values +func NewPostAPITimesheetsOK() *PostAPITimesheetsOK { + return &PostAPITimesheetsOK{} +} + +/* +PostAPITimesheetsOK describes a response with status code 200, with default header values. + +Returns the new created timesheet +*/ +type PostAPITimesheetsOK struct { + Payload *models.TimesheetEntity +} + +// IsSuccess returns true when this post Api timesheets o k response has a 2xx status code +func (o *PostAPITimesheetsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api timesheets o k response has a 3xx status code +func (o *PostAPITimesheetsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api timesheets o k response has a 4xx status code +func (o *PostAPITimesheetsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api timesheets o k response has a 5xx status code +func (o *PostAPITimesheetsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api timesheets o k response a status code equal to that given +func (o *PostAPITimesheetsOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPITimesheetsOK) Error() string { + return fmt.Sprintf("[POST /api/timesheets][%d] postApiTimesheetsOK %+v", 200, o.Payload) +} + +func (o *PostAPITimesheetsOK) String() string { + return fmt.Sprintf("[POST /api/timesheets][%d] postApiTimesheetsOK %+v", 200, o.Payload) +} + +func (o *PostAPITimesheetsOK) GetPayload() *models.TimesheetEntity { + return o.Payload +} + +func (o *PostAPITimesheetsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TimesheetEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/timesheet/timesheet_client.go b/client/timesheet/timesheet_client.go new file mode 100644 index 0000000..66572ec --- /dev/null +++ b/client/timesheet/timesheet_client.go @@ -0,0 +1,535 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package timesheet + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new timesheet API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for timesheet API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DeleteAPITimesheetsID(params *DeleteAPITimesheetsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITimesheetsIDNoContent, error) + + GetAPITimesheets(params *GetAPITimesheetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsOK, error) + + GetAPITimesheetsActive(params *GetAPITimesheetsActiveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsActiveOK, error) + + GetAPITimesheetsID(params *GetAPITimesheetsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsIDOK, error) + + GetAPITimesheetsRecent(params *GetAPITimesheetsRecentParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsRecentOK, error) + + PatchAPITimesheetsID(params *PatchAPITimesheetsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDOK, error) + + PatchAPITimesheetsIDDuplicate(params *PatchAPITimesheetsIDDuplicateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDDuplicateOK, error) + + PatchAPITimesheetsIDExport(params *PatchAPITimesheetsIDExportParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDExportOK, error) + + PatchAPITimesheetsIDMeta(params *PatchAPITimesheetsIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDMetaOK, error) + + PatchAPITimesheetsIDRestart(params *PatchAPITimesheetsIDRestartParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDRestartOK, error) + + PatchAPITimesheetsIDStop(params *PatchAPITimesheetsIDStopParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDStopOK, error) + + PostAPITimesheets(params *PostAPITimesheetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITimesheetsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DeleteAPITimesheetsID deletes an existing timesheet record +*/ +func (a *Client) DeleteAPITimesheetsID(params *DeleteAPITimesheetsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITimesheetsIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAPITimesheetsIDParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteAPITimesheetsID", + Method: "DELETE", + PathPattern: "/api/timesheets/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteAPITimesheetsIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteAPITimesheetsIDNoContent) + 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 DeleteAPITimesheetsID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPITimesheets returns a collection of timesheet records +*/ +func (a *Client) GetAPITimesheets(params *GetAPITimesheetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPITimesheetsParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPITimesheets", + Method: "GET", + PathPattern: "/api/timesheets", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPITimesheetsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPITimesheetsOK) + 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 GetAPITimesheets: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPITimesheetsActive returns the collection of active timesheet records +*/ +func (a *Client) GetAPITimesheetsActive(params *GetAPITimesheetsActiveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsActiveOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPITimesheetsActiveParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPITimesheetsActive", + Method: "GET", + PathPattern: "/api/timesheets/active", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPITimesheetsActiveReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPITimesheetsActiveOK) + 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 GetAPITimesheetsActive: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPITimesheetsID returns one timesheet record +*/ +func (a *Client) GetAPITimesheetsID(params *GetAPITimesheetsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPITimesheetsIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPITimesheetsID", + Method: "GET", + PathPattern: "/api/timesheets/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPITimesheetsIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPITimesheetsIDOK) + 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 GetAPITimesheetsID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPITimesheetsRecent returns the collection of recent user activities +*/ +func (a *Client) GetAPITimesheetsRecent(params *GetAPITimesheetsRecentParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsRecentOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPITimesheetsRecentParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPITimesheetsRecent", + Method: "GET", + PathPattern: "/api/timesheets/recent", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPITimesheetsRecentReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPITimesheetsRecentOK) + 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 GetAPITimesheetsRecent: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITimesheetsID updates an existing timesheet record + +Update an existing timesheet record, you can pass all or just a subset of the attributes. +*/ +func (a *Client) PatchAPITimesheetsID(params *PatchAPITimesheetsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITimesheetsIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITimesheetsID", + Method: "PATCH", + PathPattern: "/api/timesheets/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITimesheetsIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITimesheetsIDOK) + 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 PatchAPITimesheetsID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITimesheetsIDDuplicate duplicates an existing timesheet record +*/ +func (a *Client) PatchAPITimesheetsIDDuplicate(params *PatchAPITimesheetsIDDuplicateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDDuplicateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITimesheetsIDDuplicateParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITimesheetsIDDuplicate", + Method: "PATCH", + PathPattern: "/api/timesheets/{id}/duplicate", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITimesheetsIDDuplicateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITimesheetsIDDuplicateOK) + 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 PatchAPITimesheetsIDDuplicate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITimesheetsIDExport switches the export state of a timesheet record to un lock it +*/ +func (a *Client) PatchAPITimesheetsIDExport(params *PatchAPITimesheetsIDExportParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDExportOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITimesheetsIDExportParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITimesheetsIDExport", + Method: "PATCH", + PathPattern: "/api/timesheets/{id}/export", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITimesheetsIDExportReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITimesheetsIDExportOK) + 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 PatchAPITimesheetsIDExport: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITimesheetsIDMeta sets the value of a meta field for an existing timesheet +*/ +func (a *Client) PatchAPITimesheetsIDMeta(params *PatchAPITimesheetsIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDMetaOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITimesheetsIDMetaParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITimesheetsIDMeta", + Method: "PATCH", + PathPattern: "/api/timesheets/{id}/meta", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITimesheetsIDMetaReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITimesheetsIDMetaOK) + 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 PatchAPITimesheetsIDMeta: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITimesheetsIDRestart restarts a previously stopped timesheet record for the current user +*/ +func (a *Client) PatchAPITimesheetsIDRestart(params *PatchAPITimesheetsIDRestartParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDRestartOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITimesheetsIDRestartParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITimesheetsIDRestart", + Method: "PATCH", + PathPattern: "/api/timesheets/{id}/restart", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITimesheetsIDRestartReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITimesheetsIDRestartOK) + 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 PatchAPITimesheetsIDRestart: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPITimesheetsIDStop stops an active timesheet record +*/ +func (a *Client) PatchAPITimesheetsIDStop(params *PatchAPITimesheetsIDStopParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDStopOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPITimesheetsIDStopParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPITimesheetsIDStop", + Method: "PATCH", + PathPattern: "/api/timesheets/{id}/stop", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPITimesheetsIDStopReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPITimesheetsIDStopOK) + 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 PatchAPITimesheetsIDStop: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPITimesheets creates a new timesheet record + +Creates a new timesheet record for the current user and returns it afterwards. +*/ +func (a *Client) PostAPITimesheets(params *PostAPITimesheetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITimesheetsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPITimesheetsParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPITimesheets", + Method: "POST", + PathPattern: "/api/timesheets", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPITimesheetsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPITimesheetsOK) + 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 PostAPITimesheets: 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/user/get_api_users_id_parameters.go b/client/user/get_api_users_id_parameters.go new file mode 100644 index 0000000..08c2524 --- /dev/null +++ b/client/user/get_api_users_id_parameters.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" +) + +// NewGetAPIUsersIDParams creates a new GetAPIUsersIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIUsersIDParams() *GetAPIUsersIDParams { + return &GetAPIUsersIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIUsersIDParamsWithTimeout creates a new GetAPIUsersIDParams object +// with the ability to set a timeout on a request. +func NewGetAPIUsersIDParamsWithTimeout(timeout time.Duration) *GetAPIUsersIDParams { + return &GetAPIUsersIDParams{ + timeout: timeout, + } +} + +// NewGetAPIUsersIDParamsWithContext creates a new GetAPIUsersIDParams object +// with the ability to set a context for a request. +func NewGetAPIUsersIDParamsWithContext(ctx context.Context) *GetAPIUsersIDParams { + return &GetAPIUsersIDParams{ + Context: ctx, + } +} + +// NewGetAPIUsersIDParamsWithHTTPClient creates a new GetAPIUsersIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIUsersIDParamsWithHTTPClient(client *http.Client) *GetAPIUsersIDParams { + return &GetAPIUsersIDParams{ + HTTPClient: client, + } +} + +/* +GetAPIUsersIDParams contains all the parameters to send to the API endpoint + + for the get API users ID operation. + + Typically these are written to a http.Request. +*/ +type GetAPIUsersIDParams struct { + + /* ID. + + User ID to fetch + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API users ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIUsersIDParams) WithDefaults() *GetAPIUsersIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API users ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIUsersIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API users ID params +func (o *GetAPIUsersIDParams) WithTimeout(timeout time.Duration) *GetAPIUsersIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API users ID params +func (o *GetAPIUsersIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API users ID params +func (o *GetAPIUsersIDParams) WithContext(ctx context.Context) *GetAPIUsersIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API users ID params +func (o *GetAPIUsersIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API users ID params +func (o *GetAPIUsersIDParams) WithHTTPClient(client *http.Client) *GetAPIUsersIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API users ID params +func (o *GetAPIUsersIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get API users ID params +func (o *GetAPIUsersIDParams) WithID(id int64) *GetAPIUsersIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get API users ID params +func (o *GetAPIUsersIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIUsersIDParams) 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.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/user/get_api_users_id_responses.go b/client/user/get_api_users_id_responses.go new file mode 100644 index 0000000..11e2b53 --- /dev/null +++ b/client/user/get_api_users_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIUsersIDReader is a Reader for the GetAPIUsersID structure. +type GetAPIUsersIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIUsersIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIUsersIDOK() + 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()) + } +} + +// NewGetAPIUsersIDOK creates a GetAPIUsersIDOK with default headers values +func NewGetAPIUsersIDOK() *GetAPIUsersIDOK { + return &GetAPIUsersIDOK{} +} + +/* +GetAPIUsersIDOK describes a response with status code 200, with default header values. + +Return one user entity. +*/ +type GetAPIUsersIDOK struct { + Payload *models.UserEntity +} + +// IsSuccess returns true when this get Api users Id o k response has a 2xx status code +func (o *GetAPIUsersIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api users Id o k response has a 3xx status code +func (o *GetAPIUsersIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api users Id o k response has a 4xx status code +func (o *GetAPIUsersIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api users Id o k response has a 5xx status code +func (o *GetAPIUsersIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api users Id o k response a status code equal to that given +func (o *GetAPIUsersIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIUsersIDOK) Error() string { + return fmt.Sprintf("[GET /api/users/{id}][%d] getApiUsersIdOK %+v", 200, o.Payload) +} + +func (o *GetAPIUsersIDOK) String() string { + return fmt.Sprintf("[GET /api/users/{id}][%d] getApiUsersIdOK %+v", 200, o.Payload) +} + +func (o *GetAPIUsersIDOK) GetPayload() *models.UserEntity { + return o.Payload +} + +func (o *GetAPIUsersIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.UserEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/user/get_api_users_me_parameters.go b/client/user/get_api_users_me_parameters.go new file mode 100644 index 0000000..38bc765 --- /dev/null +++ b/client/user/get_api_users_me_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" +) + +// NewGetAPIUsersMeParams creates a new GetAPIUsersMeParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIUsersMeParams() *GetAPIUsersMeParams { + return &GetAPIUsersMeParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIUsersMeParamsWithTimeout creates a new GetAPIUsersMeParams object +// with the ability to set a timeout on a request. +func NewGetAPIUsersMeParamsWithTimeout(timeout time.Duration) *GetAPIUsersMeParams { + return &GetAPIUsersMeParams{ + timeout: timeout, + } +} + +// NewGetAPIUsersMeParamsWithContext creates a new GetAPIUsersMeParams object +// with the ability to set a context for a request. +func NewGetAPIUsersMeParamsWithContext(ctx context.Context) *GetAPIUsersMeParams { + return &GetAPIUsersMeParams{ + Context: ctx, + } +} + +// NewGetAPIUsersMeParamsWithHTTPClient creates a new GetAPIUsersMeParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIUsersMeParamsWithHTTPClient(client *http.Client) *GetAPIUsersMeParams { + return &GetAPIUsersMeParams{ + HTTPClient: client, + } +} + +/* +GetAPIUsersMeParams contains all the parameters to send to the API endpoint + + for the get API users me operation. + + Typically these are written to a http.Request. +*/ +type GetAPIUsersMeParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API users me params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIUsersMeParams) WithDefaults() *GetAPIUsersMeParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API users me params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIUsersMeParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API users me params +func (o *GetAPIUsersMeParams) WithTimeout(timeout time.Duration) *GetAPIUsersMeParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API users me params +func (o *GetAPIUsersMeParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API users me params +func (o *GetAPIUsersMeParams) WithContext(ctx context.Context) *GetAPIUsersMeParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API users me params +func (o *GetAPIUsersMeParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API users me params +func (o *GetAPIUsersMeParams) WithHTTPClient(client *http.Client) *GetAPIUsersMeParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API users me params +func (o *GetAPIUsersMeParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIUsersMeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/user/get_api_users_me_responses.go b/client/user/get_api_users_me_responses.go new file mode 100644 index 0000000..c217778 --- /dev/null +++ b/client/user/get_api_users_me_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIUsersMeReader is a Reader for the GetAPIUsersMe structure. +type GetAPIUsersMeReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIUsersMeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIUsersMeOK() + 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()) + } +} + +// NewGetAPIUsersMeOK creates a GetAPIUsersMeOK with default headers values +func NewGetAPIUsersMeOK() *GetAPIUsersMeOK { + return &GetAPIUsersMeOK{} +} + +/* +GetAPIUsersMeOK describes a response with status code 200, with default header values. + +Return the current user entity. +*/ +type GetAPIUsersMeOK struct { + Payload *models.UserEntity +} + +// IsSuccess returns true when this get Api users me o k response has a 2xx status code +func (o *GetAPIUsersMeOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api users me o k response has a 3xx status code +func (o *GetAPIUsersMeOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api users me o k response has a 4xx status code +func (o *GetAPIUsersMeOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api users me o k response has a 5xx status code +func (o *GetAPIUsersMeOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api users me o k response a status code equal to that given +func (o *GetAPIUsersMeOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIUsersMeOK) Error() string { + return fmt.Sprintf("[GET /api/users/me][%d] getApiUsersMeOK %+v", 200, o.Payload) +} + +func (o *GetAPIUsersMeOK) String() string { + return fmt.Sprintf("[GET /api/users/me][%d] getApiUsersMeOK %+v", 200, o.Payload) +} + +func (o *GetAPIUsersMeOK) GetPayload() *models.UserEntity { + return o.Payload +} + +func (o *GetAPIUsersMeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.UserEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/user/get_api_users_parameters.go b/client/user/get_api_users_parameters.go new file mode 100644 index 0000000..3097901 --- /dev/null +++ b/client/user/get_api_users_parameters.go @@ -0,0 +1,238 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" +) + +// NewGetAPIUsersParams creates a new GetAPIUsersParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAPIUsersParams() *GetAPIUsersParams { + return &GetAPIUsersParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAPIUsersParamsWithTimeout creates a new GetAPIUsersParams object +// with the ability to set a timeout on a request. +func NewGetAPIUsersParamsWithTimeout(timeout time.Duration) *GetAPIUsersParams { + return &GetAPIUsersParams{ + timeout: timeout, + } +} + +// NewGetAPIUsersParamsWithContext creates a new GetAPIUsersParams object +// with the ability to set a context for a request. +func NewGetAPIUsersParamsWithContext(ctx context.Context) *GetAPIUsersParams { + return &GetAPIUsersParams{ + Context: ctx, + } +} + +// NewGetAPIUsersParamsWithHTTPClient creates a new GetAPIUsersParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAPIUsersParamsWithHTTPClient(client *http.Client) *GetAPIUsersParams { + return &GetAPIUsersParams{ + HTTPClient: client, + } +} + +/* +GetAPIUsersParams contains all the parameters to send to the API endpoint + + for the get API users operation. + + Typically these are written to a http.Request. +*/ +type GetAPIUsersParams struct { + + /* Order. + + The result order. Allowed values: ASC, DESC (default: ASC) + */ + Order string + + /* OrderBy. + + The field by which results will be ordered. Allowed values: id, username, alias, email (default: username) + */ + OrderBy string + + /* Term. + + Free search term + */ + Term *string + + /* Visible. + + Visibility status to filter users. Allowed values: 1=visible, 2=hidden, 3=all (default: 1) + */ + Visible string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get API users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIUsersParams) WithDefaults() *GetAPIUsersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get API users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAPIUsersParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get API users params +func (o *GetAPIUsersParams) WithTimeout(timeout time.Duration) *GetAPIUsersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get API users params +func (o *GetAPIUsersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get API users params +func (o *GetAPIUsersParams) WithContext(ctx context.Context) *GetAPIUsersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get API users params +func (o *GetAPIUsersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get API users params +func (o *GetAPIUsersParams) WithHTTPClient(client *http.Client) *GetAPIUsersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get API users params +func (o *GetAPIUsersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithOrder adds the order to the get API users params +func (o *GetAPIUsersParams) WithOrder(order string) *GetAPIUsersParams { + o.SetOrder(order) + return o +} + +// SetOrder adds the order to the get API users params +func (o *GetAPIUsersParams) SetOrder(order string) { + o.Order = order +} + +// WithOrderBy adds the orderBy to the get API users params +func (o *GetAPIUsersParams) WithOrderBy(orderBy string) *GetAPIUsersParams { + o.SetOrderBy(orderBy) + return o +} + +// SetOrderBy adds the orderBy to the get API users params +func (o *GetAPIUsersParams) SetOrderBy(orderBy string) { + o.OrderBy = orderBy +} + +// WithTerm adds the term to the get API users params +func (o *GetAPIUsersParams) WithTerm(term *string) *GetAPIUsersParams { + o.SetTerm(term) + return o +} + +// SetTerm adds the term to the get API users params +func (o *GetAPIUsersParams) SetTerm(term *string) { + o.Term = term +} + +// WithVisible adds the visible to the get API users params +func (o *GetAPIUsersParams) WithVisible(visible string) *GetAPIUsersParams { + o.SetVisible(visible) + return o +} + +// SetVisible adds the visible to the get API users params +func (o *GetAPIUsersParams) SetVisible(visible string) { + o.Visible = visible +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAPIUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param order + qrOrder := o.Order + qOrder := qrOrder + + if err := r.SetQueryParam("order", qOrder); err != nil { + return err + } + + // query param orderBy + qrOrderBy := o.OrderBy + qOrderBy := qrOrderBy + + if err := r.SetQueryParam("orderBy", qOrderBy); err != nil { + return err + } + + if o.Term != nil { + + // query param term + var qrTerm string + + if o.Term != nil { + qrTerm = *o.Term + } + qTerm := qrTerm + if qTerm != "" { + + if err := r.SetQueryParam("term", qTerm); err != nil { + return err + } + } + } + + // query param visible + qrVisible := o.Visible + qVisible := qrVisible + + if err := r.SetQueryParam("visible", qVisible); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/user/get_api_users_responses.go b/client/user/get_api_users_responses.go new file mode 100644 index 0000000..d3e5d7c --- /dev/null +++ b/client/user/get_api_users_responses.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" + + "decentral1se/go-kimai/models" +) + +// GetAPIUsersReader is a Reader for the GetAPIUsers structure. +type GetAPIUsersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAPIUsersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAPIUsersOK() + 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()) + } +} + +// NewGetAPIUsersOK creates a GetAPIUsersOK with default headers values +func NewGetAPIUsersOK() *GetAPIUsersOK { + return &GetAPIUsersOK{} +} + +/* +GetAPIUsersOK describes a response with status code 200, with default header values. + +Returns the collection of all registered users. Required permission: view_user +*/ +type GetAPIUsersOK struct { + Payload []*models.UserCollection +} + +// IsSuccess returns true when this get Api users o k response has a 2xx status code +func (o *GetAPIUsersOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get Api users o k response has a 3xx status code +func (o *GetAPIUsersOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get Api users o k response has a 4xx status code +func (o *GetAPIUsersOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get Api users o k response has a 5xx status code +func (o *GetAPIUsersOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get Api users o k response a status code equal to that given +func (o *GetAPIUsersOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAPIUsersOK) Error() string { + return fmt.Sprintf("[GET /api/users][%d] getApiUsersOK %+v", 200, o.Payload) +} + +func (o *GetAPIUsersOK) String() string { + return fmt.Sprintf("[GET /api/users][%d] getApiUsersOK %+v", 200, o.Payload) +} + +func (o *GetAPIUsersOK) GetPayload() []*models.UserCollection { + return o.Payload +} + +func (o *GetAPIUsersOK) 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/user/patch_api_users_id_parameters.go b/client/user/patch_api_users_id_parameters.go new file mode 100644 index 0000000..dbb42ad --- /dev/null +++ b/client/user/patch_api_users_id_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPatchAPIUsersIDParams creates a new PatchAPIUsersIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPatchAPIUsersIDParams() *PatchAPIUsersIDParams { + return &PatchAPIUsersIDParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAPIUsersIDParamsWithTimeout creates a new PatchAPIUsersIDParams object +// with the ability to set a timeout on a request. +func NewPatchAPIUsersIDParamsWithTimeout(timeout time.Duration) *PatchAPIUsersIDParams { + return &PatchAPIUsersIDParams{ + timeout: timeout, + } +} + +// NewPatchAPIUsersIDParamsWithContext creates a new PatchAPIUsersIDParams object +// with the ability to set a context for a request. +func NewPatchAPIUsersIDParamsWithContext(ctx context.Context) *PatchAPIUsersIDParams { + return &PatchAPIUsersIDParams{ + Context: ctx, + } +} + +// NewPatchAPIUsersIDParamsWithHTTPClient creates a new PatchAPIUsersIDParams object +// with the ability to set a custom HTTPClient for a request. +func NewPatchAPIUsersIDParamsWithHTTPClient(client *http.Client) *PatchAPIUsersIDParams { + return &PatchAPIUsersIDParams{ + HTTPClient: client, + } +} + +/* +PatchAPIUsersIDParams contains all the parameters to send to the API endpoint + + for the patch API users ID operation. + + Typically these are written to a http.Request. +*/ +type PatchAPIUsersIDParams struct { + + // Body. + Body *models.UserEditForm + + /* ID. + + User ID to update + */ + ID int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the patch API users ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIUsersIDParams) WithDefaults() *PatchAPIUsersIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the patch API users ID params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PatchAPIUsersIDParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the patch API users ID params +func (o *PatchAPIUsersIDParams) WithTimeout(timeout time.Duration) *PatchAPIUsersIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch API users ID params +func (o *PatchAPIUsersIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch API users ID params +func (o *PatchAPIUsersIDParams) WithContext(ctx context.Context) *PatchAPIUsersIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch API users ID params +func (o *PatchAPIUsersIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch API users ID params +func (o *PatchAPIUsersIDParams) WithHTTPClient(client *http.Client) *PatchAPIUsersIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch API users ID params +func (o *PatchAPIUsersIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch API users ID params +func (o *PatchAPIUsersIDParams) WithBody(body *models.UserEditForm) *PatchAPIUsersIDParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch API users ID params +func (o *PatchAPIUsersIDParams) SetBody(body *models.UserEditForm) { + o.Body = body +} + +// WithID adds the id to the patch API users ID params +func (o *PatchAPIUsersIDParams) WithID(id int64) *PatchAPIUsersIDParams { + o.SetID(id) + return o +} + +// SetID adds the id to the patch API users ID params +func (o *PatchAPIUsersIDParams) SetID(id int64) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAPIUsersIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/user/patch_api_users_id_responses.go b/client/user/patch_api_users_id_responses.go new file mode 100644 index 0000000..c39889c --- /dev/null +++ b/client/user/patch_api_users_id_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" + + "decentral1se/go-kimai/models" +) + +// PatchAPIUsersIDReader is a Reader for the PatchAPIUsersID structure. +type PatchAPIUsersIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAPIUsersIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPatchAPIUsersIDOK() + 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()) + } +} + +// NewPatchAPIUsersIDOK creates a PatchAPIUsersIDOK with default headers values +func NewPatchAPIUsersIDOK() *PatchAPIUsersIDOK { + return &PatchAPIUsersIDOK{} +} + +/* +PatchAPIUsersIDOK describes a response with status code 200, with default header values. + +Returns the updated user +*/ +type PatchAPIUsersIDOK struct { + Payload *models.UserEntity +} + +// IsSuccess returns true when this patch Api users Id o k response has a 2xx status code +func (o *PatchAPIUsersIDOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this patch Api users Id o k response has a 3xx status code +func (o *PatchAPIUsersIDOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this patch Api users Id o k response has a 4xx status code +func (o *PatchAPIUsersIDOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this patch Api users Id o k response has a 5xx status code +func (o *PatchAPIUsersIDOK) IsServerError() bool { + return false +} + +// IsCode returns true when this patch Api users Id o k response a status code equal to that given +func (o *PatchAPIUsersIDOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PatchAPIUsersIDOK) Error() string { + return fmt.Sprintf("[PATCH /api/users/{id}][%d] patchApiUsersIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPIUsersIDOK) String() string { + return fmt.Sprintf("[PATCH /api/users/{id}][%d] patchApiUsersIdOK %+v", 200, o.Payload) +} + +func (o *PatchAPIUsersIDOK) GetPayload() *models.UserEntity { + return o.Payload +} + +func (o *PatchAPIUsersIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.UserEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/user/post_api_users_parameters.go b/client/user/post_api_users_parameters.go new file mode 100644 index 0000000..4cbc636 --- /dev/null +++ b/client/user/post_api_users_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" + + "decentral1se/go-kimai/models" +) + +// NewPostAPIUsersParams creates a new PostAPIUsersParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewPostAPIUsersParams() *PostAPIUsersParams { + return &PostAPIUsersParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPostAPIUsersParamsWithTimeout creates a new PostAPIUsersParams object +// with the ability to set a timeout on a request. +func NewPostAPIUsersParamsWithTimeout(timeout time.Duration) *PostAPIUsersParams { + return &PostAPIUsersParams{ + timeout: timeout, + } +} + +// NewPostAPIUsersParamsWithContext creates a new PostAPIUsersParams object +// with the ability to set a context for a request. +func NewPostAPIUsersParamsWithContext(ctx context.Context) *PostAPIUsersParams { + return &PostAPIUsersParams{ + Context: ctx, + } +} + +// NewPostAPIUsersParamsWithHTTPClient creates a new PostAPIUsersParams object +// with the ability to set a custom HTTPClient for a request. +func NewPostAPIUsersParamsWithHTTPClient(client *http.Client) *PostAPIUsersParams { + return &PostAPIUsersParams{ + HTTPClient: client, + } +} + +/* +PostAPIUsersParams contains all the parameters to send to the API endpoint + + for the post API users operation. + + Typically these are written to a http.Request. +*/ +type PostAPIUsersParams struct { + + // Body. + Body *models.UserCreateForm + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the post API users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIUsersParams) WithDefaults() *PostAPIUsersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post API users params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostAPIUsersParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the post API users params +func (o *PostAPIUsersParams) WithTimeout(timeout time.Duration) *PostAPIUsersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post API users params +func (o *PostAPIUsersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post API users params +func (o *PostAPIUsersParams) WithContext(ctx context.Context) *PostAPIUsersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post API users params +func (o *PostAPIUsersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post API users params +func (o *PostAPIUsersParams) WithHTTPClient(client *http.Client) *PostAPIUsersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post API users params +func (o *PostAPIUsersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the post API users params +func (o *PostAPIUsersParams) WithBody(body *models.UserCreateForm) *PostAPIUsersParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the post API users params +func (o *PostAPIUsersParams) SetBody(body *models.UserCreateForm) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAPIUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/user/post_api_users_responses.go b/client/user/post_api_users_responses.go new file mode 100644 index 0000000..c6c5efd --- /dev/null +++ b/client/user/post_api_users_responses.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" + + "decentral1se/go-kimai/models" +) + +// PostAPIUsersReader is a Reader for the PostAPIUsers structure. +type PostAPIUsersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAPIUsersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPostAPIUsersOK() + 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()) + } +} + +// NewPostAPIUsersOK creates a PostAPIUsersOK with default headers values +func NewPostAPIUsersOK() *PostAPIUsersOK { + return &PostAPIUsersOK{} +} + +/* +PostAPIUsersOK describes a response with status code 200, with default header values. + +Returns the new created user +*/ +type PostAPIUsersOK struct { + Payload *models.UserEntity +} + +// IsSuccess returns true when this post Api users o k response has a 2xx status code +func (o *PostAPIUsersOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this post Api users o k response has a 3xx status code +func (o *PostAPIUsersOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this post Api users o k response has a 4xx status code +func (o *PostAPIUsersOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this post Api users o k response has a 5xx status code +func (o *PostAPIUsersOK) IsServerError() bool { + return false +} + +// IsCode returns true when this post Api users o k response a status code equal to that given +func (o *PostAPIUsersOK) IsCode(code int) bool { + return code == 200 +} + +func (o *PostAPIUsersOK) Error() string { + return fmt.Sprintf("[POST /api/users][%d] postApiUsersOK %+v", 200, o.Payload) +} + +func (o *PostAPIUsersOK) String() string { + return fmt.Sprintf("[POST /api/users][%d] postApiUsersOK %+v", 200, o.Payload) +} + +func (o *PostAPIUsersOK) GetPayload() *models.UserEntity { + return o.Payload +} + +func (o *PostAPIUsersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.UserEntity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/user/user_client.go b/client/user/user_client.go new file mode 100644 index 0000000..7259f4e --- /dev/null +++ b/client/user/user_client.go @@ -0,0 +1,248 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new user API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for user API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetAPIUsers(params *GetAPIUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIUsersOK, error) + + GetAPIUsersID(params *GetAPIUsersIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIUsersIDOK, error) + + GetAPIUsersMe(params *GetAPIUsersMeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIUsersMeOK, error) + + PatchAPIUsersID(params *PatchAPIUsersIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIUsersIDOK, error) + + PostAPIUsers(params *PostAPIUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIUsersOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetAPIUsers returns the collection of all registered users +*/ +func (a *Client) GetAPIUsers(params *GetAPIUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIUsersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIUsersParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIUsers", + Method: "GET", + PathPattern: "/api/users", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIUsersReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIUsersOK) + 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 GetAPIUsers: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIUsersID returns one user entity +*/ +func (a *Client) GetAPIUsersID(params *GetAPIUsersIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIUsersIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIUsersIDParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIUsersID", + Method: "GET", + PathPattern: "/api/users/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIUsersIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIUsersIDOK) + 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 GetAPIUsersID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +GetAPIUsersMe returns the current user entity +*/ +func (a *Client) GetAPIUsersMe(params *GetAPIUsersMeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIUsersMeOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAPIUsersMeParams() + } + op := &runtime.ClientOperation{ + ID: "GetAPIUsersMe", + Method: "GET", + PathPattern: "/api/users/me", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAPIUsersMeReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAPIUsersMeOK) + 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 GetAPIUsersMe: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PatchAPIUsersID updates an existing user + +Update an existing user, you can pass all or just a subset of all attributes (passing roles will replace all existing ones) +*/ +func (a *Client) PatchAPIUsersID(params *PatchAPIUsersIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIUsersIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAPIUsersIDParams() + } + op := &runtime.ClientOperation{ + ID: "PatchAPIUsersID", + Method: "PATCH", + PathPattern: "/api/users/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PatchAPIUsersIDReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PatchAPIUsersIDOK) + 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 PatchAPIUsersID: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PostAPIUsers creates a new user + +Creates a new user and returns it afterwards +*/ +func (a *Client) PostAPIUsers(params *PostAPIUsersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIUsersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAPIUsersParams() + } + op := &runtime.ClientOperation{ + ID: "PostAPIUsers", + Method: "POST", + PathPattern: "/api/users", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PostAPIUsersReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PostAPIUsersOK) + 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 PostAPIUsers: 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/doc.json b/doc.json new file mode 100644 index 0000000..b9e8631 --- /dev/null +++ b/doc.json @@ -0,0 +1,5959 @@ +{ + "swagger": "2.0", + "info": { + "title": "Kimai - API Docs", + "description": "JSON API for the Kimai time-tracking software: [API documentation](https://www.kimai.org/documentation/rest-api.html), [Swagger definition file](doc.json)\n", + "version": "0.6" + }, + "paths": { + "/api/activities/{id}/meta": { + "patch": { + "summary": "Sets the value of a meta-field for an existing activity", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Activity record ID to set the meta-field value for", + "type": "integer" + }, + { + "name": "body", + "in": "body", + "schema": { + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "The meta-field name", + "type": "string" + }, + "value": { + "description": "The meta-field value", + "type": "string" + } + }, + "type": "object" + } + } + ], + "responses": { + "200": { + "description": "Sets the value of an existing/configured meta-field. You cannot create unknown meta-fields, if the given name is not a configured meta-field, this will return an exception.", + "schema": { + "$ref": "#/definitions/ActivityEntity" + } + } + }, + "tags": [ + "Activity" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/activities": { + "get": { + "summary": "Returns a collection of activities", + "parameters": [ + { + "name": "project", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Project ID to filter activities", + "type": "string", + "pattern": "\\d+" + }, + { + "name": "projects", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Comma separated list of project IDs to filter activities", + "type": "string", + "pattern": "[\\d|,]+" + }, + { + "name": "visible", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Visibility status to filter activities. Allowed values: 1=visible, 2=hidden, 3=all (default: 1)", + "type": "string", + "pattern": "1|2|3" + }, + { + "name": "globals", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Use if you want to fetch only global activities. Allowed values: true (default: false)", + "type": "string", + "pattern": "true" + }, + { + "name": "globalsFirst", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Deprecated parameter, value is not used any more", + "type": "string", + "pattern": "true|false" + }, + { + "name": "orderBy", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The field by which results will be ordered. Allowed values: id, name, project (default: name)", + "type": "string", + "pattern": "id|name|project" + }, + { + "name": "order", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The result order. Allowed values: ASC, DESC (default: ASC)", + "type": "string", + "pattern": "ASC|DESC" + }, + { + "name": "term", + "in": "query", + "allowEmptyValue": false, + "required": false, + "description": "Free search term", + "type": "string" + } + ], + "responses": { + "200": { + "description": "Returns a collection of activity entities", + "schema": { + "items": { + "$ref": "#/definitions/ActivityCollection" + }, + "type": "array" + } + } + }, + "tags": [ + "Activity" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "post": { + "summary": "Creates a new activity", + "description": "Creates a new activity and returns it afterwards", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ActivityEditForm" + } + } + ], + "responses": { + "200": { + "description": "Returns the new created activity", + "schema": { + "$ref": "#/definitions/ActivityEntity" + } + } + }, + "tags": [ + "Activity" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/activities/{id}": { + "get": { + "summary": "Returns one activity", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Activity ID to fetch", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns one activity entity", + "schema": { + "$ref": "#/definitions/ActivityEntity" + } + } + }, + "tags": [ + "Activity" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "patch": { + "summary": "Update an existing activity", + "description": "Update an existing activity, you can pass all or just a subset of all attributes", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ActivityEditForm" + } + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "Activity ID to update", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns the updated activity", + "schema": { + "$ref": "#/definitions/ActivityEntity" + } + } + }, + "tags": [ + "Activity" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/activities/{id}/rates": { + "get": { + "summary": "Returns a collection of all rates for one activity", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The activity whose rates will be returned", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns a collection of activity rate entities", + "schema": { + "items": { + "$ref": "#/definitions/ActivityRate" + }, + "type": "array" + } + } + }, + "tags": [ + "Activity" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "post": { + "summary": "Adds a new rate to an activity", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The activity to add the rate for", + "type": "integer" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ActivityRateForm" + } + } + ], + "responses": { + "200": { + "description": "Returns the new created rate", + "schema": { + "$ref": "#/definitions/ActivityRate" + } + } + }, + "tags": [ + "Activity" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/activities/{id}/rates/{rateId}": { + "delete": { + "summary": "Deletes one rate for an activity", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The activity whose rate will be removed", + "type": "integer" + }, + { + "name": "rateId", + "in": "path", + "required": true, + "description": "The rate to remove", + "type": "integer" + } + ], + "responses": { + "204": { + "description": "Returns no content: 204 on successful delete" + } + }, + "tags": [ + "Activity" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/config/i18n": { + "get": { + "summary": "Returns the user specific locale configuration", + "responses": { + "200": { + "description": "Returns the locale specific configurations for this user", + "schema": { + "$ref": "#/definitions/I18nConfig" + } + } + }, + "tags": [ + "Default" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/config/timesheet": { + "get": { + "summary": "Returns the timesheet configuration", + "responses": { + "200": { + "description": "Returns the instance specific timesheet configuration", + "schema": { + "$ref": "#/definitions/TimesheetConfig" + } + } + }, + "tags": [ + "Default" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/customers/{id}/meta": { + "patch": { + "summary": "Sets the value of a meta-field for an existing customer", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Customer record ID to set the meta-field value for", + "type": "integer" + }, + { + "name": "body", + "in": "body", + "schema": { + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "The meta-field name", + "type": "string" + }, + "value": { + "description": "The meta-field value", + "type": "string" + } + }, + "type": "object" + } + } + ], + "responses": { + "200": { + "description": "Sets the value of an existing/configured meta-field. You cannot create unknown meta-fields, if the given name is not a configured meta-field, this will return an exception.", + "schema": { + "$ref": "#/definitions/CustomerEntity" + } + } + }, + "tags": [ + "Customer" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/customers": { + "get": { + "summary": "Returns a collection of customers", + "parameters": [ + { + "name": "visible", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Visibility status to filter activities (1=visible, 2=hidden, 3=both)", + "type": "string", + "pattern": "\\d+" + }, + { + "name": "order", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The result order. Allowed values: ASC, DESC (default: ASC)", + "type": "string", + "pattern": "ASC|DESC" + }, + { + "name": "orderBy", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The field by which results will be ordered. Allowed values: id, name (default: name)", + "type": "string", + "pattern": "id|name" + }, + { + "name": "term", + "in": "query", + "allowEmptyValue": false, + "required": false, + "description": "Free search term", + "type": "string" + } + ], + "responses": { + "200": { + "description": "Returns a collection of customer entities", + "schema": { + "items": { + "$ref": "#/definitions/CustomerCollection" + }, + "type": "array" + } + } + }, + "tags": [ + "Customer" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "post": { + "summary": "Creates a new customer", + "description": "Creates a new customer and returns it afterwards", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CustomerEditForm" + } + } + ], + "responses": { + "200": { + "description": "Returns the new created customer", + "schema": { + "$ref": "#/definitions/CustomerEntity" + } + } + }, + "tags": [ + "Customer" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/customers/{id}": { + "get": { + "summary": "Returns one customer", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Returns one customer entity", + "schema": { + "$ref": "#/definitions/CustomerEntity" + } + } + }, + "tags": [ + "Customer" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "patch": { + "summary": "Update an existing customer", + "description": "Update an existing customer, you can pass all or just a subset of all attributes", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CustomerEditForm" + } + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "Customer ID to update", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns the updated customer", + "schema": { + "$ref": "#/definitions/CustomerEntity" + } + } + }, + "tags": [ + "Customer" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/customers/{id}/rates": { + "get": { + "summary": "Returns a collection of all rates for one customer", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The customer whose rates will be returned", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns a collection of customer rate entities", + "schema": { + "items": { + "$ref": "#/definitions/CustomerRate" + }, + "type": "array" + } + } + }, + "tags": [ + "Customer" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "post": { + "summary": "Adds a new rate to a customer", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The customer to add the rate for", + "type": "integer" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CustomerRateForm" + } + } + ], + "responses": { + "200": { + "description": "Returns the new created rate", + "schema": { + "$ref": "#/definitions/CustomerRate" + } + } + }, + "tags": [ + "Customer" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/customers/{id}/rates/{rateId}": { + "delete": { + "summary": "Deletes one rate for an customer", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The customer whose rate will be removed", + "type": "integer" + }, + { + "name": "rateId", + "in": "path", + "required": true, + "description": "The rate to remove", + "type": "integer" + } + ], + "responses": { + "204": { + "description": "Returns no content: 204 on successful delete" + } + }, + "tags": [ + "Customer" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/projects/{id}/meta": { + "patch": { + "summary": "Sets the value of a meta-field for an existing project", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Project record ID to set the meta-field value for", + "type": "integer" + }, + { + "name": "body", + "in": "body", + "schema": { + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "The meta-field name", + "type": "string" + }, + "value": { + "description": "The meta-field value", + "type": "string" + } + }, + "type": "object" + } + } + ], + "responses": { + "200": { + "description": "Sets the value of an existing/configured meta-field. You cannot create unknown meta-fields, if the given name is not a configured meta-field, this will return an exception.", + "schema": { + "$ref": "#/definitions/ProjectEntity" + } + } + }, + "tags": [ + "Project" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/projects": { + "get": { + "summary": "Returns a collection of projects.", + "parameters": [ + { + "name": "customer", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Customer ID to filter projects", + "type": "string", + "pattern": "\\d+" + }, + { + "name": "customers", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Comma separated list of customer IDs to filter projects", + "type": "string", + "pattern": "[\\d|,]+" + }, + { + "name": "visible", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Visibility status to filter projects. Allowed values: 1=visible, 2=hidden, 3=both (default: 1)", + "type": "string", + "pattern": "\\d+" + }, + { + "name": "start", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Only projects that started before this date will be included. Allowed format: HTML5 (default: now, if end is also empty)", + "type": "string", + "format": "DateTime" + }, + { + "name": "end", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Only projects that ended after this date will be included. Allowed format: HTML5 (default: now, if start is also empty)", + "type": "string", + "format": "DateTime" + }, + { + "name": "ignoreDates", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "If set, start and end are completely ignored. Allowed values: 1 (default: off)", + "type": "string", + "pattern": "1" + }, + { + "name": "globalActivities", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "If given, filters projects by their 'global activity' support. Allowed values: 1 (supports global activities) and 0 (without global activities) (default: all)", + "type": "string", + "pattern": "0|1" + }, + { + "name": "order", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The result order. Allowed values: ASC, DESC (default: ASC)", + "type": "string", + "pattern": "ASC|DESC" + }, + { + "name": "orderBy", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The field by which results will be ordered. Allowed values: id, name, customer (default: name)", + "type": "string", + "pattern": "id|name|customer" + }, + { + "name": "term", + "in": "query", + "allowEmptyValue": false, + "required": false, + "description": "Free search term", + "type": "string" + } + ], + "responses": { + "200": { + "description": "Returns a collection of project entities", + "schema": { + "items": { + "$ref": "#/definitions/ProjectCollection" + }, + "type": "array" + } + } + }, + "tags": [ + "Project" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "post": { + "summary": "Creates a new project", + "description": "Creates a new project and returns it afterwards", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ProjectEditForm" + } + } + ], + "responses": { + "200": { + "description": "Returns the new created project", + "schema": { + "$ref": "#/definitions/ProjectEntity" + } + } + }, + "tags": [ + "Project" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/projects/{id}": { + "get": { + "summary": "Returns one project", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Returns one project entity", + "schema": { + "$ref": "#/definitions/ProjectEntity" + } + } + }, + "tags": [ + "Project" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "patch": { + "summary": "Update an existing project", + "description": "Update an existing project, you can pass all or just a subset of all attributes", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ProjectEditForm" + } + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "Project ID to update", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns the updated project", + "schema": { + "$ref": "#/definitions/ProjectEntity" + } + } + }, + "tags": [ + "Project" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/projects/{id}/rates": { + "get": { + "summary": "Returns a collection of all rates for one project", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The project whose rates will be returned", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns a collection of project rate entities", + "schema": { + "items": { + "$ref": "#/definitions/ProjectRate" + }, + "type": "array" + } + } + }, + "tags": [ + "Project" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "post": { + "summary": "Adds a new rate to an project", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The project to add the rate for", + "type": "integer" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ProjectRateForm" + } + } + ], + "responses": { + "200": { + "description": "Returns the new created rate", + "schema": { + "$ref": "#/definitions/ProjectRate" + } + } + }, + "tags": [ + "Project" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/projects/{id}/rates/{rateId}": { + "delete": { + "summary": "Deletes one rate for an project", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The project whose rate will be removed", + "type": "integer" + }, + { + "name": "rateId", + "in": "path", + "required": true, + "description": "The rate to remove", + "type": "integer" + } + ], + "responses": { + "204": { + "description": "Returns no content: 204 on successful delete" + } + }, + "tags": [ + "Project" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/ping": { + "get": { + "summary": "A testing route for the API", + "responses": { + "200": { + "description": "A simple route that returns a 'pong', which you can use for testing the API", + "examples": [ + "{'message': 'pong'}" + ] + } + }, + "tags": [ + "Default" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/version": { + "get": { + "summary": "Returns information about the Kimai release", + "responses": { + "200": { + "description": "Returns version information about the current release", + "schema": { + "$ref": "#/definitions/Version" + } + } + }, + "tags": [ + "Default" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/plugins": { + "get": { + "summary": "Returns information about installed Plugins", + "responses": { + "200": { + "description": "Returns a list of plugin names and versions", + "schema": { + "items": { + "$ref": "#/definitions/Plugin" + }, + "type": "array" + } + } + }, + "tags": [ + "Default" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/tags": { + "get": { + "summary": "Fetch all existing tags", + "parameters": [ + { + "name": "name", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Search term to filter tag list", + "type": "string" + } + ], + "responses": { + "200": { + "description": "Returns the collection of all existing tags as string array", + "schema": { + "items": { + "type": "string" + }, + "type": "array" + } + } + }, + "tags": [ + "Tag" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "post": { + "summary": "Creates a new tag", + "description": "Creates a new tag and returns it afterwards", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TagEditForm" + } + } + ], + "responses": { + "200": { + "description": "Returns the new created tag", + "schema": { + "$ref": "#/definitions/TagEntity" + } + } + }, + "tags": [ + "Tag" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/tags/{id}": { + "delete": { + "summary": "Delete a tag", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Tag ID to delete", + "type": "integer" + } + ], + "responses": { + "204": { + "description": "HTTP code 204 for a successful delete" + } + }, + "tags": [ + "Tag" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/teams": { + "get": { + "summary": "Fetch all existing teams", + "responses": { + "200": { + "description": "Returns the collection of all existing teams", + "schema": { + "items": { + "$ref": "#/definitions/TeamCollection" + }, + "type": "array" + } + } + }, + "tags": [ + "Team" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "post": { + "summary": "Creates a new team", + "description": "Creates a new team and returns it afterwards", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TeamEditForm" + } + } + ], + "responses": { + "200": { + "description": "Returns the new created team", + "schema": { + "$ref": "#/definitions/Team" + } + } + }, + "tags": [ + "Team" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/teams/{id}": { + "get": { + "summary": "Returns one team", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Returns one team entity", + "schema": { + "$ref": "#/definitions/Team" + } + } + }, + "tags": [ + "Team" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "patch": { + "summary": "Update an existing team", + "description": "Update an existing team, you can pass all or just a subset of all attributes (passing members will replace all existing ones)", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TeamEditForm" + } + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "Team ID to update", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns the updated team", + "schema": { + "$ref": "#/definitions/Team" + } + } + }, + "tags": [ + "Team" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "delete": { + "summary": "Delete a team", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Team ID to delete", + "type": "integer" + } + ], + "responses": { + "204": { + "description": "Delete one team" + } + }, + "tags": [ + "Team" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/teams/{id}/members/{userId}": { + "post": { + "summary": "Add a new member to a team", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The team which will receive the new member", + "type": "integer" + }, + { + "name": "userId", + "in": "path", + "required": true, + "description": "The team member to add (User ID)", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Adds a new user to a team.", + "schema": { + "$ref": "#/definitions/Team" + } + } + }, + "tags": [ + "Team" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "delete": { + "summary": "Removes a member from the team", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The team from which the member will be removed", + "type": "integer" + }, + { + "name": "userId", + "in": "path", + "required": true, + "description": "The team member to remove (User ID)", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Removes a user from the team. The teamlead cannot be removed.", + "schema": { + "$ref": "#/definitions/Team" + } + } + }, + "tags": [ + "Team" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/teams/{id}/customers/{customerId}": { + "post": { + "summary": "Grant the team access to a customer", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The team that is granted access", + "type": "integer" + }, + { + "name": "customerId", + "in": "path", + "required": true, + "description": "The customer to grant acecess to (Customer ID)", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Adds a new customer to a team.", + "schema": { + "$ref": "#/definitions/Team" + } + } + }, + "tags": [ + "Team" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "delete": { + "summary": "Revokes access for a customer from a team", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The team whose permission will be revoked", + "type": "integer" + }, + { + "name": "customerId", + "in": "path", + "required": true, + "description": "The customer to remove (Customer ID)", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Removes a customer from the team.", + "schema": { + "$ref": "#/definitions/Team" + } + } + }, + "tags": [ + "Team" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/teams/{id}/projects/{projectId}": { + "post": { + "summary": "Grant the team access to a project", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The team that is granted access", + "type": "integer" + }, + { + "name": "projectId", + "in": "path", + "required": true, + "description": "The project to grant acecess to (Project ID)", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Adds a new project to a team.", + "schema": { + "$ref": "#/definitions/Team" + } + } + }, + "tags": [ + "Team" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "delete": { + "summary": "Revokes access for a project from a team", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The team whose permission will be revoked", + "type": "integer" + }, + { + "name": "projectId", + "in": "path", + "required": true, + "description": "The project to remove (Project ID)", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Removes a project from the team.", + "schema": { + "$ref": "#/definitions/Team" + } + } + }, + "tags": [ + "Team" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/teams/{id}/activities/{activityId}": { + "post": { + "summary": "Grant the team access to an activity", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The team that is granted access", + "type": "integer" + }, + { + "name": "activityId", + "in": "path", + "required": true, + "description": "The activity to grant acecess to (Activity ID)", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Adds a new activity to a team.", + "schema": { + "$ref": "#/definitions/Team" + } + } + }, + "tags": [ + "Team" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "delete": { + "summary": "Revokes access for an activity from a team", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The team whose permission will be revoked", + "type": "integer" + }, + { + "name": "activityId", + "in": "path", + "required": true, + "description": "The activity to remove (Activity ID)", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Removes a activity from the team.", + "schema": { + "$ref": "#/definitions/Team" + } + } + }, + "tags": [ + "Team" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/timesheets/recent": { + "get": { + "summary": "Returns the collection of recent user activities", + "parameters": [ + { + "name": "user", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "User ID to filter timesheets. Needs permission 'view_other_timesheet', pass 'all' to fetch data for all user (default: current user)", + "type": "string", + "pattern": "\\d+|all" + }, + { + "name": "begin", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Only records after this date will be included. Default: today - 1 year (format: HTML5)", + "type": "string", + "format": "DateTime" + }, + { + "name": "size", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The amount of entries (default: 10)", + "type": "string", + "pattern": "\\d+" + } + ], + "responses": { + "200": { + "description": "Returns the collection of recent user activities (always the latest entry of a unique working set grouped by customer, project and activity)", + "schema": { + "items": { + "$ref": "#/definitions/TimesheetCollectionExpanded" + }, + "type": "array" + } + } + }, + "tags": [ + "Timesheet" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/timesheets/active": { + "get": { + "summary": "Returns the collection of active timesheet records", + "responses": { + "200": { + "description": "Returns the collection of active timesheet records for the current user", + "schema": { + "items": { + "$ref": "#/definitions/TimesheetCollectionExpanded" + }, + "type": "array" + } + } + }, + "tags": [ + "Timesheet" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/timesheets/{id}/stop": { + "patch": { + "summary": "Stops an active timesheet record", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Timesheet record ID to stop", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Stops an active timesheet record and returns it afterwards.", + "schema": { + "$ref": "#/definitions/TimesheetEntity" + } + } + }, + "tags": [ + "Timesheet" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/timesheets/{id}/restart": { + "patch": { + "summary": "Restarts a previously stopped timesheet record for the current user", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Timesheet record ID to restart", + "type": "integer" + }, + { + "name": "body", + "in": "body", + "schema": { + "properties": { + "copy": { + "description": "Whether data should be copied to the new entry. Allowed values: all, tags (deprecated), rates (deprecated), description (deprecated), meta (deprecated) (default: nothing is copied)", + "type": "string", + "pattern": "all|tags|rates|meta|description" + }, + "begin": { + "description": "Changes the restart date to the given one (default: now)", + "type": "string", + "format": "DateTime" + } + }, + "type": "object" + } + } + ], + "responses": { + "200": { + "description": "Restarts a timesheet record for the same customer, project, activity combination. The current user will be the owner of the new record. Kimai tries to stop running records, which is expected to fail depending on the configured rules. Data will be copied from the original record if requested.", + "schema": { + "$ref": "#/definitions/TimesheetEntity" + } + } + }, + "tags": [ + "Timesheet" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/timesheets/{id}/duplicate": { + "patch": { + "summary": "Duplicates an existing timesheet record", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Timesheet record ID to duplicate", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Duplicates a timesheet record, resetting the export state only.", + "schema": { + "$ref": "#/definitions/TimesheetEntity" + } + } + }, + "tags": [ + "Timesheet" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/timesheets/{id}/export": { + "patch": { + "summary": "Switch the export state of a timesheet record to (un-)lock it", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Timesheet record ID to switch export state", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Switches the exported state on the record and therefor locks / unlocks it for further updates. Needs edit_export_*_timesheet permission.", + "schema": { + "$ref": "#/definitions/TimesheetEntity" + } + } + }, + "tags": [ + "Timesheet" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/timesheets/{id}/meta": { + "patch": { + "summary": "Sets the value of a meta-field for an existing timesheet.", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Timesheet record ID to set the meta-field value for", + "type": "integer" + }, + { + "name": "body", + "in": "body", + "schema": { + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "The meta-field name", + "type": "string" + }, + "value": { + "description": "The meta-field value", + "type": "string" + } + }, + "type": "object" + } + } + ], + "responses": { + "200": { + "description": "Sets the value of an existing/configured meta-field. You cannot create unknown meta-fields, if the given name is not a configured meta-field, this will return an exception.", + "schema": { + "$ref": "#/definitions/TimesheetEntity" + } + } + }, + "tags": [ + "Timesheet" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/timesheets": { + "get": { + "summary": "Returns a collection of timesheet records", + "parameters": [ + { + "name": "user", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "User ID to filter timesheets. Needs permission 'view_other_timesheet', pass 'all' to fetch data for all user (default: current user)", + "type": "string", + "pattern": "\\d+|all" + }, + { + "name": "customer", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "DEPRECATED: Customer ID to filter timesheets (will be removed with 2.0)", + "type": "string", + "pattern": "\\d+" + }, + { + "name": "customers", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Comma separated list of customer IDs to filter timesheets", + "type": "string", + "pattern": "[\\d|,]+" + }, + { + "name": "project", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "DEPRECATED: Project ID to filter timesheets (will be removed with 2.0)", + "type": "string", + "pattern": "\\d+" + }, + { + "name": "projects", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Comma separated list of project IDs to filter timesheets", + "type": "string", + "pattern": "[\\d|,]+" + }, + { + "name": "activity", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "DEPRECATED: Activity ID to filter timesheets (will be removed with 2.0)", + "type": "string", + "pattern": "\\d+" + }, + { + "name": "activities", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Comma separated list of activity IDs to filter timesheets", + "type": "string", + "pattern": "[\\d|,]+" + }, + { + "name": "page", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The page to display, renders a 404 if not found (default: 1)", + "type": "string", + "pattern": "\\d+" + }, + { + "name": "size", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The amount of entries for each page (default: 50)", + "type": "string", + "pattern": "\\d+" + }, + { + "name": "tags", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Comma separated list of tag names", + "type": "string" + }, + { + "name": "orderBy", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The field by which results will be ordered. Allowed values: id, begin, end, rate (default: begin)", + "type": "string", + "pattern": "id|begin|end|rate" + }, + { + "name": "order", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The result order. Allowed values: ASC, DESC (default: DESC)", + "type": "string", + "pattern": "ASC|DESC" + }, + { + "name": "begin", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Only records after this date will be included (format: HTML5)", + "type": "string", + "format": "DateTime" + }, + { + "name": "end", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Only records before this date will be included (format: HTML5)", + "type": "string", + "format": "DateTime" + }, + { + "name": "exported", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Use this flag if you want to filter for export state. Allowed values: 0=not exported, 1=exported (default: all)", + "type": "string", + "pattern": "0|1" + }, + { + "name": "active", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Filter for running/active records. Allowed values: 0=stopped, 1=active (default: all)", + "type": "string", + "pattern": "0|1" + }, + { + "name": "billable", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Filter for non-/billable records. Allowed values: 0=non-billable, 1=billable (default: all)", + "type": "string", + "pattern": "0|1" + }, + { + "name": "full", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Allows to fetch fully serialized objects including subresources. Allowed values: true (default: false)", + "type": "string", + "pattern": "true" + }, + { + "name": "term", + "in": "query", + "allowEmptyValue": false, + "required": false, + "description": "Free search term", + "type": "string" + }, + { + "name": "modified_after", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Only records changed after this date will be included (format: HTML5). Available since Kimai 1.10 and works only for records that were created/updated since then.", + "type": "string", + "format": "DateTime" + } + ], + "responses": { + "200": { + "description": "Returns a collection of timesheets records. Be aware that the datetime fields are given in the users local time including the timezone offset via ISO 8601.", + "schema": { + "items": { + "$ref": "#/definitions/TimesheetCollection" + }, + "type": "array" + } + } + }, + "tags": [ + "Timesheet" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "post": { + "summary": "Creates a new timesheet record", + "description": "Creates a new timesheet record for the current user and returns it afterwards.", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TimesheetEditForm" + } + }, + { + "name": "full", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Allows to fetch fully serialized objects including subresources (TimesheetEntityExpanded). Allowed values: true (default: false)", + "type": "string", + "pattern": "true" + } + ], + "responses": { + "200": { + "description": "Returns the new created timesheet", + "schema": { + "$ref": "#/definitions/TimesheetEntity" + } + } + }, + "tags": [ + "Timesheet" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/timesheets/{id}": { + "get": { + "summary": "Returns one timesheet record", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Timesheet record ID to fetch", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns one timesheet record. Be aware that the datetime fields are given in the users local time including the timezone offset via ISO 8601.", + "schema": { + "$ref": "#/definitions/TimesheetEntity" + } + } + }, + "tags": [ + "Timesheet" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "patch": { + "summary": "Update an existing timesheet record", + "description": "Update an existing timesheet record, you can pass all or just a subset of the attributes.", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Timesheet record ID to update", + "type": "integer" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TimesheetEditForm" + } + } + ], + "responses": { + "200": { + "description": "Returns the updated timesheet", + "schema": { + "$ref": "#/definitions/TimesheetEntity" + } + } + }, + "tags": [ + "Timesheet" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "delete": { + "summary": "Delete an existing timesheet record", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Timesheet record ID to delete", + "type": "integer" + } + ], + "responses": { + "204": { + "description": "Delete one timesheet record" + } + }, + "tags": [ + "Timesheet" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/users/me": { + "get": { + "summary": "Return the current user entity", + "responses": { + "200": { + "description": "Return the current user entity.", + "schema": { + "$ref": "#/definitions/UserEntity" + } + } + }, + "tags": [ + "User" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/users": { + "get": { + "summary": "Returns the collection of all registered users", + "parameters": [ + { + "name": "visible", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Visibility status to filter users. Allowed values: 1=visible, 2=hidden, 3=all (default: 1)", + "type": "string", + "pattern": "1|2|3" + }, + { + "name": "orderBy", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The field by which results will be ordered. Allowed values: id, username, alias, email (default: username)", + "type": "string", + "pattern": "id|username|alias|email" + }, + { + "name": "order", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The result order. Allowed values: ASC, DESC (default: ASC)", + "type": "string", + "pattern": "ASC|DESC" + }, + { + "name": "term", + "in": "query", + "allowEmptyValue": false, + "required": false, + "description": "Free search term", + "type": "string" + } + ], + "responses": { + "200": { + "description": "Returns the collection of all registered users. Required permission: view_user", + "schema": { + "items": { + "$ref": "#/definitions/UserCollection" + }, + "type": "array" + } + } + }, + "tags": [ + "User" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "post": { + "summary": "Creates a new user", + "description": "Creates a new user and returns it afterwards", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UserCreateForm" + } + } + ], + "responses": { + "200": { + "description": "Returns the new created user", + "schema": { + "$ref": "#/definitions/UserEntity" + } + } + }, + "tags": [ + "User" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/users/{id}": { + "get": { + "summary": "Return one user entity", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "User ID to fetch", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Return one user entity.", + "schema": { + "$ref": "#/definitions/UserEntity" + } + } + }, + "tags": [ + "User" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "patch": { + "summary": "Update an existing user", + "description": "Update an existing user, you can pass all or just a subset of all attributes (passing roles will replace all existing ones)", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UserEditForm" + } + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "User ID to update", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns the updated user", + "schema": { + "$ref": "#/definitions/UserEntity" + } + } + }, + "tags": [ + "User" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/kiosks": { + "get": { + "summary": "Returns a collection of UserAuthCodes objects", + "parameters": [ + { + "name": "orderBy", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The field by which results will be ordered. Allowed values: id, user, type, code (default: id)", + "type": "string", + "pattern": "id|user|type|code" + }, + { + "name": "order", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The result order. Allowed values: ASC, DESC (default: DESC)", + "type": "string", + "pattern": "ASC|DESC" + }, + { + "name": "page", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The page to display, renders a 404 if not found (default: 1)", + "type": "string", + "pattern": "\\d+" + }, + { + "name": "size", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The amount of entries for each page (default: 50)", + "type": "string", + "pattern": "\\d+" + } + ], + "responses": { + "200": { + "description": "Returns a collection of UserAuthCodes", + "schema": { + "items": { + "$ref": "#/definitions/UserAuthCodes" + }, + "type": "array" + } + } + }, + "tags": [ + "Kiosk" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/kiosks/{id}": { + "get": { + "summary": "Returns one UserAuthCodes entity", + "description": "Creates the code for the configured default type (if not yet existing).", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "User ID to fetch", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns one UserAuthCodes entity", + "schema": { + "$ref": "#/definitions/UserAuthCodes" + } + } + }, + "tags": [ + "Kiosk" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/expenses/{id}/meta": { + "patch": { + "summary": "Sets the value of a meta-field for an existing expense", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Expense record ID to set the meta-field value for", + "type": "integer" + }, + { + "name": "body", + "in": "body", + "schema": { + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "description": "The meta-field name", + "type": "string" + }, + "value": { + "description": "The meta-field value", + "type": "string" + } + }, + "type": "object" + } + } + ], + "responses": { + "200": { + "description": "Sets the value of an existing/configured meta-field. You cannot create unknown meta-fields, if the given name is not a configured meta-field, this will return an exception.", + "schema": { + "$ref": "#/definitions/ExpenseEntity" + } + } + }, + "tags": [ + "Expense" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/expenses/{id}/duplicate": { + "patch": { + "summary": "Duplicates an existing expense record", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Expense record ID to duplicate", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Duplicates a expense record, resetting the export state only.", + "schema": { + "$ref": "#/definitions/ExpenseEntity" + } + } + }, + "tags": [ + "Expense" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/expenses": { + "get": { + "summary": "Returns a collection of expenses", + "parameters": [ + { + "name": "orderBy", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The field by which results will be ordered. Allowed values: begin, end, duration, total, category, cost, user, customer, project, activity, description, exported, refundable, multiplier (default: begin)", + "type": "string", + "pattern": "begin|end|duration|total|category|cost|user|customer|project|activity|description|exported|refundable|multiplier" + }, + { + "name": "order", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The result order. Allowed values: ASC, DESC (default: DESC)", + "type": "string", + "pattern": "ASC|DESC" + }, + { + "name": "begin", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Only records after this date will be included (format: HTML5)", + "type": "string", + "format": "DateTime" + }, + { + "name": "end", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Only records before this date will be included (format: HTML5)", + "type": "string", + "format": "DateTime" + }, + { + "name": "refundable", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Use this flag if you want to filter for refundable expenses. Allowed values: 0=not refundable, 1=refundable (default: all)", + "type": "string", + "pattern": "0|1" + }, + { + "name": "exported", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Use this flag if you want to filter for export state. Allowed values: 0=not exported, 1=exported (default: all)", + "type": "string", + "pattern": "0|1" + }, + { + "name": "term", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "Free search term", + "type": "string", + "pattern": "[a-zA-Z0-9 \\-,:]+" + }, + { + "name": "page", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The page to display, renders a 404 if not found (default: 1)", + "type": "string", + "pattern": "\\d+" + }, + { + "name": "size", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The amount of entries for each page (default: 50)", + "type": "string", + "pattern": "\\d+" + } + ], + "responses": { + "200": { + "description": "Returns a collection of expense entities", + "schema": { + "items": { + "$ref": "#/definitions/ExpenseEntity" + }, + "type": "array" + } + } + }, + "tags": [ + "Expense" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "post": { + "summary": "Creates a new expense", + "description": "Creates a new expense and returns it afterwards", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ExpenseEditForm" + } + } + ], + "responses": { + "200": { + "description": "Returns the new created expense", + "schema": { + "$ref": "#/definitions/ExpenseEntity" + } + } + }, + "tags": [ + "Expense" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/expenses/{id}": { + "get": { + "summary": "Returns one expense", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Expense ID to fetch", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns one expense entity", + "schema": { + "$ref": "#/definitions/ExpenseEntity" + } + } + }, + "tags": [ + "Expense" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "patch": { + "summary": "Update an existing expense", + "description": "Update an existing expense, you can pass all or just a subset of all attributes", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ExpenseEditForm" + } + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "Expense ID to update", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns the updated expense", + "schema": { + "$ref": "#/definitions/ExpenseEntity" + } + } + }, + "tags": [ + "Expense" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "delete": { + "summary": "Delete an existing expense record", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Expense record ID to delete", + "type": "integer" + } + ], + "responses": { + "204": { + "description": "Delete one expense record" + } + }, + "tags": [ + "Expense" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/metafields": { + "get": { + "summary": "Returns a collection of meta-fields", + "parameters": [ + { + "name": "entity", + "in": "query", + "allowEmptyValue": true, + "required": false, + "description": "The type of object to fetch meta-fields for. Allowed values: timesheet, customer, project, activity, user, expense - returns all if not given (default: all)", + "type": "string", + "format": "MetaFieldExternalType" + } + ], + "responses": { + "200": { + "description": "Returns a collection of meta-fields", + "schema": { + "items": { + "$ref": "#/definitions/MetaFieldRule" + }, + "type": "array" + } + } + }, + "tags": [ + "MetaField" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/tasks/{id}/log": { + "patch": { + "summary": "Logs work for a task record", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Task ID to log times for", + "type": "integer" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TaskLogWorkForm" + } + } + ], + "responses": { + "200": { + "description": "Logs already performed work on a task", + "schema": { + "$ref": "#/definitions/TimesheetEntityExpanded" + } + } + }, + "tags": [ + "Task" + ] + } + }, + "/api/tasks/{id}/start": { + "patch": { + "summary": "Start a task record", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Task ID to start", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Start working on a task", + "schema": { + "$ref": "#/definitions/Task" + } + } + }, + "tags": [ + "Task" + ] + } + }, + "/api/tasks/{id}/stop": { + "patch": { + "summary": "Stops a task record for the current user", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Task ID to stop", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Stop working on a task", + "schema": { + "$ref": "#/definitions/Task" + } + } + }, + "tags": [ + "Task" + ] + } + }, + "/api/tasks/{id}/assign": { + "patch": { + "summary": "Assign a task to the current user", + "description": "Assign a currently unassigned task to the current user", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Task ID to update", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns the updated task", + "schema": { + "$ref": "#/definitions/Task" + } + } + }, + "tags": [ + "Task" + ] + } + }, + "/api/tasks/{id}/unassign": { + "patch": { + "summary": "Unassign a task from the current user", + "description": "Unassign a currently assigned task from the current user", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Task ID to update", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns the updated task", + "schema": { + "$ref": "#/definitions/Task" + } + } + }, + "tags": [ + "Task" + ] + } + }, + "/api/tasks/{id}/close": { + "patch": { + "summary": "Close a task for the current user", + "description": "Closes an assigned task for the current user", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Task ID to close", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns the closed task", + "schema": { + "$ref": "#/definitions/Task" + } + } + }, + "tags": [ + "Task" + ] + } + }, + "/api/tasks/{id}/reopen": { + "patch": { + "summary": "Reopens a task for the current user", + "description": "Reopens an assigned task for the current user", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Task ID to reopen", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns the reopened task", + "schema": { + "$ref": "#/definitions/Task" + } + } + }, + "tags": [ + "Task" + ] + } + }, + "/api/tasks": { + "get": { + "summary": "Returns a collection of tasks", + "description": "Attention: This is a GET request and you can pass in every field of the form as query parameter.\nArray values need to be written like this: /api/tasks?projects[]=1&projects[]=2", + "parameters": [ + { + "name": "query", + "in": "body", + "required": true, + "description": "Attention: This is a GET request and you can pass in every field of the form as query parameter.", + "schema": { + "$ref": "#/definitions/TaskQuery" + }, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Returns a collection of task entities", + "schema": { + "items": { + "$ref": "#/definitions/Task" + }, + "type": "array" + } + } + }, + "tags": [ + "Task" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "post": { + "summary": "Creates a new Task", + "description": "Creates a new task and returns it afterwards", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TaskEditForm" + } + } + ], + "responses": { + "200": { + "description": "Returns the new created task", + "schema": { + "$ref": "#/definitions/Task" + } + } + }, + "tags": [ + "Task" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + } + }, + "/api/tasks/{id}": { + "get": { + "summary": "Returns one task", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Task ID to fetch", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns one task entity", + "schema": { + "$ref": "#/definitions/Task" + } + } + }, + "tags": [ + "Task" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "patch": { + "summary": "Update an existing task", + "description": "Update an existing task, you can pass all or just a subset of all attributes", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TaskEditForm" + } + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "Task ID to update", + "type": "integer" + } + ], + "responses": { + "200": { + "description": "Returns the updated task", + "schema": { + "$ref": "#/definitions/Task" + } + } + }, + "tags": [ + "Task" + ], + "security": [ + { + "apiUser": [] + }, + { + "apiToken": [] + } + ] + }, + "delete": { + "summary": "Delete an existing task record", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Task record ID to delete", + "type": "integer" + } + ], + "responses": { + "204": { + "description": "Delete one task record" + } + }, + "tags": [ + "Task" + ] + } + } + }, + "definitions": { + "TeamMembership": { + "required": [ + "team", + "teamlead" + ], + "properties": { + "team": { + "$ref": "#/definitions/Team" + }, + "teamlead": { + "type": "boolean" + } + }, + "type": "object" + }, + "TeamMember": { + "required": [ + "user", + "teamlead" + ], + "properties": { + "user": { + "$ref": "#/definitions/User" + }, + "teamlead": { + "type": "boolean" + } + }, + "type": "object" + }, + "TeamCollection": { + "required": [ + "name" + ], + "properties": { + "id": { + "type": "integer" + }, + "name": { + "title": "Team name", + "type": "string", + "maxLength": 100, + "minLength": 2 + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "Team": { + "required": [ + "name" + ], + "properties": { + "teamlead": { + "$ref": "#/definitions/User" + }, + "users": { + "title": "Returns all users in the team, both teamlead and normal member.", + "items": { + "$ref": "#/definitions/User" + }, + "type": "array" + }, + "id": { + "type": "integer" + }, + "name": { + "title": "Team name", + "type": "string", + "maxLength": 100, + "minLength": 2 + }, + "members": { + "title": "All team member (including team leads)", + "items": { + "$ref": "#/definitions/TeamMember" + }, + "type": "array", + "minItems": 1 + }, + "customers": { + "title": "Customers assigned to the team", + "items": { + "$ref": "#/definitions/Customer" + }, + "type": "array" + }, + "projects": { + "title": "Projects assigned to the team", + "items": { + "$ref": "#/definitions/Project" + }, + "type": "array" + }, + "activities": { + "title": "Activities assigned to the team", + "items": { + "$ref": "#/definitions/Activity" + }, + "type": "array" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "TeamEditForm": { + "required": [ + "name", + "members" + ], + "properties": { + "name": { + "description": "Name of the team", + "type": "string" + }, + "color": { + "description": "The hexadecimal color code (default: #d2d6de)", + "type": "string" + }, + "members": { + "description": "All team members", + "items": { + "properties": { + "user": { + "description": "User ID", + "type": "integer" + }, + "teamlead": { + "description": "Whether the user is a teamlead", + "type": "boolean" + } + }, + "type": "object" + }, + "type": "array" + } + }, + "type": "object" + }, + "UserCollection": { + "required": [ + "username" + ], + "properties": { + "id": { + "title": "Internal ID", + "type": "integer" + }, + "alias": { + "title": "The user alias will be displayed in the frontend instead of the username", + "type": "string", + "maxLength": 60 + }, + "username": { + "type": "string", + "maxLength": 60, + "minLength": 2 + }, + "accountNumber": { + "type": "string", + "maxLength": 30 + }, + "enabled": { + "type": "boolean" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "UserEntity": { + "required": [ + "memberships", + "username" + ], + "properties": { + "language": { + "type": "string" + }, + "timezone": { + "type": "string" + }, + "preferences": { + "title": "Read-only list of of all visible user preferences.", + "items": { + "$ref": "#/definitions/UserPreference" + }, + "type": "array" + }, + "teams": { + "title": "List of all teams, this user is part of", + "items": { + "$ref": "#/definitions/Team" + }, + "type": "array" + }, + "id": { + "title": "Internal ID", + "type": "integer" + }, + "alias": { + "title": "The user alias will be displayed in the frontend instead of the username", + "type": "string", + "maxLength": 60 + }, + "title": { + "title": "An additional title for the user, like the Job position or Department", + "type": "string", + "maxLength": 50 + }, + "avatar": { + "title": "URL to the user avatar, will be auto-generated if empty", + "type": "string", + "maxLength": 255 + }, + "memberships": { + "$ref": "#/definitions/TeamMembership" + }, + "username": { + "type": "string", + "maxLength": 60, + "minLength": 2 + }, + "accountNumber": { + "type": "string", + "maxLength": 30 + }, + "enabled": { + "type": "boolean" + }, + "roles": { + "title": "List of all role names", + "items": { + "type": "string" + }, + "type": "array" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "UserPreference": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "value": { + "type": "string" + } + }, + "type": "object" + }, + "User": { + "required": [ + "username" + ], + "properties": { + "id": { + "title": "Internal ID", + "type": "integer" + }, + "alias": { + "title": "The user alias will be displayed in the frontend instead of the username", + "type": "string", + "maxLength": 60 + }, + "username": { + "type": "string", + "maxLength": 60, + "minLength": 2 + }, + "accountNumber": { + "type": "string", + "maxLength": 30 + }, + "enabled": { + "type": "boolean" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "UserEditForm": { + "required": [ + "email", + "language", + "timezone" + ], + "properties": { + "alias": { + "type": "string" + }, + "title": { + "type": "string" + }, + "accountNumber": { + "type": "string" + }, + "color": { + "description": "The hexadecimal color code (default: #d2d6de)", + "type": "string" + }, + "email": { + "type": "string" + }, + "language": { + "type": "string", + "enum": [ + "ar", + "cs", + "da", + "de", + "de_AT", + "de_CH", + "el", + "en", + "en_GB", + "eo", + "es", + "eu", + "fa", + "fi", + "fo", + "fr", + "he", + "hr", + "hu", + "it", + "ja", + "ko", + "nb_NO", + "nl", + "pl", + "pt", + "pt_BR", + "ro", + "ru", + "sk", + "sv", + "tr", + "uk", + "vi", + "zh_CN" + ] + }, + "timezone": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "roles": { + "items": { + "type": "string", + "enum": [ + "ROLE_TEAMLEAD", + "ROLE_ADMIN", + "ROLE_SUPER_ADMIN" + ] + }, + "type": "array" + } + }, + "type": "object" + }, + "UserCreateForm": { + "required": [ + "username", + "email", + "language", + "timezone", + "plainPassword" + ], + "properties": { + "username": { + "type": "string" + }, + "alias": { + "type": "string" + }, + "title": { + "type": "string" + }, + "accountNumber": { + "type": "string" + }, + "color": { + "description": "The hexadecimal color code (default: #d2d6de)", + "type": "string" + }, + "email": { + "type": "string" + }, + "language": { + "type": "string", + "enum": [ + "ar", + "cs", + "da", + "de", + "de_AT", + "de_CH", + "el", + "en", + "en_GB", + "eo", + "es", + "eu", + "fa", + "fi", + "fo", + "fr", + "he", + "hr", + "hu", + "it", + "ja", + "ko", + "nb_NO", + "nl", + "pl", + "pt", + "pt_BR", + "ro", + "ru", + "sk", + "sv", + "tr", + "uk", + "vi", + "zh_CN" + ] + }, + "timezone": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "roles": { + "items": { + "type": "string", + "enum": [ + "ROLE_TEAMLEAD", + "ROLE_ADMIN", + "ROLE_SUPER_ADMIN" + ] + }, + "type": "array" + }, + "plainPassword": { + "description": "Plain text password", + "type": "string" + }, + "plainApiToken": { + "description": "Plain API token", + "type": "string" + } + }, + "type": "object" + }, + "TimesheetCollectionExpanded": { + "required": [ + "begin", + "activity", + "project", + "exported", + "billable" + ], + "properties": { + "user": { + "type": "integer" + }, + "tags": { + "items": { + "type": "string" + }, + "type": "array" + }, + "id": { + "type": "integer" + }, + "begin": { + "type": "string", + "format": "date-time" + }, + "end": { + "type": "string", + "format": "date-time" + }, + "duration": { + "type": "integer" + }, + "activity": { + "$ref": "#/definitions/ActivityExpanded" + }, + "project": { + "$ref": "#/definitions/ProjectExpanded" + }, + "description": { + "type": "string" + }, + "rate": { + "type": "number", + "format": "float", + "minimum": 0 + }, + "internalRate": { + "type": "number", + "format": "float" + }, + "exported": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "metaFields": { + "title": "Meta fields", + "description": "All visible meta (custom) fields registered with this timesheet", + "items": { + "$ref": "#/definitions/TimesheetMeta" + }, + "type": "array" + } + }, + "type": "object" + }, + "TimesheetCollection": { + "required": [ + "begin", + "exported", + "billable" + ], + "properties": { + "activity": { + "type": "integer" + }, + "project": { + "type": "integer" + }, + "user": { + "type": "integer" + }, + "tags": { + "items": { + "type": "string" + }, + "type": "array" + }, + "id": { + "type": "integer" + }, + "begin": { + "type": "string", + "format": "date-time" + }, + "end": { + "type": "string", + "format": "date-time" + }, + "duration": { + "type": "integer" + }, + "description": { + "type": "string" + }, + "rate": { + "type": "number", + "format": "float", + "minimum": 0 + }, + "internalRate": { + "type": "number", + "format": "float" + }, + "exported": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "metaFields": { + "title": "Meta fields", + "description": "All visible meta (custom) fields registered with this timesheet", + "items": { + "$ref": "#/definitions/TimesheetMeta" + }, + "type": "array" + } + }, + "type": "object" + }, + "TimesheetEntityExpanded": { + "required": [ + "begin", + "activity", + "project", + "exported", + "billable" + ], + "properties": { + "user": { + "type": "integer" + }, + "tags": { + "items": { + "type": "string" + }, + "type": "array" + }, + "id": { + "type": "integer" + }, + "begin": { + "type": "string", + "format": "date-time" + }, + "end": { + "type": "string", + "format": "date-time" + }, + "duration": { + "type": "integer" + }, + "activity": { + "$ref": "#/definitions/ActivityExpanded" + }, + "project": { + "$ref": "#/definitions/ProjectExpanded" + }, + "description": { + "type": "string" + }, + "rate": { + "type": "number", + "format": "float", + "minimum": 0 + }, + "internalRate": { + "type": "number", + "format": "float" + }, + "fixedRate": { + "type": "number", + "format": "float", + "minimum": 0 + }, + "hourlyRate": { + "type": "number", + "format": "float", + "minimum": 0 + }, + "exported": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "metaFields": { + "title": "Meta fields", + "description": "All visible meta (custom) fields registered with this timesheet", + "items": { + "$ref": "#/definitions/TimesheetMeta" + }, + "type": "array" + } + }, + "type": "object" + }, + "TimesheetEntity": { + "required": [ + "begin", + "exported", + "billable" + ], + "properties": { + "activity": { + "type": "integer" + }, + "project": { + "type": "integer" + }, + "user": { + "type": "integer" + }, + "tags": { + "items": { + "type": "string" + }, + "type": "array" + }, + "id": { + "type": "integer" + }, + "begin": { + "type": "string", + "format": "date-time" + }, + "end": { + "type": "string", + "format": "date-time" + }, + "duration": { + "type": "integer" + }, + "description": { + "type": "string" + }, + "rate": { + "type": "number", + "format": "float", + "minimum": 0 + }, + "internalRate": { + "type": "number", + "format": "float" + }, + "fixedRate": { + "type": "number", + "format": "float", + "minimum": 0 + }, + "hourlyRate": { + "type": "number", + "format": "float", + "minimum": 0 + }, + "exported": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "metaFields": { + "title": "Meta fields", + "description": "All visible meta (custom) fields registered with this timesheet", + "items": { + "$ref": "#/definitions/TimesheetMeta" + }, + "type": "array" + } + }, + "type": "object" + }, + "TimesheetEditForm": { + "required": [ + "begin", + "project", + "activity" + ], + "properties": { + "begin": { + "example": "2023-01-14T05:12:43", + "type": "string", + "format": "date-time" + }, + "end": { + "example": "2023-01-14T05:12:43", + "type": "string", + "format": "date-time" + }, + "project": { + "description": "Project ID", + "type": "integer" + }, + "activity": { + "description": "Activity ID", + "type": "integer" + }, + "description": { + "type": "string" + }, + "fixedRate": { + "description": "Fixed rate", + "type": "number" + }, + "hourlyRate": { + "description": "Hourly rate", + "type": "number" + }, + "user": { + "description": "User ID", + "type": "integer" + }, + "exported": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "tags": { + "description": "Comma separated list of tags", + "type": "string" + } + }, + "type": "object" + }, + "TagEntity": { + "required": [ + "name" + ], + "properties": { + "id": { + "title": "The internal ID", + "type": "integer" + }, + "name": { + "title": "The tag name", + "type": "string", + "maxLength": 100, + "minLength": 2, + "pattern": "((?!,).)*" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "TagEditForm": { + "required": [ + "name" + ], + "properties": { + "name": { + "description": "The tag name (forbidden character: comma)", + "type": "string" + }, + "color": { + "description": "The hexadecimal color code (default: #d2d6de)", + "type": "string" + } + }, + "type": "object" + }, + "ActivityCollection": { + "required": [ + "name", + "visible", + "billable" + ], + "properties": { + "parentTitle": { + "type": "string" + }, + "project": { + "type": "integer" + }, + "id": { + "title": "Internal ID", + "type": "integer" + }, + "name": { + "title": "Name of this activity", + "type": "string", + "maxLength": 150, + "minLength": 2 + }, + "comment": { + "title": "Description of this activity", + "type": "string" + }, + "visible": { + "title": "Whether this activity is visible and can be used for timesheets", + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "metaFields": { + "title": "Meta fields", + "description": "All visible meta (custom) fields registered with this activity", + "items": { + "$ref": "#/definitions/ActivityMeta" + }, + "type": "array" + }, + "teams": { + "title": "Teams", + "description": "If no team is assigned, everyone can access the activity", + "items": { + "$ref": "#/definitions/Team" + }, + "type": "array" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "ActivityRateForm": { + "required": [ + "rate" + ], + "properties": { + "user": { + "description": "User ID", + "type": "integer" + }, + "rate": { + "description": "The rate (eg. 10.5)", + "type": "number" + }, + "internalRate": { + "description": "The internal rate (eg. 10.0 or 10)", + "type": "number" + }, + "isFixed": { + "description": "If \"true\" each time record gets the same rate, regardless of its duration", + "type": "boolean" + } + }, + "type": "object" + }, + "ActivityRate": { + "required": [ + "isFixed" + ], + "properties": { + "id": { + "type": "integer" + }, + "user": { + "$ref": "#/definitions/User" + }, + "rate": { + "type": "number", + "format": "float", + "minimum": 0 + }, + "internalRate": { + "type": "number", + "format": "float" + }, + "isFixed": { + "type": "boolean" + } + }, + "type": "object" + }, + "ActivityExpanded": { + "required": [ + "name", + "visible", + "billable" + ], + "properties": { + "id": { + "title": "Internal ID", + "type": "integer" + }, + "project": { + "$ref": "#/definitions/Project" + }, + "name": { + "title": "Name of this activity", + "type": "string", + "maxLength": 150, + "minLength": 2 + }, + "comment": { + "title": "Description of this activity", + "type": "string" + }, + "visible": { + "title": "Whether this activity is visible and can be used for timesheets", + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "Activity": { + "required": [ + "name", + "visible", + "billable" + ], + "properties": { + "project": { + "type": "integer" + }, + "id": { + "title": "Internal ID", + "type": "integer" + }, + "name": { + "title": "Name of this activity", + "type": "string", + "maxLength": 150, + "minLength": 2 + }, + "comment": { + "title": "Description of this activity", + "type": "string" + }, + "visible": { + "title": "Whether this activity is visible and can be used for timesheets", + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "ActivityEntity": { + "required": [ + "name", + "visible", + "billable", + "budget", + "timeBudget" + ], + "properties": { + "parentTitle": { + "type": "string" + }, + "project": { + "type": "integer" + }, + "id": { + "title": "Internal ID", + "type": "integer" + }, + "name": { + "title": "Name of this activity", + "type": "string", + "maxLength": 150, + "minLength": 2 + }, + "comment": { + "title": "Description of this activity", + "type": "string" + }, + "visible": { + "title": "Whether this activity is visible and can be used for timesheets", + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "metaFields": { + "title": "Meta fields", + "description": "All visible meta (custom) fields registered with this activity", + "items": { + "$ref": "#/definitions/ActivityMeta" + }, + "type": "array" + }, + "teams": { + "title": "Teams", + "description": "If no team is assigned, everyone can access the activity", + "items": { + "$ref": "#/definitions/Team" + }, + "type": "array" + }, + "budget": { + "title": "The total monetary budget, will be zero if unconfigured.", + "type": "number", + "format": "float", + "maximum": 900000000000, + "minimum": 0 + }, + "timeBudget": { + "title": "The time budget in seconds, will be zero if unconfigured.", + "type": "integer", + "maximum": 2145600000, + "minimum": 0 + }, + "budgetType": { + "title": "The type of budget:\n - null = default / full time\n - month = monthly budget", + "type": "string" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "ActivityEditForm": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "comment": { + "type": "string" + }, + "invoiceText": { + "type": "string" + }, + "project": { + "description": "Project ID", + "type": "integer" + }, + "color": { + "description": "The hexadecimal color code (default: #d2d6de)", + "type": "string" + }, + "visible": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + } + }, + "type": "object" + }, + "ProjectCollection": { + "required": [ + "name", + "visible", + "billable", + "globalActivities" + ], + "properties": { + "parentTitle": { + "type": "string" + }, + "customer": { + "type": "integer" + }, + "id": { + "title": "Internal ID", + "type": "integer" + }, + "name": { + "title": "Project name", + "type": "string", + "maxLength": 150, + "minLength": 2 + }, + "start": { + "type": "string", + "format": "date-time" + }, + "end": { + "type": "string", + "format": "date-time" + }, + "comment": { + "type": "string" + }, + "visible": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "metaFields": { + "title": "Meta fields", + "description": "All visible meta (custom) fields registered with this project", + "items": { + "$ref": "#/definitions/ProjectMeta" + }, + "type": "array" + }, + "teams": { + "title": "Teams", + "description": "If no team is assigned, everyone can access the project (also depends on the teams of the customer)", + "items": { + "$ref": "#/definitions/Team" + }, + "type": "array" + }, + "globalActivities": { + "title": "Whether this project allows booking of global activities", + "type": "boolean" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "ProjectRateForm": { + "required": [ + "rate" + ], + "properties": { + "user": { + "description": "User ID", + "type": "integer" + }, + "rate": { + "description": "The rate (eg. 10.5)", + "type": "number" + }, + "internalRate": { + "description": "The internal rate (eg. 10.0 or 10)", + "type": "number" + }, + "isFixed": { + "description": "If \"true\" each time record gets the same rate, regardless of its duration", + "type": "boolean" + } + }, + "type": "object" + }, + "ProjectRate": { + "required": [ + "isFixed" + ], + "properties": { + "id": { + "type": "integer" + }, + "user": { + "$ref": "#/definitions/User" + }, + "rate": { + "type": "number", + "format": "float", + "minimum": 0 + }, + "internalRate": { + "type": "number", + "format": "float" + }, + "isFixed": { + "type": "boolean" + } + }, + "type": "object" + }, + "ProjectExpanded": { + "required": [ + "customer", + "name", + "visible", + "billable", + "globalActivities" + ], + "properties": { + "id": { + "title": "Internal ID", + "type": "integer" + }, + "customer": { + "$ref": "#/definitions/Customer" + }, + "name": { + "title": "Project name", + "type": "string", + "maxLength": 150, + "minLength": 2 + }, + "comment": { + "type": "string" + }, + "visible": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "globalActivities": { + "title": "Whether this project allows booking of global activities", + "type": "boolean" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "Project": { + "required": [ + "name", + "visible", + "billable", + "globalActivities" + ], + "properties": { + "customer": { + "type": "integer" + }, + "id": { + "title": "Internal ID", + "type": "integer" + }, + "name": { + "title": "Project name", + "type": "string", + "maxLength": 150, + "minLength": 2 + }, + "comment": { + "type": "string" + }, + "visible": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "globalActivities": { + "title": "Whether this project allows booking of global activities", + "type": "boolean" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "ProjectEntity": { + "required": [ + "name", + "visible", + "billable", + "globalActivities", + "budget", + "timeBudget" + ], + "properties": { + "parentTitle": { + "type": "string" + }, + "customer": { + "type": "integer" + }, + "id": { + "title": "Internal ID", + "type": "integer" + }, + "name": { + "title": "Project name", + "type": "string", + "maxLength": 150, + "minLength": 2 + }, + "orderNumber": { + "title": "Project order number", + "type": "string", + "maxLength": 50 + }, + "orderDate": { + "type": "string", + "format": "date-time" + }, + "start": { + "type": "string", + "format": "date-time" + }, + "end": { + "type": "string", + "format": "date-time" + }, + "comment": { + "type": "string" + }, + "visible": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "metaFields": { + "title": "Meta fields", + "description": "All visible meta (custom) fields registered with this project", + "items": { + "$ref": "#/definitions/ProjectMeta" + }, + "type": "array" + }, + "teams": { + "title": "Teams", + "description": "If no team is assigned, everyone can access the project (also depends on the teams of the customer)", + "items": { + "$ref": "#/definitions/Team" + }, + "type": "array" + }, + "globalActivities": { + "title": "Whether this project allows booking of global activities", + "type": "boolean" + }, + "budget": { + "title": "The total monetary budget, will be zero if unconfigured.", + "type": "number", + "format": "float", + "maximum": 900000000000, + "minimum": 0 + }, + "timeBudget": { + "title": "The time budget in seconds, will be zero if unconfigured.", + "type": "integer", + "maximum": 2145600000, + "minimum": 0 + }, + "budgetType": { + "title": "The type of budget:\n - null = default / full time\n - month = monthly budget", + "type": "string" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "ProjectEditForm": { + "required": [ + "name", + "customer" + ], + "properties": { + "name": { + "type": "string" + }, + "comment": { + "type": "string" + }, + "invoiceText": { + "type": "string" + }, + "orderNumber": { + "type": "string" + }, + "orderDate": { + "example": "2023-01-14T05:12:43", + "type": "string", + "format": "date-time" + }, + "start": { + "example": "2023-01-14T05:12:43", + "type": "string", + "format": "date-time" + }, + "end": { + "example": "2023-01-14T05:12:43", + "type": "string", + "format": "date-time" + }, + "customer": { + "description": "Customer ID", + "type": "integer" + }, + "color": { + "description": "The hexadecimal color code (default: #d2d6de)", + "type": "string" + }, + "visible": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "globalActivities": { + "type": "boolean" + } + }, + "type": "object" + }, + "CustomerCollection": { + "required": [ + "name", + "visible", + "billable", + "currency" + ], + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string", + "maxLength": 150, + "minLength": 2 + }, + "number": { + "type": "string", + "maxLength": 50 + }, + "comment": { + "type": "string" + }, + "visible": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "currency": { + "type": "string", + "maxLength": 3 + }, + "metaFields": { + "title": "Meta fields", + "description": "All visible meta (custom) fields registered with this customer", + "items": { + "$ref": "#/definitions/CustomerMeta" + }, + "type": "array" + }, + "teams": { + "title": "Teams", + "description": "If no team is assigned, everyone can access the customer", + "items": { + "$ref": "#/definitions/Team" + }, + "type": "array" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "CustomerRateForm": { + "required": [ + "rate" + ], + "properties": { + "user": { + "description": "User ID", + "type": "integer" + }, + "rate": { + "description": "The rate (eg. 10.5)", + "type": "number" + }, + "internalRate": { + "description": "The internal rate (eg. 10.0 or 10)", + "type": "number" + }, + "isFixed": { + "description": "If \"true\" each time record gets the same rate, regardless of its duration", + "type": "boolean" + } + }, + "type": "object" + }, + "CustomerRate": { + "required": [ + "isFixed" + ], + "properties": { + "id": { + "type": "integer" + }, + "user": { + "$ref": "#/definitions/User" + }, + "rate": { + "type": "number", + "format": "float", + "minimum": 0 + }, + "internalRate": { + "type": "number", + "format": "float" + }, + "isFixed": { + "type": "boolean" + } + }, + "type": "object" + }, + "Customer": { + "required": [ + "name", + "visible", + "billable" + ], + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string", + "maxLength": 150, + "minLength": 2 + }, + "number": { + "type": "string", + "maxLength": 50 + }, + "comment": { + "type": "string" + }, + "visible": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "CustomerEntity": { + "required": [ + "name", + "visible", + "billable", + "country", + "currency", + "timezone", + "budget", + "timeBudget" + ], + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string", + "maxLength": 150, + "minLength": 2 + }, + "number": { + "type": "string", + "maxLength": 50 + }, + "comment": { + "type": "string" + }, + "visible": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + }, + "company": { + "type": "string", + "maxLength": 255 + }, + "vatId": { + "type": "string", + "maxLength": 50 + }, + "contact": { + "type": "string", + "maxLength": 255 + }, + "address": { + "type": "string" + }, + "country": { + "type": "string", + "maxLength": 2 + }, + "currency": { + "type": "string", + "maxLength": 3 + }, + "phone": { + "type": "string", + "maxLength": 255 + }, + "fax": { + "type": "string", + "maxLength": 255 + }, + "mobile": { + "type": "string", + "maxLength": 255 + }, + "email": { + "title": "Customers contact email", + "description": "Limited via RFC to 254 chars", + "type": "string", + "maxLength": 254 + }, + "homepage": { + "type": "string", + "maxLength": 255 + }, + "timezone": { + "title": "Timezone of begin and end", + "description": "Length was determined by a MySQL column via \"use mysql;describe time_zone_name;\"", + "type": "string", + "maxLength": 64 + }, + "metaFields": { + "title": "Meta fields", + "description": "All visible meta (custom) fields registered with this customer", + "items": { + "$ref": "#/definitions/CustomerMeta" + }, + "type": "array" + }, + "teams": { + "title": "Teams", + "description": "If no team is assigned, everyone can access the customer", + "items": { + "$ref": "#/definitions/Team" + }, + "type": "array" + }, + "budget": { + "title": "The total monetary budget, will be zero if unconfigured.", + "type": "number", + "format": "float", + "maximum": 900000000000, + "minimum": 0 + }, + "timeBudget": { + "title": "The time budget in seconds, will be zero if unconfigured.", + "type": "integer", + "maximum": 2145600000, + "minimum": 0 + }, + "budgetType": { + "title": "The type of budget:\n - null = default / full time\n - month = monthly budget", + "type": "string" + }, + "color": { + "title": "The assigned color in HTML hex format, eg. #dd1d00", + "type": "string" + } + }, + "type": "object" + }, + "CustomerEditForm": { + "required": [ + "name", + "country", + "currency", + "timezone" + ], + "properties": { + "name": { + "type": "string" + }, + "number": { + "type": "string" + }, + "comment": { + "type": "string" + }, + "company": { + "type": "string" + }, + "vatId": { + "type": "string" + }, + "contact": { + "type": "string" + }, + "address": { + "type": "string" + }, + "country": { + "type": "string" + }, + "currency": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "fax": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "email": { + "type": "string" + }, + "homepage": { + "type": "string" + }, + "timezone": { + "type": "string" + }, + "color": { + "description": "The hexadecimal color code (default: #d2d6de)", + "type": "string" + }, + "visible": { + "type": "boolean" + }, + "billable": { + "type": "boolean" + } + }, + "type": "object" + }, + "UserAuthCodes": { + "properties": { + "user": { + "$ref": "#/definitions/User" + }, + "codes": { + "items": { + "$ref": "#/definitions/UserAuth" + }, + "type": "array" + } + }, + "type": "object" + }, + "UserAuth": { + "required": [ + "type", + "code" + ], + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + } + }, + "type": "object" + }, + "ExpenseCategory": { + "required": [ + "name", + "visible" + ], + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string", + "maxLength": 100, + "minLength": 2 + }, + "visible": { + "type": "boolean" + } + }, + "type": "object" + }, + "ExpenseEntity": { + "required": [ + "category", + "cost", + "exported", + "refundable" + ], + "properties": { + "id": { + "type": "integer" + }, + "category": { + "$ref": "#/definitions/ExpenseCategory" + }, + "description": { + "type": "string" + }, + "cost": { + "type": "number", + "format": "float" + }, + "multiplier": { + "type": "number", + "format": "float", + "minimum": 0 + }, + "exported": { + "type": "boolean" + }, + "refundable": { + "type": "boolean" + }, + "total": { + "type": "number", + "format": "float" + }, + "begin": { + "type": "string", + "format": "date-time" + }, + "activity": { + "type": "integer" + }, + "project": { + "type": "integer" + }, + "user": { + "type": "integer" + }, + "metaFields": { + "items": { + "$ref": "#/definitions/ExpenseMeta" + }, + "type": "array" + } + }, + "type": "object" + }, + "ExpenseEditForm": { + "required": [ + "project", + "expenseCategory", + "multiplier", + "begin" + ], + "properties": { + "customer": { + "description": "Customer ID", + "type": "integer" + }, + "project": { + "description": "Project ID", + "type": "integer" + }, + "activity": { + "description": "Activity ID", + "type": "integer" + }, + "expenseCategory": { + "type": "string", + "format": "KimaiPlugin\\ExpensesBundle\\Entity\\ExpenseCategory id" + }, + "description": { + "type": "string" + }, + "multiplier": { + "type": "number" + }, + "refundable": { + "type": "boolean" + }, + "begin": { + "example": "2023-01-14T05:12:43", + "type": "string", + "format": "date-time" + } + }, + "type": "object" + }, + "MetaFieldRule": { + "required": [ + "name", + "type", + "visible", + "required" + ], + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "label": { + "type": "string", + "maxLength": 50 + }, + "help": { + "type": "string", + "maxLength": 200 + }, + "value": { + "type": "string" + }, + "type": { + "type": "string", + "maxLength": 100 + }, + "visible": { + "type": "boolean" + }, + "required": { + "type": "boolean" + }, + "entityType": { + "type": "string" + }, + "customer": { + "type": "integer" + }, + "project": { + "type": "integer" + }, + "activity": { + "type": "integer" + } + }, + "type": "object" + }, + "TaskQuery": { + "required": [ + "customers", + "projects", + "activities", + "order", + "orderBy" + ], + "properties": { + "searchTerm": { + "type": "string" + }, + "customers": { + "description": "Array of customer IDs", + "items": { + "description": "Customer ID", + "type": "integer" + }, + "type": "array" + }, + "projects": { + "description": "Array of project IDs", + "items": { + "description": "Project ID", + "type": "integer" + }, + "type": "array" + }, + "activities": { + "description": "Array of activity IDs", + "items": { + "description": "Activity ID", + "type": "integer" + }, + "type": "array" + }, + "tags": { + "description": "Comma separated list of tags", + "type": "string" + }, + "users": { + "description": "Array of user IDs", + "items": { + "description": "User ID", + "type": "integer" + }, + "type": "array" + }, + "teams": { + "description": "Array of team IDs", + "items": { + "description": "Team ID", + "type": "integer" + }, + "type": "array" + }, + "status": { + "items": { + "type": "string", + "enum": [ + "pending", + "progress", + "closed" + ] + }, + "type": "array" + }, + "pageSize": { + "type": "number", + "enum": [ + 10, + 15, + 20, + 25, + 30, + 35, + 40, + 45, + 50, + 60, + 70, + 80, + 90, + 100, + 125, + 150, + 175, + 200, + 250, + 300, + 350, + 400, + 450, + 500 + ] + }, + "page": { + "description": "Page number. Default: 1", + "type": "integer" + }, + "order": { + "description": "The order for returned items", + "type": "string", + "enum": [ + "ASC", + "DESC" + ] + }, + "orderBy": { + "type": "string", + "enum": [ + "title", + "customer", + "project", + "activity", + "description", + "status", + "user", + "begin", + "end", + "team" + ] + } + }, + "type": "object" + }, + "TaskLogWorkForm": { + "properties": { + "begin": { + "example": "2023-01-14T05:12:43", + "type": "string", + "format": "date-time" + }, + "end": { + "example": "2023-01-14T05:12:43", + "type": "string", + "format": "date-time" + } + }, + "type": "object" + }, + "Task": { + "required": [ + "title", + "status", + "project", + "activity" + ], + "properties": { + "tags": { + "items": { + "type": "string" + }, + "type": "array" + }, + "activeTimesheets": { + "items": { + "$ref": "#/definitions/TimesheetEntityExpanded" + }, + "type": "array" + }, + "id": { + "type": "integer" + }, + "title": { + "type": "string", + "maxLength": 100, + "minLength": 2 + }, + "status": { + "type": "string", + "maxLength": 20 + }, + "todo": { + "type": "string" + }, + "description": { + "type": "string" + }, + "project": { + "$ref": "#/definitions/ProjectExpanded" + }, + "activity": { + "$ref": "#/definitions/ActivityExpanded" + }, + "user": { + "$ref": "#/definitions/User" + }, + "team": { + "$ref": "#/definitions/Team" + }, + "end": { + "type": "string", + "format": "date-time" + }, + "estimation": { + "title": "Estimated duration for the task in seconds or null if no estimation was added", + "type": "integer", + "minimum": 0 + } + }, + "type": "object" + }, + "TaskEditForm": { + "required": [ + "title", + "project", + "activity" + ], + "properties": { + "title": { + "type": "string" + }, + "todo": { + "description": "The actual doings, which will be available on the detail and edit page.", + "type": "string" + }, + "end": { + "example": "2023-01-14T05:12:43", + "type": "string", + "format": "date-time" + }, + "project": { + "description": "Project ID", + "type": "integer" + }, + "activity": { + "description": "Activity ID", + "type": "integer" + }, + "description": { + "type": "string" + }, + "tags": { + "description": "Comma separated list of tags", + "type": "string" + }, + "user": { + "description": "User ID", + "type": "integer" + }, + "team": { + "description": "Team ID", + "type": "integer" + }, + "estimation": { + "description": "Estimation in seconds", + "type": "integer" + } + }, + "type": "object" + }, + "I18nConfig": { + "properties": { + "formDate": { + "title": "Format used for toolbar queries", + "type": "string" + }, + "dateTime": { + "title": "Format used to display date-time values (see PHP function date_format)", + "type": "string" + }, + "date": { + "title": "Format used to display date values (see PHP function date_format)", + "type": "string" + }, + "time": { + "title": "Format used to display times (see PHP function date_format)", + "type": "string" + }, + "duration": { + "title": "Format used to display durations (replace: %h with hours, %m with minutes, %s with seconds)", + "type": "string" + }, + "is24hours": { + "title": "Whether a twenty-four hour format is used (true) or 12-hours AM/PM format (false)", + "type": "boolean" + }, + "now": { + "title": "The current time of the user", + "type": "string", + "format": "date-time" + } + }, + "type": "object" + }, + "TimesheetConfig": { + "properties": { + "trackingMode": { + "title": "The time-tracking mode, see also: https://www.kimai.org/documentation/timesheet.html#tracking-modes", + "type": "string" + }, + "defaultBeginTime": { + "title": "Default begin datetime in PHP format", + "type": "string" + }, + "activeEntriesHardLimit": { + "title": "How many running timesheets a user is allowed to have at the same time", + "type": "integer" + }, + "activeEntriesSoftLimit": { + "title": "How many running timesheets a user is allowed before a warning is shown", + "type": "integer" + }, + "isAllowFutureTimes": { + "title": "Whether entries for future times are allowed", + "type": "boolean" + }, + "isAllowOverlapping": { + "title": "Whether overlapping entries are allowed", + "type": "boolean" + } + }, + "type": "object" + }, + "Version": { + "properties": { + "version": { + "title": "Kimai Version, eg. \"1.14\"", + "type": "string" + }, + "versionId": { + "title": "Kimai Version as integer, eg. 11400", + "description": "Follows the same logic as PHP_VERSION_ID, see https://www.php.net/manual/de/function.phpversion.php", + "type": "integer" + }, + "candidate": { + "title": "Candidate: either \"prod\" or \"dev\"", + "type": "string" + }, + "semver": { + "title": "Full version including status, eg: \"1.9-prod\"", + "type": "string" + }, + "name": { + "title": "The version name", + "type": "string" + }, + "copyright": { + "title": "A full copyright notice", + "type": "string" + } + }, + "type": "object" + }, + "Plugin": { + "properties": { + "name": { + "title": "The plugin name, eg. \"ExpensesBundle\"", + "type": "string" + }, + "version": { + "title": "The plugin version, eg. \"1.14\"", + "type": "string" + } + }, + "type": "object" + }, + "TimesheetMeta": { + "required": [ + "name" + ], + "properties": { + "name": { + "title": "Name of the meta (custom) field", + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "value": { + "title": "Value of the meta (custom) field", + "type": "string", + "maxLength": 65535 + } + }, + "type": "object" + }, + "ActivityMeta": { + "required": [ + "name" + ], + "properties": { + "name": { + "title": "Name of the meta (custom) field", + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "value": { + "title": "Value of the meta (custom) field", + "type": "string", + "maxLength": 65535 + } + }, + "type": "object" + }, + "ProjectMeta": { + "required": [ + "name" + ], + "properties": { + "name": { + "title": "Name of the meta (custom) field", + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "value": { + "title": "Value of the meta (custom) field", + "type": "string", + "maxLength": 65535 + } + }, + "type": "object" + }, + "CustomerMeta": { + "required": [ + "name" + ], + "properties": { + "name": { + "title": "Name of the meta (custom) field", + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "value": { + "title": "Value of the meta (custom) field", + "type": "string", + "maxLength": 65535 + } + }, + "type": "object" + }, + "ExpenseMeta": { + "required": [ + "name" + ], + "properties": { + "name": { + "title": "Name of the meta (custom) field", + "type": "string", + "maxLength": 50, + "minLength": 2 + }, + "value": { + "title": "Value of the meta (custom) field", + "type": "string", + "maxLength": 65535 + } + }, + "type": "object" + } + }, + "securityDefinitions": { + "apiUser": { + "name": "X-AUTH-USER", + "type": "apiKey", + "in": "header", + "description": "Value: {Username}" + }, + "apiToken": { + "name": "X-AUTH-TOKEN", + "type": "apiKey", + "in": "header", + "description": "Value: {API Token}" + } + }, + "security": [ + { + "X-AUTH-USER": [] + }, + { + "X-AUTH-TOKEN": [] + } + ], + "host": "demo.kimai.org" +} diff --git a/example.go b/example.go new file mode 100644 index 0000000..51f9755 --- /dev/null +++ b/example.go @@ -0,0 +1,37 @@ +package main + +import ( + "decentral1se/go-kimai/client" + "decentral1se/go-kimai/client/customer" + "fmt" + "log" + "os" + + httpTransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +func main() { + user := os.Getenv("GO_KIMAI_USER") + token := os.Getenv("GO_KIMAI_TOKEN") + authUser := httpTransport.APIKeyAuth("X-AUTH-USER", "header", user) + authToken := httpTransport.APIKeyAuth("X-AUTH-TOKEN", "header", token) + auth := httpTransport.Compose(authUser, authToken) + + domain := os.Getenv("GO_KIMAI_DOMAIN") + transport := httpTransport.New(domain, "", []string{"https"}) + cl := client.New(transport, strfmt.Default) + + csParams := customer.NewGetAPICustomersParams() + csParams.WithOrder("ASC") + csParams.WithOrderBy("name") + + resp, err := cl.Customer.GetAPICustomers(csParams, auth) + if err != nil { + log.Fatal(err) + } + + for _, cs := range resp.Payload { + fmt.Println(*cs.Name) + } +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..8ac90a0 --- /dev/null +++ b/go.mod @@ -0,0 +1,36 @@ +module decentral1se/go-kimai + +go 1.18 + +require ( + github.com/go-openapi/errors v0.20.3 + github.com/go-openapi/runtime v0.25.0 + github.com/go-openapi/strfmt v0.21.3 + github.com/go-openapi/swag v0.22.3 + github.com/go-openapi/validate v0.22.0 +) + +require ( + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect + github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/analysis v0.21.2 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.19.6 // indirect + github.com/go-openapi/loads v0.21.1 // indirect + github.com/go-openapi/spec v0.20.4 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mitchellh/mapstructure v1.4.3 // indirect + github.com/oklog/ulid v1.3.1 // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect + go.mongodb.org/mongo-driver v1.10.0 // indirect + go.opentelemetry.io/otel v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect + golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect + golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..50ea272 --- /dev/null +++ b/go.sum @@ -0,0 +1,204 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/analysis v0.21.2 h1:hXFrOYFHUAMQdu6zwAiKKJHJQ8kqZs1ux/ru1P1wLJU= +github.com/go-openapi/analysis v0.21.2/go.mod h1:HZwRk4RRisyG8vx2Oe6aqeSQcoxRp47Xkp3+K6q+LdY= +github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.20.3 h1:rz6kiC84sqNQoqrtulzaL/VERgkoCyB6WdEkc2ujzUc= +github.com/go-openapi/errors v0.20.3/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs= +github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= +github.com/go-openapi/loads v0.21.1 h1:Wb3nVZpdEzDTcly8S4HMkey6fjARRzb7iEaySimlDW0= +github.com/go-openapi/loads v0.21.1/go.mod h1:/DtAMXXneXFjbQMGEtbamCZb+4x7eGwkvZCvBmwUG+g= +github.com/go-openapi/runtime v0.25.0 h1:7yQTCdRbWhX8vnIjdzU8S00tBYf7Sg71EBeorlPHvhc= +github.com/go-openapi/runtime v0.25.0/go.mod h1:Ux6fikcHXyyob6LNWxtE96hWwjBPYF0DXgVFuMTneOs= +github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M= +github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= +github.com/go-openapi/strfmt v0.21.0/go.mod h1:ZRQ409bWMj+SOgXofQAGTIo2Ebu72Gs+WaRADcS5iNg= +github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= +github.com/go-openapi/strfmt v0.21.3 h1:xwhj5X6CjXEZZHMWy1zKJxvW9AfHC9pkyUjLvHtKG7o= +github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/validate v0.22.0 h1:b0QecH6VslW/TxtpKgzpO1SNG7GU2FsaqKdP1E2T50Y= +github.com/go-openapi/validate v0.22.0/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= +github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= +github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= +github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= +github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= +github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= +github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= +github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= +github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= +github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= +github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= +github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= +github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= +github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= +github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= +github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= +github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= +github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= +go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= +go.mongodb.org/mongo-driver v1.10.0 h1:UtV6N5k14upNp4LTduX0QCufG124fSu25Wz9tu94GLg= +go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= +go.opentelemetry.io/otel v1.11.1 h1:4WLLAmcfkmDk2ukNXJyq3/kiz/3UzCaYq6PskJsaou4= +go.opentelemetry.io/otel v1.11.1/go.mod h1:1nNhXBbWSD0nsL38H6btgnFN2k4i0sNLHNNMZMSbUGE= +go.opentelemetry.io/otel/sdk v1.11.1 h1:F7KmQgoHljhUuJyA+9BiU+EkJfyX5nVVF4wyzWZpKxs= +go.opentelemetry.io/otel/trace v1.11.1 h1:ofxdnzsNrGBYXbP7t7zpUK281+go5rF7dvdIZXF8gdQ= +go.opentelemetry.io/otel/trace v1.11.1/go.mod h1:f/Q9G7vzk5u91PhbmKbg1Qn0rzH1LJ4vbPHFGkTPtOk= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/models/activity.go b/models/activity.go new file mode 100644 index 0000000..5896f66 --- /dev/null +++ b/models/activity.go @@ -0,0 +1,127 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Activity activity +// +// swagger:model Activity +type Activity struct { + + // billable + // Required: true + Billable *bool `json:"billable"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // Description of this activity + Comment string `json:"comment,omitempty"` + + // Internal ID + ID int64 `json:"id,omitempty"` + + // Name of this activity + // Required: true + // Max Length: 150 + // Min Length: 2 + Name *string `json:"name"` + + // project + Project int64 `json:"project,omitempty"` + + // Whether this activity is visible and can be used for timesheets + // Required: true + Visible *bool `json:"visible"` +} + +// Validate validates this activity +func (m *Activity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisible(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Activity) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *Activity) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 150); err != nil { + return err + } + + return nil +} + +func (m *Activity) validateVisible(formats strfmt.Registry) error { + + if err := validate.Required("visible", "body", m.Visible); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this activity based on context it is used +func (m *Activity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Activity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Activity) UnmarshalBinary(b []byte) error { + var res Activity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/activity_collection.go b/models/activity_collection.go new file mode 100644 index 0000000..8cd0846 --- /dev/null +++ b/models/activity_collection.go @@ -0,0 +1,254 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ActivityCollection activity collection +// +// swagger:model ActivityCollection +type ActivityCollection struct { + + // billable + // Required: true + Billable *bool `json:"billable"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // Description of this activity + Comment string `json:"comment,omitempty"` + + // Internal ID + ID int64 `json:"id,omitempty"` + + // Meta fields + // + // All visible meta (custom) fields registered with this activity + MetaFields []*ActivityMeta `json:"metaFields"` + + // Name of this activity + // Required: true + // Max Length: 150 + // Min Length: 2 + Name *string `json:"name"` + + // parent title + ParentTitle string `json:"parentTitle,omitempty"` + + // project + Project int64 `json:"project,omitempty"` + + // Teams + // + // If no team is assigned, everyone can access the activity + Teams []*Team `json:"teams"` + + // Whether this activity is visible and can be used for timesheets + // Required: true + Visible *bool `json:"visible"` +} + +// Validate validates this activity collection +func (m *ActivityCollection) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMetaFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTeams(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisible(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActivityCollection) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *ActivityCollection) validateMetaFields(formats strfmt.Registry) error { + if swag.IsZero(m.MetaFields) { // not required + return nil + } + + for i := 0; i < len(m.MetaFields); i++ { + if swag.IsZero(m.MetaFields[i]) { // not required + continue + } + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ActivityCollection) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 150); err != nil { + return err + } + + return nil +} + +func (m *ActivityCollection) validateTeams(formats strfmt.Registry) error { + if swag.IsZero(m.Teams) { // not required + return nil + } + + for i := 0; i < len(m.Teams); i++ { + if swag.IsZero(m.Teams[i]) { // not required + continue + } + + if m.Teams[i] != nil { + if err := m.Teams[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ActivityCollection) validateVisible(formats strfmt.Registry) error { + + if err := validate.Required("visible", "body", m.Visible); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this activity collection based on the context it is used +func (m *ActivityCollection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMetaFields(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTeams(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActivityCollection) contextValidateMetaFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MetaFields); i++ { + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ActivityCollection) contextValidateTeams(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Teams); i++ { + + if m.Teams[i] != nil { + if err := m.Teams[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ActivityCollection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ActivityCollection) UnmarshalBinary(b []byte) error { + var res ActivityCollection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/activity_edit_form.go b/models/activity_edit_form.go new file mode 100644 index 0000000..cb124dc --- /dev/null +++ b/models/activity_edit_form.go @@ -0,0 +1,89 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ActivityEditForm activity edit form +// +// swagger:model ActivityEditForm +type ActivityEditForm struct { + + // billable + Billable bool `json:"billable,omitempty"` + + // The hexadecimal color code (default: #d2d6de) + Color string `json:"color,omitempty"` + + // comment + Comment string `json:"comment,omitempty"` + + // invoice text + InvoiceText string `json:"invoiceText,omitempty"` + + // name + // Required: true + Name *string `json:"name"` + + // Project ID + Project int64 `json:"project,omitempty"` + + // visible + Visible bool `json:"visible,omitempty"` +} + +// Validate validates this activity edit form +func (m *ActivityEditForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActivityEditForm) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this activity edit form based on context it is used +func (m *ActivityEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ActivityEditForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ActivityEditForm) UnmarshalBinary(b []byte) error { + var res ActivityEditForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/activity_entity.go b/models/activity_entity.go new file mode 100644 index 0000000..1289f89 --- /dev/null +++ b/models/activity_entity.go @@ -0,0 +1,313 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ActivityEntity activity entity +// +// swagger:model ActivityEntity +type ActivityEntity struct { + + // billable + // Required: true + Billable *bool `json:"billable"` + + // The total monetary budget, will be zero if unconfigured. + // Required: true + // Maximum: 9e+11 + // Minimum: 0 + Budget *float32 `json:"budget"` + + // The type of budget: + // - null = default / full time + // - month = monthly budget + BudgetType string `json:"budgetType,omitempty"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // Description of this activity + Comment string `json:"comment,omitempty"` + + // Internal ID + ID int64 `json:"id,omitempty"` + + // Meta fields + // + // All visible meta (custom) fields registered with this activity + MetaFields []*ActivityMeta `json:"metaFields"` + + // Name of this activity + // Required: true + // Max Length: 150 + // Min Length: 2 + Name *string `json:"name"` + + // parent title + ParentTitle string `json:"parentTitle,omitempty"` + + // project + Project int64 `json:"project,omitempty"` + + // Teams + // + // If no team is assigned, everyone can access the activity + Teams []*Team `json:"teams"` + + // The time budget in seconds, will be zero if unconfigured. + // Required: true + // Maximum: 2.1456e+09 + // Minimum: 0 + TimeBudget *int64 `json:"timeBudget"` + + // Whether this activity is visible and can be used for timesheets + // Required: true + Visible *bool `json:"visible"` +} + +// Validate validates this activity entity +func (m *ActivityEntity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBudget(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMetaFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTeams(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimeBudget(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisible(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActivityEntity) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *ActivityEntity) validateBudget(formats strfmt.Registry) error { + + if err := validate.Required("budget", "body", m.Budget); err != nil { + return err + } + + if err := validate.Minimum("budget", "body", float64(*m.Budget), 0, false); err != nil { + return err + } + + if err := validate.Maximum("budget", "body", float64(*m.Budget), 9e+11, false); err != nil { + return err + } + + return nil +} + +func (m *ActivityEntity) validateMetaFields(formats strfmt.Registry) error { + if swag.IsZero(m.MetaFields) { // not required + return nil + } + + for i := 0; i < len(m.MetaFields); i++ { + if swag.IsZero(m.MetaFields[i]) { // not required + continue + } + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ActivityEntity) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 150); err != nil { + return err + } + + return nil +} + +func (m *ActivityEntity) validateTeams(formats strfmt.Registry) error { + if swag.IsZero(m.Teams) { // not required + return nil + } + + for i := 0; i < len(m.Teams); i++ { + if swag.IsZero(m.Teams[i]) { // not required + continue + } + + if m.Teams[i] != nil { + if err := m.Teams[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ActivityEntity) validateTimeBudget(formats strfmt.Registry) error { + + if err := validate.Required("timeBudget", "body", m.TimeBudget); err != nil { + return err + } + + if err := validate.MinimumInt("timeBudget", "body", *m.TimeBudget, 0, false); err != nil { + return err + } + + if err := validate.MaximumInt("timeBudget", "body", *m.TimeBudget, 2.1456e+09, false); err != nil { + return err + } + + return nil +} + +func (m *ActivityEntity) validateVisible(formats strfmt.Registry) error { + + if err := validate.Required("visible", "body", m.Visible); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this activity entity based on the context it is used +func (m *ActivityEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMetaFields(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTeams(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActivityEntity) contextValidateMetaFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MetaFields); i++ { + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ActivityEntity) contextValidateTeams(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Teams); i++ { + + if m.Teams[i] != nil { + if err := m.Teams[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ActivityEntity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ActivityEntity) UnmarshalBinary(b []byte) error { + var res ActivityEntity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/activity_expanded.go b/models/activity_expanded.go new file mode 100644 index 0000000..a39f0db --- /dev/null +++ b/models/activity_expanded.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ActivityExpanded activity expanded +// +// swagger:model ActivityExpanded +type ActivityExpanded struct { + + // billable + // Required: true + Billable *bool `json:"billable"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // Description of this activity + Comment string `json:"comment,omitempty"` + + // Internal ID + ID int64 `json:"id,omitempty"` + + // Name of this activity + // Required: true + // Max Length: 150 + // Min Length: 2 + Name *string `json:"name"` + + // project + Project *Project `json:"project,omitempty"` + + // Whether this activity is visible and can be used for timesheets + // Required: true + Visible *bool `json:"visible"` +} + +// Validate validates this activity expanded +func (m *ActivityExpanded) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProject(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisible(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActivityExpanded) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *ActivityExpanded) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 150); err != nil { + return err + } + + return nil +} + +func (m *ActivityExpanded) validateProject(formats strfmt.Registry) error { + if swag.IsZero(m.Project) { // not required + return nil + } + + if m.Project != nil { + if err := m.Project.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("project") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("project") + } + return err + } + } + + return nil +} + +func (m *ActivityExpanded) validateVisible(formats strfmt.Registry) error { + + if err := validate.Required("visible", "body", m.Visible); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this activity expanded based on the context it is used +func (m *ActivityExpanded) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateProject(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActivityExpanded) contextValidateProject(ctx context.Context, formats strfmt.Registry) error { + + if m.Project != nil { + if err := m.Project.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("project") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("project") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ActivityExpanded) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ActivityExpanded) UnmarshalBinary(b []byte) error { + var res ActivityExpanded + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/activity_meta.go b/models/activity_meta.go new file mode 100644 index 0000000..80de18b --- /dev/null +++ b/models/activity_meta.go @@ -0,0 +1,101 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ActivityMeta activity meta +// +// swagger:model ActivityMeta +type ActivityMeta struct { + + // Name of the meta (custom) field + // Required: true + // Max Length: 50 + // Min Length: 2 + Name *string `json:"name"` + + // Value of the meta (custom) field + // Max Length: 65535 + Value string `json:"value,omitempty"` +} + +// Validate validates this activity meta +func (m *ActivityMeta) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActivityMeta) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 50); err != nil { + return err + } + + return nil +} + +func (m *ActivityMeta) validateValue(formats strfmt.Registry) error { + if swag.IsZero(m.Value) { // not required + return nil + } + + if err := validate.MaxLength("value", "body", m.Value, 65535); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this activity meta based on context it is used +func (m *ActivityMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ActivityMeta) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ActivityMeta) UnmarshalBinary(b []byte) error { + var res ActivityMeta + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/activity_rate.go b/models/activity_rate.go new file mode 100644 index 0000000..492971d --- /dev/null +++ b/models/activity_rate.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ActivityRate activity rate +// +// swagger:model ActivityRate +type ActivityRate struct { + + // id + ID int64 `json:"id,omitempty"` + + // internal rate + InternalRate float32 `json:"internalRate,omitempty"` + + // is fixed + // Required: true + IsFixed *bool `json:"isFixed"` + + // rate + // Minimum: 0 + Rate *float32 `json:"rate,omitempty"` + + // user + User *User `json:"user,omitempty"` +} + +// Validate validates this activity rate +func (m *ActivityRate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIsFixed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActivityRate) validateIsFixed(formats strfmt.Registry) error { + + if err := validate.Required("isFixed", "body", m.IsFixed); err != nil { + return err + } + + return nil +} + +func (m *ActivityRate) validateRate(formats strfmt.Registry) error { + if swag.IsZero(m.Rate) { // not required + return nil + } + + if err := validate.Minimum("rate", "body", float64(*m.Rate), 0, false); err != nil { + return err + } + + return nil +} + +func (m *ActivityRate) validateUser(formats strfmt.Registry) error { + if swag.IsZero(m.User) { // not required + return nil + } + + if m.User != nil { + if err := m.User.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// ContextValidate validate this activity rate based on the context it is used +func (m *ActivityRate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActivityRate) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { + + if m.User != nil { + if err := m.User.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ActivityRate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ActivityRate) UnmarshalBinary(b []byte) error { + var res ActivityRate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/activity_rate_form.go b/models/activity_rate_form.go new file mode 100644 index 0000000..67e24fe --- /dev/null +++ b/models/activity_rate_form.go @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ActivityRateForm activity rate form +// +// swagger:model ActivityRateForm +type ActivityRateForm struct { + + // The internal rate (eg. 10.0 or 10) + InternalRate float64 `json:"internalRate,omitempty"` + + // If "true" each time record gets the same rate, regardless of its duration + IsFixed bool `json:"isFixed,omitempty"` + + // The rate (eg. 10.5) + // Required: true + Rate *float64 `json:"rate"` + + // User ID + User int64 `json:"user,omitempty"` +} + +// Validate validates this activity rate form +func (m *ActivityRateForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActivityRateForm) validateRate(formats strfmt.Registry) error { + + if err := validate.Required("rate", "body", m.Rate); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this activity rate form based on context it is used +func (m *ActivityRateForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ActivityRateForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ActivityRateForm) UnmarshalBinary(b []byte) error { + var res ActivityRateForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/customer.go b/models/customer.go new file mode 100644 index 0000000..bf1a5fd --- /dev/null +++ b/models/customer.go @@ -0,0 +1,144 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Customer customer +// +// swagger:model Customer +type Customer struct { + + // billable + // Required: true + Billable *bool `json:"billable"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // comment + Comment string `json:"comment,omitempty"` + + // id + ID int64 `json:"id,omitempty"` + + // name + // Required: true + // Max Length: 150 + // Min Length: 2 + Name *string `json:"name"` + + // number + // Max Length: 50 + Number string `json:"number,omitempty"` + + // visible + // Required: true + Visible *bool `json:"visible"` +} + +// Validate validates this customer +func (m *Customer) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNumber(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisible(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Customer) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *Customer) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 150); err != nil { + return err + } + + return nil +} + +func (m *Customer) validateNumber(formats strfmt.Registry) error { + if swag.IsZero(m.Number) { // not required + return nil + } + + if err := validate.MaxLength("number", "body", m.Number, 50); err != nil { + return err + } + + return nil +} + +func (m *Customer) validateVisible(formats strfmt.Registry) error { + + if err := validate.Required("visible", "body", m.Visible); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this customer based on context it is used +func (m *Customer) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Customer) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Customer) UnmarshalBinary(b []byte) error { + var res Customer + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/customer_collection.go b/models/customer_collection.go new file mode 100644 index 0000000..816a076 --- /dev/null +++ b/models/customer_collection.go @@ -0,0 +1,290 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CustomerCollection customer collection +// +// swagger:model CustomerCollection +type CustomerCollection struct { + + // billable + // Required: true + Billable *bool `json:"billable"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // comment + Comment string `json:"comment,omitempty"` + + // currency + // Required: true + // Max Length: 3 + Currency *string `json:"currency"` + + // id + ID int64 `json:"id,omitempty"` + + // Meta fields + // + // All visible meta (custom) fields registered with this customer + MetaFields []*CustomerMeta `json:"metaFields"` + + // name + // Required: true + // Max Length: 150 + // Min Length: 2 + Name *string `json:"name"` + + // number + // Max Length: 50 + Number string `json:"number,omitempty"` + + // Teams + // + // If no team is assigned, everyone can access the customer + Teams []*Team `json:"teams"` + + // visible + // Required: true + Visible *bool `json:"visible"` +} + +// Validate validates this customer collection +func (m *CustomerCollection) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCurrency(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMetaFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNumber(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTeams(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisible(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CustomerCollection) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *CustomerCollection) validateCurrency(formats strfmt.Registry) error { + + if err := validate.Required("currency", "body", m.Currency); err != nil { + return err + } + + if err := validate.MaxLength("currency", "body", *m.Currency, 3); err != nil { + return err + } + + return nil +} + +func (m *CustomerCollection) validateMetaFields(formats strfmt.Registry) error { + if swag.IsZero(m.MetaFields) { // not required + return nil + } + + for i := 0; i < len(m.MetaFields); i++ { + if swag.IsZero(m.MetaFields[i]) { // not required + continue + } + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CustomerCollection) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 150); err != nil { + return err + } + + return nil +} + +func (m *CustomerCollection) validateNumber(formats strfmt.Registry) error { + if swag.IsZero(m.Number) { // not required + return nil + } + + if err := validate.MaxLength("number", "body", m.Number, 50); err != nil { + return err + } + + return nil +} + +func (m *CustomerCollection) validateTeams(formats strfmt.Registry) error { + if swag.IsZero(m.Teams) { // not required + return nil + } + + for i := 0; i < len(m.Teams); i++ { + if swag.IsZero(m.Teams[i]) { // not required + continue + } + + if m.Teams[i] != nil { + if err := m.Teams[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CustomerCollection) validateVisible(formats strfmt.Registry) error { + + if err := validate.Required("visible", "body", m.Visible); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this customer collection based on the context it is used +func (m *CustomerCollection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMetaFields(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTeams(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CustomerCollection) contextValidateMetaFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MetaFields); i++ { + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CustomerCollection) contextValidateTeams(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Teams); i++ { + + if m.Teams[i] != nil { + if err := m.Teams[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CustomerCollection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CustomerCollection) UnmarshalBinary(b []byte) error { + var res CustomerCollection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/customer_edit_form.go b/models/customer_edit_form.go new file mode 100644 index 0000000..0f282f2 --- /dev/null +++ b/models/customer_edit_form.go @@ -0,0 +1,164 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CustomerEditForm customer edit form +// +// swagger:model CustomerEditForm +type CustomerEditForm struct { + + // address + Address string `json:"address,omitempty"` + + // billable + Billable bool `json:"billable,omitempty"` + + // The hexadecimal color code (default: #d2d6de) + Color string `json:"color,omitempty"` + + // comment + Comment string `json:"comment,omitempty"` + + // company + Company string `json:"company,omitempty"` + + // contact + Contact string `json:"contact,omitempty"` + + // country + // Required: true + Country *string `json:"country"` + + // currency + // Required: true + Currency *string `json:"currency"` + + // email + Email string `json:"email,omitempty"` + + // fax + Fax string `json:"fax,omitempty"` + + // homepage + Homepage string `json:"homepage,omitempty"` + + // mobile + Mobile string `json:"mobile,omitempty"` + + // name + // Required: true + Name *string `json:"name"` + + // number + Number string `json:"number,omitempty"` + + // phone + Phone string `json:"phone,omitempty"` + + // timezone + // Required: true + Timezone *string `json:"timezone"` + + // vat Id + VatID string `json:"vatId,omitempty"` + + // visible + Visible bool `json:"visible,omitempty"` +} + +// Validate validates this customer edit form +func (m *CustomerEditForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCountry(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCurrency(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimezone(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CustomerEditForm) validateCountry(formats strfmt.Registry) error { + + if err := validate.Required("country", "body", m.Country); err != nil { + return err + } + + return nil +} + +func (m *CustomerEditForm) validateCurrency(formats strfmt.Registry) error { + + if err := validate.Required("currency", "body", m.Currency); err != nil { + return err + } + + return nil +} + +func (m *CustomerEditForm) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *CustomerEditForm) validateTimezone(formats strfmt.Registry) error { + + if err := validate.Required("timezone", "body", m.Timezone); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this customer edit form based on context it is used +func (m *CustomerEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CustomerEditForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CustomerEditForm) UnmarshalBinary(b []byte) error { + var res CustomerEditForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/customer_entity.go b/models/customer_entity.go new file mode 100644 index 0000000..3394bd4 --- /dev/null +++ b/models/customer_entity.go @@ -0,0 +1,560 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CustomerEntity customer entity +// +// swagger:model CustomerEntity +type CustomerEntity struct { + + // address + Address string `json:"address,omitempty"` + + // billable + // Required: true + Billable *bool `json:"billable"` + + // The total monetary budget, will be zero if unconfigured. + // Required: true + // Maximum: 9e+11 + // Minimum: 0 + Budget *float32 `json:"budget"` + + // The type of budget: + // - null = default / full time + // - month = monthly budget + BudgetType string `json:"budgetType,omitempty"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // comment + Comment string `json:"comment,omitempty"` + + // company + // Max Length: 255 + Company string `json:"company,omitempty"` + + // contact + // Max Length: 255 + Contact string `json:"contact,omitempty"` + + // country + // Required: true + // Max Length: 2 + Country *string `json:"country"` + + // currency + // Required: true + // Max Length: 3 + Currency *string `json:"currency"` + + // Customers contact email + // + // Limited via RFC to 254 chars + // Max Length: 254 + Email string `json:"email,omitempty"` + + // fax + // Max Length: 255 + Fax string `json:"fax,omitempty"` + + // homepage + // Max Length: 255 + Homepage string `json:"homepage,omitempty"` + + // id + ID int64 `json:"id,omitempty"` + + // Meta fields + // + // All visible meta (custom) fields registered with this customer + MetaFields []*CustomerMeta `json:"metaFields"` + + // mobile + // Max Length: 255 + Mobile string `json:"mobile,omitempty"` + + // name + // Required: true + // Max Length: 150 + // Min Length: 2 + Name *string `json:"name"` + + // number + // Max Length: 50 + Number string `json:"number,omitempty"` + + // phone + // Max Length: 255 + Phone string `json:"phone,omitempty"` + + // Teams + // + // If no team is assigned, everyone can access the customer + Teams []*Team `json:"teams"` + + // The time budget in seconds, will be zero if unconfigured. + // Required: true + // Maximum: 2.1456e+09 + // Minimum: 0 + TimeBudget *int64 `json:"timeBudget"` + + // Timezone of begin and end + // + // Length was determined by a MySQL column via "use mysql;describe time_zone_name;" + // Required: true + // Max Length: 64 + Timezone *string `json:"timezone"` + + // vat Id + // Max Length: 50 + VatID string `json:"vatId,omitempty"` + + // visible + // Required: true + Visible *bool `json:"visible"` +} + +// Validate validates this customer entity +func (m *CustomerEntity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBudget(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCompany(formats); err != nil { + res = append(res, err) + } + + if err := m.validateContact(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCountry(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCurrency(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEmail(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFax(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHomepage(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMetaFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMobile(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNumber(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePhone(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTeams(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimeBudget(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimezone(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVatID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisible(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CustomerEntity) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateBudget(formats strfmt.Registry) error { + + if err := validate.Required("budget", "body", m.Budget); err != nil { + return err + } + + if err := validate.Minimum("budget", "body", float64(*m.Budget), 0, false); err != nil { + return err + } + + if err := validate.Maximum("budget", "body", float64(*m.Budget), 9e+11, false); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateCompany(formats strfmt.Registry) error { + if swag.IsZero(m.Company) { // not required + return nil + } + + if err := validate.MaxLength("company", "body", m.Company, 255); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateContact(formats strfmt.Registry) error { + if swag.IsZero(m.Contact) { // not required + return nil + } + + if err := validate.MaxLength("contact", "body", m.Contact, 255); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateCountry(formats strfmt.Registry) error { + + if err := validate.Required("country", "body", m.Country); err != nil { + return err + } + + if err := validate.MaxLength("country", "body", *m.Country, 2); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateCurrency(formats strfmt.Registry) error { + + if err := validate.Required("currency", "body", m.Currency); err != nil { + return err + } + + if err := validate.MaxLength("currency", "body", *m.Currency, 3); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateEmail(formats strfmt.Registry) error { + if swag.IsZero(m.Email) { // not required + return nil + } + + if err := validate.MaxLength("email", "body", m.Email, 254); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateFax(formats strfmt.Registry) error { + if swag.IsZero(m.Fax) { // not required + return nil + } + + if err := validate.MaxLength("fax", "body", m.Fax, 255); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateHomepage(formats strfmt.Registry) error { + if swag.IsZero(m.Homepage) { // not required + return nil + } + + if err := validate.MaxLength("homepage", "body", m.Homepage, 255); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateMetaFields(formats strfmt.Registry) error { + if swag.IsZero(m.MetaFields) { // not required + return nil + } + + for i := 0; i < len(m.MetaFields); i++ { + if swag.IsZero(m.MetaFields[i]) { // not required + continue + } + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CustomerEntity) validateMobile(formats strfmt.Registry) error { + if swag.IsZero(m.Mobile) { // not required + return nil + } + + if err := validate.MaxLength("mobile", "body", m.Mobile, 255); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 150); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateNumber(formats strfmt.Registry) error { + if swag.IsZero(m.Number) { // not required + return nil + } + + if err := validate.MaxLength("number", "body", m.Number, 50); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validatePhone(formats strfmt.Registry) error { + if swag.IsZero(m.Phone) { // not required + return nil + } + + if err := validate.MaxLength("phone", "body", m.Phone, 255); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateTeams(formats strfmt.Registry) error { + if swag.IsZero(m.Teams) { // not required + return nil + } + + for i := 0; i < len(m.Teams); i++ { + if swag.IsZero(m.Teams[i]) { // not required + continue + } + + if m.Teams[i] != nil { + if err := m.Teams[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CustomerEntity) validateTimeBudget(formats strfmt.Registry) error { + + if err := validate.Required("timeBudget", "body", m.TimeBudget); err != nil { + return err + } + + if err := validate.MinimumInt("timeBudget", "body", *m.TimeBudget, 0, false); err != nil { + return err + } + + if err := validate.MaximumInt("timeBudget", "body", *m.TimeBudget, 2.1456e+09, false); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateTimezone(formats strfmt.Registry) error { + + if err := validate.Required("timezone", "body", m.Timezone); err != nil { + return err + } + + if err := validate.MaxLength("timezone", "body", *m.Timezone, 64); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateVatID(formats strfmt.Registry) error { + if swag.IsZero(m.VatID) { // not required + return nil + } + + if err := validate.MaxLength("vatId", "body", m.VatID, 50); err != nil { + return err + } + + return nil +} + +func (m *CustomerEntity) validateVisible(formats strfmt.Registry) error { + + if err := validate.Required("visible", "body", m.Visible); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this customer entity based on the context it is used +func (m *CustomerEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMetaFields(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTeams(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CustomerEntity) contextValidateMetaFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MetaFields); i++ { + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CustomerEntity) contextValidateTeams(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Teams); i++ { + + if m.Teams[i] != nil { + if err := m.Teams[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CustomerEntity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CustomerEntity) UnmarshalBinary(b []byte) error { + var res CustomerEntity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/customer_meta.go b/models/customer_meta.go new file mode 100644 index 0000000..d13fdb2 --- /dev/null +++ b/models/customer_meta.go @@ -0,0 +1,101 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CustomerMeta customer meta +// +// swagger:model CustomerMeta +type CustomerMeta struct { + + // Name of the meta (custom) field + // Required: true + // Max Length: 50 + // Min Length: 2 + Name *string `json:"name"` + + // Value of the meta (custom) field + // Max Length: 65535 + Value string `json:"value,omitempty"` +} + +// Validate validates this customer meta +func (m *CustomerMeta) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CustomerMeta) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 50); err != nil { + return err + } + + return nil +} + +func (m *CustomerMeta) validateValue(formats strfmt.Registry) error { + if swag.IsZero(m.Value) { // not required + return nil + } + + if err := validate.MaxLength("value", "body", m.Value, 65535); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this customer meta based on context it is used +func (m *CustomerMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CustomerMeta) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CustomerMeta) UnmarshalBinary(b []byte) error { + var res CustomerMeta + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/customer_rate.go b/models/customer_rate.go new file mode 100644 index 0000000..3147279 --- /dev/null +++ b/models/customer_rate.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CustomerRate customer rate +// +// swagger:model CustomerRate +type CustomerRate struct { + + // id + ID int64 `json:"id,omitempty"` + + // internal rate + InternalRate float32 `json:"internalRate,omitempty"` + + // is fixed + // Required: true + IsFixed *bool `json:"isFixed"` + + // rate + // Minimum: 0 + Rate *float32 `json:"rate,omitempty"` + + // user + User *User `json:"user,omitempty"` +} + +// Validate validates this customer rate +func (m *CustomerRate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIsFixed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CustomerRate) validateIsFixed(formats strfmt.Registry) error { + + if err := validate.Required("isFixed", "body", m.IsFixed); err != nil { + return err + } + + return nil +} + +func (m *CustomerRate) validateRate(formats strfmt.Registry) error { + if swag.IsZero(m.Rate) { // not required + return nil + } + + if err := validate.Minimum("rate", "body", float64(*m.Rate), 0, false); err != nil { + return err + } + + return nil +} + +func (m *CustomerRate) validateUser(formats strfmt.Registry) error { + if swag.IsZero(m.User) { // not required + return nil + } + + if m.User != nil { + if err := m.User.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// ContextValidate validate this customer rate based on the context it is used +func (m *CustomerRate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CustomerRate) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { + + if m.User != nil { + if err := m.User.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CustomerRate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CustomerRate) UnmarshalBinary(b []byte) error { + var res CustomerRate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/customer_rate_form.go b/models/customer_rate_form.go new file mode 100644 index 0000000..c080bc7 --- /dev/null +++ b/models/customer_rate_form.go @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CustomerRateForm customer rate form +// +// swagger:model CustomerRateForm +type CustomerRateForm struct { + + // The internal rate (eg. 10.0 or 10) + InternalRate float64 `json:"internalRate,omitempty"` + + // If "true" each time record gets the same rate, regardless of its duration + IsFixed bool `json:"isFixed,omitempty"` + + // The rate (eg. 10.5) + // Required: true + Rate *float64 `json:"rate"` + + // User ID + User int64 `json:"user,omitempty"` +} + +// Validate validates this customer rate form +func (m *CustomerRateForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CustomerRateForm) validateRate(formats strfmt.Registry) error { + + if err := validate.Required("rate", "body", m.Rate); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this customer rate form based on context it is used +func (m *CustomerRateForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CustomerRateForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CustomerRateForm) UnmarshalBinary(b []byte) error { + var res CustomerRateForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/expense_category.go b/models/expense_category.go new file mode 100644 index 0000000..43ed70e --- /dev/null +++ b/models/expense_category.go @@ -0,0 +1,101 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ExpenseCategory expense category +// +// swagger:model ExpenseCategory +type ExpenseCategory struct { + + // id + ID int64 `json:"id,omitempty"` + + // name + // Required: true + // Max Length: 100 + // Min Length: 2 + Name *string `json:"name"` + + // visible + // Required: true + Visible *bool `json:"visible"` +} + +// Validate validates this expense category +func (m *ExpenseCategory) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisible(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ExpenseCategory) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 100); err != nil { + return err + } + + return nil +} + +func (m *ExpenseCategory) validateVisible(formats strfmt.Registry) error { + + if err := validate.Required("visible", "body", m.Visible); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this expense category based on context it is used +func (m *ExpenseCategory) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ExpenseCategory) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ExpenseCategory) UnmarshalBinary(b []byte) error { + var res ExpenseCategory + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/expense_edit_form.go b/models/expense_edit_form.go new file mode 100644 index 0000000..415e4dc --- /dev/null +++ b/models/expense_edit_form.go @@ -0,0 +1,140 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ExpenseEditForm expense edit form +// +// swagger:model ExpenseEditForm +type ExpenseEditForm struct { + + // Activity ID + Activity int64 `json:"activity,omitempty"` + + // begin + // Example: 2023-01-14T05:12:43 + // Required: true + // Format: date-time + Begin *strfmt.DateTime `json:"begin"` + + // Customer ID + Customer int64 `json:"customer,omitempty"` + + // description + Description string `json:"description,omitempty"` + + // expense category + // Required: true + ExpenseCategory *string `json:"expenseCategory"` + + // multiplier + // Required: true + Multiplier *float64 `json:"multiplier"` + + // Project ID + // Required: true + Project *int64 `json:"project"` + + // refundable + Refundable bool `json:"refundable,omitempty"` +} + +// Validate validates this expense edit form +func (m *ExpenseEditForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBegin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateExpenseCategory(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMultiplier(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProject(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ExpenseEditForm) validateBegin(formats strfmt.Registry) error { + + if err := validate.Required("begin", "body", m.Begin); err != nil { + return err + } + + if err := validate.FormatOf("begin", "body", "date-time", m.Begin.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ExpenseEditForm) validateExpenseCategory(formats strfmt.Registry) error { + + if err := validate.Required("expenseCategory", "body", m.ExpenseCategory); err != nil { + return err + } + + return nil +} + +func (m *ExpenseEditForm) validateMultiplier(formats strfmt.Registry) error { + + if err := validate.Required("multiplier", "body", m.Multiplier); err != nil { + return err + } + + return nil +} + +func (m *ExpenseEditForm) validateProject(formats strfmt.Registry) error { + + if err := validate.Required("project", "body", m.Project); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this expense edit form based on context it is used +func (m *ExpenseEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ExpenseEditForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ExpenseEditForm) UnmarshalBinary(b []byte) error { + var res ExpenseEditForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/expense_entity.go b/models/expense_entity.go new file mode 100644 index 0000000..2113bdf --- /dev/null +++ b/models/expense_entity.go @@ -0,0 +1,274 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ExpenseEntity expense entity +// +// swagger:model ExpenseEntity +type ExpenseEntity struct { + + // activity + Activity int64 `json:"activity,omitempty"` + + // begin + // Format: date-time + Begin strfmt.DateTime `json:"begin,omitempty"` + + // category + // Required: true + Category *ExpenseCategory `json:"category"` + + // cost + // Required: true + Cost *float32 `json:"cost"` + + // description + Description string `json:"description,omitempty"` + + // exported + // Required: true + Exported *bool `json:"exported"` + + // id + ID int64 `json:"id,omitempty"` + + // meta fields + MetaFields []*ExpenseMeta `json:"metaFields"` + + // multiplier + // Minimum: 0 + Multiplier *float32 `json:"multiplier,omitempty"` + + // project + Project int64 `json:"project,omitempty"` + + // refundable + // Required: true + Refundable *bool `json:"refundable"` + + // total + Total float32 `json:"total,omitempty"` + + // user + User int64 `json:"user,omitempty"` +} + +// Validate validates this expense entity +func (m *ExpenseEntity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBegin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCategory(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCost(formats); err != nil { + res = append(res, err) + } + + if err := m.validateExported(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMetaFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMultiplier(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRefundable(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ExpenseEntity) validateBegin(formats strfmt.Registry) error { + if swag.IsZero(m.Begin) { // not required + return nil + } + + if err := validate.FormatOf("begin", "body", "date-time", m.Begin.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ExpenseEntity) validateCategory(formats strfmt.Registry) error { + + if err := validate.Required("category", "body", m.Category); err != nil { + return err + } + + if m.Category != nil { + if err := m.Category.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("category") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("category") + } + return err + } + } + + return nil +} + +func (m *ExpenseEntity) validateCost(formats strfmt.Registry) error { + + if err := validate.Required("cost", "body", m.Cost); err != nil { + return err + } + + return nil +} + +func (m *ExpenseEntity) validateExported(formats strfmt.Registry) error { + + if err := validate.Required("exported", "body", m.Exported); err != nil { + return err + } + + return nil +} + +func (m *ExpenseEntity) validateMetaFields(formats strfmt.Registry) error { + if swag.IsZero(m.MetaFields) { // not required + return nil + } + + for i := 0; i < len(m.MetaFields); i++ { + if swag.IsZero(m.MetaFields[i]) { // not required + continue + } + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ExpenseEntity) validateMultiplier(formats strfmt.Registry) error { + if swag.IsZero(m.Multiplier) { // not required + return nil + } + + if err := validate.Minimum("multiplier", "body", float64(*m.Multiplier), 0, false); err != nil { + return err + } + + return nil +} + +func (m *ExpenseEntity) validateRefundable(formats strfmt.Registry) error { + + if err := validate.Required("refundable", "body", m.Refundable); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this expense entity based on the context it is used +func (m *ExpenseEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCategory(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMetaFields(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ExpenseEntity) contextValidateCategory(ctx context.Context, formats strfmt.Registry) error { + + if m.Category != nil { + if err := m.Category.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("category") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("category") + } + return err + } + } + + return nil +} + +func (m *ExpenseEntity) contextValidateMetaFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MetaFields); i++ { + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ExpenseEntity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ExpenseEntity) UnmarshalBinary(b []byte) error { + var res ExpenseEntity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/expense_meta.go b/models/expense_meta.go new file mode 100644 index 0000000..9acc55a --- /dev/null +++ b/models/expense_meta.go @@ -0,0 +1,101 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ExpenseMeta expense meta +// +// swagger:model ExpenseMeta +type ExpenseMeta struct { + + // Name of the meta (custom) field + // Required: true + // Max Length: 50 + // Min Length: 2 + Name *string `json:"name"` + + // Value of the meta (custom) field + // Max Length: 65535 + Value string `json:"value,omitempty"` +} + +// Validate validates this expense meta +func (m *ExpenseMeta) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ExpenseMeta) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 50); err != nil { + return err + } + + return nil +} + +func (m *ExpenseMeta) validateValue(formats strfmt.Registry) error { + if swag.IsZero(m.Value) { // not required + return nil + } + + if err := validate.MaxLength("value", "body", m.Value, 65535); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this expense meta based on context it is used +func (m *ExpenseMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ExpenseMeta) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ExpenseMeta) UnmarshalBinary(b []byte) error { + var res ExpenseMeta + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/i18n_config.go b/models/i18n_config.go new file mode 100644 index 0000000..1f7d786 --- /dev/null +++ b/models/i18n_config.go @@ -0,0 +1,92 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// I18nConfig i18n config +// +// swagger:model I18nConfig +type I18nConfig struct { + + // Format used to display date values (see PHP function date_format) + Date string `json:"date,omitempty"` + + // Format used to display date-time values (see PHP function date_format) + DateTime string `json:"dateTime,omitempty"` + + // Format used to display durations (replace: %h with hours, %m with minutes, %s with seconds) + Duration string `json:"duration,omitempty"` + + // Format used for toolbar queries + FormDate string `json:"formDate,omitempty"` + + // Whether a twenty-four hour format is used (true) or 12-hours AM/PM format (false) + Is24hours bool `json:"is24hours,omitempty"` + + // The current time of the user + // Format: date-time + Now strfmt.DateTime `json:"now,omitempty"` + + // Format used to display times (see PHP function date_format) + Time string `json:"time,omitempty"` +} + +// Validate validates this i18n config +func (m *I18nConfig) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNow(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *I18nConfig) validateNow(formats strfmt.Registry) error { + if swag.IsZero(m.Now) { // not required + return nil + } + + if err := validate.FormatOf("now", "body", "date-time", m.Now.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this i18n config based on context it is used +func (m *I18nConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *I18nConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *I18nConfig) UnmarshalBinary(b []byte) error { + var res I18nConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/meta_field_rule.go b/models/meta_field_rule.go new file mode 100644 index 0000000..50b1497 --- /dev/null +++ b/models/meta_field_rule.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// MetaFieldRule meta field rule +// +// swagger:model MetaFieldRule +type MetaFieldRule struct { + + // activity + Activity int64 `json:"activity,omitempty"` + + // customer + Customer int64 `json:"customer,omitempty"` + + // entity type + EntityType string `json:"entityType,omitempty"` + + // help + // Max Length: 200 + Help string `json:"help,omitempty"` + + // id + ID int64 `json:"id,omitempty"` + + // label + // Max Length: 50 + Label string `json:"label,omitempty"` + + // name + // Required: true + // Max Length: 50 + // Min Length: 2 + Name *string `json:"name"` + + // project + Project int64 `json:"project,omitempty"` + + // required + // Required: true + Required *bool `json:"required"` + + // type + // Required: true + // Max Length: 100 + Type *string `json:"type"` + + // value + Value string `json:"value,omitempty"` + + // visible + // Required: true + Visible *bool `json:"visible"` +} + +// Validate validates this meta field rule +func (m *MetaFieldRule) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHelp(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLabel(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRequired(formats); err != nil { + res = append(res, err) + } + + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisible(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MetaFieldRule) validateHelp(formats strfmt.Registry) error { + if swag.IsZero(m.Help) { // not required + return nil + } + + if err := validate.MaxLength("help", "body", m.Help, 200); err != nil { + return err + } + + return nil +} + +func (m *MetaFieldRule) validateLabel(formats strfmt.Registry) error { + if swag.IsZero(m.Label) { // not required + return nil + } + + if err := validate.MaxLength("label", "body", m.Label, 50); err != nil { + return err + } + + return nil +} + +func (m *MetaFieldRule) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 50); err != nil { + return err + } + + return nil +} + +func (m *MetaFieldRule) validateRequired(formats strfmt.Registry) error { + + if err := validate.Required("required", "body", m.Required); err != nil { + return err + } + + return nil +} + +func (m *MetaFieldRule) validateType(formats strfmt.Registry) error { + + if err := validate.Required("type", "body", m.Type); err != nil { + return err + } + + if err := validate.MaxLength("type", "body", *m.Type, 100); err != nil { + return err + } + + return nil +} + +func (m *MetaFieldRule) validateVisible(formats strfmt.Registry) error { + + if err := validate.Required("visible", "body", m.Visible); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this meta field rule based on context it is used +func (m *MetaFieldRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *MetaFieldRule) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MetaFieldRule) UnmarshalBinary(b []byte) error { + var res MetaFieldRule + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/plugin.go b/models/plugin.go new file mode 100644 index 0000000..550efff --- /dev/null +++ b/models/plugin.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Plugin plugin +// +// swagger:model Plugin +type Plugin struct { + + // The plugin name, eg. "ExpensesBundle" + Name string `json:"name,omitempty"` + + // The plugin version, eg. "1.14" + Version string `json:"version,omitempty"` +} + +// Validate validates this plugin +func (m *Plugin) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this plugin based on context it is used +func (m *Plugin) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Plugin) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Plugin) UnmarshalBinary(b []byte) error { + var res Plugin + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/project.go b/models/project.go new file mode 100644 index 0000000..9c3fbf2 --- /dev/null +++ b/models/project.go @@ -0,0 +1,144 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Project project +// +// swagger:model Project +type Project struct { + + // billable + // Required: true + Billable *bool `json:"billable"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // comment + Comment string `json:"comment,omitempty"` + + // customer + Customer int64 `json:"customer,omitempty"` + + // Whether this project allows booking of global activities + // Required: true + GlobalActivities *bool `json:"globalActivities"` + + // Internal ID + ID int64 `json:"id,omitempty"` + + // Project name + // Required: true + // Max Length: 150 + // Min Length: 2 + Name *string `json:"name"` + + // visible + // Required: true + Visible *bool `json:"visible"` +} + +// Validate validates this project +func (m *Project) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGlobalActivities(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisible(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Project) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *Project) validateGlobalActivities(formats strfmt.Registry) error { + + if err := validate.Required("globalActivities", "body", m.GlobalActivities); err != nil { + return err + } + + return nil +} + +func (m *Project) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 150); err != nil { + return err + } + + return nil +} + +func (m *Project) validateVisible(formats strfmt.Registry) error { + + if err := validate.Required("visible", "body", m.Visible); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this project based on context it is used +func (m *Project) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Project) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Project) UnmarshalBinary(b []byte) error { + var res Project + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/project_collection.go b/models/project_collection.go new file mode 100644 index 0000000..205cb70 --- /dev/null +++ b/models/project_collection.go @@ -0,0 +1,311 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ProjectCollection project collection +// +// swagger:model ProjectCollection +type ProjectCollection struct { + + // billable + // Required: true + Billable *bool `json:"billable"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // comment + Comment string `json:"comment,omitempty"` + + // customer + Customer int64 `json:"customer,omitempty"` + + // end + // Format: date-time + End strfmt.DateTime `json:"end,omitempty"` + + // Whether this project allows booking of global activities + // Required: true + GlobalActivities *bool `json:"globalActivities"` + + // Internal ID + ID int64 `json:"id,omitempty"` + + // Meta fields + // + // All visible meta (custom) fields registered with this project + MetaFields []*ProjectMeta `json:"metaFields"` + + // Project name + // Required: true + // Max Length: 150 + // Min Length: 2 + Name *string `json:"name"` + + // parent title + ParentTitle string `json:"parentTitle,omitempty"` + + // start + // Format: date-time + Start strfmt.DateTime `json:"start,omitempty"` + + // Teams + // + // If no team is assigned, everyone can access the project (also depends on the teams of the customer) + Teams []*Team `json:"teams"` + + // visible + // Required: true + Visible *bool `json:"visible"` +} + +// Validate validates this project collection +func (m *ProjectCollection) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnd(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGlobalActivities(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMetaFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStart(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTeams(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisible(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProjectCollection) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *ProjectCollection) validateEnd(formats strfmt.Registry) error { + if swag.IsZero(m.End) { // not required + return nil + } + + if err := validate.FormatOf("end", "body", "date-time", m.End.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ProjectCollection) validateGlobalActivities(formats strfmt.Registry) error { + + if err := validate.Required("globalActivities", "body", m.GlobalActivities); err != nil { + return err + } + + return nil +} + +func (m *ProjectCollection) validateMetaFields(formats strfmt.Registry) error { + if swag.IsZero(m.MetaFields) { // not required + return nil + } + + for i := 0; i < len(m.MetaFields); i++ { + if swag.IsZero(m.MetaFields[i]) { // not required + continue + } + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProjectCollection) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 150); err != nil { + return err + } + + return nil +} + +func (m *ProjectCollection) validateStart(formats strfmt.Registry) error { + if swag.IsZero(m.Start) { // not required + return nil + } + + if err := validate.FormatOf("start", "body", "date-time", m.Start.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ProjectCollection) validateTeams(formats strfmt.Registry) error { + if swag.IsZero(m.Teams) { // not required + return nil + } + + for i := 0; i < len(m.Teams); i++ { + if swag.IsZero(m.Teams[i]) { // not required + continue + } + + if m.Teams[i] != nil { + if err := m.Teams[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProjectCollection) validateVisible(formats strfmt.Registry) error { + + if err := validate.Required("visible", "body", m.Visible); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this project collection based on the context it is used +func (m *ProjectCollection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMetaFields(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTeams(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProjectCollection) contextValidateMetaFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MetaFields); i++ { + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProjectCollection) contextValidateTeams(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Teams); i++ { + + if m.Teams[i] != nil { + if err := m.Teams[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ProjectCollection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ProjectCollection) UnmarshalBinary(b []byte) error { + var res ProjectCollection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/project_edit_form.go b/models/project_edit_form.go new file mode 100644 index 0000000..e9ae10e --- /dev/null +++ b/models/project_edit_form.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ProjectEditForm project edit form +// +// swagger:model ProjectEditForm +type ProjectEditForm struct { + + // billable + Billable bool `json:"billable,omitempty"` + + // The hexadecimal color code (default: #d2d6de) + Color string `json:"color,omitempty"` + + // comment + Comment string `json:"comment,omitempty"` + + // Customer ID + // Required: true + Customer *int64 `json:"customer"` + + // end + // Example: 2023-01-14T05:12:43 + // Format: date-time + End strfmt.DateTime `json:"end,omitempty"` + + // global activities + GlobalActivities bool `json:"globalActivities,omitempty"` + + // invoice text + InvoiceText string `json:"invoiceText,omitempty"` + + // name + // Required: true + Name *string `json:"name"` + + // order date + // Example: 2023-01-14T05:12:43 + // Format: date-time + OrderDate strfmt.DateTime `json:"orderDate,omitempty"` + + // order number + OrderNumber string `json:"orderNumber,omitempty"` + + // start + // Example: 2023-01-14T05:12:43 + // Format: date-time + Start strfmt.DateTime `json:"start,omitempty"` + + // visible + Visible bool `json:"visible,omitempty"` +} + +// Validate validates this project edit form +func (m *ProjectEditForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCustomer(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnd(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOrderDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStart(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProjectEditForm) validateCustomer(formats strfmt.Registry) error { + + if err := validate.Required("customer", "body", m.Customer); err != nil { + return err + } + + return nil +} + +func (m *ProjectEditForm) validateEnd(formats strfmt.Registry) error { + if swag.IsZero(m.End) { // not required + return nil + } + + if err := validate.FormatOf("end", "body", "date-time", m.End.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ProjectEditForm) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *ProjectEditForm) validateOrderDate(formats strfmt.Registry) error { + if swag.IsZero(m.OrderDate) { // not required + return nil + } + + if err := validate.FormatOf("orderDate", "body", "date-time", m.OrderDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ProjectEditForm) validateStart(formats strfmt.Registry) error { + if swag.IsZero(m.Start) { // not required + return nil + } + + if err := validate.FormatOf("start", "body", "date-time", m.Start.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this project edit form based on context it is used +func (m *ProjectEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ProjectEditForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ProjectEditForm) UnmarshalBinary(b []byte) error { + var res ProjectEditForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/project_entity.go b/models/project_entity.go new file mode 100644 index 0000000..40d4aa6 --- /dev/null +++ b/models/project_entity.go @@ -0,0 +1,410 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ProjectEntity project entity +// +// swagger:model ProjectEntity +type ProjectEntity struct { + + // billable + // Required: true + Billable *bool `json:"billable"` + + // The total monetary budget, will be zero if unconfigured. + // Required: true + // Maximum: 9e+11 + // Minimum: 0 + Budget *float32 `json:"budget"` + + // The type of budget: + // - null = default / full time + // - month = monthly budget + BudgetType string `json:"budgetType,omitempty"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // comment + Comment string `json:"comment,omitempty"` + + // customer + Customer int64 `json:"customer,omitempty"` + + // end + // Format: date-time + End strfmt.DateTime `json:"end,omitempty"` + + // Whether this project allows booking of global activities + // Required: true + GlobalActivities *bool `json:"globalActivities"` + + // Internal ID + ID int64 `json:"id,omitempty"` + + // Meta fields + // + // All visible meta (custom) fields registered with this project + MetaFields []*ProjectMeta `json:"metaFields"` + + // Project name + // Required: true + // Max Length: 150 + // Min Length: 2 + Name *string `json:"name"` + + // order date + // Format: date-time + OrderDate strfmt.DateTime `json:"orderDate,omitempty"` + + // Project order number + // Max Length: 50 + OrderNumber string `json:"orderNumber,omitempty"` + + // parent title + ParentTitle string `json:"parentTitle,omitempty"` + + // start + // Format: date-time + Start strfmt.DateTime `json:"start,omitempty"` + + // Teams + // + // If no team is assigned, everyone can access the project (also depends on the teams of the customer) + Teams []*Team `json:"teams"` + + // The time budget in seconds, will be zero if unconfigured. + // Required: true + // Maximum: 2.1456e+09 + // Minimum: 0 + TimeBudget *int64 `json:"timeBudget"` + + // visible + // Required: true + Visible *bool `json:"visible"` +} + +// Validate validates this project entity +func (m *ProjectEntity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBudget(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnd(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGlobalActivities(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMetaFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOrderDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOrderNumber(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStart(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTeams(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimeBudget(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisible(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProjectEntity) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *ProjectEntity) validateBudget(formats strfmt.Registry) error { + + if err := validate.Required("budget", "body", m.Budget); err != nil { + return err + } + + if err := validate.Minimum("budget", "body", float64(*m.Budget), 0, false); err != nil { + return err + } + + if err := validate.Maximum("budget", "body", float64(*m.Budget), 9e+11, false); err != nil { + return err + } + + return nil +} + +func (m *ProjectEntity) validateEnd(formats strfmt.Registry) error { + if swag.IsZero(m.End) { // not required + return nil + } + + if err := validate.FormatOf("end", "body", "date-time", m.End.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ProjectEntity) validateGlobalActivities(formats strfmt.Registry) error { + + if err := validate.Required("globalActivities", "body", m.GlobalActivities); err != nil { + return err + } + + return nil +} + +func (m *ProjectEntity) validateMetaFields(formats strfmt.Registry) error { + if swag.IsZero(m.MetaFields) { // not required + return nil + } + + for i := 0; i < len(m.MetaFields); i++ { + if swag.IsZero(m.MetaFields[i]) { // not required + continue + } + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProjectEntity) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 150); err != nil { + return err + } + + return nil +} + +func (m *ProjectEntity) validateOrderDate(formats strfmt.Registry) error { + if swag.IsZero(m.OrderDate) { // not required + return nil + } + + if err := validate.FormatOf("orderDate", "body", "date-time", m.OrderDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ProjectEntity) validateOrderNumber(formats strfmt.Registry) error { + if swag.IsZero(m.OrderNumber) { // not required + return nil + } + + if err := validate.MaxLength("orderNumber", "body", m.OrderNumber, 50); err != nil { + return err + } + + return nil +} + +func (m *ProjectEntity) validateStart(formats strfmt.Registry) error { + if swag.IsZero(m.Start) { // not required + return nil + } + + if err := validate.FormatOf("start", "body", "date-time", m.Start.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ProjectEntity) validateTeams(formats strfmt.Registry) error { + if swag.IsZero(m.Teams) { // not required + return nil + } + + for i := 0; i < len(m.Teams); i++ { + if swag.IsZero(m.Teams[i]) { // not required + continue + } + + if m.Teams[i] != nil { + if err := m.Teams[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProjectEntity) validateTimeBudget(formats strfmt.Registry) error { + + if err := validate.Required("timeBudget", "body", m.TimeBudget); err != nil { + return err + } + + if err := validate.MinimumInt("timeBudget", "body", *m.TimeBudget, 0, false); err != nil { + return err + } + + if err := validate.MaximumInt("timeBudget", "body", *m.TimeBudget, 2.1456e+09, false); err != nil { + return err + } + + return nil +} + +func (m *ProjectEntity) validateVisible(formats strfmt.Registry) error { + + if err := validate.Required("visible", "body", m.Visible); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this project entity based on the context it is used +func (m *ProjectEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMetaFields(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTeams(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProjectEntity) contextValidateMetaFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MetaFields); i++ { + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ProjectEntity) contextValidateTeams(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Teams); i++ { + + if m.Teams[i] != nil { + if err := m.Teams[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ProjectEntity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ProjectEntity) UnmarshalBinary(b []byte) error { + var res ProjectEntity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/project_expanded.go b/models/project_expanded.go new file mode 100644 index 0000000..ca8fe4b --- /dev/null +++ b/models/project_expanded.go @@ -0,0 +1,194 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ProjectExpanded project expanded +// +// swagger:model ProjectExpanded +type ProjectExpanded struct { + + // billable + // Required: true + Billable *bool `json:"billable"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // comment + Comment string `json:"comment,omitempty"` + + // customer + // Required: true + Customer *Customer `json:"customer"` + + // Whether this project allows booking of global activities + // Required: true + GlobalActivities *bool `json:"globalActivities"` + + // Internal ID + ID int64 `json:"id,omitempty"` + + // Project name + // Required: true + // Max Length: 150 + // Min Length: 2 + Name *string `json:"name"` + + // visible + // Required: true + Visible *bool `json:"visible"` +} + +// Validate validates this project expanded +func (m *ProjectExpanded) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCustomer(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGlobalActivities(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVisible(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProjectExpanded) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *ProjectExpanded) validateCustomer(formats strfmt.Registry) error { + + if err := validate.Required("customer", "body", m.Customer); err != nil { + return err + } + + if m.Customer != nil { + if err := m.Customer.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("customer") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("customer") + } + return err + } + } + + return nil +} + +func (m *ProjectExpanded) validateGlobalActivities(formats strfmt.Registry) error { + + if err := validate.Required("globalActivities", "body", m.GlobalActivities); err != nil { + return err + } + + return nil +} + +func (m *ProjectExpanded) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 150); err != nil { + return err + } + + return nil +} + +func (m *ProjectExpanded) validateVisible(formats strfmt.Registry) error { + + if err := validate.Required("visible", "body", m.Visible); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this project expanded based on the context it is used +func (m *ProjectExpanded) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCustomer(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProjectExpanded) contextValidateCustomer(ctx context.Context, formats strfmt.Registry) error { + + if m.Customer != nil { + if err := m.Customer.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("customer") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("customer") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ProjectExpanded) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ProjectExpanded) UnmarshalBinary(b []byte) error { + var res ProjectExpanded + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/project_meta.go b/models/project_meta.go new file mode 100644 index 0000000..5e4d6dd --- /dev/null +++ b/models/project_meta.go @@ -0,0 +1,101 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ProjectMeta project meta +// +// swagger:model ProjectMeta +type ProjectMeta struct { + + // Name of the meta (custom) field + // Required: true + // Max Length: 50 + // Min Length: 2 + Name *string `json:"name"` + + // Value of the meta (custom) field + // Max Length: 65535 + Value string `json:"value,omitempty"` +} + +// Validate validates this project meta +func (m *ProjectMeta) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProjectMeta) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 50); err != nil { + return err + } + + return nil +} + +func (m *ProjectMeta) validateValue(formats strfmt.Registry) error { + if swag.IsZero(m.Value) { // not required + return nil + } + + if err := validate.MaxLength("value", "body", m.Value, 65535); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this project meta based on context it is used +func (m *ProjectMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ProjectMeta) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ProjectMeta) UnmarshalBinary(b []byte) error { + var res ProjectMeta + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/project_rate.go b/models/project_rate.go new file mode 100644 index 0000000..95d1cfa --- /dev/null +++ b/models/project_rate.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ProjectRate project rate +// +// swagger:model ProjectRate +type ProjectRate struct { + + // id + ID int64 `json:"id,omitempty"` + + // internal rate + InternalRate float32 `json:"internalRate,omitempty"` + + // is fixed + // Required: true + IsFixed *bool `json:"isFixed"` + + // rate + // Minimum: 0 + Rate *float32 `json:"rate,omitempty"` + + // user + User *User `json:"user,omitempty"` +} + +// Validate validates this project rate +func (m *ProjectRate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIsFixed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProjectRate) validateIsFixed(formats strfmt.Registry) error { + + if err := validate.Required("isFixed", "body", m.IsFixed); err != nil { + return err + } + + return nil +} + +func (m *ProjectRate) validateRate(formats strfmt.Registry) error { + if swag.IsZero(m.Rate) { // not required + return nil + } + + if err := validate.Minimum("rate", "body", float64(*m.Rate), 0, false); err != nil { + return err + } + + return nil +} + +func (m *ProjectRate) validateUser(formats strfmt.Registry) error { + if swag.IsZero(m.User) { // not required + return nil + } + + if m.User != nil { + if err := m.User.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// ContextValidate validate this project rate based on the context it is used +func (m *ProjectRate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProjectRate) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { + + if m.User != nil { + if err := m.User.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ProjectRate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ProjectRate) UnmarshalBinary(b []byte) error { + var res ProjectRate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/project_rate_form.go b/models/project_rate_form.go new file mode 100644 index 0000000..6d8a0d3 --- /dev/null +++ b/models/project_rate_form.go @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ProjectRateForm project rate form +// +// swagger:model ProjectRateForm +type ProjectRateForm struct { + + // The internal rate (eg. 10.0 or 10) + InternalRate float64 `json:"internalRate,omitempty"` + + // If "true" each time record gets the same rate, regardless of its duration + IsFixed bool `json:"isFixed,omitempty"` + + // The rate (eg. 10.5) + // Required: true + Rate *float64 `json:"rate"` + + // User ID + User int64 `json:"user,omitempty"` +} + +// Validate validates this project rate form +func (m *ProjectRateForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ProjectRateForm) validateRate(formats strfmt.Registry) error { + + if err := validate.Required("rate", "body", m.Rate); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this project rate form based on context it is used +func (m *ProjectRateForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ProjectRateForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ProjectRateForm) UnmarshalBinary(b []byte) error { + var res ProjectRateForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/tag_edit_form.go b/models/tag_edit_form.go new file mode 100644 index 0000000..642e47e --- /dev/null +++ b/models/tag_edit_form.go @@ -0,0 +1,74 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TagEditForm tag edit form +// +// swagger:model TagEditForm +type TagEditForm struct { + + // The hexadecimal color code (default: #d2d6de) + Color string `json:"color,omitempty"` + + // The tag name (forbidden character: comma) + // Required: true + Name *string `json:"name"` +} + +// Validate validates this tag edit form +func (m *TagEditForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TagEditForm) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this tag edit form based on context it is used +func (m *TagEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TagEditForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TagEditForm) UnmarshalBinary(b []byte) error { + var res TagEditForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/tag_entity.go b/models/tag_entity.go new file mode 100644 index 0000000..15f3d6e --- /dev/null +++ b/models/tag_entity.go @@ -0,0 +1,92 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TagEntity tag entity +// +// swagger:model TagEntity +type TagEntity struct { + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // The internal ID + ID int64 `json:"id,omitempty"` + + // The tag name + // Required: true + // Max Length: 100 + // Min Length: 2 + // Pattern: ((?!,).)* + Name *string `json:"name"` +} + +// Validate validates this tag entity +func (m *TagEntity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TagEntity) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 100); err != nil { + return err + } + + if err := validate.Pattern("name", "body", *m.Name, `((?!,).)*`); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this tag entity based on context it is used +func (m *TagEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TagEntity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TagEntity) UnmarshalBinary(b []byte) error { + var res TagEntity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/task.go b/models/task.go new file mode 100644 index 0000000..f08e0c5 --- /dev/null +++ b/models/task.go @@ -0,0 +1,406 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Task task +// +// swagger:model Task +type Task struct { + + // active timesheets + ActiveTimesheets []*TimesheetEntityExpanded `json:"activeTimesheets"` + + // activity + // Required: true + Activity *ActivityExpanded `json:"activity"` + + // description + Description string `json:"description,omitempty"` + + // end + // Format: date-time + End strfmt.DateTime `json:"end,omitempty"` + + // Estimated duration for the task in seconds or null if no estimation was added + // Minimum: 0 + Estimation *int64 `json:"estimation,omitempty"` + + // id + ID int64 `json:"id,omitempty"` + + // project + // Required: true + Project *ProjectExpanded `json:"project"` + + // status + // Required: true + // Max Length: 20 + Status *string `json:"status"` + + // tags + Tags []string `json:"tags"` + + // team + Team *Team `json:"team,omitempty"` + + // title + // Required: true + // Max Length: 100 + // Min Length: 2 + Title *string `json:"title"` + + // todo + Todo string `json:"todo,omitempty"` + + // user + User *User `json:"user,omitempty"` +} + +// Validate validates this task +func (m *Task) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActiveTimesheets(formats); err != nil { + res = append(res, err) + } + + if err := m.validateActivity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnd(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEstimation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProject(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTeam(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTitle(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Task) validateActiveTimesheets(formats strfmt.Registry) error { + if swag.IsZero(m.ActiveTimesheets) { // not required + return nil + } + + for i := 0; i < len(m.ActiveTimesheets); i++ { + if swag.IsZero(m.ActiveTimesheets[i]) { // not required + continue + } + + if m.ActiveTimesheets[i] != nil { + if err := m.ActiveTimesheets[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("activeTimesheets" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("activeTimesheets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Task) validateActivity(formats strfmt.Registry) error { + + if err := validate.Required("activity", "body", m.Activity); err != nil { + return err + } + + if m.Activity != nil { + if err := m.Activity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("activity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("activity") + } + return err + } + } + + return nil +} + +func (m *Task) validateEnd(formats strfmt.Registry) error { + if swag.IsZero(m.End) { // not required + return nil + } + + if err := validate.FormatOf("end", "body", "date-time", m.End.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Task) validateEstimation(formats strfmt.Registry) error { + if swag.IsZero(m.Estimation) { // not required + return nil + } + + if err := validate.MinimumInt("estimation", "body", *m.Estimation, 0, false); err != nil { + return err + } + + return nil +} + +func (m *Task) validateProject(formats strfmt.Registry) error { + + if err := validate.Required("project", "body", m.Project); err != nil { + return err + } + + if m.Project != nil { + if err := m.Project.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("project") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("project") + } + return err + } + } + + return nil +} + +func (m *Task) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + if err := validate.MaxLength("status", "body", *m.Status, 20); err != nil { + return err + } + + return nil +} + +func (m *Task) validateTeam(formats strfmt.Registry) error { + if swag.IsZero(m.Team) { // not required + return nil + } + + if m.Team != nil { + if err := m.Team.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("team") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("team") + } + return err + } + } + + return nil +} + +func (m *Task) validateTitle(formats strfmt.Registry) error { + + if err := validate.Required("title", "body", m.Title); err != nil { + return err + } + + if err := validate.MinLength("title", "body", *m.Title, 2); err != nil { + return err + } + + if err := validate.MaxLength("title", "body", *m.Title, 100); err != nil { + return err + } + + return nil +} + +func (m *Task) validateUser(formats strfmt.Registry) error { + if swag.IsZero(m.User) { // not required + return nil + } + + if m.User != nil { + if err := m.User.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// ContextValidate validate this task based on the context it is used +func (m *Task) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateActiveTimesheets(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateActivity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateProject(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTeam(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Task) contextValidateActiveTimesheets(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ActiveTimesheets); i++ { + + if m.ActiveTimesheets[i] != nil { + if err := m.ActiveTimesheets[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("activeTimesheets" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("activeTimesheets" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Task) contextValidateActivity(ctx context.Context, formats strfmt.Registry) error { + + if m.Activity != nil { + if err := m.Activity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("activity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("activity") + } + return err + } + } + + return nil +} + +func (m *Task) contextValidateProject(ctx context.Context, formats strfmt.Registry) error { + + if m.Project != nil { + if err := m.Project.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("project") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("project") + } + return err + } + } + + return nil +} + +func (m *Task) contextValidateTeam(ctx context.Context, formats strfmt.Registry) error { + + if m.Team != nil { + if err := m.Team.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("team") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("team") + } + return err + } + } + + return nil +} + +func (m *Task) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { + + if m.User != nil { + if err := m.User.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Task) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Task) UnmarshalBinary(b []byte) error { + var res Task + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/task_edit_form.go b/models/task_edit_form.go new file mode 100644 index 0000000..bf741ea --- /dev/null +++ b/models/task_edit_form.go @@ -0,0 +1,144 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TaskEditForm task edit form +// +// swagger:model TaskEditForm +type TaskEditForm struct { + + // Activity ID + // Required: true + Activity *int64 `json:"activity"` + + // description + Description string `json:"description,omitempty"` + + // end + // Example: 2023-01-14T05:12:43 + // Format: date-time + End strfmt.DateTime `json:"end,omitempty"` + + // Estimation in seconds + Estimation int64 `json:"estimation,omitempty"` + + // Project ID + // Required: true + Project *int64 `json:"project"` + + // Comma separated list of tags + Tags string `json:"tags,omitempty"` + + // Team ID + Team int64 `json:"team,omitempty"` + + // title + // Required: true + Title *string `json:"title"` + + // The actual doings, which will be available on the detail and edit page. + Todo string `json:"todo,omitempty"` + + // User ID + User int64 `json:"user,omitempty"` +} + +// Validate validates this task edit form +func (m *TaskEditForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActivity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnd(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProject(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTitle(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TaskEditForm) validateActivity(formats strfmt.Registry) error { + + if err := validate.Required("activity", "body", m.Activity); err != nil { + return err + } + + return nil +} + +func (m *TaskEditForm) validateEnd(formats strfmt.Registry) error { + if swag.IsZero(m.End) { // not required + return nil + } + + if err := validate.FormatOf("end", "body", "date-time", m.End.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *TaskEditForm) validateProject(formats strfmt.Registry) error { + + if err := validate.Required("project", "body", m.Project); err != nil { + return err + } + + return nil +} + +func (m *TaskEditForm) validateTitle(formats strfmt.Registry) error { + + if err := validate.Required("title", "body", m.Title); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this task edit form based on context it is used +func (m *TaskEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TaskEditForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TaskEditForm) UnmarshalBinary(b []byte) error { + var res TaskEditForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/task_log_work_form.go b/models/task_log_work_form.go new file mode 100644 index 0000000..539c13a --- /dev/null +++ b/models/task_log_work_form.go @@ -0,0 +1,96 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TaskLogWorkForm task log work form +// +// swagger:model TaskLogWorkForm +type TaskLogWorkForm struct { + + // begin + // Example: 2023-01-14T05:12:43 + // Format: date-time + Begin strfmt.DateTime `json:"begin,omitempty"` + + // end + // Example: 2023-01-14T05:12:43 + // Format: date-time + End strfmt.DateTime `json:"end,omitempty"` +} + +// Validate validates this task log work form +func (m *TaskLogWorkForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBegin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnd(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TaskLogWorkForm) validateBegin(formats strfmt.Registry) error { + if swag.IsZero(m.Begin) { // not required + return nil + } + + if err := validate.FormatOf("begin", "body", "date-time", m.Begin.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *TaskLogWorkForm) validateEnd(formats strfmt.Registry) error { + if swag.IsZero(m.End) { // not required + return nil + } + + if err := validate.FormatOf("end", "body", "date-time", m.End.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this task log work form based on context it is used +func (m *TaskLogWorkForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TaskLogWorkForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TaskLogWorkForm) UnmarshalBinary(b []byte) error { + var res TaskLogWorkForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/task_query.go b/models/task_query.go new file mode 100644 index 0000000..055c9f4 --- /dev/null +++ b/models/task_query.go @@ -0,0 +1,334 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TaskQuery task query +// +// swagger:model TaskQuery +type TaskQuery struct { + + // Array of activity IDs + // Required: true + Activities []int64 `json:"activities"` + + // Array of customer IDs + // Required: true + Customers []int64 `json:"customers"` + + // The order for returned items + // Required: true + // Enum: [ASC DESC] + Order *string `json:"order"` + + // order by + // Required: true + // Enum: [title customer project activity description status user begin end team] + OrderBy *string `json:"orderBy"` + + // Page number. Default: 1 + Page int64 `json:"page,omitempty"` + + // page size + // Enum: [10 15 20 25 30 35 40 45 50 60 70 80 90 100 125 150 175 200 250 300 350 400 450 500] + PageSize float64 `json:"pageSize,omitempty"` + + // Array of project IDs + // Required: true + Projects []int64 `json:"projects"` + + // search term + SearchTerm string `json:"searchTerm,omitempty"` + + // status + Status []string `json:"status"` + + // Comma separated list of tags + Tags string `json:"tags,omitempty"` + + // Array of team IDs + Teams []int64 `json:"teams"` + + // Array of user IDs + Users []int64 `json:"users"` +} + +// Validate validates this task query +func (m *TaskQuery) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActivities(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCustomers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOrder(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOrderBy(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePageSize(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProjects(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TaskQuery) validateActivities(formats strfmt.Registry) error { + + if err := validate.Required("activities", "body", m.Activities); err != nil { + return err + } + + return nil +} + +func (m *TaskQuery) validateCustomers(formats strfmt.Registry) error { + + if err := validate.Required("customers", "body", m.Customers); err != nil { + return err + } + + return nil +} + +var taskQueryTypeOrderPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["ASC","DESC"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + taskQueryTypeOrderPropEnum = append(taskQueryTypeOrderPropEnum, v) + } +} + +const ( + + // TaskQueryOrderASC captures enum value "ASC" + TaskQueryOrderASC string = "ASC" + + // TaskQueryOrderDESC captures enum value "DESC" + TaskQueryOrderDESC string = "DESC" +) + +// prop value enum +func (m *TaskQuery) validateOrderEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, taskQueryTypeOrderPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *TaskQuery) validateOrder(formats strfmt.Registry) error { + + if err := validate.Required("order", "body", m.Order); err != nil { + return err + } + + // value enum + if err := m.validateOrderEnum("order", "body", *m.Order); err != nil { + return err + } + + return nil +} + +var taskQueryTypeOrderByPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["title","customer","project","activity","description","status","user","begin","end","team"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + taskQueryTypeOrderByPropEnum = append(taskQueryTypeOrderByPropEnum, v) + } +} + +const ( + + // TaskQueryOrderByTitle captures enum value "title" + TaskQueryOrderByTitle string = "title" + + // TaskQueryOrderByCustomer captures enum value "customer" + TaskQueryOrderByCustomer string = "customer" + + // TaskQueryOrderByProject captures enum value "project" + TaskQueryOrderByProject string = "project" + + // TaskQueryOrderByActivity captures enum value "activity" + TaskQueryOrderByActivity string = "activity" + + // TaskQueryOrderByDescription captures enum value "description" + TaskQueryOrderByDescription string = "description" + + // TaskQueryOrderByStatus captures enum value "status" + TaskQueryOrderByStatus string = "status" + + // TaskQueryOrderByUser captures enum value "user" + TaskQueryOrderByUser string = "user" + + // TaskQueryOrderByBegin captures enum value "begin" + TaskQueryOrderByBegin string = "begin" + + // TaskQueryOrderByEnd captures enum value "end" + TaskQueryOrderByEnd string = "end" + + // TaskQueryOrderByTeam captures enum value "team" + TaskQueryOrderByTeam string = "team" +) + +// prop value enum +func (m *TaskQuery) validateOrderByEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, taskQueryTypeOrderByPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *TaskQuery) validateOrderBy(formats strfmt.Registry) error { + + if err := validate.Required("orderBy", "body", m.OrderBy); err != nil { + return err + } + + // value enum + if err := m.validateOrderByEnum("orderBy", "body", *m.OrderBy); err != nil { + return err + } + + return nil +} + +var taskQueryTypePageSizePropEnum []interface{} + +func init() { + var res []float64 + if err := json.Unmarshal([]byte(`[10,15,20,25,30,35,40,45,50,60,70,80,90,100,125,150,175,200,250,300,350,400,450,500]`), &res); err != nil { + panic(err) + } + for _, v := range res { + taskQueryTypePageSizePropEnum = append(taskQueryTypePageSizePropEnum, v) + } +} + +// prop value enum +func (m *TaskQuery) validatePageSizeEnum(path, location string, value float64) error { + if err := validate.EnumCase(path, location, value, taskQueryTypePageSizePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *TaskQuery) validatePageSize(formats strfmt.Registry) error { + if swag.IsZero(m.PageSize) { // not required + return nil + } + + // value enum + if err := m.validatePageSizeEnum("pageSize", "body", m.PageSize); err != nil { + return err + } + + return nil +} + +func (m *TaskQuery) validateProjects(formats strfmt.Registry) error { + + if err := validate.Required("projects", "body", m.Projects); err != nil { + return err + } + + return nil +} + +var taskQueryStatusItemsEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["pending","progress","closed"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + taskQueryStatusItemsEnum = append(taskQueryStatusItemsEnum, v) + } +} + +func (m *TaskQuery) validateStatusItemsEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, taskQueryStatusItemsEnum, true); err != nil { + return err + } + return nil +} + +func (m *TaskQuery) validateStatus(formats strfmt.Registry) error { + if swag.IsZero(m.Status) { // not required + return nil + } + + for i := 0; i < len(m.Status); i++ { + + // value enum + if err := m.validateStatusItemsEnum("status"+"."+strconv.Itoa(i), "body", m.Status[i]); err != nil { + return err + } + + } + + return nil +} + +// ContextValidate validates this task query based on context it is used +func (m *TaskQuery) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TaskQuery) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TaskQuery) UnmarshalBinary(b []byte) error { + var res TaskQuery + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/team.go b/models/team.go new file mode 100644 index 0000000..0646263 --- /dev/null +++ b/models/team.go @@ -0,0 +1,431 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Team team +// +// swagger:model Team +type Team struct { + + // Activities assigned to the team + Activities []*Activity `json:"activities"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // Customers assigned to the team + Customers []*Customer `json:"customers"` + + // id + ID int64 `json:"id,omitempty"` + + // All team member (including team leads) + // Min Items: 1 + Members []*TeamMember `json:"members"` + + // Team name + // Required: true + // Max Length: 100 + // Min Length: 2 + Name *string `json:"name"` + + // Projects assigned to the team + Projects []*Project `json:"projects"` + + // teamlead + Teamlead *User `json:"teamlead,omitempty"` + + // Returns all users in the team, both teamlead and normal member. + Users []*User `json:"users"` +} + +// Validate validates this team +func (m *Team) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActivities(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCustomers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMembers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProjects(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTeamlead(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsers(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Team) validateActivities(formats strfmt.Registry) error { + if swag.IsZero(m.Activities) { // not required + return nil + } + + for i := 0; i < len(m.Activities); i++ { + if swag.IsZero(m.Activities[i]) { // not required + continue + } + + if m.Activities[i] != nil { + if err := m.Activities[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("activities" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("activities" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Team) validateCustomers(formats strfmt.Registry) error { + if swag.IsZero(m.Customers) { // not required + return nil + } + + for i := 0; i < len(m.Customers); i++ { + if swag.IsZero(m.Customers[i]) { // not required + continue + } + + if m.Customers[i] != nil { + if err := m.Customers[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("customers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("customers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Team) validateMembers(formats strfmt.Registry) error { + if swag.IsZero(m.Members) { // not required + return nil + } + + iMembersSize := int64(len(m.Members)) + + if err := validate.MinItems("members", "body", iMembersSize, 1); err != nil { + return err + } + + for i := 0; i < len(m.Members); i++ { + if swag.IsZero(m.Members[i]) { // not required + continue + } + + if m.Members[i] != nil { + if err := m.Members[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Team) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 100); err != nil { + return err + } + + return nil +} + +func (m *Team) validateProjects(formats strfmt.Registry) error { + if swag.IsZero(m.Projects) { // not required + return nil + } + + for i := 0; i < len(m.Projects); i++ { + if swag.IsZero(m.Projects[i]) { // not required + continue + } + + if m.Projects[i] != nil { + if err := m.Projects[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("projects" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("projects" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Team) validateTeamlead(formats strfmt.Registry) error { + if swag.IsZero(m.Teamlead) { // not required + return nil + } + + if m.Teamlead != nil { + if err := m.Teamlead.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teamlead") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teamlead") + } + return err + } + } + + return nil +} + +func (m *Team) validateUsers(formats strfmt.Registry) error { + if swag.IsZero(m.Users) { // not required + return nil + } + + for i := 0; i < len(m.Users); i++ { + if swag.IsZero(m.Users[i]) { // not required + continue + } + + if m.Users[i] != nil { + if err := m.Users[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("users" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this team based on the context it is used +func (m *Team) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateActivities(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCustomers(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMembers(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateProjects(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTeamlead(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Team) contextValidateActivities(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Activities); i++ { + + if m.Activities[i] != nil { + if err := m.Activities[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("activities" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("activities" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Team) contextValidateCustomers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Customers); i++ { + + if m.Customers[i] != nil { + if err := m.Customers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("customers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("customers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Team) contextValidateMembers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Members); i++ { + + if m.Members[i] != nil { + if err := m.Members[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Team) contextValidateProjects(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Projects); i++ { + + if m.Projects[i] != nil { + if err := m.Projects[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("projects" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("projects" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Team) contextValidateTeamlead(ctx context.Context, formats strfmt.Registry) error { + + if m.Teamlead != nil { + if err := m.Teamlead.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teamlead") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teamlead") + } + return err + } + } + + return nil +} + +func (m *Team) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Users); i++ { + + if m.Users[i] != nil { + if err := m.Users[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("users" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Team) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Team) UnmarshalBinary(b []byte) error { + var res Team + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/team_collection.go b/models/team_collection.go new file mode 100644 index 0000000..31352b9 --- /dev/null +++ b/models/team_collection.go @@ -0,0 +1,87 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TeamCollection team collection +// +// swagger:model TeamCollection +type TeamCollection struct { + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // id + ID int64 `json:"id,omitempty"` + + // Team name + // Required: true + // Max Length: 100 + // Min Length: 2 + Name *string `json:"name"` +} + +// Validate validates this team collection +func (m *TeamCollection) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TeamCollection) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 100); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this team collection based on context it is used +func (m *TeamCollection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TeamCollection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TeamCollection) UnmarshalBinary(b []byte) error { + var res TeamCollection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/team_edit_form.go b/models/team_edit_form.go new file mode 100644 index 0000000..2151593 --- /dev/null +++ b/models/team_edit_form.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TeamEditForm team edit form +// +// swagger:model TeamEditForm +type TeamEditForm struct { + + // The hexadecimal color code (default: #d2d6de) + Color string `json:"color,omitempty"` + + // All team members + // Required: true + Members []*TeamEditFormMembersItems0 `json:"members"` + + // Name of the team + // Required: true + Name *string `json:"name"` +} + +// Validate validates this team edit form +func (m *TeamEditForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMembers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TeamEditForm) validateMembers(formats strfmt.Registry) error { + + if err := validate.Required("members", "body", m.Members); err != nil { + return err + } + + for i := 0; i < len(m.Members); i++ { + if swag.IsZero(m.Members[i]) { // not required + continue + } + + if m.Members[i] != nil { + if err := m.Members[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TeamEditForm) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this team edit form based on the context it is used +func (m *TeamEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMembers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TeamEditForm) contextValidateMembers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Members); i++ { + + if m.Members[i] != nil { + if err := m.Members[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TeamEditForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TeamEditForm) UnmarshalBinary(b []byte) error { + var res TeamEditForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// TeamEditFormMembersItems0 team edit form members items0 +// +// swagger:model TeamEditFormMembersItems0 +type TeamEditFormMembersItems0 struct { + + // Whether the user is a teamlead + Teamlead bool `json:"teamlead,omitempty"` + + // User ID + User int64 `json:"user,omitempty"` +} + +// Validate validates this team edit form members items0 +func (m *TeamEditFormMembersItems0) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this team edit form members items0 based on context it is used +func (m *TeamEditFormMembersItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TeamEditFormMembersItems0) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TeamEditFormMembersItems0) UnmarshalBinary(b []byte) error { + var res TeamEditFormMembersItems0 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/team_member.go b/models/team_member.go new file mode 100644 index 0000000..8ca95e9 --- /dev/null +++ b/models/team_member.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TeamMember team member +// +// swagger:model TeamMember +type TeamMember struct { + + // teamlead + // Required: true + Teamlead *bool `json:"teamlead"` + + // user + // Required: true + User *User `json:"user"` +} + +// Validate validates this team member +func (m *TeamMember) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTeamlead(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TeamMember) validateTeamlead(formats strfmt.Registry) error { + + if err := validate.Required("teamlead", "body", m.Teamlead); err != nil { + return err + } + + return nil +} + +func (m *TeamMember) validateUser(formats strfmt.Registry) error { + + if err := validate.Required("user", "body", m.User); err != nil { + return err + } + + if m.User != nil { + if err := m.User.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// ContextValidate validate this team member based on the context it is used +func (m *TeamMember) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TeamMember) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { + + if m.User != nil { + if err := m.User.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TeamMember) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TeamMember) UnmarshalBinary(b []byte) error { + var res TeamMember + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/team_membership.go b/models/team_membership.go new file mode 100644 index 0000000..742c7b3 --- /dev/null +++ b/models/team_membership.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TeamMembership team membership +// +// swagger:model TeamMembership +type TeamMembership struct { + + // team + // Required: true + Team *Team `json:"team"` + + // teamlead + // Required: true + Teamlead *bool `json:"teamlead"` +} + +// Validate validates this team membership +func (m *TeamMembership) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTeam(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTeamlead(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TeamMembership) validateTeam(formats strfmt.Registry) error { + + if err := validate.Required("team", "body", m.Team); err != nil { + return err + } + + if m.Team != nil { + if err := m.Team.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("team") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("team") + } + return err + } + } + + return nil +} + +func (m *TeamMembership) validateTeamlead(formats strfmt.Registry) error { + + if err := validate.Required("teamlead", "body", m.Teamlead); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this team membership based on the context it is used +func (m *TeamMembership) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTeam(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TeamMembership) contextValidateTeam(ctx context.Context, formats strfmt.Registry) error { + + if m.Team != nil { + if err := m.Team.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("team") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("team") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TeamMembership) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TeamMembership) UnmarshalBinary(b []byte) error { + var res TeamMembership + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/timesheet_collection.go b/models/timesheet_collection.go new file mode 100644 index 0000000..2f02a9d --- /dev/null +++ b/models/timesheet_collection.go @@ -0,0 +1,239 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TimesheetCollection timesheet collection +// +// swagger:model TimesheetCollection +type TimesheetCollection struct { + + // activity + Activity int64 `json:"activity,omitempty"` + + // begin + // Required: true + // Format: date-time + Begin *strfmt.DateTime `json:"begin"` + + // billable + // Required: true + Billable *bool `json:"billable"` + + // description + Description string `json:"description,omitempty"` + + // duration + Duration int64 `json:"duration,omitempty"` + + // end + // Format: date-time + End strfmt.DateTime `json:"end,omitempty"` + + // exported + // Required: true + Exported *bool `json:"exported"` + + // id + ID int64 `json:"id,omitempty"` + + // internal rate + InternalRate float32 `json:"internalRate,omitempty"` + + // Meta fields + // + // All visible meta (custom) fields registered with this timesheet + MetaFields []*TimesheetMeta `json:"metaFields"` + + // project + Project int64 `json:"project,omitempty"` + + // rate + // Minimum: 0 + Rate *float32 `json:"rate,omitempty"` + + // tags + Tags []string `json:"tags"` + + // user + User int64 `json:"user,omitempty"` +} + +// Validate validates this timesheet collection +func (m *TimesheetCollection) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBegin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnd(formats); err != nil { + res = append(res, err) + } + + if err := m.validateExported(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMetaFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TimesheetCollection) validateBegin(formats strfmt.Registry) error { + + if err := validate.Required("begin", "body", m.Begin); err != nil { + return err + } + + if err := validate.FormatOf("begin", "body", "date-time", m.Begin.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *TimesheetCollection) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *TimesheetCollection) validateEnd(formats strfmt.Registry) error { + if swag.IsZero(m.End) { // not required + return nil + } + + if err := validate.FormatOf("end", "body", "date-time", m.End.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *TimesheetCollection) validateExported(formats strfmt.Registry) error { + + if err := validate.Required("exported", "body", m.Exported); err != nil { + return err + } + + return nil +} + +func (m *TimesheetCollection) validateMetaFields(formats strfmt.Registry) error { + if swag.IsZero(m.MetaFields) { // not required + return nil + } + + for i := 0; i < len(m.MetaFields); i++ { + if swag.IsZero(m.MetaFields[i]) { // not required + continue + } + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TimesheetCollection) validateRate(formats strfmt.Registry) error { + if swag.IsZero(m.Rate) { // not required + return nil + } + + if err := validate.Minimum("rate", "body", float64(*m.Rate), 0, false); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this timesheet collection based on the context it is used +func (m *TimesheetCollection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMetaFields(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TimesheetCollection) contextValidateMetaFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MetaFields); i++ { + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TimesheetCollection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TimesheetCollection) UnmarshalBinary(b []byte) error { + var res TimesheetCollection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/timesheet_collection_expanded.go b/models/timesheet_collection_expanded.go new file mode 100644 index 0000000..0d56129 --- /dev/null +++ b/models/timesheet_collection_expanded.go @@ -0,0 +1,329 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TimesheetCollectionExpanded timesheet collection expanded +// +// swagger:model TimesheetCollectionExpanded +type TimesheetCollectionExpanded struct { + + // activity + // Required: true + Activity *ActivityExpanded `json:"activity"` + + // begin + // Required: true + // Format: date-time + Begin *strfmt.DateTime `json:"begin"` + + // billable + // Required: true + Billable *bool `json:"billable"` + + // description + Description string `json:"description,omitempty"` + + // duration + Duration int64 `json:"duration,omitempty"` + + // end + // Format: date-time + End strfmt.DateTime `json:"end,omitempty"` + + // exported + // Required: true + Exported *bool `json:"exported"` + + // id + ID int64 `json:"id,omitempty"` + + // internal rate + InternalRate float32 `json:"internalRate,omitempty"` + + // Meta fields + // + // All visible meta (custom) fields registered with this timesheet + MetaFields []*TimesheetMeta `json:"metaFields"` + + // project + // Required: true + Project *ProjectExpanded `json:"project"` + + // rate + // Minimum: 0 + Rate *float32 `json:"rate,omitempty"` + + // tags + Tags []string `json:"tags"` + + // user + User int64 `json:"user,omitempty"` +} + +// Validate validates this timesheet collection expanded +func (m *TimesheetCollectionExpanded) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActivity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBegin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnd(formats); err != nil { + res = append(res, err) + } + + if err := m.validateExported(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMetaFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProject(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TimesheetCollectionExpanded) validateActivity(formats strfmt.Registry) error { + + if err := validate.Required("activity", "body", m.Activity); err != nil { + return err + } + + if m.Activity != nil { + if err := m.Activity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("activity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("activity") + } + return err + } + } + + return nil +} + +func (m *TimesheetCollectionExpanded) validateBegin(formats strfmt.Registry) error { + + if err := validate.Required("begin", "body", m.Begin); err != nil { + return err + } + + if err := validate.FormatOf("begin", "body", "date-time", m.Begin.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *TimesheetCollectionExpanded) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *TimesheetCollectionExpanded) validateEnd(formats strfmt.Registry) error { + if swag.IsZero(m.End) { // not required + return nil + } + + if err := validate.FormatOf("end", "body", "date-time", m.End.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *TimesheetCollectionExpanded) validateExported(formats strfmt.Registry) error { + + if err := validate.Required("exported", "body", m.Exported); err != nil { + return err + } + + return nil +} + +func (m *TimesheetCollectionExpanded) validateMetaFields(formats strfmt.Registry) error { + if swag.IsZero(m.MetaFields) { // not required + return nil + } + + for i := 0; i < len(m.MetaFields); i++ { + if swag.IsZero(m.MetaFields[i]) { // not required + continue + } + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TimesheetCollectionExpanded) validateProject(formats strfmt.Registry) error { + + if err := validate.Required("project", "body", m.Project); err != nil { + return err + } + + if m.Project != nil { + if err := m.Project.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("project") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("project") + } + return err + } + } + + return nil +} + +func (m *TimesheetCollectionExpanded) validateRate(formats strfmt.Registry) error { + if swag.IsZero(m.Rate) { // not required + return nil + } + + if err := validate.Minimum("rate", "body", float64(*m.Rate), 0, false); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this timesheet collection expanded based on the context it is used +func (m *TimesheetCollectionExpanded) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateActivity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMetaFields(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateProject(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TimesheetCollectionExpanded) contextValidateActivity(ctx context.Context, formats strfmt.Registry) error { + + if m.Activity != nil { + if err := m.Activity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("activity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("activity") + } + return err + } + } + + return nil +} + +func (m *TimesheetCollectionExpanded) contextValidateMetaFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MetaFields); i++ { + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TimesheetCollectionExpanded) contextValidateProject(ctx context.Context, formats strfmt.Registry) error { + + if m.Project != nil { + if err := m.Project.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("project") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("project") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TimesheetCollectionExpanded) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TimesheetCollectionExpanded) UnmarshalBinary(b []byte) error { + var res TimesheetCollectionExpanded + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/timesheet_config.go b/models/timesheet_config.go new file mode 100644 index 0000000..faefe08 --- /dev/null +++ b/models/timesheet_config.go @@ -0,0 +1,65 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TimesheetConfig timesheet config +// +// swagger:model TimesheetConfig +type TimesheetConfig struct { + + // How many running timesheets a user is allowed to have at the same time + ActiveEntriesHardLimit int64 `json:"activeEntriesHardLimit,omitempty"` + + // How many running timesheets a user is allowed before a warning is shown + ActiveEntriesSoftLimit int64 `json:"activeEntriesSoftLimit,omitempty"` + + // Default begin datetime in PHP format + DefaultBeginTime string `json:"defaultBeginTime,omitempty"` + + // Whether entries for future times are allowed + IsAllowFutureTimes bool `json:"isAllowFutureTimes,omitempty"` + + // Whether overlapping entries are allowed + IsAllowOverlapping bool `json:"isAllowOverlapping,omitempty"` + + // The time-tracking mode, see also: https://www.kimai.org/documentation/timesheet.html#tracking-modes + TrackingMode string `json:"trackingMode,omitempty"` +} + +// Validate validates this timesheet config +func (m *TimesheetConfig) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this timesheet config based on context it is used +func (m *TimesheetConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TimesheetConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TimesheetConfig) UnmarshalBinary(b []byte) error { + var res TimesheetConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/timesheet_edit_form.go b/models/timesheet_edit_form.go new file mode 100644 index 0000000..ce80351 --- /dev/null +++ b/models/timesheet_edit_form.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TimesheetEditForm timesheet edit form +// +// swagger:model TimesheetEditForm +type TimesheetEditForm struct { + + // Activity ID + // Required: true + Activity *int64 `json:"activity"` + + // begin + // Example: 2023-01-14T05:12:43 + // Required: true + // Format: date-time + Begin *strfmt.DateTime `json:"begin"` + + // billable + Billable bool `json:"billable,omitempty"` + + // description + Description string `json:"description,omitempty"` + + // end + // Example: 2023-01-14T05:12:43 + // Format: date-time + End strfmt.DateTime `json:"end,omitempty"` + + // exported + Exported bool `json:"exported,omitempty"` + + // Fixed rate + FixedRate float64 `json:"fixedRate,omitempty"` + + // Hourly rate + HourlyRate float64 `json:"hourlyRate,omitempty"` + + // Project ID + // Required: true + Project *int64 `json:"project"` + + // Comma separated list of tags + Tags string `json:"tags,omitempty"` + + // User ID + User int64 `json:"user,omitempty"` +} + +// Validate validates this timesheet edit form +func (m *TimesheetEditForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActivity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBegin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnd(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProject(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TimesheetEditForm) validateActivity(formats strfmt.Registry) error { + + if err := validate.Required("activity", "body", m.Activity); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEditForm) validateBegin(formats strfmt.Registry) error { + + if err := validate.Required("begin", "body", m.Begin); err != nil { + return err + } + + if err := validate.FormatOf("begin", "body", "date-time", m.Begin.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEditForm) validateEnd(formats strfmt.Registry) error { + if swag.IsZero(m.End) { // not required + return nil + } + + if err := validate.FormatOf("end", "body", "date-time", m.End.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEditForm) validateProject(formats strfmt.Registry) error { + + if err := validate.Required("project", "body", m.Project); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this timesheet edit form based on context it is used +func (m *TimesheetEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TimesheetEditForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TimesheetEditForm) UnmarshalBinary(b []byte) error { + var res TimesheetEditForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/timesheet_entity.go b/models/timesheet_entity.go new file mode 100644 index 0000000..63d7223 --- /dev/null +++ b/models/timesheet_entity.go @@ -0,0 +1,279 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TimesheetEntity timesheet entity +// +// swagger:model TimesheetEntity +type TimesheetEntity struct { + + // activity + Activity int64 `json:"activity,omitempty"` + + // begin + // Required: true + // Format: date-time + Begin *strfmt.DateTime `json:"begin"` + + // billable + // Required: true + Billable *bool `json:"billable"` + + // description + Description string `json:"description,omitempty"` + + // duration + Duration int64 `json:"duration,omitempty"` + + // end + // Format: date-time + End strfmt.DateTime `json:"end,omitempty"` + + // exported + // Required: true + Exported *bool `json:"exported"` + + // fixed rate + // Minimum: 0 + FixedRate *float32 `json:"fixedRate,omitempty"` + + // hourly rate + // Minimum: 0 + HourlyRate *float32 `json:"hourlyRate,omitempty"` + + // id + ID int64 `json:"id,omitempty"` + + // internal rate + InternalRate float32 `json:"internalRate,omitempty"` + + // Meta fields + // + // All visible meta (custom) fields registered with this timesheet + MetaFields []*TimesheetMeta `json:"metaFields"` + + // project + Project int64 `json:"project,omitempty"` + + // rate + // Minimum: 0 + Rate *float32 `json:"rate,omitempty"` + + // tags + Tags []string `json:"tags"` + + // user + User int64 `json:"user,omitempty"` +} + +// Validate validates this timesheet entity +func (m *TimesheetEntity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBegin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnd(formats); err != nil { + res = append(res, err) + } + + if err := m.validateExported(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFixedRate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHourlyRate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMetaFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TimesheetEntity) validateBegin(formats strfmt.Registry) error { + + if err := validate.Required("begin", "body", m.Begin); err != nil { + return err + } + + if err := validate.FormatOf("begin", "body", "date-time", m.Begin.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEntity) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEntity) validateEnd(formats strfmt.Registry) error { + if swag.IsZero(m.End) { // not required + return nil + } + + if err := validate.FormatOf("end", "body", "date-time", m.End.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEntity) validateExported(formats strfmt.Registry) error { + + if err := validate.Required("exported", "body", m.Exported); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEntity) validateFixedRate(formats strfmt.Registry) error { + if swag.IsZero(m.FixedRate) { // not required + return nil + } + + if err := validate.Minimum("fixedRate", "body", float64(*m.FixedRate), 0, false); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEntity) validateHourlyRate(formats strfmt.Registry) error { + if swag.IsZero(m.HourlyRate) { // not required + return nil + } + + if err := validate.Minimum("hourlyRate", "body", float64(*m.HourlyRate), 0, false); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEntity) validateMetaFields(formats strfmt.Registry) error { + if swag.IsZero(m.MetaFields) { // not required + return nil + } + + for i := 0; i < len(m.MetaFields); i++ { + if swag.IsZero(m.MetaFields[i]) { // not required + continue + } + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TimesheetEntity) validateRate(formats strfmt.Registry) error { + if swag.IsZero(m.Rate) { // not required + return nil + } + + if err := validate.Minimum("rate", "body", float64(*m.Rate), 0, false); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this timesheet entity based on the context it is used +func (m *TimesheetEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMetaFields(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TimesheetEntity) contextValidateMetaFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MetaFields); i++ { + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TimesheetEntity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TimesheetEntity) UnmarshalBinary(b []byte) error { + var res TimesheetEntity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/timesheet_entity_expanded.go b/models/timesheet_entity_expanded.go new file mode 100644 index 0000000..35de8e3 --- /dev/null +++ b/models/timesheet_entity_expanded.go @@ -0,0 +1,369 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TimesheetEntityExpanded timesheet entity expanded +// +// swagger:model TimesheetEntityExpanded +type TimesheetEntityExpanded struct { + + // activity + // Required: true + Activity *ActivityExpanded `json:"activity"` + + // begin + // Required: true + // Format: date-time + Begin *strfmt.DateTime `json:"begin"` + + // billable + // Required: true + Billable *bool `json:"billable"` + + // description + Description string `json:"description,omitempty"` + + // duration + Duration int64 `json:"duration,omitempty"` + + // end + // Format: date-time + End strfmt.DateTime `json:"end,omitempty"` + + // exported + // Required: true + Exported *bool `json:"exported"` + + // fixed rate + // Minimum: 0 + FixedRate *float32 `json:"fixedRate,omitempty"` + + // hourly rate + // Minimum: 0 + HourlyRate *float32 `json:"hourlyRate,omitempty"` + + // id + ID int64 `json:"id,omitempty"` + + // internal rate + InternalRate float32 `json:"internalRate,omitempty"` + + // Meta fields + // + // All visible meta (custom) fields registered with this timesheet + MetaFields []*TimesheetMeta `json:"metaFields"` + + // project + // Required: true + Project *ProjectExpanded `json:"project"` + + // rate + // Minimum: 0 + Rate *float32 `json:"rate,omitempty"` + + // tags + Tags []string `json:"tags"` + + // user + User int64 `json:"user,omitempty"` +} + +// Validate validates this timesheet entity expanded +func (m *TimesheetEntityExpanded) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActivity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBegin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBillable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnd(formats); err != nil { + res = append(res, err) + } + + if err := m.validateExported(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFixedRate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHourlyRate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMetaFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProject(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TimesheetEntityExpanded) validateActivity(formats strfmt.Registry) error { + + if err := validate.Required("activity", "body", m.Activity); err != nil { + return err + } + + if m.Activity != nil { + if err := m.Activity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("activity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("activity") + } + return err + } + } + + return nil +} + +func (m *TimesheetEntityExpanded) validateBegin(formats strfmt.Registry) error { + + if err := validate.Required("begin", "body", m.Begin); err != nil { + return err + } + + if err := validate.FormatOf("begin", "body", "date-time", m.Begin.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEntityExpanded) validateBillable(formats strfmt.Registry) error { + + if err := validate.Required("billable", "body", m.Billable); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEntityExpanded) validateEnd(formats strfmt.Registry) error { + if swag.IsZero(m.End) { // not required + return nil + } + + if err := validate.FormatOf("end", "body", "date-time", m.End.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEntityExpanded) validateExported(formats strfmt.Registry) error { + + if err := validate.Required("exported", "body", m.Exported); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEntityExpanded) validateFixedRate(formats strfmt.Registry) error { + if swag.IsZero(m.FixedRate) { // not required + return nil + } + + if err := validate.Minimum("fixedRate", "body", float64(*m.FixedRate), 0, false); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEntityExpanded) validateHourlyRate(formats strfmt.Registry) error { + if swag.IsZero(m.HourlyRate) { // not required + return nil + } + + if err := validate.Minimum("hourlyRate", "body", float64(*m.HourlyRate), 0, false); err != nil { + return err + } + + return nil +} + +func (m *TimesheetEntityExpanded) validateMetaFields(formats strfmt.Registry) error { + if swag.IsZero(m.MetaFields) { // not required + return nil + } + + for i := 0; i < len(m.MetaFields); i++ { + if swag.IsZero(m.MetaFields[i]) { // not required + continue + } + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TimesheetEntityExpanded) validateProject(formats strfmt.Registry) error { + + if err := validate.Required("project", "body", m.Project); err != nil { + return err + } + + if m.Project != nil { + if err := m.Project.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("project") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("project") + } + return err + } + } + + return nil +} + +func (m *TimesheetEntityExpanded) validateRate(formats strfmt.Registry) error { + if swag.IsZero(m.Rate) { // not required + return nil + } + + if err := validate.Minimum("rate", "body", float64(*m.Rate), 0, false); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this timesheet entity expanded based on the context it is used +func (m *TimesheetEntityExpanded) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateActivity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMetaFields(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateProject(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TimesheetEntityExpanded) contextValidateActivity(ctx context.Context, formats strfmt.Registry) error { + + if m.Activity != nil { + if err := m.Activity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("activity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("activity") + } + return err + } + } + + return nil +} + +func (m *TimesheetEntityExpanded) contextValidateMetaFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MetaFields); i++ { + + if m.MetaFields[i] != nil { + if err := m.MetaFields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("metaFields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *TimesheetEntityExpanded) contextValidateProject(ctx context.Context, formats strfmt.Registry) error { + + if m.Project != nil { + if err := m.Project.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("project") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("project") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TimesheetEntityExpanded) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TimesheetEntityExpanded) UnmarshalBinary(b []byte) error { + var res TimesheetEntityExpanded + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/timesheet_meta.go b/models/timesheet_meta.go new file mode 100644 index 0000000..81d488b --- /dev/null +++ b/models/timesheet_meta.go @@ -0,0 +1,101 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TimesheetMeta timesheet meta +// +// swagger:model TimesheetMeta +type TimesheetMeta struct { + + // Name of the meta (custom) field + // Required: true + // Max Length: 50 + // Min Length: 2 + Name *string `json:"name"` + + // Value of the meta (custom) field + // Max Length: 65535 + Value string `json:"value,omitempty"` +} + +// Validate validates this timesheet meta +func (m *TimesheetMeta) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TimesheetMeta) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 50); err != nil { + return err + } + + return nil +} + +func (m *TimesheetMeta) validateValue(formats strfmt.Registry) error { + if swag.IsZero(m.Value) { // not required + return nil + } + + if err := validate.MaxLength("value", "body", m.Value, 65535); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this timesheet meta based on context it is used +func (m *TimesheetMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TimesheetMeta) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TimesheetMeta) UnmarshalBinary(b []byte) error { + var res TimesheetMeta + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/user.go b/models/user.go new file mode 100644 index 0000000..b2382c9 --- /dev/null +++ b/models/user.go @@ -0,0 +1,130 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// User user +// +// swagger:model User +type User struct { + + // account number + // Max Length: 30 + AccountNumber string `json:"accountNumber,omitempty"` + + // The user alias will be displayed in the frontend instead of the username + // Max Length: 60 + Alias string `json:"alias,omitempty"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // enabled + Enabled bool `json:"enabled,omitempty"` + + // Internal ID + ID int64 `json:"id,omitempty"` + + // username + // Required: true + // Max Length: 60 + // Min Length: 2 + Username *string `json:"username"` +} + +// Validate validates this user +func (m *User) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccountNumber(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAlias(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsername(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *User) validateAccountNumber(formats strfmt.Registry) error { + if swag.IsZero(m.AccountNumber) { // not required + return nil + } + + if err := validate.MaxLength("accountNumber", "body", m.AccountNumber, 30); err != nil { + return err + } + + return nil +} + +func (m *User) validateAlias(formats strfmt.Registry) error { + if swag.IsZero(m.Alias) { // not required + return nil + } + + if err := validate.MaxLength("alias", "body", m.Alias, 60); err != nil { + return err + } + + return nil +} + +func (m *User) validateUsername(formats strfmt.Registry) error { + + if err := validate.Required("username", "body", m.Username); err != nil { + return err + } + + if err := validate.MinLength("username", "body", *m.Username, 2); err != nil { + return err + } + + if err := validate.MaxLength("username", "body", *m.Username, 60); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this user based on context it is used +func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *User) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *User) UnmarshalBinary(b []byte) error { + var res User + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/user_auth.go b/models/user_auth.go new file mode 100644 index 0000000..dd75b42 --- /dev/null +++ b/models/user_auth.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UserAuth user auth +// +// swagger:model UserAuth +type UserAuth struct { + + // code + // Required: true + Code *string `json:"code"` + + // type + // Required: true + Type *string `json:"type"` +} + +// Validate validates this user auth +func (m *UserAuth) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserAuth) validateCode(formats strfmt.Registry) error { + + if err := validate.Required("code", "body", m.Code); err != nil { + return err + } + + return nil +} + +func (m *UserAuth) validateType(formats strfmt.Registry) error { + + if err := validate.Required("type", "body", m.Type); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this user auth based on context it is used +func (m *UserAuth) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UserAuth) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserAuth) UnmarshalBinary(b []byte) error { + var res UserAuth + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/user_auth_codes.go b/models/user_auth_codes.go new file mode 100644 index 0000000..9f8c78b --- /dev/null +++ b/models/user_auth_codes.go @@ -0,0 +1,162 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// UserAuthCodes user auth codes +// +// swagger:model UserAuthCodes +type UserAuthCodes struct { + + // codes + Codes []*UserAuth `json:"codes"` + + // user + User *User `json:"user,omitempty"` +} + +// Validate validates this user auth codes +func (m *UserAuthCodes) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCodes(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserAuthCodes) validateCodes(formats strfmt.Registry) error { + if swag.IsZero(m.Codes) { // not required + return nil + } + + for i := 0; i < len(m.Codes); i++ { + if swag.IsZero(m.Codes[i]) { // not required + continue + } + + if m.Codes[i] != nil { + if err := m.Codes[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("codes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("codes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *UserAuthCodes) validateUser(formats strfmt.Registry) error { + if swag.IsZero(m.User) { // not required + return nil + } + + if m.User != nil { + if err := m.User.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// ContextValidate validate this user auth codes based on the context it is used +func (m *UserAuthCodes) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCodes(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserAuthCodes) contextValidateCodes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Codes); i++ { + + if m.Codes[i] != nil { + if err := m.Codes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("codes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("codes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *UserAuthCodes) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { + + if m.User != nil { + if err := m.User.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UserAuthCodes) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserAuthCodes) UnmarshalBinary(b []byte) error { + var res UserAuthCodes + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/user_collection.go b/models/user_collection.go new file mode 100644 index 0000000..08f7518 --- /dev/null +++ b/models/user_collection.go @@ -0,0 +1,130 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UserCollection user collection +// +// swagger:model UserCollection +type UserCollection struct { + + // account number + // Max Length: 30 + AccountNumber string `json:"accountNumber,omitempty"` + + // The user alias will be displayed in the frontend instead of the username + // Max Length: 60 + Alias string `json:"alias,omitempty"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // enabled + Enabled bool `json:"enabled,omitempty"` + + // Internal ID + ID int64 `json:"id,omitempty"` + + // username + // Required: true + // Max Length: 60 + // Min Length: 2 + Username *string `json:"username"` +} + +// Validate validates this user collection +func (m *UserCollection) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccountNumber(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAlias(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsername(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserCollection) validateAccountNumber(formats strfmt.Registry) error { + if swag.IsZero(m.AccountNumber) { // not required + return nil + } + + if err := validate.MaxLength("accountNumber", "body", m.AccountNumber, 30); err != nil { + return err + } + + return nil +} + +func (m *UserCollection) validateAlias(formats strfmt.Registry) error { + if swag.IsZero(m.Alias) { // not required + return nil + } + + if err := validate.MaxLength("alias", "body", m.Alias, 60); err != nil { + return err + } + + return nil +} + +func (m *UserCollection) validateUsername(formats strfmt.Registry) error { + + if err := validate.Required("username", "body", m.Username); err != nil { + return err + } + + if err := validate.MinLength("username", "body", *m.Username, 2); err != nil { + return err + } + + if err := validate.MaxLength("username", "body", *m.Username, 60); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this user collection based on context it is used +func (m *UserCollection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UserCollection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserCollection) UnmarshalBinary(b []byte) error { + var res UserCollection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/user_create_form.go b/models/user_create_form.go new file mode 100644 index 0000000..1f5747d --- /dev/null +++ b/models/user_create_form.go @@ -0,0 +1,336 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UserCreateForm user create form +// +// swagger:model UserCreateForm +type UserCreateForm struct { + + // account number + AccountNumber string `json:"accountNumber,omitempty"` + + // alias + Alias string `json:"alias,omitempty"` + + // The hexadecimal color code (default: #d2d6de) + Color string `json:"color,omitempty"` + + // email + // Required: true + Email *string `json:"email"` + + // enabled + Enabled bool `json:"enabled,omitempty"` + + // language + // Required: true + // Enum: [ar cs da de de_AT de_CH el en en_GB eo es eu fa fi fo fr he hr hu it ja ko nb_NO nl pl pt pt_BR ro ru sk sv tr uk vi zh_CN] + Language *string `json:"language"` + + // Plain API token + PlainAPIToken string `json:"plainApiToken,omitempty"` + + // Plain text password + // Required: true + PlainPassword *string `json:"plainPassword"` + + // roles + Roles []string `json:"roles"` + + // timezone + // Required: true + Timezone *string `json:"timezone"` + + // title + Title string `json:"title,omitempty"` + + // username + // Required: true + Username *string `json:"username"` +} + +// Validate validates this user create form +func (m *UserCreateForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmail(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLanguage(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePlainPassword(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRoles(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimezone(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsername(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserCreateForm) validateEmail(formats strfmt.Registry) error { + + if err := validate.Required("email", "body", m.Email); err != nil { + return err + } + + return nil +} + +var userCreateFormTypeLanguagePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["ar","cs","da","de","de_AT","de_CH","el","en","en_GB","eo","es","eu","fa","fi","fo","fr","he","hr","hu","it","ja","ko","nb_NO","nl","pl","pt","pt_BR","ro","ru","sk","sv","tr","uk","vi","zh_CN"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + userCreateFormTypeLanguagePropEnum = append(userCreateFormTypeLanguagePropEnum, v) + } +} + +const ( + + // UserCreateFormLanguageAr captures enum value "ar" + UserCreateFormLanguageAr string = "ar" + + // UserCreateFormLanguageCs captures enum value "cs" + UserCreateFormLanguageCs string = "cs" + + // UserCreateFormLanguageDa captures enum value "da" + UserCreateFormLanguageDa string = "da" + + // UserCreateFormLanguageDe captures enum value "de" + UserCreateFormLanguageDe string = "de" + + // UserCreateFormLanguageDeAT captures enum value "de_AT" + UserCreateFormLanguageDeAT string = "de_AT" + + // UserCreateFormLanguageDeCH captures enum value "de_CH" + UserCreateFormLanguageDeCH string = "de_CH" + + // UserCreateFormLanguageEl captures enum value "el" + UserCreateFormLanguageEl string = "el" + + // UserCreateFormLanguageEn captures enum value "en" + UserCreateFormLanguageEn string = "en" + + // UserCreateFormLanguageEnGB captures enum value "en_GB" + UserCreateFormLanguageEnGB string = "en_GB" + + // UserCreateFormLanguageEo captures enum value "eo" + UserCreateFormLanguageEo string = "eo" + + // UserCreateFormLanguageEs captures enum value "es" + UserCreateFormLanguageEs string = "es" + + // UserCreateFormLanguageEu captures enum value "eu" + UserCreateFormLanguageEu string = "eu" + + // UserCreateFormLanguageFa captures enum value "fa" + UserCreateFormLanguageFa string = "fa" + + // UserCreateFormLanguageFi captures enum value "fi" + UserCreateFormLanguageFi string = "fi" + + // UserCreateFormLanguageFo captures enum value "fo" + UserCreateFormLanguageFo string = "fo" + + // UserCreateFormLanguageFr captures enum value "fr" + UserCreateFormLanguageFr string = "fr" + + // UserCreateFormLanguageHe captures enum value "he" + UserCreateFormLanguageHe string = "he" + + // UserCreateFormLanguageHr captures enum value "hr" + UserCreateFormLanguageHr string = "hr" + + // UserCreateFormLanguageHu captures enum value "hu" + UserCreateFormLanguageHu string = "hu" + + // UserCreateFormLanguageIt captures enum value "it" + UserCreateFormLanguageIt string = "it" + + // UserCreateFormLanguageJa captures enum value "ja" + UserCreateFormLanguageJa string = "ja" + + // UserCreateFormLanguageKo captures enum value "ko" + UserCreateFormLanguageKo string = "ko" + + // UserCreateFormLanguageNbNO captures enum value "nb_NO" + UserCreateFormLanguageNbNO string = "nb_NO" + + // UserCreateFormLanguageNl captures enum value "nl" + UserCreateFormLanguageNl string = "nl" + + // UserCreateFormLanguagePl captures enum value "pl" + UserCreateFormLanguagePl string = "pl" + + // UserCreateFormLanguagePt captures enum value "pt" + UserCreateFormLanguagePt string = "pt" + + // UserCreateFormLanguagePtBR captures enum value "pt_BR" + UserCreateFormLanguagePtBR string = "pt_BR" + + // UserCreateFormLanguageRo captures enum value "ro" + UserCreateFormLanguageRo string = "ro" + + // UserCreateFormLanguageRu captures enum value "ru" + UserCreateFormLanguageRu string = "ru" + + // UserCreateFormLanguageSk captures enum value "sk" + UserCreateFormLanguageSk string = "sk" + + // UserCreateFormLanguageSv captures enum value "sv" + UserCreateFormLanguageSv string = "sv" + + // UserCreateFormLanguageTr captures enum value "tr" + UserCreateFormLanguageTr string = "tr" + + // UserCreateFormLanguageUk captures enum value "uk" + UserCreateFormLanguageUk string = "uk" + + // UserCreateFormLanguageVi captures enum value "vi" + UserCreateFormLanguageVi string = "vi" + + // UserCreateFormLanguageZhCN captures enum value "zh_CN" + UserCreateFormLanguageZhCN string = "zh_CN" +) + +// prop value enum +func (m *UserCreateForm) validateLanguageEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, userCreateFormTypeLanguagePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *UserCreateForm) validateLanguage(formats strfmt.Registry) error { + + if err := validate.Required("language", "body", m.Language); err != nil { + return err + } + + // value enum + if err := m.validateLanguageEnum("language", "body", *m.Language); err != nil { + return err + } + + return nil +} + +func (m *UserCreateForm) validatePlainPassword(formats strfmt.Registry) error { + + if err := validate.Required("plainPassword", "body", m.PlainPassword); err != nil { + return err + } + + return nil +} + +var userCreateFormRolesItemsEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["ROLE_TEAMLEAD","ROLE_ADMIN","ROLE_SUPER_ADMIN"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + userCreateFormRolesItemsEnum = append(userCreateFormRolesItemsEnum, v) + } +} + +func (m *UserCreateForm) validateRolesItemsEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, userCreateFormRolesItemsEnum, true); err != nil { + return err + } + return nil +} + +func (m *UserCreateForm) validateRoles(formats strfmt.Registry) error { + if swag.IsZero(m.Roles) { // not required + return nil + } + + for i := 0; i < len(m.Roles); i++ { + + // value enum + if err := m.validateRolesItemsEnum("roles"+"."+strconv.Itoa(i), "body", m.Roles[i]); err != nil { + return err + } + + } + + return nil +} + +func (m *UserCreateForm) validateTimezone(formats strfmt.Registry) error { + + if err := validate.Required("timezone", "body", m.Timezone); err != nil { + return err + } + + return nil +} + +func (m *UserCreateForm) validateUsername(formats strfmt.Registry) error { + + if err := validate.Required("username", "body", m.Username); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this user create form based on context it is used +func (m *UserCreateForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UserCreateForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserCreateForm) UnmarshalBinary(b []byte) error { + var res UserCreateForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/user_edit_form.go b/models/user_edit_form.go new file mode 100644 index 0000000..a63f5fd --- /dev/null +++ b/models/user_edit_form.go @@ -0,0 +1,299 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UserEditForm user edit form +// +// swagger:model UserEditForm +type UserEditForm struct { + + // account number + AccountNumber string `json:"accountNumber,omitempty"` + + // alias + Alias string `json:"alias,omitempty"` + + // The hexadecimal color code (default: #d2d6de) + Color string `json:"color,omitempty"` + + // email + // Required: true + Email *string `json:"email"` + + // enabled + Enabled bool `json:"enabled,omitempty"` + + // language + // Required: true + // Enum: [ar cs da de de_AT de_CH el en en_GB eo es eu fa fi fo fr he hr hu it ja ko nb_NO nl pl pt pt_BR ro ru sk sv tr uk vi zh_CN] + Language *string `json:"language"` + + // roles + Roles []string `json:"roles"` + + // timezone + // Required: true + Timezone *string `json:"timezone"` + + // title + Title string `json:"title,omitempty"` +} + +// Validate validates this user edit form +func (m *UserEditForm) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmail(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLanguage(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRoles(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimezone(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserEditForm) validateEmail(formats strfmt.Registry) error { + + if err := validate.Required("email", "body", m.Email); err != nil { + return err + } + + return nil +} + +var userEditFormTypeLanguagePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["ar","cs","da","de","de_AT","de_CH","el","en","en_GB","eo","es","eu","fa","fi","fo","fr","he","hr","hu","it","ja","ko","nb_NO","nl","pl","pt","pt_BR","ro","ru","sk","sv","tr","uk","vi","zh_CN"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + userEditFormTypeLanguagePropEnum = append(userEditFormTypeLanguagePropEnum, v) + } +} + +const ( + + // UserEditFormLanguageAr captures enum value "ar" + UserEditFormLanguageAr string = "ar" + + // UserEditFormLanguageCs captures enum value "cs" + UserEditFormLanguageCs string = "cs" + + // UserEditFormLanguageDa captures enum value "da" + UserEditFormLanguageDa string = "da" + + // UserEditFormLanguageDe captures enum value "de" + UserEditFormLanguageDe string = "de" + + // UserEditFormLanguageDeAT captures enum value "de_AT" + UserEditFormLanguageDeAT string = "de_AT" + + // UserEditFormLanguageDeCH captures enum value "de_CH" + UserEditFormLanguageDeCH string = "de_CH" + + // UserEditFormLanguageEl captures enum value "el" + UserEditFormLanguageEl string = "el" + + // UserEditFormLanguageEn captures enum value "en" + UserEditFormLanguageEn string = "en" + + // UserEditFormLanguageEnGB captures enum value "en_GB" + UserEditFormLanguageEnGB string = "en_GB" + + // UserEditFormLanguageEo captures enum value "eo" + UserEditFormLanguageEo string = "eo" + + // UserEditFormLanguageEs captures enum value "es" + UserEditFormLanguageEs string = "es" + + // UserEditFormLanguageEu captures enum value "eu" + UserEditFormLanguageEu string = "eu" + + // UserEditFormLanguageFa captures enum value "fa" + UserEditFormLanguageFa string = "fa" + + // UserEditFormLanguageFi captures enum value "fi" + UserEditFormLanguageFi string = "fi" + + // UserEditFormLanguageFo captures enum value "fo" + UserEditFormLanguageFo string = "fo" + + // UserEditFormLanguageFr captures enum value "fr" + UserEditFormLanguageFr string = "fr" + + // UserEditFormLanguageHe captures enum value "he" + UserEditFormLanguageHe string = "he" + + // UserEditFormLanguageHr captures enum value "hr" + UserEditFormLanguageHr string = "hr" + + // UserEditFormLanguageHu captures enum value "hu" + UserEditFormLanguageHu string = "hu" + + // UserEditFormLanguageIt captures enum value "it" + UserEditFormLanguageIt string = "it" + + // UserEditFormLanguageJa captures enum value "ja" + UserEditFormLanguageJa string = "ja" + + // UserEditFormLanguageKo captures enum value "ko" + UserEditFormLanguageKo string = "ko" + + // UserEditFormLanguageNbNO captures enum value "nb_NO" + UserEditFormLanguageNbNO string = "nb_NO" + + // UserEditFormLanguageNl captures enum value "nl" + UserEditFormLanguageNl string = "nl" + + // UserEditFormLanguagePl captures enum value "pl" + UserEditFormLanguagePl string = "pl" + + // UserEditFormLanguagePt captures enum value "pt" + UserEditFormLanguagePt string = "pt" + + // UserEditFormLanguagePtBR captures enum value "pt_BR" + UserEditFormLanguagePtBR string = "pt_BR" + + // UserEditFormLanguageRo captures enum value "ro" + UserEditFormLanguageRo string = "ro" + + // UserEditFormLanguageRu captures enum value "ru" + UserEditFormLanguageRu string = "ru" + + // UserEditFormLanguageSk captures enum value "sk" + UserEditFormLanguageSk string = "sk" + + // UserEditFormLanguageSv captures enum value "sv" + UserEditFormLanguageSv string = "sv" + + // UserEditFormLanguageTr captures enum value "tr" + UserEditFormLanguageTr string = "tr" + + // UserEditFormLanguageUk captures enum value "uk" + UserEditFormLanguageUk string = "uk" + + // UserEditFormLanguageVi captures enum value "vi" + UserEditFormLanguageVi string = "vi" + + // UserEditFormLanguageZhCN captures enum value "zh_CN" + UserEditFormLanguageZhCN string = "zh_CN" +) + +// prop value enum +func (m *UserEditForm) validateLanguageEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, userEditFormTypeLanguagePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *UserEditForm) validateLanguage(formats strfmt.Registry) error { + + if err := validate.Required("language", "body", m.Language); err != nil { + return err + } + + // value enum + if err := m.validateLanguageEnum("language", "body", *m.Language); err != nil { + return err + } + + return nil +} + +var userEditFormRolesItemsEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["ROLE_TEAMLEAD","ROLE_ADMIN","ROLE_SUPER_ADMIN"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + userEditFormRolesItemsEnum = append(userEditFormRolesItemsEnum, v) + } +} + +func (m *UserEditForm) validateRolesItemsEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, userEditFormRolesItemsEnum, true); err != nil { + return err + } + return nil +} + +func (m *UserEditForm) validateRoles(formats strfmt.Registry) error { + if swag.IsZero(m.Roles) { // not required + return nil + } + + for i := 0; i < len(m.Roles); i++ { + + // value enum + if err := m.validateRolesItemsEnum("roles"+"."+strconv.Itoa(i), "body", m.Roles[i]); err != nil { + return err + } + + } + + return nil +} + +func (m *UserEditForm) validateTimezone(formats strfmt.Registry) error { + + if err := validate.Required("timezone", "body", m.Timezone); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this user edit form based on context it is used +func (m *UserEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UserEditForm) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserEditForm) UnmarshalBinary(b []byte) error { + var res UserEditForm + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/user_entity.go b/models/user_entity.go new file mode 100644 index 0000000..3978161 --- /dev/null +++ b/models/user_entity.go @@ -0,0 +1,347 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UserEntity user entity +// +// swagger:model UserEntity +type UserEntity struct { + + // account number + // Max Length: 30 + AccountNumber string `json:"accountNumber,omitempty"` + + // The user alias will be displayed in the frontend instead of the username + // Max Length: 60 + Alias string `json:"alias,omitempty"` + + // URL to the user avatar, will be auto-generated if empty + // Max Length: 255 + Avatar string `json:"avatar,omitempty"` + + // The assigned color in HTML hex format, eg. #dd1d00 + Color string `json:"color,omitempty"` + + // enabled + Enabled bool `json:"enabled,omitempty"` + + // Internal ID + ID int64 `json:"id,omitempty"` + + // language + Language string `json:"language,omitempty"` + + // memberships + // Required: true + Memberships *TeamMembership `json:"memberships"` + + // Read-only list of of all visible user preferences. + Preferences []*UserPreference `json:"preferences"` + + // List of all role names + Roles []string `json:"roles"` + + // List of all teams, this user is part of + Teams []*Team `json:"teams"` + + // timezone + Timezone string `json:"timezone,omitempty"` + + // An additional title for the user, like the Job position or Department + // Max Length: 50 + Title string `json:"title,omitempty"` + + // username + // Required: true + // Max Length: 60 + // Min Length: 2 + Username *string `json:"username"` +} + +// Validate validates this user entity +func (m *UserEntity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccountNumber(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAlias(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAvatar(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemberships(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePreferences(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTeams(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTitle(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsername(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserEntity) validateAccountNumber(formats strfmt.Registry) error { + if swag.IsZero(m.AccountNumber) { // not required + return nil + } + + if err := validate.MaxLength("accountNumber", "body", m.AccountNumber, 30); err != nil { + return err + } + + return nil +} + +func (m *UserEntity) validateAlias(formats strfmt.Registry) error { + if swag.IsZero(m.Alias) { // not required + return nil + } + + if err := validate.MaxLength("alias", "body", m.Alias, 60); err != nil { + return err + } + + return nil +} + +func (m *UserEntity) validateAvatar(formats strfmt.Registry) error { + if swag.IsZero(m.Avatar) { // not required + return nil + } + + if err := validate.MaxLength("avatar", "body", m.Avatar, 255); err != nil { + return err + } + + return nil +} + +func (m *UserEntity) validateMemberships(formats strfmt.Registry) error { + + if err := validate.Required("memberships", "body", m.Memberships); err != nil { + return err + } + + if m.Memberships != nil { + if err := m.Memberships.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memberships") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("memberships") + } + return err + } + } + + return nil +} + +func (m *UserEntity) validatePreferences(formats strfmt.Registry) error { + if swag.IsZero(m.Preferences) { // not required + return nil + } + + for i := 0; i < len(m.Preferences); i++ { + if swag.IsZero(m.Preferences[i]) { // not required + continue + } + + if m.Preferences[i] != nil { + if err := m.Preferences[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("preferences" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("preferences" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *UserEntity) validateTeams(formats strfmt.Registry) error { + if swag.IsZero(m.Teams) { // not required + return nil + } + + for i := 0; i < len(m.Teams); i++ { + if swag.IsZero(m.Teams[i]) { // not required + continue + } + + if m.Teams[i] != nil { + if err := m.Teams[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *UserEntity) validateTitle(formats strfmt.Registry) error { + if swag.IsZero(m.Title) { // not required + return nil + } + + if err := validate.MaxLength("title", "body", m.Title, 50); err != nil { + return err + } + + return nil +} + +func (m *UserEntity) validateUsername(formats strfmt.Registry) error { + + if err := validate.Required("username", "body", m.Username); err != nil { + return err + } + + if err := validate.MinLength("username", "body", *m.Username, 2); err != nil { + return err + } + + if err := validate.MaxLength("username", "body", *m.Username, 60); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this user entity based on the context it is used +func (m *UserEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMemberships(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePreferences(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTeams(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserEntity) contextValidateMemberships(ctx context.Context, formats strfmt.Registry) error { + + if m.Memberships != nil { + if err := m.Memberships.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memberships") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("memberships") + } + return err + } + } + + return nil +} + +func (m *UserEntity) contextValidatePreferences(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Preferences); i++ { + + if m.Preferences[i] != nil { + if err := m.Preferences[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("preferences" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("preferences" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *UserEntity) contextValidateTeams(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Teams); i++ { + + if m.Teams[i] != nil { + if err := m.Teams[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("teams" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("teams" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UserEntity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserEntity) UnmarshalBinary(b []byte) error { + var res UserEntity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/user_preference.go b/models/user_preference.go new file mode 100644 index 0000000..b8e0972 --- /dev/null +++ b/models/user_preference.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UserPreference user preference +// +// swagger:model UserPreference +type UserPreference struct { + + // name + // Required: true + // Max Length: 50 + // Min Length: 2 + Name *string `json:"name"` + + // value + Value string `json:"value,omitempty"` +} + +// Validate validates this user preference +func (m *UserPreference) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserPreference) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 2); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 50); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this user preference based on context it is used +func (m *UserPreference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UserPreference) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserPreference) UnmarshalBinary(b []byte) error { + var res UserPreference + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/version.go b/models/version.go new file mode 100644 index 0000000..f3e2b26 --- /dev/null +++ b/models/version.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Version version +// +// swagger:model Version +type Version struct { + + // Candidate: either "prod" or "dev" + Candidate string `json:"candidate,omitempty"` + + // A full copyright notice + Copyright string `json:"copyright,omitempty"` + + // The version name + Name string `json:"name,omitempty"` + + // Full version including status, eg: "1.9-prod" + Semver string `json:"semver,omitempty"` + + // Kimai Version, eg. "1.14" + Version string `json:"version,omitempty"` + + // Kimai Version as integer, eg. 11400 + // + // Follows the same logic as PHP_VERSION_ID, see https://www.php.net/manual/de/function.phpversion.php + VersionID int64 `json:"versionId,omitempty"` +} + +// Validate validates this version +func (m *Version) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this version based on context it is used +func (m *Version) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Version) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Version) UnmarshalBinary(b []byte) error { + var res Version + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}