github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/projects/add_branch_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package projects 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 // AddBranchReader is a Reader for the AddBranch structure. 21 type AddBranchReader struct { 22 formats strfmt.Registry 23 } 24 25 // ReadResponse reads a server response into the received o. 26 func (o *AddBranchReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 27 switch response.Code() { 28 case 200: 29 result := NewAddBranchOK() 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 := NewAddBranchBadRequest() 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 := NewAddBranchForbidden() 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 := NewAddBranchNotFound() 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 := NewAddBranchConflict() 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 := NewAddBranchInternalServerError() 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 // NewAddBranchOK creates a AddBranchOK with default headers values 70 func NewAddBranchOK() *AddBranchOK { 71 return &AddBranchOK{} 72 } 73 74 /* AddBranchOK describes a response with status code 200, with default header values. 75 76 Success 77 */ 78 type AddBranchOK struct { 79 Payload *mono_models.Branch 80 } 81 82 func (o *AddBranchOK) Error() string { 83 return fmt.Sprintf("[POST /projects/{projectID}/branches][%d] addBranchOK %+v", 200, o.Payload) 84 } 85 func (o *AddBranchOK) GetPayload() *mono_models.Branch { 86 return o.Payload 87 } 88 89 func (o *AddBranchOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 90 91 o.Payload = new(mono_models.Branch) 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 // NewAddBranchBadRequest creates a AddBranchBadRequest with default headers values 102 func NewAddBranchBadRequest() *AddBranchBadRequest { 103 return &AddBranchBadRequest{} 104 } 105 106 /* AddBranchBadRequest describes a response with status code 400, with default header values. 107 108 Bad Request 109 */ 110 type AddBranchBadRequest struct { 111 Payload *mono_models.Message 112 } 113 114 func (o *AddBranchBadRequest) Error() string { 115 return fmt.Sprintf("[POST /projects/{projectID}/branches][%d] addBranchBadRequest %+v", 400, o.Payload) 116 } 117 func (o *AddBranchBadRequest) GetPayload() *mono_models.Message { 118 return o.Payload 119 } 120 121 func (o *AddBranchBadRequest) 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 // NewAddBranchForbidden creates a AddBranchForbidden with default headers values 134 func NewAddBranchForbidden() *AddBranchForbidden { 135 return &AddBranchForbidden{} 136 } 137 138 /* AddBranchForbidden describes a response with status code 403, with default header values. 139 140 Forbidden 141 */ 142 type AddBranchForbidden struct { 143 Payload *mono_models.Message 144 } 145 146 func (o *AddBranchForbidden) Error() string { 147 return fmt.Sprintf("[POST /projects/{projectID}/branches][%d] addBranchForbidden %+v", 403, o.Payload) 148 } 149 func (o *AddBranchForbidden) GetPayload() *mono_models.Message { 150 return o.Payload 151 } 152 153 func (o *AddBranchForbidden) 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 // NewAddBranchNotFound creates a AddBranchNotFound with default headers values 166 func NewAddBranchNotFound() *AddBranchNotFound { 167 return &AddBranchNotFound{} 168 } 169 170 /* AddBranchNotFound describes a response with status code 404, with default header values. 171 172 Not Found 173 */ 174 type AddBranchNotFound struct { 175 Payload *mono_models.Message 176 } 177 178 func (o *AddBranchNotFound) Error() string { 179 return fmt.Sprintf("[POST /projects/{projectID}/branches][%d] addBranchNotFound %+v", 404, o.Payload) 180 } 181 func (o *AddBranchNotFound) GetPayload() *mono_models.Message { 182 return o.Payload 183 } 184 185 func (o *AddBranchNotFound) 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 // NewAddBranchConflict creates a AddBranchConflict with default headers values 198 func NewAddBranchConflict() *AddBranchConflict { 199 return &AddBranchConflict{} 200 } 201 202 /* AddBranchConflict describes a response with status code 409, with default header values. 203 204 Conflict 205 */ 206 type AddBranchConflict struct { 207 Payload *mono_models.Message 208 } 209 210 func (o *AddBranchConflict) Error() string { 211 return fmt.Sprintf("[POST /projects/{projectID}/branches][%d] addBranchConflict %+v", 409, o.Payload) 212 } 213 func (o *AddBranchConflict) GetPayload() *mono_models.Message { 214 return o.Payload 215 } 216 217 func (o *AddBranchConflict) 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 // NewAddBranchInternalServerError creates a AddBranchInternalServerError with default headers values 230 func NewAddBranchInternalServerError() *AddBranchInternalServerError { 231 return &AddBranchInternalServerError{} 232 } 233 234 /* AddBranchInternalServerError describes a response with status code 500, with default header values. 235 236 Server Error 237 */ 238 type AddBranchInternalServerError struct { 239 Payload *mono_models.Message 240 } 241 242 func (o *AddBranchInternalServerError) Error() string { 243 return fmt.Sprintf("[POST /projects/{projectID}/branches][%d] addBranchInternalServerError %+v", 500, o.Payload) 244 } 245 func (o *AddBranchInternalServerError) GetPayload() *mono_models.Message { 246 return o.Payload 247 } 248 249 func (o *AddBranchInternalServerError) 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 /*AddBranchBody add branch body 262 swagger:model AddBranchBody 263 */ 264 type AddBranchBody struct { 265 266 // branch label 267 Label string `json:"label,omitempty"` 268 } 269 270 // Validate validates this add branch body 271 func (o *AddBranchBody) Validate(formats strfmt.Registry) error { 272 return nil 273 } 274 275 // ContextValidate validates this add branch body based on context it is used 276 func (o *AddBranchBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 277 return nil 278 } 279 280 // MarshalBinary interface implementation 281 func (o *AddBranchBody) 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 *AddBranchBody) UnmarshalBinary(b []byte) error { 290 var res AddBranchBody 291 if err := swag.ReadJSON(b, &res); err != nil { 292 return err 293 } 294 *o = res 295 return nil 296 }