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.Sprintf("[GET /api/expenses][%d] getApiExpensesOK %+v", 200, o.Payload)
}
func (o *GetAPIExpensesOK) GetPayload() []*models.ExpenseEntity {
return o.Payload
}
func (o *GetAPIExpensesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

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"
)
// NewPatchAPIExpensesIDDuplicateParams creates a new PatchAPIExpensesIDDuplicateParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPatchAPIExpensesIDDuplicateParams() *PatchAPIExpensesIDDuplicateParams {
return &PatchAPIExpensesIDDuplicateParams{
timeout: cr.DefaultTimeout,
}
}
// NewPatchAPIExpensesIDDuplicateParamsWithTimeout creates a new PatchAPIExpensesIDDuplicateParams object
// with the ability to set a timeout on a request.
func NewPatchAPIExpensesIDDuplicateParamsWithTimeout(timeout time.Duration) *PatchAPIExpensesIDDuplicateParams {
return &PatchAPIExpensesIDDuplicateParams{
timeout: timeout,
}
}
// NewPatchAPIExpensesIDDuplicateParamsWithContext creates a new PatchAPIExpensesIDDuplicateParams object
// with the ability to set a context for a request.
func NewPatchAPIExpensesIDDuplicateParamsWithContext(ctx context.Context) *PatchAPIExpensesIDDuplicateParams {
return &PatchAPIExpensesIDDuplicateParams{
Context: ctx,
}
}
// NewPatchAPIExpensesIDDuplicateParamsWithHTTPClient creates a new PatchAPIExpensesIDDuplicateParams object
// with the ability to set a custom HTTPClient for a request.
func NewPatchAPIExpensesIDDuplicateParamsWithHTTPClient(client *http.Client) *PatchAPIExpensesIDDuplicateParams {
return &PatchAPIExpensesIDDuplicateParams{
HTTPClient: client,
}
}
/*
PatchAPIExpensesIDDuplicateParams contains all the parameters to send to the API endpoint
for the patch API expenses ID duplicate operation.
Typically these are written to a http.Request.
*/
type PatchAPIExpensesIDDuplicateParams struct {
/* ID.
Expense record ID to duplicate
*/
ID int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the patch API expenses ID duplicate params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PatchAPIExpensesIDDuplicateParams) WithDefaults() *PatchAPIExpensesIDDuplicateParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the patch API expenses ID duplicate params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PatchAPIExpensesIDDuplicateParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the patch API expenses ID duplicate params
func (o *PatchAPIExpensesIDDuplicateParams) WithTimeout(timeout time.Duration) *PatchAPIExpensesIDDuplicateParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the patch API expenses ID duplicate params
func (o *PatchAPIExpensesIDDuplicateParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the patch API expenses ID duplicate params
func (o *PatchAPIExpensesIDDuplicateParams) WithContext(ctx context.Context) *PatchAPIExpensesIDDuplicateParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the patch API expenses ID duplicate params
func (o *PatchAPIExpensesIDDuplicateParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the patch API expenses ID duplicate params
func (o *PatchAPIExpensesIDDuplicateParams) WithHTTPClient(client *http.Client) *PatchAPIExpensesIDDuplicateParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the patch API expenses ID duplicate params
func (o *PatchAPIExpensesIDDuplicateParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the patch API expenses ID duplicate params
func (o *PatchAPIExpensesIDDuplicateParams) WithID(id int64) *PatchAPIExpensesIDDuplicateParams {
o.SetID(id)
return o
}
// SetID adds the id to the patch API expenses ID duplicate params
func (o *PatchAPIExpensesIDDuplicateParams) SetID(id int64) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *PatchAPIExpensesIDDuplicateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param id
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

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"
)
// PatchAPIExpensesIDDuplicateReader is a Reader for the PatchAPIExpensesIDDuplicate structure.
type PatchAPIExpensesIDDuplicateReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PatchAPIExpensesIDDuplicateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPatchAPIExpensesIDDuplicateOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewPatchAPIExpensesIDDuplicateOK creates a PatchAPIExpensesIDDuplicateOK with default headers values
func NewPatchAPIExpensesIDDuplicateOK() *PatchAPIExpensesIDDuplicateOK {
return &PatchAPIExpensesIDDuplicateOK{}
}
/*
PatchAPIExpensesIDDuplicateOK describes a response with status code 200, with default header values.
Duplicates a expense record, resetting the export state only.
*/
type PatchAPIExpensesIDDuplicateOK struct {
Payload *models.ExpenseEntity
}
// IsSuccess returns true when this patch Api expenses Id duplicate o k response has a 2xx status code
func (o *PatchAPIExpensesIDDuplicateOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this patch Api expenses Id duplicate o k response has a 3xx status code
func (o *PatchAPIExpensesIDDuplicateOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this patch Api expenses Id duplicate o k response has a 4xx status code
func (o *PatchAPIExpensesIDDuplicateOK) IsClientError() bool {
return false
}
// IsServerError returns true when this patch Api expenses Id duplicate o k response has a 5xx status code
func (o *PatchAPIExpensesIDDuplicateOK) IsServerError() bool {
return false
}
// IsCode returns true when this patch Api expenses Id duplicate o k response a status code equal to that given
func (o *PatchAPIExpensesIDDuplicateOK) IsCode(code int) bool {
return code == 200
}
func (o *PatchAPIExpensesIDDuplicateOK) Error() string {
return fmt.Sprintf("[PATCH /api/expenses/{id}/duplicate][%d] patchApiExpensesIdDuplicateOK %+v", 200, o.Payload)
}
func (o *PatchAPIExpensesIDDuplicateOK) String() string {
return fmt.Sprintf("[PATCH /api/expenses/{id}/duplicate][%d] patchApiExpensesIdDuplicateOK %+v", 200, o.Payload)
}
func (o *PatchAPIExpensesIDDuplicateOK) GetPayload() *models.ExpenseEntity {
return o.Payload
}
func (o *PatchAPIExpensesIDDuplicateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ExpenseEntity)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,169 @@
// Code generated by go-swagger; DO NOT EDIT.
package expense
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewPatchAPIExpensesIDMetaParams creates a new PatchAPIExpensesIDMetaParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPatchAPIExpensesIDMetaParams() *PatchAPIExpensesIDMetaParams {
return &PatchAPIExpensesIDMetaParams{
timeout: cr.DefaultTimeout,
}
}
// NewPatchAPIExpensesIDMetaParamsWithTimeout creates a new PatchAPIExpensesIDMetaParams object
// with the ability to set a timeout on a request.
func NewPatchAPIExpensesIDMetaParamsWithTimeout(timeout time.Duration) *PatchAPIExpensesIDMetaParams {
return &PatchAPIExpensesIDMetaParams{
timeout: timeout,
}
}
// NewPatchAPIExpensesIDMetaParamsWithContext creates a new PatchAPIExpensesIDMetaParams object
// with the ability to set a context for a request.
func NewPatchAPIExpensesIDMetaParamsWithContext(ctx context.Context) *PatchAPIExpensesIDMetaParams {
return &PatchAPIExpensesIDMetaParams{
Context: ctx,
}
}
// NewPatchAPIExpensesIDMetaParamsWithHTTPClient creates a new PatchAPIExpensesIDMetaParams object
// with the ability to set a custom HTTPClient for a request.
func NewPatchAPIExpensesIDMetaParamsWithHTTPClient(client *http.Client) *PatchAPIExpensesIDMetaParams {
return &PatchAPIExpensesIDMetaParams{
HTTPClient: client,
}
}
/*
PatchAPIExpensesIDMetaParams contains all the parameters to send to the API endpoint
for the patch API expenses ID meta operation.
Typically these are written to a http.Request.
*/
type PatchAPIExpensesIDMetaParams struct {
// Body.
Body PatchAPIExpensesIDMetaBody
/* ID.
Expense record ID to set the meta-field value for
*/
ID int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the patch API expenses ID meta params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PatchAPIExpensesIDMetaParams) WithDefaults() *PatchAPIExpensesIDMetaParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the patch API expenses ID meta params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PatchAPIExpensesIDMetaParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the patch API expenses ID meta params
func (o *PatchAPIExpensesIDMetaParams) WithTimeout(timeout time.Duration) *PatchAPIExpensesIDMetaParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the patch API expenses ID meta params
func (o *PatchAPIExpensesIDMetaParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the patch API expenses ID meta params
func (o *PatchAPIExpensesIDMetaParams) WithContext(ctx context.Context) *PatchAPIExpensesIDMetaParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the patch API expenses ID meta params
func (o *PatchAPIExpensesIDMetaParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the patch API expenses ID meta params
func (o *PatchAPIExpensesIDMetaParams) WithHTTPClient(client *http.Client) *PatchAPIExpensesIDMetaParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the patch API expenses ID meta params
func (o *PatchAPIExpensesIDMetaParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the patch API expenses ID meta params
func (o *PatchAPIExpensesIDMetaParams) WithBody(body PatchAPIExpensesIDMetaBody) *PatchAPIExpensesIDMetaParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the patch API expenses ID meta params
func (o *PatchAPIExpensesIDMetaParams) SetBody(body PatchAPIExpensesIDMetaBody) {
o.Body = body
}
// WithID adds the id to the patch API expenses ID meta params
func (o *PatchAPIExpensesIDMetaParams) WithID(id int64) *PatchAPIExpensesIDMetaParams {
o.SetID(id)
return o
}
// SetID adds the id to the patch API expenses ID meta params
func (o *PatchAPIExpensesIDMetaParams) SetID(id int64) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *PatchAPIExpensesIDMetaParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param id
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,176 @@
// Code generated by go-swagger; DO NOT EDIT.
package expense
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
"decentral1se/go-kimai/models"
)
// PatchAPIExpensesIDMetaReader is a Reader for the PatchAPIExpensesIDMeta structure.
type PatchAPIExpensesIDMetaReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PatchAPIExpensesIDMetaReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPatchAPIExpensesIDMetaOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewPatchAPIExpensesIDMetaOK creates a PatchAPIExpensesIDMetaOK with default headers values
func NewPatchAPIExpensesIDMetaOK() *PatchAPIExpensesIDMetaOK {
return &PatchAPIExpensesIDMetaOK{}
}
/*
PatchAPIExpensesIDMetaOK describes a response with status code 200, with default header values.
Sets the value of an existing/configured meta-field. You cannot create unknown meta-fields, if the given name is not a configured meta-field, this will return an exception.
*/
type PatchAPIExpensesIDMetaOK struct {
Payload *models.ExpenseEntity
}
// IsSuccess returns true when this patch Api expenses Id meta o k response has a 2xx status code
func (o *PatchAPIExpensesIDMetaOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this patch Api expenses Id meta o k response has a 3xx status code
func (o *PatchAPIExpensesIDMetaOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this patch Api expenses Id meta o k response has a 4xx status code
func (o *PatchAPIExpensesIDMetaOK) IsClientError() bool {
return false
}
// IsServerError returns true when this patch Api expenses Id meta o k response has a 5xx status code
func (o *PatchAPIExpensesIDMetaOK) IsServerError() bool {
return false
}
// IsCode returns true when this patch Api expenses Id meta o k response a status code equal to that given
func (o *PatchAPIExpensesIDMetaOK) IsCode(code int) bool {
return code == 200
}
func (o *PatchAPIExpensesIDMetaOK) Error() string {
return fmt.Sprintf("[PATCH /api/expenses/{id}/meta][%d] patchApiExpensesIdMetaOK %+v", 200, o.Payload)
}
func (o *PatchAPIExpensesIDMetaOK) String() string {
return fmt.Sprintf("[PATCH /api/expenses/{id}/meta][%d] patchApiExpensesIdMetaOK %+v", 200, o.Payload)
}
func (o *PatchAPIExpensesIDMetaOK) GetPayload() *models.ExpenseEntity {
return o.Payload
}
func (o *PatchAPIExpensesIDMetaOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ExpenseEntity)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
PatchAPIExpensesIDMetaBody patch API expenses ID meta body
swagger:model PatchAPIExpensesIDMetaBody
*/
type PatchAPIExpensesIDMetaBody struct {
// The meta-field name
// Required: true
Name *string `json:"name"`
// The meta-field value
// Required: true
Value *string `json:"value"`
}
// Validate validates this patch API expenses ID meta body
func (o *PatchAPIExpensesIDMetaBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateName(formats); err != nil {
res = append(res, err)
}
if err := o.validateValue(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *PatchAPIExpensesIDMetaBody) validateName(formats strfmt.Registry) error {
if err := validate.Required("body"+"."+"name", "body", o.Name); err != nil {
return err
}
return nil
}
func (o *PatchAPIExpensesIDMetaBody) validateValue(formats strfmt.Registry) error {
if err := validate.Required("body"+"."+"value", "body", o.Value); err != nil {
return err
}
return nil
}
// ContextValidate validates this patch API expenses ID meta body based on context it is used
func (o *PatchAPIExpensesIDMetaBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *PatchAPIExpensesIDMetaBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *PatchAPIExpensesIDMetaBody) UnmarshalBinary(b []byte) error {
var res PatchAPIExpensesIDMetaBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@ -0,0 +1,173 @@
// Code generated by go-swagger; DO NOT EDIT.
package expense
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"decentral1se/go-kimai/models"
)
// NewPatchAPIExpensesIDParams creates a new PatchAPIExpensesIDParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPatchAPIExpensesIDParams() *PatchAPIExpensesIDParams {
return &PatchAPIExpensesIDParams{
timeout: cr.DefaultTimeout,
}
}
// NewPatchAPIExpensesIDParamsWithTimeout creates a new PatchAPIExpensesIDParams object
// with the ability to set a timeout on a request.
func NewPatchAPIExpensesIDParamsWithTimeout(timeout time.Duration) *PatchAPIExpensesIDParams {
return &PatchAPIExpensesIDParams{
timeout: timeout,
}
}
// NewPatchAPIExpensesIDParamsWithContext creates a new PatchAPIExpensesIDParams object
// with the ability to set a context for a request.
func NewPatchAPIExpensesIDParamsWithContext(ctx context.Context) *PatchAPIExpensesIDParams {
return &PatchAPIExpensesIDParams{
Context: ctx,
}
}
// NewPatchAPIExpensesIDParamsWithHTTPClient creates a new PatchAPIExpensesIDParams object
// with the ability to set a custom HTTPClient for a request.
func NewPatchAPIExpensesIDParamsWithHTTPClient(client *http.Client) *PatchAPIExpensesIDParams {
return &PatchAPIExpensesIDParams{
HTTPClient: client,
}
}
/*
PatchAPIExpensesIDParams contains all the parameters to send to the API endpoint
for the patch API expenses ID operation.
Typically these are written to a http.Request.
*/
type PatchAPIExpensesIDParams struct {
// Body.
Body *models.ExpenseEditForm
/* ID.
Expense ID to update
*/
ID int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the patch API expenses ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PatchAPIExpensesIDParams) WithDefaults() *PatchAPIExpensesIDParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the patch API expenses ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PatchAPIExpensesIDParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the patch API expenses ID params
func (o *PatchAPIExpensesIDParams) WithTimeout(timeout time.Duration) *PatchAPIExpensesIDParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the patch API expenses ID params
func (o *PatchAPIExpensesIDParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the patch API expenses ID params
func (o *PatchAPIExpensesIDParams) WithContext(ctx context.Context) *PatchAPIExpensesIDParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the patch API expenses ID params
func (o *PatchAPIExpensesIDParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the patch API expenses ID params
func (o *PatchAPIExpensesIDParams) WithHTTPClient(client *http.Client) *PatchAPIExpensesIDParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the patch API expenses ID params
func (o *PatchAPIExpensesIDParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the patch API expenses ID params
func (o *PatchAPIExpensesIDParams) WithBody(body *models.ExpenseEditForm) *PatchAPIExpensesIDParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the patch API expenses ID params
func (o *PatchAPIExpensesIDParams) SetBody(body *models.ExpenseEditForm) {
o.Body = body
}
// WithID adds the id to the patch API expenses ID params
func (o *PatchAPIExpensesIDParams) WithID(id int64) *PatchAPIExpensesIDParams {
o.SetID(id)
return o
}
// SetID adds the id to the patch API expenses ID params
func (o *PatchAPIExpensesIDParams) SetID(id int64) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *PatchAPIExpensesIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Body != nil {
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
}
// path param id
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

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"
)
// PatchAPIExpensesIDReader is a Reader for the PatchAPIExpensesID structure.
type PatchAPIExpensesIDReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PatchAPIExpensesIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPatchAPIExpensesIDOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewPatchAPIExpensesIDOK creates a PatchAPIExpensesIDOK with default headers values
func NewPatchAPIExpensesIDOK() *PatchAPIExpensesIDOK {
return &PatchAPIExpensesIDOK{}
}
/*
PatchAPIExpensesIDOK describes a response with status code 200, with default header values.
Returns the updated expense
*/
type PatchAPIExpensesIDOK struct {
Payload *models.ExpenseEntity
}
// IsSuccess returns true when this patch Api expenses Id o k response has a 2xx status code
func (o *PatchAPIExpensesIDOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this patch Api expenses Id o k response has a 3xx status code
func (o *PatchAPIExpensesIDOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this patch Api expenses Id o k response has a 4xx status code
func (o *PatchAPIExpensesIDOK) IsClientError() bool {
return false
}
// IsServerError returns true when this patch Api expenses Id o k response has a 5xx status code
func (o *PatchAPIExpensesIDOK) IsServerError() bool {
return false
}
// IsCode returns true when this patch Api expenses Id o k response a status code equal to that given
func (o *PatchAPIExpensesIDOK) IsCode(code int) bool {
return code == 200
}
func (o *PatchAPIExpensesIDOK) Error() string {
return fmt.Sprintf("[PATCH /api/expenses/{id}][%d] patchApiExpensesIdOK %+v", 200, o.Payload)
}
func (o *PatchAPIExpensesIDOK) String() string {
return fmt.Sprintf("[PATCH /api/expenses/{id}][%d] patchApiExpensesIdOK %+v", 200, o.Payload)
}
func (o *PatchAPIExpensesIDOK) GetPayload() *models.ExpenseEntity {
return o.Payload
}
func (o *PatchAPIExpensesIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ExpenseEntity)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,150 @@
// Code generated by go-swagger; DO NOT EDIT.
package expense
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// NewPostAPIExpensesParams creates a new PostAPIExpensesParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostAPIExpensesParams() *PostAPIExpensesParams {
return &PostAPIExpensesParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostAPIExpensesParamsWithTimeout creates a new PostAPIExpensesParams object
// with the ability to set a timeout on a request.
func NewPostAPIExpensesParamsWithTimeout(timeout time.Duration) *PostAPIExpensesParams {
return &PostAPIExpensesParams{
timeout: timeout,
}
}
// NewPostAPIExpensesParamsWithContext creates a new PostAPIExpensesParams object
// with the ability to set a context for a request.
func NewPostAPIExpensesParamsWithContext(ctx context.Context) *PostAPIExpensesParams {
return &PostAPIExpensesParams{
Context: ctx,
}
}
// NewPostAPIExpensesParamsWithHTTPClient creates a new PostAPIExpensesParams object
// with the ability to set a custom HTTPClient for a request.
func NewPostAPIExpensesParamsWithHTTPClient(client *http.Client) *PostAPIExpensesParams {
return &PostAPIExpensesParams{
HTTPClient: client,
}
}
/*
PostAPIExpensesParams contains all the parameters to send to the API endpoint
for the post API expenses operation.
Typically these are written to a http.Request.
*/
type PostAPIExpensesParams struct {
// Body.
Body *models.ExpenseEditForm
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the post API expenses params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostAPIExpensesParams) WithDefaults() *PostAPIExpensesParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the post API expenses params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostAPIExpensesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post API expenses params
func (o *PostAPIExpensesParams) WithTimeout(timeout time.Duration) *PostAPIExpensesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post API expenses params
func (o *PostAPIExpensesParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the post API expenses params
func (o *PostAPIExpensesParams) WithContext(ctx context.Context) *PostAPIExpensesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post API expenses params
func (o *PostAPIExpensesParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post API expenses params
func (o *PostAPIExpensesParams) WithHTTPClient(client *http.Client) *PostAPIExpensesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post API expenses params
func (o *PostAPIExpensesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the post API expenses params
func (o *PostAPIExpensesParams) WithBody(body *models.ExpenseEditForm) *PostAPIExpensesParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the post API expenses params
func (o *PostAPIExpensesParams) SetBody(body *models.ExpenseEditForm) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *PostAPIExpensesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Body != nil {
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

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"
)
// PostAPIExpensesReader is a Reader for the PostAPIExpenses structure.
type PostAPIExpensesReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PostAPIExpensesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostAPIExpensesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewPostAPIExpensesOK creates a PostAPIExpensesOK with default headers values
func NewPostAPIExpensesOK() *PostAPIExpensesOK {
return &PostAPIExpensesOK{}
}
/*
PostAPIExpensesOK describes a response with status code 200, with default header values.
Returns the new created expense
*/
type PostAPIExpensesOK struct {
Payload *models.ExpenseEntity
}
// IsSuccess returns true when this post Api expenses o k response has a 2xx status code
func (o *PostAPIExpensesOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this post Api expenses o k response has a 3xx status code
func (o *PostAPIExpensesOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this post Api expenses o k response has a 4xx status code
func (o *PostAPIExpensesOK) IsClientError() bool {
return false
}
// IsServerError returns true when this post Api expenses o k response has a 5xx status code
func (o *PostAPIExpensesOK) IsServerError() bool {
return false
}
// IsCode returns true when this post Api expenses o k response a status code equal to that given
func (o *PostAPIExpensesOK) IsCode(code int) bool {
return code == 200
}
func (o *PostAPIExpensesOK) Error() string {
return fmt.Sprintf("[POST /api/expenses][%d] postApiExpensesOK %+v", 200, o.Payload)
}
func (o *PostAPIExpensesOK) String() string {
return fmt.Sprintf("[POST /api/expenses][%d] postApiExpensesOK %+v", 200, o.Payload)
}
func (o *PostAPIExpensesOK) GetPayload() *models.ExpenseEntity {
return o.Payload
}
func (o *PostAPIExpensesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ExpenseEntity)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

167
client/go_kimai_client.go Normal file
View File

@ -0,0 +1,167 @@
// Code generated by go-swagger; DO NOT EDIT.
package client
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/client/activity"
"decentral1se/go-kimai/client/customer"
"decentral1se/go-kimai/client/default_operations"
"decentral1se/go-kimai/client/expense"
"decentral1se/go-kimai/client/kiosk"
"decentral1se/go-kimai/client/meta_field"
"decentral1se/go-kimai/client/project"
"decentral1se/go-kimai/client/tag"
"decentral1se/go-kimai/client/task"
"decentral1se/go-kimai/client/team"
"decentral1se/go-kimai/client/timesheet"
"decentral1se/go-kimai/client/user"
)
// Default go kimai HTTP client.
var Default = NewHTTPClient(nil)
const (
// DefaultHost is the default Host
// found in Meta (info) section of spec file
DefaultHost string = "demo.kimai.org"
// DefaultBasePath is the default BasePath
// found in Meta (info) section of spec file
DefaultBasePath string = "/"
)
// DefaultSchemes are the default schemes found in Meta (info) section of spec file
var DefaultSchemes = []string{"http"}
// NewHTTPClient creates a new go kimai HTTP client.
func NewHTTPClient(formats strfmt.Registry) *GoKimai {
return NewHTTPClientWithConfig(formats, nil)
}
// NewHTTPClientWithConfig creates a new go kimai HTTP client,
// using a customizable transport config.
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *GoKimai {
// ensure nullable parameters have default
if cfg == nil {
cfg = DefaultTransportConfig()
}
// create transport and client
transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes)
return New(transport, formats)
}
// New creates a new go kimai client
func New(transport runtime.ClientTransport, formats strfmt.Registry) *GoKimai {
// ensure nullable parameters have default
if formats == nil {
formats = strfmt.Default
}
cli := new(GoKimai)
cli.Transport = transport
cli.Activity = activity.New(transport, formats)
cli.Customer = customer.New(transport, formats)
cli.DefaultOperations = default_operations.New(transport, formats)
cli.Expense = expense.New(transport, formats)
cli.Kiosk = kiosk.New(transport, formats)
cli.MetaField = meta_field.New(transport, formats)
cli.Project = project.New(transport, formats)
cli.Tag = tag.New(transport, formats)
cli.Task = task.New(transport, formats)
cli.Team = team.New(transport, formats)
cli.Timesheet = timesheet.New(transport, formats)
cli.User = user.New(transport, formats)
return cli
}
// DefaultTransportConfig creates a TransportConfig with the
// default settings taken from the meta section of the spec file.
func DefaultTransportConfig() *TransportConfig {
return &TransportConfig{
Host: DefaultHost,
BasePath: DefaultBasePath,
Schemes: DefaultSchemes,
}
}
// TransportConfig contains the transport related info,
// found in the meta section of the spec file.
type TransportConfig struct {
Host string
BasePath string
Schemes []string
}
// WithHost overrides the default host,
// provided by the meta section of the spec file.
func (cfg *TransportConfig) WithHost(host string) *TransportConfig {
cfg.Host = host
return cfg
}
// WithBasePath overrides the default basePath,
// provided by the meta section of the spec file.
func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig {
cfg.BasePath = basePath
return cfg
}
// WithSchemes overrides the default schemes,
// provided by the meta section of the spec file.
func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig {
cfg.Schemes = schemes
return cfg
}
// GoKimai is a client for go kimai
type GoKimai struct {
Activity activity.ClientService
Customer customer.ClientService
DefaultOperations default_operations.ClientService
Expense expense.ClientService
Kiosk kiosk.ClientService
MetaField meta_field.ClientService
Project project.ClientService
Tag tag.ClientService
Task task.ClientService
Team team.ClientService
Timesheet timesheet.ClientService
User user.ClientService
Transport runtime.ClientTransport
}
// SetTransport changes the transport on the client and all its subresources
func (c *GoKimai) SetTransport(transport runtime.ClientTransport) {
c.Transport = transport
c.Activity.SetTransport(transport)
c.Customer.SetTransport(transport)
c.DefaultOperations.SetTransport(transport)
c.Expense.SetTransport(transport)
c.Kiosk.SetTransport(transport)
c.MetaField.SetTransport(transport)
c.Project.SetTransport(transport)
c.Tag.SetTransport(transport)
c.Task.SetTransport(transport)
c.Team.SetTransport(transport)
c.Timesheet.SetTransport(transport)
c.User.SetTransport(transport)
}

View File

@ -0,0 +1,152 @@
// Code generated by go-swagger; DO NOT EDIT.
package kiosk
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewGetAPIKiosksIDParams creates a new GetAPIKiosksIDParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAPIKiosksIDParams() *GetAPIKiosksIDParams {
return &GetAPIKiosksIDParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPIKiosksIDParamsWithTimeout creates a new GetAPIKiosksIDParams object
// with the ability to set a timeout on a request.
func NewGetAPIKiosksIDParamsWithTimeout(timeout time.Duration) *GetAPIKiosksIDParams {
return &GetAPIKiosksIDParams{
timeout: timeout,
}
}
// NewGetAPIKiosksIDParamsWithContext creates a new GetAPIKiosksIDParams object
// with the ability to set a context for a request.
func NewGetAPIKiosksIDParamsWithContext(ctx context.Context) *GetAPIKiosksIDParams {
return &GetAPIKiosksIDParams{
Context: ctx,
}
}
// NewGetAPIKiosksIDParamsWithHTTPClient creates a new GetAPIKiosksIDParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPIKiosksIDParamsWithHTTPClient(client *http.Client) *GetAPIKiosksIDParams {
return &GetAPIKiosksIDParams{
HTTPClient: client,
}
}
/*
GetAPIKiosksIDParams contains all the parameters to send to the API endpoint
for the get API kiosks ID operation.
Typically these are written to a http.Request.
*/
type GetAPIKiosksIDParams struct {
/* ID.
User ID to fetch
*/
ID int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API kiosks ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIKiosksIDParams) WithDefaults() *GetAPIKiosksIDParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API kiosks ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIKiosksIDParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) WithTimeout(timeout time.Duration) *GetAPIKiosksIDParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) WithContext(ctx context.Context) *GetAPIKiosksIDParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) WithHTTPClient(client *http.Client) *GetAPIKiosksIDParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) WithID(id int64) *GetAPIKiosksIDParams {
o.SetID(id)
return o
}
// SetID adds the id to the get API kiosks ID params
func (o *GetAPIKiosksIDParams) SetID(id int64) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPIKiosksIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param id
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,98 @@
// Code generated by go-swagger; DO NOT EDIT.
package kiosk
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// GetAPIKiosksIDReader is a Reader for the GetAPIKiosksID structure.
type GetAPIKiosksIDReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAPIKiosksIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAPIKiosksIDOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetAPIKiosksIDOK creates a GetAPIKiosksIDOK with default headers values
func NewGetAPIKiosksIDOK() *GetAPIKiosksIDOK {
return &GetAPIKiosksIDOK{}
}
/*
GetAPIKiosksIDOK describes a response with status code 200, with default header values.
Returns one UserAuthCodes entity
*/
type GetAPIKiosksIDOK struct {
Payload *models.UserAuthCodes
}
// IsSuccess returns true when this get Api kiosks Id o k response has a 2xx status code
func (o *GetAPIKiosksIDOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get Api kiosks Id o k response has a 3xx status code
func (o *GetAPIKiosksIDOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get Api kiosks Id o k response has a 4xx status code
func (o *GetAPIKiosksIDOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get Api kiosks Id o k response has a 5xx status code
func (o *GetAPIKiosksIDOK) IsServerError() bool {
return false
}
// IsCode returns true when this get Api kiosks Id o k response a status code equal to that given
func (o *GetAPIKiosksIDOK) IsCode(code int) bool {
return code == 200
}
func (o *GetAPIKiosksIDOK) Error() string {
return fmt.Sprintf("[GET /api/kiosks/{id}][%d] getApiKiosksIdOK %+v", 200, o.Payload)
}
func (o *GetAPIKiosksIDOK) String() string {
return fmt.Sprintf("[GET /api/kiosks/{id}][%d] getApiKiosksIdOK %+v", 200, o.Payload)
}
func (o *GetAPIKiosksIDOK) GetPayload() *models.UserAuthCodes {
return o.Payload
}
func (o *GetAPIKiosksIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.UserAuthCodes)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,229 @@
// Code generated by go-swagger; DO NOT EDIT.
package kiosk
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewGetAPIKiosksParams creates a new GetAPIKiosksParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAPIKiosksParams() *GetAPIKiosksParams {
return &GetAPIKiosksParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPIKiosksParamsWithTimeout creates a new GetAPIKiosksParams object
// with the ability to set a timeout on a request.
func NewGetAPIKiosksParamsWithTimeout(timeout time.Duration) *GetAPIKiosksParams {
return &GetAPIKiosksParams{
timeout: timeout,
}
}
// NewGetAPIKiosksParamsWithContext creates a new GetAPIKiosksParams object
// with the ability to set a context for a request.
func NewGetAPIKiosksParamsWithContext(ctx context.Context) *GetAPIKiosksParams {
return &GetAPIKiosksParams{
Context: ctx,
}
}
// NewGetAPIKiosksParamsWithHTTPClient creates a new GetAPIKiosksParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPIKiosksParamsWithHTTPClient(client *http.Client) *GetAPIKiosksParams {
return &GetAPIKiosksParams{
HTTPClient: client,
}
}
/*
GetAPIKiosksParams contains all the parameters to send to the API endpoint
for the get API kiosks operation.
Typically these are written to a http.Request.
*/
type GetAPIKiosksParams struct {
/* Order.
The result order. Allowed values: ASC, DESC (default: DESC)
*/
Order string
/* OrderBy.
The field by which results will be ordered. Allowed values: id, user, type, code (default: id)
*/
OrderBy string
/* Page.
The page to display, renders a 404 if not found (default: 1)
*/
Page string
/* Size.
The amount of entries for each page (default: 50)
*/
Size string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API kiosks params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIKiosksParams) WithDefaults() *GetAPIKiosksParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API kiosks params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIKiosksParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API kiosks params
func (o *GetAPIKiosksParams) WithTimeout(timeout time.Duration) *GetAPIKiosksParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API kiosks params
func (o *GetAPIKiosksParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API kiosks params
func (o *GetAPIKiosksParams) WithContext(ctx context.Context) *GetAPIKiosksParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API kiosks params
func (o *GetAPIKiosksParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API kiosks params
func (o *GetAPIKiosksParams) WithHTTPClient(client *http.Client) *GetAPIKiosksParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API kiosks params
func (o *GetAPIKiosksParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithOrder adds the order to the get API kiosks params
func (o *GetAPIKiosksParams) WithOrder(order string) *GetAPIKiosksParams {
o.SetOrder(order)
return o
}
// SetOrder adds the order to the get API kiosks params
func (o *GetAPIKiosksParams) SetOrder(order string) {
o.Order = order
}
// WithOrderBy adds the orderBy to the get API kiosks params
func (o *GetAPIKiosksParams) WithOrderBy(orderBy string) *GetAPIKiosksParams {
o.SetOrderBy(orderBy)
return o
}
// SetOrderBy adds the orderBy to the get API kiosks params
func (o *GetAPIKiosksParams) SetOrderBy(orderBy string) {
o.OrderBy = orderBy
}
// WithPage adds the page to the get API kiosks params
func (o *GetAPIKiosksParams) WithPage(page string) *GetAPIKiosksParams {
o.SetPage(page)
return o
}
// SetPage adds the page to the get API kiosks params
func (o *GetAPIKiosksParams) SetPage(page string) {
o.Page = page
}
// WithSize adds the size to the get API kiosks params
func (o *GetAPIKiosksParams) WithSize(size string) *GetAPIKiosksParams {
o.SetSize(size)
return o
}
// SetSize adds the size to the get API kiosks params
func (o *GetAPIKiosksParams) SetSize(size string) {
o.Size = size
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPIKiosksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// query param order
qrOrder := o.Order
qOrder := qrOrder
if err := r.SetQueryParam("order", qOrder); err != nil {
return err
}
// query param orderBy
qrOrderBy := o.OrderBy
qOrderBy := qrOrderBy
if err := r.SetQueryParam("orderBy", qOrderBy); err != nil {
return err
}
// query param page
qrPage := o.Page
qPage := qrPage
if err := r.SetQueryParam("page", qPage); err != nil {
return err
}
// query param size
qrSize := o.Size
qSize := qrSize
if err := r.SetQueryParam("size", qSize); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,96 @@
// Code generated by go-swagger; DO NOT EDIT.
package kiosk
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// GetAPIKiosksReader is a Reader for the GetAPIKiosks structure.
type GetAPIKiosksReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAPIKiosksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAPIKiosksOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetAPIKiosksOK creates a GetAPIKiosksOK with default headers values
func NewGetAPIKiosksOK() *GetAPIKiosksOK {
return &GetAPIKiosksOK{}
}
/*
GetAPIKiosksOK describes a response with status code 200, with default header values.
Returns a collection of UserAuthCodes
*/
type GetAPIKiosksOK struct {
Payload []*models.UserAuthCodes
}
// IsSuccess returns true when this get Api kiosks o k response has a 2xx status code
func (o *GetAPIKiosksOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get Api kiosks o k response has a 3xx status code
func (o *GetAPIKiosksOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get Api kiosks o k response has a 4xx status code
func (o *GetAPIKiosksOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get Api kiosks o k response has a 5xx status code
func (o *GetAPIKiosksOK) IsServerError() bool {
return false
}
// IsCode returns true when this get Api kiosks o k response a status code equal to that given
func (o *GetAPIKiosksOK) IsCode(code int) bool {
return code == 200
}
func (o *GetAPIKiosksOK) Error() string {
return fmt.Sprintf("[GET /api/kiosks][%d] getApiKiosksOK %+v", 200, o.Payload)
}
func (o *GetAPIKiosksOK) String() string {
return fmt.Sprintf("[GET /api/kiosks][%d] getApiKiosksOK %+v", 200, o.Payload)
}
func (o *GetAPIKiosksOK) GetPayload() []*models.UserAuthCodes {
return o.Payload
}
func (o *GetAPIKiosksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,123 @@
// Code generated by go-swagger; DO NOT EDIT.
package kiosk
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new kiosk API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for kiosk API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods
type ClientService interface {
GetAPIKiosks(params *GetAPIKiosksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIKiosksOK, error)
GetAPIKiosksID(params *GetAPIKiosksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIKiosksIDOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
GetAPIKiosks returns a collection of user auth codes objects
*/
func (a *Client) GetAPIKiosks(params *GetAPIKiosksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIKiosksOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIKiosksParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIKiosks",
Method: "GET",
PathPattern: "/api/kiosks",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIKiosksReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*GetAPIKiosksOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for GetAPIKiosks: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIKiosksID returns one user auth codes entity
Creates the code for the configured default type (if not yet existing).
*/
func (a *Client) GetAPIKiosksID(params *GetAPIKiosksIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIKiosksIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIKiosksIDParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIKiosksID",
Method: "GET",
PathPattern: "/api/kiosks/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIKiosksIDReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*GetAPIKiosksIDOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for GetAPIKiosksID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@ -0,0 +1,156 @@
// Code generated by go-swagger; DO NOT EDIT.
package meta_field
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewGetAPIMetafieldsParams creates a new GetAPIMetafieldsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAPIMetafieldsParams() *GetAPIMetafieldsParams {
return &GetAPIMetafieldsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPIMetafieldsParamsWithTimeout creates a new GetAPIMetafieldsParams object
// with the ability to set a timeout on a request.
func NewGetAPIMetafieldsParamsWithTimeout(timeout time.Duration) *GetAPIMetafieldsParams {
return &GetAPIMetafieldsParams{
timeout: timeout,
}
}
// NewGetAPIMetafieldsParamsWithContext creates a new GetAPIMetafieldsParams object
// with the ability to set a context for a request.
func NewGetAPIMetafieldsParamsWithContext(ctx context.Context) *GetAPIMetafieldsParams {
return &GetAPIMetafieldsParams{
Context: ctx,
}
}
// NewGetAPIMetafieldsParamsWithHTTPClient creates a new GetAPIMetafieldsParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPIMetafieldsParamsWithHTTPClient(client *http.Client) *GetAPIMetafieldsParams {
return &GetAPIMetafieldsParams{
HTTPClient: client,
}
}
/*
GetAPIMetafieldsParams contains all the parameters to send to the API endpoint
for the get API metafields operation.
Typically these are written to a http.Request.
*/
type GetAPIMetafieldsParams struct {
/* Entity.
The type of object to fetch meta-fields for. Allowed values: timesheet, customer, project, activity, user, expense - returns all if not given (default: all)
Format: MetaFieldExternalType
*/
Entity string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API metafields params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIMetafieldsParams) WithDefaults() *GetAPIMetafieldsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API metafields params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIMetafieldsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API metafields params
func (o *GetAPIMetafieldsParams) WithTimeout(timeout time.Duration) *GetAPIMetafieldsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API metafields params
func (o *GetAPIMetafieldsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API metafields params
func (o *GetAPIMetafieldsParams) WithContext(ctx context.Context) *GetAPIMetafieldsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API metafields params
func (o *GetAPIMetafieldsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API metafields params
func (o *GetAPIMetafieldsParams) WithHTTPClient(client *http.Client) *GetAPIMetafieldsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API metafields params
func (o *GetAPIMetafieldsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithEntity adds the entity to the get API metafields params
func (o *GetAPIMetafieldsParams) WithEntity(entity string) *GetAPIMetafieldsParams {
o.SetEntity(entity)
return o
}
// SetEntity adds the entity to the get API metafields params
func (o *GetAPIMetafieldsParams) SetEntity(entity string) {
o.Entity = entity
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPIMetafieldsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// query param entity
qrEntity := o.Entity
qEntity := qrEntity
if err := r.SetQueryParam("entity", qEntity); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,96 @@
// Code generated by go-swagger; DO NOT EDIT.
package meta_field
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// GetAPIMetafieldsReader is a Reader for the GetAPIMetafields structure.
type GetAPIMetafieldsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAPIMetafieldsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAPIMetafieldsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetAPIMetafieldsOK creates a GetAPIMetafieldsOK with default headers values
func NewGetAPIMetafieldsOK() *GetAPIMetafieldsOK {
return &GetAPIMetafieldsOK{}
}
/*
GetAPIMetafieldsOK describes a response with status code 200, with default header values.
Returns a collection of meta-fields
*/
type GetAPIMetafieldsOK struct {
Payload []*models.MetaFieldRule
}
// IsSuccess returns true when this get Api metafields o k response has a 2xx status code
func (o *GetAPIMetafieldsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get Api metafields o k response has a 3xx status code
func (o *GetAPIMetafieldsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get Api metafields o k response has a 4xx status code
func (o *GetAPIMetafieldsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get Api metafields o k response has a 5xx status code
func (o *GetAPIMetafieldsOK) IsServerError() bool {
return false
}
// IsCode returns true when this get Api metafields o k response a status code equal to that given
func (o *GetAPIMetafieldsOK) IsCode(code int) bool {
return code == 200
}
func (o *GetAPIMetafieldsOK) Error() string {
return fmt.Sprintf("[GET /api/metafields][%d] getApiMetafieldsOK %+v", 200, o.Payload)
}
func (o *GetAPIMetafieldsOK) String() string {
return fmt.Sprintf("[GET /api/metafields][%d] getApiMetafieldsOK %+v", 200, o.Payload)
}
func (o *GetAPIMetafieldsOK) GetPayload() []*models.MetaFieldRule {
return o.Payload
}
func (o *GetAPIMetafieldsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,80 @@
// Code generated by go-swagger; DO NOT EDIT.
package meta_field
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new meta field API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for meta field API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods
type ClientService interface {
GetAPIMetafields(params *GetAPIMetafieldsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIMetafieldsOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
GetAPIMetafields returns a collection of meta fields
*/
func (a *Client) GetAPIMetafields(params *GetAPIMetafieldsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIMetafieldsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIMetafieldsParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIMetafields",
Method: "GET",
PathPattern: "/api/metafields",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIMetafieldsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*GetAPIMetafieldsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for GetAPIMetafields: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@ -0,0 +1,174 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewDeleteAPIProjectsIDRatesRateIDParams creates a new DeleteAPIProjectsIDRatesRateIDParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDeleteAPIProjectsIDRatesRateIDParams() *DeleteAPIProjectsIDRatesRateIDParams {
return &DeleteAPIProjectsIDRatesRateIDParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteAPIProjectsIDRatesRateIDParamsWithTimeout creates a new DeleteAPIProjectsIDRatesRateIDParams object
// with the ability to set a timeout on a request.
func NewDeleteAPIProjectsIDRatesRateIDParamsWithTimeout(timeout time.Duration) *DeleteAPIProjectsIDRatesRateIDParams {
return &DeleteAPIProjectsIDRatesRateIDParams{
timeout: timeout,
}
}
// NewDeleteAPIProjectsIDRatesRateIDParamsWithContext creates a new DeleteAPIProjectsIDRatesRateIDParams object
// with the ability to set a context for a request.
func NewDeleteAPIProjectsIDRatesRateIDParamsWithContext(ctx context.Context) *DeleteAPIProjectsIDRatesRateIDParams {
return &DeleteAPIProjectsIDRatesRateIDParams{
Context: ctx,
}
}
// NewDeleteAPIProjectsIDRatesRateIDParamsWithHTTPClient creates a new DeleteAPIProjectsIDRatesRateIDParams object
// with the ability to set a custom HTTPClient for a request.
func NewDeleteAPIProjectsIDRatesRateIDParamsWithHTTPClient(client *http.Client) *DeleteAPIProjectsIDRatesRateIDParams {
return &DeleteAPIProjectsIDRatesRateIDParams{
HTTPClient: client,
}
}
/*
DeleteAPIProjectsIDRatesRateIDParams contains all the parameters to send to the API endpoint
for the delete API projects ID rates rate ID operation.
Typically these are written to a http.Request.
*/
type DeleteAPIProjectsIDRatesRateIDParams struct {
/* ID.
The project whose rate will be removed
*/
ID int64
/* RateID.
The rate to remove
*/
RateID int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the delete API projects ID rates rate ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteAPIProjectsIDRatesRateIDParams) WithDefaults() *DeleteAPIProjectsIDRatesRateIDParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the delete API projects ID rates rate ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteAPIProjectsIDRatesRateIDParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the delete API projects ID rates rate ID params
func (o *DeleteAPIProjectsIDRatesRateIDParams) WithTimeout(timeout time.Duration) *DeleteAPIProjectsIDRatesRateIDParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete API projects ID rates rate ID params
func (o *DeleteAPIProjectsIDRatesRateIDParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete API projects ID rates rate ID params
func (o *DeleteAPIProjectsIDRatesRateIDParams) WithContext(ctx context.Context) *DeleteAPIProjectsIDRatesRateIDParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete API projects ID rates rate ID params
func (o *DeleteAPIProjectsIDRatesRateIDParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete API projects ID rates rate ID params
func (o *DeleteAPIProjectsIDRatesRateIDParams) WithHTTPClient(client *http.Client) *DeleteAPIProjectsIDRatesRateIDParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete API projects ID rates rate ID params
func (o *DeleteAPIProjectsIDRatesRateIDParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the delete API projects ID rates rate ID params
func (o *DeleteAPIProjectsIDRatesRateIDParams) WithID(id int64) *DeleteAPIProjectsIDRatesRateIDParams {
o.SetID(id)
return o
}
// SetID adds the id to the delete API projects ID rates rate ID params
func (o *DeleteAPIProjectsIDRatesRateIDParams) SetID(id int64) {
o.ID = id
}
// WithRateID adds the rateID to the delete API projects ID rates rate ID params
func (o *DeleteAPIProjectsIDRatesRateIDParams) WithRateID(rateID int64) *DeleteAPIProjectsIDRatesRateIDParams {
o.SetRateID(rateID)
return o
}
// SetRateID adds the rateId to the delete API projects ID rates rate ID params
func (o *DeleteAPIProjectsIDRatesRateIDParams) SetRateID(rateID int64) {
o.RateID = rateID
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteAPIProjectsIDRatesRateIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param id
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
return err
}
// path param rateId
if err := r.SetPathParam("rateId", swag.FormatInt64(o.RateID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,83 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// DeleteAPIProjectsIDRatesRateIDReader is a Reader for the DeleteAPIProjectsIDRatesRateID structure.
type DeleteAPIProjectsIDRatesRateIDReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteAPIProjectsIDRatesRateIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewDeleteAPIProjectsIDRatesRateIDNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewDeleteAPIProjectsIDRatesRateIDNoContent creates a DeleteAPIProjectsIDRatesRateIDNoContent with default headers values
func NewDeleteAPIProjectsIDRatesRateIDNoContent() *DeleteAPIProjectsIDRatesRateIDNoContent {
return &DeleteAPIProjectsIDRatesRateIDNoContent{}
}
/*
DeleteAPIProjectsIDRatesRateIDNoContent describes a response with status code 204, with default header values.
Returns no content: 204 on successful delete
*/
type DeleteAPIProjectsIDRatesRateIDNoContent struct {
}
// IsSuccess returns true when this delete Api projects Id rates rate Id no content response has a 2xx status code
func (o *DeleteAPIProjectsIDRatesRateIDNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this delete Api projects Id rates rate Id no content response has a 3xx status code
func (o *DeleteAPIProjectsIDRatesRateIDNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete Api projects Id rates rate Id no content response has a 4xx status code
func (o *DeleteAPIProjectsIDRatesRateIDNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this delete Api projects Id rates rate Id no content response has a 5xx status code
func (o *DeleteAPIProjectsIDRatesRateIDNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this delete Api projects Id rates rate Id no content response a status code equal to that given
func (o *DeleteAPIProjectsIDRatesRateIDNoContent) IsCode(code int) bool {
return code == 204
}
func (o *DeleteAPIProjectsIDRatesRateIDNoContent) Error() string {
return fmt.Sprintf("[DELETE /api/projects/{id}/rates/{rateId}][%d] deleteApiProjectsIdRatesRateIdNoContent ", 204)
}
func (o *DeleteAPIProjectsIDRatesRateIDNoContent) String() string {
return fmt.Sprintf("[DELETE /api/projects/{id}/rates/{rateId}][%d] deleteApiProjectsIdRatesRateIdNoContent ", 204)
}
func (o *DeleteAPIProjectsIDRatesRateIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@ -0,0 +1,148 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewGetAPIProjectsIDParams creates a new GetAPIProjectsIDParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAPIProjectsIDParams() *GetAPIProjectsIDParams {
return &GetAPIProjectsIDParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPIProjectsIDParamsWithTimeout creates a new GetAPIProjectsIDParams object
// with the ability to set a timeout on a request.
func NewGetAPIProjectsIDParamsWithTimeout(timeout time.Duration) *GetAPIProjectsIDParams {
return &GetAPIProjectsIDParams{
timeout: timeout,
}
}
// NewGetAPIProjectsIDParamsWithContext creates a new GetAPIProjectsIDParams object
// with the ability to set a context for a request.
func NewGetAPIProjectsIDParamsWithContext(ctx context.Context) *GetAPIProjectsIDParams {
return &GetAPIProjectsIDParams{
Context: ctx,
}
}
// NewGetAPIProjectsIDParamsWithHTTPClient creates a new GetAPIProjectsIDParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPIProjectsIDParamsWithHTTPClient(client *http.Client) *GetAPIProjectsIDParams {
return &GetAPIProjectsIDParams{
HTTPClient: client,
}
}
/*
GetAPIProjectsIDParams contains all the parameters to send to the API endpoint
for the get API projects ID operation.
Typically these are written to a http.Request.
*/
type GetAPIProjectsIDParams struct {
// ID.
ID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API projects ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIProjectsIDParams) WithDefaults() *GetAPIProjectsIDParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API projects ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIProjectsIDParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API projects ID params
func (o *GetAPIProjectsIDParams) WithTimeout(timeout time.Duration) *GetAPIProjectsIDParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API projects ID params
func (o *GetAPIProjectsIDParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API projects ID params
func (o *GetAPIProjectsIDParams) WithContext(ctx context.Context) *GetAPIProjectsIDParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API projects ID params
func (o *GetAPIProjectsIDParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API projects ID params
func (o *GetAPIProjectsIDParams) WithHTTPClient(client *http.Client) *GetAPIProjectsIDParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API projects ID params
func (o *GetAPIProjectsIDParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the get API projects ID params
func (o *GetAPIProjectsIDParams) WithID(id string) *GetAPIProjectsIDParams {
o.SetID(id)
return o
}
// SetID adds the id to the get API projects ID params
func (o *GetAPIProjectsIDParams) SetID(id string) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPIProjectsIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,152 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewGetAPIProjectsIDRatesParams creates a new GetAPIProjectsIDRatesParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAPIProjectsIDRatesParams() *GetAPIProjectsIDRatesParams {
return &GetAPIProjectsIDRatesParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPIProjectsIDRatesParamsWithTimeout creates a new GetAPIProjectsIDRatesParams object
// with the ability to set a timeout on a request.
func NewGetAPIProjectsIDRatesParamsWithTimeout(timeout time.Duration) *GetAPIProjectsIDRatesParams {
return &GetAPIProjectsIDRatesParams{
timeout: timeout,
}
}
// NewGetAPIProjectsIDRatesParamsWithContext creates a new GetAPIProjectsIDRatesParams object
// with the ability to set a context for a request.
func NewGetAPIProjectsIDRatesParamsWithContext(ctx context.Context) *GetAPIProjectsIDRatesParams {
return &GetAPIProjectsIDRatesParams{
Context: ctx,
}
}
// NewGetAPIProjectsIDRatesParamsWithHTTPClient creates a new GetAPIProjectsIDRatesParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPIProjectsIDRatesParamsWithHTTPClient(client *http.Client) *GetAPIProjectsIDRatesParams {
return &GetAPIProjectsIDRatesParams{
HTTPClient: client,
}
}
/*
GetAPIProjectsIDRatesParams contains all the parameters to send to the API endpoint
for the get API projects ID rates operation.
Typically these are written to a http.Request.
*/
type GetAPIProjectsIDRatesParams struct {
/* ID.
The project whose rates will be returned
*/
ID int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API projects ID rates params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIProjectsIDRatesParams) WithDefaults() *GetAPIProjectsIDRatesParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API projects ID rates params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIProjectsIDRatesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API projects ID rates params
func (o *GetAPIProjectsIDRatesParams) WithTimeout(timeout time.Duration) *GetAPIProjectsIDRatesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API projects ID rates params
func (o *GetAPIProjectsIDRatesParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API projects ID rates params
func (o *GetAPIProjectsIDRatesParams) WithContext(ctx context.Context) *GetAPIProjectsIDRatesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API projects ID rates params
func (o *GetAPIProjectsIDRatesParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API projects ID rates params
func (o *GetAPIProjectsIDRatesParams) WithHTTPClient(client *http.Client) *GetAPIProjectsIDRatesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API projects ID rates params
func (o *GetAPIProjectsIDRatesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the get API projects ID rates params
func (o *GetAPIProjectsIDRatesParams) WithID(id int64) *GetAPIProjectsIDRatesParams {
o.SetID(id)
return o
}
// SetID adds the id to the get API projects ID rates params
func (o *GetAPIProjectsIDRatesParams) SetID(id int64) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPIProjectsIDRatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param id
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,96 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// GetAPIProjectsIDRatesReader is a Reader for the GetAPIProjectsIDRates structure.
type GetAPIProjectsIDRatesReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAPIProjectsIDRatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAPIProjectsIDRatesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetAPIProjectsIDRatesOK creates a GetAPIProjectsIDRatesOK with default headers values
func NewGetAPIProjectsIDRatesOK() *GetAPIProjectsIDRatesOK {
return &GetAPIProjectsIDRatesOK{}
}
/*
GetAPIProjectsIDRatesOK describes a response with status code 200, with default header values.
Returns a collection of project rate entities
*/
type GetAPIProjectsIDRatesOK struct {
Payload []*models.ProjectRate
}
// IsSuccess returns true when this get Api projects Id rates o k response has a 2xx status code
func (o *GetAPIProjectsIDRatesOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get Api projects Id rates o k response has a 3xx status code
func (o *GetAPIProjectsIDRatesOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get Api projects Id rates o k response has a 4xx status code
func (o *GetAPIProjectsIDRatesOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get Api projects Id rates o k response has a 5xx status code
func (o *GetAPIProjectsIDRatesOK) IsServerError() bool {
return false
}
// IsCode returns true when this get Api projects Id rates o k response a status code equal to that given
func (o *GetAPIProjectsIDRatesOK) IsCode(code int) bool {
return code == 200
}
func (o *GetAPIProjectsIDRatesOK) Error() string {
return fmt.Sprintf("[GET /api/projects/{id}/rates][%d] getApiProjectsIdRatesOK %+v", 200, o.Payload)
}
func (o *GetAPIProjectsIDRatesOK) String() string {
return fmt.Sprintf("[GET /api/projects/{id}/rates][%d] getApiProjectsIdRatesOK %+v", 200, o.Payload)
}
func (o *GetAPIProjectsIDRatesOK) GetPayload() []*models.ProjectRate {
return o.Payload
}
func (o *GetAPIProjectsIDRatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,98 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// GetAPIProjectsIDReader is a Reader for the GetAPIProjectsID structure.
type GetAPIProjectsIDReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAPIProjectsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAPIProjectsIDOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetAPIProjectsIDOK creates a GetAPIProjectsIDOK with default headers values
func NewGetAPIProjectsIDOK() *GetAPIProjectsIDOK {
return &GetAPIProjectsIDOK{}
}
/*
GetAPIProjectsIDOK describes a response with status code 200, with default header values.
Returns one project entity
*/
type GetAPIProjectsIDOK struct {
Payload *models.ProjectEntity
}
// IsSuccess returns true when this get Api projects Id o k response has a 2xx status code
func (o *GetAPIProjectsIDOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get Api projects Id o k response has a 3xx status code
func (o *GetAPIProjectsIDOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get Api projects Id o k response has a 4xx status code
func (o *GetAPIProjectsIDOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get Api projects Id o k response has a 5xx status code
func (o *GetAPIProjectsIDOK) IsServerError() bool {
return false
}
// IsCode returns true when this get Api projects Id o k response a status code equal to that given
func (o *GetAPIProjectsIDOK) IsCode(code int) bool {
return code == 200
}
func (o *GetAPIProjectsIDOK) Error() string {
return fmt.Sprintf("[GET /api/projects/{id}][%d] getApiProjectsIdOK %+v", 200, o.Payload)
}
func (o *GetAPIProjectsIDOK) String() string {
return fmt.Sprintf("[GET /api/projects/{id}][%d] getApiProjectsIdOK %+v", 200, o.Payload)
}
func (o *GetAPIProjectsIDOK) GetPayload() *models.ProjectEntity {
return o.Payload
}
func (o *GetAPIProjectsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ProjectEntity)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,392 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewGetAPIProjectsParams creates a new GetAPIProjectsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAPIProjectsParams() *GetAPIProjectsParams {
return &GetAPIProjectsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPIProjectsParamsWithTimeout creates a new GetAPIProjectsParams object
// with the ability to set a timeout on a request.
func NewGetAPIProjectsParamsWithTimeout(timeout time.Duration) *GetAPIProjectsParams {
return &GetAPIProjectsParams{
timeout: timeout,
}
}
// NewGetAPIProjectsParamsWithContext creates a new GetAPIProjectsParams object
// with the ability to set a context for a request.
func NewGetAPIProjectsParamsWithContext(ctx context.Context) *GetAPIProjectsParams {
return &GetAPIProjectsParams{
Context: ctx,
}
}
// NewGetAPIProjectsParamsWithHTTPClient creates a new GetAPIProjectsParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPIProjectsParamsWithHTTPClient(client *http.Client) *GetAPIProjectsParams {
return &GetAPIProjectsParams{
HTTPClient: client,
}
}
/*
GetAPIProjectsParams contains all the parameters to send to the API endpoint
for the get API projects operation.
Typically these are written to a http.Request.
*/
type GetAPIProjectsParams struct {
/* Customer.
Customer ID to filter projects
*/
Customer string
/* Customers.
Comma separated list of customer IDs to filter projects
*/
Customers string
/* End.
Only projects that ended after this date will be included. Allowed format: HTML5 (default: now, if start is also empty)
Format: DateTime
*/
End string
/* GlobalActivities.
If given, filters projects by their 'global activity' support. Allowed values: 1 (supports global activities) and 0 (without global activities) (default: all)
*/
GlobalActivities string
/* IgnoreDates.
If set, start and end are completely ignored. Allowed values: 1 (default: off)
*/
IgnoreDates string
/* Order.
The result order. Allowed values: ASC, DESC (default: ASC)
*/
Order string
/* OrderBy.
The field by which results will be ordered. Allowed values: id, name, customer (default: name)
*/
OrderBy string
/* Start.
Only projects that started before this date will be included. Allowed format: HTML5 (default: now, if end is also empty)
Format: DateTime
*/
Start string
/* Term.
Free search term
*/
Term *string
/* Visible.
Visibility status to filter projects. Allowed values: 1=visible, 2=hidden, 3=both (default: 1)
*/
Visible string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API projects params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIProjectsParams) WithDefaults() *GetAPIProjectsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API projects params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPIProjectsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API projects params
func (o *GetAPIProjectsParams) WithTimeout(timeout time.Duration) *GetAPIProjectsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API projects params
func (o *GetAPIProjectsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API projects params
func (o *GetAPIProjectsParams) WithContext(ctx context.Context) *GetAPIProjectsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API projects params
func (o *GetAPIProjectsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API projects params
func (o *GetAPIProjectsParams) WithHTTPClient(client *http.Client) *GetAPIProjectsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API projects params
func (o *GetAPIProjectsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithCustomer adds the customer to the get API projects params
func (o *GetAPIProjectsParams) WithCustomer(customer string) *GetAPIProjectsParams {
o.SetCustomer(customer)
return o
}
// SetCustomer adds the customer to the get API projects params
func (o *GetAPIProjectsParams) SetCustomer(customer string) {
o.Customer = customer
}
// WithCustomers adds the customers to the get API projects params
func (o *GetAPIProjectsParams) WithCustomers(customers string) *GetAPIProjectsParams {
o.SetCustomers(customers)
return o
}
// SetCustomers adds the customers to the get API projects params
func (o *GetAPIProjectsParams) SetCustomers(customers string) {
o.Customers = customers
}
// WithEnd adds the end to the get API projects params
func (o *GetAPIProjectsParams) WithEnd(end string) *GetAPIProjectsParams {
o.SetEnd(end)
return o
}
// SetEnd adds the end to the get API projects params
func (o *GetAPIProjectsParams) SetEnd(end string) {
o.End = end
}
// WithGlobalActivities adds the globalActivities to the get API projects params
func (o *GetAPIProjectsParams) WithGlobalActivities(globalActivities string) *GetAPIProjectsParams {
o.SetGlobalActivities(globalActivities)
return o
}
// SetGlobalActivities adds the globalActivities to the get API projects params
func (o *GetAPIProjectsParams) SetGlobalActivities(globalActivities string) {
o.GlobalActivities = globalActivities
}
// WithIgnoreDates adds the ignoreDates to the get API projects params
func (o *GetAPIProjectsParams) WithIgnoreDates(ignoreDates string) *GetAPIProjectsParams {
o.SetIgnoreDates(ignoreDates)
return o
}
// SetIgnoreDates adds the ignoreDates to the get API projects params
func (o *GetAPIProjectsParams) SetIgnoreDates(ignoreDates string) {
o.IgnoreDates = ignoreDates
}
// WithOrder adds the order to the get API projects params
func (o *GetAPIProjectsParams) WithOrder(order string) *GetAPIProjectsParams {
o.SetOrder(order)
return o
}
// SetOrder adds the order to the get API projects params
func (o *GetAPIProjectsParams) SetOrder(order string) {
o.Order = order
}
// WithOrderBy adds the orderBy to the get API projects params
func (o *GetAPIProjectsParams) WithOrderBy(orderBy string) *GetAPIProjectsParams {
o.SetOrderBy(orderBy)
return o
}
// SetOrderBy adds the orderBy to the get API projects params
func (o *GetAPIProjectsParams) SetOrderBy(orderBy string) {
o.OrderBy = orderBy
}
// WithStart adds the start to the get API projects params
func (o *GetAPIProjectsParams) WithStart(start string) *GetAPIProjectsParams {
o.SetStart(start)
return o
}
// SetStart adds the start to the get API projects params
func (o *GetAPIProjectsParams) SetStart(start string) {
o.Start = start
}
// WithTerm adds the term to the get API projects params
func (o *GetAPIProjectsParams) WithTerm(term *string) *GetAPIProjectsParams {
o.SetTerm(term)
return o
}
// SetTerm adds the term to the get API projects params
func (o *GetAPIProjectsParams) SetTerm(term *string) {
o.Term = term
}
// WithVisible adds the visible to the get API projects params
func (o *GetAPIProjectsParams) WithVisible(visible string) *GetAPIProjectsParams {
o.SetVisible(visible)
return o
}
// SetVisible adds the visible to the get API projects params
func (o *GetAPIProjectsParams) SetVisible(visible string) {
o.Visible = visible
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPIProjectsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// query param customer
qrCustomer := o.Customer
qCustomer := qrCustomer
if err := r.SetQueryParam("customer", qCustomer); err != nil {
return err
}
// query param customers
qrCustomers := o.Customers
qCustomers := qrCustomers
if err := r.SetQueryParam("customers", qCustomers); err != nil {
return err
}
// query param end
qrEnd := o.End
qEnd := qrEnd
if err := r.SetQueryParam("end", qEnd); err != nil {
return err
}
// query param globalActivities
qrGlobalActivities := o.GlobalActivities
qGlobalActivities := qrGlobalActivities
if err := r.SetQueryParam("globalActivities", qGlobalActivities); err != nil {
return err
}
// query param ignoreDates
qrIgnoreDates := o.IgnoreDates
qIgnoreDates := qrIgnoreDates
if err := r.SetQueryParam("ignoreDates", qIgnoreDates); err != nil {
return err
}
// query param order
qrOrder := o.Order
qOrder := qrOrder
if err := r.SetQueryParam("order", qOrder); err != nil {
return err
}
// query param orderBy
qrOrderBy := o.OrderBy
qOrderBy := qrOrderBy
if err := r.SetQueryParam("orderBy", qOrderBy); err != nil {
return err
}
// query param start
qrStart := o.Start
qStart := qrStart
if err := r.SetQueryParam("start", qStart); err != nil {
return err
}
if o.Term != nil {
// query param term
var qrTerm string
if o.Term != nil {
qrTerm = *o.Term
}
qTerm := qrTerm
if qTerm != "" {
if err := r.SetQueryParam("term", qTerm); err != nil {
return err
}
}
}
// query param visible
qrVisible := o.Visible
qVisible := qrVisible
if err := r.SetQueryParam("visible", qVisible); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,96 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// GetAPIProjectsReader is a Reader for the GetAPIProjects structure.
type GetAPIProjectsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAPIProjectsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAPIProjectsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetAPIProjectsOK creates a GetAPIProjectsOK with default headers values
func NewGetAPIProjectsOK() *GetAPIProjectsOK {
return &GetAPIProjectsOK{}
}
/*
GetAPIProjectsOK describes a response with status code 200, with default header values.
Returns a collection of project entities
*/
type GetAPIProjectsOK struct {
Payload []*models.ProjectCollection
}
// IsSuccess returns true when this get Api projects o k response has a 2xx status code
func (o *GetAPIProjectsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get Api projects o k response has a 3xx status code
func (o *GetAPIProjectsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get Api projects o k response has a 4xx status code
func (o *GetAPIProjectsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get Api projects o k response has a 5xx status code
func (o *GetAPIProjectsOK) IsServerError() bool {
return false
}
// IsCode returns true when this get Api projects o k response a status code equal to that given
func (o *GetAPIProjectsOK) IsCode(code int) bool {
return code == 200
}
func (o *GetAPIProjectsOK) Error() string {
return fmt.Sprintf("[GET /api/projects][%d] getApiProjectsOK %+v", 200, o.Payload)
}
func (o *GetAPIProjectsOK) String() string {
return fmt.Sprintf("[GET /api/projects][%d] getApiProjectsOK %+v", 200, o.Payload)
}
func (o *GetAPIProjectsOK) GetPayload() []*models.ProjectCollection {
return o.Payload
}
func (o *GetAPIProjectsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,169 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewPatchAPIProjectsIDMetaParams creates a new PatchAPIProjectsIDMetaParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPatchAPIProjectsIDMetaParams() *PatchAPIProjectsIDMetaParams {
return &PatchAPIProjectsIDMetaParams{
timeout: cr.DefaultTimeout,
}
}
// NewPatchAPIProjectsIDMetaParamsWithTimeout creates a new PatchAPIProjectsIDMetaParams object
// with the ability to set a timeout on a request.
func NewPatchAPIProjectsIDMetaParamsWithTimeout(timeout time.Duration) *PatchAPIProjectsIDMetaParams {
return &PatchAPIProjectsIDMetaParams{
timeout: timeout,
}
}
// NewPatchAPIProjectsIDMetaParamsWithContext creates a new PatchAPIProjectsIDMetaParams object
// with the ability to set a context for a request.
func NewPatchAPIProjectsIDMetaParamsWithContext(ctx context.Context) *PatchAPIProjectsIDMetaParams {
return &PatchAPIProjectsIDMetaParams{
Context: ctx,
}
}
// NewPatchAPIProjectsIDMetaParamsWithHTTPClient creates a new PatchAPIProjectsIDMetaParams object
// with the ability to set a custom HTTPClient for a request.
func NewPatchAPIProjectsIDMetaParamsWithHTTPClient(client *http.Client) *PatchAPIProjectsIDMetaParams {
return &PatchAPIProjectsIDMetaParams{
HTTPClient: client,
}
}
/*
PatchAPIProjectsIDMetaParams contains all the parameters to send to the API endpoint
for the patch API projects ID meta operation.
Typically these are written to a http.Request.
*/
type PatchAPIProjectsIDMetaParams struct {
// Body.
Body PatchAPIProjectsIDMetaBody
/* ID.
Project record ID to set the meta-field value for
*/
ID int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the patch API projects ID meta params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PatchAPIProjectsIDMetaParams) WithDefaults() *PatchAPIProjectsIDMetaParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the patch API projects ID meta params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PatchAPIProjectsIDMetaParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the patch API projects ID meta params
func (o *PatchAPIProjectsIDMetaParams) WithTimeout(timeout time.Duration) *PatchAPIProjectsIDMetaParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the patch API projects ID meta params
func (o *PatchAPIProjectsIDMetaParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the patch API projects ID meta params
func (o *PatchAPIProjectsIDMetaParams) WithContext(ctx context.Context) *PatchAPIProjectsIDMetaParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the patch API projects ID meta params
func (o *PatchAPIProjectsIDMetaParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the patch API projects ID meta params
func (o *PatchAPIProjectsIDMetaParams) WithHTTPClient(client *http.Client) *PatchAPIProjectsIDMetaParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the patch API projects ID meta params
func (o *PatchAPIProjectsIDMetaParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the patch API projects ID meta params
func (o *PatchAPIProjectsIDMetaParams) WithBody(body PatchAPIProjectsIDMetaBody) *PatchAPIProjectsIDMetaParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the patch API projects ID meta params
func (o *PatchAPIProjectsIDMetaParams) SetBody(body PatchAPIProjectsIDMetaBody) {
o.Body = body
}
// WithID adds the id to the patch API projects ID meta params
func (o *PatchAPIProjectsIDMetaParams) WithID(id int64) *PatchAPIProjectsIDMetaParams {
o.SetID(id)
return o
}
// SetID adds the id to the patch API projects ID meta params
func (o *PatchAPIProjectsIDMetaParams) SetID(id int64) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *PatchAPIProjectsIDMetaParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
// path param id
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,176 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
"decentral1se/go-kimai/models"
)
// PatchAPIProjectsIDMetaReader is a Reader for the PatchAPIProjectsIDMeta structure.
type PatchAPIProjectsIDMetaReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PatchAPIProjectsIDMetaReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPatchAPIProjectsIDMetaOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewPatchAPIProjectsIDMetaOK creates a PatchAPIProjectsIDMetaOK with default headers values
func NewPatchAPIProjectsIDMetaOK() *PatchAPIProjectsIDMetaOK {
return &PatchAPIProjectsIDMetaOK{}
}
/*
PatchAPIProjectsIDMetaOK describes a response with status code 200, with default header values.
Sets the value of an existing/configured meta-field. You cannot create unknown meta-fields, if the given name is not a configured meta-field, this will return an exception.
*/
type PatchAPIProjectsIDMetaOK struct {
Payload *models.ProjectEntity
}
// IsSuccess returns true when this patch Api projects Id meta o k response has a 2xx status code
func (o *PatchAPIProjectsIDMetaOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this patch Api projects Id meta o k response has a 3xx status code
func (o *PatchAPIProjectsIDMetaOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this patch Api projects Id meta o k response has a 4xx status code
func (o *PatchAPIProjectsIDMetaOK) IsClientError() bool {
return false
}
// IsServerError returns true when this patch Api projects Id meta o k response has a 5xx status code
func (o *PatchAPIProjectsIDMetaOK) IsServerError() bool {
return false
}
// IsCode returns true when this patch Api projects Id meta o k response a status code equal to that given
func (o *PatchAPIProjectsIDMetaOK) IsCode(code int) bool {
return code == 200
}
func (o *PatchAPIProjectsIDMetaOK) Error() string {
return fmt.Sprintf("[PATCH /api/projects/{id}/meta][%d] patchApiProjectsIdMetaOK %+v", 200, o.Payload)
}
func (o *PatchAPIProjectsIDMetaOK) String() string {
return fmt.Sprintf("[PATCH /api/projects/{id}/meta][%d] patchApiProjectsIdMetaOK %+v", 200, o.Payload)
}
func (o *PatchAPIProjectsIDMetaOK) GetPayload() *models.ProjectEntity {
return o.Payload
}
func (o *PatchAPIProjectsIDMetaOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ProjectEntity)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
PatchAPIProjectsIDMetaBody patch API projects ID meta body
swagger:model PatchAPIProjectsIDMetaBody
*/
type PatchAPIProjectsIDMetaBody struct {
// The meta-field name
// Required: true
Name *string `json:"name"`
// The meta-field value
// Required: true
Value *string `json:"value"`
}
// Validate validates this patch API projects ID meta body
func (o *PatchAPIProjectsIDMetaBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateName(formats); err != nil {
res = append(res, err)
}
if err := o.validateValue(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *PatchAPIProjectsIDMetaBody) validateName(formats strfmt.Registry) error {
if err := validate.Required("body"+"."+"name", "body", o.Name); err != nil {
return err
}
return nil
}
func (o *PatchAPIProjectsIDMetaBody) validateValue(formats strfmt.Registry) error {
if err := validate.Required("body"+"."+"value", "body", o.Value); err != nil {
return err
}
return nil
}
// ContextValidate validates this patch API projects ID meta body based on context it is used
func (o *PatchAPIProjectsIDMetaBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *PatchAPIProjectsIDMetaBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *PatchAPIProjectsIDMetaBody) UnmarshalBinary(b []byte) error {
var res PatchAPIProjectsIDMetaBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@ -0,0 +1,173 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"decentral1se/go-kimai/models"
)
// NewPatchAPIProjectsIDParams creates a new PatchAPIProjectsIDParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPatchAPIProjectsIDParams() *PatchAPIProjectsIDParams {
return &PatchAPIProjectsIDParams{
timeout: cr.DefaultTimeout,
}
}
// NewPatchAPIProjectsIDParamsWithTimeout creates a new PatchAPIProjectsIDParams object
// with the ability to set a timeout on a request.
func NewPatchAPIProjectsIDParamsWithTimeout(timeout time.Duration) *PatchAPIProjectsIDParams {
return &PatchAPIProjectsIDParams{
timeout: timeout,
}
}
// NewPatchAPIProjectsIDParamsWithContext creates a new PatchAPIProjectsIDParams object
// with the ability to set a context for a request.
func NewPatchAPIProjectsIDParamsWithContext(ctx context.Context) *PatchAPIProjectsIDParams {
return &PatchAPIProjectsIDParams{
Context: ctx,
}
}
// NewPatchAPIProjectsIDParamsWithHTTPClient creates a new PatchAPIProjectsIDParams object
// with the ability to set a custom HTTPClient for a request.
func NewPatchAPIProjectsIDParamsWithHTTPClient(client *http.Client) *PatchAPIProjectsIDParams {
return &PatchAPIProjectsIDParams{
HTTPClient: client,
}
}
/*
PatchAPIProjectsIDParams contains all the parameters to send to the API endpoint
for the patch API projects ID operation.
Typically these are written to a http.Request.
*/
type PatchAPIProjectsIDParams struct {
// Body.
Body *models.ProjectEditForm
/* ID.
Project ID to update
*/
ID int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the patch API projects ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PatchAPIProjectsIDParams) WithDefaults() *PatchAPIProjectsIDParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the patch API projects ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PatchAPIProjectsIDParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the patch API projects ID params
func (o *PatchAPIProjectsIDParams) WithTimeout(timeout time.Duration) *PatchAPIProjectsIDParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the patch API projects ID params
func (o *PatchAPIProjectsIDParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the patch API projects ID params
func (o *PatchAPIProjectsIDParams) WithContext(ctx context.Context) *PatchAPIProjectsIDParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the patch API projects ID params
func (o *PatchAPIProjectsIDParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the patch API projects ID params
func (o *PatchAPIProjectsIDParams) WithHTTPClient(client *http.Client) *PatchAPIProjectsIDParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the patch API projects ID params
func (o *PatchAPIProjectsIDParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the patch API projects ID params
func (o *PatchAPIProjectsIDParams) WithBody(body *models.ProjectEditForm) *PatchAPIProjectsIDParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the patch API projects ID params
func (o *PatchAPIProjectsIDParams) SetBody(body *models.ProjectEditForm) {
o.Body = body
}
// WithID adds the id to the patch API projects ID params
func (o *PatchAPIProjectsIDParams) WithID(id int64) *PatchAPIProjectsIDParams {
o.SetID(id)
return o
}
// SetID adds the id to the patch API projects ID params
func (o *PatchAPIProjectsIDParams) SetID(id int64) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *PatchAPIProjectsIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Body != nil {
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
}
// path param id
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,98 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// PatchAPIProjectsIDReader is a Reader for the PatchAPIProjectsID structure.
type PatchAPIProjectsIDReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PatchAPIProjectsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPatchAPIProjectsIDOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewPatchAPIProjectsIDOK creates a PatchAPIProjectsIDOK with default headers values
func NewPatchAPIProjectsIDOK() *PatchAPIProjectsIDOK {
return &PatchAPIProjectsIDOK{}
}
/*
PatchAPIProjectsIDOK describes a response with status code 200, with default header values.
Returns the updated project
*/
type PatchAPIProjectsIDOK struct {
Payload *models.ProjectEntity
}
// IsSuccess returns true when this patch Api projects Id o k response has a 2xx status code
func (o *PatchAPIProjectsIDOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this patch Api projects Id o k response has a 3xx status code
func (o *PatchAPIProjectsIDOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this patch Api projects Id o k response has a 4xx status code
func (o *PatchAPIProjectsIDOK) IsClientError() bool {
return false
}
// IsServerError returns true when this patch Api projects Id o k response has a 5xx status code
func (o *PatchAPIProjectsIDOK) IsServerError() bool {
return false
}
// IsCode returns true when this patch Api projects Id o k response a status code equal to that given
func (o *PatchAPIProjectsIDOK) IsCode(code int) bool {
return code == 200
}
func (o *PatchAPIProjectsIDOK) Error() string {
return fmt.Sprintf("[PATCH /api/projects/{id}][%d] patchApiProjectsIdOK %+v", 200, o.Payload)
}
func (o *PatchAPIProjectsIDOK) String() string {
return fmt.Sprintf("[PATCH /api/projects/{id}][%d] patchApiProjectsIdOK %+v", 200, o.Payload)
}
func (o *PatchAPIProjectsIDOK) GetPayload() *models.ProjectEntity {
return o.Payload
}
func (o *PatchAPIProjectsIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ProjectEntity)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,173 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"decentral1se/go-kimai/models"
)
// NewPostAPIProjectsIDRatesParams creates a new PostAPIProjectsIDRatesParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostAPIProjectsIDRatesParams() *PostAPIProjectsIDRatesParams {
return &PostAPIProjectsIDRatesParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostAPIProjectsIDRatesParamsWithTimeout creates a new PostAPIProjectsIDRatesParams object
// with the ability to set a timeout on a request.
func NewPostAPIProjectsIDRatesParamsWithTimeout(timeout time.Duration) *PostAPIProjectsIDRatesParams {
return &PostAPIProjectsIDRatesParams{
timeout: timeout,
}
}
// NewPostAPIProjectsIDRatesParamsWithContext creates a new PostAPIProjectsIDRatesParams object
// with the ability to set a context for a request.
func NewPostAPIProjectsIDRatesParamsWithContext(ctx context.Context) *PostAPIProjectsIDRatesParams {
return &PostAPIProjectsIDRatesParams{
Context: ctx,
}
}
// NewPostAPIProjectsIDRatesParamsWithHTTPClient creates a new PostAPIProjectsIDRatesParams object
// with the ability to set a custom HTTPClient for a request.
func NewPostAPIProjectsIDRatesParamsWithHTTPClient(client *http.Client) *PostAPIProjectsIDRatesParams {
return &PostAPIProjectsIDRatesParams{
HTTPClient: client,
}
}
/*
PostAPIProjectsIDRatesParams contains all the parameters to send to the API endpoint
for the post API projects ID rates operation.
Typically these are written to a http.Request.
*/
type PostAPIProjectsIDRatesParams struct {
// Body.
Body *models.ProjectRateForm
/* ID.
The project to add the rate for
*/
ID int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the post API projects ID rates params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostAPIProjectsIDRatesParams) WithDefaults() *PostAPIProjectsIDRatesParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the post API projects ID rates params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostAPIProjectsIDRatesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post API projects ID rates params
func (o *PostAPIProjectsIDRatesParams) WithTimeout(timeout time.Duration) *PostAPIProjectsIDRatesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post API projects ID rates params
func (o *PostAPIProjectsIDRatesParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the post API projects ID rates params
func (o *PostAPIProjectsIDRatesParams) WithContext(ctx context.Context) *PostAPIProjectsIDRatesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post API projects ID rates params
func (o *PostAPIProjectsIDRatesParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post API projects ID rates params
func (o *PostAPIProjectsIDRatesParams) WithHTTPClient(client *http.Client) *PostAPIProjectsIDRatesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post API projects ID rates params
func (o *PostAPIProjectsIDRatesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the post API projects ID rates params
func (o *PostAPIProjectsIDRatesParams) WithBody(body *models.ProjectRateForm) *PostAPIProjectsIDRatesParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the post API projects ID rates params
func (o *PostAPIProjectsIDRatesParams) SetBody(body *models.ProjectRateForm) {
o.Body = body
}
// WithID adds the id to the post API projects ID rates params
func (o *PostAPIProjectsIDRatesParams) WithID(id int64) *PostAPIProjectsIDRatesParams {
o.SetID(id)
return o
}
// SetID adds the id to the post API projects ID rates params
func (o *PostAPIProjectsIDRatesParams) SetID(id int64) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *PostAPIProjectsIDRatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Body != nil {
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
}
// path param id
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,98 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// PostAPIProjectsIDRatesReader is a Reader for the PostAPIProjectsIDRates structure.
type PostAPIProjectsIDRatesReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PostAPIProjectsIDRatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostAPIProjectsIDRatesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewPostAPIProjectsIDRatesOK creates a PostAPIProjectsIDRatesOK with default headers values
func NewPostAPIProjectsIDRatesOK() *PostAPIProjectsIDRatesOK {
return &PostAPIProjectsIDRatesOK{}
}
/*
PostAPIProjectsIDRatesOK describes a response with status code 200, with default header values.
Returns the new created rate
*/
type PostAPIProjectsIDRatesOK struct {
Payload *models.ProjectRate
}
// IsSuccess returns true when this post Api projects Id rates o k response has a 2xx status code
func (o *PostAPIProjectsIDRatesOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this post Api projects Id rates o k response has a 3xx status code
func (o *PostAPIProjectsIDRatesOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this post Api projects Id rates o k response has a 4xx status code
func (o *PostAPIProjectsIDRatesOK) IsClientError() bool {
return false
}
// IsServerError returns true when this post Api projects Id rates o k response has a 5xx status code
func (o *PostAPIProjectsIDRatesOK) IsServerError() bool {
return false
}
// IsCode returns true when this post Api projects Id rates o k response a status code equal to that given
func (o *PostAPIProjectsIDRatesOK) IsCode(code int) bool {
return code == 200
}
func (o *PostAPIProjectsIDRatesOK) Error() string {
return fmt.Sprintf("[POST /api/projects/{id}/rates][%d] postApiProjectsIdRatesOK %+v", 200, o.Payload)
}
func (o *PostAPIProjectsIDRatesOK) String() string {
return fmt.Sprintf("[POST /api/projects/{id}/rates][%d] postApiProjectsIdRatesOK %+v", 200, o.Payload)
}
func (o *PostAPIProjectsIDRatesOK) GetPayload() *models.ProjectRate {
return o.Payload
}
func (o *PostAPIProjectsIDRatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ProjectRate)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,150 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// NewPostAPIProjectsParams creates a new PostAPIProjectsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostAPIProjectsParams() *PostAPIProjectsParams {
return &PostAPIProjectsParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostAPIProjectsParamsWithTimeout creates a new PostAPIProjectsParams object
// with the ability to set a timeout on a request.
func NewPostAPIProjectsParamsWithTimeout(timeout time.Duration) *PostAPIProjectsParams {
return &PostAPIProjectsParams{
timeout: timeout,
}
}
// NewPostAPIProjectsParamsWithContext creates a new PostAPIProjectsParams object
// with the ability to set a context for a request.
func NewPostAPIProjectsParamsWithContext(ctx context.Context) *PostAPIProjectsParams {
return &PostAPIProjectsParams{
Context: ctx,
}
}
// NewPostAPIProjectsParamsWithHTTPClient creates a new PostAPIProjectsParams object
// with the ability to set a custom HTTPClient for a request.
func NewPostAPIProjectsParamsWithHTTPClient(client *http.Client) *PostAPIProjectsParams {
return &PostAPIProjectsParams{
HTTPClient: client,
}
}
/*
PostAPIProjectsParams contains all the parameters to send to the API endpoint
for the post API projects operation.
Typically these are written to a http.Request.
*/
type PostAPIProjectsParams struct {
// Body.
Body *models.ProjectEditForm
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the post API projects params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostAPIProjectsParams) WithDefaults() *PostAPIProjectsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the post API projects params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostAPIProjectsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post API projects params
func (o *PostAPIProjectsParams) WithTimeout(timeout time.Duration) *PostAPIProjectsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post API projects params
func (o *PostAPIProjectsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the post API projects params
func (o *PostAPIProjectsParams) WithContext(ctx context.Context) *PostAPIProjectsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post API projects params
func (o *PostAPIProjectsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post API projects params
func (o *PostAPIProjectsParams) WithHTTPClient(client *http.Client) *PostAPIProjectsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post API projects params
func (o *PostAPIProjectsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the post API projects params
func (o *PostAPIProjectsParams) WithBody(body *models.ProjectEditForm) *PostAPIProjectsParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the post API projects params
func (o *PostAPIProjectsParams) SetBody(body *models.ProjectEditForm) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *PostAPIProjectsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Body != nil {
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,98 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// PostAPIProjectsReader is a Reader for the PostAPIProjects structure.
type PostAPIProjectsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PostAPIProjectsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostAPIProjectsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewPostAPIProjectsOK creates a PostAPIProjectsOK with default headers values
func NewPostAPIProjectsOK() *PostAPIProjectsOK {
return &PostAPIProjectsOK{}
}
/*
PostAPIProjectsOK describes a response with status code 200, with default header values.
Returns the new created project
*/
type PostAPIProjectsOK struct {
Payload *models.ProjectEntity
}
// IsSuccess returns true when this post Api projects o k response has a 2xx status code
func (o *PostAPIProjectsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this post Api projects o k response has a 3xx status code
func (o *PostAPIProjectsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this post Api projects o k response has a 4xx status code
func (o *PostAPIProjectsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this post Api projects o k response has a 5xx status code
func (o *PostAPIProjectsOK) IsServerError() bool {
return false
}
// IsCode returns true when this post Api projects o k response a status code equal to that given
func (o *PostAPIProjectsOK) IsCode(code int) bool {
return code == 200
}
func (o *PostAPIProjectsOK) Error() string {
return fmt.Sprintf("[POST /api/projects][%d] postApiProjectsOK %+v", 200, o.Payload)
}
func (o *PostAPIProjectsOK) String() string {
return fmt.Sprintf("[POST /api/projects][%d] postApiProjectsOK %+v", 200, o.Payload)
}
func (o *PostAPIProjectsOK) GetPayload() *models.ProjectEntity {
return o.Payload
}
func (o *PostAPIProjectsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.ProjectEntity)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,371 @@
// Code generated by go-swagger; DO NOT EDIT.
package project
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new project API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for project API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods
type ClientService interface {
DeleteAPIProjectsIDRatesRateID(params *DeleteAPIProjectsIDRatesRateIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIProjectsIDRatesRateIDNoContent, error)
GetAPIProjects(params *GetAPIProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsOK, error)
GetAPIProjectsID(params *GetAPIProjectsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsIDOK, error)
GetAPIProjectsIDRates(params *GetAPIProjectsIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsIDRatesOK, error)
PatchAPIProjectsID(params *PatchAPIProjectsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIProjectsIDOK, error)
PatchAPIProjectsIDMeta(params *PatchAPIProjectsIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIProjectsIDMetaOK, error)
PostAPIProjects(params *PostAPIProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIProjectsOK, error)
PostAPIProjectsIDRates(params *PostAPIProjectsIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIProjectsIDRatesOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
DeleteAPIProjectsIDRatesRateID deletes one rate for an project
*/
func (a *Client) DeleteAPIProjectsIDRatesRateID(params *DeleteAPIProjectsIDRatesRateIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPIProjectsIDRatesRateIDNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAPIProjectsIDRatesRateIDParams()
}
op := &runtime.ClientOperation{
ID: "DeleteAPIProjectsIDRatesRateID",
Method: "DELETE",
PathPattern: "/api/projects/{id}/rates/{rateId}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteAPIProjectsIDRatesRateIDReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DeleteAPIProjectsIDRatesRateIDNoContent)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for DeleteAPIProjectsIDRatesRateID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIProjects returns a collection of projects
*/
func (a *Client) GetAPIProjects(params *GetAPIProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIProjectsParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIProjects",
Method: "GET",
PathPattern: "/api/projects",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIProjectsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*GetAPIProjectsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for GetAPIProjects: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIProjectsID returns one project
*/
func (a *Client) GetAPIProjectsID(params *GetAPIProjectsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIProjectsIDParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIProjectsID",
Method: "GET",
PathPattern: "/api/projects/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIProjectsIDReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*GetAPIProjectsIDOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for GetAPIProjectsID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPIProjectsIDRates returns a collection of all rates for one project
*/
func (a *Client) GetAPIProjectsIDRates(params *GetAPIProjectsIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPIProjectsIDRatesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPIProjectsIDRatesParams()
}
op := &runtime.ClientOperation{
ID: "GetAPIProjectsIDRates",
Method: "GET",
PathPattern: "/api/projects/{id}/rates",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPIProjectsIDRatesReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*GetAPIProjectsIDRatesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for GetAPIProjectsIDRates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPIProjectsID updates an existing project
Update an existing project, you can pass all or just a subset of all attributes
*/
func (a *Client) PatchAPIProjectsID(params *PatchAPIProjectsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIProjectsIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPIProjectsIDParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPIProjectsID",
Method: "PATCH",
PathPattern: "/api/projects/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPIProjectsIDReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PatchAPIProjectsIDOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for PatchAPIProjectsID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPIProjectsIDMeta sets the value of a meta field for an existing project
*/
func (a *Client) PatchAPIProjectsIDMeta(params *PatchAPIProjectsIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPIProjectsIDMetaOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPIProjectsIDMetaParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPIProjectsIDMeta",
Method: "PATCH",
PathPattern: "/api/projects/{id}/meta",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPIProjectsIDMetaReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PatchAPIProjectsIDMetaOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for PatchAPIProjectsIDMeta: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostAPIProjects creates a new project
Creates a new project and returns it afterwards
*/
func (a *Client) PostAPIProjects(params *PostAPIProjectsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIProjectsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostAPIProjectsParams()
}
op := &runtime.ClientOperation{
ID: "PostAPIProjects",
Method: "POST",
PathPattern: "/api/projects",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostAPIProjectsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PostAPIProjectsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for PostAPIProjects: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostAPIProjectsIDRates adds a new rate to an project
*/
func (a *Client) PostAPIProjectsIDRates(params *PostAPIProjectsIDRatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPIProjectsIDRatesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostAPIProjectsIDRatesParams()
}
op := &runtime.ClientOperation{
ID: "PostAPIProjectsIDRates",
Method: "POST",
PathPattern: "/api/projects/{id}/rates",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostAPIProjectsIDRatesReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PostAPIProjectsIDRatesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for PostAPIProjectsIDRates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@ -0,0 +1,152 @@
// Code generated by go-swagger; DO NOT EDIT.
package tag
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewDeleteAPITagsIDParams creates a new DeleteAPITagsIDParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDeleteAPITagsIDParams() *DeleteAPITagsIDParams {
return &DeleteAPITagsIDParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteAPITagsIDParamsWithTimeout creates a new DeleteAPITagsIDParams object
// with the ability to set a timeout on a request.
func NewDeleteAPITagsIDParamsWithTimeout(timeout time.Duration) *DeleteAPITagsIDParams {
return &DeleteAPITagsIDParams{
timeout: timeout,
}
}
// NewDeleteAPITagsIDParamsWithContext creates a new DeleteAPITagsIDParams object
// with the ability to set a context for a request.
func NewDeleteAPITagsIDParamsWithContext(ctx context.Context) *DeleteAPITagsIDParams {
return &DeleteAPITagsIDParams{
Context: ctx,
}
}
// NewDeleteAPITagsIDParamsWithHTTPClient creates a new DeleteAPITagsIDParams object
// with the ability to set a custom HTTPClient for a request.
func NewDeleteAPITagsIDParamsWithHTTPClient(client *http.Client) *DeleteAPITagsIDParams {
return &DeleteAPITagsIDParams{
HTTPClient: client,
}
}
/*
DeleteAPITagsIDParams contains all the parameters to send to the API endpoint
for the delete API tags ID operation.
Typically these are written to a http.Request.
*/
type DeleteAPITagsIDParams struct {
/* ID.
Tag ID to delete
*/
ID int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the delete API tags ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteAPITagsIDParams) WithDefaults() *DeleteAPITagsIDParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the delete API tags ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteAPITagsIDParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the delete API tags ID params
func (o *DeleteAPITagsIDParams) WithTimeout(timeout time.Duration) *DeleteAPITagsIDParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete API tags ID params
func (o *DeleteAPITagsIDParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete API tags ID params
func (o *DeleteAPITagsIDParams) WithContext(ctx context.Context) *DeleteAPITagsIDParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete API tags ID params
func (o *DeleteAPITagsIDParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete API tags ID params
func (o *DeleteAPITagsIDParams) WithHTTPClient(client *http.Client) *DeleteAPITagsIDParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete API tags ID params
func (o *DeleteAPITagsIDParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the delete API tags ID params
func (o *DeleteAPITagsIDParams) WithID(id int64) *DeleteAPITagsIDParams {
o.SetID(id)
return o
}
// SetID adds the id to the delete API tags ID params
func (o *DeleteAPITagsIDParams) SetID(id int64) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteAPITagsIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param id
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,83 @@
// Code generated by go-swagger; DO NOT EDIT.
package tag
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// DeleteAPITagsIDReader is a Reader for the DeleteAPITagsID structure.
type DeleteAPITagsIDReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteAPITagsIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewDeleteAPITagsIDNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewDeleteAPITagsIDNoContent creates a DeleteAPITagsIDNoContent with default headers values
func NewDeleteAPITagsIDNoContent() *DeleteAPITagsIDNoContent {
return &DeleteAPITagsIDNoContent{}
}
/*
DeleteAPITagsIDNoContent describes a response with status code 204, with default header values.
HTTP code 204 for a successful delete
*/
type DeleteAPITagsIDNoContent struct {
}
// IsSuccess returns true when this delete Api tags Id no content response has a 2xx status code
func (o *DeleteAPITagsIDNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this delete Api tags Id no content response has a 3xx status code
func (o *DeleteAPITagsIDNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete Api tags Id no content response has a 4xx status code
func (o *DeleteAPITagsIDNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this delete Api tags Id no content response has a 5xx status code
func (o *DeleteAPITagsIDNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this delete Api tags Id no content response a status code equal to that given
func (o *DeleteAPITagsIDNoContent) IsCode(code int) bool {
return code == 204
}
func (o *DeleteAPITagsIDNoContent) Error() string {
return fmt.Sprintf("[DELETE /api/tags/{id}][%d] deleteApiTagsIdNoContent ", 204)
}
func (o *DeleteAPITagsIDNoContent) String() string {
return fmt.Sprintf("[DELETE /api/tags/{id}][%d] deleteApiTagsIdNoContent ", 204)
}
func (o *DeleteAPITagsIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@ -0,0 +1,154 @@
// Code generated by go-swagger; DO NOT EDIT.
package tag
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewGetAPITagsParams creates a new GetAPITagsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAPITagsParams() *GetAPITagsParams {
return &GetAPITagsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPITagsParamsWithTimeout creates a new GetAPITagsParams object
// with the ability to set a timeout on a request.
func NewGetAPITagsParamsWithTimeout(timeout time.Duration) *GetAPITagsParams {
return &GetAPITagsParams{
timeout: timeout,
}
}
// NewGetAPITagsParamsWithContext creates a new GetAPITagsParams object
// with the ability to set a context for a request.
func NewGetAPITagsParamsWithContext(ctx context.Context) *GetAPITagsParams {
return &GetAPITagsParams{
Context: ctx,
}
}
// NewGetAPITagsParamsWithHTTPClient creates a new GetAPITagsParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPITagsParamsWithHTTPClient(client *http.Client) *GetAPITagsParams {
return &GetAPITagsParams{
HTTPClient: client,
}
}
/*
GetAPITagsParams contains all the parameters to send to the API endpoint
for the get API tags operation.
Typically these are written to a http.Request.
*/
type GetAPITagsParams struct {
/* Name.
Search term to filter tag list
*/
Name string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API tags params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPITagsParams) WithDefaults() *GetAPITagsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API tags params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPITagsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API tags params
func (o *GetAPITagsParams) WithTimeout(timeout time.Duration) *GetAPITagsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API tags params
func (o *GetAPITagsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API tags params
func (o *GetAPITagsParams) WithContext(ctx context.Context) *GetAPITagsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API tags params
func (o *GetAPITagsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API tags params
func (o *GetAPITagsParams) WithHTTPClient(client *http.Client) *GetAPITagsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API tags params
func (o *GetAPITagsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithName adds the name to the get API tags params
func (o *GetAPITagsParams) WithName(name string) *GetAPITagsParams {
o.SetName(name)
return o
}
// SetName adds the name to the get API tags params
func (o *GetAPITagsParams) SetName(name string) {
o.Name = name
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPITagsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// query param name
qrName := o.Name
qName := qrName
if err := r.SetQueryParam("name", qName); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,94 @@
// Code generated by go-swagger; DO NOT EDIT.
package tag
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// GetAPITagsReader is a Reader for the GetAPITags structure.
type GetAPITagsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAPITagsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAPITagsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetAPITagsOK creates a GetAPITagsOK with default headers values
func NewGetAPITagsOK() *GetAPITagsOK {
return &GetAPITagsOK{}
}
/*
GetAPITagsOK describes a response with status code 200, with default header values.
Returns the collection of all existing tags as string array
*/
type GetAPITagsOK struct {
Payload []string
}
// IsSuccess returns true when this get Api tags o k response has a 2xx status code
func (o *GetAPITagsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get Api tags o k response has a 3xx status code
func (o *GetAPITagsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get Api tags o k response has a 4xx status code
func (o *GetAPITagsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get Api tags o k response has a 5xx status code
func (o *GetAPITagsOK) IsServerError() bool {
return false
}
// IsCode returns true when this get Api tags o k response a status code equal to that given
func (o *GetAPITagsOK) IsCode(code int) bool {
return code == 200
}
func (o *GetAPITagsOK) Error() string {
return fmt.Sprintf("[GET /api/tags][%d] getApiTagsOK %+v", 200, o.Payload)
}
func (o *GetAPITagsOK) String() string {
return fmt.Sprintf("[GET /api/tags][%d] getApiTagsOK %+v", 200, o.Payload)
}
func (o *GetAPITagsOK) GetPayload() []string {
return o.Payload
}
func (o *GetAPITagsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@ -0,0 +1,150 @@
// Code generated by go-swagger; DO NOT EDIT.
package tag
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// NewPostAPITagsParams creates a new PostAPITagsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostAPITagsParams() *PostAPITagsParams {
return &PostAPITagsParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostAPITagsParamsWithTimeout creates a new PostAPITagsParams object
// with the ability to set a timeout on a request.
func NewPostAPITagsParamsWithTimeout(timeout time.Duration) *PostAPITagsParams {
return &PostAPITagsParams{
timeout: timeout,
}
}
// NewPostAPITagsParamsWithContext creates a new PostAPITagsParams object
// with the ability to set a context for a request.
func NewPostAPITagsParamsWithContext(ctx context.Context) *PostAPITagsParams {
return &PostAPITagsParams{
Context: ctx,
}
}
// NewPostAPITagsParamsWithHTTPClient creates a new PostAPITagsParams object
// with the ability to set a custom HTTPClient for a request.
func NewPostAPITagsParamsWithHTTPClient(client *http.Client) *PostAPITagsParams {
return &PostAPITagsParams{
HTTPClient: client,
}
}
/*
PostAPITagsParams contains all the parameters to send to the API endpoint
for the post API tags operation.
Typically these are written to a http.Request.
*/
type PostAPITagsParams struct {
// Body.
Body *models.TagEditForm
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the post API tags params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostAPITagsParams) WithDefaults() *PostAPITagsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the post API tags params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostAPITagsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post API tags params
func (o *PostAPITagsParams) WithTimeout(timeout time.Duration) *PostAPITagsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post API tags params
func (o *PostAPITagsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the post API tags params
func (o *PostAPITagsParams) WithContext(ctx context.Context) *PostAPITagsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post API tags params
func (o *PostAPITagsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post API tags params
func (o *PostAPITagsParams) WithHTTPClient(client *http.Client) *PostAPITagsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post API tags params
func (o *PostAPITagsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the post API tags params
func (o *PostAPITagsParams) WithBody(body *models.TagEditForm) *PostAPITagsParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the post API tags params
func (o *PostAPITagsParams) SetBody(body *models.TagEditForm) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *PostAPITagsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Body != nil {
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,98 @@
// Code generated by go-swagger; DO NOT EDIT.
package tag
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// PostAPITagsReader is a Reader for the PostAPITags structure.
type PostAPITagsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PostAPITagsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPostAPITagsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewPostAPITagsOK creates a PostAPITagsOK with default headers values
func NewPostAPITagsOK() *PostAPITagsOK {
return &PostAPITagsOK{}
}
/*
PostAPITagsOK describes a response with status code 200, with default header values.
Returns the new created tag
*/
type PostAPITagsOK struct {
Payload *models.TagEntity
}
// IsSuccess returns true when this post Api tags o k response has a 2xx status code
func (o *PostAPITagsOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this post Api tags o k response has a 3xx status code
func (o *PostAPITagsOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this post Api tags o k response has a 4xx status code
func (o *PostAPITagsOK) IsClientError() bool {
return false
}
// IsServerError returns true when this post Api tags o k response has a 5xx status code
func (o *PostAPITagsOK) IsServerError() bool {
return false
}
// IsCode returns true when this post Api tags o k response a status code equal to that given
func (o *PostAPITagsOK) IsCode(code int) bool {
return code == 200
}
func (o *PostAPITagsOK) Error() string {
return fmt.Sprintf("[POST /api/tags][%d] postApiTagsOK %+v", 200, o.Payload)
}
func (o *PostAPITagsOK) String() string {
return fmt.Sprintf("[POST /api/tags][%d] postApiTagsOK %+v", 200, o.Payload)
}
func (o *PostAPITagsOK) GetPayload() *models.TagEntity {
return o.Payload
}
func (o *PostAPITagsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.TagEntity)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

164
client/tag/tag_client.go Normal file
View File

@ -0,0 +1,164 @@
// Code generated by go-swagger; DO NOT EDIT.
package tag
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new tag API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for tag API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods
type ClientService interface {
DeleteAPITagsID(params *DeleteAPITagsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITagsIDNoContent, error)
GetAPITags(params *GetAPITagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITagsOK, error)
PostAPITags(params *PostAPITagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITagsOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
DeleteAPITagsID deletes a tag
*/
func (a *Client) DeleteAPITagsID(params *DeleteAPITagsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITagsIDNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAPITagsIDParams()
}
op := &runtime.ClientOperation{
ID: "DeleteAPITagsID",
Method: "DELETE",
PathPattern: "/api/tags/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteAPITagsIDReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DeleteAPITagsIDNoContent)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for DeleteAPITagsID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPITags fetches all existing tags
*/
func (a *Client) GetAPITags(params *GetAPITagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITagsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPITagsParams()
}
op := &runtime.ClientOperation{
ID: "GetAPITags",
Method: "GET",
PathPattern: "/api/tags",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPITagsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*GetAPITagsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for GetAPITags: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostAPITags creates a new tag
Creates a new tag and returns it afterwards
*/
func (a *Client) PostAPITags(params *PostAPITagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITagsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostAPITagsParams()
}
op := &runtime.ClientOperation{
ID: "PostAPITags",
Method: "POST",
PathPattern: "/api/tags",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostAPITagsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PostAPITagsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for PostAPITags: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}

View File

@ -0,0 +1,152 @@
// Code generated by go-swagger; DO NOT EDIT.
package task
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewDeleteAPITasksIDParams creates a new DeleteAPITasksIDParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewDeleteAPITasksIDParams() *DeleteAPITasksIDParams {
return &DeleteAPITasksIDParams{
timeout: cr.DefaultTimeout,
}
}
// NewDeleteAPITasksIDParamsWithTimeout creates a new DeleteAPITasksIDParams object
// with the ability to set a timeout on a request.
func NewDeleteAPITasksIDParamsWithTimeout(timeout time.Duration) *DeleteAPITasksIDParams {
return &DeleteAPITasksIDParams{
timeout: timeout,
}
}
// NewDeleteAPITasksIDParamsWithContext creates a new DeleteAPITasksIDParams object
// with the ability to set a context for a request.
func NewDeleteAPITasksIDParamsWithContext(ctx context.Context) *DeleteAPITasksIDParams {
return &DeleteAPITasksIDParams{
Context: ctx,
}
}
// NewDeleteAPITasksIDParamsWithHTTPClient creates a new DeleteAPITasksIDParams object
// with the ability to set a custom HTTPClient for a request.
func NewDeleteAPITasksIDParamsWithHTTPClient(client *http.Client) *DeleteAPITasksIDParams {
return &DeleteAPITasksIDParams{
HTTPClient: client,
}
}
/*
DeleteAPITasksIDParams contains all the parameters to send to the API endpoint
for the delete API tasks ID operation.
Typically these are written to a http.Request.
*/
type DeleteAPITasksIDParams struct {
/* ID.
Task record ID to delete
*/
ID int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the delete API tasks ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteAPITasksIDParams) WithDefaults() *DeleteAPITasksIDParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the delete API tasks ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *DeleteAPITasksIDParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the delete API tasks ID params
func (o *DeleteAPITasksIDParams) WithTimeout(timeout time.Duration) *DeleteAPITasksIDParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the delete API tasks ID params
func (o *DeleteAPITasksIDParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the delete API tasks ID params
func (o *DeleteAPITasksIDParams) WithContext(ctx context.Context) *DeleteAPITasksIDParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the delete API tasks ID params
func (o *DeleteAPITasksIDParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the delete API tasks ID params
func (o *DeleteAPITasksIDParams) WithHTTPClient(client *http.Client) *DeleteAPITasksIDParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the delete API tasks ID params
func (o *DeleteAPITasksIDParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the delete API tasks ID params
func (o *DeleteAPITasksIDParams) WithID(id int64) *DeleteAPITasksIDParams {
o.SetID(id)
return o
}
// SetID adds the id to the delete API tasks ID params
func (o *DeleteAPITasksIDParams) SetID(id int64) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *DeleteAPITasksIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param id
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,83 @@
// Code generated by go-swagger; DO NOT EDIT.
package task
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// DeleteAPITasksIDReader is a Reader for the DeleteAPITasksID structure.
type DeleteAPITasksIDReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *DeleteAPITasksIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 204:
result := NewDeleteAPITasksIDNoContent()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewDeleteAPITasksIDNoContent creates a DeleteAPITasksIDNoContent with default headers values
func NewDeleteAPITasksIDNoContent() *DeleteAPITasksIDNoContent {
return &DeleteAPITasksIDNoContent{}
}
/*
DeleteAPITasksIDNoContent describes a response with status code 204, with default header values.
Delete one task record
*/
type DeleteAPITasksIDNoContent struct {
}
// IsSuccess returns true when this delete Api tasks Id no content response has a 2xx status code
func (o *DeleteAPITasksIDNoContent) IsSuccess() bool {
return true
}
// IsRedirect returns true when this delete Api tasks Id no content response has a 3xx status code
func (o *DeleteAPITasksIDNoContent) IsRedirect() bool {
return false
}
// IsClientError returns true when this delete Api tasks Id no content response has a 4xx status code
func (o *DeleteAPITasksIDNoContent) IsClientError() bool {
return false
}
// IsServerError returns true when this delete Api tasks Id no content response has a 5xx status code
func (o *DeleteAPITasksIDNoContent) IsServerError() bool {
return false
}
// IsCode returns true when this delete Api tasks Id no content response a status code equal to that given
func (o *DeleteAPITasksIDNoContent) IsCode(code int) bool {
return code == 204
}
func (o *DeleteAPITasksIDNoContent) Error() string {
return fmt.Sprintf("[DELETE /api/tasks/{id}][%d] deleteApiTasksIdNoContent ", 204)
}
func (o *DeleteAPITasksIDNoContent) String() string {
return fmt.Sprintf("[DELETE /api/tasks/{id}][%d] deleteApiTasksIdNoContent ", 204)
}
func (o *DeleteAPITasksIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}

View File

@ -0,0 +1,152 @@
// Code generated by go-swagger; DO NOT EDIT.
package task
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewGetAPITasksIDParams creates a new GetAPITasksIDParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAPITasksIDParams() *GetAPITasksIDParams {
return &GetAPITasksIDParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPITasksIDParamsWithTimeout creates a new GetAPITasksIDParams object
// with the ability to set a timeout on a request.
func NewGetAPITasksIDParamsWithTimeout(timeout time.Duration) *GetAPITasksIDParams {
return &GetAPITasksIDParams{
timeout: timeout,
}
}
// NewGetAPITasksIDParamsWithContext creates a new GetAPITasksIDParams object
// with the ability to set a context for a request.
func NewGetAPITasksIDParamsWithContext(ctx context.Context) *GetAPITasksIDParams {
return &GetAPITasksIDParams{
Context: ctx,
}
}
// NewGetAPITasksIDParamsWithHTTPClient creates a new GetAPITasksIDParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPITasksIDParamsWithHTTPClient(client *http.Client) *GetAPITasksIDParams {
return &GetAPITasksIDParams{
HTTPClient: client,
}
}
/*
GetAPITasksIDParams contains all the parameters to send to the API endpoint
for the get API tasks ID operation.
Typically these are written to a http.Request.
*/
type GetAPITasksIDParams struct {
/* ID.
Task ID to fetch
*/
ID int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API tasks ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPITasksIDParams) WithDefaults() *GetAPITasksIDParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API tasks ID params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPITasksIDParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API tasks ID params
func (o *GetAPITasksIDParams) WithTimeout(timeout time.Duration) *GetAPITasksIDParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API tasks ID params
func (o *GetAPITasksIDParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API tasks ID params
func (o *GetAPITasksIDParams) WithContext(ctx context.Context) *GetAPITasksIDParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API tasks ID params
func (o *GetAPITasksIDParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API tasks ID params
func (o *GetAPITasksIDParams) WithHTTPClient(client *http.Client) *GetAPITasksIDParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API tasks ID params
func (o *GetAPITasksIDParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithID adds the id to the get API tasks ID params
func (o *GetAPITasksIDParams) WithID(id int64) *GetAPITasksIDParams {
o.SetID(id)
return o
}
// SetID adds the id to the get API tasks ID params
func (o *GetAPITasksIDParams) SetID(id int64) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPITasksIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param id
if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,98 @@
// Code generated by go-swagger; DO NOT EDIT.
package task
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"decentral1se/go-kimai/models"
)
// GetAPITasksIDReader is a Reader for the GetAPITasksID structure.
type GetAPITasksIDReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetAPITasksIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetAPITasksIDOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetAPITasksIDOK creates a GetAPITasksIDOK with default headers values
func NewGetAPITasksIDOK() *GetAPITasksIDOK {
return &GetAPITasksIDOK{}
}
/*
GetAPITasksIDOK describes a response with status code 200, with default header values.
Returns one task entity
*/
type GetAPITasksIDOK struct {
Payload *models.Task
}
// IsSuccess returns true when this get Api tasks Id o k response has a 2xx status code
func (o *GetAPITasksIDOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get Api tasks Id o k response has a 3xx status code
func (o *GetAPITasksIDOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get Api tasks Id o k response has a 4xx status code
func (o *GetAPITasksIDOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get Api tasks Id o k response has a 5xx status code
func (o *GetAPITasksIDOK) IsServerError() bool {
return false
}
// IsCode returns true when this get Api tasks Id o k response a status code equal to that given
func (o *GetAPITasksIDOK) IsCode(code int) bool {
return code == 200
}
func (o *GetAPITasksIDOK) Error() string {
return fmt.Sprintf("[GET /api/tasks/{id}][%d] getApiTasksIdOK %+v", 200, o.Payload)
}
func (o *GetAPITasksIDOK) String() string {
return fmt.Sprintf("[GET /api/tasks/{id}][%d] getApiTasksIdOK %+v", 200, o.Payload)
}
func (o *GetAPITasksIDOK) GetPayload() *models.Task {
return o.Payload
}
func (o *GetAPITasksIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Task)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

Some files were not shown because too many files have changed in this diff Show More