// Code generated by go-swagger; DO NOT EDIT. // (c) 2012-2020 by Taxnexus, Inc. // All rights reserved worldwide. // Proprietary product; unlicensed use is not allowed package enrollments import ( "encoding/json" stderrors "errors" "fmt" "io" "code.tnxs.net/vernonkeenan/lib/api/members/members_models" "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" ) // PostEnrollmentsReader is a Reader for the PostEnrollments structure. type PostEnrollmentsReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *PostEnrollmentsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) { switch response.Code() { case 200: result := NewPostEnrollmentsOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 401: result := NewPostEnrollmentsUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 403: result := NewPostEnrollmentsForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 404: result := NewPostEnrollmentsNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 422: result := NewPostEnrollmentsUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 500: result := NewPostEnrollmentsInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result default: return nil, runtime.NewAPIError("[POST /enrollments] postEnrollments", response, response.Code()) } } // NewPostEnrollmentsOK creates a PostEnrollmentsOK with default headers values func NewPostEnrollmentsOK() *PostEnrollmentsOK { return &PostEnrollmentsOK{} } // PostEnrollmentsOK describes a response with status code 200, with default header values. // // Enrollment Response Object type PostEnrollmentsOK struct { Payload *members_models.EnrollmentResponse } // IsSuccess returns true when this post enrollments o k response has a 2xx status code func (o *PostEnrollmentsOK) IsSuccess() bool { return true } // IsRedirect returns true when this post enrollments o k response has a 3xx status code func (o *PostEnrollmentsOK) IsRedirect() bool { return false } // IsClientError returns true when this post enrollments o k response has a 4xx status code func (o *PostEnrollmentsOK) IsClientError() bool { return false } // IsServerError returns true when this post enrollments o k response has a 5xx status code func (o *PostEnrollmentsOK) IsServerError() bool { return false } // IsCode returns true when this post enrollments o k response a status code equal to that given func (o *PostEnrollmentsOK) IsCode(code int) bool { return code == 200 } // Code gets the status code for the post enrollments o k response func (o *PostEnrollmentsOK) Code() int { return 200 } func (o *PostEnrollmentsOK) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /enrollments][%d] postEnrollmentsOK %s", 200, payload) } func (o *PostEnrollmentsOK) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /enrollments][%d] postEnrollmentsOK %s", 200, payload) } func (o *PostEnrollmentsOK) GetPayload() *members_models.EnrollmentResponse { return o.Payload } func (o *PostEnrollmentsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(members_models.EnrollmentResponse) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { return err } return nil } // NewPostEnrollmentsUnauthorized creates a PostEnrollmentsUnauthorized with default headers values func NewPostEnrollmentsUnauthorized() *PostEnrollmentsUnauthorized { return &PostEnrollmentsUnauthorized{} } // PostEnrollmentsUnauthorized describes a response with status code 401, with default header values. // // Access Unauthorized, invalid API-KEY was used type PostEnrollmentsUnauthorized struct { Payload *members_models.Error } // IsSuccess returns true when this post enrollments unauthorized response has a 2xx status code func (o *PostEnrollmentsUnauthorized) IsSuccess() bool { return false } // IsRedirect returns true when this post enrollments unauthorized response has a 3xx status code func (o *PostEnrollmentsUnauthorized) IsRedirect() bool { return false } // IsClientError returns true when this post enrollments unauthorized response has a 4xx status code func (o *PostEnrollmentsUnauthorized) IsClientError() bool { return true } // IsServerError returns true when this post enrollments unauthorized response has a 5xx status code func (o *PostEnrollmentsUnauthorized) IsServerError() bool { return false } // IsCode returns true when this post enrollments unauthorized response a status code equal to that given func (o *PostEnrollmentsUnauthorized) IsCode(code int) bool { return code == 401 } // Code gets the status code for the post enrollments unauthorized response func (o *PostEnrollmentsUnauthorized) Code() int { return 401 } func (o *PostEnrollmentsUnauthorized) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /enrollments][%d] postEnrollmentsUnauthorized %s", 401, payload) } func (o *PostEnrollmentsUnauthorized) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /enrollments][%d] postEnrollmentsUnauthorized %s", 401, payload) } func (o *PostEnrollmentsUnauthorized) GetPayload() *members_models.Error { return o.Payload } func (o *PostEnrollmentsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(members_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { return err } return nil } // NewPostEnrollmentsForbidden creates a PostEnrollmentsForbidden with default headers values func NewPostEnrollmentsForbidden() *PostEnrollmentsForbidden { return &PostEnrollmentsForbidden{} } // PostEnrollmentsForbidden describes a response with status code 403, with default header values. // // Access forbidden, account lacks access type PostEnrollmentsForbidden struct { AccessControlAllowOrigin string Payload *members_models.Error } // IsSuccess returns true when this post enrollments forbidden response has a 2xx status code func (o *PostEnrollmentsForbidden) IsSuccess() bool { return false } // IsRedirect returns true when this post enrollments forbidden response has a 3xx status code func (o *PostEnrollmentsForbidden) IsRedirect() bool { return false } // IsClientError returns true when this post enrollments forbidden response has a 4xx status code func (o *PostEnrollmentsForbidden) IsClientError() bool { return true } // IsServerError returns true when this post enrollments forbidden response has a 5xx status code func (o *PostEnrollmentsForbidden) IsServerError() bool { return false } // IsCode returns true when this post enrollments forbidden response a status code equal to that given func (o *PostEnrollmentsForbidden) IsCode(code int) bool { return code == 403 } // Code gets the status code for the post enrollments forbidden response func (o *PostEnrollmentsForbidden) Code() int { return 403 } func (o *PostEnrollmentsForbidden) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /enrollments][%d] postEnrollmentsForbidden %s", 403, payload) } func (o *PostEnrollmentsForbidden) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /enrollments][%d] postEnrollmentsForbidden %s", 403, payload) } func (o *PostEnrollmentsForbidden) GetPayload() *members_models.Error { return o.Payload } func (o *PostEnrollmentsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { // hydrates response header Access-Control-Allow-Origin hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin") if hdrAccessControlAllowOrigin != "" { o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin } o.Payload = new(members_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { return err } return nil } // NewPostEnrollmentsNotFound creates a PostEnrollmentsNotFound with default headers values func NewPostEnrollmentsNotFound() *PostEnrollmentsNotFound { return &PostEnrollmentsNotFound{} } // PostEnrollmentsNotFound describes a response with status code 404, with default header values. // // Resource was not found type PostEnrollmentsNotFound struct { Payload *members_models.Error } // IsSuccess returns true when this post enrollments not found response has a 2xx status code func (o *PostEnrollmentsNotFound) IsSuccess() bool { return false } // IsRedirect returns true when this post enrollments not found response has a 3xx status code func (o *PostEnrollmentsNotFound) IsRedirect() bool { return false } // IsClientError returns true when this post enrollments not found response has a 4xx status code func (o *PostEnrollmentsNotFound) IsClientError() bool { return true } // IsServerError returns true when this post enrollments not found response has a 5xx status code func (o *PostEnrollmentsNotFound) IsServerError() bool { return false } // IsCode returns true when this post enrollments not found response a status code equal to that given func (o *PostEnrollmentsNotFound) IsCode(code int) bool { return code == 404 } // Code gets the status code for the post enrollments not found response func (o *PostEnrollmentsNotFound) Code() int { return 404 } func (o *PostEnrollmentsNotFound) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /enrollments][%d] postEnrollmentsNotFound %s", 404, payload) } func (o *PostEnrollmentsNotFound) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /enrollments][%d] postEnrollmentsNotFound %s", 404, payload) } func (o *PostEnrollmentsNotFound) GetPayload() *members_models.Error { return o.Payload } func (o *PostEnrollmentsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(members_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { return err } return nil } // NewPostEnrollmentsUnprocessableEntity creates a PostEnrollmentsUnprocessableEntity with default headers values func NewPostEnrollmentsUnprocessableEntity() *PostEnrollmentsUnprocessableEntity { return &PostEnrollmentsUnprocessableEntity{} } // PostEnrollmentsUnprocessableEntity describes a response with status code 422, with default header values. // // Unprocessable Entity, likely a bad parameter type PostEnrollmentsUnprocessableEntity struct { Payload *members_models.Error } // IsSuccess returns true when this post enrollments unprocessable entity response has a 2xx status code func (o *PostEnrollmentsUnprocessableEntity) IsSuccess() bool { return false } // IsRedirect returns true when this post enrollments unprocessable entity response has a 3xx status code func (o *PostEnrollmentsUnprocessableEntity) IsRedirect() bool { return false } // IsClientError returns true when this post enrollments unprocessable entity response has a 4xx status code func (o *PostEnrollmentsUnprocessableEntity) IsClientError() bool { return true } // IsServerError returns true when this post enrollments unprocessable entity response has a 5xx status code func (o *PostEnrollmentsUnprocessableEntity) IsServerError() bool { return false } // IsCode returns true when this post enrollments unprocessable entity response a status code equal to that given func (o *PostEnrollmentsUnprocessableEntity) IsCode(code int) bool { return code == 422 } // Code gets the status code for the post enrollments unprocessable entity response func (o *PostEnrollmentsUnprocessableEntity) Code() int { return 422 } func (o *PostEnrollmentsUnprocessableEntity) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /enrollments][%d] postEnrollmentsUnprocessableEntity %s", 422, payload) } func (o *PostEnrollmentsUnprocessableEntity) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /enrollments][%d] postEnrollmentsUnprocessableEntity %s", 422, payload) } func (o *PostEnrollmentsUnprocessableEntity) GetPayload() *members_models.Error { return o.Payload } func (o *PostEnrollmentsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(members_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { return err } return nil } // NewPostEnrollmentsInternalServerError creates a PostEnrollmentsInternalServerError with default headers values func NewPostEnrollmentsInternalServerError() *PostEnrollmentsInternalServerError { return &PostEnrollmentsInternalServerError{} } // PostEnrollmentsInternalServerError describes a response with status code 500, with default header values. // // Server Internal Error type PostEnrollmentsInternalServerError struct { Payload *members_models.Error } // IsSuccess returns true when this post enrollments internal server error response has a 2xx status code func (o *PostEnrollmentsInternalServerError) IsSuccess() bool { return false } // IsRedirect returns true when this post enrollments internal server error response has a 3xx status code func (o *PostEnrollmentsInternalServerError) IsRedirect() bool { return false } // IsClientError returns true when this post enrollments internal server error response has a 4xx status code func (o *PostEnrollmentsInternalServerError) IsClientError() bool { return false } // IsServerError returns true when this post enrollments internal server error response has a 5xx status code func (o *PostEnrollmentsInternalServerError) IsServerError() bool { return true } // IsCode returns true when this post enrollments internal server error response a status code equal to that given func (o *PostEnrollmentsInternalServerError) IsCode(code int) bool { return code == 500 } // Code gets the status code for the post enrollments internal server error response func (o *PostEnrollmentsInternalServerError) Code() int { return 500 } func (o *PostEnrollmentsInternalServerError) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /enrollments][%d] postEnrollmentsInternalServerError %s", 500, payload) } func (o *PostEnrollmentsInternalServerError) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /enrollments][%d] postEnrollmentsInternalServerError %s", 500, payload) } func (o *PostEnrollmentsInternalServerError) GetPayload() *members_models.Error { return o.Payload } func (o *PostEnrollmentsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(members_models.Error) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { return err } return nil }