vortex-python-sdk 0.7.0__tar.gz → 0.9.1__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.1
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.1"
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.1
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)
@@ -192,6 +196,8 @@ class Vortex:
192
196
  "x-api-key": f"{self.api_key}",
193
197
  "Content-Type": "application/json",
194
198
  "User-Agent": f"vortex-python-sdk/{_get_version()}",
199
+ "x-vortex-sdk-name": "vortex-python-sdk",
200
+ "x-vortex-sdk-version": _get_version(),
195
201
  }
196
202
 
197
203
  try:
@@ -249,6 +255,8 @@ class Vortex:
249
255
  "x-api-key": f"{self.api_key}",
250
256
  "Content-Type": "application/json",
251
257
  "User-Agent": f"vortex-python-sdk/{_get_version()}",
258
+ "x-vortex-sdk-name": "vortex-python-sdk",
259
+ "x-vortex-sdk-version": _get_version(),
252
260
  }
253
261
 
254
262
  try:
@@ -444,6 +452,58 @@ class Vortex:
444
452
 
445
453
  return await self._vortex_api_request("POST", "/invitations/accept", data=data)
446
454
 
455
+ async def accept_invitation(
456
+ self,
457
+ invitation_id: str,
458
+ user: Union[AcceptUser, Dict[str, Any]],
459
+ ) -> Dict:
460
+ """
461
+ Accept a single invitation (recommended method)
462
+
463
+ This is the recommended method for accepting invitations.
464
+
465
+ Args:
466
+ invitation_id: Single invitation ID to accept
467
+ user: User object with email/phone/name
468
+
469
+ Returns:
470
+ API response
471
+
472
+ Example:
473
+ user = AcceptUser(email="user@example.com", name="John Doe")
474
+ result = await client.accept_invitation("inv-123", user)
475
+
476
+ # Or with a dict:
477
+ result = await client.accept_invitation("inv-123", {"email": "user@example.com"})
478
+ """
479
+ return await self.accept_invitations([invitation_id], user)
480
+
481
+ def accept_invitation_sync(
482
+ self,
483
+ invitation_id: str,
484
+ user: Union[AcceptUser, Dict[str, Any]],
485
+ ) -> Dict:
486
+ """
487
+ Accept a single invitation (synchronous, recommended method)
488
+
489
+ This is the recommended method for accepting invitations.
490
+
491
+ Args:
492
+ invitation_id: Single invitation ID to accept
493
+ user: User object with email/phone/name
494
+
495
+ Returns:
496
+ API response
497
+
498
+ Example:
499
+ user = AcceptUser(email="user@example.com", name="John Doe")
500
+ result = client.accept_invitation_sync("inv-123", user)
501
+
502
+ # Or with a dict:
503
+ result = client.accept_invitation_sync("inv-123", {"email": "user@example.com"})
504
+ """
505
+ return self.accept_invitations_sync([invitation_id], user)
506
+
447
507
  def accept_invitations_sync(
448
508
  self,
449
509
  invitation_ids: List[str],