// 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 ( "fmt" "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // RepoAddTopicReader is a Reader for the RepoAddTopic structure. type RepoAddTopicReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *RepoAddTopicReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 204: result := NewRepoAddTopicNoContent() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 404: result := NewRepoAddTopicNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 422: result := NewRepoAddTopicUnprocessableEntity() 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}/topics/{topic}] repoAddTopic", response, response.Code()) } } // NewRepoAddTopicNoContent creates a RepoAddTopicNoContent with default headers values func NewRepoAddTopicNoContent() *RepoAddTopicNoContent { return &RepoAddTopicNoContent{} } /* RepoAddTopicNoContent describes a response with status code 204, with default header values. APIEmpty is an empty response */ type RepoAddTopicNoContent struct { } // IsSuccess returns true when this repo add topic no content response has a 2xx status code func (o *RepoAddTopicNoContent) IsSuccess() bool { return true } // IsRedirect returns true when this repo add topic no content response has a 3xx status code func (o *RepoAddTopicNoContent) IsRedirect() bool { return false } // IsClientError returns true when this repo add topic no content response has a 4xx status code func (o *RepoAddTopicNoContent) IsClientError() bool { return false } // IsServerError returns true when this repo add topic no content response has a 5xx status code func (o *RepoAddTopicNoContent) IsServerError() bool { return false } // IsCode returns true when this repo add topic no content response a status code equal to that given func (o *RepoAddTopicNoContent) IsCode(code int) bool { return code == 204 } // Code gets the status code for the repo add topic no content response func (o *RepoAddTopicNoContent) Code() int { return 204 } func (o *RepoAddTopicNoContent) Error() string { return fmt.Sprintf("[PUT /repos/{owner}/{repo}/topics/{topic}][%d] repoAddTopicNoContent", 204) } func (o *RepoAddTopicNoContent) String() string { return fmt.Sprintf("[PUT /repos/{owner}/{repo}/topics/{topic}][%d] repoAddTopicNoContent", 204) } func (o *RepoAddTopicNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { return nil } // NewRepoAddTopicNotFound creates a RepoAddTopicNotFound with default headers values func NewRepoAddTopicNotFound() *RepoAddTopicNotFound { return &RepoAddTopicNotFound{} } /* RepoAddTopicNotFound describes a response with status code 404, with default header values. APINotFound is a not found empty response */ type RepoAddTopicNotFound struct { } // IsSuccess returns true when this repo add topic not found response has a 2xx status code func (o *RepoAddTopicNotFound) IsSuccess() bool { return false } // IsRedirect returns true when this repo add topic not found response has a 3xx status code func (o *RepoAddTopicNotFound) IsRedirect() bool { return false } // IsClientError returns true when this repo add topic not found response has a 4xx status code func (o *RepoAddTopicNotFound) IsClientError() bool { return true } // IsServerError returns true when this repo add topic not found response has a 5xx status code func (o *RepoAddTopicNotFound) IsServerError() bool { return false } // IsCode returns true when this repo add topic not found response a status code equal to that given func (o *RepoAddTopicNotFound) IsCode(code int) bool { return code == 404 } // Code gets the status code for the repo add topic not found response func (o *RepoAddTopicNotFound) Code() int { return 404 } func (o *RepoAddTopicNotFound) Error() string { return fmt.Sprintf("[PUT /repos/{owner}/{repo}/topics/{topic}][%d] repoAddTopicNotFound", 404) } func (o *RepoAddTopicNotFound) String() string { return fmt.Sprintf("[PUT /repos/{owner}/{repo}/topics/{topic}][%d] repoAddTopicNotFound", 404) } func (o *RepoAddTopicNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { return nil } // NewRepoAddTopicUnprocessableEntity creates a RepoAddTopicUnprocessableEntity with default headers values func NewRepoAddTopicUnprocessableEntity() *RepoAddTopicUnprocessableEntity { return &RepoAddTopicUnprocessableEntity{} } /* RepoAddTopicUnprocessableEntity describes a response with status code 422, with default header values. APIInvalidTopicsError is error format response to invalid topics */ type RepoAddTopicUnprocessableEntity struct { InvalidTopics []string Message string } // IsSuccess returns true when this repo add topic unprocessable entity response has a 2xx status code func (o *RepoAddTopicUnprocessableEntity) IsSuccess() bool { return false } // IsRedirect returns true when this repo add topic unprocessable entity response has a 3xx status code func (o *RepoAddTopicUnprocessableEntity) IsRedirect() bool { return false } // IsClientError returns true when this repo add topic unprocessable entity response has a 4xx status code func (o *RepoAddTopicUnprocessableEntity) IsClientError() bool { return true } // IsServerError returns true when this repo add topic unprocessable entity response has a 5xx status code func (o *RepoAddTopicUnprocessableEntity) IsServerError() bool { return false } // IsCode returns true when this repo add topic unprocessable entity response a status code equal to that given func (o *RepoAddTopicUnprocessableEntity) IsCode(code int) bool { return code == 422 } // Code gets the status code for the repo add topic unprocessable entity response func (o *RepoAddTopicUnprocessableEntity) Code() int { return 422 } func (o *RepoAddTopicUnprocessableEntity) Error() string { return fmt.Sprintf("[PUT /repos/{owner}/{repo}/topics/{topic}][%d] repoAddTopicUnprocessableEntity", 422) } func (o *RepoAddTopicUnprocessableEntity) String() string { return fmt.Sprintf("[PUT /repos/{owner}/{repo}/topics/{topic}][%d] repoAddTopicUnprocessableEntity", 422) } func (o *RepoAddTopicUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { // hydrates response header invalidTopics hdrInvalidTopics := response.GetHeader("invalidTopics") if hdrInvalidTopics != "" { // binding header items for invalidTopics valInvalidTopics, err := o.bindHeaderInvalidTopics(hdrInvalidTopics, formats) if err != nil { return err } o.InvalidTopics = valInvalidTopics } // hydrates response header message hdrMessage := response.GetHeader("message") if hdrMessage != "" { o.Message = hdrMessage } return nil } // bindHeaderRepoAddTopicUnprocessableEntity binds the response header invalidTopics func (o *RepoAddTopicUnprocessableEntity) bindHeaderInvalidTopics(hdr string, formats strfmt.Registry) ([]string, error) { invalidTopicsIV := hdr var ( invalidTopicsIC []string ) // items.CollectionFormat: "" invalidTopicsIR := swag.SplitByFormat(invalidTopicsIV, "") for _, invalidTopicsIIV := range invalidTopicsIR { // convert split string to string invalidTopicsIIC := invalidTopicsIIV // string as string invalidTopicsIC = append(invalidTopicsIC, invalidTopicsIIC) // roll-up string into []string } return invalidTopicsIC, nil }