// Code generated by go-swagger; DO NOT EDIT. package operations // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "encoding/json" "fmt" "io" "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" "github.com/fiskerinc/cloud-services/pkg/ota_api/models" ) // PostApitokenReader is a Reader for the PostApitoken structure. type PostApitokenReader struct { formats strfmt.Registry } // ReadResponse reads a server response into the received o. func (o *PostApitokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: result := NewPostApitokenOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil case 400: result := NewPostApitokenBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 401: result := NewPostApitokenUnauthorized() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result case 503: result := NewPostApitokenServiceUnavailable() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result default: return nil, runtime.NewAPIError("[POST /apitoken] PostApitoken", response, response.Code()) } } // NewPostApitokenOK creates a PostApitokenOK with default headers values func NewPostApitokenOK() *PostApitokenOK { return &PostApitokenOK{} } /* PostApitokenOK describes a response with status code 200, with default header values. OK */ type PostApitokenOK struct { Payload *models.CommonAPIToken } // IsSuccess returns true when this post apitoken o k response has a 2xx status code func (o *PostApitokenOK) IsSuccess() bool { return true } // IsRedirect returns true when this post apitoken o k response has a 3xx status code func (o *PostApitokenOK) IsRedirect() bool { return false } // IsClientError returns true when this post apitoken o k response has a 4xx status code func (o *PostApitokenOK) IsClientError() bool { return false } // IsServerError returns true when this post apitoken o k response has a 5xx status code func (o *PostApitokenOK) IsServerError() bool { return false } // IsCode returns true when this post apitoken o k response a status code equal to that given func (o *PostApitokenOK) IsCode(code int) bool { return code == 200 } // Code gets the status code for the post apitoken o k response func (o *PostApitokenOK) Code() int { return 200 } func (o *PostApitokenOK) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /apitoken][%d] postApitokenOK %s", 200, payload) } func (o *PostApitokenOK) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /apitoken][%d] postApitokenOK %s", 200, payload) } func (o *PostApitokenOK) GetPayload() *models.CommonAPIToken { return o.Payload } func (o *PostApitokenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(models.CommonAPIToken) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewPostApitokenBadRequest creates a PostApitokenBadRequest with default headers values func NewPostApitokenBadRequest() *PostApitokenBadRequest { return &PostApitokenBadRequest{} } /* PostApitokenBadRequest describes a response with status code 400, with default header values. Bad request */ type PostApitokenBadRequest struct { Payload *models.CommonJSONError } // IsSuccess returns true when this post apitoken bad request response has a 2xx status code func (o *PostApitokenBadRequest) IsSuccess() bool { return false } // IsRedirect returns true when this post apitoken bad request response has a 3xx status code func (o *PostApitokenBadRequest) IsRedirect() bool { return false } // IsClientError returns true when this post apitoken bad request response has a 4xx status code func (o *PostApitokenBadRequest) IsClientError() bool { return true } // IsServerError returns true when this post apitoken bad request response has a 5xx status code func (o *PostApitokenBadRequest) IsServerError() bool { return false } // IsCode returns true when this post apitoken bad request response a status code equal to that given func (o *PostApitokenBadRequest) IsCode(code int) bool { return code == 400 } // Code gets the status code for the post apitoken bad request response func (o *PostApitokenBadRequest) Code() int { return 400 } func (o *PostApitokenBadRequest) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /apitoken][%d] postApitokenBadRequest %s", 400, payload) } func (o *PostApitokenBadRequest) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /apitoken][%d] postApitokenBadRequest %s", 400, payload) } func (o *PostApitokenBadRequest) GetPayload() *models.CommonJSONError { return o.Payload } func (o *PostApitokenBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(models.CommonJSONError) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewPostApitokenUnauthorized creates a PostApitokenUnauthorized with default headers values func NewPostApitokenUnauthorized() *PostApitokenUnauthorized { return &PostApitokenUnauthorized{} } /* PostApitokenUnauthorized describes a response with status code 401, with default header values. Unauthorized */ type PostApitokenUnauthorized struct { Payload *models.CommonJSONError } // IsSuccess returns true when this post apitoken unauthorized response has a 2xx status code func (o *PostApitokenUnauthorized) IsSuccess() bool { return false } // IsRedirect returns true when this post apitoken unauthorized response has a 3xx status code func (o *PostApitokenUnauthorized) IsRedirect() bool { return false } // IsClientError returns true when this post apitoken unauthorized response has a 4xx status code func (o *PostApitokenUnauthorized) IsClientError() bool { return true } // IsServerError returns true when this post apitoken unauthorized response has a 5xx status code func (o *PostApitokenUnauthorized) IsServerError() bool { return false } // IsCode returns true when this post apitoken unauthorized response a status code equal to that given func (o *PostApitokenUnauthorized) IsCode(code int) bool { return code == 401 } // Code gets the status code for the post apitoken unauthorized response func (o *PostApitokenUnauthorized) Code() int { return 401 } func (o *PostApitokenUnauthorized) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /apitoken][%d] postApitokenUnauthorized %s", 401, payload) } func (o *PostApitokenUnauthorized) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /apitoken][%d] postApitokenUnauthorized %s", 401, payload) } func (o *PostApitokenUnauthorized) GetPayload() *models.CommonJSONError { return o.Payload } func (o *PostApitokenUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(models.CommonJSONError) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil } // NewPostApitokenServiceUnavailable creates a PostApitokenServiceUnavailable with default headers values func NewPostApitokenServiceUnavailable() *PostApitokenServiceUnavailable { return &PostApitokenServiceUnavailable{} } /* PostApitokenServiceUnavailable describes a response with status code 503, with default header values. Service unavailable */ type PostApitokenServiceUnavailable struct { Payload *models.CommonJSONError } // IsSuccess returns true when this post apitoken service unavailable response has a 2xx status code func (o *PostApitokenServiceUnavailable) IsSuccess() bool { return false } // IsRedirect returns true when this post apitoken service unavailable response has a 3xx status code func (o *PostApitokenServiceUnavailable) IsRedirect() bool { return false } // IsClientError returns true when this post apitoken service unavailable response has a 4xx status code func (o *PostApitokenServiceUnavailable) IsClientError() bool { return false } // IsServerError returns true when this post apitoken service unavailable response has a 5xx status code func (o *PostApitokenServiceUnavailable) IsServerError() bool { return true } // IsCode returns true when this post apitoken service unavailable response a status code equal to that given func (o *PostApitokenServiceUnavailable) IsCode(code int) bool { return code == 503 } // Code gets the status code for the post apitoken service unavailable response func (o *PostApitokenServiceUnavailable) Code() int { return 503 } func (o *PostApitokenServiceUnavailable) Error() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /apitoken][%d] postApitokenServiceUnavailable %s", 503, payload) } func (o *PostApitokenServiceUnavailable) String() string { payload, _ := json.Marshal(o.Payload) return fmt.Sprintf("[POST /apitoken][%d] postApitokenServiceUnavailable %s", 503, payload) } func (o *PostApitokenServiceUnavailable) GetPayload() *models.CommonJSONError { return o.Payload } func (o *PostApitokenServiceUnavailable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { o.Payload = new(models.CommonJSONError) // response payload if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } return nil }