github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/users/unique_username_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package users 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/runtime" 13 "github.com/go-openapi/strfmt" 14 15 "github.com/ActiveState/cli/pkg/platform/api/mono/mono_models" 16 ) 17 18 // UniqueUsernameReader is a Reader for the UniqueUsername structure. 19 type UniqueUsernameReader struct { 20 formats strfmt.Registry 21 } 22 23 // ReadResponse reads a server response into the received o. 24 func (o *UniqueUsernameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 25 switch response.Code() { 26 case 200: 27 result := NewUniqueUsernameOK() 28 if err := result.readResponse(response, consumer, o.formats); err != nil { 29 return nil, err 30 } 31 return result, nil 32 case 400: 33 result := NewUniqueUsernameBadRequest() 34 if err := result.readResponse(response, consumer, o.formats); err != nil { 35 return nil, err 36 } 37 return nil, result 38 case 409: 39 result := NewUniqueUsernameConflict() 40 if err := result.readResponse(response, consumer, o.formats); err != nil { 41 return nil, err 42 } 43 return nil, result 44 default: 45 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 46 } 47 } 48 49 // NewUniqueUsernameOK creates a UniqueUsernameOK with default headers values 50 func NewUniqueUsernameOK() *UniqueUsernameOK { 51 return &UniqueUsernameOK{} 52 } 53 54 /* UniqueUsernameOK describes a response with status code 200, with default header values. 55 56 Username available 57 */ 58 type UniqueUsernameOK struct { 59 Payload *mono_models.Message 60 } 61 62 func (o *UniqueUsernameOK) Error() string { 63 return fmt.Sprintf("[GET /users/uniqueUsername/{username}][%d] uniqueUsernameOK %+v", 200, o.Payload) 64 } 65 func (o *UniqueUsernameOK) GetPayload() *mono_models.Message { 66 return o.Payload 67 } 68 69 func (o *UniqueUsernameOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 70 71 o.Payload = new(mono_models.Message) 72 73 // response payload 74 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 75 return err 76 } 77 78 return nil 79 } 80 81 // NewUniqueUsernameBadRequest creates a UniqueUsernameBadRequest with default headers values 82 func NewUniqueUsernameBadRequest() *UniqueUsernameBadRequest { 83 return &UniqueUsernameBadRequest{} 84 } 85 86 /* UniqueUsernameBadRequest describes a response with status code 400, with default header values. 87 88 Bad Request 89 */ 90 type UniqueUsernameBadRequest struct { 91 Payload *mono_models.Message 92 } 93 94 func (o *UniqueUsernameBadRequest) Error() string { 95 return fmt.Sprintf("[GET /users/uniqueUsername/{username}][%d] uniqueUsernameBadRequest %+v", 400, o.Payload) 96 } 97 func (o *UniqueUsernameBadRequest) GetPayload() *mono_models.Message { 98 return o.Payload 99 } 100 101 func (o *UniqueUsernameBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 102 103 o.Payload = new(mono_models.Message) 104 105 // response payload 106 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 107 return err 108 } 109 110 return nil 111 } 112 113 // NewUniqueUsernameConflict creates a UniqueUsernameConflict with default headers values 114 func NewUniqueUsernameConflict() *UniqueUsernameConflict { 115 return &UniqueUsernameConflict{} 116 } 117 118 /* UniqueUsernameConflict describes a response with status code 409, with default header values. 119 120 Username Conflict 121 */ 122 type UniqueUsernameConflict struct { 123 Payload *mono_models.Message 124 } 125 126 func (o *UniqueUsernameConflict) Error() string { 127 return fmt.Sprintf("[GET /users/uniqueUsername/{username}][%d] uniqueUsernameConflict %+v", 409, o.Payload) 128 } 129 func (o *UniqueUsernameConflict) GetPayload() *mono_models.Message { 130 return o.Payload 131 } 132 133 func (o *UniqueUsernameConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 134 135 o.Payload = new(mono_models.Message) 136 137 // response payload 138 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 139 return err 140 } 141 142 return nil 143 }