lib/api/members/members_client/sessions/get_me_responses.go

180 lines
4.8 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 sessions
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"
)
// GetMeReader is a Reader for the GetMe structure.
type GetMeReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *GetMeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
switch response.Code() {
case 200:
result := NewGetMeOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewGetMeUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[GET /sessions/me] getMe", response, response.Code())
}
}
// NewGetMeOK creates a GetMeOK with default headers values
func NewGetMeOK() *GetMeOK {
return &GetMeOK{}
}
// GetMeOK describes a response with status code 200, with default header values.
//
// Current user profile
type GetMeOK struct {
Payload *members_models.User
}
// IsSuccess returns true when this get me o k response has a 2xx status code
func (o *GetMeOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this get me o k response has a 3xx status code
func (o *GetMeOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this get me o k response has a 4xx status code
func (o *GetMeOK) IsClientError() bool {
return false
}
// IsServerError returns true when this get me o k response has a 5xx status code
func (o *GetMeOK) IsServerError() bool {
return false
}
// IsCode returns true when this get me o k response a status code equal to that given
func (o *GetMeOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the get me o k response
func (o *GetMeOK) Code() int {
return 200
}
func (o *GetMeOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /sessions/me][%d] getMeOK %s", 200, payload)
}
func (o *GetMeOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /sessions/me][%d] getMeOK %s", 200, payload)
}
func (o *GetMeOK) GetPayload() *members_models.User {
return o.Payload
}
func (o *GetMeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(members_models.User)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
return err
}
return nil
}
// NewGetMeUnauthorized creates a GetMeUnauthorized with default headers values
func NewGetMeUnauthorized() *GetMeUnauthorized {
return &GetMeUnauthorized{}
}
// GetMeUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
type GetMeUnauthorized struct {
Payload *members_models.Error
}
// IsSuccess returns true when this get me unauthorized response has a 2xx status code
func (o *GetMeUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this get me unauthorized response has a 3xx status code
func (o *GetMeUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this get me unauthorized response has a 4xx status code
func (o *GetMeUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this get me unauthorized response has a 5xx status code
func (o *GetMeUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this get me unauthorized response a status code equal to that given
func (o *GetMeUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the get me unauthorized response
func (o *GetMeUnauthorized) Code() int {
return 401
}
func (o *GetMeUnauthorized) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /sessions/me][%d] getMeUnauthorized %s", 401, payload)
}
func (o *GetMeUnauthorized) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /sessions/me][%d] getMeUnauthorized %s", 401, payload)
}
func (o *GetMeUnauthorized) GetPayload() *members_models.Error {
return o.Payload
}
func (o *GetMeUnauthorized) 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
}