// Code generated by go-swagger; DO NOT EDIT.

package objects

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"encoding/json"
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	apiserver_params "github.com/cloudbase/garm/apiserver/params"
	garm_params "github.com/cloudbase/garm/params"
)

// ListFileObjectsReader is a Reader for the ListFileObjects structure.
type ListFileObjectsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ListFileObjectsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewListFileObjectsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewListFileObjectsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /objects] ListFileObjects", response, response.Code())
	}
}

// NewListFileObjectsOK creates a ListFileObjectsOK with default headers values
func NewListFileObjectsOK() *ListFileObjectsOK {
	return &ListFileObjectsOK{}
}

/*
ListFileObjectsOK describes a response with status code 200, with default header values.

FileObjectPaginatedResponse
*/
type ListFileObjectsOK struct {
	Payload garm_params.FileObjectPaginatedResponse
}

// IsSuccess returns true when this list file objects o k response has a 2xx status code
func (o *ListFileObjectsOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this list file objects o k response has a 3xx status code
func (o *ListFileObjectsOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this list file objects o k response has a 4xx status code
func (o *ListFileObjectsOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this list file objects o k response has a 5xx status code
func (o *ListFileObjectsOK) IsServerError() bool {
	return false
}

// IsCode returns true when this list file objects o k response a status code equal to that given
func (o *ListFileObjectsOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the list file objects o k response
func (o *ListFileObjectsOK) Code() int {
	return 200
}

func (o *ListFileObjectsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /objects][%d] listFileObjectsOK %s", 200, payload)
}

func (o *ListFileObjectsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /objects][%d] listFileObjectsOK %s", 200, payload)
}

func (o *ListFileObjectsOK) GetPayload() garm_params.FileObjectPaginatedResponse {
	return o.Payload
}

func (o *ListFileObjectsOK) 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
}

// NewListFileObjectsBadRequest creates a ListFileObjectsBadRequest with default headers values
func NewListFileObjectsBadRequest() *ListFileObjectsBadRequest {
	return &ListFileObjectsBadRequest{}
}

/*
ListFileObjectsBadRequest describes a response with status code 400, with default header values.

APIErrorResponse
*/
type ListFileObjectsBadRequest struct {
	Payload apiserver_params.APIErrorResponse
}

// IsSuccess returns true when this list file objects bad request response has a 2xx status code
func (o *ListFileObjectsBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this list file objects bad request response has a 3xx status code
func (o *ListFileObjectsBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this list file objects bad request response has a 4xx status code
func (o *ListFileObjectsBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this list file objects bad request response has a 5xx status code
func (o *ListFileObjectsBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this list file objects bad request response a status code equal to that given
func (o *ListFileObjectsBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the list file objects bad request response
func (o *ListFileObjectsBadRequest) Code() int {
	return 400
}

func (o *ListFileObjectsBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /objects][%d] listFileObjectsBadRequest %s", 400, payload)
}

func (o *ListFileObjectsBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /objects][%d] listFileObjectsBadRequest %s", 400, payload)
}

func (o *ListFileObjectsBadRequest) GetPayload() apiserver_params.APIErrorResponse {
	return o.Payload
}

func (o *ListFileObjectsBadRequest) 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
}
