github.com/ryanbennettvoid/go-swagger@v0.18.1-0.20190104015444-3854bbbe2392/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 mountItem("GET", basePath+"/pets", nil) 52 53 /* swagger:route POST /pets pets users createPet 54 55 Create a pet based on the parameters. 56 57 Consumes: 58 - application/json 59 - application/x-protobuf 60 61 Produces: 62 - application/json 63 - application/x-protobuf 64 65 Schemes: http, https, ws, wss 66 67 Responses: 68 default: genericError 69 200: someResponse 70 422: validationError 71 72 Security: 73 api_key: 74 oauth: read, write */ 75 mountItem("POST", basePath+"/pets", nil) 76 77 // swagger:route GET /orders orders listOrders 78 // 79 // lists orders filtered by some parameters. 80 // 81 // Consumes: 82 // application/json 83 // application/x-protobuf 84 // 85 // Produces: 86 // application/json 87 // application/x-protobuf 88 // 89 // Schemes: http, https, ws, wss 90 // 91 // Security: 92 // api_key: 93 // oauth: orders:read, https://www.googleapis.com/auth/userinfo.email 94 // 95 // Responses: 96 // default: genericError 97 // 200: someResponse 98 // 422: validationError 99 mountItem("GET", basePath+"/orders", nil) 100 101 // swagger:route POST /orders orders createOrder 102 // 103 // create an order based on the parameters. 104 // 105 // Consumes: 106 // application/json 107 // application/x-protobuf 108 // 109 // Produces: 110 // application/json 111 // application/x-protobuf 112 // 113 // Schemes: http, https, ws, wss 114 // 115 // Security: 116 // api_key: 117 // oauth: read, write 118 // 119 // Responses: 120 // default: genericError 121 // 200: someResponse 122 // 422: validationError 123 mountItem("POST", basePath+"/orders", nil) 124 125 // swagger:route GET /orders/{id} orders orderDetails 126 // 127 // gets the details for an order. 128 // 129 // Consumes: 130 // application/json 131 // application/x-protobuf 132 // 133 // Produces: 134 // application/json 135 // application/x-protobuf 136 // 137 // Schemes: http, https, ws, wss 138 // 139 // Security: 140 // api_key: 141 // oauth: read, write 142 // 143 // Responses: 144 // default: genericError 145 // 200: someResponse 146 // 422: validationError 147 mountItem("GET", basePath+"/orders/:id", nil) 148 149 // swagger:route PUT /orders/{id} orders updateOrder 150 // 151 // Update the details for an order. 152 // 153 // When the order doesn't exist this will return an error. 154 // 155 // Consumes: 156 // application/json 157 // application/x-protobuf 158 // 159 // Produces: 160 // application/json 161 // application/x-protobuf 162 // 163 // Schemes: http, https, ws, wss 164 // 165 // Security: 166 // api_key: 167 // oauth: read, write 168 // 169 // Responses: 170 // default: genericError 171 // 200: someResponse 172 // 422: validationError 173 mountItem("PUT", basePath+"/orders/:id", nil) 174 175 // swagger:route DELETE /orders/{id} deleteOrder 176 // 177 // delete a particular order. 178 // 179 // Consumes: 180 // application/json 181 // application/x-protobuf 182 // 183 // Produces: 184 // application/json 185 // application/x-protobuf 186 // 187 // Schemes: http, https, ws, wss 188 // 189 // Security: 190 // api_key: 191 // oauth: read, write 192 // 193 // Responses: 194 // default: genericError 195 // 200: someResponse 196 // 202: description:Some description 197 // 422: validationError 198 mountItem("DELETE", basePath+"/orders/:id", nil) 199 200 return nil 201 } 202 203 // not really used but I need a method to decorate the calls to 204 func mountItem(method, path string, handler interface{}) {}