https://github.com/sailthru/sailthru-net-client
Sailthru .NET client
https://github.com/sailthru/sailthru-net-client
Last synced: 13 days ago
JSON representation
Sailthru .NET client
- Host: GitHub
- URL: https://github.com/sailthru/sailthru-net-client
- Owner: sailthru
- License: mit
- Created: 2011-01-19T20:57:03.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2022-12-20T01:18:40.000Z (over 2 years ago)
- Last Synced: 2025-05-07T13:56:12.392Z (13 days ago)
- Language: C#
- Homepage: https://getstarted.sailthru.com/developers/api-client/net/
- Size: 4.33 MB
- Stars: 6
- Watchers: 66
- Forks: 19
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE.txt
Awesome Lists containing this project
README
sailthru-net-client
====================For installation instructions, documentation, and examples please visit: [https://getstarted.sailthru.com/developers/api-client/net/](https://getstarted.sailthru.com/developers/api-client/net/)
A simple client library to remotely access the `Sailthru REST API` as per [http://getstarted.sailthru.com/developers/api](http://getstarted.sailthru.com/developers/api)
As of commit b8714e2, UserRequest.OptoutEmail is now an enum rather than a string. Replace `"all"` with "OptoutStatus.All", `"blast"` with "OptoutStatus.Blast", "basic" with "OptoutStatus.Basic", and `"none"` with "OptoutStatus.None". For example, "userRequest.OptoutEmail = "all";" should now be "userRequest.OptoutEmail = OptoutStatus.All;"
#### API Rate Limiting
Here is an example how to check rate limiting and throttle API calls based on that. For more information about Rate Limiting, see [Sailthru Documentation](https://getstarted.sailthru.com/new-for-developers-overview/api/api-technical-details/#Rate_Limiting)
```csharp
SailthruClient sailthruClient = new SailthruClient(apiKey, apiSec);// ... make some api calls ....
Hashtable lastRateLimitInfo = sailthruClient.getLastRateLimitInfo("user", "post");
// getLastRateLimitInfo returns null if given endpoint/method wasn't triggered previously
if (lastRateLimitInfo != null) {
int limit = lastRateLimitInfo['limit'];
int remaining = lastRateLimitInfo['remaining'];
DateTime reset = (DateTime)lastRateLimitInfo['reset'];// throttle api calls based on last rate limit info
if (remaining <= 0) {
TimeSpan time_span_till_reset = reset.Subtract(DateTime.now());
// sleep or perform other business logic before next user api call
Thread.Sleep(time_span_till_reset);
}
}
```