1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package entries
20
21
22
23
24 import (
25 "github.com/go-openapi/runtime"
26 "github.com/go-openapi/strfmt"
27 )
28
29
30 func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
31 return &Client{transport: transport, formats: formats}
32 }
33
34
37 type Client struct {
38 transport runtime.ClientTransport
39 formats strfmt.Registry
40 }
41
42
43 type ClientOption func(*runtime.ClientOperation)
44
45
46 type ClientService interface {
47 CreateLogEntry(params *CreateLogEntryParams, opts ...ClientOption) (*CreateLogEntryCreated, error)
48
49 GetLogEntryByIndex(params *GetLogEntryByIndexParams, opts ...ClientOption) (*GetLogEntryByIndexOK, error)
50
51 GetLogEntryByUUID(params *GetLogEntryByUUIDParams, opts ...ClientOption) (*GetLogEntryByUUIDOK, error)
52
53 SearchLogQuery(params *SearchLogQueryParams, opts ...ClientOption) (*SearchLogQueryOK, error)
54
55 SetTransport(transport runtime.ClientTransport)
56 }
57
58
63 func (a *Client) CreateLogEntry(params *CreateLogEntryParams, opts ...ClientOption) (*CreateLogEntryCreated, error) {
64
65 if params == nil {
66 params = NewCreateLogEntryParams()
67 }
68 op := &runtime.ClientOperation{
69 ID: "createLogEntry",
70 Method: "POST",
71 PathPattern: "/api/v1/log/entries",
72 ProducesMediaTypes: []string{"application/json"},
73 ConsumesMediaTypes: []string{"application/json"},
74 Schemes: []string{"http"},
75 Params: params,
76 Reader: &CreateLogEntryReader{formats: a.formats},
77 Context: params.Context,
78 Client: params.HTTPClient,
79 }
80 for _, opt := range opts {
81 opt(op)
82 }
83
84 result, err := a.transport.Submit(op)
85 if err != nil {
86 return nil, err
87 }
88 success, ok := result.(*CreateLogEntryCreated)
89 if ok {
90 return success, nil
91 }
92
93 unexpectedSuccess := result.(*CreateLogEntryDefault)
94 return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
95 }
96
97
100 func (a *Client) GetLogEntryByIndex(params *GetLogEntryByIndexParams, opts ...ClientOption) (*GetLogEntryByIndexOK, error) {
101
102 if params == nil {
103 params = NewGetLogEntryByIndexParams()
104 }
105 op := &runtime.ClientOperation{
106 ID: "getLogEntryByIndex",
107 Method: "GET",
108 PathPattern: "/api/v1/log/entries",
109 ProducesMediaTypes: []string{"application/json"},
110 ConsumesMediaTypes: []string{"application/json"},
111 Schemes: []string{"http"},
112 Params: params,
113 Reader: &GetLogEntryByIndexReader{formats: a.formats},
114 Context: params.Context,
115 Client: params.HTTPClient,
116 }
117 for _, opt := range opts {
118 opt(op)
119 }
120
121 result, err := a.transport.Submit(op)
122 if err != nil {
123 return nil, err
124 }
125 success, ok := result.(*GetLogEntryByIndexOK)
126 if ok {
127 return success, nil
128 }
129
130 unexpectedSuccess := result.(*GetLogEntryByIndexDefault)
131 return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
132 }
133
134
139 func (a *Client) GetLogEntryByUUID(params *GetLogEntryByUUIDParams, opts ...ClientOption) (*GetLogEntryByUUIDOK, error) {
140
141 if params == nil {
142 params = NewGetLogEntryByUUIDParams()
143 }
144 op := &runtime.ClientOperation{
145 ID: "getLogEntryByUUID",
146 Method: "GET",
147 PathPattern: "/api/v1/log/entries/{entryUUID}",
148 ProducesMediaTypes: []string{"application/json"},
149 ConsumesMediaTypes: []string{"application/json"},
150 Schemes: []string{"http"},
151 Params: params,
152 Reader: &GetLogEntryByUUIDReader{formats: a.formats},
153 Context: params.Context,
154 Client: params.HTTPClient,
155 }
156 for _, opt := range opts {
157 opt(op)
158 }
159
160 result, err := a.transport.Submit(op)
161 if err != nil {
162 return nil, err
163 }
164 success, ok := result.(*GetLogEntryByUUIDOK)
165 if ok {
166 return success, nil
167 }
168
169 unexpectedSuccess := result.(*GetLogEntryByUUIDDefault)
170 return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
171 }
172
173
176 func (a *Client) SearchLogQuery(params *SearchLogQueryParams, opts ...ClientOption) (*SearchLogQueryOK, error) {
177
178 if params == nil {
179 params = NewSearchLogQueryParams()
180 }
181 op := &runtime.ClientOperation{
182 ID: "searchLogQuery",
183 Method: "POST",
184 PathPattern: "/api/v1/log/entries/retrieve",
185 ProducesMediaTypes: []string{"application/json"},
186 ConsumesMediaTypes: []string{"application/json"},
187 Schemes: []string{"http"},
188 Params: params,
189 Reader: &SearchLogQueryReader{formats: a.formats},
190 Context: params.Context,
191 Client: params.HTTPClient,
192 }
193 for _, opt := range opts {
194 opt(op)
195 }
196
197 result, err := a.transport.Submit(op)
198 if err != nil {
199 return nil, err
200 }
201 success, ok := result.(*SearchLogQueryOK)
202 if ok {
203 return success, nil
204 }
205
206 unexpectedSuccess := result.(*SearchLogQueryDefault)
207 return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
208 }
209
210
211 func (a *Client) SetTransport(transport runtime.ClientTransport) {
212 a.transport = transport
213 }
214
View as plain text