vortex-python-sdk 0.7.0__tar.gz → 0.9.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vortex-python-sdk
3
- Version: 0.7.0
3
+ Version: 0.9.0
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
@@ -123,21 +123,21 @@ async def get_user_invitations():
123
123
  invitations = vortex.get_invitations_by_target_sync("email", "user@example.com")
124
124
  ```
125
125
 
126
- #### Accept Invitations
126
+ #### Accept an Invitation
127
127
 
128
128
  ```python
129
- async def accept_user_invitations():
129
+ async def accept_user_invitation():
130
130
  # Async version
131
- result = await vortex.accept_invitations(
132
- invitation_ids=["inv1", "inv2"],
133
- target={"type": "email", "value": "user@example.com"}
131
+ result = await vortex.accept_invitation(
132
+ invitation_id="inv-123",
133
+ user={"email": "user@example.com"}
134
134
  )
135
135
  print(f"Result: {result}")
136
136
 
137
137
  # Sync version
138
- result = vortex.accept_invitations_sync(
139
- invitation_ids=["inv1", "inv2"],
140
- target={"type": "email", "value": "user@example.com"}
138
+ result = vortex.accept_invitation_sync(
139
+ invitation_id="inv-123",
140
+ user={"email": "user@example.com"}
141
141
  )
142
142
  ```
143
143
 
@@ -85,21 +85,21 @@ async def get_user_invitations():
85
85
  invitations = vortex.get_invitations_by_target_sync("email", "user@example.com")
86
86
  ```
87
87
 
88
- #### Accept Invitations
88
+ #### Accept an Invitation
89
89
 
90
90
  ```python
91
- async def accept_user_invitations():
91
+ async def accept_user_invitation():
92
92
  # Async version
93
- result = await vortex.accept_invitations(
94
- invitation_ids=["inv1", "inv2"],
95
- target={"type": "email", "value": "user@example.com"}
93
+ result = await vortex.accept_invitation(
94
+ invitation_id="inv-123",
95
+ user={"email": "user@example.com"}
96
96
  )
97
97
  print(f"Result: {result}")
98
98
 
99
99
  # Sync version
100
- result = vortex.accept_invitations_sync(
101
- invitation_ids=["inv1", "inv2"],
102
- target={"type": "email", "value": "user@example.com"}
100
+ result = vortex.accept_invitation_sync(
101
+ invitation_id="inv-123",
102
+ user={"email": "user@example.com"}
103
103
  )
104
104
  ```
105
105
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "vortex-python-sdk"
7
- version = "0.7.0"
7
+ version = "0.9.0"
8
8
  description = "Vortex Python SDK for invitation management and JWT generation"
9
9
  authors = [{name = "TeamVortexSoftware", email = "support@vortexsoftware.com"}]
10
10
  readme = "README.md"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vortex-python-sdk
3
- Version: 0.7.0
3
+ Version: 0.9.0
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
@@ -123,21 +123,21 @@ async def get_user_invitations():
123
123
  invitations = vortex.get_invitations_by_target_sync("email", "user@example.com")
124
124
  ```
125
125
 
126
- #### Accept Invitations
126
+ #### Accept an Invitation
127
127
 
128
128
  ```python
129
- async def accept_user_invitations():
129
+ async def accept_user_invitation():
130
130
  # Async version
131
- result = await vortex.accept_invitations(
132
- invitation_ids=["inv1", "inv2"],
133
- target={"type": "email", "value": "user@example.com"}
131
+ result = await vortex.accept_invitation(
132
+ invitation_id="inv-123",
133
+ user={"email": "user@example.com"}
134
134
  )
135
135
  print(f"Result: {result}")
136
136
 
137
137
  # Sync version
138
- result = vortex.accept_invitations_sync(
139
- invitation_ids=["inv1", "inv2"],
140
- target={"type": "email", "value": "user@example.com"}
138
+ result = vortex.accept_invitation_sync(
139
+ invitation_id="inv-123",
140
+ user={"email": "user@example.com"}
141
141
  )
142
142
  ```
143
143
 
@@ -64,6 +64,8 @@ class User(BaseModel):
64
64
  - user_name: User's display name
65
65
  - user_avatar_url: User's avatar URL (must be HTTPS, max 2000 chars)
66
66
  - admin_scopes: List of admin scopes (e.g., ['autojoin'])
67
+ - allowed_email_domains: List of allowed email domains for invitation restrictions
68
+ (e.g., ['acme.com', 'acme.org'])
67
69
 
68
70
  Additional fields are allowed via extra parameter
69
71
  """
@@ -72,9 +74,11 @@ class User(BaseModel):
72
74
  user_name: Optional[str] = Field(None, alias="userName")
73
75
  user_avatar_url: Optional[str] = Field(None, alias="userAvatarUrl")
74
76
  admin_scopes: Optional[List[str]] = None
77
+ allowed_email_domains: Optional[List[str]] = Field(None, alias="allowedEmailDomains")
75
78
 
76
79
  class Config:
77
80
  extra = "allow" # Allow additional fields
81
+ populate_by_name = True
78
82
 
79
83
 
80
84
  class AuthenticatedUser(BaseModel):
@@ -140,6 +140,10 @@ class Vortex:
140
140
  if user.admin_scopes:
141
141
  jwt_payload["adminScopes"] = user.admin_scopes
142
142
 
143
+ # Add allowedEmailDomains if present (for domain-restricted invitations)
144
+ if user.allowed_email_domains:
145
+ jwt_payload["allowedEmailDomains"] = user.allowed_email_domains
146
+
143
147
  # Add any additional properties from user.model_extra
144
148
  if hasattr(user, "model_extra") and user.model_extra:
145
149
  jwt_payload.update(user.model_extra)
@@ -444,6 +448,58 @@ class Vortex:
444
448
 
445
449
  return await self._vortex_api_request("POST", "/invitations/accept", data=data)
446
450
 
451
+ async def accept_invitation(
452
+ self,
453
+ invitation_id: str,
454
+ user: Union[AcceptUser, Dict[str, Any]],
455
+ ) -> Dict:
456
+ """
457
+ Accept a single invitation (recommended method)
458
+
459
+ This is the recommended method for accepting invitations.
460
+
461
+ Args:
462
+ invitation_id: Single invitation ID to accept
463
+ user: User object with email/phone/name
464
+
465
+ Returns:
466
+ API response
467
+
468
+ Example:
469
+ user = AcceptUser(email="user@example.com", name="John Doe")
470
+ result = await client.accept_invitation("inv-123", user)
471
+
472
+ # Or with a dict:
473
+ result = await client.accept_invitation("inv-123", {"email": "user@example.com"})
474
+ """
475
+ return await self.accept_invitations([invitation_id], user)
476
+
477
+ def accept_invitation_sync(
478
+ self,
479
+ invitation_id: str,
480
+ user: Union[AcceptUser, Dict[str, Any]],
481
+ ) -> Dict:
482
+ """
483
+ Accept a single invitation (synchronous, recommended method)
484
+
485
+ This is the recommended method for accepting invitations.
486
+
487
+ Args:
488
+ invitation_id: Single invitation ID to accept
489
+ user: User object with email/phone/name
490
+
491
+ Returns:
492
+ API response
493
+
494
+ Example:
495
+ user = AcceptUser(email="user@example.com", name="John Doe")
496
+ result = client.accept_invitation_sync("inv-123", user)
497
+
498
+ # Or with a dict:
499
+ result = client.accept_invitation_sync("inv-123", {"email": "user@example.com"})
500
+ """
501
+ return self.accept_invitations_sync([invitation_id], user)
502
+
447
503
  def accept_invitations_sync(
448
504
  self,
449
505
  invitation_ids: List[str],