/
options.go
64 lines (52 loc) · 1.15 KB
/
options.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
package openapi
import (
"net/http"
)
type Options struct {
Summary string
Description string
OperationID string
Tags []string
Authentication map[string][]string
Response map[string]MethodResponse
Path *PathBuilder
Headers []Parameter
Extensions
http.HandlerFunc
}
func (m *Options) GetSummary() string {
return m.Summary
}
func (m *Options) GetOperationID() string {
return m.OperationID
}
func (m *Options) GetDescription() string {
return m.Description
}
func (m *Options) GetExtensions() map[string]interface{} {
return m.Extensions
}
func (m *Options) GetResponse(s string) (string, interface{}) {
if r, ok := m.Response[s]; ok {
return r.Description, r.Value
}
return "", nil
}
func (m *Options) GetAuthentication(key string) (bool, []string) {
if a, ok := m.Authentication[key]; ok {
return true, a
}
return false, nil
}
func (m *Options) GetHeaders() []Parameter {
return m.Headers
}
func (m *Options) GetRequestBodies() *RequestBodies {
return nil
}
func (m *Options) GetTags() []string {
return m.Tags
}
func (m *Options) GetHandlerFunc() http.HandlerFunc {
return m.HandlerFunc
}