vortex-python-sdk 0.0.1__py3-none-any.whl → 0.0.2__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.

Potentially problematic release.


This version of vortex-python-sdk might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vortex-python-sdk
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Vortex Python SDK for invitation management and JWT generation
5
5
  Author-email: TeamVortexSoftware <support@vortexsoftware.com>
6
6
  License-Expression: MIT
@@ -67,16 +67,33 @@ vortex = Vortex(api_key="your-api-key", base_url="https://custom-api.example.com
67
67
  ```python
68
68
  # Generate JWT for a user
69
69
  jwt = vortex.generate_jwt({
70
- "user_id": "user123",
71
- "identifiers": {
72
- "email": "user@example.com",
73
- "username": "johndoe"
74
- },
75
- "groups": ["admin", "users"],
70
+ "user_id": "user-123",
71
+ "identifiers": [
72
+ {"type": "email", "value": "user@example.com"}
73
+ ],
74
+ "groups": [
75
+ {"type": "team", "id": "team-1", "name": "Engineering"}
76
+ ],
76
77
  "role": "admin"
77
78
  })
78
79
 
79
80
  print(f"JWT: {jwt}")
81
+
82
+ # Or using type-safe models
83
+ from vortex_sdk import JwtPayload, IdentifierInput, GroupInput
84
+
85
+ jwt = vortex.generate_jwt(
86
+ JwtPayload(
87
+ user_id="user-123",
88
+ identifiers=[
89
+ IdentifierInput(type="email", value="user@example.com")
90
+ ],
91
+ groups=[
92
+ GroupInput(type="team", id="team-1", name="Engineering")
93
+ ],
94
+ role="admin"
95
+ )
96
+ )
80
97
  ```
81
98
 
82
99
  ### Invitation Management
@@ -0,0 +1,9 @@
1
+ vortex_python_sdk-0.0.2.dist-info/licenses/LICENSE,sha256=VndlWxbL4-w3YDf2yE5gJscj4zVXF0qlSq0LDtay3lo,1074
2
+ vortex_sdk/__init__.py,sha256=BVRNzjJmtAX7QjUSqG1qL_l3jpVp-AOxMhuBdCCPFOg,709
3
+ vortex_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ vortex_sdk/types.py,sha256=49M5wb1PjFPeeqzZurd91rIaCTJK2Ll-L28BQhxd4wI,3026
5
+ vortex_sdk/vortex.py,sha256=gtIuLkW4XY6zMClNeMukicEU8Afr6RYA7RHG25YTtmE,13275
6
+ vortex_python_sdk-0.0.2.dist-info/METADATA,sha256=iFMbcUiLIgSOhbijKHdXYQkKJb2rgFjPrCRrxnBu33g,6198
7
+ vortex_python_sdk-0.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ vortex_python_sdk-0.0.2.dist-info/top_level.txt,sha256=xFDlEcXIIi_sBhkse0YfMnSdg2IlaYUd0oP2UCDc_Y0,11
9
+ vortex_python_sdk-0.0.2.dist-info/RECORD,,
vortex_sdk/__init__.py CHANGED
@@ -8,6 +8,8 @@ from .vortex import Vortex
8
8
  from .types import (
9
9
  AuthenticatedUser,
10
10
  JwtPayload,
11
+ IdentifierInput,
12
+ GroupInput,
11
13
  InvitationTarget,
12
14
  Invitation,
13
15
  CreateInvitationRequest,
@@ -16,7 +18,7 @@ from .types import (
16
18
  VortexApiError
17
19
  )
18
20
 
19
- __version__ = "0.0.1"
21
+ __version__ = "0.0.2"
20
22
  __author__ = "TeamVortexSoftware"
21
23
  __email__ = "support@vortexsoftware.com"
22
24
 
@@ -24,6 +26,8 @@ __all__ = [
24
26
  "Vortex",
25
27
  "AuthenticatedUser",
26
28
  "JwtPayload",
29
+ "IdentifierInput",
30
+ "GroupInput",
27
31
  "InvitationTarget",
28
32
  "Invitation",
29
33
  "CreateInvitationRequest",
vortex_sdk/types.py CHANGED
@@ -1,18 +1,62 @@
1
1
  from typing import Dict, List, Optional, Union, Literal
2
- from pydantic import BaseModel
2
+ from pydantic import BaseModel, Field
3
+
4
+
5
+ class IdentifierInput(BaseModel):
6
+ """Identifier structure for JWT generation"""
7
+ type: Literal["email", "sms"]
8
+ value: str
9
+
10
+
11
+ class GroupInput(BaseModel):
12
+ """Group structure for JWT generation (input)"""
13
+ type: str
14
+ id: Optional[str] = None # Legacy field (deprecated, use groupId)
15
+ groupId: Optional[str] = Field(None, alias="group_id", serialization_alias="groupId") # Preferred: Customer's group ID
16
+ name: str
17
+
18
+ class Config:
19
+ populate_by_name = True
20
+
21
+
22
+ class InvitationGroup(BaseModel):
23
+ """
24
+ Invitation group from API responses
25
+ This matches the MemberGroups table structure from the API
26
+ """
27
+ id: str # Vortex internal UUID
28
+ account_id: str # Vortex account ID (camelCase in JSON: accountId)
29
+ group_id: str # Customer's group ID (camelCase in JSON: groupId)
30
+ type: str # Group type (e.g., "workspace", "team")
31
+ name: str # Group name
32
+ created_at: str # ISO 8601 timestamp (camelCase in JSON: createdAt)
33
+
34
+ class Config:
35
+ # Allow both snake_case (Python) and camelCase (JSON) field names
36
+ populate_by_name = True
37
+ json_schema_extra = {
38
+ "example": {
39
+ "id": "550e8400-e29b-41d4-a716-446655440000",
40
+ "accountId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
41
+ "groupId": "workspace-123",
42
+ "type": "workspace",
43
+ "name": "My Workspace",
44
+ "createdAt": "2025-01-27T12:00:00.000Z"
45
+ }
46
+ }
3
47
 
4
48
 
5
49
  class AuthenticatedUser(BaseModel):
6
50
  user_id: str
7
- identifiers: Dict[str, str]
8
- groups: Optional[List[str]] = None
51
+ identifiers: List[IdentifierInput]
52
+ groups: Optional[List[GroupInput]] = None
9
53
  role: Optional[str] = None
10
54
 
11
55
 
12
56
  class JwtPayload(BaseModel):
13
57
  user_id: str
14
- identifiers: Dict[str, str]
15
- groups: Optional[List[str]] = None
58
+ identifiers: List[IdentifierInput]
59
+ groups: Optional[List[GroupInput]] = None
16
60
  role: Optional[str] = None
17
61
 
18
62
 
@@ -24,8 +68,7 @@ class InvitationTarget(BaseModel):
24
68
  class Invitation(BaseModel):
25
69
  id: str
26
70
  target: InvitationTarget
27
- group_type: Optional[str] = None
28
- group_id: Optional[str] = None
71
+ groups: Optional[List[InvitationGroup]] = None # Full group information
29
72
  status: str
30
73
  created_at: str
31
74
  updated_at: Optional[str] = None
vortex_sdk/vortex.py CHANGED
@@ -49,14 +49,18 @@ class Vortex:
49
49
  "typ": "JWT"
50
50
  }
51
51
 
52
- # JWT Payload
52
+ # JWT Payload - serialize identifiers and groups to dicts
53
53
  jwt_payload = {
54
54
  "userId": payload.user_id,
55
- "identifiers": payload.identifiers,
55
+ "identifiers": [{"type": id.type, "value": id.value} for id in payload.identifiers],
56
56
  }
57
57
 
58
58
  if payload.groups is not None:
59
- jwt_payload["groups"] = payload.groups
59
+ # Serialize groups, using model_dump to handle camelCase conversion
60
+ jwt_payload["groups"] = [
61
+ {k: v for k, v in group.model_dump(by_alias=True, exclude_none=True).items()}
62
+ for group in payload.groups
63
+ ]
60
64
  if payload.role is not None:
61
65
  jwt_payload["role"] = payload.role
62
66
 
@@ -1,9 +0,0 @@
1
- vortex_python_sdk-0.0.1.dist-info/licenses/LICENSE,sha256=VndlWxbL4-w3YDf2yE5gJscj4zVXF0qlSq0LDtay3lo,1074
2
- vortex_sdk/__init__.py,sha256=mFLcyV2i5W7xuj25cThFWYBm6S0HpeOGtUIHDenzhBc,631
3
- vortex_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- vortex_sdk/types.py,sha256=whBfV7yVcrmk5K7ex1s4FCs92V9_bj-7KUsCRi5fmgk,1491
5
- vortex_sdk/vortex.py,sha256=_Ov62rzGdLecbID6LVQLMZgDc96xw7jY5qNqsfUjV3o,12963
6
- vortex_python_sdk-0.0.1.dist-info/METADATA,sha256=BH1AkI5SMi_mhRtttqLa5w1o2gk8ymwdzX3emM6U5iQ,5765
7
- vortex_python_sdk-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- vortex_python_sdk-0.0.1.dist-info/top_level.txt,sha256=xFDlEcXIIi_sBhkse0YfMnSdg2IlaYUd0oP2UCDc_Y0,11
9
- vortex_python_sdk-0.0.1.dist-info/RECORD,,