Corti.Sdk
0.0.834
See the version list below for details.
dotnet add package Corti.Sdk --version 0.0.834
NuGet\Install-Package Corti.Sdk -Version 0.0.834
<PackageReference Include="Corti.Sdk" Version="0.0.834" />
<PackageVersion Include="Corti.Sdk" Version="0.0.834" />
<PackageReference Include="Corti.Sdk" />
paket add Corti.Sdk --version 0.0.834
#r "nuget: Corti.Sdk, 0.0.834"
#:package Corti.Sdk@0.0.834
#addin nuget:?package=Corti.Sdk&version=0.0.834
#tool nuget:?package=Corti.Sdk&version=0.0.834
Corti C# Library
The Corti C# library provides convenient access to the Corti APIs from C#.
Table of Contents
- Documentation
- Requirements
- Installation
- Usage
- Authentication
- Exception Handling
- Pagination
- Advanced
- Contributing
Documentation
- Documentation
- API Reference
- Console — get your credentials here
- Examples
Requirements
This SDK requires:
Installation
dotnet add package Corti.Sdk
Usage
Instantiate and use the client with the following:
using Corti;
var client = new CortiClient("TENANT_NAME", "YOUR_ENVIRONMENT_ID", new CortiClientAuth.ClientCredentials("CLIENT_ID", "CLIENT_SECRET"));
await client.Interactions.CreateAsync(
new InteractionsCreateRequest
{
Encounter = new InteractionsEncounterCreateRequest
{
Identifier = "identifier",
Status = InteractionsEncounterStatusEnum.Planned,
Type = InteractionsEncounterTypeEnum.FirstConsultation,
},
}
);
Authentication
The SDK supports several OAuth 2.0 flows. In all cases the SDK manages tokens in memory — before each request it checks whether the stored access token is still valid, and if not, calls the appropriate token endpoint transparently. No manual token management is needed.
Client Credentials (recommended for server-side apps)
The SDK fetches and refreshes tokens automatically using your client credentials.
var client = new CortiClient(
"YOUR_TENANT_NAME",
"YOUR_ENVIRONMENT_ID",
new CortiClientAuth.ClientCredentials("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET")
);
Bearer token (pre-obtained)
Use when you already have a valid access token. Pass ClientId + RefreshToken to enable automatic renewal when the token expires.
// Static token — no automatic renewal
var client = new CortiClient(new CortiClientAuth.Bearer("YOUR_ACCESS_TOKEN"));
// Token with automatic refresh via stored refresh token
var client = new CortiClient(new CortiClientAuth.Bearer(
AccessToken: "YOUR_ACCESS_TOKEN",
ClientId: "YOUR_CLIENT_ID",
RefreshToken: "YOUR_REFRESH_TOKEN",
ExpiresIn: 300, // seconds until access token expires
RefreshExpiresIn: 1800 // seconds until refresh token expires
));
Bearer token with custom refresh
Use when your application manages token renewal (e.g. via a proxy or an external identity provider). The SDK calls RefreshAccessToken whenever the stored token expires.
var client = new CortiClient(new CortiClientAuth.BearerCustomRefresh(
RefreshAccessToken: async (refreshToken, ct) =>
{
// call your own token endpoint and return the new token
return new CustomRefreshResult { AccessToken = "NEW_TOKEN", ExpiresIn = 300 };
},
AccessToken: "YOUR_ACCESS_TOKEN"
));
Resource Owner Password Credentials (ROPC)
var client = new CortiClient(
"YOUR_TENANT_NAME",
"YOUR_ENVIRONMENT_ID",
new CortiClientAuth.Ropc("YOUR_CLIENT_ID", "USERNAME", "PASSWORD")
);
Authorization Code
var client = new CortiClient(
"YOUR_TENANT_NAME",
"YOUR_ENVIRONMENT_ID",
new CortiClientAuth.AuthorizationCode("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET", "AUTH_CODE", "YOUR_REDIRECT_URI")
);
PKCE
var client = new CortiClient(
"YOUR_TENANT_NAME",
"YOUR_ENVIRONMENT_ID",
new CortiClientAuth.Pkce("YOUR_CLIENT_ID", "AUTH_CODE", "YOUR_REDIRECT_URI", "YOUR_CODE_VERIFIER")
);
Exception Handling
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error will be thrown.
using Corti;
try {
var response = await client.Interactions.CreateAsync(...);
} catch (CortiClientApiException e) {
System.Console.WriteLine(e.Body);
System.Console.WriteLine(e.StatusCode);
}
Pagination
List endpoints are paginated. The SDK provides an async enumerable so that you can simply loop over the items:
using Corti;
var client = new CortiClient("TENANT_NAME", "YOUR_ENVIRONMENT_ID", new CortiClientAuth.ClientCredentials("CLIENT_ID", "CLIENT_SECRET"));
var items = await client.Interactions.ListAsync(new InteractionsListRequest());
await foreach (var item in items)
{
// do something with item
}
Advanced
Retries
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2).
A request is deemed retryable when any of the following HTTP status codes is returned:
Use the MaxRetries request option to configure this behavior.
var response = await client.Interactions.CreateAsync(
...,
new RequestOptions {
MaxRetries: 0 // Override MaxRetries at the request level
}
);
Timeouts
The SDK defaults to a 30 second timeout. Use the Timeout option to configure this behavior.
var response = await client.Interactions.CreateAsync(
...,
new RequestOptions {
Timeout: TimeSpan.FromSeconds(3) // Override timeout to 3s
}
);
Raw Response
Access raw HTTP response data (status code, headers, URL) alongside parsed response data using the .WithRawResponse() method.
using Corti;
// Access raw response data (status code, headers, etc.) alongside the parsed response
var result = await client.Interactions.CreateAsync(...).WithRawResponse();
// Access the parsed data
var data = result.Data;
// Access raw response metadata
var statusCode = result.RawResponse.StatusCode;
var headers = result.RawResponse.Headers;
var url = result.RawResponse.Url;
// Access specific headers (case-insensitive)
if (headers.TryGetValue("X-Request-Id", out var requestId))
{
System.Console.WriteLine($"Request ID: {requestId}");
}
// For the default behavior, simply await without .WithRawResponse()
var data = await client.Interactions.CreateAsync(...);
Additional Headers
If you would like to send additional headers as part of the request, use the AdditionalHeaders request option.
var response = await client.Interactions.CreateAsync(
...,
new RequestOptions {
AdditionalHeaders = new Dictionary<string, string?>
{
{ "X-Custom-Header", "custom-value" }
}
}
);
Additional Query Parameters
If you would like to send additional query parameters as part of the request, use the AdditionalQueryParameters request option.
var response = await client.Interactions.CreateAsync(
...,
new RequestOptions {
AdditionalQueryParameters = new Dictionary<string, string>
{
{ "custom_param", "custom-value" }
}
}
);
Forward Compatible Enums
This SDK uses forward-compatible enums that can handle unknown values gracefully.
using Corti;
// Using a built-in value
var interactionsListRequestSort = InteractionsListRequestSort.Id;
// Using a custom value
var customInteractionsListRequestSort = InteractionsListRequestSort.FromCustom("custom-value");
// Using in a switch statement
switch (interactionsListRequestSort.Value)
{
case InteractionsListRequestSort.Values.Id:
Console.WriteLine("Id");
break;
default:
Console.WriteLine($"Unknown value: {interactionsListRequestSort.Value}");
break;
}
// Explicit casting
string interactionsListRequestSortString = (string)InteractionsListRequestSort.Id;
InteractionsListRequestSort interactionsListRequestSortFromString = (InteractionsListRequestSort)"id";
Contributing
While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!
On the other hand, contributions to the README are always very welcome!
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- Portable.System.DateTimeOnly (>= 8.0.2)
- System.Net.Http (>= 4.3.4)
- System.Text.Json (>= 8.0.5)
- System.Threading.Channels (>= 8.0.0)
-
.NETStandard 2.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- Portable.System.DateTimeOnly (>= 8.0.2)
- System.Net.Http (>= 4.3.4)
- System.Text.Json (>= 8.0.5)
- System.Threading.Channels (>= 8.0.0)
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- System.Threading.Channels (>= 8.0.0)
-
net9.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- System.Threading.Channels (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-rc | 65 | 4/8/2026 |
| 0.0.834 | 92 | 3/25/2026 |
| 0.0.834-alpha.1 | 46 | 3/25/2026 |
| 0.0.833 | 82 | 3/25/2026 |
| 0.0.1 | 98 | 3/13/2026 |