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

package repository

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

// UserCurrentPutSubscriptionReader is a Reader for the UserCurrentPutSubscription structure.
type UserCurrentPutSubscriptionReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *UserCurrentPutSubscriptionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewUserCurrentPutSubscriptionOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewUserCurrentPutSubscriptionForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewUserCurrentPutSubscriptionNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /repos/{owner}/{repo}/subscription] userCurrentPutSubscription", response, response.Code())
	}
}

// NewUserCurrentPutSubscriptionOK creates a UserCurrentPutSubscriptionOK with default headers values
func NewUserCurrentPutSubscriptionOK() *UserCurrentPutSubscriptionOK {
	return &UserCurrentPutSubscriptionOK{}
}

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

WatchInfo
*/
type UserCurrentPutSubscriptionOK struct {
	Payload *models.WatchInfo
}

// IsSuccess returns true when this user current put subscription o k response has a 2xx status code
func (o *UserCurrentPutSubscriptionOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this user current put subscription o k response has a 3xx status code
func (o *UserCurrentPutSubscriptionOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this user current put subscription o k response has a 4xx status code
func (o *UserCurrentPutSubscriptionOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this user current put subscription o k response has a 5xx status code
func (o *UserCurrentPutSubscriptionOK) IsServerError() bool {
	return false
}

// IsCode returns true when this user current put subscription o k response a status code equal to that given
func (o *UserCurrentPutSubscriptionOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the user current put subscription o k response
func (o *UserCurrentPutSubscriptionOK) Code() int {
	return 200
}

func (o *UserCurrentPutSubscriptionOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/subscription][%d] userCurrentPutSubscriptionOK %s", 200, payload)
}

func (o *UserCurrentPutSubscriptionOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/subscription][%d] userCurrentPutSubscriptionOK %s", 200, payload)
}

func (o *UserCurrentPutSubscriptionOK) GetPayload() *models.WatchInfo {
	return o.Payload
}

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

	o.Payload = new(models.WatchInfo)

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

	return nil
}

// NewUserCurrentPutSubscriptionForbidden creates a UserCurrentPutSubscriptionForbidden with default headers values
func NewUserCurrentPutSubscriptionForbidden() *UserCurrentPutSubscriptionForbidden {
	return &UserCurrentPutSubscriptionForbidden{}
}

/*
UserCurrentPutSubscriptionForbidden describes a response with status code 403, with default header values.

APIForbiddenError is a forbidden error response
*/
type UserCurrentPutSubscriptionForbidden struct {
	Message string
	URL     string
}

// IsSuccess returns true when this user current put subscription forbidden response has a 2xx status code
func (o *UserCurrentPutSubscriptionForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this user current put subscription forbidden response has a 3xx status code
func (o *UserCurrentPutSubscriptionForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this user current put subscription forbidden response has a 4xx status code
func (o *UserCurrentPutSubscriptionForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this user current put subscription forbidden response has a 5xx status code
func (o *UserCurrentPutSubscriptionForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this user current put subscription forbidden response a status code equal to that given
func (o *UserCurrentPutSubscriptionForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the user current put subscription forbidden response
func (o *UserCurrentPutSubscriptionForbidden) Code() int {
	return 403
}

func (o *UserCurrentPutSubscriptionForbidden) Error() string {
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/subscription][%d] userCurrentPutSubscriptionForbidden", 403)
}

func (o *UserCurrentPutSubscriptionForbidden) String() string {
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/subscription][%d] userCurrentPutSubscriptionForbidden", 403)
}

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

// NewUserCurrentPutSubscriptionNotFound creates a UserCurrentPutSubscriptionNotFound with default headers values
func NewUserCurrentPutSubscriptionNotFound() *UserCurrentPutSubscriptionNotFound {
	return &UserCurrentPutSubscriptionNotFound{}
}

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

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

// IsSuccess returns true when this user current put subscription not found response has a 2xx status code
func (o *UserCurrentPutSubscriptionNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this user current put subscription not found response has a 3xx status code
func (o *UserCurrentPutSubscriptionNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this user current put subscription not found response has a 4xx status code
func (o *UserCurrentPutSubscriptionNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this user current put subscription not found response has a 5xx status code
func (o *UserCurrentPutSubscriptionNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this user current put subscription not found response a status code equal to that given
func (o *UserCurrentPutSubscriptionNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the user current put subscription not found response
func (o *UserCurrentPutSubscriptionNotFound) Code() int {
	return 404
}

func (o *UserCurrentPutSubscriptionNotFound) Error() string {
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/subscription][%d] userCurrentPutSubscriptionNotFound", 404)
}

func (o *UserCurrentPutSubscriptionNotFound) String() string {
	return fmt.Sprintf("[PUT /repos/{owner}/{repo}/subscription][%d] userCurrentPutSubscriptionNotFound", 404)
}

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

	return nil
}
