pangea-sdk 3.8.0b1__py3-none-any.whl → 5.4.0b1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. pangea/__init__.py +1 -1
  2. pangea/asyncio/file_uploader.py +1 -1
  3. pangea/asyncio/request.py +56 -34
  4. pangea/asyncio/services/__init__.py +4 -0
  5. pangea/asyncio/services/ai_guard.py +75 -0
  6. pangea/asyncio/services/audit.py +192 -31
  7. pangea/asyncio/services/authn.py +187 -109
  8. pangea/asyncio/services/authz.py +285 -0
  9. pangea/asyncio/services/base.py +21 -2
  10. pangea/asyncio/services/embargo.py +2 -2
  11. pangea/asyncio/services/file_scan.py +24 -9
  12. pangea/asyncio/services/intel.py +108 -34
  13. pangea/asyncio/services/prompt_guard.py +73 -0
  14. pangea/asyncio/services/redact.py +72 -4
  15. pangea/asyncio/services/sanitize.py +217 -0
  16. pangea/asyncio/services/share.py +246 -73
  17. pangea/asyncio/services/vault.py +1710 -750
  18. pangea/crypto/rsa.py +135 -0
  19. pangea/deep_verify.py +7 -1
  20. pangea/dump_audit.py +9 -8
  21. pangea/request.py +87 -59
  22. pangea/response.py +49 -31
  23. pangea/services/__init__.py +4 -0
  24. pangea/services/ai_guard.py +128 -0
  25. pangea/services/audit/audit.py +205 -42
  26. pangea/services/audit/models.py +56 -8
  27. pangea/services/audit/signing.py +6 -5
  28. pangea/services/audit/util.py +3 -3
  29. pangea/services/authn/authn.py +140 -70
  30. pangea/services/authn/models.py +167 -11
  31. pangea/services/authz.py +400 -0
  32. pangea/services/base.py +39 -8
  33. pangea/services/embargo.py +2 -2
  34. pangea/services/file_scan.py +32 -15
  35. pangea/services/intel.py +157 -32
  36. pangea/services/prompt_guard.py +83 -0
  37. pangea/services/redact.py +152 -4
  38. pangea/services/sanitize.py +371 -0
  39. pangea/services/share/share.py +683 -107
  40. pangea/services/vault/models/asymmetric.py +120 -18
  41. pangea/services/vault/models/common.py +439 -141
  42. pangea/services/vault/models/keys.py +94 -0
  43. pangea/services/vault/models/secret.py +27 -3
  44. pangea/services/vault/models/symmetric.py +68 -22
  45. pangea/services/vault/vault.py +1690 -749
  46. pangea/tools.py +6 -7
  47. pangea/utils.py +16 -27
  48. pangea/verify_audit.py +270 -83
  49. {pangea_sdk-3.8.0b1.dist-info → pangea_sdk-5.4.0b1.dist-info}/METADATA +43 -35
  50. pangea_sdk-5.4.0b1.dist-info/RECORD +60 -0
  51. {pangea_sdk-3.8.0b1.dist-info → pangea_sdk-5.4.0b1.dist-info}/WHEEL +1 -1
  52. pangea_sdk-3.8.0b1.dist-info/RECORD +0 -50
@@ -1,11 +1,13 @@
1
1
  # Copyright 2022 Pangea Cyber Corporation
2
2
  # Author: Pangea Cyber Corporation
3
+ from __future__ import annotations
3
4
 
4
5
  from typing import Dict, List, Optional, Union
5
6
 
6
7
  import pangea.services.authn.models as m
7
8
  from pangea.asyncio.services.base import ServiceBaseAsync
8
- from pangea.response import PangeaResponse
9
+ from pangea.config import PangeaConfig
10
+ from pangea.response import PangeaResponse, PangeaResponseResult
9
11
 
10
12
  SERVICE_NAME = "authn"
11
13
 
@@ -23,24 +25,38 @@ class AuthNAsync(ServiceBaseAsync):
23
25
  import os
24
26
 
25
27
  # Pangea SDK
28
+ from pangea.asyncio.services import AuthNAsync
26
29
  from pangea.config import PangeaConfig
27
- from pangea.services import AuthN
28
30
 
29
31
  PANGEA_TOKEN = os.getenv("PANGEA_AUTHN_TOKEN")
30
32
  authn_config = PangeaConfig(domain="pangea.cloud")
31
33
 
32
34
  # Setup Pangea AuthN service
33
- authn = AuthN(token=PANGEA_TOKEN, config=authn_config)
35
+ authn = AuthNAsync(token=PANGEA_TOKEN, config=authn_config)
34
36
  """
35
37
 
36
38
  service_name = SERVICE_NAME
37
39
 
38
40
  def __init__(
39
41
  self,
40
- token,
41
- config=None,
42
- logger_name="pangea",
43
- ):
42
+ token: str,
43
+ config: PangeaConfig | None = None,
44
+ logger_name: str = "pangea",
45
+ ) -> None:
46
+ """
47
+ AuthN client
48
+
49
+ Initializes a new AuthN client.
50
+
51
+ Args:
52
+ token: Pangea API token.
53
+ config: Configuration.
54
+ logger_name: Logger name.
55
+
56
+ Examples:
57
+ config = PangeaConfig(domain="pangea_domain")
58
+ authn = AuthNAsync(token="pangea_token", config=config)
59
+ """
44
60
  super().__init__(token, config, logger_name=logger_name)
45
61
  self.user = AuthNAsync.UserAsync(token, config, logger_name=logger_name)
46
62
  self.flow = AuthNAsync.FlowAsync(token, config, logger_name=logger_name)
@@ -53,10 +69,10 @@ class AuthNAsync(ServiceBaseAsync):
53
69
 
54
70
  def __init__(
55
71
  self,
56
- token,
57
- config=None,
58
- logger_name="pangea",
59
- ):
72
+ token: str,
73
+ config: PangeaConfig | None = None,
74
+ logger_name: str = "pangea",
75
+ ) -> None:
60
76
  super().__init__(token, config, logger_name=logger_name)
61
77
 
62
78
  async def invalidate(self, session_id: str) -> PangeaResponse[m.SessionInvalidateResult]:
@@ -80,7 +96,7 @@ class AuthNAsync(ServiceBaseAsync):
80
96
  """
81
97
  input = m.SessionInvalidateRequest(session_id=session_id)
82
98
  return await self.request.post(
83
- "v2/session/invalidate", m.SessionInvalidateResult, data=input.dict(exclude_none=True)
99
+ "v2/session/invalidate", m.SessionInvalidateResult, data=input.model_dump(exclude_none=True)
84
100
  )
85
101
 
86
102
  async def list(
@@ -117,7 +133,9 @@ class AuthNAsync(ServiceBaseAsync):
117
133
  filter = m.SessionListFilter(**filter)
118
134
 
119
135
  input = m.SessionListRequest(filter=filter, last=last, order=order, order_by=order_by, size=size)
120
- return await self.request.post("v2/session/list", m.SessionListResults, data=input.dict(exclude_none=True))
136
+ return await self.request.post(
137
+ "v2/session/list", m.SessionListResults, data=input.model_dump(exclude_none=True)
138
+ )
121
139
 
122
140
  async def logout(self, user_id: str) -> PangeaResponse[m.SessionLogoutResult]:
123
141
  """
@@ -140,7 +158,7 @@ class AuthNAsync(ServiceBaseAsync):
140
158
  """
141
159
  input = m.SessionLogoutRequest(user_id=user_id)
142
160
  return await self.request.post(
143
- "v2/session/logout", m.SessionLogoutResult, data=input.dict(exclude_none=True)
161
+ "v2/session/logout", m.SessionLogoutResult, data=input.model_dump(exclude_none=True)
144
162
  )
145
163
 
146
164
  class ClientAsync(ServiceBaseAsync):
@@ -148,10 +166,10 @@ class AuthNAsync(ServiceBaseAsync):
148
166
 
149
167
  def __init__(
150
168
  self,
151
- token,
152
- config=None,
153
- logger_name="pangea",
154
- ):
169
+ token: str,
170
+ config: PangeaConfig | None = None,
171
+ logger_name: str = "pangea",
172
+ ) -> None:
155
173
  super().__init__(token, config, logger_name=logger_name)
156
174
  self.session = AuthNAsync.ClientAsync.SessionAsync(token, config, logger_name=logger_name)
157
175
  self.password = AuthNAsync.ClientAsync.PasswordAsync(token, config, logger_name=logger_name)
@@ -180,7 +198,7 @@ class AuthNAsync(ServiceBaseAsync):
180
198
  """
181
199
  input = m.ClientUserinfoRequest(code=code)
182
200
  return await self.request.post(
183
- "v2/client/userinfo", m.ClientUserinfoResult, data=input.dict(exclude_none=True)
201
+ "v2/client/userinfo", m.ClientUserinfoResult, data=input.model_dump(exclude_none=True)
184
202
  )
185
203
 
186
204
  async def jwks(
@@ -208,10 +226,10 @@ class AuthNAsync(ServiceBaseAsync):
208
226
 
209
227
  def __init__(
210
228
  self,
211
- token,
212
- config=None,
213
- logger_name="pangea",
214
- ):
229
+ token: str,
230
+ config: PangeaConfig | None = None,
231
+ logger_name: str = "pangea",
232
+ ) -> None:
215
233
  super().__init__(token, config, logger_name=logger_name)
216
234
 
217
235
  async def invalidate(self, token: str, session_id: str) -> PangeaResponse[m.ClientSessionInvalidateResult]:
@@ -237,7 +255,9 @@ class AuthNAsync(ServiceBaseAsync):
237
255
  """
238
256
  input = m.ClientSessionInvalidateRequest(token=token, session_id=session_id)
239
257
  return await self.request.post(
240
- "v2/client/session/invalidate", m.ClientSessionInvalidateResult, data=input.dict(exclude_none=True)
258
+ "v2/client/session/invalidate",
259
+ m.ClientSessionInvalidateResult,
260
+ data=input.model_dump(exclude_none=True),
241
261
  )
242
262
 
243
263
  async def list(
@@ -281,7 +301,7 @@ class AuthNAsync(ServiceBaseAsync):
281
301
  token=token, filter=filter, last=last, order=order, order_by=order_by, size=size
282
302
  )
283
303
  return await self.request.post(
284
- "v2/client/session/list", m.ClientSessionListResults, data=input.dict(exclude_none=True)
304
+ "v2/client/session/list", m.ClientSessionListResults, data=input.model_dump(exclude_none=True)
285
305
  )
286
306
 
287
307
  async def logout(self, token: str) -> PangeaResponse[m.ClientSessionLogoutResult]:
@@ -305,7 +325,7 @@ class AuthNAsync(ServiceBaseAsync):
305
325
  """
306
326
  input = m.ClientSessionLogoutRequest(token=token)
307
327
  return await self.request.post(
308
- "v2/client/session/logout", m.ClientSessionLogoutResult, data=input.dict(exclude_none=True)
328
+ "v2/client/session/logout", m.ClientSessionLogoutResult, data=input.model_dump(exclude_none=True)
309
329
  )
310
330
 
311
331
  async def refresh(
@@ -335,7 +355,7 @@ class AuthNAsync(ServiceBaseAsync):
335
355
  """
336
356
  input = m.ClientSessionRefreshRequest(refresh_token=refresh_token, user_token=user_token)
337
357
  return await self.request.post(
338
- "v2/client/session/refresh", m.ClientSessionRefreshResult, data=input.dict(exclude_none=True)
358
+ "v2/client/session/refresh", m.ClientSessionRefreshResult, data=input.model_dump(exclude_none=True)
339
359
  )
340
360
 
341
361
  class PasswordAsync(ServiceBaseAsync):
@@ -343,10 +363,10 @@ class AuthNAsync(ServiceBaseAsync):
343
363
 
344
364
  def __init__(
345
365
  self,
346
- token,
347
- config=None,
348
- logger_name="pangea",
349
- ):
366
+ token: str,
367
+ config: PangeaConfig | None = None,
368
+ logger_name: str = "pangea",
369
+ ) -> None:
350
370
  super().__init__(token, config, logger_name=logger_name)
351
371
 
352
372
  async def change(
@@ -376,18 +396,37 @@ class AuthNAsync(ServiceBaseAsync):
376
396
  """
377
397
  input = m.ClientPasswordChangeRequest(token=token, old_password=old_password, new_password=new_password)
378
398
  return await self.request.post(
379
- "v2/client/password/change", m.ClientPasswordChangeResult, data=input.dict(exclude_none=True)
399
+ "v2/client/password/change", m.ClientPasswordChangeResult, data=input.model_dump(exclude_none=True)
380
400
  )
381
401
 
402
+ async def expire(self, user_id: str) -> PangeaResponse[PangeaResponseResult]:
403
+ """
404
+ Expire a user's password
405
+
406
+ Expire a user's password.
407
+
408
+ OperationId: authn_post_v2_user_password_expire
409
+
410
+ Args:
411
+ user_id: The identity of a user or a service.
412
+
413
+ Returns:
414
+ A PangeaResponse with an empty object in the response.result field.
415
+
416
+ Examples:
417
+ await authn.client.password.expire("pui_[...]")
418
+ """
419
+ return await self.request.post("v2/user/password/expire", PangeaResponseResult, {"id": user_id})
420
+
382
421
  class TokenAsync(ServiceBaseAsync):
383
422
  service_name = SERVICE_NAME
384
423
 
385
424
  def __init__(
386
425
  self,
387
- token,
388
- config=None,
389
- logger_name="pangea",
390
- ):
426
+ token: str,
427
+ config: PangeaConfig | None = None,
428
+ logger_name: str = "pangea",
429
+ ) -> None:
391
430
  super().__init__(token, config, logger_name=logger_name)
392
431
 
393
432
  async def check(self, token: str) -> PangeaResponse[m.ClientTokenCheckResult]:
@@ -413,7 +452,7 @@ class AuthNAsync(ServiceBaseAsync):
413
452
  """
414
453
  input = m.ClientTokenCheckRequest(token=token)
415
454
  return await self.request.post(
416
- "v2/client/token/check", m.ClientTokenCheckResult, data=input.dict(exclude_none=True)
455
+ "v2/client/token/check", m.ClientTokenCheckResult, data=input.model_dump(exclude_none=True)
417
456
  )
418
457
 
419
458
  class UserAsync(ServiceBaseAsync):
@@ -421,10 +460,10 @@ class AuthNAsync(ServiceBaseAsync):
421
460
 
422
461
  def __init__(
423
462
  self,
424
- token,
425
- config=None,
426
- logger_name="pangea",
427
- ):
463
+ token: str,
464
+ config: PangeaConfig | None = None,
465
+ logger_name: str = "pangea",
466
+ ) -> None:
428
467
  super().__init__(token, config, logger_name=logger_name)
429
468
  self.profile = AuthNAsync.UserAsync.ProfileAsync(token, config, logger_name=logger_name)
430
469
  self.authenticators = AuthNAsync.UserAsync.AuthenticatorsAsync(token, config, logger_name=logger_name)
@@ -434,6 +473,8 @@ class AuthNAsync(ServiceBaseAsync):
434
473
  self,
435
474
  email: str,
436
475
  profile: m.Profile,
476
+ *,
477
+ username: str | None = None,
437
478
  ) -> PangeaResponse[m.UserCreateResult]:
438
479
  """
439
480
  Create User
@@ -443,8 +484,9 @@ class AuthNAsync(ServiceBaseAsync):
443
484
  OperationId: authn_post_v2_user_create
444
485
 
445
486
  Args:
446
- email (str): An email address
447
- profile (m.Profile): A user profile as a collection of string properties
487
+ email: An email address.
488
+ profile: A user profile as a collection of string properties.
489
+ username: A username.
448
490
 
449
491
  Returns:
450
492
  A PangeaResponse with a user and its information in the response.result field.
@@ -463,11 +505,14 @@ class AuthNAsync(ServiceBaseAsync):
463
505
  input = m.UserCreateRequest(
464
506
  email=email,
465
507
  profile=profile,
508
+ username=username,
509
+ )
510
+ return await self.request.post(
511
+ "v2/user/create", m.UserCreateResult, data=input.model_dump(exclude_none=True)
466
512
  )
467
- return await self.request.post("v2/user/create", m.UserCreateResult, data=input.dict(exclude_none=True))
468
513
 
469
514
  async def delete(
470
- self, email: Optional[str] = None, id: Optional[str] = None
515
+ self, email: str | None = None, id: str | None = None, *, username: str | None = None
471
516
  ) -> PangeaResponse[m.UserDeleteResult]:
472
517
  """
473
518
  Delete User
@@ -477,8 +522,9 @@ class AuthNAsync(ServiceBaseAsync):
477
522
  OperationId: authn_post_v2_user_delete
478
523
 
479
524
  Args:
480
- email (str, optional): An email address
481
- id (str, optional): The id of a user or a service
525
+ email: An email address.
526
+ id: The id of a user or a service.
527
+ username: A username.
482
528
 
483
529
  Returns:
484
530
  A PangeaResponse with an empty object in the response.result field.
@@ -486,8 +532,10 @@ class AuthNAsync(ServiceBaseAsync):
486
532
  Examples:
487
533
  authn.user.delete(email="example@example.com")
488
534
  """
489
- input = m.UserDeleteRequest(email=email, id=id)
490
- return await self.request.post("v2/user/delete", m.UserDeleteResult, data=input.dict(exclude_none=True))
535
+ input = m.UserDeleteRequest(email=email, id=id, username=username)
536
+ return await self.request.post(
537
+ "v2/user/delete", m.UserDeleteResult, data=input.model_dump(exclude_none=True)
538
+ )
491
539
 
492
540
  async def invite(
493
541
  self,
@@ -528,13 +576,17 @@ class AuthNAsync(ServiceBaseAsync):
528
576
  callback=callback,
529
577
  state=state,
530
578
  )
531
- return await self.request.post("v2/user/invite", m.UserInviteResult, data=input.dict(exclude_none=True))
579
+ return await self.request.post(
580
+ "v2/user/invite", m.UserInviteResult, data=input.model_dump(exclude_none=True)
581
+ )
532
582
 
533
583
  async def update(
534
584
  self,
535
585
  disabled: bool,
536
- id: Optional[str] = None,
537
- email: Optional[str] = None,
586
+ id: str | None = None,
587
+ email: str | None = None,
588
+ *,
589
+ username: str | None = None,
538
590
  ) -> PangeaResponse[m.UserUpdateResult]:
539
591
  """
540
592
  Update user's settings
@@ -544,10 +596,11 @@ class AuthNAsync(ServiceBaseAsync):
544
596
  OperationId: authn_post_v2_user_update
545
597
 
546
598
  Args:
547
- disabled (bool): New disabled value.
599
+ disabled: New disabled value.
548
600
  Disabling a user account will prevent them from logging in.
549
- id (str, optional): The identity of a user or a service
550
- email (str, optional): An email address
601
+ id: The identity of a user or a service.
602
+ email: An email address.
603
+ username: A username.
551
604
 
552
605
  Returns:
553
606
  A PangeaResponse with a user and its information in the response.result field.
@@ -564,9 +617,12 @@ class AuthNAsync(ServiceBaseAsync):
564
617
  id=id,
565
618
  email=email,
566
619
  disabled=disabled,
620
+ username=username,
567
621
  )
568
622
 
569
- return await self.request.post("v2/user/update", m.UserUpdateResult, data=input.dict(exclude_none=True))
623
+ return await self.request.post(
624
+ "v2/user/update", m.UserUpdateResult, data=input.model_dump(exclude_none=True)
625
+ )
570
626
 
571
627
  async def list(
572
628
  self,
@@ -608,17 +664,17 @@ class AuthNAsync(ServiceBaseAsync):
608
664
  order_by=order_by,
609
665
  size=size,
610
666
  )
611
- return await self.request.post("v2/user/list", m.UserListResult, data=input.dict(exclude_none=True))
667
+ return await self.request.post("v2/user/list", m.UserListResult, data=input.model_dump(exclude_none=True))
612
668
 
613
669
  class InvitesAsync(ServiceBaseAsync):
614
670
  service_name = SERVICE_NAME
615
671
 
616
672
  def __init__(
617
673
  self,
618
- token,
619
- config=None,
620
- logger_name="pangea",
621
- ):
674
+ token: str,
675
+ config: PangeaConfig | None = None,
676
+ logger_name: str = "pangea",
677
+ ) -> None:
622
678
  super().__init__(token, config, logger_name=logger_name)
623
679
 
624
680
  async def list(
@@ -655,7 +711,7 @@ class AuthNAsync(ServiceBaseAsync):
655
711
 
656
712
  input = m.UserInviteListRequest(filter=filter, last=last, order=order, order_by=order_by, size=size)
657
713
  return await self.request.post(
658
- "v2/user/invite/list", m.UserInviteListResult, data=input.dict(exclude_none=True)
714
+ "v2/user/invite/list", m.UserInviteListResult, data=input.model_dump(exclude_none=True)
659
715
  )
660
716
 
661
717
  async def delete(self, id: str) -> PangeaResponse[m.UserInviteDeleteResult]:
@@ -679,7 +735,7 @@ class AuthNAsync(ServiceBaseAsync):
679
735
  """
680
736
  input = m.UserInviteDeleteRequest(id=id)
681
737
  return await self.request.post(
682
- "v2/user/invite/delete", m.UserInviteDeleteResult, data=input.dict(exclude_none=True)
738
+ "v2/user/invite/delete", m.UserInviteDeleteResult, data=input.model_dump(exclude_none=True)
683
739
  )
684
740
 
685
741
  class AuthenticatorsAsync(ServiceBaseAsync):
@@ -687,14 +743,19 @@ class AuthNAsync(ServiceBaseAsync):
687
743
 
688
744
  def __init__(
689
745
  self,
690
- token,
691
- config=None,
692
- logger_name="pangea",
693
- ):
746
+ token: str,
747
+ config: PangeaConfig | None = None,
748
+ logger_name: str = "pangea",
749
+ ) -> None:
694
750
  super().__init__(token, config, logger_name=logger_name)
695
751
 
696
752
  async def delete(
697
- self, authenticator_id: str, id: Optional[str] = None, email: Optional[str] = None
753
+ self,
754
+ authenticator_id: str,
755
+ id: str | None = None,
756
+ email: str | None = None,
757
+ *,
758
+ username: str | None = None,
698
759
  ) -> PangeaResponse[m.UserAuthenticatorsDeleteResult]:
699
760
  """
700
761
  Delete user authenticator
@@ -704,9 +765,10 @@ class AuthNAsync(ServiceBaseAsync):
704
765
  OperationId: authn_post_v2_user_authenticators_delete
705
766
 
706
767
  Args:
707
- authenticator_id (str): An ID for an authenticator
708
- id (str, optional): The identity of a user or a service
709
- email (str, optional): An email address
768
+ authenticator_id: An ID for an authenticator.
769
+ id: The identity of a user or a service.
770
+ email: An email address.
771
+ username: A username.
710
772
 
711
773
  Returns:
712
774
  A PangeaResponse with an empty object in the response.result field.
@@ -717,15 +779,17 @@ class AuthNAsync(ServiceBaseAsync):
717
779
  id="pui_xpkhwpnz2cmegsws737xbsqnmnuwtbm5",
718
780
  )
719
781
  """
720
- input = m.UserAuthenticatorsDeleteRequest(authenticator_id=authenticator_id, email=email, id=id)
782
+ input = m.UserAuthenticatorsDeleteRequest(
783
+ authenticator_id=authenticator_id, email=email, id=id, username=username
784
+ )
721
785
  return await self.request.post(
722
786
  "v2/user/authenticators/delete",
723
787
  m.UserAuthenticatorsDeleteResult,
724
- data=input.dict(exclude_none=True),
788
+ data=input.model_dump(exclude_none=True),
725
789
  )
726
790
 
727
791
  async def list(
728
- self, email: Optional[str] = None, id: Optional[str] = None
792
+ self, email: str | None = None, id: str | None = None, *, username: str | None = None
729
793
  ) -> PangeaResponse[m.UserAuthenticatorsListResult]:
730
794
  """
731
795
  Get user authenticators
@@ -735,8 +799,9 @@ class AuthNAsync(ServiceBaseAsync):
735
799
  OperationId: authn_post_v2_user_authenticators_list
736
800
 
737
801
  Args:
738
- email (str, optional): An email address
739
- id (str, optional): The identity of a user or a service
802
+ email: An email address.
803
+ id: The identity of a user or a service.
804
+ username: A username.
740
805
 
741
806
  Returns:
742
807
  A PangeaResponse with a list of authenticators in the response.result field.
@@ -748,9 +813,11 @@ class AuthNAsync(ServiceBaseAsync):
748
813
  id="pui_xpkhwpnz2cmegsws737xbsqnmnuwtbm5",
749
814
  )
750
815
  """
751
- input = m.UserAuthenticatorsListRequest(email=email, id=id)
816
+ input = m.UserAuthenticatorsListRequest(email=email, id=id, username=username)
752
817
  return await self.request.post(
753
- "v2/user/authenticators/list", m.UserAuthenticatorsListResult, data=input.dict(exclude_none=True)
818
+ "v2/user/authenticators/list",
819
+ m.UserAuthenticatorsListResult,
820
+ data=input.model_dump(exclude_none=True),
754
821
  )
755
822
 
756
823
  class ProfileAsync(ServiceBaseAsync):
@@ -758,14 +825,14 @@ class AuthNAsync(ServiceBaseAsync):
758
825
 
759
826
  def __init__(
760
827
  self,
761
- token,
762
- config=None,
763
- logger_name="pangea",
764
- ):
828
+ token: str,
829
+ config: PangeaConfig | None = None,
830
+ logger_name: str = "pangea",
831
+ ) -> None:
765
832
  super().__init__(token, config, logger_name=logger_name)
766
833
 
767
834
  async def get(
768
- self, id: Optional[str] = None, email: Optional[str] = None
835
+ self, id: str | None = None, email: str | None = None, *, username: str | None = None
769
836
  ) -> PangeaResponse[m.UserProfileGetResult]:
770
837
  """
771
838
  Get user
@@ -775,8 +842,9 @@ class AuthNAsync(ServiceBaseAsync):
775
842
  OperationId: authn_post_v2_user_profile_get
776
843
 
777
844
  Args:
778
- id (str, optional): The identity of a user or a service
779
- email (str, optional): An email address
845
+ id: The identity of a user or a service.
846
+ email: An email address.
847
+ username: A username.
780
848
 
781
849
  Returns:
782
850
  A PangeaResponse with a user and its information in the response.result field.
@@ -788,16 +856,18 @@ class AuthNAsync(ServiceBaseAsync):
788
856
  email="joe.user@email.com",
789
857
  )
790
858
  """
791
- input = m.UserProfileGetRequest(id=id, email=email)
859
+ input = m.UserProfileGetRequest(id=id, email=email, username=username)
792
860
  return await self.request.post(
793
- "v2/user/profile/get", m.UserProfileGetResult, data=input.dict(exclude_none=True)
861
+ "v2/user/profile/get", m.UserProfileGetResult, data=input.model_dump(exclude_none=True)
794
862
  )
795
863
 
796
864
  async def update(
797
865
  self,
798
866
  profile: m.Profile,
799
- id: Optional[str] = None,
800
- email: Optional[str] = None,
867
+ id: str | None = None,
868
+ email: str | None = None,
869
+ *,
870
+ username: str | None = None,
801
871
  ) -> PangeaResponse[m.UserProfileUpdateResult]:
802
872
  """
803
873
  Update user
@@ -807,9 +877,10 @@ class AuthNAsync(ServiceBaseAsync):
807
877
  OperationId: authn_post_v2_user_profile_update
808
878
 
809
879
  Args:
810
- profile (m.Profile): Updates to a user profile
811
- id (str, optional): The identity of a user or a service
812
- email (str, optional): An email address
880
+ profile: Updates to a user profile.
881
+ id: The identity of a user or a service.
882
+ email: An email address.
883
+ username: A username.
813
884
 
814
885
  Returns:
815
886
  A PangeaResponse with a user and its information in the response.result field.
@@ -828,9 +899,10 @@ class AuthNAsync(ServiceBaseAsync):
828
899
  id=id,
829
900
  email=email,
830
901
  profile=profile,
902
+ username=username,
831
903
  )
832
904
  return await self.request.post(
833
- "v2/user/profile/update", m.UserProfileUpdateResult, data=input.dict(exclude_none=True)
905
+ "v2/user/profile/update", m.UserProfileUpdateResult, data=input.model_dump(exclude_none=True)
834
906
  )
835
907
 
836
908
  class FlowAsync(ServiceBaseAsync):
@@ -838,10 +910,10 @@ class AuthNAsync(ServiceBaseAsync):
838
910
 
839
911
  def __init__(
840
912
  self,
841
- token,
842
- config=None,
843
- logger_name="pangea",
844
- ):
913
+ token: str,
914
+ config: PangeaConfig | None = None,
915
+ logger_name: str = "pangea",
916
+ ) -> None:
845
917
  super().__init__(token, config, logger_name=logger_name)
846
918
 
847
919
  async def complete(self, flow_id: str) -> PangeaResponse[m.FlowCompleteResult]:
@@ -866,7 +938,9 @@ class AuthNAsync(ServiceBaseAsync):
866
938
  )
867
939
  """
868
940
  input = m.FlowCompleteRequest(flow_id=flow_id)
869
- return await self.request.post("v2/flow/complete", m.FlowCompleteResult, data=input.dict(exclude_none=True))
941
+ return await self.request.post(
942
+ "v2/flow/complete", m.FlowCompleteResult, data=input.model_dump(exclude_none=True)
943
+ )
870
944
 
871
945
  async def restart(
872
946
  self, flow_id: str, choice: m.FlowChoice, data: m.FlowRestartData = {}
@@ -898,7 +972,9 @@ class AuthNAsync(ServiceBaseAsync):
898
972
  """
899
973
 
900
974
  input = m.FlowRestartRequest(flow_id=flow_id, choice=choice, data=data)
901
- return await self.request.post("v2/flow/restart", m.FlowRestartResult, data=input.dict(exclude_none=True))
975
+ return await self.request.post(
976
+ "v2/flow/restart", m.FlowRestartResult, data=input.model_dump(exclude_none=True)
977
+ )
902
978
 
903
979
  async def start(
904
980
  self,
@@ -937,7 +1013,7 @@ class AuthNAsync(ServiceBaseAsync):
937
1013
  )
938
1014
  """
939
1015
  input = m.FlowStartRequest(cb_uri=cb_uri, email=email, flow_types=flow_types, invitation=invitation)
940
- return await self.request.post("v2/flow/start", m.FlowStartResult, data=input.dict(exclude_none=True))
1016
+ return await self.request.post("v2/flow/start", m.FlowStartResult, data=input.model_dump(exclude_none=True))
941
1017
 
942
1018
  async def update(
943
1019
  self, flow_id: str, choice: m.FlowChoice, data: m.FlowUpdateData = {}
@@ -971,17 +1047,19 @@ class AuthNAsync(ServiceBaseAsync):
971
1047
  """
972
1048
 
973
1049
  input = m.FlowUpdateRequest(flow_id=flow_id, choice=choice, data=data)
974
- return await self.request.post("v2/flow/update", m.FlowUpdateResult, data=input.dict(exclude_none=True))
1050
+ return await self.request.post(
1051
+ "v2/flow/update", m.FlowUpdateResult, data=input.model_dump(exclude_none=True)
1052
+ )
975
1053
 
976
1054
  class AgreementsAsync(ServiceBaseAsync):
977
1055
  service_name = SERVICE_NAME
978
1056
 
979
1057
  def __init__(
980
1058
  self,
981
- token,
982
- config=None,
983
- logger_name="pangea",
984
- ):
1059
+ token: str,
1060
+ config: PangeaConfig | None = None,
1061
+ logger_name: str = "pangea",
1062
+ ) -> None:
985
1063
  super().__init__(token, config, logger_name=logger_name)
986
1064
 
987
1065
  async def create(
@@ -1015,7 +1093,7 @@ class AuthNAsync(ServiceBaseAsync):
1015
1093
 
1016
1094
  input = m.AgreementCreateRequest(type=type, name=name, text=text, active=active)
1017
1095
  return await self.request.post(
1018
- "v2/agreements/create", m.AgreementCreateResult, data=input.dict(exclude_none=True)
1096
+ "v2/agreements/create", m.AgreementCreateResult, data=input.model_dump(exclude_none=True)
1019
1097
  )
1020
1098
 
1021
1099
  async def delete(self, type: m.AgreementType, id: str) -> PangeaResponse[m.AgreementDeleteResult]:
@@ -1042,7 +1120,7 @@ class AuthNAsync(ServiceBaseAsync):
1042
1120
 
1043
1121
  input = m.AgreementDeleteRequest(type=type, id=id)
1044
1122
  return await self.request.post(
1045
- "v2/agreements/delete", m.AgreementDeleteResult, data=input.dict(exclude_none=True)
1123
+ "v2/agreements/delete", m.AgreementDeleteResult, data=input.model_dump(exclude_none=True)
1046
1124
  )
1047
1125
 
1048
1126
  async def list(
@@ -1080,7 +1158,7 @@ class AuthNAsync(ServiceBaseAsync):
1080
1158
 
1081
1159
  input = m.AgreementListRequest(filter=filter, last=last, order=order, order_by=order_by, size=size)
1082
1160
  return await self.request.post(
1083
- "v2/agreements/list", m.AgreementListResult, data=input.dict(exclude_none=True)
1161
+ "v2/agreements/list", m.AgreementListResult, data=input.model_dump(exclude_none=True)
1084
1162
  )
1085
1163
 
1086
1164
  async def update(
@@ -1121,5 +1199,5 @@ class AuthNAsync(ServiceBaseAsync):
1121
1199
 
1122
1200
  input = m.AgreementUpdateRequest(type=type, id=id, name=name, text=text, active=active)
1123
1201
  return await self.request.post(
1124
- "v2/agreements/update", m.AgreementUpdateResult, data=input.dict(exclude_none=True)
1202
+ "v2/agreements/update", m.AgreementUpdateResult, data=input.model_dump(exclude_none=True)
1125
1203
  )