Skip to main content

Examples

The flow is the same as in the JS and Python SDKs:

  1. Build the typed entity.
  2. Call the matching accessor on the client.
  3. Branch on result.IsSuccess / result.IsFailure.

Create a category

using Dime.Scheduler;
using Dime.Scheduler.Entities;

var client = new DimeSchedulerClient("MY_API_KEY", Environment.Sandbox);

var category = new Category { Name = "VIP", Color = "#22d3ee" };
var result = await client.Categories.CreateAsync(category);

if (result.IsFailure)
throw new InvalidOperationException(result.Error?.ToString());

Create a job and its first task

A task must belong to a job - send the job first, then the task:

const string sourceApp = "BC_CRONUS";
const string sourceType = "SERVICE";
const string jobNo = "SO001";

await client.Jobs.CreateAsync(new Job
{
SourceApp = sourceApp,
SourceType = sourceType,
JobNo = jobNo,
ShortDescription = "Repair HVAC at HQ London",
});

await client.Tasks.CreateAsync(new Dime.Scheduler.Entities.Task
{
SourceApp = sourceApp,
SourceType = sourceType,
JobNo = jobNo,
TaskNo = "SO001_LINE10",
ShortDescription = "Replace compressor",
});

Need many at once? Pass an IEnumerable<T>:

await client.Tasks.CreateAsync(new[] { task1, task2, task3 });

Update the live location of a resource

var location = new ResourceGpsTracking
{
ResourceNo = "GEOFFREY",
Latitude = 52.372746m,
Longitude = 4.893086m,
};

await client.ResourceGpsTrackings.CreateAsync(location);

Read appointments for a date range

Result<ICollection<AppointmentDto>> result = await client.Appointments.GetAsync(
new DateTime(2026, 5, 1, 0, 0, 0, DateTimeKind.Utc),
new DateTime(2026, 5, 31, 23, 59, 59, DateTimeKind.Utc),
new[] { "GEOFFREY", "JOHNNY" });

foreach (var appointment in result.Value ?? Array.Empty<AppointmentDto>())
{
Console.WriteLine($"{appointment.AppointmentNo} {appointment.StartDate}");
}

Send a fly-in message to online users

await client.Messages.PostAsync(new Message
{
Text = "Heads up - planning board reload in 5 minutes.",
Severity = Severity.Warning,
});

Lock an appointment

The narrow AppointmentLocked accessor changes only the lock state - no need to re-send the whole appointment:

await client.AppointmentLocked.CreateAsync(new AppointmentLocked
{
SourceApp = "BC_CRONUS",
SourceType = "SERVICE",
AppointmentGuid = Guid.Parse("2a77f6c6-c502-4ad2-9ee2-6fba0f9361a1"),
Locked = true,
});

More examples live alongside the source in the dime-scheduler/sdk repo.