go-kimai/client/project/patch_api_projects_id_meta_responses.go

177 lines
4.9 KiB
Go
Raw Normal View History

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