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

181 lines
5.2 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
// 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/vernonkeenan/lib/api/members/members_models"
)
// RefreshSessionReader is a Reader for the RefreshSession structure.
type RefreshSessionReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *RefreshSessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewRefreshSessionOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewRefreshSessionUnauthorized()
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())
}
}
// NewRefreshSessionOK creates a RefreshSessionOK with default headers values
func NewRefreshSessionOK() *RefreshSessionOK {
return &RefreshSessionOK{}
}
/*
RefreshSessionOK describes a response with status code 200, with default header values.
Token refreshed
*/
type RefreshSessionOK struct {
/* New kvSession cookie with updated expiry
*/
SetCookie string
}
// IsSuccess returns true when this refresh session o k response has a 2xx status code
func (o *RefreshSessionOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this refresh session o k response has a 3xx status code
func (o *RefreshSessionOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this refresh session o k response has a 4xx status code
func (o *RefreshSessionOK) IsClientError() bool {
return false
}
// IsServerError returns true when this refresh session o k response has a 5xx status code
func (o *RefreshSessionOK) IsServerError() bool {
return false
}
// IsCode returns true when this refresh session o k response a status code equal to that given
func (o *RefreshSessionOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the refresh session o k response
func (o *RefreshSessionOK) Code() int {
return 200
}
func (o *RefreshSessionOK) Error() string {
return fmt.Sprintf("[POST /sessions/refresh][%d] refreshSessionOK ", 200)
}
func (o *RefreshSessionOK) String() string {
return fmt.Sprintf("[POST /sessions/refresh][%d] refreshSessionOK ", 200)
}
func (o *RefreshSessionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// hydrates response header Set-Cookie
hdrSetCookie := response.GetHeader("Set-Cookie")
if hdrSetCookie != "" {
o.SetCookie = hdrSetCookie
}
return nil
}
// NewRefreshSessionUnauthorized creates a RefreshSessionUnauthorized with default headers values
func NewRefreshSessionUnauthorized() *RefreshSessionUnauthorized {
return &RefreshSessionUnauthorized{}
}
/*
RefreshSessionUnauthorized describes a response with status code 401, with default header values.
Access Unauthorized, invalid API-KEY was used
*/
type RefreshSessionUnauthorized struct {
Payload *members_models.Error
}
// IsSuccess returns true when this refresh session unauthorized response has a 2xx status code
func (o *RefreshSessionUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this refresh session unauthorized response has a 3xx status code
func (o *RefreshSessionUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this refresh session unauthorized response has a 4xx status code
func (o *RefreshSessionUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this refresh session unauthorized response has a 5xx status code
func (o *RefreshSessionUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this refresh session unauthorized response a status code equal to that given
func (o *RefreshSessionUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the refresh session unauthorized response
func (o *RefreshSessionUnauthorized) Code() int {
return 401
}
func (o *RefreshSessionUnauthorized) Error() string {
return fmt.Sprintf("[POST /sessions/refresh][%d] refreshSessionUnauthorized %+v", 401, o.Payload)
}
func (o *RefreshSessionUnauthorized) String() string {
return fmt.Sprintf("[POST /sessions/refresh][%d] refreshSessionUnauthorized %+v", 401, o.Payload)
}
func (o *RefreshSessionUnauthorized) GetPayload() *members_models.Error {
return o.Payload
}
func (o *RefreshSessionUnauthorized) 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
}