The Orb C# SDK provides convenient access to the Orb REST API from applications written in C#.
The REST API documentation can be found on docs.withorb.com.
dotnet add reference /path/to/orb-csharp/src/Orb/
See the examples
directory for complete and runnable examples.
using Customers = Orb.Models.Customers;
using Orb = Orb;
using System = System;
// Configured using the ORB_API_KEY, ORB_WEBHOOK_SECRET and ORB_BASE_URL environment variables
Orb::OrbClient client = new Orb::OrbClient();
var param = new Customers::CustomerCreateParams()
{
Email = "[email protected]", Name = "My Customer"
};
var customer = await client.Customers.Create(param);
System::Console.WriteLine(customer);
Configure the client using environment variables:
using Orb = Orb;
// Configured using the ORB_API_KEY, ORB_WEBHOOK_SECRET and ORB_BASE_URL environment variables
Orb::OrbClient client = new Orb::OrbClient();
Or manually:
using Orb = Orb;
Orb::OrbClient client = new Orb::OrbClient()
{
APIKey = "My API Key"
};
Alternatively, you can use a combination of the two approaches.