-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpassage.gen.go
2470 lines (2028 loc) · 76.6 KB
/
passage.gen.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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Package passage provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
package passage
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"time"
"github.com/oapi-codegen/runtime"
)
const (
BearerAuthScopes = "bearerAuth.Scopes"
)
// Defines values for N400ErrorCode.
const (
CustomProviderRequired N400ErrorCode = "custom_provider_required"
InvalidRequest N400ErrorCode = "invalid_request"
)
// Defines values for N401ErrorCode.
const (
InvalidAccessToken N401ErrorCode = "invalid_access_token"
InvalidNonce N401ErrorCode = "invalid_nonce"
)
// Defines values for N403ErrorCode.
const (
CannotCreateOrganizationBillingPortalSession N403ErrorCode = "cannot_create_organization_billing_portal_session"
CannotCreateTransaction N403ErrorCode = "cannot_create_transaction"
CannotDeleteAdmin N403ErrorCode = "cannot_delete_admin"
CannotDeleteOrganizationMember N403ErrorCode = "cannot_delete_organization_member"
CannotSelfUpdateOrganizationMember N403ErrorCode = "cannot_self_update_organization_member"
OperationNotAllowed N403ErrorCode = "operation_not_allowed"
)
// Defines values for N404ErrorCode.
const (
APIKeyNotFound N404ErrorCode = "api_key_not_found"
AdminNotFound N404ErrorCode = "admin_not_found"
AppNotFound N404ErrorCode = "app_not_found"
DeviceNotFound N404ErrorCode = "device_not_found"
DomainNotFound N404ErrorCode = "domain_not_found"
EmailProviderNotFound N404ErrorCode = "email_provider_not_found"
EmailTemplateNotFound N404ErrorCode = "email_template_not_found"
EventNotFound N404ErrorCode = "event_not_found"
FunctionNotFound N404ErrorCode = "function_not_found"
FunctionSecretKeyNotFound N404ErrorCode = "function_secret_key_not_found"
FunctionVersionNotFound N404ErrorCode = "function_version_not_found"
MetadataFieldNotFound N404ErrorCode = "metadata_field_not_found"
NativeClientNotFound N404ErrorCode = "native_client_not_found"
Oauth2AppNotFound N404ErrorCode = "oauth2_app_not_found"
OrganizationMemberNotFound N404ErrorCode = "organization_member_not_found"
SmsProviderNotFound N404ErrorCode = "sms_provider_not_found"
SmsTemplateNotFound N404ErrorCode = "sms_template_not_found"
SocialConnectionNotFound N404ErrorCode = "social_connection_not_found"
UserNotFound N404ErrorCode = "user_not_found"
)
// Defines values for N500ErrorCode.
const (
InternalServerError N500ErrorCode = "internal_server_error"
)
// Defines values for ChannelType.
const (
EmailChannel ChannelType = "email"
PhoneChannel ChannelType = "phone"
)
// Defines values for MagicLinkLanguage.
const (
De MagicLinkLanguage = "de"
En MagicLinkLanguage = "en"
Es MagicLinkLanguage = "es"
It MagicLinkLanguage = "it"
Pl MagicLinkLanguage = "pl"
Pt MagicLinkLanguage = "pt"
Zh MagicLinkLanguage = "zh"
)
// Defines values for MagicLinkType.
const (
LoginType MagicLinkType = "login"
VerifyIdentifierType MagicLinkType = "verify_identifier"
)
// Defines values for SocialConnectionType.
const (
Apple SocialConnectionType = "apple"
Github SocialConnectionType = "github"
Google SocialConnectionType = "google"
)
// Defines values for UserEventAction.
const (
UserEventActionLogin UserEventAction = "login"
UserEventActionOther UserEventAction = "other"
UserEventActionRegister UserEventAction = "register"
)
// Defines values for UserEventStatus.
const (
Complete UserEventStatus = "complete"
Incomplete UserEventStatus = "incomplete"
)
// Defines values for UserStatus.
const (
StatusActive UserStatus = "active"
StatusInactive UserStatus = "inactive"
StatusPending UserStatus = "pending"
)
// Defines values for WebAuthnType.
const (
Passkey WebAuthnType = "passkey"
Platform WebAuthnType = "platform"
SecurityKey WebAuthnType = "security_key"
)
// N400Error defines model for 400Error.
type N400Error struct {
Code N400ErrorCode `json:"code"`
Error string `json:"error"`
}
// N400ErrorCode defines model for 400Error.Code.
type N400ErrorCode string
// N401Error defines model for 401Error.
type N401Error struct {
Code N401ErrorCode `json:"code"`
Error string `json:"error"`
}
// N401ErrorCode defines model for 401Error.Code.
type N401ErrorCode string
// N403Error defines model for 403Error.
type N403Error struct {
Code N403ErrorCode `json:"code"`
Error string `json:"error"`
}
// N403ErrorCode defines model for 403Error.Code.
type N403ErrorCode string
// N404Error defines model for 404Error.
type N404Error struct {
Code N404ErrorCode `json:"code"`
Error string `json:"error"`
}
// N404ErrorCode defines model for 404Error.Code.
type N404ErrorCode string
// N500Error defines model for 500Error.
type N500Error struct {
Code N500ErrorCode `json:"code"`
Error string `json:"error"`
}
// N500ErrorCode defines model for 500Error.Code.
type N500ErrorCode string
// AppleUserSocialConnection defines model for AppleUserSocialConnection.
type AppleUserSocialConnection struct {
CreatedAt time.Time `json:"created_at"`
LastLoginAt time.Time `json:"last_login_at"`
// ProviderID The external ID of the Social Connection.
ProviderID string `json:"provider_id"`
// ProviderIdentifier The email of connected social user.
ProviderIdentifier string `json:"provider_identifier"`
}
// magicLinkArgs defines model for CreateMagicLinkRequest.
type magicLinkArgs struct {
// ChannelType The channel for magic link delivery: "email" or "phone". Required if "send" is true.
ChannelType ChannelType `json:"channel,omitempty"`
Email string `json:"email,omitempty"`
// Language language of the email or sms to send
Language MagicLinkLanguage `json:"language,omitempty"`
// MagicLinkPath must be a relative url
MagicLinkPath string `json:"magic_link_path,omitempty"`
Phone string `json:"phone,omitempty"`
RedirectURL string `json:"redirect_url,omitempty"`
Send bool `json:"send,omitempty"`
// TTL time to live in minutes
TTL int `json:"ttl,omitempty"`
// Type The type of magic link to create: "login" or "verify_identifier". Defaults to "login".
Type MagicLinkType `json:"type,omitempty"`
UserID string `json:"user_id,omitempty"`
}
// CreateUserArgs defines model for CreateUserRequest.
type CreateUserArgs struct {
// Email Email of the new user. Either this or `phone` is required; both may be provided.
Email string `json:"email,omitempty"`
// Phone Phone number of the new user. Either this or `email` is required; both may be provided.
Phone string `json:"phone,omitempty"`
UserMetadata map[string]interface{} `json:"user_metadata,omitempty"`
}
// GithubUserSocialConnection defines model for GithubUserSocialConnection.
type GithubUserSocialConnection struct {
CreatedAt time.Time `json:"created_at"`
LastLoginAt time.Time `json:"last_login_at"`
// ProviderID The external ID of the Social Connection.
ProviderID string `json:"provider_id"`
// ProviderIdentifier The email of connected social user.
ProviderIdentifier string `json:"provider_identifier"`
}
// GoogleUserSocialConnection defines model for GoogleUserSocialConnection.
type GoogleUserSocialConnection struct {
CreatedAt time.Time `json:"created_at"`
LastLoginAt time.Time `json:"last_login_at"`
// ProviderID The external ID of the Social Connection.
ProviderID string `json:"provider_id"`
// ProviderIdentifier The email of connected social user.
ProviderIdentifier string `json:"provider_identifier"`
}
// Link defines model for Link.
type Link struct {
Href string `json:"href"`
}
// ListDevicesResponse defines model for ListDevicesResponse.
type ListDevicesResponse struct {
Devices []WebAuthnDevices `json:"devices"`
}
// ListPaginatedUsersItem defines model for ListPaginatedUsersItem.
type ListPaginatedUsersItem struct {
CreatedAt time.Time `json:"created_at"`
Email string `json:"email"`
EmailVerified bool `json:"email_verified"`
// ExternalID The external ID of the user. Only set if the user was created in a Flex app.
ExternalID string `json:"external_id"`
ID string `json:"id"`
LastLoginAt time.Time `json:"last_login_at"`
LoginCount int `json:"login_count"`
Phone string `json:"phone"`
PhoneVerified bool `json:"phone_verified"`
Status UserStatus `json:"status"`
UpdatedAt time.Time `json:"updated_at"`
UserMetadata *map[string]interface{} `json:"user_metadata"`
}
// paginatedUsersResponse defines model for ListPaginatedUsersResponse.
type paginatedUsersResponse struct {
Links PaginatedLinks `json:"_links"`
// CreatedBefore time anchor (Unix timestamp) --> all users returned created before this timestamp
CreatedBefore int64 `json:"created_before"`
Limit int `json:"limit"`
Page int `json:"page"`
// TotalUsers total number of users for a particular query
TotalUsers int64 `json:"total_users"`
Users []ListPaginatedUsersItem `json:"users"`
}
// MagicLink defines model for MagicLink.
type MagicLink struct {
Activated bool `json:"activated"`
AppID string `json:"app_id"`
ID string `json:"id"`
Identifier string `json:"identifier"`
RedirectURL string `json:"redirect_url"`
Secret string `json:"secret"`
// TTL time to live in minutes
TTL int `json:"ttl"`
// Type The type of magic link to create: "login" or "verify_identifier". Defaults to "login".
Type MagicLinkType `json:"type"`
URL string `json:"url"`
UserID string `json:"user_id"`
}
// ChannelType The channel for magic link delivery: "email" or "phone". Required if "send" is true.
type ChannelType string
// MagicLinkLanguage language of the email or sms to send
type MagicLinkLanguage string
// MagicLinkResponse defines model for MagicLinkResponse.
type MagicLinkResponse struct {
MagicLink MagicLink `json:"magic_link"`
}
// MagicLinkType The type of magic link to create: "login" or "verify_identifier". Defaults to "login".
type MagicLinkType string
// PaginatedLinks defines model for PaginatedLinks.
type PaginatedLinks struct {
First Link `json:"first"`
Last Link `json:"last"`
Next Link `json:"next"`
Previous Link `json:"previous"`
Self Link `json:"self"`
}
// SocialConnectionType defines model for SocialConnectionType.
type SocialConnectionType string
// UpdateUserOptions defines model for UpdateUserRequest.
type UpdateUserOptions struct {
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
UserMetadata map[string]interface{} `json:"user_metadata,omitempty"`
}
// UserEventAction defines model for UserEventAction.
type UserEventAction string
// UserEventStatus defines model for UserEventStatus.
type UserEventStatus string
// PassageUser defines model for UserInfo.
type PassageUser struct {
CreatedAt time.Time `json:"created_at"`
Email string `json:"email"`
EmailVerified bool `json:"email_verified"`
// ExternalID The external ID of the user. Only set if the user was created in a Flex app.
ExternalID string `json:"external_id"`
ID string `json:"id"`
LastLoginAt time.Time `json:"last_login_at"`
LoginCount int `json:"login_count"`
Phone string `json:"phone"`
PhoneVerified bool `json:"phone_verified"`
RecentEvents []UserRecentEvent `json:"recent_events"`
SocialConnections UserSocialConnections `json:"social_connections"`
Status UserStatus `json:"status"`
UpdatedAt time.Time `json:"updated_at"`
UserMetadata map[string]interface{} `json:"user_metadata"`
Webauthn bool `json:"webauthn"`
WebauthnDevices []WebAuthnDevices `json:"webauthn_devices"`
// WebauthnTypes List of credential types that have been used for authentication
WebauthnTypes []WebAuthnType `json:"webauthn_types"`
}
// UserRecentEvent defines model for UserRecentEvent.
type UserRecentEvent struct {
Action UserEventAction `json:"action"`
CompletedAt *time.Time `json:"completed_at"`
CreatedAt time.Time `json:"created_at"`
ID string `json:"id"`
IPAddr string `json:"ip_addr"`
SocialLoginType *SocialConnectionType `json:"social_login_type"`
Status UserEventStatus `json:"status"`
Type string `json:"type"`
// UserAgent The raw user agent value from the originating device
UserAgent string `json:"user_agent"`
// UserAgentDisplay A display-friendly version of the user agent
UserAgentDisplay string `json:"user_agent_display"`
}
// UserResponse defines model for UserResponse.
type UserResponse struct {
PassageUser PassageUser `json:"user"`
}
// UserSocialConnections defines model for UserSocialConnections.
type UserSocialConnections struct {
Apple *AppleUserSocialConnection `json:"apple,omitempty"`
Github *GithubUserSocialConnection `json:"github,omitempty"`
Google *GoogleUserSocialConnection `json:"google,omitempty"`
}
// UserStatus defines model for UserStatus.
type UserStatus string
// WebAuthnDevices defines model for WebAuthnDevices.
type WebAuthnDevices struct {
// CreatedAt The first time this webAuthn device was used to authenticate the user
CreatedAt time.Time `json:"created_at"`
// CredID The CredID for this webAuthn device
CredID string `json:"cred_id"`
// FriendlyName The friendly name for the webAuthn device used to authenticate
FriendlyName string `json:"friendly_name"`
// Icons Contains the light and dark SVG icons that represent the brand of those devices
// Values can be null or base64 encoded SVG. Example of SVG output:
// data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDE5MiAxOTIiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDE5MiAxOTIiIHdpZHRoPSIyNHB4Ij48cmVjdCBmaWxsPSJub25lIiBoZWlnaHQ9IjE5MiIgd2lkdGg9IjE5MiIgeT0iMCIvPjxnPjxwYXRoIGQ9Ik02OS4yOSwxMDZjLTMuNDYsNS45Ny05LjkxLDEwLTE3LjI5LDEwYy0xMS4wMywwLTIwLTguOTctMjAtMjBzOC45Ny0yMCwyMC0yMCBjNy4zOCwwLDEzLjgzLDQuMDMsMTcuMjksMTBoMjUuNTVDOTAuMyw2Ni41NCw3Mi44Miw1Miw1Miw1MkMyNy43NCw1Miw4LDcxLjc0LDgsOTZzMTkuNzQsNDQsNDQsNDRjMjAuODIsMCwzOC4zLTE0LjU0LDQyLjg0LTM0IEg2OS4yOXoiIGZpbGw9IiM0Mjg1RjQiLz48cmVjdCBmaWxsPSIjRkJCQzA0IiBoZWlnaHQ9IjI0IiB3aWR0aD0iNDQiIHg9Ijk0IiB5PSI4NCIvPjxwYXRoIGQ9Ik05NC4zMiw4NEg2OHYwLjA1YzIuNSwzLjM0LDQsNy40Nyw0LDExLjk1cy0xLjUsOC42MS00LDExLjk1VjEwOGgyNi4zMiBjMS4wOC0zLjgyLDEuNjgtNy44NCwxLjY4LTEyUzk1LjQxLDg3LjgyLDk0LjMyLDg0eiIgZmlsbD0iI0VBNDMzNSIvPjxwYXRoIGQ9Ik0xODQsMTA2djI2aC0xNnYtOGMwLTQuNDItMy41OC04LTgtOHMtOCwzLjU4LTgsOHY4aC0xNnYtMjZIMTg0eiIgZmlsbD0iIzM0QTg1MyIvPjxyZWN0IGZpbGw9IiMxODgwMzgiIGhlaWdodD0iMjQiIHdpZHRoPSI0OCIgeD0iMTM2IiB5PSI4NCIvPjwvZz48L3N2Zz4=
Icons WebAuthnIcons `json:"icons"`
// ID The ID of the webAuthn device used for authentication
ID string `json:"id"`
// LastLoginAt The last time this webAuthn device was used to authenticate the user
LastLoginAt time.Time `json:"last_login_at"`
// Type The type of this credential
Type WebAuthnType `json:"type"`
// UpdatedAt The last time this webAuthn device was updated
UpdatedAt time.Time `json:"updated_at"`
// UsageCount How many times this webAuthn device has been used to authenticate the user
UsageCount int `json:"usage_count"`
}
// WebAuthnIcons Contains the light and dark SVG icons that represent the brand of those devices
// Values can be null or base64 encoded SVG. Example of SVG output:
// data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDE5MiAxOTIiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDE5MiAxOTIiIHdpZHRoPSIyNHB4Ij48cmVjdCBmaWxsPSJub25lIiBoZWlnaHQ9IjE5MiIgd2lkdGg9IjE5MiIgeT0iMCIvPjxnPjxwYXRoIGQ9Ik02OS4yOSwxMDZjLTMuNDYsNS45Ny05LjkxLDEwLTE3LjI5LDEwYy0xMS4wMywwLTIwLTguOTctMjAtMjBzOC45Ny0yMCwyMC0yMCBjNy4zOCwwLDEzLjgzLDQuMDMsMTcuMjksMTBoMjUuNTVDOTAuMyw2Ni41NCw3Mi44Miw1Miw1Miw1MkMyNy43NCw1Miw4LDcxLjc0LDgsOTZzMTkuNzQsNDQsNDQsNDRjMjAuODIsMCwzOC4zLTE0LjU0LDQyLjg0LTM0IEg2OS4yOXoiIGZpbGw9IiM0Mjg1RjQiLz48cmVjdCBmaWxsPSIjRkJCQzA0IiBoZWlnaHQ9IjI0IiB3aWR0aD0iNDQiIHg9Ijk0IiB5PSI4NCIvPjxwYXRoIGQ9Ik05NC4zMiw4NEg2OHYwLjA1YzIuNSwzLjM0LDQsNy40Nyw0LDExLjk1cy0xLjUsOC42MS00LDExLjk1VjEwOGgyNi4zMiBjMS4wOC0zLjgyLDEuNjgtNy44NCwxLjY4LTEyUzk1LjQxLDg3LjgyLDk0LjMyLDg0eiIgZmlsbD0iI0VBNDMzNSIvPjxwYXRoIGQ9Ik0xODQsMTA2djI2aC0xNnYtOGMwLTQuNDItMy41OC04LTgtOHMtOCwzLjU4LTgsOHY4aC0xNnYtMjZIMTg0eiIgZmlsbD0iIzM0QTg1MyIvPjxyZWN0IGZpbGw9IiMxODgwMzgiIGhlaWdodD0iMjQiIHdpZHRoPSI0OCIgeD0iMTM2IiB5PSI4NCIvPjwvZz48L3N2Zz4=
type WebAuthnIcons struct {
Dark *string `json:"dark"`
Light *string `json:"light"`
}
// WebAuthnType The type of this credential
type WebAuthnType string
// AppID defines model for app_id.
type AppID = string
// UserID defines model for user_id.
type UserID = string
// N400BadRequest defines model for 400BadRequest.
type N400BadRequest = N400Error
// N401Unauthorized defines model for 401Unauthorized.
type N401Unauthorized = N401Error
// N403Forbidden defines model for 403Forbidden.
type N403Forbidden = N403Error
// N404NotFound defines model for 404NotFound.
type N404NotFound = N404Error
// N500InternalServerError defines model for 500InternalServerError.
type N500InternalServerError = N500Error
// ListPaginatedUsersParams defines parameters for ListPaginatedUsers.
type ListPaginatedUsersParams struct {
// Page page to fetch (min=1)
Page *int `form:"page,omitempty" json:"page,omitempty"`
// Limit number of users to fetch per page (max=500)
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
// CreatedBefore Unix timestamp to anchor pagination results (fetches events that were created before the timestamp)
CreatedBefore *int `form:"created_before,omitempty" json:"created_before,omitempty"`
// OrderBy Comma separated list of <field>:<ASC/DESC> (example: order_by=id:DESC,created_at:ASC) **cannot order_by `identifier`
OrderBy *string `form:"order_by,omitempty" json:"order_by,omitempty"`
// Identifier search users email OR phone (pagination prepended operators identifier=<val>, identifier=<ne:val>, identifier=<gt:val>, identifier=<lt:val>, identifier=<like:val>, identifier=<not_like:val>)
Identifier *string `form:"identifier,omitempty" json:"identifier,omitempty"`
// ID search users id (pagination prepended operators id=<val>, id=<ne:val>, id=<gt:val>, id=<lt:val>, id=<like:val>, id=<not_like:val>)
ID *string `form:"id,omitempty" json:"id,omitempty"`
// LoginCount search users login_count (pagination prepended operators login_count=<val>, login_count=<ne:val>, login_count=<gt:val>, login_count=<lt:val>)
LoginCount *int `form:"login_count,omitempty" json:"login_count,omitempty"`
// Status search users by status (pagination prepended operators status=<val>, status=<ne:val>, status=<gt:val>, status=<lt:val>, status=<like:val>, status=<not_like:val>) -- valid values: (active, inactive, pending)
Status *string `form:"status,omitempty" json:"status,omitempty"`
// CreatedAt search users created_at (pagination prepended operators created_at=<val>, created_at=<ne:val>, created_at=<gt:val>, created_at=<lt:val> -- valid timestamp in the format: 2006-01-02T15:04:05.000000Z required
CreatedAt *string `form:"created_at,omitempty" json:"created_at,omitempty"`
// UpdatedAt search users updated_at (pagination prepended operators updated_at=<val>, updated_at=<ne:val>, updated_at=<gt:val>, updated_at=<lt:val> -- valid timestamp in the format: 2006-01-02T15:04:05.000000Z required
UpdatedAt *string `form:"updated_at,omitempty" json:"updated_at,omitempty"`
// LastLoginAt search users last_login_at (pagination prepended operators last_login_at=<val>, lat_login_at=<ne:val>, last_login_at=<gt:val>, last_login_at=<lt:val> -- valid timestamp in the format: 2006-01-02T15:04:05.000000Z required
LastLoginAt *string `form:"last_login_at,omitempty" json:"last_login_at,omitempty"`
}
// CreateMagicLinkJSONRequestBody defines body for CreateMagicLink for application/json ContentType.
type CreateMagicLinkJSONRequestBody = magicLinkArgs
// CreateUserJSONRequestBody defines body for CreateUser for application/json ContentType.
type CreateUserJSONRequestBody = CreateUserArgs
// UpdateUserJSONRequestBody defines body for UpdateUser for application/json ContentType.
type UpdateUserJSONRequestBody = UpdateUserOptions
// RequestEditorFn is the function signature for the RequestEditor callback function
type RequestEditorFn func(ctx context.Context, req *http.Request) error
// Doer performs HTTP requests.
//
// The standard http.Client implements this interface.
type HttpRequestDoer interface {
Do(req *http.Request) (*http.Response, error)
}
// Client which conforms to the OpenAPI3 specification for this service.
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
// ClientOption allows setting custom parameters during construction
type ClientOption func(*Client) error
// Creates a new Client, with reasonable defaults
func NewClient(server string, opts ...ClientOption) (*Client, error) {
// create a client with sane default values
client := Client{
Server: server,
}
// mutate client and add all optional params
for _, o := range opts {
if err := o(&client); err != nil {
return nil, err
}
}
// ensure the server URL always has a trailing slash
if !strings.HasSuffix(client.Server, "/") {
client.Server += "/"
}
// create httpClient, if not already present
if client.Client == nil {
client.Client = &http.Client{}
}
return &client, nil
}
// WithHTTPClient allows overriding the default Doer, which is
// automatically created using http.Client. This is useful for tests.
func WithHTTPClient(doer HttpRequestDoer) ClientOption {
return func(c *Client) error {
c.Client = doer
return nil
}
}
// WithRequestEditorFn allows setting up a callback function, which will be
// called right before sending the request. This can be used to mutate the request.
func WithRequestEditorFn(fn RequestEditorFn) ClientOption {
return func(c *Client) error {
c.RequestEditors = append(c.RequestEditors, fn)
return nil
}
}
// The interface specification for the client above.
type ClientInterface interface {
// CreateMagicLinkWithBody request with any body
CreateMagicLinkWithBody(ctx context.Context, appID AppID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
CreateMagicLink(ctx context.Context, appID AppID, body CreateMagicLinkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// ListPaginatedUsers request
ListPaginatedUsers(ctx context.Context, appID AppID, params *ListPaginatedUsersParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// CreateUserWithBody request with any body
CreateUserWithBody(ctx context.Context, appID AppID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
CreateUser(ctx context.Context, appID AppID, body CreateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// DeleteUser request
DeleteUser(ctx context.Context, appID AppID, userID UserID, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetUser request
GetUser(ctx context.Context, appID AppID, userID UserID, reqEditors ...RequestEditorFn) (*http.Response, error)
// UpdateUserWithBody request with any body
UpdateUserWithBody(ctx context.Context, appID AppID, userID UserID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
UpdateUser(ctx context.Context, appID AppID, userID UserID, body UpdateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// ActivateUser request
ActivateUser(ctx context.Context, appID AppID, userID UserID, reqEditors ...RequestEditorFn) (*http.Response, error)
// DeactivateUser request
DeactivateUser(ctx context.Context, appID AppID, userID UserID, reqEditors ...RequestEditorFn) (*http.Response, error)
// ListUserDevices request
ListUserDevices(ctx context.Context, appID AppID, userID UserID, reqEditors ...RequestEditorFn) (*http.Response, error)
// DeleteUserDevices request
DeleteUserDevices(ctx context.Context, appID AppID, userID UserID, deviceID string, reqEditors ...RequestEditorFn) (*http.Response, error)
// RevokeUserRefreshTokens request
RevokeUserRefreshTokens(ctx context.Context, appID AppID, userID UserID, reqEditors ...RequestEditorFn) (*http.Response, error)
}
func (c *Client) CreateMagicLinkWithBody(ctx context.Context, appID AppID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCreateMagicLinkRequestWithBody(c.Server, appID, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) CreateMagicLink(ctx context.Context, appID AppID, body CreateMagicLinkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCreateMagicLinkRequest(c.Server, appID, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) ListPaginatedUsers(ctx context.Context, appID AppID, params *ListPaginatedUsersParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewListPaginatedUsersRequest(c.Server, appID, params)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) CreateUserWithBody(ctx context.Context, appID AppID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCreateUserRequestWithBody(c.Server, appID, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) CreateUser(ctx context.Context, appID AppID, body CreateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCreateUserRequest(c.Server, appID, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) DeleteUser(ctx context.Context, appID AppID, userID UserID, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewDeleteUserRequest(c.Server, appID, userID)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) GetUser(ctx context.Context, appID AppID, userID UserID, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetUserRequest(c.Server, appID, userID)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) UpdateUserWithBody(ctx context.Context, appID AppID, userID UserID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewUpdateUserRequestWithBody(c.Server, appID, userID, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) UpdateUser(ctx context.Context, appID AppID, userID UserID, body UpdateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewUpdateUserRequest(c.Server, appID, userID, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) ActivateUser(ctx context.Context, appID AppID, userID UserID, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewActivateUserRequest(c.Server, appID, userID)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) DeactivateUser(ctx context.Context, appID AppID, userID UserID, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewDeactivateUserRequest(c.Server, appID, userID)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) ListUserDevices(ctx context.Context, appID AppID, userID UserID, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewListUserDevicesRequest(c.Server, appID, userID)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) DeleteUserDevices(ctx context.Context, appID AppID, userID UserID, deviceID string, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewDeleteUserDevicesRequest(c.Server, appID, userID, deviceID)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) RevokeUserRefreshTokens(ctx context.Context, appID AppID, userID UserID, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewRevokeUserRefreshTokensRequest(c.Server, appID, userID)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
// NewCreateMagicLinkRequest calls the generic CreateMagicLink builder with application/json body
func NewCreateMagicLinkRequest(server string, appID AppID, body CreateMagicLinkJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewCreateMagicLinkRequestWithBody(server, appID, "application/json", bodyReader)
}
// NewCreateMagicLinkRequestWithBody generates requests for CreateMagicLink with any type of body
func NewCreateMagicLinkRequestWithBody(server string, appID AppID, contentType string, body io.Reader) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "app_id", runtime.ParamLocationPath, appID)
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/apps/%s/magic-links", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewListPaginatedUsersRequest generates requests for ListPaginatedUsers
func NewListPaginatedUsersRequest(server string, appID AppID, params *ListPaginatedUsersParams) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "app_id", runtime.ParamLocationPath, appID)
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/apps/%s/users", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
if params != nil {
queryValues := queryURL.Query()
if params.Page != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "page", runtime.ParamLocationQuery, *params.Page); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Limit != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.CreatedBefore != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "created_before", runtime.ParamLocationQuery, *params.CreatedBefore); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.OrderBy != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "order_by", runtime.ParamLocationQuery, *params.OrderBy); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Identifier != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "identifier", runtime.ParamLocationQuery, *params.Identifier); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.ID != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "id", runtime.ParamLocationQuery, *params.ID); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.LoginCount != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "login_count", runtime.ParamLocationQuery, *params.LoginCount); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Status != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "status", runtime.ParamLocationQuery, *params.Status); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.CreatedAt != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "created_at", runtime.ParamLocationQuery, *params.CreatedAt); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {