Skip to content

Conversation

@mrashed-dev
Copy link
Contributor

Description

Add a new option to as_json to convert a Nylas object to JSON ignoring API rules for read only params

Usage

To include read only values in the as_json call, just pass in False for enforce_read_only:

from nylas import APIClient
nylas = APIClient(
    CLIENT_ID,
    CLIENT_SECRET,
    ACCESS_TOKEN
)

# Return an event by specifying its id
event = nylas.events.get('{id}')

# Return a JSON representation of the Event, including ready only parameters
event_json = event.as_json(False)

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.

Allows to convert object to JSON ignoring API rules for read only params
@mrashed-dev mrashed-dev requested review from a team, pengfeiye and tasdrake and removed request for a team June 5, 2022 19:55
@mrashed-dev mrashed-dev merged commit 0a7576e into main Jun 6, 2022
@mrashed-dev mrashed-dev deleted the TSDK-305-add-support-for-as-json-python-sdk branch June 6, 2022 21:55
mrashed-dev added a commit that referenced this pull request Jun 28, 2022
In the last release we added enforce_read_only to the as_json function (#222) but only on the top level one. Some models overrided this function but was missing this parameter, so this adds it in.
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.

3 participants