Examples
These examples show how to create categoriesCategoryA visual indicator (a color) applied to appointments to classify or label them., resourcesResourceAn entity that can carry out work - a person, vehicle, tool, or room - that you schedule on the planning board., tasksTaskA unit of work that belongs to a job. It appears in the open task list until it is scheduled to a resource. and appointmentsAppointmentA task scheduled to a resource for a specific period - the scheduled instance you see on the planning board. with the Rust SDK. The flow is the same as in the .NET, JavaScript and Python SDKs:
- Build an
entities::*struct (or a slice of them) for the entity you want to send. - Call the matching accessor on the client and
.awaitit. - Handle the
Resultwith?or amatch.
Every snippet below runs inside an async context such as this one:
use dimescheduler::{DimeSchedulerClient, Environment};
#[tokio::main]
async fn main() -> dimescheduler::Result<()> {
let client = DimeSchedulerClient::with_environment("MY_API_KEY", Environment::Sandbox);
// ... the snippets go here ...
Ok(())
}
Create a category
A category drives the background color of appointments on the planning boardPlanning boardThe main graphical scheduling surface where dispatchers drag tasks onto resources across a timeline.. Category has three fields and all of them are required, so there is nothing to default:
use dimescheduler::entities::Category;
client
.categories
.create(&Category {
name: "INSTALL".into(),
display_name: "Install".into(),
color: "#22d3ee".into(),
})
.await?;
Update the live location of a resource
After this call, resource GEOFFREY shows up in Amsterdam on the map. Coordinates are f64:
use dimescheduler::entities::ResourceGpsTracking;
client
.resource_gps_trackings
.create(&ResourceGpsTracking {
resource_no: "GEOFFREY".into(),
latitude: 52.372746,
longitude: 4.893086,
..Default::default()
})
.await?;
Create a job and its first task
A task must belong to a jobJobA high-level container, comparable to a project, that bundles related tasks together with common information such as customer, billing, and address., so send them in order:
use dimescheduler::entities::{Job, Task};
let (source_app, source_type, job_no) = ("CRM", "SERVICECASE", "CASE_123");
client
.jobs
.create(&Job {
source_app: source_app.into(),
source_type: source_type.into(),
job_no: job_no.into(),
short_description: "Repair HVAC in Berlin office".into(),
..Default::default()
})
.await?;
client
.tasks
.create(&Task {
source_app: source_app.into(),
source_type: source_type.into(),
job_no: job_no.into(),
task_no: "CASE_123_ACTIVITY001".into(),
short_description: "Repair HVAC".into(),
..Default::default()
})
.await?;
Need to send many at once? Use the _many variant with a slice:
client.tasks.create_many(&[task_1, task_2, task_3]).await?;
Read appointments for a date range
Dates are RFC 3339 strings. The response is a Vec<types::AppointmentDto> whose fields are all Options:
let appointments = client
.appointments
.get("2026-05-01T00:00:00Z", "2026-05-31T23:59:59Z", &["GEOFFREY", "JOHNNY"])
.await?;
for appointment in &appointments {
println!(
"{} {}",
appointment.appointment_no.as_deref().unwrap_or("-"),
appointment.start_date.as_deref().unwrap_or("-"),
);
}
Send a fly-in message to online users
Severity is an enum in dimescheduler::types:
use dimescheduler::{entities::Message, types::Severity};
client
.messages
.send(&Message {
text: Some("Heads up - planning board reload in 5 minutes.".into()),
severity: Some(Severity::Warning),
..Default::default()
})
.await?;
Handle rate limits explicitly
The crate does not retry on its own, so a 429 reaches your code as Error::Api. Back off and try again at the call site. This uses Tokio's time feature:
use dimescheduler::Error;
use std::time::Duration;
let mut attempt = 0u32;
loop {
match client.categories.create(&category).await {
Ok(_) => break,
Err(Error::Api { status: 429, .. }) if attempt < 5 => {
attempt += 1;
tokio::time::sleep(Duration::from_secs(2u64.pow(attempt))).await;
}
Err(e) => return Err(e), // any other failure: bail
}
}
More examples live in the crate's rustdoc and alongside the source in the dime-scheduler/sdk monorepo.