github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/users/delete_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 // DeleteEmailReader is a Reader for the DeleteEmail structure. 21 type DeleteEmailReader struct { 22 formats strfmt.Registry 23 } 24 25 // ReadResponse reads a server response into the received o. 26 func (o *DeleteEmailReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 27 switch response.Code() { 28 case 200: 29 result := NewDeleteEmailOK() 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 := NewDeleteEmailBadRequest() 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 := NewDeleteEmailForbidden() 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 := NewDeleteEmailNotFound() 48 if err := result.readResponse(response, consumer, o.formats); err != nil { 49 return nil, err 50 } 51 return nil, result 52 case 500: 53 result := NewDeleteEmailInternalServerError() 54 if err := result.readResponse(response, consumer, o.formats); err != nil { 55 return nil, err 56 } 57 return nil, result 58 default: 59 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 60 } 61 } 62 63 // NewDeleteEmailOK creates a DeleteEmailOK with default headers values 64 func NewDeleteEmailOK() *DeleteEmailOK { 65 return &DeleteEmailOK{} 66 } 67 68 /* DeleteEmailOK describes a response with status code 200, with default header values. 69 70 Email deleted 71 */ 72 type DeleteEmailOK struct { 73 Payload *mono_models.Message 74 } 75 76 func (o *DeleteEmailOK) Error() string { 77 return fmt.Sprintf("[DELETE /users/{username}/emails][%d] deleteEmailOK %+v", 200, o.Payload) 78 } 79 func (o *DeleteEmailOK) GetPayload() *mono_models.Message { 80 return o.Payload 81 } 82 83 func (o *DeleteEmailOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 84 85 o.Payload = new(mono_models.Message) 86 87 // response payload 88 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 89 return err 90 } 91 92 return nil 93 } 94 95 // NewDeleteEmailBadRequest creates a DeleteEmailBadRequest with default headers values 96 func NewDeleteEmailBadRequest() *DeleteEmailBadRequest { 97 return &DeleteEmailBadRequest{} 98 } 99 100 /* DeleteEmailBadRequest describes a response with status code 400, with default header values. 101 102 Bad Request 103 */ 104 type DeleteEmailBadRequest struct { 105 Payload *mono_models.Message 106 } 107 108 func (o *DeleteEmailBadRequest) Error() string { 109 return fmt.Sprintf("[DELETE /users/{username}/emails][%d] deleteEmailBadRequest %+v", 400, o.Payload) 110 } 111 func (o *DeleteEmailBadRequest) GetPayload() *mono_models.Message { 112 return o.Payload 113 } 114 115 func (o *DeleteEmailBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 116 117 o.Payload = new(mono_models.Message) 118 119 // response payload 120 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 121 return err 122 } 123 124 return nil 125 } 126 127 // NewDeleteEmailForbidden creates a DeleteEmailForbidden with default headers values 128 func NewDeleteEmailForbidden() *DeleteEmailForbidden { 129 return &DeleteEmailForbidden{} 130 } 131 132 /* DeleteEmailForbidden describes a response with status code 403, with default header values. 133 134 Forbidden 135 */ 136 type DeleteEmailForbidden struct { 137 Payload *mono_models.Message 138 } 139 140 func (o *DeleteEmailForbidden) Error() string { 141 return fmt.Sprintf("[DELETE /users/{username}/emails][%d] deleteEmailForbidden %+v", 403, o.Payload) 142 } 143 func (o *DeleteEmailForbidden) GetPayload() *mono_models.Message { 144 return o.Payload 145 } 146 147 func (o *DeleteEmailForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 148 149 o.Payload = new(mono_models.Message) 150 151 // response payload 152 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 153 return err 154 } 155 156 return nil 157 } 158 159 // NewDeleteEmailNotFound creates a DeleteEmailNotFound with default headers values 160 func NewDeleteEmailNotFound() *DeleteEmailNotFound { 161 return &DeleteEmailNotFound{} 162 } 163 164 /* DeleteEmailNotFound describes a response with status code 404, with default header values. 165 166 Not Found 167 */ 168 type DeleteEmailNotFound struct { 169 Payload *mono_models.Message 170 } 171 172 func (o *DeleteEmailNotFound) Error() string { 173 return fmt.Sprintf("[DELETE /users/{username}/emails][%d] deleteEmailNotFound %+v", 404, o.Payload) 174 } 175 func (o *DeleteEmailNotFound) GetPayload() *mono_models.Message { 176 return o.Payload 177 } 178 179 func (o *DeleteEmailNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 180 181 o.Payload = new(mono_models.Message) 182 183 // response payload 184 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 185 return err 186 } 187 188 return nil 189 } 190 191 // NewDeleteEmailInternalServerError creates a DeleteEmailInternalServerError with default headers values 192 func NewDeleteEmailInternalServerError() *DeleteEmailInternalServerError { 193 return &DeleteEmailInternalServerError{} 194 } 195 196 /* DeleteEmailInternalServerError describes a response with status code 500, with default header values. 197 198 Server Error 199 */ 200 type DeleteEmailInternalServerError struct { 201 Payload *mono_models.Message 202 } 203 204 func (o *DeleteEmailInternalServerError) Error() string { 205 return fmt.Sprintf("[DELETE /users/{username}/emails][%d] deleteEmailInternalServerError %+v", 500, o.Payload) 206 } 207 func (o *DeleteEmailInternalServerError) GetPayload() *mono_models.Message { 208 return o.Payload 209 } 210 211 func (o *DeleteEmailInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 212 213 o.Payload = new(mono_models.Message) 214 215 // response payload 216 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 217 return err 218 } 219 220 return nil 221 } 222 223 /*DeleteEmailBody delete email body 224 swagger:model DeleteEmailBody 225 */ 226 type DeleteEmailBody struct { 227 228 // email 229 Email string `json:"email,omitempty"` 230 } 231 232 // Validate validates this delete email body 233 func (o *DeleteEmailBody) Validate(formats strfmt.Registry) error { 234 return nil 235 } 236 237 // ContextValidate validates this delete email body based on context it is used 238 func (o *DeleteEmailBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 239 return nil 240 } 241 242 // MarshalBinary interface implementation 243 func (o *DeleteEmailBody) MarshalBinary() ([]byte, error) { 244 if o == nil { 245 return nil, nil 246 } 247 return swag.WriteJSON(o) 248 } 249 250 // UnmarshalBinary interface implementation 251 func (o *DeleteEmailBody) UnmarshalBinary(b []byte) error { 252 var res DeleteEmailBody 253 if err := swag.ReadJSON(b, &res); err != nil { 254 return err 255 } 256 *o = res 257 return nil 258 }