github.com/rzurga/go-swagger@v0.28.1-0.20211109195225-5d1f453ffa3a/fixtures/goparsing/petstore/rest/handlers/orders.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 handlers 16 17 import ( 18 "net/http" 19 20 "github.com/go-openapi/runtime/middleware/denco" 21 "github.com/go-swagger/go-swagger/fixtures/goparsing/petstore/models" 22 ) 23 24 // An OrderID parameter model. 25 // 26 // This is used for operations that want the ID of an order in the path 27 // swagger:parameters getOrderDetails cancelOrder updateOrder 28 type OrderID struct { 29 // The ID of the order 30 // 31 // in: path 32 // required: true 33 ID int64 `json:"id"` 34 } 35 36 // An OrderBodyParams model. 37 // 38 // This is used for operations that want an Order as body of the request 39 // swagger:parameters updateOrder createOrder 40 type OrderBodyParams struct { 41 // The order to submit 42 // 43 // required: true 44 // in: body 45 Order *models.Order `json:"order"` 46 } 47 48 // An OrderResponse response model 49 // 50 // This is used for returning a response with a single order as body 51 // 52 // swagger:response orderResponse 53 type OrderResponse struct { 54 // in: body 55 Payload *models.Order `json:"order"` 56 } 57 58 // GetOrderDetails swagger:route GET /orders/{id} orders getOrderDetails 59 // 60 // Gets the details for an order. 61 // 62 // Responses: 63 // default: genericError 64 // 200: orderResponse 65 func GetOrderDetails(rw http.ResponseWriter, req *http.Request, params denco.Params) { 66 // some actual stuff should happen in here 67 } 68 69 // CancelOrder swagger:route DELETE /orders/{id} orders cancelOrder 70 // 71 // Deletes an order. 72 // 73 // Responses: 74 // default: genericError 75 // 204: 76 func CancelOrder(rw http.ResponseWriter, req *http.Request, params denco.Params) { 77 // some actual stuff should happen in here 78 } 79 80 // UpdateOrder swagger:route PUT /orders/{id} orders updateOrder 81 // 82 // Updates an order. 83 // 84 // Responses: 85 // default: genericError 86 // 200: order 87 // 422: validationError 88 func UpdateOrder(rw http.ResponseWriter, req *http.Request, params denco.Params) { 89 // some actual stuff should happen in here 90 } 91 92 // CreateOrder swagger:route POST /orders orders createOrder 93 // 94 // Creates an order. 95 // 96 // Responses: 97 // default: genericError 98 // 200: orderResponse 99 // 422: validationError 100 func CreateOrder(rw http.ResponseWriter, req *http.Request, params denco.Params) { 101 // some actual stuff should happen in here 102 } 103 104 // GetHelp swagger:route GET /help help 105 // 106 // Gets the help as markdown 107 // 108 // Responses: 109 // default: genericError 110 // 200: MarkdownRender 111 // 422: validationError 112 func GetHelp(rw http.ResponseWriter, req *http.Request, params denco.Params) { 113 // some actual stuff should happen in here 114 } 115 116 // MarkdownRender is a rendered markdown document 117 // swagger:response MarkdownRender 118 type MarkdownRender string