-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
120 lines (110 loc) · 2.47 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// go-swagger examples.
//
// The purpose of this application is to provide some
// use cases describing how to generate docs for your API
//
// Schemes: http, https
// Host: localhost
// BasePath: /
// Version: 0.0.1
//
// Consumes:
// - application/json
//
// Produces:
// - application/json
//
// swagger:meta
package main
import "net/http"
// An OrderBodyParams model.
//
// This is used for operations that want an Order as body of the request
// swagger:parameters createOrder
type OrderBodyParams struct {
// The order to submit.
//
// in: body
// required: true
Order *Order `json:"order"`
}
// An OrderQueryParams model.
//
// swagger:parameters listOrder
type OrderQueryParams struct {
// List order limitations.
//
// required: true
// minimum: 1
// maximum: 12
Limit int32 `json:"limit"`
}
// An OrderResponse response model
//
// This is used for returning a response with a single order as body
//
// swagger:response orderResponse
type OrderResponse struct {
//Get number of rate limted requests remaining
//
RateLimitRemaining string `json:"Rate-Limit-Remaining"`
//
// in: body
Payload *Order `json:"order"`
}
// A UserNameParams parameter model.
//
// This is used for operations that want the ID of a user in the path
// swagger:parameters getUserByNickname
type UserNameParams struct {
// The nickname of user
//
// in: path
// required: true
Nickname string `json:"nickname"`
}
// A ValidationError is a swagger response to represent error
//
// swagger:response validationError
type ValidationError struct {
// in: body
Body struct {
Code int32 `json:"code"`
Message string `json:"message"`
Field string `json:"field"`
} `json:"body"`
}
// CreateOrder swagger:route POST /orders orders createOrder
//
// Handler to create an order.
//
// Responses:
// 200: orderResponse
// 422: validationError
func CreateOrder(w http.ResponseWriter, req *http.Request) {
// your code here
}
// GetOrders swagger:route GET /orders orders listOrder
//
// Handler returning list of orders.
//
// List of orders made by current user
//
// Responses:
// 200: []order
func ListOrder(w http.ResponseWriter, r *http.Request) {
// your code here
}
// Me swagger:route GET /users{nickname} users getUserByNickname
//
// Handler returning information about user.
//
// Information about user
//
// Responses:
// 200: user
func GetUserByNickname(w http.ResponseWriter, r *http.Request) {
// your code here
}
func main() {
}