scalekit-sdk-python 1.1.0__tar.gz → 2.0.0__tar.gz
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.
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/PKG-INFO +1 -1
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/client.py +59 -1
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/common/scalekit.py +15 -1
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/core.py +2 -2
- scalekit_sdk_python-2.0.0/scalekit/users.py +367 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/auth/auth_pb2.py +152 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/auth/auth_pb2.pyi +212 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/auth/auth_pb2_grpc.py +430 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/auth/passwordless_pb2.py +98 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/auth/passwordless_pb2.pyi +99 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/auth/passwordless_pb2_grpc.py +132 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/clients/clients_pb2.py +575 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/clients/clients_pb2.pyi +639 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/clients/clients_pb2_grpc.py +330 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/commons/commons_pb2.py +84 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/commons/commons_pb2.pyi +40 -26
- scalekit_sdk_python-2.0.0/scalekit/v1/connections/connections_pb2.py +511 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/connections/connections_pb2.pyi +55 -2
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/connections/connections_pb2_grpc.py +66 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/directories/directories_pb2.py +396 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/directories/directories_pb2.pyi +58 -8
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/directories/directories_pb2_grpc.py +99 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/domains/domains_pb2.py +28 -18
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/domains/domains_pb2.pyi +10 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/domains/domains_pb2_grpc.py +34 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/emails/emails_pb2.py +287 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/emails/emails_pb2.pyi +94 -2
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/emails/emails_pb2_grpc.py +66 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/environments/environments_pb2.py +108 -54
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/environments/environments_pb2.pyi +79 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/environments/environments_pb2_grpc.py +132 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/events/events_pb2.py +2 -2
- scalekit_sdk_python-2.0.0/scalekit/v1/members/members_pb2.py +109 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/members/members_pb2.pyi +3 -2
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/options/options_pb2.py +2 -2
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/options/options_pb2.pyi +2 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/organizations/organizations_pb2.py +309 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/roles/roles_pb2.py +169 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/roles/roles_pb2.pyi +68 -4
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/roles/roles_pb2_grpc.py +165 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/user_attributes/user_attributes_pb2.py +9 -9
- scalekit_sdk_python-2.0.0/scalekit/v1/users/users_pb2.py +322 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/users/users_pb2.pyi +370 -0
- scalekit_sdk_python-2.0.0/scalekit/v1/users/users_pb2_grpc.py +401 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit_sdk_python.egg-info/PKG-INFO +1 -1
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit_sdk_python.egg-info/SOURCES.txt +4 -4
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/setup.py +1 -1
- scalekit_sdk_python-1.1.0/scalekit/v1/auth/auth_pb2.py +0 -77
- scalekit_sdk_python-1.1.0/scalekit/v1/auth/auth_pb2.pyi +0 -78
- scalekit_sdk_python-1.1.0/scalekit/v1/auth/auth_pb2_grpc.py +0 -199
- scalekit_sdk_python-1.1.0/scalekit/v1/clients/clients_pb2.py +0 -253
- scalekit_sdk_python-1.1.0/scalekit/v1/clients/clients_pb2.pyi +0 -304
- scalekit_sdk_python-1.1.0/scalekit/v1/commons/commons_pb2.py +0 -72
- scalekit_sdk_python-1.1.0/scalekit/v1/connections/connections_pb2.py +0 -472
- scalekit_sdk_python-1.1.0/scalekit/v1/directories/directories_pb2.py +0 -348
- scalekit_sdk_python-1.1.0/scalekit/v1/emails/emails_pb2.py +0 -236
- scalekit_sdk_python-1.1.0/scalekit/v1/login_box/login_box_pb2.py +0 -79
- scalekit_sdk_python-1.1.0/scalekit/v1/login_box/login_box_pb2.pyi +0 -88
- scalekit_sdk_python-1.1.0/scalekit/v1/login_box/login_box_pb2_grpc.py +0 -165
- scalekit_sdk_python-1.1.0/scalekit/v1/members/members_pb2.py +0 -108
- scalekit_sdk_python-1.1.0/scalekit/v1/organizations/organizations_pb2.py +0 -283
- scalekit_sdk_python-1.1.0/scalekit/v1/roles/roles_pb2.py +0 -111
- scalekit_sdk_python-1.1.0/scalekit/v1/users/users_pb2.py +0 -162
- scalekit_sdk_python-1.1.0/scalekit/v1/users/users_pb2.pyi +0 -171
- scalekit_sdk_python-1.1.0/scalekit/v1/users/users_pb2_grpc.py +0 -232
- scalekit_sdk_python-1.1.0/scalekit/v1/workspaces/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/LICENSE +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/README.md +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/buf/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/buf/validate/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/buf/validate/expression_pb2.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/buf/validate/expression_pb2.pyi +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/buf/validate/expression_pb2_grpc.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/buf/validate/priv/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/buf/validate/priv/private_pb2.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/buf/validate/priv/private_pb2.pyi +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/buf/validate/priv/private_pb2_grpc.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/buf/validate/validate_pb2.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/buf/validate/validate_pb2.pyi +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/buf/validate/validate_pb2_grpc.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/common/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/common/user.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/connection.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/constants/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/constants/user.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/directory.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/domain.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/m2m_client.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/organization.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/utils/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/utils/directory.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/auth/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/clients/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/commons/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/commons/commons_pb2_grpc.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/connections/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/directories/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/domains/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/emails/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/environments/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/errdetails/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/errdetails/errdetails_pb2.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/errdetails/errdetails_pb2.pyi +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/errdetails/errdetails_pb2_grpc.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/events/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/events/events_pb2.pyi +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/events/events_pb2_grpc.py +0 -0
- {scalekit_sdk_python-1.1.0/scalekit/v1/login_box → scalekit_sdk_python-2.0.0/scalekit/v1/members}/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/members/members_pb2_grpc.py +0 -0
- {scalekit_sdk_python-1.1.0/scalekit/v1/members → scalekit_sdk_python-2.0.0/scalekit/v1/migrations}/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/migrations/migrations_pb2.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/migrations/migrations_pb2.pyi +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/migrations/migrations_pb2_grpc.py +0 -0
- {scalekit_sdk_python-1.1.0/scalekit/v1/migrations → scalekit_sdk_python-2.0.0/scalekit/v1/options}/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/options/options_pb2_grpc.py +0 -0
- {scalekit_sdk_python-1.1.0/scalekit/v1/options → scalekit_sdk_python-2.0.0/scalekit/v1/organizations}/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/organizations/organizations_pb2.pyi +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/organizations/organizations_pb2_grpc.py +0 -0
- {scalekit_sdk_python-1.1.0/scalekit/v1/organizations → scalekit_sdk_python-2.0.0/scalekit/v1/roles}/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0/scalekit/v1/roles → scalekit_sdk_python-2.0.0/scalekit/v1/user_attributes}/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/user_attributes/user_attributes_pb2.pyi +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/user_attributes/user_attributes_pb2_grpc.py +0 -0
- {scalekit_sdk_python-1.1.0/scalekit/v1/user_attributes → scalekit_sdk_python-2.0.0/scalekit/v1/users}/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0/scalekit/v1/users → scalekit_sdk_python-2.0.0/scalekit/v1/webhooks}/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/webhooks/webhooks_pb2.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/webhooks/webhooks_pb2.pyi +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/webhooks/webhooks_pb2_grpc.py +0 -0
- {scalekit_sdk_python-1.1.0/scalekit/v1/webhooks → scalekit_sdk_python-2.0.0/scalekit/v1/workspaces}/__init__.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/workspaces/workspaces_pb2.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/workspaces/workspaces_pb2.pyi +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit/v1/workspaces/workspaces_pb2_grpc.py +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit_sdk_python.egg-info/dependency_links.txt +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit_sdk_python.egg-info/requires.txt +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/scalekit_sdk_python.egg-info/top_level.txt +0 -0
- {scalekit_sdk_python-1.1.0 → scalekit_sdk_python-2.0.0}/setup.cfg +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
import json
|
|
3
2
|
from math import floor
|
|
4
3
|
from typing import Any, Optional, Dict
|
|
@@ -15,15 +14,18 @@ from scalekit.connection import ConnectionClient
|
|
|
15
14
|
from scalekit.m2m_client import M2MClient
|
|
16
15
|
from scalekit.organization import OrganizationClient
|
|
17
16
|
from scalekit.directory import DirectoryClient
|
|
17
|
+
from scalekit.users import UserClient
|
|
18
18
|
from scalekit.common.scalekit import (
|
|
19
19
|
AuthorizationUrlOptions,
|
|
20
20
|
CodeAuthenticationOptions,
|
|
21
21
|
GrantType,
|
|
22
22
|
IdpInitiatedLoginClaims,
|
|
23
|
+
LogoutUrlOptions,
|
|
23
24
|
)
|
|
24
25
|
from scalekit.constants.user import id_token_claim_to_user_map
|
|
25
26
|
|
|
26
27
|
AUTHORIZE_ENDPOINT = "oauth/authorize"
|
|
28
|
+
LOGOUT_ENDPOINT = "end_session"
|
|
27
29
|
webhook_tolerance_in_seconds = timedelta(minutes=5)
|
|
28
30
|
webhook_signature_version = "v1"
|
|
29
31
|
|
|
@@ -58,6 +60,7 @@ class ScalekitClient:
|
|
|
58
60
|
self.organization = OrganizationClient(self.core_client)
|
|
59
61
|
self.directory = DirectoryClient(self.core_client)
|
|
60
62
|
self.m2m_client = M2MClient(self.core_client)
|
|
63
|
+
self.users = UserClient(self.core_client)
|
|
61
64
|
except Exception as exp:
|
|
62
65
|
raise exp
|
|
63
66
|
|
|
@@ -91,6 +94,7 @@ class ScalekitClient:
|
|
|
91
94
|
"connection_id": options.connection_id,
|
|
92
95
|
"organization_id": options.organization_id,
|
|
93
96
|
"provider": options.provider,
|
|
97
|
+
"prompt": options.prompt,
|
|
94
98
|
}
|
|
95
99
|
|
|
96
100
|
valid_auth_params = {k: v for k, v in url_params_dict.items() if v}
|
|
@@ -345,3 +349,57 @@ class ScalekitClient:
|
|
|
345
349
|
"""
|
|
346
350
|
signature = hmac.new(secret, data.encode(), hashlib.sha256).digest()
|
|
347
351
|
return f"v1, {base64.b64encode(signature).decode('utf-8')}"
|
|
352
|
+
|
|
353
|
+
def refresh_access_token(self, refresh_token: str):
|
|
354
|
+
"""
|
|
355
|
+
Method to refresh access token using refresh token
|
|
356
|
+
|
|
357
|
+
:param refresh_token : Refresh token to get new access token
|
|
358
|
+
:type : ``` str ```
|
|
359
|
+
|
|
360
|
+
:returns:
|
|
361
|
+
dict with access token & refresh token
|
|
362
|
+
"""
|
|
363
|
+
try:
|
|
364
|
+
response = self.core_client.authenticate(
|
|
365
|
+
json.dumps(
|
|
366
|
+
{
|
|
367
|
+
"refresh_token": refresh_token,
|
|
368
|
+
"grant_type": GrantType.RefreshToken.value,
|
|
369
|
+
"client_id": self.core_client.client_id,
|
|
370
|
+
"client_secret": self.core_client.client_secret,
|
|
371
|
+
}
|
|
372
|
+
)
|
|
373
|
+
)
|
|
374
|
+
response = json.loads(response.content)
|
|
375
|
+
return {
|
|
376
|
+
"access_token": response["access_token"],
|
|
377
|
+
"refresh_token": response["refresh_token"]
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
except Exception as exp:
|
|
381
|
+
raise exp
|
|
382
|
+
|
|
383
|
+
def get_logout_url(self, options: LogoutUrlOptions) -> str:
|
|
384
|
+
"""
|
|
385
|
+
Method to get logout URL
|
|
386
|
+
|
|
387
|
+
:param options : Logout URL options object
|
|
388
|
+
:type : ``` LogoutUrlOptions ```
|
|
389
|
+
|
|
390
|
+
:returns:
|
|
391
|
+
str: The logout URL
|
|
392
|
+
"""
|
|
393
|
+
try:
|
|
394
|
+
url_params_dict = {
|
|
395
|
+
"id_token_hint": options.id_token_hint,
|
|
396
|
+
"post_logout_redirect_uri": options.post_logout_redirect_uri,
|
|
397
|
+
"state": options.state
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
valid_params = {k: v for k, v in url_params_dict.items() if v is not None}
|
|
401
|
+
query_string = urlencode(valid_params)
|
|
402
|
+
|
|
403
|
+
return f"{self.core_client.env_url}/{LOGOUT_ENDPOINT}?{query_string}"
|
|
404
|
+
except Exception as exp:
|
|
405
|
+
raise exp
|
|
@@ -23,6 +23,7 @@ class AuthorizationUrlOptions:
|
|
|
23
23
|
self.domain_hint: Optional[str] = None
|
|
24
24
|
self.login_hint: Optional[str] = None
|
|
25
25
|
self.provider: Optional[str] = None
|
|
26
|
+
self.prompt: Optional[str] = None
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
class CodeAuthenticationOptions:
|
|
@@ -57,4 +58,17 @@ class IdpInitiatedLoginClaims:
|
|
|
57
58
|
self.connection_id: str
|
|
58
59
|
self.organization_id: str
|
|
59
60
|
self.login_hint: str
|
|
60
|
-
self.relay_state: Optional[str] = None
|
|
61
|
+
self.relay_state: Optional[str] = None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class LogoutUrlOptions:
|
|
65
|
+
"""Options for logout URL generation"""
|
|
66
|
+
def __init__(
|
|
67
|
+
self,
|
|
68
|
+
id_token_hint: Optional[str] = None,
|
|
69
|
+
post_logout_redirect_uri: Optional[str] = None,
|
|
70
|
+
state: Optional[str] = None
|
|
71
|
+
):
|
|
72
|
+
self.id_token_hint = id_token_hint
|
|
73
|
+
self.post_logout_redirect_uri = post_logout_redirect_uri
|
|
74
|
+
self.state = state
|
|
@@ -27,8 +27,8 @@ class WithCall(Protocol):
|
|
|
27
27
|
class CoreClient:
|
|
28
28
|
"""Class definition for Core Client"""
|
|
29
29
|
|
|
30
|
-
sdk_version = "Scalekit-Python/
|
|
31
|
-
api_version = "
|
|
30
|
+
sdk_version = "Scalekit-Python/2.0.0"
|
|
31
|
+
api_version = "20250625"
|
|
32
32
|
user_agent = f"{sdk_version} Python/{platform.python_version()} ({platform.system()}; {platform.architecture()}"
|
|
33
33
|
|
|
34
34
|
def __init__(self, env_url, client_id, client_secret):
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from scalekit.core import CoreClient
|
|
4
|
+
from scalekit.v1.users.users_pb2 import *
|
|
5
|
+
from scalekit.v1.users.users_pb2_grpc import UserServiceStub
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class UserClient:
|
|
9
|
+
"""Class definition for User Client"""
|
|
10
|
+
|
|
11
|
+
def __init__(self, core_client: CoreClient):
|
|
12
|
+
"""
|
|
13
|
+
Initializer for User Client
|
|
14
|
+
|
|
15
|
+
:param core_client : CoreClient Object
|
|
16
|
+
:type : ``` obj ```
|
|
17
|
+
:returns
|
|
18
|
+
None
|
|
19
|
+
"""
|
|
20
|
+
self.core_client = core_client
|
|
21
|
+
self.user_service = UserServiceStub(
|
|
22
|
+
self.core_client.grpc_secure_channel
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
def create_user_and_membership(
|
|
26
|
+
self,
|
|
27
|
+
organization_id: str,
|
|
28
|
+
user: CreateUser,
|
|
29
|
+
send_invitation_email: bool = True
|
|
30
|
+
) -> CreateUserAndMembershipResponse:
|
|
31
|
+
"""
|
|
32
|
+
Method to create a new user and add them to an organization
|
|
33
|
+
|
|
34
|
+
:param organization_id : Organization id to create user for
|
|
35
|
+
:type : ``` str ```
|
|
36
|
+
:param user : CreateUser object with expected values for user creation
|
|
37
|
+
:type : ``` obj ```
|
|
38
|
+
:param send_invitation_email: Whether to send activation email to the user
|
|
39
|
+
:type : ``` bool ```
|
|
40
|
+
|
|
41
|
+
:returns:
|
|
42
|
+
Create User And Membership Response
|
|
43
|
+
"""
|
|
44
|
+
return self.core_client.grpc_exec(
|
|
45
|
+
self.user_service.CreateUserAndMembership.with_call,
|
|
46
|
+
CreateUserAndMembershipRequest(
|
|
47
|
+
organization_id=organization_id,
|
|
48
|
+
user=user,
|
|
49
|
+
send_invitation_email=send_invitation_email
|
|
50
|
+
),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
def get_user(self, user_id: str) -> GetUserResponse:
|
|
54
|
+
"""
|
|
55
|
+
Method to get user by ID
|
|
56
|
+
|
|
57
|
+
:param user_id : User id to get user details
|
|
58
|
+
:type : ``` str ```
|
|
59
|
+
|
|
60
|
+
:returns:
|
|
61
|
+
Get User Response
|
|
62
|
+
"""
|
|
63
|
+
return self.core_client.grpc_exec(
|
|
64
|
+
self.user_service.GetUser.with_call,
|
|
65
|
+
GetUserRequest(id=user_id),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
def get_user_by_external_id(self, external_id: str) -> GetUserResponse:
|
|
69
|
+
"""
|
|
70
|
+
Method to get user by external ID
|
|
71
|
+
|
|
72
|
+
:param external_id : External id to get user details
|
|
73
|
+
:type : ``` str ```
|
|
74
|
+
|
|
75
|
+
:returns:
|
|
76
|
+
Get User Response
|
|
77
|
+
"""
|
|
78
|
+
return self.core_client.grpc_exec(
|
|
79
|
+
self.user_service.GetUser.with_call,
|
|
80
|
+
GetUserRequest(external_id=external_id),
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
def list_users(
|
|
84
|
+
self,
|
|
85
|
+
page_size: Optional[int] = None,
|
|
86
|
+
page_token: Optional[str] = None
|
|
87
|
+
) -> ListUsersResponse:
|
|
88
|
+
"""
|
|
89
|
+
Method to list all users in environment
|
|
90
|
+
|
|
91
|
+
:param page_size : Page size for pagination
|
|
92
|
+
:type : ``` int ```
|
|
93
|
+
:param page_token : Page token for pagination
|
|
94
|
+
:type : ``` str ```
|
|
95
|
+
|
|
96
|
+
:returns:
|
|
97
|
+
List Users Response
|
|
98
|
+
"""
|
|
99
|
+
return self.core_client.grpc_exec(
|
|
100
|
+
self.user_service.ListUsers.with_call,
|
|
101
|
+
ListUsersRequest(
|
|
102
|
+
page_size=page_size,
|
|
103
|
+
page_token=page_token
|
|
104
|
+
),
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
def list_organization_users(
|
|
108
|
+
self,
|
|
109
|
+
organization_id: str,
|
|
110
|
+
page_size: Optional[int] = None,
|
|
111
|
+
page_token: Optional[str] = None
|
|
112
|
+
) -> ListOrganizationUsersResponse:
|
|
113
|
+
"""
|
|
114
|
+
Method to list users for given organization id
|
|
115
|
+
|
|
116
|
+
:param organization_id : Organization id to list users for
|
|
117
|
+
:type : ``` str ```
|
|
118
|
+
:param page_size : Page size for pagination
|
|
119
|
+
:type : ``` int ```
|
|
120
|
+
:param page_token : Page token for pagination
|
|
121
|
+
:type : ``` str ```
|
|
122
|
+
|
|
123
|
+
:returns:
|
|
124
|
+
List Organization Users Response
|
|
125
|
+
"""
|
|
126
|
+
return self.core_client.grpc_exec(
|
|
127
|
+
self.user_service.ListOrganizationUsers.with_call,
|
|
128
|
+
ListOrganizationUsersRequest(
|
|
129
|
+
organization_id=organization_id,
|
|
130
|
+
page_size=page_size,
|
|
131
|
+
page_token=page_token
|
|
132
|
+
),
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
def update_user(self, user_id: str, user: UpdateUser) -> UpdateUserResponse:
|
|
136
|
+
"""
|
|
137
|
+
Method to update an existing user by ID
|
|
138
|
+
|
|
139
|
+
:param user_id : User id to update
|
|
140
|
+
:type : ``` str ```
|
|
141
|
+
:param user : UpdateUser object with expected values for user update
|
|
142
|
+
:type : ``` obj ```
|
|
143
|
+
|
|
144
|
+
:returns:
|
|
145
|
+
Update User Response
|
|
146
|
+
"""
|
|
147
|
+
return self.core_client.grpc_exec(
|
|
148
|
+
self.user_service.UpdateUser.with_call,
|
|
149
|
+
UpdateUserRequest(id=user_id, user=user),
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
def update_user_by_external_id(self, external_id: str, user: UpdateUser) -> UpdateUserResponse:
|
|
153
|
+
"""
|
|
154
|
+
Method to update an existing user by external ID
|
|
155
|
+
|
|
156
|
+
:param external_id : External id to update
|
|
157
|
+
:type : ``` str ```
|
|
158
|
+
:param user : UpdateUser object with expected values for user update
|
|
159
|
+
:type : ``` obj ```
|
|
160
|
+
|
|
161
|
+
:returns:
|
|
162
|
+
Update User Response
|
|
163
|
+
"""
|
|
164
|
+
return self.core_client.grpc_exec(
|
|
165
|
+
self.user_service.UpdateUser.with_call,
|
|
166
|
+
UpdateUserRequest(external_id=external_id, user=user),
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
def delete_user(self, user_id: str):
|
|
170
|
+
"""
|
|
171
|
+
Method to delete user by ID
|
|
172
|
+
|
|
173
|
+
:param user_id : User id to be deleted
|
|
174
|
+
:type : ``` str ```
|
|
175
|
+
|
|
176
|
+
:returns:
|
|
177
|
+
None
|
|
178
|
+
"""
|
|
179
|
+
return self.core_client.grpc_exec(
|
|
180
|
+
self.user_service.DeleteUser.with_call,
|
|
181
|
+
DeleteUserRequest(id=user_id),
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
def delete_user_by_external_id(self, external_id: str):
|
|
185
|
+
"""
|
|
186
|
+
Method to delete user by external ID
|
|
187
|
+
|
|
188
|
+
:param external_id : External id to be deleted
|
|
189
|
+
:type : ``` str ```
|
|
190
|
+
|
|
191
|
+
:returns:
|
|
192
|
+
None
|
|
193
|
+
"""
|
|
194
|
+
return self.core_client.grpc_exec(
|
|
195
|
+
self.user_service.DeleteUser.with_call,
|
|
196
|
+
DeleteUserRequest(external_id=external_id),
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
def create_membership(
|
|
200
|
+
self,
|
|
201
|
+
organization_id: str,
|
|
202
|
+
user_id: str,
|
|
203
|
+
membership: CreateMembership,
|
|
204
|
+
send_invitation_email: bool = True
|
|
205
|
+
) -> CreateMembershipResponse:
|
|
206
|
+
"""
|
|
207
|
+
Method to create a membership for a user by user ID
|
|
208
|
+
|
|
209
|
+
:param organization_id : Organization id
|
|
210
|
+
:type : ``` str ```
|
|
211
|
+
:param user_id : User id
|
|
212
|
+
:type : ``` str ```
|
|
213
|
+
:param membership : CreateMembership object
|
|
214
|
+
:type : ``` obj ```
|
|
215
|
+
:param send_invitation_email: Whether to send activation email to the user
|
|
216
|
+
:type : ``` bool ```
|
|
217
|
+
|
|
218
|
+
:returns:
|
|
219
|
+
Create Membership Response
|
|
220
|
+
"""
|
|
221
|
+
return self.core_client.grpc_exec(
|
|
222
|
+
self.user_service.CreateMembership.with_call,
|
|
223
|
+
CreateMembershipRequest(
|
|
224
|
+
organization_id=organization_id,
|
|
225
|
+
id=user_id,
|
|
226
|
+
membership=membership,
|
|
227
|
+
send_invitation_email=send_invitation_email
|
|
228
|
+
),
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
def create_membership_by_external_id(
|
|
232
|
+
self,
|
|
233
|
+
organization_id: str,
|
|
234
|
+
external_id: str,
|
|
235
|
+
membership: CreateMembership,
|
|
236
|
+
send_invitation_email: bool = True
|
|
237
|
+
) -> CreateMembershipResponse:
|
|
238
|
+
"""
|
|
239
|
+
Method to create a membership for a user by external ID
|
|
240
|
+
|
|
241
|
+
:param organization_id : Organization id
|
|
242
|
+
:type : ``` str ```
|
|
243
|
+
:param external_id : External id
|
|
244
|
+
:type : ``` str ```
|
|
245
|
+
:param membership : CreateMembership object
|
|
246
|
+
:type : ``` obj ```
|
|
247
|
+
:param send_invitation_email: Whether to send activation email to the user
|
|
248
|
+
:type : ``` bool ```
|
|
249
|
+
|
|
250
|
+
:returns:
|
|
251
|
+
Create Membership Response
|
|
252
|
+
"""
|
|
253
|
+
return self.core_client.grpc_exec(
|
|
254
|
+
self.user_service.CreateMembership.with_call,
|
|
255
|
+
CreateMembershipRequest(
|
|
256
|
+
organization_id=organization_id,
|
|
257
|
+
external_id=external_id,
|
|
258
|
+
membership=membership,
|
|
259
|
+
send_invitation_email=send_invitation_email
|
|
260
|
+
),
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
def update_membership(
|
|
264
|
+
self,
|
|
265
|
+
organization_id: str,
|
|
266
|
+
user_id: str,
|
|
267
|
+
membership: UpdateMembership
|
|
268
|
+
) -> UpdateMembershipResponse:
|
|
269
|
+
"""
|
|
270
|
+
Method to update a membership for a user by user ID
|
|
271
|
+
|
|
272
|
+
:param organization_id : Organization id
|
|
273
|
+
:type : ``` str ```
|
|
274
|
+
:param user_id : User id
|
|
275
|
+
:type : ``` str ```
|
|
276
|
+
:param membership : UpdateMembership object
|
|
277
|
+
:type : ``` obj ```
|
|
278
|
+
|
|
279
|
+
:returns:
|
|
280
|
+
Update Membership Response
|
|
281
|
+
"""
|
|
282
|
+
return self.core_client.grpc_exec(
|
|
283
|
+
self.user_service.UpdateMembership.with_call,
|
|
284
|
+
UpdateMembershipRequest(
|
|
285
|
+
organization_id=organization_id,
|
|
286
|
+
id=user_id,
|
|
287
|
+
membership=membership
|
|
288
|
+
),
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
def update_membership_by_external_id(
|
|
292
|
+
self,
|
|
293
|
+
organization_id: str,
|
|
294
|
+
external_id: str,
|
|
295
|
+
membership: UpdateMembership
|
|
296
|
+
) -> UpdateMembershipResponse:
|
|
297
|
+
"""
|
|
298
|
+
Method to update a membership for a user by external ID
|
|
299
|
+
|
|
300
|
+
:param organization_id : Organization id
|
|
301
|
+
:type : ``` str ```
|
|
302
|
+
:param external_id : External id
|
|
303
|
+
:type : ``` str ```
|
|
304
|
+
:param membership : UpdateMembership object
|
|
305
|
+
:type : ``` obj ```
|
|
306
|
+
|
|
307
|
+
:returns:
|
|
308
|
+
Update Membership Response
|
|
309
|
+
"""
|
|
310
|
+
return self.core_client.grpc_exec(
|
|
311
|
+
self.user_service.UpdateMembership.with_call,
|
|
312
|
+
UpdateMembershipRequest(
|
|
313
|
+
organization_id=organization_id,
|
|
314
|
+
external_id=external_id,
|
|
315
|
+
membership=membership
|
|
316
|
+
),
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
def delete_membership(
|
|
320
|
+
self,
|
|
321
|
+
organization_id: str,
|
|
322
|
+
user_id: str
|
|
323
|
+
):
|
|
324
|
+
"""
|
|
325
|
+
Method to delete a membership for a user by user ID
|
|
326
|
+
|
|
327
|
+
:param organization_id : Organization id
|
|
328
|
+
:type : ``` str ```
|
|
329
|
+
:param user_id : User id
|
|
330
|
+
:type : ``` str ```
|
|
331
|
+
|
|
332
|
+
:returns:
|
|
333
|
+
None
|
|
334
|
+
"""
|
|
335
|
+
return self.core_client.grpc_exec(
|
|
336
|
+
self.user_service.DeleteMembership.with_call,
|
|
337
|
+
DeleteMembershipRequest(
|
|
338
|
+
organization_id=organization_id,
|
|
339
|
+
id=user_id
|
|
340
|
+
),
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
def delete_membership_by_external_id(
|
|
344
|
+
self,
|
|
345
|
+
organization_id: str,
|
|
346
|
+
external_id: str
|
|
347
|
+
):
|
|
348
|
+
"""
|
|
349
|
+
Method to delete a membership for a user by external ID
|
|
350
|
+
|
|
351
|
+
:param organization_id : Organization id
|
|
352
|
+
:type : ``` str ```
|
|
353
|
+
:param external_id : External id
|
|
354
|
+
:type : ``` str ```
|
|
355
|
+
|
|
356
|
+
:returns:
|
|
357
|
+
None
|
|
358
|
+
"""
|
|
359
|
+
return self.core_client.grpc_exec(
|
|
360
|
+
self.user_service.DeleteMembership.with_call,
|
|
361
|
+
DeleteMembershipRequest(
|
|
362
|
+
organization_id=organization_id,
|
|
363
|
+
external_id=external_id
|
|
364
|
+
),
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
|