feat: init

This commit is contained in:
decentral1se
2023-01-14 15:14:06 +01:00
commit f44e2acbaf
245 changed files with 44079 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,644 @@
// Code generated by go-swagger; DO NOT EDIT.
package timesheet
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewGetAPITimesheetsParams creates a new GetAPITimesheetsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAPITimesheetsParams() *GetAPITimesheetsParams {
return &GetAPITimesheetsParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPITimesheetsParamsWithTimeout creates a new GetAPITimesheetsParams object
// with the ability to set a timeout on a request.
func NewGetAPITimesheetsParamsWithTimeout(timeout time.Duration) *GetAPITimesheetsParams {
return &GetAPITimesheetsParams{
timeout: timeout,
}
}
// NewGetAPITimesheetsParamsWithContext creates a new GetAPITimesheetsParams object
// with the ability to set a context for a request.
func NewGetAPITimesheetsParamsWithContext(ctx context.Context) *GetAPITimesheetsParams {
return &GetAPITimesheetsParams{
Context: ctx,
}
}
// NewGetAPITimesheetsParamsWithHTTPClient creates a new GetAPITimesheetsParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPITimesheetsParamsWithHTTPClient(client *http.Client) *GetAPITimesheetsParams {
return &GetAPITimesheetsParams{
HTTPClient: client,
}
}
/*
GetAPITimesheetsParams contains all the parameters to send to the API endpoint
for the get API timesheets operation.
Typically these are written to a http.Request.
*/
type GetAPITimesheetsParams struct {
/* Active.
Filter for running/active records. Allowed values: 0=stopped, 1=active (default: all)
*/
Active string
/* Activities.
Comma separated list of activity IDs to filter timesheets
*/
Activities string
/* Activity.
DEPRECATED: Activity ID to filter timesheets (will be removed with 2.0)
*/
Activity string
/* Begin.
Only records after this date will be included (format: HTML5)
Format: DateTime
*/
Begin string
/* Billable.
Filter for non-/billable records. Allowed values: 0=non-billable, 1=billable (default: all)
*/
Billable string
/* Customer.
DEPRECATED: Customer ID to filter timesheets (will be removed with 2.0)
*/
Customer string
/* Customers.
Comma separated list of customer IDs to filter timesheets
*/
Customers string
/* End.
Only records before this date will be included (format: HTML5)
Format: DateTime
*/
End string
/* Exported.
Use this flag if you want to filter for export state. Allowed values: 0=not exported, 1=exported (default: all)
*/
Exported string
/* Full.
Allows to fetch fully serialized objects including subresources. Allowed values: true (default: false)
*/
Full string
/* ModifiedAfter.
Only records changed after this date will be included (format: HTML5). Available since Kimai 1.10 and works only for records that were created/updated since then.
Format: DateTime
*/
ModifiedAfter string
/* Order.
The result order. Allowed values: ASC, DESC (default: DESC)
*/
Order string
/* OrderBy.
The field by which results will be ordered. Allowed values: id, begin, end, rate (default: begin)
*/
OrderBy string
/* Page.
The page to display, renders a 404 if not found (default: 1)
*/
Page string
/* Project.
DEPRECATED: Project ID to filter timesheets (will be removed with 2.0)
*/
Project string
/* Projects.
Comma separated list of project IDs to filter timesheets
*/
Projects string
/* Size.
The amount of entries for each page (default: 50)
*/
Size string
/* Tags.
Comma separated list of tag names
*/
Tags string
/* Term.
Free search term
*/
Term *string
/* User.
User ID to filter timesheets. Needs permission 'view_other_timesheet', pass 'all' to fetch data for all user (default: current user)
*/
User string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API timesheets params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPITimesheetsParams) WithDefaults() *GetAPITimesheetsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API timesheets params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPITimesheetsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API timesheets params
func (o *GetAPITimesheetsParams) WithTimeout(timeout time.Duration) *GetAPITimesheetsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API timesheets params
func (o *GetAPITimesheetsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API timesheets params
func (o *GetAPITimesheetsParams) WithContext(ctx context.Context) *GetAPITimesheetsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API timesheets params
func (o *GetAPITimesheetsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API timesheets params
func (o *GetAPITimesheetsParams) WithHTTPClient(client *http.Client) *GetAPITimesheetsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API timesheets params
func (o *GetAPITimesheetsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithActive adds the active to the get API timesheets params
func (o *GetAPITimesheetsParams) WithActive(active string) *GetAPITimesheetsParams {
o.SetActive(active)
return o
}
// SetActive adds the active to the get API timesheets params
func (o *GetAPITimesheetsParams) SetActive(active string) {
o.Active = active
}
// WithActivities adds the activities to the get API timesheets params
func (o *GetAPITimesheetsParams) WithActivities(activities string) *GetAPITimesheetsParams {
o.SetActivities(activities)
return o
}
// SetActivities adds the activities to the get API timesheets params
func (o *GetAPITimesheetsParams) SetActivities(activities string) {
o.Activities = activities
}
// WithActivity adds the activity to the get API timesheets params
func (o *GetAPITimesheetsParams) WithActivity(activity string) *GetAPITimesheetsParams {
o.SetActivity(activity)
return o
}
// SetActivity adds the activity to the get API timesheets params
func (o *GetAPITimesheetsParams) SetActivity(activity string) {
o.Activity = activity
}
// WithBegin adds the begin to the get API timesheets params
func (o *GetAPITimesheetsParams) WithBegin(begin string) *GetAPITimesheetsParams {
o.SetBegin(begin)
return o
}
// SetBegin adds the begin to the get API timesheets params
func (o *GetAPITimesheetsParams) SetBegin(begin string) {
o.Begin = begin
}
// WithBillable adds the billable to the get API timesheets params
func (o *GetAPITimesheetsParams) WithBillable(billable string) *GetAPITimesheetsParams {
o.SetBillable(billable)
return o
}
// SetBillable adds the billable to the get API timesheets params
func (o *GetAPITimesheetsParams) SetBillable(billable string) {
o.Billable = billable
}
// WithCustomer adds the customer to the get API timesheets params
func (o *GetAPITimesheetsParams) WithCustomer(customer string) *GetAPITimesheetsParams {
o.SetCustomer(customer)
return o
}
// SetCustomer adds the customer to the get API timesheets params
func (o *GetAPITimesheetsParams) SetCustomer(customer string) {
o.Customer = customer
}
// WithCustomers adds the customers to the get API timesheets params
func (o *GetAPITimesheetsParams) WithCustomers(customers string) *GetAPITimesheetsParams {
o.SetCustomers(customers)
return o
}
// SetCustomers adds the customers to the get API timesheets params
func (o *GetAPITimesheetsParams) SetCustomers(customers string) {
o.Customers = customers
}
// WithEnd adds the end to the get API timesheets params
func (o *GetAPITimesheetsParams) WithEnd(end string) *GetAPITimesheetsParams {
o.SetEnd(end)
return o
}
// SetEnd adds the end to the get API timesheets params
func (o *GetAPITimesheetsParams) SetEnd(end string) {
o.End = end
}
// WithExported adds the exported to the get API timesheets params
func (o *GetAPITimesheetsParams) WithExported(exported string) *GetAPITimesheetsParams {
o.SetExported(exported)
return o
}
// SetExported adds the exported to the get API timesheets params
func (o *GetAPITimesheetsParams) SetExported(exported string) {
o.Exported = exported
}
// WithFull adds the full to the get API timesheets params
func (o *GetAPITimesheetsParams) WithFull(full string) *GetAPITimesheetsParams {
o.SetFull(full)
return o
}
// SetFull adds the full to the get API timesheets params
func (o *GetAPITimesheetsParams) SetFull(full string) {
o.Full = full
}
// WithModifiedAfter adds the modifiedAfter to the get API timesheets params
func (o *GetAPITimesheetsParams) WithModifiedAfter(modifiedAfter string) *GetAPITimesheetsParams {
o.SetModifiedAfter(modifiedAfter)
return o
}
// SetModifiedAfter adds the modifiedAfter to the get API timesheets params
func (o *GetAPITimesheetsParams) SetModifiedAfter(modifiedAfter string) {
o.ModifiedAfter = modifiedAfter
}
// WithOrder adds the order to the get API timesheets params
func (o *GetAPITimesheetsParams) WithOrder(order string) *GetAPITimesheetsParams {
o.SetOrder(order)
return o
}
// SetOrder adds the order to the get API timesheets params
func (o *GetAPITimesheetsParams) SetOrder(order string) {
o.Order = order
}
// WithOrderBy adds the orderBy to the get API timesheets params
func (o *GetAPITimesheetsParams) WithOrderBy(orderBy string) *GetAPITimesheetsParams {
o.SetOrderBy(orderBy)
return o
}
// SetOrderBy adds the orderBy to the get API timesheets params
func (o *GetAPITimesheetsParams) SetOrderBy(orderBy string) {
o.OrderBy = orderBy
}
// WithPage adds the page to the get API timesheets params
func (o *GetAPITimesheetsParams) WithPage(page string) *GetAPITimesheetsParams {
o.SetPage(page)
return o
}
// SetPage adds the page to the get API timesheets params
func (o *GetAPITimesheetsParams) SetPage(page string) {
o.Page = page
}
// WithProject adds the project to the get API timesheets params
func (o *GetAPITimesheetsParams) WithProject(project string) *GetAPITimesheetsParams {
o.SetProject(project)
return o
}
// SetProject adds the project to the get API timesheets params
func (o *GetAPITimesheetsParams) SetProject(project string) {
o.Project = project
}
// WithProjects adds the projects to the get API timesheets params
func (o *GetAPITimesheetsParams) WithProjects(projects string) *GetAPITimesheetsParams {
o.SetProjects(projects)
return o
}
// SetProjects adds the projects to the get API timesheets params
func (o *GetAPITimesheetsParams) SetProjects(projects string) {
o.Projects = projects
}
// WithSize adds the size to the get API timesheets params
func (o *GetAPITimesheetsParams) WithSize(size string) *GetAPITimesheetsParams {
o.SetSize(size)
return o
}
// SetSize adds the size to the get API timesheets params
func (o *GetAPITimesheetsParams) SetSize(size string) {
o.Size = size
}
// WithTags adds the tags to the get API timesheets params
func (o *GetAPITimesheetsParams) WithTags(tags string) *GetAPITimesheetsParams {
o.SetTags(tags)
return o
}
// SetTags adds the tags to the get API timesheets params
func (o *GetAPITimesheetsParams) SetTags(tags string) {
o.Tags = tags
}
// WithTerm adds the term to the get API timesheets params
func (o *GetAPITimesheetsParams) WithTerm(term *string) *GetAPITimesheetsParams {
o.SetTerm(term)
return o
}
// SetTerm adds the term to the get API timesheets params
func (o *GetAPITimesheetsParams) SetTerm(term *string) {
o.Term = term
}
// WithUser adds the user to the get API timesheets params
func (o *GetAPITimesheetsParams) WithUser(user string) *GetAPITimesheetsParams {
o.SetUser(user)
return o
}
// SetUser adds the user to the get API timesheets params
func (o *GetAPITimesheetsParams) SetUser(user string) {
o.User = user
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPITimesheetsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// query param active
qrActive := o.Active
qActive := qrActive
if err := r.SetQueryParam("active", qActive); err != nil {
return err
}
// query param activities
qrActivities := o.Activities
qActivities := qrActivities
if err := r.SetQueryParam("activities", qActivities); err != nil {
return err
}
// query param activity
qrActivity := o.Activity
qActivity := qrActivity
if err := r.SetQueryParam("activity", qActivity); err != nil {
return err
}
// query param begin
qrBegin := o.Begin
qBegin := qrBegin
if err := r.SetQueryParam("begin", qBegin); err != nil {
return err
}
// query param billable
qrBillable := o.Billable
qBillable := qrBillable
if err := r.SetQueryParam("billable", qBillable); err != nil {
return err
}
// query param customer
qrCustomer := o.Customer
qCustomer := qrCustomer
if err := r.SetQueryParam("customer", qCustomer); err != nil {
return err
}
// query param customers
qrCustomers := o.Customers
qCustomers := qrCustomers
if err := r.SetQueryParam("customers", qCustomers); err != nil {
return err
}
// query param end
qrEnd := o.End
qEnd := qrEnd
if err := r.SetQueryParam("end", qEnd); err != nil {
return err
}
// query param exported
qrExported := o.Exported
qExported := qrExported
if err := r.SetQueryParam("exported", qExported); err != nil {
return err
}
// query param full
qrFull := o.Full
qFull := qrFull
if err := r.SetQueryParam("full", qFull); err != nil {
return err
}
// query param modified_after
qrModifiedAfter := o.ModifiedAfter
qModifiedAfter := qrModifiedAfter
if err := r.SetQueryParam("modified_after", qModifiedAfter); err != nil {
return err
}
// query param order
qrOrder := o.Order
qOrder := qrOrder
if err := r.SetQueryParam("order", qOrder); err != nil {
return err
}
// query param orderBy
qrOrderBy := o.OrderBy
qOrderBy := qrOrderBy
if err := r.SetQueryParam("orderBy", qOrderBy); err != nil {
return err
}
// query param page
qrPage := o.Page
qPage := qrPage
if err := r.SetQueryParam("page", qPage); err != nil {
return err
}
// query param project
qrProject := o.Project
qProject := qrProject
if err := r.SetQueryParam("project", qProject); err != nil {
return err
}
// query param projects
qrProjects := o.Projects
qProjects := qrProjects
if err := r.SetQueryParam("projects", qProjects); err != nil {
return err
}
// query param size
qrSize := o.Size
qSize := qrSize
if err := r.SetQueryParam("size", qSize); err != nil {
return err
}
// query param tags
qrTags := o.Tags
qTags := qrTags
if err := r.SetQueryParam("tags", qTags); err != nil {
return err
}
if o.Term != nil {
// query param term
var qrTerm string
if o.Term != nil {
qrTerm = *o.Term
}
qTerm := qrTerm
if qTerm != "" {
if err := r.SetQueryParam("term", qTerm); err != nil {
return err
}
}
}
// query param user
qrUser := o.User
qUser := qrUser
if err := r.SetQueryParam("user", qUser); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,206 @@
// Code generated by go-swagger; DO NOT EDIT.
package timesheet
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewGetAPITimesheetsRecentParams creates a new GetAPITimesheetsRecentParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetAPITimesheetsRecentParams() *GetAPITimesheetsRecentParams {
return &GetAPITimesheetsRecentParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPITimesheetsRecentParamsWithTimeout creates a new GetAPITimesheetsRecentParams object
// with the ability to set a timeout on a request.
func NewGetAPITimesheetsRecentParamsWithTimeout(timeout time.Duration) *GetAPITimesheetsRecentParams {
return &GetAPITimesheetsRecentParams{
timeout: timeout,
}
}
// NewGetAPITimesheetsRecentParamsWithContext creates a new GetAPITimesheetsRecentParams object
// with the ability to set a context for a request.
func NewGetAPITimesheetsRecentParamsWithContext(ctx context.Context) *GetAPITimesheetsRecentParams {
return &GetAPITimesheetsRecentParams{
Context: ctx,
}
}
// NewGetAPITimesheetsRecentParamsWithHTTPClient creates a new GetAPITimesheetsRecentParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPITimesheetsRecentParamsWithHTTPClient(client *http.Client) *GetAPITimesheetsRecentParams {
return &GetAPITimesheetsRecentParams{
HTTPClient: client,
}
}
/*
GetAPITimesheetsRecentParams contains all the parameters to send to the API endpoint
for the get API timesheets recent operation.
Typically these are written to a http.Request.
*/
type GetAPITimesheetsRecentParams struct {
/* Begin.
Only records after this date will be included. Default: today - 1 year (format: HTML5)
Format: DateTime
*/
Begin string
/* Size.
The amount of entries (default: 10)
*/
Size string
/* User.
User ID to filter timesheets. Needs permission 'view_other_timesheet', pass 'all' to fetch data for all user (default: current user)
*/
User string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API timesheets recent params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPITimesheetsRecentParams) WithDefaults() *GetAPITimesheetsRecentParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API timesheets recent params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPITimesheetsRecentParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) WithTimeout(timeout time.Duration) *GetAPITimesheetsRecentParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) WithContext(ctx context.Context) *GetAPITimesheetsRecentParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) WithHTTPClient(client *http.Client) *GetAPITimesheetsRecentParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBegin adds the begin to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) WithBegin(begin string) *GetAPITimesheetsRecentParams {
o.SetBegin(begin)
return o
}
// SetBegin adds the begin to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) SetBegin(begin string) {
o.Begin = begin
}
// WithSize adds the size to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) WithSize(size string) *GetAPITimesheetsRecentParams {
o.SetSize(size)
return o
}
// SetSize adds the size to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) SetSize(size string) {
o.Size = size
}
// WithUser adds the user to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) WithUser(user string) *GetAPITimesheetsRecentParams {
o.SetUser(user)
return o
}
// SetUser adds the user to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) SetUser(user string) {
o.User = user
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPITimesheetsRecentParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// query param begin
qrBegin := o.Begin
qBegin := qrBegin
if err := r.SetQueryParam("begin", qBegin); err != nil {
return err
}
// query param size
qrSize := o.Size
qSize := qrSize
if err := r.SetQueryParam("size", qSize); err != nil {
return err
}
// query param user
qrUser := o.User
qUser := qrUser
if err := r.SetQueryParam("user", qUser); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,165 @@
// Code generated by go-swagger; DO NOT EDIT.
package timesheet
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"fmt"
"io"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
"decentral1se/go-kimai/models"
)
// PatchAPITimesheetsIDRestartReader is a Reader for the PatchAPITimesheetsIDRestart structure.
type PatchAPITimesheetsIDRestartReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PatchAPITimesheetsIDRestartReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPatchAPITimesheetsIDRestartOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewPatchAPITimesheetsIDRestartOK creates a PatchAPITimesheetsIDRestartOK with default headers values
func NewPatchAPITimesheetsIDRestartOK() *PatchAPITimesheetsIDRestartOK {
return &PatchAPITimesheetsIDRestartOK{}
}
/*
PatchAPITimesheetsIDRestartOK describes a response with status code 200, with default header values.
Restarts a timesheet record for the same customer, project, activity combination. The current user will be the owner of the new record. Kimai tries to stop running records, which is expected to fail depending on the configured rules. Data will be copied from the original record if requested.
*/
type PatchAPITimesheetsIDRestartOK struct {
Payload *models.TimesheetEntity
}
// IsSuccess returns true when this patch Api timesheets Id restart o k response has a 2xx status code
func (o *PatchAPITimesheetsIDRestartOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this patch Api timesheets Id restart o k response has a 3xx status code
func (o *PatchAPITimesheetsIDRestartOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this patch Api timesheets Id restart o k response has a 4xx status code
func (o *PatchAPITimesheetsIDRestartOK) IsClientError() bool {
return false
}
// IsServerError returns true when this patch Api timesheets Id restart o k response has a 5xx status code
func (o *PatchAPITimesheetsIDRestartOK) IsServerError() bool {
return false
}
// IsCode returns true when this patch Api timesheets Id restart o k response a status code equal to that given
func (o *PatchAPITimesheetsIDRestartOK) IsCode(code int) bool {
return code == 200
}
func (o *PatchAPITimesheetsIDRestartOK) Error() string {
return fmt.Sprintf("[PATCH /api/timesheets/{id}/restart][%d] patchApiTimesheetsIdRestartOK %+v", 200, o.Payload)
}
func (o *PatchAPITimesheetsIDRestartOK) String() string {
return fmt.Sprintf("[PATCH /api/timesheets/{id}/restart][%d] patchApiTimesheetsIdRestartOK %+v", 200, o.Payload)
}
func (o *PatchAPITimesheetsIDRestartOK) GetPayload() *models.TimesheetEntity {
return o.Payload
}
func (o *PatchAPITimesheetsIDRestartOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.TimesheetEntity)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
/*
PatchAPITimesheetsIDRestartBody patch API timesheets ID restart body
swagger:model PatchAPITimesheetsIDRestartBody
*/
type PatchAPITimesheetsIDRestartBody struct {
// Changes the restart date to the given one (default: now)
Begin string `json:"begin,omitempty"`
// Whether data should be copied to the new entry. Allowed values: all, tags (deprecated), rates (deprecated), description (deprecated), meta (deprecated) (default: nothing is copied)
// Pattern: all|tags|rates|meta|description
Copy string `json:"copy,omitempty"`
}
// Validate validates this patch API timesheets ID restart body
func (o *PatchAPITimesheetsIDRestartBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateCopy(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *PatchAPITimesheetsIDRestartBody) validateCopy(formats strfmt.Registry) error {
if swag.IsZero(o.Copy) { // not required
return nil
}
if err := validate.Pattern("body"+"."+"copy", "body", o.Copy, `all|tags|rates|meta|description`); err != nil {
return err
}
return nil
}
// ContextValidate validates this patch API timesheets ID restart body based on context it is used
func (o *PatchAPITimesheetsIDRestartBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *PatchAPITimesheetsIDRestartBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *PatchAPITimesheetsIDRestartBody) UnmarshalBinary(b []byte) error {
var res PatchAPITimesheetsIDRestartBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,535 @@
// Code generated by go-swagger; DO NOT EDIT.
package timesheet
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new timesheet API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for timesheet API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods
type ClientService interface {
DeleteAPITimesheetsID(params *DeleteAPITimesheetsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITimesheetsIDNoContent, error)
GetAPITimesheets(params *GetAPITimesheetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsOK, error)
GetAPITimesheetsActive(params *GetAPITimesheetsActiveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsActiveOK, error)
GetAPITimesheetsID(params *GetAPITimesheetsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsIDOK, error)
GetAPITimesheetsRecent(params *GetAPITimesheetsRecentParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsRecentOK, error)
PatchAPITimesheetsID(params *PatchAPITimesheetsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDOK, error)
PatchAPITimesheetsIDDuplicate(params *PatchAPITimesheetsIDDuplicateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDDuplicateOK, error)
PatchAPITimesheetsIDExport(params *PatchAPITimesheetsIDExportParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDExportOK, error)
PatchAPITimesheetsIDMeta(params *PatchAPITimesheetsIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDMetaOK, error)
PatchAPITimesheetsIDRestart(params *PatchAPITimesheetsIDRestartParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDRestartOK, error)
PatchAPITimesheetsIDStop(params *PatchAPITimesheetsIDStopParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDStopOK, error)
PostAPITimesheets(params *PostAPITimesheetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITimesheetsOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
DeleteAPITimesheetsID deletes an existing timesheet record
*/
func (a *Client) DeleteAPITimesheetsID(params *DeleteAPITimesheetsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteAPITimesheetsIDNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteAPITimesheetsIDParams()
}
op := &runtime.ClientOperation{
ID: "DeleteAPITimesheetsID",
Method: "DELETE",
PathPattern: "/api/timesheets/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteAPITimesheetsIDReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DeleteAPITimesheetsIDNoContent)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for DeleteAPITimesheetsID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPITimesheets returns a collection of timesheet records
*/
func (a *Client) GetAPITimesheets(params *GetAPITimesheetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPITimesheetsParams()
}
op := &runtime.ClientOperation{
ID: "GetAPITimesheets",
Method: "GET",
PathPattern: "/api/timesheets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPITimesheetsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*GetAPITimesheetsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for GetAPITimesheets: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPITimesheetsActive returns the collection of active timesheet records
*/
func (a *Client) GetAPITimesheetsActive(params *GetAPITimesheetsActiveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsActiveOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPITimesheetsActiveParams()
}
op := &runtime.ClientOperation{
ID: "GetAPITimesheetsActive",
Method: "GET",
PathPattern: "/api/timesheets/active",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPITimesheetsActiveReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*GetAPITimesheetsActiveOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for GetAPITimesheetsActive: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPITimesheetsID returns one timesheet record
*/
func (a *Client) GetAPITimesheetsID(params *GetAPITimesheetsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPITimesheetsIDParams()
}
op := &runtime.ClientOperation{
ID: "GetAPITimesheetsID",
Method: "GET",
PathPattern: "/api/timesheets/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPITimesheetsIDReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*GetAPITimesheetsIDOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for GetAPITimesheetsID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetAPITimesheetsRecent returns the collection of recent user activities
*/
func (a *Client) GetAPITimesheetsRecent(params *GetAPITimesheetsRecentParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAPITimesheetsRecentOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetAPITimesheetsRecentParams()
}
op := &runtime.ClientOperation{
ID: "GetAPITimesheetsRecent",
Method: "GET",
PathPattern: "/api/timesheets/recent",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &GetAPITimesheetsRecentReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*GetAPITimesheetsRecentOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for GetAPITimesheetsRecent: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITimesheetsID updates an existing timesheet record
Update an existing timesheet record, you can pass all or just a subset of the attributes.
*/
func (a *Client) PatchAPITimesheetsID(params *PatchAPITimesheetsIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITimesheetsIDParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITimesheetsID",
Method: "PATCH",
PathPattern: "/api/timesheets/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITimesheetsIDReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PatchAPITimesheetsIDOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for PatchAPITimesheetsID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITimesheetsIDDuplicate duplicates an existing timesheet record
*/
func (a *Client) PatchAPITimesheetsIDDuplicate(params *PatchAPITimesheetsIDDuplicateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDDuplicateOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITimesheetsIDDuplicateParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITimesheetsIDDuplicate",
Method: "PATCH",
PathPattern: "/api/timesheets/{id}/duplicate",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITimesheetsIDDuplicateReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PatchAPITimesheetsIDDuplicateOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for PatchAPITimesheetsIDDuplicate: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITimesheetsIDExport switches the export state of a timesheet record to un lock it
*/
func (a *Client) PatchAPITimesheetsIDExport(params *PatchAPITimesheetsIDExportParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDExportOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITimesheetsIDExportParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITimesheetsIDExport",
Method: "PATCH",
PathPattern: "/api/timesheets/{id}/export",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITimesheetsIDExportReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PatchAPITimesheetsIDExportOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for PatchAPITimesheetsIDExport: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITimesheetsIDMeta sets the value of a meta field for an existing timesheet
*/
func (a *Client) PatchAPITimesheetsIDMeta(params *PatchAPITimesheetsIDMetaParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDMetaOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITimesheetsIDMetaParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITimesheetsIDMeta",
Method: "PATCH",
PathPattern: "/api/timesheets/{id}/meta",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITimesheetsIDMetaReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PatchAPITimesheetsIDMetaOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for PatchAPITimesheetsIDMeta: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITimesheetsIDRestart restarts a previously stopped timesheet record for the current user
*/
func (a *Client) PatchAPITimesheetsIDRestart(params *PatchAPITimesheetsIDRestartParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDRestartOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITimesheetsIDRestartParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITimesheetsIDRestart",
Method: "PATCH",
PathPattern: "/api/timesheets/{id}/restart",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITimesheetsIDRestartReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PatchAPITimesheetsIDRestartOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for PatchAPITimesheetsIDRestart: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchAPITimesheetsIDStop stops an active timesheet record
*/
func (a *Client) PatchAPITimesheetsIDStop(params *PatchAPITimesheetsIDStopParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchAPITimesheetsIDStopOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchAPITimesheetsIDStopParams()
}
op := &runtime.ClientOperation{
ID: "PatchAPITimesheetsIDStop",
Method: "PATCH",
PathPattern: "/api/timesheets/{id}/stop",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PatchAPITimesheetsIDStopReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PatchAPITimesheetsIDStopOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for PatchAPITimesheetsIDStop: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PostAPITimesheets creates a new timesheet record
Creates a new timesheet record for the current user and returns it afterwards.
*/
func (a *Client) PostAPITimesheets(params *PostAPITimesheetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PostAPITimesheetsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPostAPITimesheetsParams()
}
op := &runtime.ClientOperation{
ID: "PostAPITimesheets",
Method: "POST",
PathPattern: "/api/timesheets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &PostAPITimesheetsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PostAPITimesheetsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for PostAPITimesheets: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}