11from dataclasses import dataclass , field
2- from typing import Literal , Optional , List
2+ from typing import Optional , List
33
44from dataclasses_json import dataclass_json
5+ from typing_extensions import TypedDict , NotRequired
56
67from nylas .models .redirect_uri import RedirectUri
78
8- Region = Literal [ "us" , "eu" ]
9- """ Literal representing the available Nylas API regions . """
9+ Region = str
10+ """ The Nylas API region (free-form string, e.g. ``us``, ``eu``) . """
1011
11- Environment = Literal [ "production" , "staging" , "development" , "sandbox" ]
12- """ Literal representing the different Nylas API environments . """
12+ Environment = str
13+ """ The Nylas API environment (free-form string, e.g. ``sandbox``) . """
1314
1415
1516@dataclass_json
@@ -46,6 +47,8 @@ class HostedAuthentication:
4647 subtitle: Subtitle for the hosted authentication page.
4748 background_color: Background color of the hosted authentication page.
4849 spacing: CSS spacing attribute in px.
50+ terms_of_service_url: URL pointing to the terms of service.
51+ privacy_policy_url: URL pointing to the privacy policy.
4952 """
5053
5154 background_image_url : Optional [str ] = None
@@ -56,6 +59,23 @@ class HostedAuthentication:
5659 subtitle : Optional [str ] = None
5760 background_color : Optional [str ] = None
5861 spacing : Optional [int ] = None
62+ terms_of_service_url : Optional [str ] = None
63+ privacy_policy_url : Optional [str ] = None
64+
65+
66+ @dataclass_json
67+ @dataclass
68+ class IdpSettings :
69+ """
70+ Class representation of identity provider settings for the application.
71+
72+ Attributes:
73+ origins: Comma-separated list of allowed origins.
74+ issuers: Comma-separated list of allowed issuers.
75+ """
76+
77+ origins : Optional [str ] = None
78+ issuers : Optional [str ] = None
5979
6080
6181@dataclass_json
@@ -70,14 +90,134 @@ class ApplicationDetails:
7090 region: Region identifier.
7191 environment: Environment identifier.
7292 branding: Branding details for the application.
93+ v2_application_id: The associated v2 application ID, if any.
94+ domain: The white-label domain associated with the application, if any.
7395 hosted_authentication: Hosted authentication branding details.
96+ idp_settings: Identity provider settings.
7497 callback_uris: List of redirect URIs.
98+ created_at: Unix timestamp (seconds) when the application was created.
99+ updated_at: Unix timestamp (seconds) when the application was last updated.
100+ blocked: Whether the application is blocked.
75101 """
76102
77103 application_id : str
78104 organization_id : str
79105 region : Region
80106 environment : Environment
81107 branding : Branding
108+ v2_application_id : Optional [str ] = None
109+ domain : Optional [str ] = None
82110 hosted_authentication : Optional [HostedAuthentication ] = None
111+ idp_settings : Optional [IdpSettings ] = None
83112 callback_uris : List [RedirectUri ] = field (default_factory = list )
113+ created_at : Optional [int ] = None
114+ updated_at : Optional [int ] = None
115+ blocked : Optional [bool ] = None
116+
117+
118+ class WritableBranding (TypedDict ):
119+ """
120+ Class representing branding details for a create/update application call.
121+
122+ Attributes:
123+ name: Name of the application.
124+ icon_url: URL pointing to the application icon.
125+ website_url: Application/publisher website URL.
126+ description: Description of the application.
127+ """
128+
129+ name : NotRequired [str ]
130+ icon_url : NotRequired [str ]
131+ website_url : NotRequired [str ]
132+ description : NotRequired [str ]
133+
134+
135+ class WritableHostedAuthentication (TypedDict ):
136+ """
137+ Class representing hosted authentication details for a create/update application call.
138+
139+ Attributes:
140+ background_image_url: URL pointing to the background image.
141+ alignment: Alignment of the background image.
142+ color_primary: Primary color of the hosted authentication page.
143+ color_secondary: Secondary color of the hosted authentication page.
144+ title: Title of the hosted authentication page.
145+ subtitle: Subtitle for the hosted authentication page.
146+ background_color: Background color of the hosted authentication page.
147+ spacing: CSS spacing attribute in px.
148+ terms_of_service_url: URL pointing to the terms of service.
149+ privacy_policy_url: URL pointing to the privacy policy.
150+ """
151+
152+ background_image_url : NotRequired [str ]
153+ alignment : NotRequired [str ]
154+ color_primary : NotRequired [str ]
155+ color_secondary : NotRequired [str ]
156+ title : NotRequired [str ]
157+ subtitle : NotRequired [str ]
158+ background_color : NotRequired [str ]
159+ spacing : NotRequired [int ]
160+ terms_of_service_url : NotRequired [str ]
161+ privacy_policy_url : NotRequired [str ]
162+
163+
164+ class WritableIdpSettings (TypedDict ):
165+ """
166+ Class representing identity provider settings for a create/update application call.
167+
168+ Attributes:
169+ origins: Comma-separated list of allowed origins.
170+ issuers: Comma-separated list of allowed issuers.
171+ """
172+
173+ origins : NotRequired [str ]
174+ issuers : NotRequired [str ]
175+
176+
177+ class WritableAdditionalSettings (TypedDict ):
178+ """
179+ Class representing additional application settings for an update call.
180+
181+ These settings are write-only: they can be set via the update call but are
182+ stripped from every response and are not bound on the application model.
183+
184+ Attributes:
185+ login_url: The login URL.
186+ logout_url: The logout URL.
187+ refresh_token_expiration_absolute: Absolute refresh token expiration.
188+ refresh_token_expiration_idle: Idle refresh token expiration.
189+ rotate_refresh_token: Whether to rotate the refresh token.
190+ allow_query_param_in_redirect_uri: Whether query params are allowed in redirect URIs.
191+ """
192+
193+ login_url : NotRequired [str ]
194+ logout_url : NotRequired [str ]
195+ refresh_token_expiration_absolute : NotRequired [int ]
196+ refresh_token_expiration_idle : NotRequired [int ]
197+ rotate_refresh_token : NotRequired [bool ]
198+ allow_query_param_in_redirect_uri : NotRequired [bool ]
199+
200+
201+ class UpdateApplicationRequest (TypedDict ):
202+ """
203+ Class representing a request to update a Nylas application.
204+
205+ Note:
206+ ``callback_uris`` / ``redirect_uris`` cannot be set via this request; the
207+ server silently ignores them. Manage callback URIs via the dedicated
208+ redirect-uris endpoints. ``additional_settings`` is write-only and is
209+ stripped from the response.
210+
211+ Attributes:
212+ branding: Branding details for the application.
213+ hosted_authentication: Hosted authentication branding details.
214+ idp_settings: Identity provider settings.
215+ domain: The white-label domain associated with the application.
216+ additional_settings: Additional (write-only) application settings.
217+ """
218+
219+ branding : NotRequired [WritableBranding ]
220+ hosted_authentication : NotRequired [WritableHostedAuthentication ]
221+ idp_settings : NotRequired [WritableIdpSettings ]
222+ domain : NotRequired [str ]
223+ additional_settings : NotRequired [WritableAdditionalSettings ]
0 commit comments