140 lines
3.4 KiB
Go
140 lines
3.4 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package authentication
|
|
|
|
// 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"
|
|
|
|
strfmt "github.com/go-openapi/strfmt"
|
|
|
|
models "src.dualinventive.com/go/authentication-service/rest/models"
|
|
)
|
|
|
|
// 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) (interface{}, 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
|
|
|
|
case 500:
|
|
result := NewGetMeInternalServerError()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
|
|
default:
|
|
return nil, runtime.NewAPIError("unknown error", response, response.Code())
|
|
}
|
|
}
|
|
|
|
// NewGetMeOK creates a GetMeOK with default headers values
|
|
func NewGetMeOK() *GetMeOK {
|
|
return &GetMeOK{}
|
|
}
|
|
|
|
/*GetMeOK handles this case with default header values.
|
|
|
|
Success
|
|
*/
|
|
type GetMeOK struct {
|
|
Payload *models.User
|
|
}
|
|
|
|
func (o *GetMeOK) Error() string {
|
|
return fmt.Sprintf("[GET /me][%d] getMeOK %+v", 200, o.Payload)
|
|
}
|
|
|
|
func (o *GetMeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
o.Payload = new(models.User)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewGetMeUnauthorized creates a GetMeUnauthorized with default headers values
|
|
func NewGetMeUnauthorized() *GetMeUnauthorized {
|
|
return &GetMeUnauthorized{}
|
|
}
|
|
|
|
/*GetMeUnauthorized handles this case with default header values.
|
|
|
|
Authentication failed
|
|
*/
|
|
type GetMeUnauthorized struct {
|
|
Payload *models.ErrResponse
|
|
}
|
|
|
|
func (o *GetMeUnauthorized) Error() string {
|
|
return fmt.Sprintf("[GET /me][%d] getMeUnauthorized %+v", 401, o.Payload)
|
|
}
|
|
|
|
func (o *GetMeUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
o.Payload = new(models.ErrResponse)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewGetMeInternalServerError creates a GetMeInternalServerError with default headers values
|
|
func NewGetMeInternalServerError() *GetMeInternalServerError {
|
|
return &GetMeInternalServerError{}
|
|
}
|
|
|
|
/*GetMeInternalServerError handles this case with default header values.
|
|
|
|
Internal Server Error
|
|
*/
|
|
type GetMeInternalServerError struct {
|
|
Payload *models.ErrResponse
|
|
}
|
|
|
|
func (o *GetMeInternalServerError) Error() string {
|
|
return fmt.Sprintf("[GET /me][%d] getMeInternalServerError %+v", 500, o.Payload)
|
|
}
|
|
|
|
func (o *GetMeInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
o.Payload = new(models.ErrResponse)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|