// Code generated by go-swagger; DO NOT EDIT. package organization // 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" ) // OrgCreateReader is a Reader for the OrgCreate structure. type OrgCreateReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *OrgCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 201: result := NewOrgCreateCreated() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 403: result := NewOrgCreateForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 422: result := NewOrgCreateUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result default: return nil, runtime.NewAPIError("[POST /orgs] orgCreate", response, response.Code()) } } // NewOrgCreateCreated creates a OrgCreateCreated with default headers values func NewOrgCreateCreated() *OrgCreateCreated { return &OrgCreateCreated{} } /* OrgCreateCreated describes a response with status code 201, with default header values. Organization */ type OrgCreateCreated struct { Payload *models.Organization } // IsSuccess returns true when this org create created response has a 2xx status code func (o *OrgCreateCreated) IsSuccess() bool { return true } // IsRedirect returns true when this org create created response has a 3xx status code func (o *OrgCreateCreated) IsRedirect() bool { return false } // IsClientError returns true when this org create created response has a 4xx status code func (o *OrgCreateCreated) IsClientError() bool { return false } // IsServerError returns true when this org create created response has a 5xx status code func (o *OrgCreateCreated) IsServerError() bool { return false } // IsCode returns true when this org create created response a status code equal to that given func (o *OrgCreateCreated) IsCode(code int) bool { return code == 201 } // Code gets the status code for the org create created response func (o *OrgCreateCreated) Code() int { return 201 } func (o *OrgCreateCreated) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /orgs][%d] orgCreateCreated %s", 201, payload) } func (o *OrgCreateCreated) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /orgs][%d] orgCreateCreated %s", 201, payload) } func (o *OrgCreateCreated) GetPayload() *models.Organization { return o.Payload } func (o *OrgCreateCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(models.Organization) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewOrgCreateForbidden creates a OrgCreateForbidden with default headers values func NewOrgCreateForbidden() *OrgCreateForbidden { return &OrgCreateForbidden{} } /* OrgCreateForbidden describes a response with status code 403, with default header values. APIForbiddenError is a forbidden error response */ type OrgCreateForbidden struct { Message string URL string } // IsSuccess returns true when this org create forbidden response has a 2xx status code func (o *OrgCreateForbidden) IsSuccess() bool { return false } // IsRedirect returns true when this org create forbidden response has a 3xx status code func (o *OrgCreateForbidden) IsRedirect() bool { return false } // IsClientError returns true when this org create forbidden response has a 4xx status code func (o *OrgCreateForbidden) IsClientError() bool { return true } // IsServerError returns true when this org create forbidden response has a 5xx status code func (o *OrgCreateForbidden) IsServerError() bool { return false } // IsCode returns true when this org create forbidden response a status code equal to that given func (o *OrgCreateForbidden) IsCode(code int) bool { return code == 403 } // Code gets the status code for the org create forbidden response func (o *OrgCreateForbidden) Code() int { return 403 } func (o *OrgCreateForbidden) Error() string { return fmt.Sprintf("[POST /orgs][%d] orgCreateForbidden", 403) } func (o *OrgCreateForbidden) String() string { return fmt.Sprintf("[POST /orgs][%d] orgCreateForbidden", 403) } func (o *OrgCreateForbidden) 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 } // NewOrgCreateUnprocessableEntity creates a OrgCreateUnprocessableEntity with default headers values func NewOrgCreateUnprocessableEntity() *OrgCreateUnprocessableEntity { return &OrgCreateUnprocessableEntity{} } /* OrgCreateUnprocessableEntity describes a response with status code 422, with default header values. APIValidationError is error format response related to input validation */ type OrgCreateUnprocessableEntity struct { Message string URL string } // IsSuccess returns true when this org create unprocessable entity response has a 2xx status code func (o *OrgCreateUnprocessableEntity) IsSuccess() bool { return false } // IsRedirect returns true when this org create unprocessable entity response has a 3xx status code func (o *OrgCreateUnprocessableEntity) IsRedirect() bool { return false } // IsClientError returns true when this org create unprocessable entity response has a 4xx status code func (o *OrgCreateUnprocessableEntity) IsClientError() bool { return true } // IsServerError returns true when this org create unprocessable entity response has a 5xx status code func (o *OrgCreateUnprocessableEntity) IsServerError() bool { return false } // IsCode returns true when this org create unprocessable entity response a status code equal to that given func (o *OrgCreateUnprocessableEntity) IsCode(code int) bool { return code == 422 } // Code gets the status code for the org create unprocessable entity response func (o *OrgCreateUnprocessableEntity) Code() int { return 422 } func (o *OrgCreateUnprocessableEntity) Error() string { return fmt.Sprintf("[POST /orgs][%d] orgCreateUnprocessableEntity", 422) } func (o *OrgCreateUnprocessableEntity) String() string { return fmt.Sprintf("[POST /orgs][%d] orgCreateUnprocessableEntity", 422) } func (o *OrgCreateUnprocessableEntity) 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 }