intercom / intercom-dotnet

Intercom API client library for .NET
https://developers.intercom.io/reference
Apache License 2.0
63 stars 53 forks source link

Add Support to access Throttle Headers #112

Open markalanevans opened 6 years ago

markalanevans commented 6 years ago

@travega @khalilovcmd so how do i get access to the headers?

X-RateLimit-Limit: Maximum number of operations allowed in the current window
X-RateLimit-Remaining: Number of operations left in the current window.
X-RateLimit-Reset: Time when rate limit window will be reset as a Unix timestamp.
kmossco commented 6 years ago

@markalanevans at the moment we don't have a way to access these directly, and is one of the reasons why we need to rework that side of the library. This is something we will be addressing soon, but if you have the time and bandwidth I'll be happy to review a PR on this. 👍

jpasichnyk commented 5 years ago

+1 I was thinking these should be bubbled up in a custom exception indicating to the caller that they were "rate limited", as easy to access properties. Or at minimum as some dictionary entries like other errors are returned.

ioggstream commented 4 years ago

In case you expose those headers, I suggest using this spec https://tools.ietf.org/html/draft-polli-ratelimit-headers-03 which is currently supported by various api gateway (kong, envoy proxy, redhat-3scale, ...) and some client libraries.

it just expresses X-RateLimit-Reset in delta-seconds instead of a timestamp: this reduces clock-skew issues and "thundering herd" problems at begin of period