nylas/nylas-python

No way to specify Nylas-API-Version (2.1 required for event.ics_uid)

bengotow opened this issue · 2 comments

Right now, I'm using this hack to create a nylas.APIClient that sends the header Nylas-API-Version: 2.1:

def nylas_with_v21(token):
    client = nylas.APIClient(None, None, token.value)
    client.session.headers["Nylas-API-Version"] = "2.1"
    return client

This isn't ideal and the version should probably a) be a constructor parameter and b) default to the latest version if none is specified. (Currently if you do not specify a version header explicitly, it assumes the oldest version (?) and I do not receive event.ics_uid.)

It might be that a default version is also specified from the Nylas dashboard, but it'd still be nice to support setting it explicitly in case a user's application needs to use the new version in only a few places for some reason.

Thanks for bringing this to our attention @bengotow, we will investigate this issue!

You may now specify a version number for a new APIClient instance. To do so, just initialize the object as so:

nylas = APIClient(
    client_id=CLIENT_ID,
    client_secret=CLIENT_SECRET,
    access_token=ACCESS_TOKEN,
    api_version='2.1'
)

Note the api_version line. If not included, it will by default fall back to the latest supported version by the SDK (which at the current time of writing, it's 2.2).