Skip to content

Commit 19eef10

Browse files
committed
Regenerate SDK.
1 parent 50fc4dd commit 19eef10

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@ import authress
3434

3535
See the SDK reference guide for a examples of commonly executed blocks with descriptions.
3636

37+
<!-- Use absolute links, to support this link working from PyPI-->
3738
[SDK Documentation](https://github.com/Authress/authress-sdk.py/blob/main/docs/README.md)
3839

3940

4041
## Quick Examples:
4142

43+
<!-- Use absolute links, to support this link working from PyPI-->
44+
4245
* [Authorize using a user token](https://github.com/Authress/authress-sdk.py/blob/main/docs/EXAMPLES.md#authorize-using-a-user-token)
4346
* [Authorize with a service client](https://github.com/Authress/authress-sdk.py/blob/main/docs/EXAMPLES.md#authorize-with-a-service-client)
4447
* [Using the Authress service client as an API key](https://github.com/Authress/authress-sdk.py/blob/main/docs/EXAMPLES.md#using-the-authress-service-client-as-an-api-key)
@@ -47,4 +50,6 @@ See the SDK reference guide for a examples of commonly executed blocks with desc
4750

4851
## Contribution Guide
4952

53+
<!-- Use absolute links, to support this link working from PyPI-->
54+
5055
[Developing for the Python SDK](https://github.com/Authress/authress-sdk.py/blob/main/contributing.md)

authress/models/invite.py

+37-3
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ class Invite(BaseModel):
3131
"""
3232
The user invite used to invite users to your application or to Authress as an admin. # noqa: E501
3333
"""
34-
invite_id: Optional[StrictStr] = Field(default=None, alias="inviteId", description="The unique identifier for the invite. Use this ID to accept the invite. This parameter is ignored during invite creation.")
35-
tenant_id: Optional[constr(strict=True, max_length=128, min_length=0)] = Field(default=None, alias="tenantId")
34+
invite_id: StrictStr = Field(default=..., alias="inviteId", description="The unique identifier for the invite. Use this ID to accept the invite. This parameter is ignored during invite creation.")
35+
tenant_id: Optional[constr(strict=True, max_length=128, min_length=0)] = Field(default=None, alias="tenantId", description="DEPRECATED: Use default_login_tenant_id instead.")
36+
default_login_tenant_id: Optional[constr(strict=True, max_length=128, min_length=0)] = Field(default=None, alias="defaultLoginTenantId", description="Specify the tenant associated with the invite. This tenant Id is used to automatically select the tenant during login with Authress when using the @authress/login SDK. This parameter is ignored when accepting invites directly. To explicitly add a user to a tenant use the linkTenantUser API endpoint.")
3637
statements: conlist(InviteStatement, max_items=100, min_items=0) = Field(default=..., description="A list of statements which match roles to resources. The invited user will all statements apply to them when the invite is accepted.")
38+
conflict_resolution_strategy: Optional[StrictStr] = Field(default='GENERATE_NEW_RECORD', alias="conflictResolutionStrategy", description="An access record will be created when the invite is accepted. If the access record already exists, and the statements in this invite can be merged safely, then the existing record will be updated. A safe merge is one in which the current user will only gain additional access to the statements defined in the invite and other users will not gain additional access in any scenario. When this cannot be done safely, Authress will fallback to this parameter.<br> <ul> <li><code>GENERATE_NEW_RECORD</code> - (Default) Create a new access record which matches the statements in this invite. The record ID will be randomly generated and is unpredictable.</li> <li><code>UNSAFE_FORCE_MERGE</code> - Add the user and statements to the existing record. This will cause the user to gain all the permissions already defined in that record and will cause all the users currently in that record to gain all the additional permissions defined in the invite.</li> <li><code>REPLACE_RECORD_DATA</code> - Replace the existing access record users, roles, and resources with those specified in this invite.</li> <li><code>SKIP_CHANGES</code> - Do not replace, do not create, do not throw. Optimal for ensuring that all records have a known management strategy and successful invite acceptance is more important than the granted permissions.</li> </ul>")
3739
links: Optional[AccountLinks] = None
38-
__properties = ["inviteId", "tenantId", "statements", "links"]
40+
__properties = ["inviteId", "tenantId", "defaultLoginTenantId", "statements", "conflictResolutionStrategy", "links"]
3941

4042
@validator('tenant_id')
4143
def tenant_id_validate_regular_expression(cls, value):
@@ -47,6 +49,26 @@ def tenant_id_validate_regular_expression(cls, value):
4749
raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9-_.:]*$/")
4850
return value
4951

52+
@validator('default_login_tenant_id')
53+
def default_login_tenant_id_validate_regular_expression(cls, value):
54+
"""Validates the regular expression"""
55+
if value is None:
56+
return value
57+
58+
if not re.match(r"^[a-zA-Z0-9-_.:]*$", value):
59+
raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9-_.:]*$/")
60+
return value
61+
62+
@validator('conflict_resolution_strategy')
63+
def conflict_resolution_strategy_validate_enum(cls, value):
64+
"""Validates the enum"""
65+
if value is None:
66+
return value
67+
68+
if value not in ('GENERATE_NEW_RECORD', 'UNSAFE_FORCE_MERGE', 'SKIP_CHANGES', 'REPLACE_RECORD_DATA'):
69+
raise ValueError("must be one of enum values ('GENERATE_NEW_RECORD', 'UNSAFE_FORCE_MERGE', 'SKIP_CHANGES', 'REPLACE_RECORD_DATA')")
70+
return value
71+
5072
class Config:
5173
"""Pydantic configuration"""
5274
allow_population_by_field_name = True
@@ -87,6 +109,16 @@ def to_dict(self):
87109
if self.tenant_id is None and "tenant_id" in self.__fields_set__:
88110
_dict['tenantId'] = None
89111

112+
# set to None if default_login_tenant_id (nullable) is None
113+
# and __fields_set__ contains the field
114+
if self.default_login_tenant_id is None and "default_login_tenant_id" in self.__fields_set__:
115+
_dict['defaultLoginTenantId'] = None
116+
117+
# set to None if conflict_resolution_strategy (nullable) is None
118+
# and __fields_set__ contains the field
119+
if self.conflict_resolution_strategy is None and "conflict_resolution_strategy" in self.__fields_set__:
120+
_dict['conflictResolutionStrategy'] = None
121+
90122
return _dict
91123

92124
@classmethod
@@ -101,7 +133,9 @@ def from_dict(cls, obj: dict) -> Invite:
101133
_obj = Invite.parse_obj({
102134
"invite_id": obj.get("inviteId"),
103135
"tenant_id": obj.get("tenantId"),
136+
"default_login_tenant_id": obj.get("defaultLoginTenantId"),
104137
"statements": [InviteStatement.from_dict(_item) for _item in obj.get("statements")] if obj.get("statements") is not None else None,
138+
"conflict_resolution_strategy": obj.get("conflictResolutionStrategy") if obj.get("conflictResolutionStrategy") is not None else 'GENERATE_NEW_RECORD',
105139
"links": AccountLinks.from_dict(obj.get("links")) if obj.get("links") is not None else None
106140
})
107141
return _obj

authress/models/invite_statement.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class InviteStatement(BaseModel):
3232
"""
3333
roles: conlist(constr(strict=True, max_length=64, min_length=1), max_items=100, min_items=1) = Field(...)
3434
resources: conlist(Resource, max_items=100, min_items=1) = Field(...)
35-
__properties = ["roles", "resources", "users", "groups"]
35+
__properties = ["roles", "resources"]
3636

3737
class Config:
3838
"""Pydantic configuration"""

0 commit comments

Comments
 (0)