166 lines
5.3 KiB
Go
166 lines
5.3 KiB
Go
|
// 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
|
||
|
}
|