-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathendpoint.go
More file actions
46 lines (39 loc) · 883 Bytes
/
endpoint.go
File metadata and controls
46 lines (39 loc) · 883 Bytes
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
package simplapi
type Endpoint struct {
method string
path string
tags []string
summary string
description string
operationId string
handlers []interface{}
addToSpec bool
}
func newEndpoint(method string, path string, handlers ...interface{}) *Endpoint {
return &Endpoint{
method: method,
path: path,
handlers: handlers,
addToSpec: true,
}
}
func (e *Endpoint) WithTag(tag string) *Endpoint {
e.tags = append(e.tags, tag)
return e
}
func (e *Endpoint) WithSummary(summary string) *Endpoint {
e.summary = summary
return e
}
func (e *Endpoint) WithDescription(description string) *Endpoint {
e.description = description
return e
}
func (e *Endpoint) WithOperationId(operationId string) *Endpoint {
e.operationId = operationId
return e
}
func (e *Endpoint) WithoutSpec() *Endpoint {
e.addToSpec = false
return e
}