-
-
Notifications
You must be signed in to change notification settings - Fork 930
/
common_client.go
333 lines (287 loc) · 14.1 KB
/
common_client.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
// Code generated by go-swagger; DO NOT EDIT.
package common
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new common API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for common API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientService is the interface for Client methods
type ClientService interface {
GetSchema(params *GetSchemaParams) (*GetSchemaOK, error)
GetSelfServiceBrowserLoginRequest(params *GetSelfServiceBrowserLoginRequestParams) (*GetSelfServiceBrowserLoginRequestOK, error)
GetSelfServiceBrowserRecoveryRequest(params *GetSelfServiceBrowserRecoveryRequestParams) (*GetSelfServiceBrowserRecoveryRequestOK, error)
GetSelfServiceBrowserRegistrationRequest(params *GetSelfServiceBrowserRegistrationRequestParams) (*GetSelfServiceBrowserRegistrationRequestOK, error)
GetSelfServiceBrowserSettingsRequest(params *GetSelfServiceBrowserSettingsRequestParams) (*GetSelfServiceBrowserSettingsRequestOK, error)
GetSelfServiceError(params *GetSelfServiceErrorParams) (*GetSelfServiceErrorOK, error)
GetSelfServiceVerificationRequest(params *GetSelfServiceVerificationRequestParams) (*GetSelfServiceVerificationRequestOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
GetSchema Get a Traits Schema Definition
*/
func (a *Client) GetSchema(params *GetSchemaParams) (*GetSchemaOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetSchemaParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getSchema",
Method: "GET",
PathPattern: "/schemas/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/x-www-form-urlencoded"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetSchemaReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetSchemaOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getSchema: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetSelfServiceBrowserLoginRequest gets the request context browser based login user flows
This endpoint returns a login request's context with, for example, error details and
other information.
When accessing this endpoint through ORY Kratos' Public API, ensure that cookies are set as they are required for CSRF to work. To prevent
token scanning attacks, the public endpoint does not return 404 status codes.
More information can be found at [ORY Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration).
*/
func (a *Client) GetSelfServiceBrowserLoginRequest(params *GetSelfServiceBrowserLoginRequestParams) (*GetSelfServiceBrowserLoginRequestOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetSelfServiceBrowserLoginRequestParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getSelfServiceBrowserLoginRequest",
Method: "GET",
PathPattern: "/self-service/browser/flows/requests/login",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/x-www-form-urlencoded"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetSelfServiceBrowserLoginRequestReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetSelfServiceBrowserLoginRequestOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getSelfServiceBrowserLoginRequest: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetSelfServiceBrowserRecoveryRequest gets the request context of browser based recovery flows
When accessing this endpoint through ORY Kratos' Public API, ensure that cookies are set as they are required
for checking the auth session. To prevent scanning attacks, the public endpoint does not return 404 status codes
but instead 403 or 500.
More information can be found at [ORY Kratos Account Recovery Documentation](../self-service/flows/password-reset-account-recovery).
*/
func (a *Client) GetSelfServiceBrowserRecoveryRequest(params *GetSelfServiceBrowserRecoveryRequestParams) (*GetSelfServiceBrowserRecoveryRequestOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetSelfServiceBrowserRecoveryRequestParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getSelfServiceBrowserRecoveryRequest",
Method: "GET",
PathPattern: "/self-service/browser/flows/requests/recovery",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/x-www-form-urlencoded"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetSelfServiceBrowserRecoveryRequestReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetSelfServiceBrowserRecoveryRequestOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getSelfServiceBrowserRecoveryRequest: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetSelfServiceBrowserRegistrationRequest gets the request context of browser based registration user flows
This endpoint returns a registration request's context with, for example, error details and
other information.
When accessing this endpoint through ORY Kratos' Public API, ensure that cookies are set as they are required for CSRF to work. To prevent
token scanning attacks, the public endpoint does not return 404 status codes.
More information can be found at [ORY Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration).
*/
func (a *Client) GetSelfServiceBrowserRegistrationRequest(params *GetSelfServiceBrowserRegistrationRequestParams) (*GetSelfServiceBrowserRegistrationRequestOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetSelfServiceBrowserRegistrationRequestParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getSelfServiceBrowserRegistrationRequest",
Method: "GET",
PathPattern: "/self-service/browser/flows/requests/registration",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/x-www-form-urlencoded"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetSelfServiceBrowserRegistrationRequestReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetSelfServiceBrowserRegistrationRequestOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getSelfServiceBrowserRegistrationRequest: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetSelfServiceBrowserSettingsRequest gets the request context of browser based settings flows
When accessing this endpoint through ORY Kratos' Public API, ensure that cookies are set as they are required
for checking the auth session. To prevent scanning attacks, the public endpoint does not return 404 status codes
but instead 403 or 500.
More information can be found at [ORY Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings).
*/
func (a *Client) GetSelfServiceBrowserSettingsRequest(params *GetSelfServiceBrowserSettingsRequestParams) (*GetSelfServiceBrowserSettingsRequestOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetSelfServiceBrowserSettingsRequestParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getSelfServiceBrowserSettingsRequest",
Method: "GET",
PathPattern: "/self-service/browser/flows/requests/settings",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/x-www-form-urlencoded"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetSelfServiceBrowserSettingsRequestReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetSelfServiceBrowserSettingsRequestOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getSelfServiceBrowserSettingsRequest: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetSelfServiceError gets user facing self service errors
This endpoint returns the error associated with a user-facing self service errors.
When accessing this endpoint through ORY Kratos' Public API, ensure that cookies are set as they are required for CSRF to work. To prevent
token scanning attacks, the public endpoint does not return 404 status codes.
This endpoint supports stub values to help you implement the error UI:
`?error=stub:500` - returns a stub 500 (Internal Server Error) error.
More information can be found at [ORY Kratos User User Facing Error Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-facing-errors).
*/
func (a *Client) GetSelfServiceError(params *GetSelfServiceErrorParams) (*GetSelfServiceErrorOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetSelfServiceErrorParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getSelfServiceError",
Method: "GET",
PathPattern: "/self-service/errors",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/x-www-form-urlencoded"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetSelfServiceErrorReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetSelfServiceErrorOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getSelfServiceError: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetSelfServiceVerificationRequest gets the request context of browser based verification flows
When accessing this endpoint through ORY Kratos' Public API, ensure that cookies are set as they are required
for checking the auth session. To prevent scanning attacks, the public endpoint does not return 404 status codes
but instead 403 or 500.
More information can be found at [ORY Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/selfservice/flows/verify-email-account-activation).
*/
func (a *Client) GetSelfServiceVerificationRequest(params *GetSelfServiceVerificationRequestParams) (*GetSelfServiceVerificationRequestOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetSelfServiceVerificationRequestParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getSelfServiceVerificationRequest",
Method: "GET",
PathPattern: "/self-service/browser/flows/requests/verification",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json", "application/x-www-form-urlencoded"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetSelfServiceVerificationRequestReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetSelfServiceVerificationRequestOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getSelfServiceVerificationRequest: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}