This project is a complete rewrite of ringcentral/ringcentral-csharp-client.
Package is avaiable on NuGet: https://www.nuget.org/packages/RingCentral.Net
You can install it just like you install any other NuGet packages.
If you need PubNub feature, you also need to install one of the following packages:
- If you want to target traditional .NET Framework: https://www.nuget.org/packages/RingCentral.Net.Pubnub
- If you want to target .NET Core, Mono, Xamarin...etc: https://www.nuget.org/packages/RingCentral.Net.PubnubPCL
You can find sample code for all the endpoints.
There is also lots of useful code for your reference in our test cases.
By default this SDK doesn't do token refresh. You are responsible to design and implement your own token management strategy.
However, if you need a quick and dirty solution, you can try rc.AuthoRefresh(interval: 1000 * 60 * 30);
. To disable it, use rc.StopAutoRefresh();
.
By default there is no API calls auto retry. If an API call fails, an exception will be thrown and you are supposed to catch and handle it.
However, if you need a quick and dirty solution, you can try rc.AutoRetry(baseDelay: 10000, maxRetryTimes: 10, retryableHttpStatusCodes: new[]{429});
.
Above it's a sample to deal with API rate limit. To disable it, use rc.StopAutoRetry();
.
Some sample code for binary content downloading may not work.
Because RingCentral is gradually migrating binary content to CDN such as media.ringcentral.com
.
For example, to download the attachment of a fax:
// `message` is the fax message object
var content = await rc.Get<byte[]>(message.attachments[0].uri);
The following does NOT work:
// `message` is the fax message object
var content = await rc.Restapi().Account().Extension().MessageStore(message.id).Content(message.attachments[0].id).Get();
But not all binary content has been migrated to CDN. If the resource to download provides you with a CDN uri, use that CDN uri. If there is no CDN uri provided, contruct the uri as the sample code shows.
By default, the SDK doesn't return headers:
var extInfo = await rc.Restapi().Account("~").Extension("~").Get();
If you need headers:
var httpResponseMessage = await rc.Get(rc.Restapi().Account("~").Extension("~").Path(true));
var headers = httpResponseMessage.Headers;
var responseBodyStr = await httpResponseMessage.Content.ReadAsStringAsync();
var extInfo = JsonConvert.DeserializeObject<GetExtensionInfoResponse>(responseBodyStr);
Update version number in RingCentral.Net/RingCentral.Net.csproj
& RingCentral.Net/RestClient.cs
cd RingCentral.Net
dotnet pack
Update version number in RingCentral.Net.PubnubPCL/RingCentral.Net.PubnubPCL.csproj
cd RingCentral.Net.PubnubPCL
dotnet pack
Update version number in RingCentral.Net.Pubnub\Properties\AssemblyInfo.cs
Rebuild solution
cd RingCentral.Net.Pubnub
nuget pack
Reference: Quickstart: Create and publish a package using Visual Studio (.NET Framework, Windows)
- Write a script to generate swagger spec
- Add batch get to auto generated sample code
- How to handle deprecated endpoints?
- Exception error message for binary data? Will it print a LOT?