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

// UserUpdateOAuth2ApplicationReader is a Reader for the UserUpdateOAuth2Application structure.
type UserUpdateOAuth2ApplicationReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *UserUpdateOAuth2ApplicationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewUserUpdateOAuth2ApplicationOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 404:
		result := NewUserUpdateOAuth2ApplicationNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PATCH /user/applications/oauth2/{id}] userUpdateOAuth2Application", response, response.Code())
	}
}

// NewUserUpdateOAuth2ApplicationOK creates a UserUpdateOAuth2ApplicationOK with default headers values
func NewUserUpdateOAuth2ApplicationOK() *UserUpdateOAuth2ApplicationOK {
	return &UserUpdateOAuth2ApplicationOK{}
}

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

OAuth2Application
*/
type UserUpdateOAuth2ApplicationOK struct {
	Payload *models.OAuth2Application
}

// IsSuccess returns true when this user update o auth2 application o k response has a 2xx status code
func (o *UserUpdateOAuth2ApplicationOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this user update o auth2 application o k response has a 3xx status code
func (o *UserUpdateOAuth2ApplicationOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this user update o auth2 application o k response has a 4xx status code
func (o *UserUpdateOAuth2ApplicationOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this user update o auth2 application o k response has a 5xx status code
func (o *UserUpdateOAuth2ApplicationOK) IsServerError() bool {
	return false
}

// IsCode returns true when this user update o auth2 application o k response a status code equal to that given
func (o *UserUpdateOAuth2ApplicationOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the user update o auth2 application o k response
func (o *UserUpdateOAuth2ApplicationOK) Code() int {
	return 200
}

func (o *UserUpdateOAuth2ApplicationOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /user/applications/oauth2/{id}][%d] userUpdateOAuth2ApplicationOK %s", 200, payload)
}

func (o *UserUpdateOAuth2ApplicationOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /user/applications/oauth2/{id}][%d] userUpdateOAuth2ApplicationOK %s", 200, payload)
}

func (o *UserUpdateOAuth2ApplicationOK) GetPayload() *models.OAuth2Application {
	return o.Payload
}

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

	o.Payload = new(models.OAuth2Application)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewUserUpdateOAuth2ApplicationNotFound creates a UserUpdateOAuth2ApplicationNotFound with default headers values
func NewUserUpdateOAuth2ApplicationNotFound() *UserUpdateOAuth2ApplicationNotFound {
	return &UserUpdateOAuth2ApplicationNotFound{}
}

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

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

// IsSuccess returns true when this user update o auth2 application not found response has a 2xx status code
func (o *UserUpdateOAuth2ApplicationNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this user update o auth2 application not found response has a 3xx status code
func (o *UserUpdateOAuth2ApplicationNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this user update o auth2 application not found response has a 4xx status code
func (o *UserUpdateOAuth2ApplicationNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this user update o auth2 application not found response has a 5xx status code
func (o *UserUpdateOAuth2ApplicationNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this user update o auth2 application not found response a status code equal to that given
func (o *UserUpdateOAuth2ApplicationNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the user update o auth2 application not found response
func (o *UserUpdateOAuth2ApplicationNotFound) Code() int {
	return 404
}

func (o *UserUpdateOAuth2ApplicationNotFound) Error() string {
	return fmt.Sprintf("[PATCH /user/applications/oauth2/{id}][%d] userUpdateOAuth2ApplicationNotFound", 404)
}

func (o *UserUpdateOAuth2ApplicationNotFound) String() string {
	return fmt.Sprintf("[PATCH /user/applications/oauth2/{id}][%d] userUpdateOAuth2ApplicationNotFound", 404)
}

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

	return nil
}
