This PR allows you to pass in a map of additional, custom headers that can be sent to the Node SDK.
Usage
This can be used one of two ways, for all outgoing calls or on a per-call-basis.
All Calls
For all outgoing calls, you can set headers when initializing the Nylas SDK:
const nylas = new Nylas({
apiKey: "NYLAS_API_KEY",
headers: {
foo: "bar"
},
});
messages = await nylas.messages.list({
"identifier",
}); // Will be sent with 'foo: bar' header
calendars = await nylas.calendars.list({
"identifier",
}); // Will be sent with 'foo: bar' header
Per-call basis
For all calls to the API, we have an override object. This object is now extended to include a headers field.
const nylas = new Nylas({
apiKey: "NYLAS_API_KEY",
});
messages = await nylas.messages.list({
"identifier",
overrides: {
headers: {
foo: "bar"
}
}
}); // Will be sent with 'foo: bar' header
calendars = await nylas.calendars.list({
"identifier",
}); // Will not be sent with 'foo: bar' header
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.
Description
This PR allows you to pass in a map of additional, custom headers that can be sent to the Node SDK.
Usage
This can be used one of two ways, for all outgoing calls or on a per-call-basis.
All Calls
For all outgoing calls, you can set headers when initializing the Nylas SDK:
Per-call basis
For all calls to the API, we have an
override
object. This object is now extended to include aheaders
field.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.