-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for overriding various fields of outgoing requests #363
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good 👍 But...you code sample is wrong 😑 Should be like this
from nylas import Client
nylas = Client(
api_key="nyk_v0_z2TBrNMB8zcYl0BUOybx0KwZpEiXx1ZEQREpwrfVTFeZZKLdY7gDgfSacyuhhusy",
)
calendars, request_id, next_cursor = nylas.calendars.list("[email protected]", overrides= {
"api_key": "SECONDARY_API_KEY",
"api_uri": "https://random.api.nylas.com",
"timeout": 360,
"headers": {
"X-Header": "123"
}
})
I'm going to add a PR to address the test errors 😎
Added override=None for all tests that require it
Went overboard with override=None
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #363 +/- ##
==========================================
- Coverage 98.91% 98.55% -0.36%
==========================================
Files 45 45
Lines 1654 1734 +80
==========================================
+ Hits 1636 1709 +73
- Misses 18 25 +7 ☔ View full report in Codecov by Sentry. |
Fixing tests is a never-ending job
All tests fixed 🥳 |
# Changelog * Added support for custom headers field for drafts and messages (#360) * Added support for overriding various fields of outgoing requests (#363) * Added support for `provider` field in code exchange response (#360) * Added support for `event_type` filtering field for listing events (#364) * Added clean messages support (#361) * Added additional webhook triggers (#357) * Fixed issue where attachments < 3mb were not being encoded correctly (#362) * Fixed issue deserializing event and code exchange responses (#358, #368, #369)
Description
This PR adds support for adding a new
RequestOverride
object which can be built with fields that can override:for outgoing requests.
Usage
For all methods that call the Nylas API, there is now an additional
overrides: RequestOverrides
field that takes in the built object and will override the specific outgoing call with whatever non-null values are present. This can also be used to add additional headers to outgoing calls. Here's an example:License
I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner.