// 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 courses 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" ) // PostCourseLessonsReader is a Reader for the PostCourseLessons structure. type PostCourseLessonsReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *PostCourseLessonsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) { switch response.Code() { case 200: result := NewPostCourseLessonsOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 401: result := NewPostCourseLessonsUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 403: result := NewPostCourseLessonsForbidden() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 404: result := NewPostCourseLessonsNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 422: result := NewPostCourseLessonsUnprocessableEntity() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 500: result := NewPostCourseLessonsInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result default: return nil, runtime.NewAPIError("[POST /courselessons] postCourseLessons", response, response.Code()) } } // NewPostCourseLessonsOK creates a PostCourseLessonsOK with default headers values func NewPostCourseLessonsOK() *PostCourseLessonsOK { return &PostCourseLessonsOK{} } // PostCourseLessonsOK describes a response with status code 200, with default header values. // // CourseLesson Response Object type PostCourseLessonsOK struct { Payload *members_models.CourseLessonResponse } // IsSuccess returns true when this post course lessons o k response has a 2xx status code func (o *PostCourseLessonsOK) IsSuccess() bool { return true } // IsRedirect returns true when this post course lessons o k response has a 3xx status code func (o *PostCourseLessonsOK) IsRedirect() bool { return false } // IsClientError returns true when this post course lessons o k response has a 4xx status code func (o *PostCourseLessonsOK) IsClientError() bool { return false } // IsServerError returns true when this post course lessons o k response has a 5xx status code func (o *PostCourseLessonsOK) IsServerError() bool { return false } // IsCode returns true when this post course lessons o k response a status code equal to that given func (o *PostCourseLessonsOK) IsCode(code int) bool { return code == 200 } // Code gets the status code for the post course lessons o k response func (o *PostCourseLessonsOK) Code() int { return 200 } func (o *PostCourseLessonsOK) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /courselessons][%d] postCourseLessonsOK %s", 200, payload) } func (o *PostCourseLessonsOK) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /courselessons][%d] postCourseLessonsOK %s", 200, payload) } func (o *PostCourseLessonsOK) GetPayload() *members_models.CourseLessonResponse { return o.Payload } func (o *PostCourseLessonsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(members_models.CourseLessonResponse) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) { return err } return nil } // NewPostCourseLessonsUnauthorized creates a PostCourseLessonsUnauthorized with default headers values func NewPostCourseLessonsUnauthorized() *PostCourseLessonsUnauthorized { return &PostCourseLessonsUnauthorized{} } // PostCourseLessonsUnauthorized describes a response with status code 401, with default header values. // // Access Unauthorized, invalid API-KEY was used type PostCourseLessonsUnauthorized struct { Payload *members_models.Error } // IsSuccess returns true when this post course lessons unauthorized response has a 2xx status code func (o *PostCourseLessonsUnauthorized) IsSuccess() bool { return false } // IsRedirect returns true when this post course lessons unauthorized response has a 3xx status code func (o *PostCourseLessonsUnauthorized) IsRedirect() bool { return false } // IsClientError returns true when this post course lessons unauthorized response has a 4xx status code func (o *PostCourseLessonsUnauthorized) IsClientError() bool { return true } // IsServerError returns true when this post course lessons unauthorized response has a 5xx status code func (o *PostCourseLessonsUnauthorized) IsServerError() bool { return false } // IsCode returns true when this post course lessons unauthorized response a status code equal to that given func (o *PostCourseLessonsUnauthorized) IsCode(code int) bool { return code == 401 } // Code gets the status code for the post course lessons unauthorized response func (o *PostCourseLessonsUnauthorized) Code() int { return 401 } func (o *PostCourseLessonsUnauthorized) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /courselessons][%d] postCourseLessonsUnauthorized %s", 401, payload) } func (o *PostCourseLessonsUnauthorized) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /courselessons][%d] postCourseLessonsUnauthorized %s", 401, payload) } func (o *PostCourseLessonsUnauthorized) GetPayload() *members_models.Error { return o.Payload } func (o *PostCourseLessonsUnauthorized) 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 } // NewPostCourseLessonsForbidden creates a PostCourseLessonsForbidden with default headers values func NewPostCourseLessonsForbidden() *PostCourseLessonsForbidden { return &PostCourseLessonsForbidden{} } // PostCourseLessonsForbidden describes a response with status code 403, with default header values. // // Access forbidden, account lacks access type PostCourseLessonsForbidden struct { AccessControlAllowOrigin string Payload *members_models.Error } // IsSuccess returns true when this post course lessons forbidden response has a 2xx status code func (o *PostCourseLessonsForbidden) IsSuccess() bool { return false } // IsRedirect returns true when this post course lessons forbidden response has a 3xx status code func (o *PostCourseLessonsForbidden) IsRedirect() bool { return false } // IsClientError returns true when this post course lessons forbidden response has a 4xx status code func (o *PostCourseLessonsForbidden) IsClientError() bool { return true } // IsServerError returns true when this post course lessons forbidden response has a 5xx status code func (o *PostCourseLessonsForbidden) IsServerError() bool { return false } // IsCode returns true when this post course lessons forbidden response a status code equal to that given func (o *PostCourseLessonsForbidden) IsCode(code int) bool { return code == 403 } // Code gets the status code for the post course lessons forbidden response func (o *PostCourseLessonsForbidden) Code() int { return 403 } func (o *PostCourseLessonsForbidden) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /courselessons][%d] postCourseLessonsForbidden %s", 403, payload) } func (o *PostCourseLessonsForbidden) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /courselessons][%d] postCourseLessonsForbidden %s", 403, payload) } func (o *PostCourseLessonsForbidden) GetPayload() *members_models.Error { return o.Payload } func (o *PostCourseLessonsForbidden) 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 } // NewPostCourseLessonsNotFound creates a PostCourseLessonsNotFound with default headers values func NewPostCourseLessonsNotFound() *PostCourseLessonsNotFound { return &PostCourseLessonsNotFound{} } // PostCourseLessonsNotFound describes a response with status code 404, with default header values. // // Resource was not found type PostCourseLessonsNotFound struct { Payload *members_models.Error } // IsSuccess returns true when this post course lessons not found response has a 2xx status code func (o *PostCourseLessonsNotFound) IsSuccess() bool { return false } // IsRedirect returns true when this post course lessons not found response has a 3xx status code func (o *PostCourseLessonsNotFound) IsRedirect() bool { return false } // IsClientError returns true when this post course lessons not found response has a 4xx status code func (o *PostCourseLessonsNotFound) IsClientError() bool { return true } // IsServerError returns true when this post course lessons not found response has a 5xx status code func (o *PostCourseLessonsNotFound) IsServerError() bool { return false } // IsCode returns true when this post course lessons not found response a status code equal to that given func (o *PostCourseLessonsNotFound) IsCode(code int) bool { return code == 404 } // Code gets the status code for the post course lessons not found response func (o *PostCourseLessonsNotFound) Code() int { return 404 } func (o *PostCourseLessonsNotFound) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /courselessons][%d] postCourseLessonsNotFound %s", 404, payload) } func (o *PostCourseLessonsNotFound) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /courselessons][%d] postCourseLessonsNotFound %s", 404, payload) } func (o *PostCourseLessonsNotFound) GetPayload() *members_models.Error { return o.Payload } func (o *PostCourseLessonsNotFound) 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 } // NewPostCourseLessonsUnprocessableEntity creates a PostCourseLessonsUnprocessableEntity with default headers values func NewPostCourseLessonsUnprocessableEntity() *PostCourseLessonsUnprocessableEntity { return &PostCourseLessonsUnprocessableEntity{} } // PostCourseLessonsUnprocessableEntity describes a response with status code 422, with default header values. // // Unprocessable Entity, likely a bad parameter type PostCourseLessonsUnprocessableEntity struct { Payload *members_models.Error } // IsSuccess returns true when this post course lessons unprocessable entity response has a 2xx status code func (o *PostCourseLessonsUnprocessableEntity) IsSuccess() bool { return false } // IsRedirect returns true when this post course lessons unprocessable entity response has a 3xx status code func (o *PostCourseLessonsUnprocessableEntity) IsRedirect() bool { return false } // IsClientError returns true when this post course lessons unprocessable entity response has a 4xx status code func (o *PostCourseLessonsUnprocessableEntity) IsClientError() bool { return true } // IsServerError returns true when this post course lessons unprocessable entity response has a 5xx status code func (o *PostCourseLessonsUnprocessableEntity) IsServerError() bool { return false } // IsCode returns true when this post course lessons unprocessable entity response a status code equal to that given func (o *PostCourseLessonsUnprocessableEntity) IsCode(code int) bool { return code == 422 } // Code gets the status code for the post course lessons unprocessable entity response func (o *PostCourseLessonsUnprocessableEntity) Code() int { return 422 } func (o *PostCourseLessonsUnprocessableEntity) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /courselessons][%d] postCourseLessonsUnprocessableEntity %s", 422, payload) } func (o *PostCourseLessonsUnprocessableEntity) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /courselessons][%d] postCourseLessonsUnprocessableEntity %s", 422, payload) } func (o *PostCourseLessonsUnprocessableEntity) GetPayload() *members_models.Error { return o.Payload } func (o *PostCourseLessonsUnprocessableEntity) 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 } // NewPostCourseLessonsInternalServerError creates a PostCourseLessonsInternalServerError with default headers values func NewPostCourseLessonsInternalServerError() *PostCourseLessonsInternalServerError { return &PostCourseLessonsInternalServerError{} } // PostCourseLessonsInternalServerError describes a response with status code 500, with default header values. // // Server Internal Error type PostCourseLessonsInternalServerError struct { Payload *members_models.Error } // IsSuccess returns true when this post course lessons internal server error response has a 2xx status code func (o *PostCourseLessonsInternalServerError) IsSuccess() bool { return false } // IsRedirect returns true when this post course lessons internal server error response has a 3xx status code func (o *PostCourseLessonsInternalServerError) IsRedirect() bool { return false } // IsClientError returns true when this post course lessons internal server error response has a 4xx status code func (o *PostCourseLessonsInternalServerError) IsClientError() bool { return false } // IsServerError returns true when this post course lessons internal server error response has a 5xx status code func (o *PostCourseLessonsInternalServerError) IsServerError() bool { return true } // IsCode returns true when this post course lessons internal server error response a status code equal to that given func (o *PostCourseLessonsInternalServerError) IsCode(code int) bool { return code == 500 } // Code gets the status code for the post course lessons internal server error response func (o *PostCourseLessonsInternalServerError) Code() int { return 500 } func (o *PostCourseLessonsInternalServerError) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /courselessons][%d] postCourseLessonsInternalServerError %s", 500, payload) } func (o *PostCourseLessonsInternalServerError) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /courselessons][%d] postCourseLessonsInternalServerError %s", 500, payload) } func (o *PostCourseLessonsInternalServerError) GetPayload() *members_models.Error { return o.Payload } func (o *PostCourseLessonsInternalServerError) 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 }