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

package user

// 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"

	"src.opensuse.org/autogits/common/gitea-generated/models"
)

// GetUserVariablesListReader is a Reader for the GetUserVariablesList structure.
type GetUserVariablesListReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetUserVariablesListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetUserVariablesListOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetUserVariablesListBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetUserVariablesListNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /user/actions/variables] getUserVariablesList", response, response.Code())
	}
}

// NewGetUserVariablesListOK creates a GetUserVariablesListOK with default headers values
func NewGetUserVariablesListOK() *GetUserVariablesListOK {
	return &GetUserVariablesListOK{}
}

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

VariableList
*/
type GetUserVariablesListOK struct {
	Payload []*models.ActionVariable
}

// IsSuccess returns true when this get user variables list o k response has a 2xx status code
func (o *GetUserVariablesListOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this get user variables list o k response has a 3xx status code
func (o *GetUserVariablesListOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get user variables list o k response has a 4xx status code
func (o *GetUserVariablesListOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this get user variables list o k response has a 5xx status code
func (o *GetUserVariablesListOK) IsServerError() bool {
	return false
}

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

// Code gets the status code for the get user variables list o k response
func (o *GetUserVariablesListOK) Code() int {
	return 200
}

func (o *GetUserVariablesListOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /user/actions/variables][%d] getUserVariablesListOK %s", 200, payload)
}

func (o *GetUserVariablesListOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /user/actions/variables][%d] getUserVariablesListOK %s", 200, payload)
}

func (o *GetUserVariablesListOK) GetPayload() []*models.ActionVariable {
	return o.Payload
}

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

// NewGetUserVariablesListBadRequest creates a GetUserVariablesListBadRequest with default headers values
func NewGetUserVariablesListBadRequest() *GetUserVariablesListBadRequest {
	return &GetUserVariablesListBadRequest{}
}

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

APIError is error format response
*/
type GetUserVariablesListBadRequest struct {
	Message string
	URL     string
}

// IsSuccess returns true when this get user variables list bad request response has a 2xx status code
func (o *GetUserVariablesListBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get user variables list bad request response has a 3xx status code
func (o *GetUserVariablesListBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get user variables list bad request response has a 4xx status code
func (o *GetUserVariablesListBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this get user variables list bad request response has a 5xx status code
func (o *GetUserVariablesListBadRequest) IsServerError() bool {
	return false
}

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

// Code gets the status code for the get user variables list bad request response
func (o *GetUserVariablesListBadRequest) Code() int {
	return 400
}

func (o *GetUserVariablesListBadRequest) Error() string {
	return fmt.Sprintf("[GET /user/actions/variables][%d] getUserVariablesListBadRequest", 400)
}

func (o *GetUserVariablesListBadRequest) String() string {
	return fmt.Sprintf("[GET /user/actions/variables][%d] getUserVariablesListBadRequest", 400)
}

func (o *GetUserVariablesListBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// hydrates response header message
	hdrMessage := response.GetHeader("message")

	if hdrMessage != "" {
		o.Message = hdrMessage
	}

	// hydrates response header url
	hdrURL := response.GetHeader("url")

	if hdrURL != "" {
		o.URL = hdrURL
	}

	return nil
}

// NewGetUserVariablesListNotFound creates a GetUserVariablesListNotFound with default headers values
func NewGetUserVariablesListNotFound() *GetUserVariablesListNotFound {
	return &GetUserVariablesListNotFound{}
}

/*
GetUserVariablesListNotFound describes a response with status code 404, with default header values.

APINotFound is a not found empty response
*/
type GetUserVariablesListNotFound struct {
}

// IsSuccess returns true when this get user variables list not found response has a 2xx status code
func (o *GetUserVariablesListNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get user variables list not found response has a 3xx status code
func (o *GetUserVariablesListNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get user variables list not found response has a 4xx status code
func (o *GetUserVariablesListNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this get user variables list not found response has a 5xx status code
func (o *GetUserVariablesListNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this get user variables list not found response a status code equal to that given
func (o *GetUserVariablesListNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the get user variables list not found response
func (o *GetUserVariablesListNotFound) Code() int {
	return 404
}

func (o *GetUserVariablesListNotFound) Error() string {
	return fmt.Sprintf("[GET /user/actions/variables][%d] getUserVariablesListNotFound", 404)
}

func (o *GetUserVariablesListNotFound) String() string {
	return fmt.Sprintf("[GET /user/actions/variables][%d] getUserVariablesListNotFound", 404)
}

func (o *GetUserVariablesListNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	return nil
}
