mirror of https://github.com/vernonkeenan/lib
485 lines
15 KiB
Go
485 lines
15 KiB
Go
// 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"
|
|
)
|
|
|
|
// 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) (any, 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("[GET /courses] getCourses", 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 {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /courses][%d] getCoursesOK %s", 200, payload)
|
|
}
|
|
|
|
func (o *GetCoursesOK) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /courses][%d] getCoursesOK %s", 200, 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 && !stderrors.Is(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 {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /courses][%d] getCoursesUnauthorized %s", 401, payload)
|
|
}
|
|
|
|
func (o *GetCoursesUnauthorized) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /courses][%d] getCoursesUnauthorized %s", 401, 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 && !stderrors.Is(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 {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /courses][%d] getCoursesForbidden %s", 403, payload)
|
|
}
|
|
|
|
func (o *GetCoursesForbidden) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /courses][%d] getCoursesForbidden %s", 403, 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 && !stderrors.Is(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 {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /courses][%d] getCoursesNotFound %s", 404, payload)
|
|
}
|
|
|
|
func (o *GetCoursesNotFound) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /courses][%d] getCoursesNotFound %s", 404, 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 && !stderrors.Is(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 {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /courses][%d] getCoursesUnprocessableEntity %s", 422, payload)
|
|
}
|
|
|
|
func (o *GetCoursesUnprocessableEntity) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /courses][%d] getCoursesUnprocessableEntity %s", 422, 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 && !stderrors.Is(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 {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /courses][%d] getCoursesInternalServerError %s", 500, payload)
|
|
}
|
|
|
|
func (o *GetCoursesInternalServerError) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /courses][%d] getCoursesInternalServerError %s", 500, 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 && !stderrors.Is(err, io.EOF) {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|