summaryrefslogtreecommitdiffstats
path: root/examples/create_task.rs
blob: c79d41791d436ac70ee6454a04f3fb396686b96b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
extern crate task_hookrs;
extern crate chrono;
extern crate serde_json;
extern crate uuid;

use task_hookrs::task::Task;
use task_hookrs::status::TaskStatus;
use task_hookrs::uda::UDA;

use chrono::NaiveDateTime;
use serde_json::to_string;
use uuid::Uuid;

fn main() {
    let uuid = Uuid::nil();
    let date = NaiveDateTime::parse_from_str("2016-12-31 12:13:14", "%Y-%m-%d %H:%M:%S").unwrap();
    let t = Task::new(
        Some(12),
        TaskStatus::Pending,
        uuid,
        date.into(),
        "Test task".to_string(),
        None,
        None,
        None,
        None,
        None,
        None,
        None,
        None,
        None,
        None,
        None,
        None,
        None,
        None,
        None,
        None,
        UDA::default(),
    );
    println!("[{}]", to_string(&t).unwrap());
}