// 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" ) // CreateForkReader is a Reader for the CreateFork structure. type CreateForkReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *CreateForkReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 202: result := NewCreateForkAccepted() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 403: result := NewCreateForkForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 404: result := NewCreateForkNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 409: result := NewCreateForkConflict() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 422: result := NewCreateForkUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result default: return nil, runtime.NewAPIError("[POST /repos/{owner}/{repo}/forks] createFork", response, response.Code()) } } // NewCreateForkAccepted creates a CreateForkAccepted with default headers values func NewCreateForkAccepted() *CreateForkAccepted { return &CreateForkAccepted{} } /* CreateForkAccepted describes a response with status code 202, with default header values. Repository */ type CreateForkAccepted struct { Payload *models.Repository } // IsSuccess returns true when this create fork accepted response has a 2xx status code func (o *CreateForkAccepted) IsSuccess() bool { return true } // IsRedirect returns true when this create fork accepted response has a 3xx status code func (o *CreateForkAccepted) IsRedirect() bool { return false } // IsClientError returns true when this create fork accepted response has a 4xx status code func (o *CreateForkAccepted) IsClientError() bool { return false } // IsServerError returns true when this create fork accepted response has a 5xx status code func (o *CreateForkAccepted) IsServerError() bool { return false } // IsCode returns true when this create fork accepted response a status code equal to that given func (o *CreateForkAccepted) IsCode(code int) bool { return code == 202 } // Code gets the status code for the create fork accepted response func (o *CreateForkAccepted) Code() int { return 202 } func (o *CreateForkAccepted) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkAccepted %s", 202, payload) } func (o *CreateForkAccepted) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkAccepted %s", 202, payload) } func (o *CreateForkAccepted) GetPayload() *models.Repository { return o.Payload } func (o *CreateForkAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(models.Repository) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewCreateForkForbidden creates a CreateForkForbidden with default headers values func NewCreateForkForbidden() *CreateForkForbidden { return &CreateForkForbidden{} } /* CreateForkForbidden describes a response with status code 403, with default header values. APIForbiddenError is a forbidden error response */ type CreateForkForbidden struct { Message string URL string } // IsSuccess returns true when this create fork forbidden response has a 2xx status code func (o *CreateForkForbidden) IsSuccess() bool { return false } // IsRedirect returns true when this create fork forbidden response has a 3xx status code func (o *CreateForkForbidden) IsRedirect() bool { return false } // IsClientError returns true when this create fork forbidden response has a 4xx status code func (o *CreateForkForbidden) IsClientError() bool { return true } // IsServerError returns true when this create fork forbidden response has a 5xx status code func (o *CreateForkForbidden) IsServerError() bool { return false } // IsCode returns true when this create fork forbidden response a status code equal to that given func (o *CreateForkForbidden) IsCode(code int) bool { return code == 403 } // Code gets the status code for the create fork forbidden response func (o *CreateForkForbidden) Code() int { return 403 } func (o *CreateForkForbidden) Error() string { return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkForbidden", 403) } func (o *CreateForkForbidden) String() string { return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkForbidden", 403) } func (o *CreateForkForbidden) 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 } // NewCreateForkNotFound creates a CreateForkNotFound with default headers values func NewCreateForkNotFound() *CreateForkNotFound { return &CreateForkNotFound{} } /* CreateForkNotFound describes a response with status code 404, with default header values. APINotFound is a not found empty response */ type CreateForkNotFound struct { } // IsSuccess returns true when this create fork not found response has a 2xx status code func (o *CreateForkNotFound) IsSuccess() bool { return false } // IsRedirect returns true when this create fork not found response has a 3xx status code func (o *CreateForkNotFound) IsRedirect() bool { return false } // IsClientError returns true when this create fork not found response has a 4xx status code func (o *CreateForkNotFound) IsClientError() bool { return true } // IsServerError returns true when this create fork not found response has a 5xx status code func (o *CreateForkNotFound) IsServerError() bool { return false } // IsCode returns true when this create fork not found response a status code equal to that given func (o *CreateForkNotFound) IsCode(code int) bool { return code == 404 } // Code gets the status code for the create fork not found response func (o *CreateForkNotFound) Code() int { return 404 } func (o *CreateForkNotFound) Error() string { return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkNotFound", 404) } func (o *CreateForkNotFound) String() string { return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkNotFound", 404) } func (o *CreateForkNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { return nil } // NewCreateForkConflict creates a CreateForkConflict with default headers values func NewCreateForkConflict() *CreateForkConflict { return &CreateForkConflict{} } /* CreateForkConflict describes a response with status code 409, with default header values. The repository with the same name already exists. */ type CreateForkConflict struct { } // IsSuccess returns true when this create fork conflict response has a 2xx status code func (o *CreateForkConflict) IsSuccess() bool { return false } // IsRedirect returns true when this create fork conflict response has a 3xx status code func (o *CreateForkConflict) IsRedirect() bool { return false } // IsClientError returns true when this create fork conflict response has a 4xx status code func (o *CreateForkConflict) IsClientError() bool { return true } // IsServerError returns true when this create fork conflict response has a 5xx status code func (o *CreateForkConflict) IsServerError() bool { return false } // IsCode returns true when this create fork conflict response a status code equal to that given func (o *CreateForkConflict) IsCode(code int) bool { return code == 409 } // Code gets the status code for the create fork conflict response func (o *CreateForkConflict) Code() int { return 409 } func (o *CreateForkConflict) Error() string { return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkConflict", 409) } func (o *CreateForkConflict) String() string { return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkConflict", 409) } func (o *CreateForkConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { return nil } // NewCreateForkUnprocessableEntity creates a CreateForkUnprocessableEntity with default headers values func NewCreateForkUnprocessableEntity() *CreateForkUnprocessableEntity { return &CreateForkUnprocessableEntity{} } /* CreateForkUnprocessableEntity describes a response with status code 422, with default header values. APIValidationError is error format response related to input validation */ type CreateForkUnprocessableEntity struct { Message string URL string } // IsSuccess returns true when this create fork unprocessable entity response has a 2xx status code func (o *CreateForkUnprocessableEntity) IsSuccess() bool { return false } // IsRedirect returns true when this create fork unprocessable entity response has a 3xx status code func (o *CreateForkUnprocessableEntity) IsRedirect() bool { return false } // IsClientError returns true when this create fork unprocessable entity response has a 4xx status code func (o *CreateForkUnprocessableEntity) IsClientError() bool { return true } // IsServerError returns true when this create fork unprocessable entity response has a 5xx status code func (o *CreateForkUnprocessableEntity) IsServerError() bool { return false } // IsCode returns true when this create fork unprocessable entity response a status code equal to that given func (o *CreateForkUnprocessableEntity) IsCode(code int) bool { return code == 422 } // Code gets the status code for the create fork unprocessable entity response func (o *CreateForkUnprocessableEntity) Code() int { return 422 } func (o *CreateForkUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkUnprocessableEntity", 422) } func (o *CreateForkUnprocessableEntity) String() string { return fmt.Sprintf("[POST /repos/{owner}/{repo}/forks][%d] createForkUnprocessableEntity", 422) } func (o *CreateForkUnprocessableEntity) 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 }