Skip to main content

C#

The C# SDK supports all of the operations of the Integration API and Management API.

using System;
using System.Diagnostics;
using TalonOne.Api;
using TalonOne.Client;
using TalonOne.Model;
namespace Example
{
public class Example
{
public void main()
{
// Configure BasePath & API key authorization: api_key_v1
var integrationConfig = new Configuration {
BasePath = "https://mycompany.talon.one",
ApiKey = new Dictionary<string, string> {
{ "Authorization", "e18149e88f42205432281c9d3d0e711111302722577ad60dcebc86c43aabfe70" }
},
ApiKeyPrefix = new Dictionary<string, string> {
{ "Authorization", "ApiKey-v1" }
}
};
// Or via the "global" Default configuration:
// Configuration.Default.BasePath = "https://mycompany.talon.one";
// Configuration.Default.ApiKey.Add("Authorization", "YOUR_API_KEY");
// Configuration.Default.ApiKeyPrefix.Add("Authorization", "ApiKey-v1");
// ************************************************
// Integration API example to send a session update
// ************************************************
// When using the default approach, the next initiation of `IntegrationApi`
// could be using the empty constructor
var integrationApi = new IntegrationApi(integrationConfig);
var customerSessionId = "my_unique_session_integration_id"; // string | The custom identifier for this session, must be unique within the account.
var customerSessionPayload = new NewCustomerSession {
ProfileId = "DADBOOF",
State = NewCustomerSession.StateEnum.Open, // `Open` would be the default value anyway
Total = (decimal)42.234
};
try
{
// Create/update a customer session using `UpdateCustomerSession` function
IntegrationState result = apiInstance.UpdateCustomerSession(customerSessionId, customerSessionPayload);
Console.WriteLine(result);
}
catch (Exception e)
{
Console.WriteLine("Exception when calling IntegrationApi.UpdateCustomerSession: " + e.Message );
}
}
}
}