Skip to content

Commit d986ca8

Browse files
add httpInfo to notary and monitor examples
1 parent 939b59f commit d986ca8

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

launcher-csharp/Monitor/Examples/GetMonitoringDataFunc.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ public virtual IEnumerable<object> Invoke(string accessToken, string requestPath
5454

5555
var cursoredResult = dataSetApi.GetStreamWithHttpInfo("2.0", "monitor", options);
5656

57+
cursoredResult.Headers.TryGetValue("X-RateLimit-Remaining", out string remaining);
58+
cursoredResult.Headers.TryGetValue("X-RateLimit-Reset", out string reset);
59+
60+
DateTime resetDate = DateTimeOffset.FromUnixTimeSeconds(long.Parse(reset)).UtcDateTime;
61+
62+
Console.WriteLine("API calls remaining: " + remaining);
63+
Console.WriteLine("Next Reset: " + resetDate);
64+
5765
string endCursor = cursoredResult.Data.EndCursor;
5866

5967
// If the endCursor from the response is the same as the one that you already have,

launcher-csharp/Notary/Examples/SendWithThirdPartyNotary.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,16 @@ public static string SendWithNotary(string signerEmail, string signerName, strin
2323

2424
//ds-snippet-start:Notary4Step4
2525
var envelopesApi = new EnvelopesApi(docuSignClient);
26-
EnvelopeSummary results = envelopesApi.CreateEnvelope(accountId, env);
27-
return results.EnvelopeId;
26+
ApiResponse<EnvelopeSummary> results = envelopesApi.CreateEnvelopeWithHttpInfo(accountId, env);
27+
28+
results.Headers.TryGetValue("X-RateLimit-Remaining", out string remaining);
29+
results.Headers.TryGetValue("X-RateLimit-Reset", out string reset);
30+
31+
DateTime resetDate = DateTimeOffset.FromUnixTimeSeconds(long.Parse(reset)).UtcDateTime;
32+
33+
Console.WriteLine("API calls remaining: " + remaining);
34+
Console.WriteLine("Next Reset: " + resetDate);
35+
return results.Data.EnvelopeId;
2836
//ds-snippet-end:Notary4Step4
2937
}
3038

0 commit comments

Comments
 (0)