@perspectask/sdk 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -422,6 +422,85 @@ type KpiEntry = {
422
422
  */
423
423
  encrypted?: true;
424
424
  };
425
+ type Timer = {
426
+ /**
427
+ * Id of this timer. Pass it to update it.
428
+ */
429
+ id: string;
430
+ /**
431
+ * The task (short id). Its title comes from `GET /tasks/{id}`.
432
+ */
433
+ task_id: string;
434
+ /**
435
+ * ISO 8601 UTC instant.
436
+ */
437
+ started_at: string;
438
+ /**
439
+ * ISO 8601 UTC instant. Omitted while it runs.
440
+ */
441
+ ended_at?: string;
442
+ /**
443
+ * Seconds between start and end. Omitted while it runs.
444
+ */
445
+ duration?: number;
446
+ /**
447
+ * Only present on the running timer.
448
+ */
449
+ running?: true;
450
+ /**
451
+ * Only on a stop: the timer ran under 5 seconds, so it was deleted instead of kept.
452
+ */
453
+ discarded?: true;
454
+ };
455
+ type TimerStatus = {
456
+ /**
457
+ * Seconds of finished timers since the start of the day (`day_start`, default midnight UTC).
458
+ */
459
+ worked_today: number;
460
+ running?: Timer & unknown;
461
+ };
462
+ type StartTimerResponse = {
463
+ timer: Timer & unknown;
464
+ stopped?: Timer & unknown;
465
+ /**
466
+ * Only present when this task’s timer was already running; nothing changed.
467
+ */
468
+ already_running?: true;
469
+ };
470
+ type HistoryEntry = {
471
+ /**
472
+ * The task (short id).
473
+ */
474
+ task_id: string;
475
+ /**
476
+ * What changed: `created`, `status`, `priority`, `scheduled`, `parent_added`, `parent_removed`, `title`, `description`, `encryption`.
477
+ */
478
+ action: string;
479
+ /**
480
+ * When it changed (ISO 8601 UTC).
481
+ */
482
+ at: string;
483
+ /**
484
+ * The value before. `status`: the label (e.g. `IN_PROGRESS`); `priority`: the number; `scheduled`: the deadline column id (e.g. `w-48-2026`); `title`/`description`: the text. Omitted when there was none.
485
+ */
486
+ old?: string;
487
+ /**
488
+ * The value after, same forms as `old`. For `parent_added`/`parent_removed` it is the parent task (short id). Omitted when cleared.
489
+ */
490
+ new?: string;
491
+ /**
492
+ * The note given for the change (e.g. why a deadline moved).
493
+ */
494
+ reason?: string;
495
+ /**
496
+ * Who made it when it was not the owner in the web app: `apikey:<key prefix>` or `oauth:<app name>`. Omitted for the owner.
497
+ */
498
+ actor?: string;
499
+ /**
500
+ * Only on a `title`/`description` edit saved end-to-end encrypted: its text is omitted.
501
+ */
502
+ encrypted?: true;
503
+ };
425
504
  type ListTasksData = {
426
505
  body?: never;
427
506
  path?: never;
@@ -815,6 +894,201 @@ type UpdateTaskKpiResponses = {
815
894
  200: KpiEntry;
816
895
  };
817
896
  type UpdateTaskKpiResponse = UpdateTaskKpiResponses[keyof UpdateTaskKpiResponses];
897
+ type GetTimerStatusData = {
898
+ body?: never;
899
+ path?: never;
900
+ query?: {
901
+ /**
902
+ * Start of the user's day, so `worked_today` follows their time zone, e.g. `2026-11-23T00:00:00+02:00`. Defaults to midnight UTC.
903
+ */
904
+ day_start?: string;
905
+ };
906
+ url: '/timers/status';
907
+ };
908
+ type GetTimerStatusResponses = {
909
+ /**
910
+ * Timer status
911
+ */
912
+ 200: TimerStatus;
913
+ };
914
+ type GetTimerStatusResponse = GetTimerStatusResponses[keyof GetTimerStatusResponses];
915
+ type ListTimersData = {
916
+ body?: never;
917
+ path?: never;
918
+ query?: {
919
+ /**
920
+ * Only this task’s timers (full UUID or short id).
921
+ */
922
+ task_id?: string;
923
+ /**
924
+ * Only timers started at or after this instant.
925
+ */
926
+ since?: string;
927
+ /**
928
+ * Most entries to return, newest first. Defaults to 200, at most 1000.
929
+ */
930
+ limit?: number;
931
+ };
932
+ url: '/timers';
933
+ };
934
+ type ListTimersErrors = {
935
+ /**
936
+ * Task not found (`task_id`)
937
+ */
938
+ 404: unknown;
939
+ };
940
+ type ListTimersResponses = {
941
+ /**
942
+ * Timers
943
+ */
944
+ 200: Array<Timer>;
945
+ };
946
+ type ListTimersResponse = ListTimersResponses[keyof ListTimersResponses];
947
+ type StartTaskTimerData = {
948
+ body?: never;
949
+ path: {
950
+ id: string;
951
+ };
952
+ query?: never;
953
+ url: '/tasks/{id}/timers';
954
+ };
955
+ type StartTaskTimerErrors = {
956
+ /**
957
+ * The task is completed or cancelled
958
+ */
959
+ 400: unknown;
960
+ /**
961
+ * Task is encrypted
962
+ */
963
+ 403: unknown;
964
+ /**
965
+ * Task not found
966
+ */
967
+ 404: unknown;
968
+ };
969
+ type StartTaskTimerResponses = {
970
+ /**
971
+ * Already running
972
+ */
973
+ 200: StartTimerResponse;
974
+ /**
975
+ * Started
976
+ */
977
+ 201: StartTimerResponse;
978
+ };
979
+ type StartTaskTimerResponse = StartTaskTimerResponses[keyof StartTaskTimerResponses];
980
+ type StopTimerData = {
981
+ body?: never;
982
+ path?: never;
983
+ query?: never;
984
+ url: '/timers/stop';
985
+ };
986
+ type StopTimerErrors = {
987
+ /**
988
+ * No timer is running
989
+ */
990
+ 404: unknown;
991
+ };
992
+ type StopTimerResponses = {
993
+ /**
994
+ * Stopped
995
+ */
996
+ 200: Timer;
997
+ };
998
+ type StopTimerResponse = StopTimerResponses[keyof StopTimerResponses];
999
+ type UpdateTimerData = {
1000
+ body: {
1001
+ /**
1002
+ * New start, ISO 8601 with `Z` or an offset.
1003
+ */
1004
+ started_at?: string;
1005
+ /**
1006
+ * New end, ISO 8601 with `Z` or an offset.
1007
+ */
1008
+ ended_at?: string;
1009
+ };
1010
+ path: {
1011
+ /**
1012
+ * The timer id (`id` from the timer list).
1013
+ */
1014
+ timerId: string;
1015
+ };
1016
+ query?: never;
1017
+ url: '/timers/{timerId}';
1018
+ };
1019
+ type UpdateTimerErrors = {
1020
+ /**
1021
+ * Invalid change
1022
+ */
1023
+ 400: unknown;
1024
+ /**
1025
+ * The timer's task is encrypted
1026
+ */
1027
+ 403: unknown;
1028
+ /**
1029
+ * Timer or its task not found
1030
+ */
1031
+ 404: unknown;
1032
+ };
1033
+ type UpdateTimerResponses = {
1034
+ /**
1035
+ * Updated
1036
+ */
1037
+ 200: Timer;
1038
+ };
1039
+ type UpdateTimerResponse = UpdateTimerResponses[keyof UpdateTimerResponses];
1040
+ type ListTasksHistoryData = {
1041
+ body?: never;
1042
+ path?: never;
1043
+ query?: {
1044
+ /**
1045
+ * Only changes at or after this instant.
1046
+ */
1047
+ since?: string;
1048
+ /**
1049
+ * Most entries to return, newest first. Defaults to 200, at most 1000.
1050
+ */
1051
+ limit?: number;
1052
+ };
1053
+ url: '/tasks/history';
1054
+ };
1055
+ type ListTasksHistoryResponses = {
1056
+ /**
1057
+ * History
1058
+ */
1059
+ 200: Array<HistoryEntry>;
1060
+ };
1061
+ type ListTasksHistoryResponse = ListTasksHistoryResponses[keyof ListTasksHistoryResponses];
1062
+ type ListTaskHistoryData = {
1063
+ body?: never;
1064
+ path: {
1065
+ id: string;
1066
+ };
1067
+ query?: {
1068
+ /**
1069
+ * Most entries to return, newest first. Defaults to 200, at most 1000.
1070
+ */
1071
+ limit?: number;
1072
+ };
1073
+ url: '/tasks/{id}/history';
1074
+ };
1075
+ type ListTaskHistoryErrors = {
1076
+ /**
1077
+ * Task is encrypted
1078
+ */
1079
+ 403: unknown;
1080
+ /**
1081
+ * Task not found
1082
+ */
1083
+ 404: unknown;
1084
+ };
1085
+ type ListTaskHistoryResponses = {
1086
+ /**
1087
+ * History
1088
+ */
1089
+ 200: Array<HistoryEntry>;
1090
+ };
1091
+ type ListTaskHistoryResponse = ListTaskHistoryResponses[keyof ListTaskHistoryResponses];
818
1092
 
819
1093
  type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
820
1094
  /**
@@ -846,6 +1120,18 @@ declare class Tasks {
846
1120
  * Update a task
847
1121
  */
848
1122
  static updateTask<ThrowOnError extends boolean = false>(options: Options<UpdateTaskData, ThrowOnError>): RequestResult<UpdateTaskResponses, UpdateTaskErrors, ThrowOnError, "fields">;
1123
+ /**
1124
+ * List the history of all tasks
1125
+ *
1126
+ * Every change to your tasks, newest first: status, priority, deadline, parents, title and description edits. Recorded automatically on every change; nobody can edit it. Changes made through the API or a connected app carry an `actor`. Encrypted and deleted tasks are left out.
1127
+ */
1128
+ static listTasksHistory<ThrowOnError extends boolean = false>(options?: Options<ListTasksHistoryData, ThrowOnError>): RequestResult<ListTasksHistoryResponses, unknown, ThrowOnError, "fields">;
1129
+ /**
1130
+ * List the history of a task
1131
+ *
1132
+ * Every change to one task, newest first. Recorded automatically on every change; nobody can edit it. Changes made through the API or a connected app carry an `actor`.
1133
+ */
1134
+ static listTaskHistory<ThrowOnError extends boolean = false>(options: Options<ListTaskHistoryData, ThrowOnError>): RequestResult<ListTaskHistoryResponses, ListTaskHistoryErrors, ThrowOnError, "fields">;
849
1135
  }
850
1136
  declare class PullRequests {
851
1137
  /**
@@ -897,6 +1183,38 @@ declare class Kpis {
897
1183
  */
898
1184
  static updateTaskKpi<ThrowOnError extends boolean = false>(options: Options<UpdateTaskKpiData, ThrowOnError>): RequestResult<UpdateTaskKpiResponses, UpdateTaskKpiErrors, ThrowOnError, "fields">;
899
1185
  }
1186
+ declare class Timers {
1187
+ /**
1188
+ * Get the running timer and time worked today
1189
+ *
1190
+ * The running timer, if any, and the seconds of finished timers today. Pass `day_start` with the user's local midnight so today follows their time zone.
1191
+ */
1192
+ static getTimerStatus<ThrowOnError extends boolean = false>(options?: Options<GetTimerStatusData, ThrowOnError>): RequestResult<GetTimerStatusResponses, unknown, ThrowOnError, "fields">;
1193
+ /**
1194
+ * List timers
1195
+ *
1196
+ * Your work sessions, newest first: which task, when it started and ended, and its duration in seconds. Filter by task with `task_id`. Timers of encrypted tasks are included (they hold no task content).
1197
+ */
1198
+ static listTimers<ThrowOnError extends boolean = false>(options?: Options<ListTimersData, ThrowOnError>): RequestResult<ListTimersResponses, ListTimersErrors, ThrowOnError, "fields">;
1199
+ /**
1200
+ * Start a timer on a task
1201
+ *
1202
+ * Start tracking time on a task. Only one timer runs at a time, so a timer running on another task is stopped first (returned as `stopped`). Starting the task that already runs changes nothing (200, `already_running`). Refused for a completed or cancelled task (400) and an encrypted one (403).
1203
+ */
1204
+ static startTaskTimer<ThrowOnError extends boolean = false>(options: Options<StartTaskTimerData, ThrowOnError>): RequestResult<StartTaskTimerResponses, StartTaskTimerErrors, ThrowOnError, "fields">;
1205
+ /**
1206
+ * Stop the running timer
1207
+ *
1208
+ * Stop whatever timer is running. A timer stopped under 5 seconds is deleted instead of kept (`discarded: true`).
1209
+ */
1210
+ static stopTimer<ThrowOnError extends boolean = false>(options?: Options<StopTimerData, ThrowOnError>): RequestResult<StopTimerResponses, StopTimerErrors, ThrowOnError, "fields">;
1211
+ /**
1212
+ * Update a timer
1213
+ *
1214
+ * Change when a finished timer started and/or ended, e.g. to fix a forgotten stop. Refused for a running timer, a date in the future, a start after the end, or an overlap with another timer (400). Deleting a timer is only possible in the web app.
1215
+ */
1216
+ static updateTimer<ThrowOnError extends boolean = false>(options: Options<UpdateTimerData, ThrowOnError>): RequestResult<UpdateTimerResponses, UpdateTimerErrors, ThrowOnError, "fields">;
1217
+ }
900
1218
 
901
1219
  declare const zTask: z.ZodMiniObject<{
902
1220
  id: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -965,6 +1283,58 @@ declare const zKpiEntry: z.ZodMiniObject<{
965
1283
  value: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
966
1284
  encrypted: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
967
1285
  }, z.core.$strip>;
1286
+ declare const zTimer: z.ZodMiniObject<{
1287
+ id: z.ZodMiniUUID;
1288
+ task_id: z.ZodMiniString<string>;
1289
+ started_at: z.ZodMiniString<string>;
1290
+ ended_at: z.ZodMiniOptional<z.ZodMiniString<string>>;
1291
+ duration: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
1292
+ running: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1293
+ discarded: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1294
+ }, z.core.$strip>;
1295
+ declare const zTimerStatus: z.ZodMiniObject<{
1296
+ worked_today: z.ZodMiniNumberFormat;
1297
+ running: z.ZodMiniOptional<z.ZodMiniIntersection<z.ZodMiniObject<{
1298
+ id: z.ZodMiniUUID;
1299
+ task_id: z.ZodMiniString<string>;
1300
+ started_at: z.ZodMiniString<string>;
1301
+ ended_at: z.ZodMiniOptional<z.ZodMiniString<string>>;
1302
+ duration: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
1303
+ running: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1304
+ discarded: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1305
+ }, z.core.$strip>, z.ZodMiniUnknown>>;
1306
+ }, z.core.$strip>;
1307
+ declare const zStartTimerResponse: z.ZodMiniObject<{
1308
+ timer: z.ZodMiniIntersection<z.ZodMiniObject<{
1309
+ id: z.ZodMiniUUID;
1310
+ task_id: z.ZodMiniString<string>;
1311
+ started_at: z.ZodMiniString<string>;
1312
+ ended_at: z.ZodMiniOptional<z.ZodMiniString<string>>;
1313
+ duration: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
1314
+ running: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1315
+ discarded: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1316
+ }, z.core.$strip>, z.ZodMiniUnknown>;
1317
+ stopped: z.ZodMiniOptional<z.ZodMiniIntersection<z.ZodMiniObject<{
1318
+ id: z.ZodMiniUUID;
1319
+ task_id: z.ZodMiniString<string>;
1320
+ started_at: z.ZodMiniString<string>;
1321
+ ended_at: z.ZodMiniOptional<z.ZodMiniString<string>>;
1322
+ duration: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
1323
+ running: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1324
+ discarded: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1325
+ }, z.core.$strip>, z.ZodMiniUnknown>>;
1326
+ already_running: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1327
+ }, z.core.$strip>;
1328
+ declare const zHistoryEntry: z.ZodMiniObject<{
1329
+ task_id: z.ZodMiniString<string>;
1330
+ action: z.ZodMiniString<string>;
1331
+ at: z.ZodMiniString<string>;
1332
+ old: z.ZodMiniOptional<z.ZodMiniString<string>>;
1333
+ new: z.ZodMiniOptional<z.ZodMiniString<string>>;
1334
+ reason: z.ZodMiniOptional<z.ZodMiniString<string>>;
1335
+ actor: z.ZodMiniOptional<z.ZodMiniString<string>>;
1336
+ encrypted: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1337
+ }, z.core.$strip>;
968
1338
  declare const zListTasksQuery: z.ZodMiniObject<{
969
1339
  includeEncrypted: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
970
1340
  tree: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
@@ -1291,12 +1661,142 @@ declare const zUpdateTaskKpiResponse: z.ZodMiniObject<{
1291
1661
  value: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
1292
1662
  encrypted: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1293
1663
  }, z.core.$strip>;
1664
+ declare const zGetTimerStatusQuery: z.ZodMiniObject<{
1665
+ day_start: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
1666
+ }, z.core.$strip>;
1667
+ /**
1668
+ * Timer status
1669
+ */
1670
+ declare const zGetTimerStatusResponse: z.ZodMiniObject<{
1671
+ worked_today: z.ZodMiniNumberFormat;
1672
+ running: z.ZodMiniOptional<z.ZodMiniIntersection<z.ZodMiniObject<{
1673
+ id: z.ZodMiniUUID;
1674
+ task_id: z.ZodMiniString<string>;
1675
+ started_at: z.ZodMiniString<string>;
1676
+ ended_at: z.ZodMiniOptional<z.ZodMiniString<string>>;
1677
+ duration: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
1678
+ running: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1679
+ discarded: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1680
+ }, z.core.$strip>, z.ZodMiniUnknown>>;
1681
+ }, z.core.$strip>;
1682
+ declare const zListTimersQuery: z.ZodMiniObject<{
1683
+ task_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
1684
+ since: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
1685
+ limit: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
1686
+ }, z.core.$strip>;
1687
+ /**
1688
+ * Timers
1689
+ */
1690
+ declare const zListTimersResponse: z.ZodMiniArray<z.ZodMiniObject<{
1691
+ id: z.ZodMiniUUID;
1692
+ task_id: z.ZodMiniString<string>;
1693
+ started_at: z.ZodMiniString<string>;
1694
+ ended_at: z.ZodMiniOptional<z.ZodMiniString<string>>;
1695
+ duration: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
1696
+ running: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1697
+ discarded: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1698
+ }, z.core.$strip>>;
1699
+ declare const zStartTaskTimerPath: z.ZodMiniObject<{
1700
+ id: z.ZodMiniString<string>;
1701
+ }, z.core.$strip>;
1702
+ /**
1703
+ * Already running
1704
+ */
1705
+ declare const zStartTaskTimerResponse: z.ZodMiniObject<{
1706
+ timer: z.ZodMiniIntersection<z.ZodMiniObject<{
1707
+ id: z.ZodMiniUUID;
1708
+ task_id: z.ZodMiniString<string>;
1709
+ started_at: z.ZodMiniString<string>;
1710
+ ended_at: z.ZodMiniOptional<z.ZodMiniString<string>>;
1711
+ duration: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
1712
+ running: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1713
+ discarded: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1714
+ }, z.core.$strip>, z.ZodMiniUnknown>;
1715
+ stopped: z.ZodMiniOptional<z.ZodMiniIntersection<z.ZodMiniObject<{
1716
+ id: z.ZodMiniUUID;
1717
+ task_id: z.ZodMiniString<string>;
1718
+ started_at: z.ZodMiniString<string>;
1719
+ ended_at: z.ZodMiniOptional<z.ZodMiniString<string>>;
1720
+ duration: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
1721
+ running: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1722
+ discarded: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1723
+ }, z.core.$strip>, z.ZodMiniUnknown>>;
1724
+ already_running: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1725
+ }, z.core.$strip>;
1726
+ /**
1727
+ * Stopped
1728
+ */
1729
+ declare const zStopTimerResponse: z.ZodMiniObject<{
1730
+ id: z.ZodMiniUUID;
1731
+ task_id: z.ZodMiniString<string>;
1732
+ started_at: z.ZodMiniString<string>;
1733
+ ended_at: z.ZodMiniOptional<z.ZodMiniString<string>>;
1734
+ duration: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
1735
+ running: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1736
+ discarded: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1737
+ }, z.core.$strip>;
1738
+ declare const zUpdateTimerBody: z.ZodMiniObject<{
1739
+ started_at: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
1740
+ ended_at: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
1741
+ }, z.core.$strip>;
1742
+ declare const zUpdateTimerPath: z.ZodMiniObject<{
1743
+ timerId: z.ZodMiniUUID;
1744
+ }, z.core.$strip>;
1745
+ /**
1746
+ * Updated
1747
+ */
1748
+ declare const zUpdateTimerResponse: z.ZodMiniObject<{
1749
+ id: z.ZodMiniUUID;
1750
+ task_id: z.ZodMiniString<string>;
1751
+ started_at: z.ZodMiniString<string>;
1752
+ ended_at: z.ZodMiniOptional<z.ZodMiniString<string>>;
1753
+ duration: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
1754
+ running: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1755
+ discarded: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1756
+ }, z.core.$strip>;
1757
+ declare const zListTasksHistoryQuery: z.ZodMiniObject<{
1758
+ since: z.ZodMiniOptional<z.iso.ZodMiniISODateTime>;
1759
+ limit: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
1760
+ }, z.core.$strip>;
1761
+ /**
1762
+ * History
1763
+ */
1764
+ declare const zListTasksHistoryResponse: z.ZodMiniArray<z.ZodMiniObject<{
1765
+ task_id: z.ZodMiniString<string>;
1766
+ action: z.ZodMiniString<string>;
1767
+ at: z.ZodMiniString<string>;
1768
+ old: z.ZodMiniOptional<z.ZodMiniString<string>>;
1769
+ new: z.ZodMiniOptional<z.ZodMiniString<string>>;
1770
+ reason: z.ZodMiniOptional<z.ZodMiniString<string>>;
1771
+ actor: z.ZodMiniOptional<z.ZodMiniString<string>>;
1772
+ encrypted: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1773
+ }, z.core.$strip>>;
1774
+ declare const zListTaskHistoryPath: z.ZodMiniObject<{
1775
+ id: z.ZodMiniString<string>;
1776
+ }, z.core.$strip>;
1777
+ declare const zListTaskHistoryQuery: z.ZodMiniObject<{
1778
+ limit: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
1779
+ }, z.core.$strip>;
1780
+ /**
1781
+ * History
1782
+ */
1783
+ declare const zListTaskHistoryResponse: z.ZodMiniArray<z.ZodMiniObject<{
1784
+ task_id: z.ZodMiniString<string>;
1785
+ action: z.ZodMiniString<string>;
1786
+ at: z.ZodMiniString<string>;
1787
+ old: z.ZodMiniOptional<z.ZodMiniString<string>>;
1788
+ new: z.ZodMiniOptional<z.ZodMiniString<string>>;
1789
+ reason: z.ZodMiniOptional<z.ZodMiniString<string>>;
1790
+ actor: z.ZodMiniOptional<z.ZodMiniString<string>>;
1791
+ encrypted: z.ZodMiniOptional<z.ZodMiniLiteral<true>>;
1792
+ }, z.core.$strip>>;
1294
1793
 
1295
1794
  interface PerspecTaskOptions {
1296
1795
  /**
1297
1796
  * Your PerspecTask API key (begins with `pt_live_`). Create one in the web
1298
1797
  * app under **Account → API Keys**. Carries `tasks:read` / `tasks:write`
1299
- * scopes, and `kpis:read` / `kpis:write` for KPIs.
1798
+ * scopes, `kpis:read` / `kpis:write` for KPIs, `timers:read` /
1799
+ * `timers:write` for time tracking and `history:read` for task history.
1300
1800
  *
1301
1801
  * Or a function returning a token, called before every request: that's how
1302
1802
  * a `pt login` OAuth token is refreshed when it expires (see
@@ -1337,6 +1837,8 @@ declare class PerspecTask {
1337
1837
  * is scoped to. Encrypted tasks are returned with `encrypted: true` and no title/description keys.
1338
1838
  */
1339
1839
  readonly tasks: ReturnType<typeof createTasksNamespace>;
1840
+ /** Time tracking: the running timer, the list of work sessions, start, stop and edit. */
1841
+ readonly timers: ReturnType<typeof createTimersNamespace>;
1340
1842
  constructor(options: PerspecTaskOptions);
1341
1843
  }
1342
1844
  declare function createTasksNamespace(client: Client): {
@@ -1424,6 +1926,34 @@ declare function createTasksNamespace(client: Client): {
1424
1926
  response?: Response;
1425
1927
  }>;
1426
1928
  };
1929
+ /**
1930
+ * The read-only log of every change to your tasks (status, priority,
1931
+ * deadline, parents, title, description). Needs the `history:read` scope.
1932
+ */
1933
+ history: {
1934
+ /** Every change across your plaintext tasks, newest first (`{ since, limit }`). Wraps `Tasks.listTasksHistory`. */
1935
+ list: (query?: ListTasksHistoryData["query"]) => Promise<({
1936
+ data: undefined;
1937
+ error: unknown;
1938
+ } | {
1939
+ data: HistoryEntry[];
1940
+ error: undefined;
1941
+ }) & {
1942
+ request?: Request;
1943
+ response?: Response;
1944
+ }>;
1945
+ /** Every change to one task, newest first (`{ limit }`). Wraps `Tasks.listTaskHistory`. */
1946
+ get: (id: string, query?: ListTaskHistoryData["query"]) => Promise<({
1947
+ data: HistoryEntry[];
1948
+ error: undefined;
1949
+ } | {
1950
+ data: undefined;
1951
+ error: unknown;
1952
+ }) & {
1953
+ request?: Request;
1954
+ response?: Response;
1955
+ }>;
1956
+ };
1427
1957
  /**
1428
1958
  * A task's KPI: `target` entries (the number to reach, optionally by a
1429
1959
  * date) and `actual` entries (readings over time). Needs the `kpis:read` /
@@ -1487,5 +2017,62 @@ declare function createTasksNamespace(client: Client): {
1487
2017
  }>;
1488
2018
  };
1489
2019
  };
2020
+ declare function createTimersNamespace(client: Client): {
2021
+ /** The running timer and the seconds worked today (`{ day_start }` = the user's local midnight). Wraps `Timers.getTimerStatus`. */
2022
+ status: (query?: GetTimerStatusData["query"]) => Promise<({
2023
+ data: undefined;
2024
+ error: unknown;
2025
+ } | {
2026
+ data: TimerStatus;
2027
+ error: undefined;
2028
+ }) & {
2029
+ request?: Request;
2030
+ response?: Response;
2031
+ }>;
2032
+ /** Work sessions, newest first (`{ task_id, since, limit }`). Wraps `Timers.listTimers`. */
2033
+ list: (query?: ListTimersData["query"]) => Promise<({
2034
+ data: Timer[];
2035
+ error: undefined;
2036
+ } | {
2037
+ data: undefined;
2038
+ error: unknown;
2039
+ }) & {
2040
+ request?: Request;
2041
+ response?: Response;
2042
+ }>;
2043
+ /** Start a timer on a task; a timer running elsewhere is stopped first. Wraps `Timers.startTaskTimer`. */
2044
+ start: (taskId: string) => Promise<({
2045
+ data: StartTimerResponse;
2046
+ error: undefined;
2047
+ } | {
2048
+ data: undefined;
2049
+ error: unknown;
2050
+ }) & {
2051
+ request?: Request;
2052
+ response?: Response;
2053
+ }>;
2054
+ /** Stop the running timer. Wraps `Timers.stopTimer`. */
2055
+ stop: () => Promise<({
2056
+ data: Timer;
2057
+ error: undefined;
2058
+ } | {
2059
+ data: undefined;
2060
+ error: unknown;
2061
+ }) & {
2062
+ request?: Request;
2063
+ response?: Response;
2064
+ }>;
2065
+ /** Change a finished timer's `started_at` and/or `ended_at`. Wraps `Timers.updateTimer`. */
2066
+ update: (timerId: string, body: UpdateTimerData["body"]) => Promise<({
2067
+ data: Timer;
2068
+ error: undefined;
2069
+ } | {
2070
+ data: undefined;
2071
+ error: unknown;
2072
+ }) & {
2073
+ request?: Request;
2074
+ response?: Response;
2075
+ }>;
2076
+ };
1490
2077
 
1491
- export { type ClientOptions, type CreateTaskData, type CreateTaskKpiData, type CreateTaskKpiErrors, type CreateTaskKpiResponse, type CreateTaskKpiResponses, type CreateTaskResponse, type CreateTaskResponses, type DeleteTaskKpiData, type DeleteTaskKpiErrors, type DeleteTaskKpiResponse, type DeleteTaskKpiResponses, type GetTaskData, type GetTaskErrors, type GetTaskResponse, type GetTaskResponses, type KpiEntry, Kpis, type LinkTaskPullRequestData, type LinkTaskPullRequestErrors, type LinkTaskPullRequestResponse, type LinkTaskPullRequestResponses, type ListKpiTasksData, type ListKpiTasksResponse, type ListKpiTasksResponses, type ListTaskKpisData, type ListTaskKpisErrors, type ListTaskKpisResponse, type ListTaskKpisResponses, type ListTaskPullRequestsData, type ListTaskPullRequestsErrors, type ListTaskPullRequestsResponse, type ListTaskPullRequestsResponses, type ListTasksData, type ListTasksResponse, type ListTasksResponses, type Options, PerspecTask, type PerspecTaskOptions, type PullRequest, PullRequests, type Task, Tasks, type UnlinkTaskPullRequestData, type UnlinkTaskPullRequestErrors, type UnlinkTaskPullRequestResponse, type UnlinkTaskPullRequestResponses, type UpdateTaskData, type UpdateTaskErrors, type UpdateTaskKpiData, type UpdateTaskKpiErrors, type UpdateTaskKpiResponse, type UpdateTaskKpiResponses, type UpdateTaskResponse, type UpdateTaskResponses, PerspecTask as default, zCreateTaskBody, zCreateTaskKpiBody, zCreateTaskKpiPath, zCreateTaskKpiResponse, zCreateTaskResponse, zDeleteTaskKpiPath, zDeleteTaskKpiResponse, zGetTaskPath, zGetTaskQuery, zGetTaskResponse, zKpiEntry, zLinkTaskPullRequestBody, zLinkTaskPullRequestPath, zLinkTaskPullRequestResponse, zListKpiTasksResponse, zListTaskKpisPath, zListTaskKpisResponse, zListTaskPullRequestsPath, zListTaskPullRequestsResponse, zListTasksQuery, zListTasksResponse, zPullRequest, zTask, zUnlinkTaskPullRequestPath, zUnlinkTaskPullRequestResponse, zUpdateTaskBody, zUpdateTaskKpiBody, zUpdateTaskKpiPath, zUpdateTaskKpiResponse, zUpdateTaskPath, zUpdateTaskResponse };
2078
+ export { type ClientOptions, type CreateTaskData, type CreateTaskKpiData, type CreateTaskKpiErrors, type CreateTaskKpiResponse, type CreateTaskKpiResponses, type CreateTaskResponse, type CreateTaskResponses, type DeleteTaskKpiData, type DeleteTaskKpiErrors, type DeleteTaskKpiResponse, type DeleteTaskKpiResponses, type GetTaskData, type GetTaskErrors, type GetTaskResponse, type GetTaskResponses, type GetTimerStatusData, type GetTimerStatusResponse, type GetTimerStatusResponses, type HistoryEntry, type KpiEntry, Kpis, type LinkTaskPullRequestData, type LinkTaskPullRequestErrors, type LinkTaskPullRequestResponse, type LinkTaskPullRequestResponses, type ListKpiTasksData, type ListKpiTasksResponse, type ListKpiTasksResponses, type ListTaskHistoryData, type ListTaskHistoryErrors, type ListTaskHistoryResponse, type ListTaskHistoryResponses, type ListTaskKpisData, type ListTaskKpisErrors, type ListTaskKpisResponse, type ListTaskKpisResponses, type ListTaskPullRequestsData, type ListTaskPullRequestsErrors, type ListTaskPullRequestsResponse, type ListTaskPullRequestsResponses, type ListTasksData, type ListTasksHistoryData, type ListTasksHistoryResponse, type ListTasksHistoryResponses, type ListTasksResponse, type ListTasksResponses, type ListTimersData, type ListTimersErrors, type ListTimersResponse, type ListTimersResponses, type Options, PerspecTask, type PerspecTaskOptions, type PullRequest, PullRequests, type StartTaskTimerData, type StartTaskTimerErrors, type StartTaskTimerResponse, type StartTaskTimerResponses, type StartTimerResponse, type StopTimerData, type StopTimerErrors, type StopTimerResponse, type StopTimerResponses, type Task, Tasks, type Timer, type TimerStatus, Timers, type UnlinkTaskPullRequestData, type UnlinkTaskPullRequestErrors, type UnlinkTaskPullRequestResponse, type UnlinkTaskPullRequestResponses, type UpdateTaskData, type UpdateTaskErrors, type UpdateTaskKpiData, type UpdateTaskKpiErrors, type UpdateTaskKpiResponse, type UpdateTaskKpiResponses, type UpdateTaskResponse, type UpdateTaskResponses, type UpdateTimerData, type UpdateTimerErrors, type UpdateTimerResponse, type UpdateTimerResponses, PerspecTask as default, zCreateTaskBody, zCreateTaskKpiBody, zCreateTaskKpiPath, zCreateTaskKpiResponse, zCreateTaskResponse, zDeleteTaskKpiPath, zDeleteTaskKpiResponse, zGetTaskPath, zGetTaskQuery, zGetTaskResponse, zGetTimerStatusQuery, zGetTimerStatusResponse, zHistoryEntry, zKpiEntry, zLinkTaskPullRequestBody, zLinkTaskPullRequestPath, zLinkTaskPullRequestResponse, zListKpiTasksResponse, zListTaskHistoryPath, zListTaskHistoryQuery, zListTaskHistoryResponse, zListTaskKpisPath, zListTaskKpisResponse, zListTaskPullRequestsPath, zListTaskPullRequestsResponse, zListTasksHistoryQuery, zListTasksHistoryResponse, zListTasksQuery, zListTasksResponse, zListTimersQuery, zListTimersResponse, zPullRequest, zStartTaskTimerPath, zStartTaskTimerResponse, zStartTimerResponse, zStopTimerResponse, zTask, zTimer, zTimerStatus, zUnlinkTaskPullRequestPath, zUnlinkTaskPullRequestResponse, zUpdateTaskBody, zUpdateTaskKpiBody, zUpdateTaskKpiPath, zUpdateTaskKpiResponse, zUpdateTaskPath, zUpdateTaskResponse, zUpdateTimerBody, zUpdateTimerPath, zUpdateTimerResponse };