2023-01-14 14:14:06 +00:00
// 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"
2023-01-17 11:32:20 +00:00
"github.com/decentral1se/go-kimai/models"
2023-01-14 14:14:06 +00:00
)
// 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
}