Skip to content
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

[58500] Python SDK support for metadata for events #152

Conversation

mrashed-dev
Copy link
Collaborator

Description

The Nylas Calendar API has a new beta feature of adding a new metadata field to calendar events. This PR makes the feature available via the Nylas Python SDK.

Usage

To filter using either metadata_key or metadata_value you can pass in a string:
events = nylas.events.where(metadata_key='hello').all()
or, you can pass in multiple strings as an array:
events = nylas.events.where(metadata_value=['value1', 'value2']).all()

To filter on metadata_pair you can pass in a dict of key-value pairs to use in the query:
events = nylas.events.where(metadata_pair={'hello': 'world'}).all()

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.

'metadata_key' and 'metadata_value' can already be filtered by passing them in as an array. 'metadata_pair' is now supported by passing in a dict
@shortcut-integration
Copy link

This pull request has been linked to Clubhouse Story #58500: Python SDK support for metadata for events.

Copy link

@philrenaud philrenaud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to run python Black locally to format things (it may just be upset about your import order; unsure)

And ideally you could add some tests to https://github.com/nylas/nylas-python/blob/main/tests/test_events.py here as well

Added extra logic in the mock_events function to be able to mimic filtering using the 3 different types of metadata filters; `metadata_key`, `metadata_value`, and `metadata_pair`
@mrashed-dev
Copy link
Collaborator Author

mrashed-dev commented May 18, 2021

You'll need to run python Black locally to format things (it may just be upset about your import order; unsure)

And ideally you could add some tests to https://github.com/nylas/nylas-python/blob/main/tests/test_events.py here as well

@philrenaud Black was re-ran and tests were added!

@mrashed-dev mrashed-dev merged commit f5742d4 into main May 21, 2021
mrashed-dev added a commit that referenced this pull request Jul 21, 2021
New `nylas` v5.0.0 release bringing in the following additions:
* Add support for the Nylas Neural API (#163)
* Add `metadata` support (#152)
* Add new Room Resource fields  (#156)
* Add `Nylas-API-Version` header support (#157, #151)

as well as the following changes:
* Transitioned from `app_id` and `app_secret` naming to `client_id` and `client_secret` (#159, #86)
* Fix adding a tracking object to an existing `draft` (#153)
* Fix issue when converting offset-aware `datetime` objects to `timestamp` (#154, #143)
* Fix `limit` value in filter not being used when making `.all()` call (#155)
* Fix `from_` field set by attribute on draft ignored (#162, #160)
* Remove `bumpversion` from a required dependency to an extra dependency (#158, #144)
@mrashed-dev mrashed-dev deleted the mostafarashed/ch58500/python-sdk-support-for-metadata-for-events branch August 30, 2023 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants