github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/users/search_usernames_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 // SearchUsernamesReader is a Reader for the SearchUsernames structure. 21 type SearchUsernamesReader struct { 22 formats strfmt.Registry 23 } 24 25 // ReadResponse reads a server response into the received o. 26 func (o *SearchUsernamesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 27 switch response.Code() { 28 case 200: 29 result := NewSearchUsernamesOK() 30 if err := result.readResponse(response, consumer, o.formats); err != nil { 31 return nil, err 32 } 33 return result, nil 34 case 403: 35 result := NewSearchUsernamesForbidden() 36 if err := result.readResponse(response, consumer, o.formats); err != nil { 37 return nil, err 38 } 39 return nil, result 40 case 500: 41 result := NewSearchUsernamesInternalServerError() 42 if err := result.readResponse(response, consumer, o.formats); err != nil { 43 return nil, err 44 } 45 return nil, result 46 default: 47 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 48 } 49 } 50 51 // NewSearchUsernamesOK creates a SearchUsernamesOK with default headers values 52 func NewSearchUsernamesOK() *SearchUsernamesOK { 53 return &SearchUsernamesOK{} 54 } 55 56 /* SearchUsernamesOK describes a response with status code 200, with default header values. 57 58 Search for users matching the given search string 59 */ 60 type SearchUsernamesOK struct { 61 Payload []*mono_models.User 62 } 63 64 func (o *SearchUsernamesOK) Error() string { 65 return fmt.Sprintf("[POST /users/search_usernames][%d] searchUsernamesOK %+v", 200, o.Payload) 66 } 67 func (o *SearchUsernamesOK) GetPayload() []*mono_models.User { 68 return o.Payload 69 } 70 71 func (o *SearchUsernamesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 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 // NewSearchUsernamesForbidden creates a SearchUsernamesForbidden with default headers values 82 func NewSearchUsernamesForbidden() *SearchUsernamesForbidden { 83 return &SearchUsernamesForbidden{} 84 } 85 86 /* SearchUsernamesForbidden describes a response with status code 403, with default header values. 87 88 Forbidden 89 */ 90 type SearchUsernamesForbidden struct { 91 Payload *mono_models.Message 92 } 93 94 func (o *SearchUsernamesForbidden) Error() string { 95 return fmt.Sprintf("[POST /users/search_usernames][%d] searchUsernamesForbidden %+v", 403, o.Payload) 96 } 97 func (o *SearchUsernamesForbidden) GetPayload() *mono_models.Message { 98 return o.Payload 99 } 100 101 func (o *SearchUsernamesForbidden) 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 // NewSearchUsernamesInternalServerError creates a SearchUsernamesInternalServerError with default headers values 114 func NewSearchUsernamesInternalServerError() *SearchUsernamesInternalServerError { 115 return &SearchUsernamesInternalServerError{} 116 } 117 118 /* SearchUsernamesInternalServerError describes a response with status code 500, with default header values. 119 120 Server Error 121 */ 122 type SearchUsernamesInternalServerError struct { 123 Payload *mono_models.Message 124 } 125 126 func (o *SearchUsernamesInternalServerError) Error() string { 127 return fmt.Sprintf("[POST /users/search_usernames][%d] searchUsernamesInternalServerError %+v", 500, o.Payload) 128 } 129 func (o *SearchUsernamesInternalServerError) GetPayload() *mono_models.Message { 130 return o.Payload 131 } 132 133 func (o *SearchUsernamesInternalServerError) 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 } 144 145 /*SearchUsernamesBody search usernames body 146 swagger:model SearchUsernamesBody 147 */ 148 type SearchUsernamesBody struct { 149 150 // The search query 151 Query string `json:"query,omitempty"` 152 } 153 154 // Validate validates this search usernames body 155 func (o *SearchUsernamesBody) Validate(formats strfmt.Registry) error { 156 return nil 157 } 158 159 // ContextValidate validates this search usernames body based on context it is used 160 func (o *SearchUsernamesBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 161 return nil 162 } 163 164 // MarshalBinary interface implementation 165 func (o *SearchUsernamesBody) MarshalBinary() ([]byte, error) { 166 if o == nil { 167 return nil, nil 168 } 169 return swag.WriteJSON(o) 170 } 171 172 // UnmarshalBinary interface implementation 173 func (o *SearchUsernamesBody) UnmarshalBinary(b []byte) error { 174 var res SearchUsernamesBody 175 if err := swag.ReadJSON(b, &res); err != nil { 176 return err 177 } 178 *o = res 179 return nil 180 }