github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/users/add_email_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 "context" 10 "fmt" 11 "io" 12 13 "github.com/go-openapi/runtime" 14 "github.com/go-openapi/strfmt" 15 "github.com/go-openapi/swag" 16 17 "github.com/ActiveState/cli/pkg/platform/api/mono/mono_models" 18 ) 19 20 // AddEmailReader is a Reader for the AddEmail structure. 21 type AddEmailReader struct { 22 formats strfmt.Registry 23 } 24 25 // ReadResponse reads a server response into the received o. 26 func (o *AddEmailReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 27 switch response.Code() { 28 case 200: 29 result := NewAddEmailOK() 30 if err := result.readResponse(response, consumer, o.formats); err != nil { 31 return nil, err 32 } 33 return result, nil 34 case 400: 35 result := NewAddEmailBadRequest() 36 if err := result.readResponse(response, consumer, o.formats); err != nil { 37 return nil, err 38 } 39 return nil, result 40 case 403: 41 result := NewAddEmailForbidden() 42 if err := result.readResponse(response, consumer, o.formats); err != nil { 43 return nil, err 44 } 45 return nil, result 46 case 404: 47 result := NewAddEmailNotFound() 48 if err := result.readResponse(response, consumer, o.formats); err != nil { 49 return nil, err 50 } 51 return nil, result 52 case 409: 53 result := NewAddEmailConflict() 54 if err := result.readResponse(response, consumer, o.formats); err != nil { 55 return nil, err 56 } 57 return nil, result 58 case 500: 59 result := NewAddEmailInternalServerError() 60 if err := result.readResponse(response, consumer, o.formats); err != nil { 61 return nil, err 62 } 63 return nil, result 64 default: 65 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 66 } 67 } 68 69 // NewAddEmailOK creates a AddEmailOK with default headers values 70 func NewAddEmailOK() *AddEmailOK { 71 return &AddEmailOK{} 72 } 73 74 /* AddEmailOK describes a response with status code 200, with default header values. 75 76 Email added 77 */ 78 type AddEmailOK struct { 79 Payload *mono_models.Email 80 } 81 82 func (o *AddEmailOK) Error() string { 83 return fmt.Sprintf("[POST /users/{username}/emails][%d] addEmailOK %+v", 200, o.Payload) 84 } 85 func (o *AddEmailOK) GetPayload() *mono_models.Email { 86 return o.Payload 87 } 88 89 func (o *AddEmailOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 90 91 o.Payload = new(mono_models.Email) 92 93 // response payload 94 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 95 return err 96 } 97 98 return nil 99 } 100 101 // NewAddEmailBadRequest creates a AddEmailBadRequest with default headers values 102 func NewAddEmailBadRequest() *AddEmailBadRequest { 103 return &AddEmailBadRequest{} 104 } 105 106 /* AddEmailBadRequest describes a response with status code 400, with default header values. 107 108 Bad Request 109 */ 110 type AddEmailBadRequest struct { 111 Payload *mono_models.Message 112 } 113 114 func (o *AddEmailBadRequest) Error() string { 115 return fmt.Sprintf("[POST /users/{username}/emails][%d] addEmailBadRequest %+v", 400, o.Payload) 116 } 117 func (o *AddEmailBadRequest) GetPayload() *mono_models.Message { 118 return o.Payload 119 } 120 121 func (o *AddEmailBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 122 123 o.Payload = new(mono_models.Message) 124 125 // response payload 126 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 127 return err 128 } 129 130 return nil 131 } 132 133 // NewAddEmailForbidden creates a AddEmailForbidden with default headers values 134 func NewAddEmailForbidden() *AddEmailForbidden { 135 return &AddEmailForbidden{} 136 } 137 138 /* AddEmailForbidden describes a response with status code 403, with default header values. 139 140 Forbidden 141 */ 142 type AddEmailForbidden struct { 143 Payload *mono_models.Message 144 } 145 146 func (o *AddEmailForbidden) Error() string { 147 return fmt.Sprintf("[POST /users/{username}/emails][%d] addEmailForbidden %+v", 403, o.Payload) 148 } 149 func (o *AddEmailForbidden) GetPayload() *mono_models.Message { 150 return o.Payload 151 } 152 153 func (o *AddEmailForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 154 155 o.Payload = new(mono_models.Message) 156 157 // response payload 158 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 159 return err 160 } 161 162 return nil 163 } 164 165 // NewAddEmailNotFound creates a AddEmailNotFound with default headers values 166 func NewAddEmailNotFound() *AddEmailNotFound { 167 return &AddEmailNotFound{} 168 } 169 170 /* AddEmailNotFound describes a response with status code 404, with default header values. 171 172 Not Found 173 */ 174 type AddEmailNotFound struct { 175 Payload *mono_models.Message 176 } 177 178 func (o *AddEmailNotFound) Error() string { 179 return fmt.Sprintf("[POST /users/{username}/emails][%d] addEmailNotFound %+v", 404, o.Payload) 180 } 181 func (o *AddEmailNotFound) GetPayload() *mono_models.Message { 182 return o.Payload 183 } 184 185 func (o *AddEmailNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 186 187 o.Payload = new(mono_models.Message) 188 189 // response payload 190 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 191 return err 192 } 193 194 return nil 195 } 196 197 // NewAddEmailConflict creates a AddEmailConflict with default headers values 198 func NewAddEmailConflict() *AddEmailConflict { 199 return &AddEmailConflict{} 200 } 201 202 /* AddEmailConflict describes a response with status code 409, with default header values. 203 204 Conflict 205 */ 206 type AddEmailConflict struct { 207 Payload *mono_models.Message 208 } 209 210 func (o *AddEmailConflict) Error() string { 211 return fmt.Sprintf("[POST /users/{username}/emails][%d] addEmailConflict %+v", 409, o.Payload) 212 } 213 func (o *AddEmailConflict) GetPayload() *mono_models.Message { 214 return o.Payload 215 } 216 217 func (o *AddEmailConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 218 219 o.Payload = new(mono_models.Message) 220 221 // response payload 222 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 223 return err 224 } 225 226 return nil 227 } 228 229 // NewAddEmailInternalServerError creates a AddEmailInternalServerError with default headers values 230 func NewAddEmailInternalServerError() *AddEmailInternalServerError { 231 return &AddEmailInternalServerError{} 232 } 233 234 /* AddEmailInternalServerError describes a response with status code 500, with default header values. 235 236 Server Error 237 */ 238 type AddEmailInternalServerError struct { 239 Payload *mono_models.Message 240 } 241 242 func (o *AddEmailInternalServerError) Error() string { 243 return fmt.Sprintf("[POST /users/{username}/emails][%d] addEmailInternalServerError %+v", 500, o.Payload) 244 } 245 func (o *AddEmailInternalServerError) GetPayload() *mono_models.Message { 246 return o.Payload 247 } 248 249 func (o *AddEmailInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 250 251 o.Payload = new(mono_models.Message) 252 253 // response payload 254 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 255 return err 256 } 257 258 return nil 259 } 260 261 /*AddEmailBody add email body 262 swagger:model AddEmailBody 263 */ 264 type AddEmailBody struct { 265 266 // email 267 Email string `json:"email,omitempty"` 268 } 269 270 // Validate validates this add email body 271 func (o *AddEmailBody) Validate(formats strfmt.Registry) error { 272 return nil 273 } 274 275 // ContextValidate validates this add email body based on context it is used 276 func (o *AddEmailBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 277 return nil 278 } 279 280 // MarshalBinary interface implementation 281 func (o *AddEmailBody) MarshalBinary() ([]byte, error) { 282 if o == nil { 283 return nil, nil 284 } 285 return swag.WriteJSON(o) 286 } 287 288 // UnmarshalBinary interface implementation 289 func (o *AddEmailBody) UnmarshalBinary(b []byte) error { 290 var res AddEmailBody 291 if err := swag.ReadJSON(b, &res); err != nil { 292 return err 293 } 294 *o = res 295 return nil 296 }