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.europe-west1.talon.one",
ApiKey = new Dictionary<string, string> {
{ "Authorization", "e18149e88f42205432281c9d3d0e711111302722577ad60dcebc86c43aabfe70" }
},
ApiKeyPrefix = new Dictionary<string, string> {
{ "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 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 );
}
}
}
}