Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
118 lines (90 sloc) 2.83 KB
// 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 (
"fmt"
"io"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
models "github.com/netlify/open-api/go/models"
)
// CreateSiteReader is a Reader for the CreateSite structure.
type CreateSiteReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *CreateSiteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 201:
result := NewCreateSiteCreated()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
default:
result := NewCreateSiteDefault(response.Code())
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
if response.Code()/100 == 2 {
return result, nil
}
return nil, result
}
}
// NewCreateSiteCreated creates a CreateSiteCreated with default headers values
func NewCreateSiteCreated() *CreateSiteCreated {
return &CreateSiteCreated{}
}
/*CreateSiteCreated handles this case with default header values.
Created
*/
type CreateSiteCreated struct {
Payload *models.Site
}
func (o *CreateSiteCreated) Error() string {
return fmt.Sprintf("[POST /sites][%d] createSiteCreated %+v", 201, o.Payload)
}
func (o *CreateSiteCreated) GetPayload() *models.Site {
return o.Payload
}
func (o *CreateSiteCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Site)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewCreateSiteDefault creates a CreateSiteDefault with default headers values
func NewCreateSiteDefault(code int) *CreateSiteDefault {
return &CreateSiteDefault{
_statusCode: code,
}
}
/*CreateSiteDefault handles this case with default header values.
error
*/
type CreateSiteDefault struct {
_statusCode int
Payload *models.Error
}
// Code gets the status code for the create site default response
func (o *CreateSiteDefault) Code() int {
return o._statusCode
}
func (o *CreateSiteDefault) Error() string {
return fmt.Sprintf("[POST /sites][%d] createSite default %+v", o._statusCode, o.Payload)
}
func (o *CreateSiteDefault) GetPayload() *models.Error {
return o.Payload
}
func (o *CreateSiteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.Error)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
You can’t perform that action at this time.