lib/api/members/members_client/courses/get_courses_responses.go

487 lines
14 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2023 by Vernon Keenan
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package courses
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"code.tnxs.net/work/lib/api/members/members_models"
)
// GetCoursesReader is a Reader for the GetCourses structure.
type GetCoursesReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetCoursesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewGetCoursesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewGetCoursesUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 403:
result := NewGetCoursesForbidden()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 404:
result := NewGetCoursesNotFound()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 422:
result := NewGetCoursesUnprocessableEntity()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewGetCoursesInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewGetCoursesOK creates a GetCoursesOK with default headers values
func NewGetCoursesOK() *GetCoursesOK {
return &GetCoursesOK{}
}
/*
GetCoursesOK describes a response with status code 200, with default header values.
Course Response Object
*/
type GetCoursesOK struct {
Payload *members_models.CourseResponse
}
// IsSuccess returns true when this get courses o k response has a 2xx status code
func (o *GetCoursesOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get courses o k response has a 3xx status code
func (o *GetCoursesOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get courses o k response has a 4xx status code
func (o *GetCoursesOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get courses o k response has a 5xx status code
func (o *GetCoursesOK) IsServerError() bool {
return false
}
// IsCode returns true when this get courses o k response a status code equal to that given
func (o *GetCoursesOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get courses o k response
func (o *GetCoursesOK) Code() int {
return 200
}
func (o *GetCoursesOK) Error() string {
return fmt.Sprintf("[GET /courses][%d] getCoursesOK %+v", 200, o.Payload)
}
func (o *GetCoursesOK) String() string {
return fmt.Sprintf("[GET /courses][%d] getCoursesOK %+v", 200, o.Payload)
}
func (o *GetCoursesOK) GetPayload() *members_models.CourseResponse {
return o.Payload
}
func (o *GetCoursesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(members_models.CourseResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewGetCoursesUnauthorized creates a GetCoursesUnauthorized with default headers values
func NewGetCoursesUnauthorized() *GetCoursesUnauthorized {
return &GetCoursesUnauthorized{}
}
/*
GetCoursesUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type GetCoursesUnauthorized struct {
Payload *members_models.Error
}
// IsSuccess returns true when this get courses unauthorized response has a 2xx status code
func (o *GetCoursesUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get courses unauthorized response has a 3xx status code
func (o *GetCoursesUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this get courses unauthorized response has a 4xx status code
func (o *GetCoursesUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this get courses unauthorized response has a 5xx status code
func (o *GetCoursesUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this get courses unauthorized response a status code equal to that given
func (o *GetCoursesUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the get courses unauthorized response
func (o *GetCoursesUnauthorized) Code() int {
return 401
}
func (o *GetCoursesUnauthorized) Error() string {
return fmt.Sprintf("[GET /courses][%d] getCoursesUnauthorized %+v", 401, o.Payload)
}
func (o *GetCoursesUnauthorized) String() string {
return fmt.Sprintf("[GET /courses][%d] getCoursesUnauthorized %+v", 401, o.Payload)
}
func (o *GetCoursesUnauthorized) GetPayload() *members_models.Error {
return o.Payload
}
func (o *GetCoursesUnauthorized) 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 && err != io.EOF {
return err
}
return nil
}
// NewGetCoursesForbidden creates a GetCoursesForbidden with default headers values
func NewGetCoursesForbidden() *GetCoursesForbidden {
return &GetCoursesForbidden{}
}
/*
GetCoursesForbidden describes a response with status code 403, with default header values.
Access forbidden, account lacks access
*/
type GetCoursesForbidden struct {
AccessControlAllowOrigin string
Payload *members_models.Error
}
// IsSuccess returns true when this get courses forbidden response has a 2xx status code
func (o *GetCoursesForbidden) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get courses forbidden response has a 3xx status code
func (o *GetCoursesForbidden) IsRedirect() bool {
return false
}
// IsClientError returns true when this get courses forbidden response has a 4xx status code
func (o *GetCoursesForbidden) IsClientError() bool {
return true
}
// IsServerError returns true when this get courses forbidden response has a 5xx status code
func (o *GetCoursesForbidden) IsServerError() bool {
return false
}
// IsCode returns true when this get courses forbidden response a status code equal to that given
func (o *GetCoursesForbidden) IsCode(code int) bool {
return code == 403
}
// Code gets the status code for the get courses forbidden response
func (o *GetCoursesForbidden) Code() int {
return 403
}
func (o *GetCoursesForbidden) Error() string {
return fmt.Sprintf("[GET /courses][%d] getCoursesForbidden %+v", 403, o.Payload)
}
func (o *GetCoursesForbidden) String() string {
return fmt.Sprintf("[GET /courses][%d] getCoursesForbidden %+v", 403, o.Payload)
}
func (o *GetCoursesForbidden) GetPayload() *members_models.Error {
return o.Payload
}
func (o *GetCoursesForbidden) 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 && err != io.EOF {
return err
}
return nil
}
// NewGetCoursesNotFound creates a GetCoursesNotFound with default headers values
func NewGetCoursesNotFound() *GetCoursesNotFound {
return &GetCoursesNotFound{}
}
/*
GetCoursesNotFound describes a response with status code 404, with default header values.
Resource was not found
*/
type GetCoursesNotFound struct {
Payload *members_models.Error
}
// IsSuccess returns true when this get courses not found response has a 2xx status code
func (o *GetCoursesNotFound) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get courses not found response has a 3xx status code
func (o *GetCoursesNotFound) IsRedirect() bool {
return false
}
// IsClientError returns true when this get courses not found response has a 4xx status code
func (o *GetCoursesNotFound) IsClientError() bool {
return true
}
// IsServerError returns true when this get courses not found response has a 5xx status code
func (o *GetCoursesNotFound) IsServerError() bool {
return false
}
// IsCode returns true when this get courses not found response a status code equal to that given
func (o *GetCoursesNotFound) IsCode(code int) bool {
return code == 404
}
// Code gets the status code for the get courses not found response
func (o *GetCoursesNotFound) Code() int {
return 404
}
func (o *GetCoursesNotFound) Error() string {
return fmt.Sprintf("[GET /courses][%d] getCoursesNotFound %+v", 404, o.Payload)
}
func (o *GetCoursesNotFound) String() string {
return fmt.Sprintf("[GET /courses][%d] getCoursesNotFound %+v", 404, o.Payload)
}
func (o *GetCoursesNotFound) GetPayload() *members_models.Error {
return o.Payload
}
func (o *GetCoursesNotFound) 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 && err != io.EOF {
return err
}
return nil
}
// NewGetCoursesUnprocessableEntity creates a GetCoursesUnprocessableEntity with default headers values
func NewGetCoursesUnprocessableEntity() *GetCoursesUnprocessableEntity {
return &GetCoursesUnprocessableEntity{}
}
/*
GetCoursesUnprocessableEntity describes a response with status code 422, with default header values.
Unprocessable Entity, likely a bad parameter
*/
type GetCoursesUnprocessableEntity struct {
Payload *members_models.Error
}
// IsSuccess returns true when this get courses unprocessable entity response has a 2xx status code
func (o *GetCoursesUnprocessableEntity) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get courses unprocessable entity response has a 3xx status code
func (o *GetCoursesUnprocessableEntity) IsRedirect() bool {
return false
}
// IsClientError returns true when this get courses unprocessable entity response has a 4xx status code
func (o *GetCoursesUnprocessableEntity) IsClientError() bool {
return true
}
// IsServerError returns true when this get courses unprocessable entity response has a 5xx status code
func (o *GetCoursesUnprocessableEntity) IsServerError() bool {
return false
}
// IsCode returns true when this get courses unprocessable entity response a status code equal to that given
func (o *GetCoursesUnprocessableEntity) IsCode(code int) bool {
return code == 422
}
// Code gets the status code for the get courses unprocessable entity response
func (o *GetCoursesUnprocessableEntity) Code() int {
return 422
}
func (o *GetCoursesUnprocessableEntity) Error() string {
return fmt.Sprintf("[GET /courses][%d] getCoursesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetCoursesUnprocessableEntity) String() string {
return fmt.Sprintf("[GET /courses][%d] getCoursesUnprocessableEntity %+v", 422, o.Payload)
}
func (o *GetCoursesUnprocessableEntity) GetPayload() *members_models.Error {
return o.Payload
}
func (o *GetCoursesUnprocessableEntity) 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 && err != io.EOF {
return err
}
return nil
}
// NewGetCoursesInternalServerError creates a GetCoursesInternalServerError with default headers values
func NewGetCoursesInternalServerError() *GetCoursesInternalServerError {
return &GetCoursesInternalServerError{}
}
/*
GetCoursesInternalServerError describes a response with status code 500, with default header values.
Server Internal Error
*/
type GetCoursesInternalServerError struct {
Payload *members_models.Error
}
// IsSuccess returns true when this get courses internal server error response has a 2xx status code
func (o *GetCoursesInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get courses internal server error response has a 3xx status code
func (o *GetCoursesInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this get courses internal server error response has a 4xx status code
func (o *GetCoursesInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this get courses internal server error response has a 5xx status code
func (o *GetCoursesInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this get courses internal server error response a status code equal to that given
func (o *GetCoursesInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the get courses internal server error response
func (o *GetCoursesInternalServerError) Code() int {
return 500
}
func (o *GetCoursesInternalServerError) Error() string {
return fmt.Sprintf("[GET /courses][%d] getCoursesInternalServerError %+v", 500, o.Payload)
}
func (o *GetCoursesInternalServerError) String() string {
return fmt.Sprintf("[GET /courses][%d] getCoursesInternalServerError %+v", 500, o.Payload)
}
func (o *GetCoursesInternalServerError) GetPayload() *members_models.Error {
return o.Payload
}
func (o *GetCoursesInternalServerError) 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 && err != io.EOF {
return err
}
return nil
}