feat: init

This commit is contained in:
decentral1se 2023-01-14 15:14:06 +01:00
commit f44e2acbaf
No known key found for this signature in database
GPG Key ID: 03789458B3D0C410
245 changed files with 44079 additions and 0 deletions

3
.envrc.example Normal file
View File

@ -0,0 +1,3 @@
export GO_KIMAI_USER=...
export GO_KIMAI_TOKEN=...
export GO_KIMAI_DOMAIN=...

15
LICENSE Normal file
View File

@ -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 <https://www.gnu.org/licenses/>.

21
README.md Normal file
View File

@ -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
<a><img src="https://www.gnu.org/graphics/gplv3-with-text-136x68.png"/></a>

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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