github.com/jamescostian/go-swagger@v0.30.4-0.20221130163922-68364d6b567b/fixtures/goparsing/classification/operations/todo_operation.go (about) 1 // Copyright 2015 go-swagger maintainers 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package operations 16 17 // ListPetParams the params for the list pets query 18 type ListPetParams struct { 19 // OutOfStock when set to true only the pets that are out of stock will be returned 20 OutOfStock bool 21 } 22 23 // ServeAPI serves the API for this record store 24 func ServeAPI(host, basePath string, schemes []string) error { 25 26 // swagger:route GET /pets pets users listPets 27 // 28 // Lists pets filtered by some parameters. 29 // 30 // This will show all available pets by default. 31 // You can get the pets that are out of stock 32 // 33 // Consumes: 34 // application/json 35 // application/x-protobuf 36 // 37 // Produces: 38 // application/json 39 // application/x-protobuf 40 // 41 // Schemes: http, https, ws, wss 42 // 43 // Security: 44 // api_key: 45 // oauth: read, write 46 // 47 // Responses: 48 // default: genericError 49 // 200: someResponse 50 // 422: validationError 51 // 52 // Extensions: 53 // x-some-flag: true 54 mountItem("GET", basePath+"/pets", nil) 55 56 /* swagger:route POST /pets pets users createPet 57 58 Create a pet based on the parameters. 59 60 Consumes: 61 - application/json 62 - application/x-protobuf 63 64 Produces: 65 - application/json 66 - application/x-protobuf 67 68 Schemes: http, https, ws, wss 69 70 Responses: 71 default: genericError 72 200: someResponse 73 422: validationError 74 75 Security: 76 api_key: 77 oauth: read, write */ 78 mountItem("POST", basePath+"/pets", nil) 79 80 // swagger:route GET /orders orders listOrders 81 // 82 // lists orders filtered by some parameters. 83 // 84 // Consumes: 85 // application/json 86 // application/x-protobuf 87 // 88 // Produces: 89 // application/json 90 // application/x-protobuf 91 // 92 // Schemes: http, https, ws, wss 93 // 94 // Security: 95 // api_key: 96 // oauth: orders:read, https://www.googleapis.com/auth/userinfo.email 97 // 98 // Responses: 99 // default: genericError 100 // 200: someResponse 101 // 422: validationError 102 // 103 // Extensions: 104 // x-some-flag: false 105 // x-some-list: 106 // - item1 107 // - item2 108 // - item3 109 // x-some-object: 110 // key1: value1 111 // key2: value2 112 // subobject: 113 // subkey1: subvalue1 114 // subkey2: subvalue2 115 mountItem("GET", basePath+"/orders", nil) 116 117 // swagger:route POST /orders orders createOrder 118 // 119 // create an order based on the parameters. 120 // 121 // Consumes: 122 // application/json 123 // application/x-protobuf 124 // 125 // Produces: 126 // application/json 127 // application/x-protobuf 128 // 129 // Schemes: http, https, ws, wss 130 // 131 // Security: 132 // api_key: 133 // oauth: read, write 134 // 135 // Responses: 136 // default: genericError 137 // 200: someResponse 138 // 422: validationError 139 mountItem("POST", basePath+"/orders", nil) 140 141 // swagger:route GET /orders/{id} orders orderDetails 142 // 143 // gets the details for an order. 144 // 145 // Consumes: 146 // application/json 147 // application/x-protobuf 148 // 149 // Produces: 150 // application/json 151 // application/x-protobuf 152 // 153 // Schemes: http, https, ws, wss 154 // 155 // Security: 156 // api_key: 157 // oauth: read, write 158 // 159 // Responses: 160 // default: genericError 161 // 200: someResponse 162 // 201: fileResponse 163 // 422: validationError 164 mountItem("GET", basePath+"/orders/:id", nil) 165 166 // swagger:route PUT /orders/{id} orders updateOrder 167 // 168 // Update the details for an order. 169 // 170 // When the order doesn't exist this will return an error. 171 // 172 // Consumes: 173 // application/json 174 // application/x-protobuf 175 // 176 // Produces: 177 // application/json 178 // application/x-protobuf 179 // 180 // Schemes: http, https, ws, wss 181 // 182 // Security: 183 // api_key: 184 // oauth: read, write 185 // 186 // Responses: 187 // default: genericError 188 // 200: someResponse 189 // 422: validationError 190 mountItem("PUT", basePath+"/orders/:id", nil) 191 192 // swagger:route DELETE /orders/{id} deleteOrder 193 // 194 // delete a particular order. 195 // 196 // Consumes: 197 // application/json 198 // application/x-protobuf 199 // 200 // Produces: 201 // application/json 202 // application/x-protobuf 203 // 204 // Schemes: http, https, ws, wss 205 // 206 // Security: 207 // api_key: 208 // oauth: read, write 209 // 210 // Responses: 211 // default: genericError 212 // 200: someResponse 213 // 202: description:Some description 214 // 422: validationError 215 mountItem("DELETE", basePath+"/orders/:id", nil) 216 217 return nil 218 } 219 220 // not really used but I need a method to decorate the calls to 221 func mountItem(method, path string, handler interface{}) {}