Skip to content

Latest commit

 

History

History
172 lines (155 loc) · 3.97 KB

importing_data.md

File metadata and controls

172 lines (155 loc) · 3.97 KB

Importing Data

To import data into Tyme, you can first use the built-in calls to either fetch the data form a webserver or let the user choose a file from the disk.

Then you can use the following classes in a plugin script to create the entire project structure, tasks, time entries, rides and expenses.

Note that every object in Tyme needs to have its own unique ID. Duplicated IDs can lead to unpredictable behavior!

The unique ID is an alphanumeric value. Please add a prefix to avoid possible ID clashes. If you do not provide an ID, Tyme will generate one. So it's safe to call Category.create().

This example checks, if a category exists, creates one on demand, creates a new project and connects it to the category:

const id = "prefix_id1";
let category = Category.fromID(id) ?? Category.create(id);
category.name = "My Category";

let project = Project.create("prefix_id2");
project.name = "My Project";
project.category = category;

List of available classes

class Category {
    id // string
    name // string
    color // numeric value (0x334455)
    isCompleted // bool
    static create(id)
    static fromID(id)
    delete()
}
class Project {
    id // string
    name // string
    isCompleted // bool
    color // numeric value (0x334455)
    defaultHourlyRate // float
    plannedBudget // float
    plannedDuration // int, seconds
    trackingMode // int, 0=slot, 1=cluster
    startDate // date, optional
    dueDate // date, optional
    category // the category the project is contained in
    static create(id)
    static fromID(id)
    delete()
}
class TimedTask {
    id // string
    name // string
    isCompleted // bool
    billable // bool
    hourlyRate // float
    roundingMethod // int, down=0, nearest=1, up=2
    roundingMinutes // int
    plannedBudget // float
    plannedDuration // int, seconds
    startDate // date, optional
    dueDate // date, optional
    project // the project the task is contained in
    static create(id)
    static fromID(id)
    delete()
}
class TimedSubtask {
    id // string
    name // string
    isCompleted // bool
    billable // bool
    hourlyRate // float
    plannedBudget // float
    plannedDuration // int, seconds
    startDate // date, optional
    dueDate // date, optional
    parentTask // the task the sub-task is contained in
    static create(id)
    static fromID(id)
    delete()
}
class TimeEntry {
    id // string
    billingState // unbilled=0, billed=1, paid=2
    note // string
    timeStart // date
    timeEnd // date
    userID // string, optional
    parentTask // the task the entry is contained in
    static create(id)
    static fromID(id)
    delete()
}
class MileageTask {
    id // string
    name // string
    isCompleted // bool
    billable // bool
    kilometerRate // float, kilometers
    plannedBudget // float
    project // the project the task is contained in
    static create(id)
    static fromID(id)
    delete()
}
class MileageEntry {
    id // string
    billingState // unbilled=0, billed=1, paid=2
    traveledDistance // float, kilometers
    note // string
    timeStart // date
    timeEnd // date
    userID // string, optional
    parentTask // the task the entry is contained in
    static create(id)
    static fromID(id)
    delete()
}
class ExpenseGroup {
    id // string
    name // string
    isCompleted // bool
    billable // bool
    plannedBudget // float
    project // the project the group is contained in
    static create(id)
    static fromID(id)
    delete()
}
class Expense {
    id // string
    name // string
    note // string
    isCompleted // bool
    billable // bool
    quantity // float
    price // float
    purchaseDate // date
    userID // string, optional
    group // the group the expense is contained in
    static create(id)
    static fromID(id)
    delete()
}