Skip to content

Commit 00f3a6d

Browse files
authored
Support callback URIs in application updates (#476)
1 parent 01ecf07 commit 00f3a6d

4 files changed

Lines changed: 30 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Unreleased
44
----------
55
* Aligned Lists create support with the public `POST /v3/lists` schema and added create response/schema coverage
66
* Added Manage Domains service-account auth support with canonical signed request bodies, bearer-auth suppression, encoded domain path segments, and `dmarc`/`arc` verification types
7-
* Added Workspaces resource (`client.workspaces`) with `list`, `find`, `create`, `update` (PATCH), `destroy`, `auto_group`, `manual_assign`, `default`, `policy_id`, and `rule_ids`
7+
* Added Workspaces resource (`client.workspaces`) with `list`, `find`, `create`, `update` (PATCH), `destroy`, `auto_group`, `manual_assign`, `invalid_also`, `default`, `policy_id`, and `rule_ids`
8+
* Corrected Applications `update` to accept `callback_uris` with callback URI IDs for preserving existing callback URIs
89
* Corrected RedirectUris `update` to use PATCH instead of PUT; added `deleted_at` to the RedirectUri model and made `platform` optional on create
910
* Verified and extended Applications: added `update` (PATCH `/v3/applications`) and public response fields (`idp_settings`, hosted-authentication legal URLs, `domain`, `blocked`, timestamps)
1011
* Fix draft and other JSON API requests failing with "only JSON and multipart supported" by sending `Content-Type: application/json` instead of `application/json; charset=utf-8`

nylas/models/application_details.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from dataclasses_json import dataclass_json
55
from typing_extensions import TypedDict, NotRequired
66

7-
from nylas.models.redirect_uri import RedirectUri
7+
from nylas.models.redirect_uri import RedirectUri, WritableRedirectUriSettings
88

99
Region = str
1010
""" The Nylas API region (free-form string, e.g. ``us``, ``eu``). """
@@ -196,26 +196,42 @@ class WritableAdditionalSettings(TypedDict):
196196
allow_query_param_in_redirect_uri: NotRequired[bool]
197197

198198

199+
class UpdateApplicationRedirectUriRequest(TypedDict):
200+
"""
201+
Class representing a callback URI provided for an update application call.
202+
203+
Attributes:
204+
id: Existing callback URI ID. Include this when preserving or updating an existing URI.
205+
url: Redirect URL.
206+
platform: Platform identifier. Optional; defaults to "web" server-side.
207+
settings: Optional settings for the redirect URI.
208+
"""
209+
210+
id: NotRequired[str]
211+
url: str
212+
platform: NotRequired[str]
213+
settings: NotRequired[WritableRedirectUriSettings]
214+
215+
199216
class UpdateApplicationRequest(TypedDict):
200217
"""
201218
Class representing a request to update a Nylas application.
202219
203220
Note:
204-
``callback_uris`` / ``redirect_uris`` cannot be set via this request; the
205-
server silently ignores them. Manage callback URIs via the dedicated
206-
redirect-uris endpoints. ``additional_settings`` is write-only and is
207-
stripped from the response.
221+
``additional_settings`` is write-only and is stripped from the response.
208222
209223
Attributes:
210224
branding: Branding details for the application.
211225
hosted_authentication: Hosted authentication branding details.
212226
idp_settings: Identity provider settings.
227+
callback_uris: List of callback URIs for the application.
213228
domain: The white-label domain associated with the application.
214229
additional_settings: Additional (write-only) application settings.
215230
"""
216231

217232
branding: NotRequired[WritableBranding]
218233
hosted_authentication: NotRequired[WritableHostedAuthentication]
219234
idp_settings: NotRequired[WritableIdpSettings]
235+
callback_uris: NotRequired[List[UpdateApplicationRedirectUriRequest]]
220236
domain: NotRequired[str]
221237
additional_settings: NotRequired[WritableAdditionalSettings]

nylas/resources/applications.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ def update(
5151
Update the application information.
5252
5353
Note:
54-
``callback_uris`` / ``redirect_uris`` cannot be updated here; the server
55-
silently ignores them. Use the redirect URIs endpoints instead.
5654
``additional_settings`` is write-only and is stripped from the response.
5755
5856
Args:

tests/resources/test_applications.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ def test_update(self):
173173
"branding": {"name": "Updated application"},
174174
"hosted_authentication": {"title": "Welcome"},
175175
"idp_settings": {"origins": "https://a.com"},
176+
"callback_uris": [
177+
{
178+
"id": "0556d035-6cb6-4262-a035-6b77e11cf8fc",
179+
"url": "https://example.com/callback",
180+
"platform": "web",
181+
}
182+
],
176183
"domain": "auth.example.com",
177184
"additional_settings": {"rotate_refresh_token": True},
178185
}

0 commit comments

Comments
 (0)