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