github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/examples/file-server/client/uploads/upload_file_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package uploads
     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  
    11  	"github.com/go-openapi/runtime"
    12  	"github.com/go-openapi/strfmt"
    13  )
    14  
    15  // UploadFileReader is a Reader for the UploadFile structure.
    16  type UploadFileReader struct {
    17  	formats strfmt.Registry
    18  }
    19  
    20  // ReadResponse reads a server response into the received o.
    21  func (o *UploadFileReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    22  	switch response.Code() {
    23  	case 200:
    24  		result := NewUploadFileOK()
    25  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    26  			return nil, err
    27  		}
    28  		return result, nil
    29  	default:
    30  		return nil, runtime.NewAPIError("[POST /upload] uploadFile", response, response.Code())
    31  	}
    32  }
    33  
    34  // NewUploadFileOK creates a UploadFileOK with default headers values
    35  func NewUploadFileOK() *UploadFileOK {
    36  	return &UploadFileOK{}
    37  }
    38  
    39  /*
    40  UploadFileOK describes a response with status code 200, with default header values.
    41  
    42  OK
    43  */
    44  type UploadFileOK struct {
    45  }
    46  
    47  // IsSuccess returns true when this upload file o k response has a 2xx status code
    48  func (o *UploadFileOK) IsSuccess() bool {
    49  	return true
    50  }
    51  
    52  // IsRedirect returns true when this upload file o k response has a 3xx status code
    53  func (o *UploadFileOK) IsRedirect() bool {
    54  	return false
    55  }
    56  
    57  // IsClientError returns true when this upload file o k response has a 4xx status code
    58  func (o *UploadFileOK) IsClientError() bool {
    59  	return false
    60  }
    61  
    62  // IsServerError returns true when this upload file o k response has a 5xx status code
    63  func (o *UploadFileOK) IsServerError() bool {
    64  	return false
    65  }
    66  
    67  // IsCode returns true when this upload file o k response a status code equal to that given
    68  func (o *UploadFileOK) IsCode(code int) bool {
    69  	return code == 200
    70  }
    71  
    72  // Code gets the status code for the upload file o k response
    73  func (o *UploadFileOK) Code() int {
    74  	return 200
    75  }
    76  
    77  func (o *UploadFileOK) Error() string {
    78  	return fmt.Sprintf("[POST /upload][%d] uploadFileOK", 200)
    79  }
    80  
    81  func (o *UploadFileOK) String() string {
    82  	return fmt.Sprintf("[POST /upload][%d] uploadFileOK", 200)
    83  }
    84  
    85  func (o *UploadFileOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    86  
    87  	return nil
    88  }