package otoggl

  1. Overview
  2. Docs

Source file toggl_t.ml

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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
(* Auto-generated from "toggl.atd" *)
[@@@ocaml.warning "-27-32-33-35-39"]

(** Helper types *)

(** Response types *)
type datetime = Ptime.t [@@deriving show, eq]

(** Represents a time entry as we send to Toggl when updating one *)
type time_entry_update_request = {
  description: string option;
  wid: int option;
  pid: int option option;
  start: datetime option;
  stop: datetime option option;
  duration: int option;
  tags: string list option;
  duronly: bool option;
  billable: bool option
}
  [@@deriving show, eq]

type wrapped_time_entry_update_request = {
  time_entry: time_entry_update_request
}
  [@@deriving show, eq]

(**
  Represents a time entry as we send to Toggl when starting or creating one
*)
type time_entry_request = {
  description: string;
  wid: int option;
  pid: int option;
  start: datetime option;
  stop: datetime option option;
  duration: int;
  created_with: string;
  tags: string list;
  duronly: bool;
  billable: bool
}
  [@@deriving show, eq]

type wrapped_time_entry = { time_entry: time_entry_request }
  [@@deriving show, eq]

type wid = int [@@deriving show, eq]

(** Represents a project as we send to Toggl when creating one *)
type project_request = {
  wid: wid;
  name: string;
  billable: bool;
  is_private: bool;
  active: bool;
  auto_estimates: bool;
  estimated_hours: bool;
  actual_hours: int;
  template: bool;
  template_id: int option;
  cid: int option;
  color: string option;
  hex_color: string option
}
  [@@deriving show, eq]

type wrapped_project_request = { project: project_request }
  [@@deriving show, eq]

(** Represents a workspace in Toggl *)
type workspace = {
  id: wid;
  name: string;
  default_currency: string;
  at: datetime;
  premium: bool;
  admin: bool;
  default_hourly_rate: float;
  only_admins_may_create_projects: bool;
  only_admins_see_billable_rates: bool;
  only_admins_see_team_dashboard: bool;
  projects_billable_by_default: bool;
  rounding: int;
  rounding_minutes: int;
  ical_enabled: bool;
  api_token: string option;
  profile: int option;
  logo_url: string option
}
  [@@deriving show, eq]

type workspace_list = workspace list [@@deriving show, eq]

type uid = int [@@deriving show, eq]

type tid = int [@@deriving show, eq]

type pid = int [@@deriving show, eq]

(** Represents a time enty as will be returned from the Toggl API *)
type time_entry = {
  id: tid;
  wid: wid;
  uid: uid;
  description: string;
  at: datetime;
  pid: pid option;
  start: datetime;
  stop: datetime option;
  duration: int;
  tags: string list;
  duronly: bool;
  billable: bool
}
  [@@deriving show, eq]

type time_entry_list = time_entry list [@@deriving show, eq]

type tid_list = tid list [@@deriving show, eq]

(** Represents a project in Toggl *)
type project = {
  id: pid;
  wid: wid;
  name: string;
  at: datetime;
  created_at: datetime option;
  billable: bool;
  is_private: bool;
  active: bool;
  auto_estimates: bool;
  estimated_hours: bool;
  actual_hours: int;
  template: bool;
  template_id: int option;
  color: string option;
  hex_color: string option
}
  [@@deriving show, eq]

type project_list = project list [@@deriving show, eq]

type pid_list = pid list [@@deriving show, eq]

type data_time_entry = { data: time_entry } [@@deriving show, eq]

(** Request types *)
type data_project = { data: project }
  [@@deriving show, eq]
OCaml

Innovation. Community. Security.