github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/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 // 64 // default: genericError 65 // 200: orderResponse 66 func GetOrderDetails(rw http.ResponseWriter, req *http.Request, params denco.Params) { 67 // some actual stuff should happen in here 68 } 69 70 // CancelOrder swagger:route DELETE /orders/{id} orders cancelOrder 71 // 72 // Deletes an order. 73 // 74 // Responses: 75 // 76 // default: genericError 77 // 204: 78 func CancelOrder(rw http.ResponseWriter, req *http.Request, params denco.Params) { 79 // some actual stuff should happen in here 80 } 81 82 // UpdateOrder swagger:route PUT /orders/{id} orders updateOrder 83 // 84 // Updates an order. 85 // 86 // Responses: 87 // 88 // default: genericError 89 // 200: order 90 // 422: validationError 91 func UpdateOrder(rw http.ResponseWriter, req *http.Request, params denco.Params) { 92 // some actual stuff should happen in here 93 } 94 95 // CreateOrder swagger:route POST /orders orders createOrder 96 // 97 // Creates an order. 98 // 99 // Responses: 100 // 101 // default: genericError 102 // 200: orderResponse 103 // 422: validationError 104 func CreateOrder(rw http.ResponseWriter, req *http.Request, params denco.Params) { 105 // some actual stuff should happen in here 106 } 107 108 // GetHelp swagger:route GET /help help 109 // 110 // # Gets the help as markdown 111 // 112 // Responses: 113 // 114 // default: genericError 115 // 200: MarkdownRender 116 // 422: validationError 117 func GetHelp(rw http.ResponseWriter, req *http.Request, params denco.Params) { 118 // some actual stuff should happen in here 119 } 120 121 // MarkdownRender is a rendered markdown document 122 // swagger:response MarkdownRender 123 type MarkdownRender string