pangea-sdk 3.8.0b4__py3-none-any.whl → 4.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pangea/__init__.py +1 -2
- pangea/asyncio/request.py +17 -22
- pangea/asyncio/services/__init__.py +0 -2
- pangea/asyncio/services/audit.py +188 -23
- pangea/asyncio/services/authn.py +167 -108
- pangea/asyncio/services/authz.py +36 -45
- pangea/asyncio/services/embargo.py +2 -2
- pangea/asyncio/services/file_scan.py +3 -3
- pangea/asyncio/services/intel.py +44 -26
- pangea/asyncio/services/redact.py +60 -4
- pangea/asyncio/services/vault.py +145 -30
- pangea/dump_audit.py +1 -1
- pangea/request.py +30 -24
- pangea/response.py +34 -42
- pangea/services/__init__.py +0 -2
- pangea/services/audit/audit.py +202 -34
- pangea/services/audit/models.py +56 -8
- pangea/services/audit/util.py +3 -3
- pangea/services/authn/authn.py +116 -65
- pangea/services/authn/models.py +88 -4
- pangea/services/authz.py +51 -56
- pangea/services/base.py +23 -6
- pangea/services/embargo.py +2 -2
- pangea/services/file_scan.py +3 -2
- pangea/services/intel.py +25 -23
- pangea/services/redact.py +124 -4
- pangea/services/vault/models/common.py +121 -6
- pangea/services/vault/models/symmetric.py +2 -2
- pangea/services/vault/vault.py +143 -32
- pangea/utils.py +20 -109
- pangea/verify_audit.py +267 -83
- {pangea_sdk-3.8.0b4.dist-info → pangea_sdk-4.0.0.dist-info}/METADATA +12 -20
- pangea_sdk-4.0.0.dist-info/RECORD +46 -0
- {pangea_sdk-3.8.0b4.dist-info → pangea_sdk-4.0.0.dist-info}/WHEEL +1 -1
- pangea/asyncio/__init__.py +0 -1
- pangea/asyncio/file_uploader.py +0 -39
- pangea/asyncio/services/sanitize.py +0 -185
- pangea/asyncio/services/share.py +0 -573
- pangea/file_uploader.py +0 -35
- pangea/services/sanitize.py +0 -275
- pangea/services/share/file_format.py +0 -170
- pangea/services/share/share.py +0 -877
- pangea_sdk-3.8.0b4.dist-info/RECORD +0 -54
pangea/asyncio/services/authn.py
CHANGED
@@ -1,10 +1,12 @@
|
|
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
|
9
|
+
from pangea.config import PangeaConfig
|
8
10
|
from pangea.response import PangeaResponse
|
9
11
|
|
10
12
|
SERVICE_NAME = "authn"
|
@@ -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 =
|
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.
|
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(
|
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.
|
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.
|
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",
|
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.
|
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.
|
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.
|
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,7 +396,7 @@ 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.
|
399
|
+
"v2/client/password/change", m.ClientPasswordChangeResult, data=input.model_dump(exclude_none=True)
|
380
400
|
)
|
381
401
|
|
382
402
|
class TokenAsync(ServiceBaseAsync):
|
@@ -384,10 +404,10 @@ class AuthNAsync(ServiceBaseAsync):
|
|
384
404
|
|
385
405
|
def __init__(
|
386
406
|
self,
|
387
|
-
token,
|
388
|
-
config=None,
|
389
|
-
logger_name="pangea",
|
390
|
-
):
|
407
|
+
token: str,
|
408
|
+
config: PangeaConfig | None = None,
|
409
|
+
logger_name: str = "pangea",
|
410
|
+
) -> None:
|
391
411
|
super().__init__(token, config, logger_name=logger_name)
|
392
412
|
|
393
413
|
async def check(self, token: str) -> PangeaResponse[m.ClientTokenCheckResult]:
|
@@ -413,7 +433,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
413
433
|
"""
|
414
434
|
input = m.ClientTokenCheckRequest(token=token)
|
415
435
|
return await self.request.post(
|
416
|
-
"v2/client/token/check", m.ClientTokenCheckResult, data=input.
|
436
|
+
"v2/client/token/check", m.ClientTokenCheckResult, data=input.model_dump(exclude_none=True)
|
417
437
|
)
|
418
438
|
|
419
439
|
class UserAsync(ServiceBaseAsync):
|
@@ -421,10 +441,10 @@ class AuthNAsync(ServiceBaseAsync):
|
|
421
441
|
|
422
442
|
def __init__(
|
423
443
|
self,
|
424
|
-
token,
|
425
|
-
config=None,
|
426
|
-
logger_name="pangea",
|
427
|
-
):
|
444
|
+
token: str,
|
445
|
+
config: PangeaConfig | None = None,
|
446
|
+
logger_name: str = "pangea",
|
447
|
+
) -> None:
|
428
448
|
super().__init__(token, config, logger_name=logger_name)
|
429
449
|
self.profile = AuthNAsync.UserAsync.ProfileAsync(token, config, logger_name=logger_name)
|
430
450
|
self.authenticators = AuthNAsync.UserAsync.AuthenticatorsAsync(token, config, logger_name=logger_name)
|
@@ -434,6 +454,8 @@ class AuthNAsync(ServiceBaseAsync):
|
|
434
454
|
self,
|
435
455
|
email: str,
|
436
456
|
profile: m.Profile,
|
457
|
+
*,
|
458
|
+
username: str | None = None,
|
437
459
|
) -> PangeaResponse[m.UserCreateResult]:
|
438
460
|
"""
|
439
461
|
Create User
|
@@ -443,8 +465,9 @@ class AuthNAsync(ServiceBaseAsync):
|
|
443
465
|
OperationId: authn_post_v2_user_create
|
444
466
|
|
445
467
|
Args:
|
446
|
-
email
|
447
|
-
profile
|
468
|
+
email: An email address.
|
469
|
+
profile: A user profile as a collection of string properties.
|
470
|
+
username: A username.
|
448
471
|
|
449
472
|
Returns:
|
450
473
|
A PangeaResponse with a user and its information in the response.result field.
|
@@ -463,11 +486,14 @@ class AuthNAsync(ServiceBaseAsync):
|
|
463
486
|
input = m.UserCreateRequest(
|
464
487
|
email=email,
|
465
488
|
profile=profile,
|
489
|
+
username=username,
|
490
|
+
)
|
491
|
+
return await self.request.post(
|
492
|
+
"v2/user/create", m.UserCreateResult, data=input.model_dump(exclude_none=True)
|
466
493
|
)
|
467
|
-
return await self.request.post("v2/user/create", m.UserCreateResult, data=input.dict(exclude_none=True))
|
468
494
|
|
469
495
|
async def delete(
|
470
|
-
self, email:
|
496
|
+
self, email: str | None = None, id: str | None = None, *, username: str | None = None
|
471
497
|
) -> PangeaResponse[m.UserDeleteResult]:
|
472
498
|
"""
|
473
499
|
Delete User
|
@@ -477,8 +503,9 @@ class AuthNAsync(ServiceBaseAsync):
|
|
477
503
|
OperationId: authn_post_v2_user_delete
|
478
504
|
|
479
505
|
Args:
|
480
|
-
email
|
481
|
-
id
|
506
|
+
email: An email address.
|
507
|
+
id: The id of a user or a service.
|
508
|
+
username: A username.
|
482
509
|
|
483
510
|
Returns:
|
484
511
|
A PangeaResponse with an empty object in the response.result field.
|
@@ -486,8 +513,10 @@ class AuthNAsync(ServiceBaseAsync):
|
|
486
513
|
Examples:
|
487
514
|
authn.user.delete(email="example@example.com")
|
488
515
|
"""
|
489
|
-
input = m.UserDeleteRequest(email=email, id=id)
|
490
|
-
return await self.request.post(
|
516
|
+
input = m.UserDeleteRequest(email=email, id=id, username=username)
|
517
|
+
return await self.request.post(
|
518
|
+
"v2/user/delete", m.UserDeleteResult, data=input.model_dump(exclude_none=True)
|
519
|
+
)
|
491
520
|
|
492
521
|
async def invite(
|
493
522
|
self,
|
@@ -528,13 +557,17 @@ class AuthNAsync(ServiceBaseAsync):
|
|
528
557
|
callback=callback,
|
529
558
|
state=state,
|
530
559
|
)
|
531
|
-
return await self.request.post(
|
560
|
+
return await self.request.post(
|
561
|
+
"v2/user/invite", m.UserInviteResult, data=input.model_dump(exclude_none=True)
|
562
|
+
)
|
532
563
|
|
533
564
|
async def update(
|
534
565
|
self,
|
535
566
|
disabled: bool,
|
536
|
-
id:
|
537
|
-
email:
|
567
|
+
id: str | None = None,
|
568
|
+
email: str | None = None,
|
569
|
+
*,
|
570
|
+
username: str | None = None,
|
538
571
|
) -> PangeaResponse[m.UserUpdateResult]:
|
539
572
|
"""
|
540
573
|
Update user's settings
|
@@ -544,10 +577,11 @@ class AuthNAsync(ServiceBaseAsync):
|
|
544
577
|
OperationId: authn_post_v2_user_update
|
545
578
|
|
546
579
|
Args:
|
547
|
-
disabled
|
580
|
+
disabled: New disabled value.
|
548
581
|
Disabling a user account will prevent them from logging in.
|
549
|
-
id
|
550
|
-
email
|
582
|
+
id: The identity of a user or a service.
|
583
|
+
email: An email address.
|
584
|
+
username: A username.
|
551
585
|
|
552
586
|
Returns:
|
553
587
|
A PangeaResponse with a user and its information in the response.result field.
|
@@ -564,9 +598,12 @@ class AuthNAsync(ServiceBaseAsync):
|
|
564
598
|
id=id,
|
565
599
|
email=email,
|
566
600
|
disabled=disabled,
|
601
|
+
username=username,
|
567
602
|
)
|
568
603
|
|
569
|
-
return await self.request.post(
|
604
|
+
return await self.request.post(
|
605
|
+
"v2/user/update", m.UserUpdateResult, data=input.model_dump(exclude_none=True)
|
606
|
+
)
|
570
607
|
|
571
608
|
async def list(
|
572
609
|
self,
|
@@ -608,17 +645,17 @@ class AuthNAsync(ServiceBaseAsync):
|
|
608
645
|
order_by=order_by,
|
609
646
|
size=size,
|
610
647
|
)
|
611
|
-
return await self.request.post("v2/user/list", m.UserListResult, data=input.
|
648
|
+
return await self.request.post("v2/user/list", m.UserListResult, data=input.model_dump(exclude_none=True))
|
612
649
|
|
613
650
|
class InvitesAsync(ServiceBaseAsync):
|
614
651
|
service_name = SERVICE_NAME
|
615
652
|
|
616
653
|
def __init__(
|
617
654
|
self,
|
618
|
-
token,
|
619
|
-
config=None,
|
620
|
-
logger_name="pangea",
|
621
|
-
):
|
655
|
+
token: str,
|
656
|
+
config: PangeaConfig | None = None,
|
657
|
+
logger_name: str = "pangea",
|
658
|
+
) -> None:
|
622
659
|
super().__init__(token, config, logger_name=logger_name)
|
623
660
|
|
624
661
|
async def list(
|
@@ -655,7 +692,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
655
692
|
|
656
693
|
input = m.UserInviteListRequest(filter=filter, last=last, order=order, order_by=order_by, size=size)
|
657
694
|
return await self.request.post(
|
658
|
-
"v2/user/invite/list", m.UserInviteListResult, data=input.
|
695
|
+
"v2/user/invite/list", m.UserInviteListResult, data=input.model_dump(exclude_none=True)
|
659
696
|
)
|
660
697
|
|
661
698
|
async def delete(self, id: str) -> PangeaResponse[m.UserInviteDeleteResult]:
|
@@ -679,7 +716,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
679
716
|
"""
|
680
717
|
input = m.UserInviteDeleteRequest(id=id)
|
681
718
|
return await self.request.post(
|
682
|
-
"v2/user/invite/delete", m.UserInviteDeleteResult, data=input.
|
719
|
+
"v2/user/invite/delete", m.UserInviteDeleteResult, data=input.model_dump(exclude_none=True)
|
683
720
|
)
|
684
721
|
|
685
722
|
class AuthenticatorsAsync(ServiceBaseAsync):
|
@@ -687,14 +724,19 @@ class AuthNAsync(ServiceBaseAsync):
|
|
687
724
|
|
688
725
|
def __init__(
|
689
726
|
self,
|
690
|
-
token,
|
691
|
-
config=None,
|
692
|
-
logger_name="pangea",
|
693
|
-
):
|
727
|
+
token: str,
|
728
|
+
config: PangeaConfig | None = None,
|
729
|
+
logger_name: str = "pangea",
|
730
|
+
) -> None:
|
694
731
|
super().__init__(token, config, logger_name=logger_name)
|
695
732
|
|
696
733
|
async def delete(
|
697
|
-
self,
|
734
|
+
self,
|
735
|
+
authenticator_id: str,
|
736
|
+
id: str | None = None,
|
737
|
+
email: str | None = None,
|
738
|
+
*,
|
739
|
+
username: str | None = None,
|
698
740
|
) -> PangeaResponse[m.UserAuthenticatorsDeleteResult]:
|
699
741
|
"""
|
700
742
|
Delete user authenticator
|
@@ -704,9 +746,10 @@ class AuthNAsync(ServiceBaseAsync):
|
|
704
746
|
OperationId: authn_post_v2_user_authenticators_delete
|
705
747
|
|
706
748
|
Args:
|
707
|
-
authenticator_id
|
708
|
-
id
|
709
|
-
email
|
749
|
+
authenticator_id: An ID for an authenticator.
|
750
|
+
id: The identity of a user or a service.
|
751
|
+
email: An email address.
|
752
|
+
username: A username.
|
710
753
|
|
711
754
|
Returns:
|
712
755
|
A PangeaResponse with an empty object in the response.result field.
|
@@ -717,15 +760,17 @@ class AuthNAsync(ServiceBaseAsync):
|
|
717
760
|
id="pui_xpkhwpnz2cmegsws737xbsqnmnuwtbm5",
|
718
761
|
)
|
719
762
|
"""
|
720
|
-
input = m.UserAuthenticatorsDeleteRequest(
|
763
|
+
input = m.UserAuthenticatorsDeleteRequest(
|
764
|
+
authenticator_id=authenticator_id, email=email, id=id, username=username
|
765
|
+
)
|
721
766
|
return await self.request.post(
|
722
767
|
"v2/user/authenticators/delete",
|
723
768
|
m.UserAuthenticatorsDeleteResult,
|
724
|
-
data=input.
|
769
|
+
data=input.model_dump(exclude_none=True),
|
725
770
|
)
|
726
771
|
|
727
772
|
async def list(
|
728
|
-
self, email:
|
773
|
+
self, email: str | None = None, id: str | None = None, *, username: str | None = None
|
729
774
|
) -> PangeaResponse[m.UserAuthenticatorsListResult]:
|
730
775
|
"""
|
731
776
|
Get user authenticators
|
@@ -735,8 +780,9 @@ class AuthNAsync(ServiceBaseAsync):
|
|
735
780
|
OperationId: authn_post_v2_user_authenticators_list
|
736
781
|
|
737
782
|
Args:
|
738
|
-
email
|
739
|
-
id
|
783
|
+
email: An email address.
|
784
|
+
id: The identity of a user or a service.
|
785
|
+
username: A username.
|
740
786
|
|
741
787
|
Returns:
|
742
788
|
A PangeaResponse with a list of authenticators in the response.result field.
|
@@ -748,9 +794,11 @@ class AuthNAsync(ServiceBaseAsync):
|
|
748
794
|
id="pui_xpkhwpnz2cmegsws737xbsqnmnuwtbm5",
|
749
795
|
)
|
750
796
|
"""
|
751
|
-
input = m.UserAuthenticatorsListRequest(email=email, id=id)
|
797
|
+
input = m.UserAuthenticatorsListRequest(email=email, id=id, username=username)
|
752
798
|
return await self.request.post(
|
753
|
-
"v2/user/authenticators/list",
|
799
|
+
"v2/user/authenticators/list",
|
800
|
+
m.UserAuthenticatorsListResult,
|
801
|
+
data=input.model_dump(exclude_none=True),
|
754
802
|
)
|
755
803
|
|
756
804
|
class ProfileAsync(ServiceBaseAsync):
|
@@ -758,14 +806,14 @@ class AuthNAsync(ServiceBaseAsync):
|
|
758
806
|
|
759
807
|
def __init__(
|
760
808
|
self,
|
761
|
-
token,
|
762
|
-
config=None,
|
763
|
-
logger_name="pangea",
|
764
|
-
):
|
809
|
+
token: str,
|
810
|
+
config: PangeaConfig | None = None,
|
811
|
+
logger_name: str = "pangea",
|
812
|
+
) -> None:
|
765
813
|
super().__init__(token, config, logger_name=logger_name)
|
766
814
|
|
767
815
|
async def get(
|
768
|
-
self, id:
|
816
|
+
self, id: str | None = None, email: str | None = None, *, username: str | None = None
|
769
817
|
) -> PangeaResponse[m.UserProfileGetResult]:
|
770
818
|
"""
|
771
819
|
Get user
|
@@ -775,8 +823,9 @@ class AuthNAsync(ServiceBaseAsync):
|
|
775
823
|
OperationId: authn_post_v2_user_profile_get
|
776
824
|
|
777
825
|
Args:
|
778
|
-
id
|
779
|
-
email
|
826
|
+
id: The identity of a user or a service.
|
827
|
+
email: An email address.
|
828
|
+
username: A username.
|
780
829
|
|
781
830
|
Returns:
|
782
831
|
A PangeaResponse with a user and its information in the response.result field.
|
@@ -788,16 +837,18 @@ class AuthNAsync(ServiceBaseAsync):
|
|
788
837
|
email="joe.user@email.com",
|
789
838
|
)
|
790
839
|
"""
|
791
|
-
input = m.UserProfileGetRequest(id=id, email=email)
|
840
|
+
input = m.UserProfileGetRequest(id=id, email=email, username=username)
|
792
841
|
return await self.request.post(
|
793
|
-
"v2/user/profile/get", m.UserProfileGetResult, data=input.
|
842
|
+
"v2/user/profile/get", m.UserProfileGetResult, data=input.model_dump(exclude_none=True)
|
794
843
|
)
|
795
844
|
|
796
845
|
async def update(
|
797
846
|
self,
|
798
847
|
profile: m.Profile,
|
799
|
-
id:
|
800
|
-
email:
|
848
|
+
id: str | None = None,
|
849
|
+
email: str | None = None,
|
850
|
+
*,
|
851
|
+
username: str | None = None,
|
801
852
|
) -> PangeaResponse[m.UserProfileUpdateResult]:
|
802
853
|
"""
|
803
854
|
Update user
|
@@ -807,9 +858,10 @@ class AuthNAsync(ServiceBaseAsync):
|
|
807
858
|
OperationId: authn_post_v2_user_profile_update
|
808
859
|
|
809
860
|
Args:
|
810
|
-
profile
|
811
|
-
id
|
812
|
-
email
|
861
|
+
profile: Updates to a user profile.
|
862
|
+
id: The identity of a user or a service.
|
863
|
+
email: An email address.
|
864
|
+
username: A username.
|
813
865
|
|
814
866
|
Returns:
|
815
867
|
A PangeaResponse with a user and its information in the response.result field.
|
@@ -828,9 +880,10 @@ class AuthNAsync(ServiceBaseAsync):
|
|
828
880
|
id=id,
|
829
881
|
email=email,
|
830
882
|
profile=profile,
|
883
|
+
username=username,
|
831
884
|
)
|
832
885
|
return await self.request.post(
|
833
|
-
"v2/user/profile/update", m.UserProfileUpdateResult, data=input.
|
886
|
+
"v2/user/profile/update", m.UserProfileUpdateResult, data=input.model_dump(exclude_none=True)
|
834
887
|
)
|
835
888
|
|
836
889
|
class FlowAsync(ServiceBaseAsync):
|
@@ -838,10 +891,10 @@ class AuthNAsync(ServiceBaseAsync):
|
|
838
891
|
|
839
892
|
def __init__(
|
840
893
|
self,
|
841
|
-
token,
|
842
|
-
config=None,
|
843
|
-
logger_name="pangea",
|
844
|
-
):
|
894
|
+
token: str,
|
895
|
+
config: PangeaConfig | None = None,
|
896
|
+
logger_name: str = "pangea",
|
897
|
+
) -> None:
|
845
898
|
super().__init__(token, config, logger_name=logger_name)
|
846
899
|
|
847
900
|
async def complete(self, flow_id: str) -> PangeaResponse[m.FlowCompleteResult]:
|
@@ -866,7 +919,9 @@ class AuthNAsync(ServiceBaseAsync):
|
|
866
919
|
)
|
867
920
|
"""
|
868
921
|
input = m.FlowCompleteRequest(flow_id=flow_id)
|
869
|
-
return await self.request.post(
|
922
|
+
return await self.request.post(
|
923
|
+
"v2/flow/complete", m.FlowCompleteResult, data=input.model_dump(exclude_none=True)
|
924
|
+
)
|
870
925
|
|
871
926
|
async def restart(
|
872
927
|
self, flow_id: str, choice: m.FlowChoice, data: m.FlowRestartData = {}
|
@@ -898,7 +953,9 @@ class AuthNAsync(ServiceBaseAsync):
|
|
898
953
|
"""
|
899
954
|
|
900
955
|
input = m.FlowRestartRequest(flow_id=flow_id, choice=choice, data=data)
|
901
|
-
return await self.request.post(
|
956
|
+
return await self.request.post(
|
957
|
+
"v2/flow/restart", m.FlowRestartResult, data=input.model_dump(exclude_none=True)
|
958
|
+
)
|
902
959
|
|
903
960
|
async def start(
|
904
961
|
self,
|
@@ -937,7 +994,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
937
994
|
)
|
938
995
|
"""
|
939
996
|
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.
|
997
|
+
return await self.request.post("v2/flow/start", m.FlowStartResult, data=input.model_dump(exclude_none=True))
|
941
998
|
|
942
999
|
async def update(
|
943
1000
|
self, flow_id: str, choice: m.FlowChoice, data: m.FlowUpdateData = {}
|
@@ -971,17 +1028,19 @@ class AuthNAsync(ServiceBaseAsync):
|
|
971
1028
|
"""
|
972
1029
|
|
973
1030
|
input = m.FlowUpdateRequest(flow_id=flow_id, choice=choice, data=data)
|
974
|
-
return await self.request.post(
|
1031
|
+
return await self.request.post(
|
1032
|
+
"v2/flow/update", m.FlowUpdateResult, data=input.model_dump(exclude_none=True)
|
1033
|
+
)
|
975
1034
|
|
976
1035
|
class AgreementsAsync(ServiceBaseAsync):
|
977
1036
|
service_name = SERVICE_NAME
|
978
1037
|
|
979
1038
|
def __init__(
|
980
1039
|
self,
|
981
|
-
token,
|
982
|
-
config=None,
|
983
|
-
logger_name="pangea",
|
984
|
-
):
|
1040
|
+
token: str,
|
1041
|
+
config: PangeaConfig | None = None,
|
1042
|
+
logger_name: str = "pangea",
|
1043
|
+
) -> None:
|
985
1044
|
super().__init__(token, config, logger_name=logger_name)
|
986
1045
|
|
987
1046
|
async def create(
|
@@ -1015,7 +1074,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
1015
1074
|
|
1016
1075
|
input = m.AgreementCreateRequest(type=type, name=name, text=text, active=active)
|
1017
1076
|
return await self.request.post(
|
1018
|
-
"v2/agreements/create", m.AgreementCreateResult, data=input.
|
1077
|
+
"v2/agreements/create", m.AgreementCreateResult, data=input.model_dump(exclude_none=True)
|
1019
1078
|
)
|
1020
1079
|
|
1021
1080
|
async def delete(self, type: m.AgreementType, id: str) -> PangeaResponse[m.AgreementDeleteResult]:
|
@@ -1042,7 +1101,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
1042
1101
|
|
1043
1102
|
input = m.AgreementDeleteRequest(type=type, id=id)
|
1044
1103
|
return await self.request.post(
|
1045
|
-
"v2/agreements/delete", m.AgreementDeleteResult, data=input.
|
1104
|
+
"v2/agreements/delete", m.AgreementDeleteResult, data=input.model_dump(exclude_none=True)
|
1046
1105
|
)
|
1047
1106
|
|
1048
1107
|
async def list(
|
@@ -1080,7 +1139,7 @@ class AuthNAsync(ServiceBaseAsync):
|
|
1080
1139
|
|
1081
1140
|
input = m.AgreementListRequest(filter=filter, last=last, order=order, order_by=order_by, size=size)
|
1082
1141
|
return await self.request.post(
|
1083
|
-
"v2/agreements/list", m.AgreementListResult, data=input.
|
1142
|
+
"v2/agreements/list", m.AgreementListResult, data=input.model_dump(exclude_none=True)
|
1084
1143
|
)
|
1085
1144
|
|
1086
1145
|
async def update(
|
@@ -1121,5 +1180,5 @@ class AuthNAsync(ServiceBaseAsync):
|
|
1121
1180
|
|
1122
1181
|
input = m.AgreementUpdateRequest(type=type, id=id, name=name, text=text, active=active)
|
1123
1182
|
return await self.request.post(
|
1124
|
-
"v2/agreements/update", m.AgreementUpdateResult, data=input.
|
1183
|
+
"v2/agreements/update", m.AgreementUpdateResult, data=input.model_dump(exclude_none=True)
|
1125
1184
|
)
|