github.com/circl-dev/go-swagger@v0.31.0/examples/stream-server/client/operations/elapse_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package operations 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "fmt" 10 "io" 11 12 "github.com/go-openapi/strfmt" 13 "github.com/circl-dev/runtime" 14 ) 15 16 // ElapseReader is a Reader for the Elapse structure. 17 type ElapseReader struct { 18 formats strfmt.Registry 19 writer io.Writer 20 } 21 22 // ReadResponse reads a server response into the received o. 23 func (o *ElapseReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 24 switch response.Code() { 25 case 200: 26 result := NewElapseOK(o.writer) 27 if err := result.readResponse(response, consumer, o.formats); err != nil { 28 return nil, err 29 } 30 return result, nil 31 case 403: 32 result := NewElapseForbidden() 33 if err := result.readResponse(response, consumer, o.formats); err != nil { 34 return nil, err 35 } 36 return nil, result 37 default: 38 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 39 } 40 } 41 42 // NewElapseOK creates a ElapseOK with default headers values 43 func NewElapseOK(writer io.Writer) *ElapseOK { 44 return &ElapseOK{ 45 46 Payload: writer, 47 } 48 } 49 50 /* ElapseOK describes a response with status code 200, with default header values. 51 52 Secondly update on remaining time 53 */ 54 type ElapseOK struct { 55 Payload io.Writer 56 } 57 58 func (o *ElapseOK) Error() string { 59 return fmt.Sprintf("[GET /elapse/{length}][%d] elapseOK %+v", 200, o.Payload) 60 } 61 func (o *ElapseOK) GetPayload() io.Writer { 62 return o.Payload 63 } 64 65 func (o *ElapseOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 66 67 // response payload 68 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 69 return err 70 } 71 72 return nil 73 } 74 75 // NewElapseForbidden creates a ElapseForbidden with default headers values 76 func NewElapseForbidden() *ElapseForbidden { 77 return &ElapseForbidden{} 78 } 79 80 /* ElapseForbidden describes a response with status code 403, with default header values. 81 82 Contrived - thrown when length of 11 is chosen 83 */ 84 type ElapseForbidden struct { 85 } 86 87 func (o *ElapseForbidden) Error() string { 88 return fmt.Sprintf("[GET /elapse/{length}][%d] elapseForbidden ", 403) 89 } 90 91 func (o *ElapseForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 92 93 return nil 94 }