|
| 1 | +package operations |
| 2 | + |
| 3 | +// This file was generated by the swagger tool. |
| 4 | +// Editing this file might prove futile when you re-run the swagger generate command |
| 5 | + |
| 6 | +import ( |
| 7 | + "fmt" |
| 8 | + "io" |
| 9 | + |
| 10 | + "github.com/go-openapi/runtime" |
| 11 | + |
| 12 | + strfmt "github.com/go-openapi/strfmt" |
| 13 | + |
| 14 | + "github.com/netlify/open-api/go/models" |
| 15 | +) |
| 16 | + |
| 17 | +// ExchangeTicketReader is a Reader for the ExchangeTicket structure. |
| 18 | +type ExchangeTicketReader struct { |
| 19 | + formats strfmt.Registry |
| 20 | +} |
| 21 | + |
| 22 | +// ReadResponse reads a server response into the recieved o. |
| 23 | +func (o *ExchangeTicketReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { |
| 24 | + switch response.Code() { |
| 25 | + |
| 26 | + case 201: |
| 27 | + result := NewExchangeTicketCreated() |
| 28 | + if err := result.readResponse(response, consumer, o.formats); err != nil { |
| 29 | + return nil, err |
| 30 | + } |
| 31 | + return result, nil |
| 32 | + |
| 33 | + default: |
| 34 | + result := NewExchangeTicketDefault(response.Code()) |
| 35 | + if err := result.readResponse(response, consumer, o.formats); err != nil { |
| 36 | + return nil, err |
| 37 | + } |
| 38 | + return nil, result |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | +// NewExchangeTicketCreated creates a ExchangeTicketCreated with default headers values |
| 43 | +func NewExchangeTicketCreated() *ExchangeTicketCreated { |
| 44 | + return &ExchangeTicketCreated{} |
| 45 | +} |
| 46 | + |
| 47 | +/*ExchangeTicketCreated handles this case with default header values. |
| 48 | +
|
| 49 | +ok |
| 50 | +*/ |
| 51 | +type ExchangeTicketCreated struct { |
| 52 | + Payload *models.AccessToken |
| 53 | +} |
| 54 | + |
| 55 | +func (o *ExchangeTicketCreated) Error() string { |
| 56 | + return fmt.Sprintf("[POST /oauth/tickets/{ticket_id}/exchange][%d] exchangeTicketCreated %+v", 201, o.Payload) |
| 57 | +} |
| 58 | + |
| 59 | +func (o *ExchangeTicketCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { |
| 60 | + |
| 61 | + o.Payload = new(models.AccessToken) |
| 62 | + |
| 63 | + // response payload |
| 64 | + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { |
| 65 | + return err |
| 66 | + } |
| 67 | + |
| 68 | + return nil |
| 69 | +} |
| 70 | + |
| 71 | +// NewExchangeTicketDefault creates a ExchangeTicketDefault with default headers values |
| 72 | +func NewExchangeTicketDefault(code int) *ExchangeTicketDefault { |
| 73 | + return &ExchangeTicketDefault{ |
| 74 | + _statusCode: code, |
| 75 | + } |
| 76 | +} |
| 77 | + |
| 78 | +/*ExchangeTicketDefault handles this case with default header values. |
| 79 | +
|
| 80 | +error |
| 81 | +*/ |
| 82 | +type ExchangeTicketDefault struct { |
| 83 | + _statusCode int |
| 84 | + |
| 85 | + Payload *models.Error |
| 86 | +} |
| 87 | + |
| 88 | +// Code gets the status code for the exchange ticket default response |
| 89 | +func (o *ExchangeTicketDefault) Code() int { |
| 90 | + return o._statusCode |
| 91 | +} |
| 92 | + |
| 93 | +func (o *ExchangeTicketDefault) Error() string { |
| 94 | + return fmt.Sprintf("[POST /oauth/tickets/{ticket_id}/exchange][%d] exchangeTicket default %+v", o._statusCode, o.Payload) |
| 95 | +} |
| 96 | + |
| 97 | +func (o *ExchangeTicketDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { |
| 98 | + |
| 99 | + o.Payload = new(models.Error) |
| 100 | + |
| 101 | + // response payload |
| 102 | + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { |
| 103 | + return err |
| 104 | + } |
| 105 | + |
| 106 | + return nil |
| 107 | +} |
0 commit comments