github.com/youyuanwu/go-swagger@v0.19.0/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 // 201: fileResponse 147 // 422: validationError 148 mountItem("GET", basePath+"/orders/:id", nil) 149 150 // swagger:route PUT /orders/{id} orders updateOrder 151 // 152 // Update the details for an order. 153 // 154 // When the order doesn't exist this will return an error. 155 // 156 // Consumes: 157 // application/json 158 // application/x-protobuf 159 // 160 // Produces: 161 // application/json 162 // application/x-protobuf 163 // 164 // Schemes: http, https, ws, wss 165 // 166 // Security: 167 // api_key: 168 // oauth: read, write 169 // 170 // Responses: 171 // default: genericError 172 // 200: someResponse 173 // 422: validationError 174 mountItem("PUT", basePath+"/orders/:id", nil) 175 176 // swagger:route DELETE /orders/{id} deleteOrder 177 // 178 // delete a particular order. 179 // 180 // Consumes: 181 // application/json 182 // application/x-protobuf 183 // 184 // Produces: 185 // application/json 186 // application/x-protobuf 187 // 188 // Schemes: http, https, ws, wss 189 // 190 // Security: 191 // api_key: 192 // oauth: read, write 193 // 194 // Responses: 195 // default: genericError 196 // 200: someResponse 197 // 202: description:Some description 198 // 422: validationError 199 mountItem("DELETE", basePath+"/orders/:id", nil) 200 201 return nil 202 } 203 204 // not really used but I need a method to decorate the calls to 205 func mountItem(method, path string, handler interface{}) {}