@doist/todoist-api-typescript 7.9.1 → 7.10.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.
Files changed (343) hide show
  1. package/README.md +5 -204
  2. package/index.d.ts +1 -0
  3. package/index.js +1 -0
  4. package/index.mjs +1 -0
  5. package/package.json +12 -92
  6. package/LICENSE +0 -21
  7. package/dist/cjs/authentication.js +0 -204
  8. package/dist/cjs/consts/endpoints.js +0 -141
  9. package/dist/cjs/index.js +0 -20
  10. package/dist/cjs/package.json +0 -1
  11. package/dist/cjs/test-utils/asserts.js +0 -11
  12. package/dist/cjs/test-utils/msw-setup.js +0 -97
  13. package/dist/cjs/test-utils/obsidian-fetch-adapter.js +0 -53
  14. package/dist/cjs/test-utils/test-defaults.js +0 -240
  15. package/dist/cjs/todoist-api.js +0 -2623
  16. package/dist/cjs/transport/fetch-with-retry.js +0 -206
  17. package/dist/cjs/transport/http-client.js +0 -133
  18. package/dist/cjs/transport/http-dispatcher.js +0 -72
  19. package/dist/cjs/types/activity/index.js +0 -18
  20. package/dist/cjs/types/activity/requests.js +0 -2
  21. package/dist/cjs/types/activity/types.js +0 -28
  22. package/dist/cjs/types/backups/index.js +0 -18
  23. package/dist/cjs/types/backups/requests.js +0 -2
  24. package/dist/cjs/types/backups/types.js +0 -8
  25. package/dist/cjs/types/comments/index.js +0 -18
  26. package/dist/cjs/types/comments/requests.js +0 -2
  27. package/dist/cjs/types/comments/types.js +0 -60
  28. package/dist/cjs/types/common.js +0 -10
  29. package/dist/cjs/types/emails/index.js +0 -17
  30. package/dist/cjs/types/emails/requests.js +0 -5
  31. package/dist/cjs/types/errors.js +0 -29
  32. package/dist/cjs/types/folders/index.js +0 -17
  33. package/dist/cjs/types/folders/requests.js +0 -2
  34. package/dist/cjs/types/http.js +0 -24
  35. package/dist/cjs/types/id-mappings/index.js +0 -18
  36. package/dist/cjs/types/id-mappings/requests.js +0 -20
  37. package/dist/cjs/types/id-mappings/types.js +0 -12
  38. package/dist/cjs/types/index.js +0 -36
  39. package/dist/cjs/types/insights/index.js +0 -18
  40. package/dist/cjs/types/insights/requests.js +0 -2
  41. package/dist/cjs/types/insights/types.js +0 -84
  42. package/dist/cjs/types/labels/index.js +0 -18
  43. package/dist/cjs/types/labels/requests.js +0 -2
  44. package/dist/cjs/types/labels/types.js +0 -11
  45. package/dist/cjs/types/productivity/index.js +0 -17
  46. package/dist/cjs/types/productivity/types.js +0 -67
  47. package/dist/cjs/types/projects/index.js +0 -18
  48. package/dist/cjs/types/projects/requests.js +0 -2
  49. package/dist/cjs/types/projects/types.js +0 -56
  50. package/dist/cjs/types/reminders/index.js +0 -17
  51. package/dist/cjs/types/reminders/requests.js +0 -95
  52. package/dist/cjs/types/sections/index.js +0 -18
  53. package/dist/cjs/types/sections/requests.js +0 -2
  54. package/dist/cjs/types/sections/types.js +0 -22
  55. package/dist/cjs/types/sync/commands/calendars.js +0 -2
  56. package/dist/cjs/types/sync/commands/filters.js +0 -2
  57. package/dist/cjs/types/sync/commands/folders.js +0 -2
  58. package/dist/cjs/types/sync/commands/index.js +0 -35
  59. package/dist/cjs/types/sync/commands/labels.js +0 -5
  60. package/dist/cjs/types/sync/commands/notes.js +0 -2
  61. package/dist/cjs/types/sync/commands/notifications.js +0 -2
  62. package/dist/cjs/types/sync/commands/others.js +0 -2
  63. package/dist/cjs/types/sync/commands/project-view-options.js +0 -2
  64. package/dist/cjs/types/sync/commands/projects.js +0 -2
  65. package/dist/cjs/types/sync/commands/reminders.js +0 -2
  66. package/dist/cjs/types/sync/commands/sections.js +0 -2
  67. package/dist/cjs/types/sync/commands/shared.js +0 -20
  68. package/dist/cjs/types/sync/commands/sharing.js +0 -2
  69. package/dist/cjs/types/sync/commands/tasks.js +0 -2
  70. package/dist/cjs/types/sync/commands/view-options.js +0 -2
  71. package/dist/cjs/types/sync/commands/workspace-filters.js +0 -2
  72. package/dist/cjs/types/sync/commands/workspace-goals.js +0 -2
  73. package/dist/cjs/types/sync/commands/workspaces.js +0 -2
  74. package/dist/cjs/types/sync/index.js +0 -22
  75. package/dist/cjs/types/sync/request.js +0 -2
  76. package/dist/cjs/types/sync/resource-types.js +0 -40
  77. package/dist/cjs/types/sync/resources/calendars.js +0 -31
  78. package/dist/cjs/types/sync/resources/collaborators.js +0 -25
  79. package/dist/cjs/types/sync/resources/completed-info.js +0 -30
  80. package/dist/cjs/types/sync/resources/filters.js +0 -16
  81. package/dist/cjs/types/sync/resources/folders.js +0 -14
  82. package/dist/cjs/types/sync/resources/index.js +0 -33
  83. package/dist/cjs/types/sync/resources/live-notifications.js +0 -39
  84. package/dist/cjs/types/sync/resources/notes.js +0 -23
  85. package/dist/cjs/types/sync/resources/reminders.js +0 -50
  86. package/dist/cjs/types/sync/resources/suggestions.js +0 -42
  87. package/dist/cjs/types/sync/resources/tooltips.js +0 -10
  88. package/dist/cjs/types/sync/resources/user-plan-limits.js +0 -24
  89. package/dist/cjs/types/sync/resources/user-settings.js +0 -42
  90. package/dist/cjs/types/sync/resources/user.js +0 -120
  91. package/dist/cjs/types/sync/resources/view-options.js +0 -83
  92. package/dist/cjs/types/sync/resources/workspace-filters.js +0 -21
  93. package/dist/cjs/types/sync/resources/workspace-goals.js +0 -32
  94. package/dist/cjs/types/sync/resources/workspaces.js +0 -73
  95. package/dist/cjs/types/sync/response.js +0 -2
  96. package/dist/cjs/types/sync/user-preferences.js +0 -71
  97. package/dist/cjs/types/tasks/index.js +0 -18
  98. package/dist/cjs/types/tasks/requests.js +0 -2
  99. package/dist/cjs/types/tasks/types.js +0 -59
  100. package/dist/cjs/types/templates/index.js +0 -17
  101. package/dist/cjs/types/templates/requests.js +0 -2
  102. package/dist/cjs/types/uploads/index.js +0 -17
  103. package/dist/cjs/types/uploads/requests.js +0 -2
  104. package/dist/cjs/types/users/index.js +0 -17
  105. package/dist/cjs/types/users/types.js +0 -51
  106. package/dist/cjs/types/workspaces/index.js +0 -18
  107. package/dist/cjs/types/workspaces/requests.js +0 -2
  108. package/dist/cjs/types/workspaces/types.js +0 -155
  109. package/dist/cjs/utils/activity-helpers.js +0 -58
  110. package/dist/cjs/utils/case-conversion.js +0 -69
  111. package/dist/cjs/utils/colors.js +0 -143
  112. package/dist/cjs/utils/index.js +0 -25
  113. package/dist/cjs/utils/multipart-upload.js +0 -178
  114. package/dist/cjs/utils/processing-helpers.js +0 -18
  115. package/dist/cjs/utils/sanitization.js +0 -116
  116. package/dist/cjs/utils/sync-helpers.js +0 -22
  117. package/dist/cjs/utils/uncompletable-helpers.js +0 -60
  118. package/dist/cjs/utils/url-helpers.js +0 -74
  119. package/dist/cjs/utils/validators.js +0 -141
  120. package/dist/esm/authentication.js +0 -196
  121. package/dist/esm/consts/endpoints.js +0 -122
  122. package/dist/esm/index.js +0 -4
  123. package/dist/esm/test-utils/asserts.js +0 -8
  124. package/dist/esm/test-utils/msw-setup.js +0 -88
  125. package/dist/esm/test-utils/obsidian-fetch-adapter.js +0 -50
  126. package/dist/esm/test-utils/test-defaults.js +0 -237
  127. package/dist/esm/todoist-api.js +0 -2619
  128. package/dist/esm/transport/fetch-with-retry.js +0 -203
  129. package/dist/esm/transport/http-client.js +0 -128
  130. package/dist/esm/transport/http-dispatcher.js +0 -35
  131. package/dist/esm/types/activity/index.js +0 -2
  132. package/dist/esm/types/activity/requests.js +0 -1
  133. package/dist/esm/types/activity/types.js +0 -25
  134. package/dist/esm/types/backups/index.js +0 -2
  135. package/dist/esm/types/backups/requests.js +0 -1
  136. package/dist/esm/types/backups/types.js +0 -5
  137. package/dist/esm/types/comments/index.js +0 -2
  138. package/dist/esm/types/comments/requests.js +0 -1
  139. package/dist/esm/types/comments/types.js +0 -57
  140. package/dist/esm/types/common.js +0 -7
  141. package/dist/esm/types/emails/index.js +0 -1
  142. package/dist/esm/types/emails/requests.js +0 -2
  143. package/dist/esm/types/errors.js +0 -24
  144. package/dist/esm/types/folders/index.js +0 -1
  145. package/dist/esm/types/folders/requests.js +0 -1
  146. package/dist/esm/types/http.js +0 -20
  147. package/dist/esm/types/id-mappings/index.js +0 -2
  148. package/dist/esm/types/id-mappings/requests.js +0 -17
  149. package/dist/esm/types/id-mappings/types.js +0 -9
  150. package/dist/esm/types/index.js +0 -20
  151. package/dist/esm/types/insights/index.js +0 -2
  152. package/dist/esm/types/insights/requests.js +0 -1
  153. package/dist/esm/types/insights/types.js +0 -81
  154. package/dist/esm/types/labels/index.js +0 -2
  155. package/dist/esm/types/labels/requests.js +0 -1
  156. package/dist/esm/types/labels/types.js +0 -8
  157. package/dist/esm/types/productivity/index.js +0 -1
  158. package/dist/esm/types/productivity/types.js +0 -64
  159. package/dist/esm/types/projects/index.js +0 -2
  160. package/dist/esm/types/projects/requests.js +0 -1
  161. package/dist/esm/types/projects/types.js +0 -53
  162. package/dist/esm/types/reminders/index.js +0 -1
  163. package/dist/esm/types/reminders/requests.js +0 -92
  164. package/dist/esm/types/sections/index.js +0 -2
  165. package/dist/esm/types/sections/requests.js +0 -1
  166. package/dist/esm/types/sections/types.js +0 -19
  167. package/dist/esm/types/sync/commands/calendars.js +0 -1
  168. package/dist/esm/types/sync/commands/filters.js +0 -1
  169. package/dist/esm/types/sync/commands/folders.js +0 -1
  170. package/dist/esm/types/sync/commands/index.js +0 -19
  171. package/dist/esm/types/sync/commands/labels.js +0 -2
  172. package/dist/esm/types/sync/commands/notes.js +0 -1
  173. package/dist/esm/types/sync/commands/notifications.js +0 -1
  174. package/dist/esm/types/sync/commands/others.js +0 -1
  175. package/dist/esm/types/sync/commands/project-view-options.js +0 -1
  176. package/dist/esm/types/sync/commands/projects.js +0 -1
  177. package/dist/esm/types/sync/commands/reminders.js +0 -1
  178. package/dist/esm/types/sync/commands/sections.js +0 -1
  179. package/dist/esm/types/sync/commands/shared.js +0 -16
  180. package/dist/esm/types/sync/commands/sharing.js +0 -1
  181. package/dist/esm/types/sync/commands/tasks.js +0 -1
  182. package/dist/esm/types/sync/commands/view-options.js +0 -1
  183. package/dist/esm/types/sync/commands/workspace-filters.js +0 -1
  184. package/dist/esm/types/sync/commands/workspace-goals.js +0 -1
  185. package/dist/esm/types/sync/commands/workspaces.js +0 -1
  186. package/dist/esm/types/sync/index.js +0 -6
  187. package/dist/esm/types/sync/request.js +0 -1
  188. package/dist/esm/types/sync/resource-types.js +0 -37
  189. package/dist/esm/types/sync/resources/calendars.js +0 -28
  190. package/dist/esm/types/sync/resources/collaborators.js +0 -22
  191. package/dist/esm/types/sync/resources/completed-info.js +0 -27
  192. package/dist/esm/types/sync/resources/filters.js +0 -13
  193. package/dist/esm/types/sync/resources/folders.js +0 -11
  194. package/dist/esm/types/sync/resources/index.js +0 -17
  195. package/dist/esm/types/sync/resources/live-notifications.js +0 -36
  196. package/dist/esm/types/sync/resources/notes.js +0 -20
  197. package/dist/esm/types/sync/resources/reminders.js +0 -47
  198. package/dist/esm/types/sync/resources/suggestions.js +0 -39
  199. package/dist/esm/types/sync/resources/tooltips.js +0 -7
  200. package/dist/esm/types/sync/resources/user-plan-limits.js +0 -21
  201. package/dist/esm/types/sync/resources/user-settings.js +0 -39
  202. package/dist/esm/types/sync/resources/user.js +0 -117
  203. package/dist/esm/types/sync/resources/view-options.js +0 -80
  204. package/dist/esm/types/sync/resources/workspace-filters.js +0 -18
  205. package/dist/esm/types/sync/resources/workspace-goals.js +0 -29
  206. package/dist/esm/types/sync/resources/workspaces.js +0 -70
  207. package/dist/esm/types/sync/response.js +0 -1
  208. package/dist/esm/types/sync/user-preferences.js +0 -68
  209. package/dist/esm/types/tasks/index.js +0 -2
  210. package/dist/esm/types/tasks/requests.js +0 -1
  211. package/dist/esm/types/tasks/types.js +0 -56
  212. package/dist/esm/types/templates/index.js +0 -1
  213. package/dist/esm/types/templates/requests.js +0 -1
  214. package/dist/esm/types/uploads/index.js +0 -1
  215. package/dist/esm/types/uploads/requests.js +0 -1
  216. package/dist/esm/types/users/index.js +0 -1
  217. package/dist/esm/types/users/types.js +0 -48
  218. package/dist/esm/types/workspaces/index.js +0 -2
  219. package/dist/esm/types/workspaces/requests.js +0 -1
  220. package/dist/esm/types/workspaces/types.js +0 -152
  221. package/dist/esm/utils/activity-helpers.js +0 -53
  222. package/dist/esm/utils/case-conversion.js +0 -61
  223. package/dist/esm/utils/colors.js +0 -139
  224. package/dist/esm/utils/index.js +0 -4
  225. package/dist/esm/utils/multipart-upload.js +0 -142
  226. package/dist/esm/utils/processing-helpers.js +0 -12
  227. package/dist/esm/utils/sanitization.js +0 -112
  228. package/dist/esm/utils/sync-helpers.js +0 -19
  229. package/dist/esm/utils/uncompletable-helpers.js +0 -54
  230. package/dist/esm/utils/url-helpers.js +0 -68
  231. package/dist/esm/utils/validators.js +0 -132
  232. package/dist/types/authentication.d.ts +0 -158
  233. package/dist/types/consts/endpoints.d.ts +0 -81
  234. package/dist/types/index.d.ts +0 -4
  235. package/dist/types/test-utils/asserts.d.ts +0 -1
  236. package/dist/types/test-utils/msw-setup.d.ts +0 -33
  237. package/dist/types/test-utils/obsidian-fetch-adapter.d.ts +0 -29
  238. package/dist/types/test-utils/test-defaults.d.ts +0 -261
  239. package/dist/types/todoist-api.d.ts +0 -1018
  240. package/dist/types/transport/fetch-with-retry.d.ts +0 -12
  241. package/dist/types/transport/http-client.d.ts +0 -16
  242. package/dist/types/transport/http-dispatcher.d.ts +0 -3
  243. package/dist/types/types/activity/index.d.ts +0 -2
  244. package/dist/types/types/activity/requests.d.ts +0 -85
  245. package/dist/types/types/activity/types.d.ts +0 -49
  246. package/dist/types/types/backups/index.d.ts +0 -2
  247. package/dist/types/types/backups/requests.d.ts +0 -16
  248. package/dist/types/types/backups/types.d.ts +0 -7
  249. package/dist/types/types/comments/index.d.ts +0 -2
  250. package/dist/types/types/comments/requests.d.ts +0 -64
  251. package/dist/types/types/comments/types.d.ts +0 -141
  252. package/dist/types/types/common.d.ts +0 -13
  253. package/dist/types/types/emails/index.d.ts +0 -1
  254. package/dist/types/types/emails/requests.d.ts +0 -30
  255. package/dist/types/types/errors.d.ts +0 -12
  256. package/dist/types/types/folders/index.d.ts +0 -1
  257. package/dist/types/types/folders/requests.d.ts +0 -20
  258. package/dist/types/types/http.d.ts +0 -85
  259. package/dist/types/types/id-mappings/index.d.ts +0 -2
  260. package/dist/types/types/id-mappings/requests.d.ts +0 -28
  261. package/dist/types/types/id-mappings/types.d.ts +0 -13
  262. package/dist/types/types/index.d.ts +0 -20
  263. package/dist/types/types/insights/index.d.ts +0 -2
  264. package/dist/types/types/insights/requests.d.ts +0 -26
  265. package/dist/types/types/insights/types.d.ts +0 -186
  266. package/dist/types/types/labels/index.d.ts +0 -2
  267. package/dist/types/types/labels/requests.d.ts +0 -75
  268. package/dist/types/types/labels/types.d.ts +0 -13
  269. package/dist/types/types/productivity/index.d.ts +0 -1
  270. package/dist/types/types/productivity/types.d.ts +0 -115
  271. package/dist/types/types/projects/index.d.ts +0 -2
  272. package/dist/types/types/projects/requests.d.ts +0 -169
  273. package/dist/types/types/projects/types.d.ts +0 -201
  274. package/dist/types/types/reminders/index.d.ts +0 -1
  275. package/dist/types/types/reminders/requests.d.ts +0 -205
  276. package/dist/types/types/sections/index.d.ts +0 -2
  277. package/dist/types/types/sections/requests.d.ts +0 -41
  278. package/dist/types/types/sections/types.d.ts +0 -44
  279. package/dist/types/types/sync/commands/calendars.d.ts +0 -14
  280. package/dist/types/types/sync/commands/filters.d.ts +0 -22
  281. package/dist/types/types/sync/commands/folders.d.ts +0 -18
  282. package/dist/types/types/sync/commands/index.d.ts +0 -171
  283. package/dist/types/types/sync/commands/labels.d.ts +0 -32
  284. package/dist/types/types/sync/commands/notes.d.ts +0 -27
  285. package/dist/types/types/sync/commands/notifications.d.ts +0 -10
  286. package/dist/types/types/sync/commands/others.d.ts +0 -39
  287. package/dist/types/types/sync/commands/project-view-options.d.ts +0 -14
  288. package/dist/types/types/sync/commands/projects.d.ts +0 -90
  289. package/dist/types/types/sync/commands/reminders.d.ts +0 -51
  290. package/dist/types/types/sync/commands/sections.d.ts +0 -31
  291. package/dist/types/types/sync/commands/shared.d.ts +0 -51
  292. package/dist/types/types/sync/commands/sharing.d.ts +0 -16
  293. package/dist/types/types/sync/commands/tasks.d.ts +0 -78
  294. package/dist/types/types/sync/commands/view-options.d.ts +0 -15
  295. package/dist/types/types/sync/commands/workspace-filters.d.ts +0 -23
  296. package/dist/types/types/sync/commands/workspace-goals.d.ts +0 -24
  297. package/dist/types/types/sync/commands/workspaces.d.ts +0 -79
  298. package/dist/types/types/sync/index.d.ts +0 -6
  299. package/dist/types/types/sync/request.d.ts +0 -7
  300. package/dist/types/types/sync/resource-types.d.ts +0 -5
  301. package/dist/types/types/sync/resources/calendars.d.ts +0 -38
  302. package/dist/types/types/sync/resources/collaborators.d.ts +0 -28
  303. package/dist/types/types/sync/resources/completed-info.d.ts +0 -33
  304. package/dist/types/types/sync/resources/filters.d.ts +0 -12
  305. package/dist/types/types/sync/resources/folders.d.ts +0 -10
  306. package/dist/types/types/sync/resources/index.d.ts +0 -17
  307. package/dist/types/types/sync/resources/live-notifications.d.ts +0 -32
  308. package/dist/types/types/sync/resources/notes.d.ts +0 -34
  309. package/dist/types/types/sync/resources/reminders.d.ts +0 -126
  310. package/dist/types/types/sync/resources/suggestions.d.ts +0 -96
  311. package/dist/types/types/sync/resources/tooltips.d.ts +0 -6
  312. package/dist/types/types/sync/resources/user-plan-limits.d.ts +0 -41
  313. package/dist/types/types/sync/resources/user-settings.d.ts +0 -40
  314. package/dist/types/types/sync/resources/user.d.ts +0 -134
  315. package/dist/types/types/sync/resources/view-options.d.ts +0 -169
  316. package/dist/types/types/sync/resources/workspace-filters.d.ts +0 -17
  317. package/dist/types/types/sync/resources/workspace-goals.d.ts +0 -29
  318. package/dist/types/types/sync/resources/workspaces.d.ts +0 -142
  319. package/dist/types/types/sync/response.d.ts +0 -51
  320. package/dist/types/types/sync/user-preferences.d.ts +0 -39
  321. package/dist/types/types/tasks/index.d.ts +0 -2
  322. package/dist/types/types/tasks/requests.d.ts +0 -197
  323. package/dist/types/types/tasks/types.d.ts +0 -162
  324. package/dist/types/types/templates/index.d.ts +0 -1
  325. package/dist/types/types/templates/requests.d.ts +0 -92
  326. package/dist/types/types/uploads/index.d.ts +0 -1
  327. package/dist/types/types/uploads/requests.d.ts +0 -32
  328. package/dist/types/types/users/index.d.ts +0 -1
  329. package/dist/types/types/users/types.d.ts +0 -66
  330. package/dist/types/types/workspaces/index.d.ts +0 -2
  331. package/dist/types/types/workspaces/requests.d.ts +0 -260
  332. package/dist/types/types/workspaces/types.d.ts +0 -267
  333. package/dist/types/utils/activity-helpers.d.ts +0 -28
  334. package/dist/types/utils/case-conversion.d.ts +0 -12
  335. package/dist/types/utils/colors.d.ts +0 -197
  336. package/dist/types/utils/index.d.ts +0 -4
  337. package/dist/types/utils/multipart-upload.d.ts +0 -54
  338. package/dist/types/utils/processing-helpers.d.ts +0 -1
  339. package/dist/types/utils/sanitization.d.ts +0 -35
  340. package/dist/types/utils/sync-helpers.d.ts +0 -17
  341. package/dist/types/utils/uncompletable-helpers.d.ts +0 -30
  342. package/dist/types/utils/url-helpers.d.ts +0 -32
  343. package/dist/types/utils/validators.d.ts +0 -1404
package/README.md CHANGED
@@ -1,210 +1,11 @@
1
- # Todoist API TypeScript Client
1
+ # @doist/todoist-api-typescript
2
2
 
3
- This is the official TypeScript API client for the Todoist REST API.
3
+ > **This package has been renamed to [`@doist/todoist-sdk`](https://npmjs.com/package/@doist/todoist-sdk).**
4
4
 
5
- ## Installation
6
-
7
- Requires Node 20.18.1+.
8
-
9
- ```
10
- npm install @doist/todoist-api-typescript
11
- ```
12
-
13
- ### Usage
14
-
15
- An example of initializing the API client and fetching a user's tasks:
16
-
17
- ```typescript
18
- import { TodoistApi } from '@doist/todoist-api-typescript'
19
-
20
- const api = new TodoistApi('YOURTOKEN')
21
-
22
- api.getTasks()
23
- .then((tasks) => console.log(tasks))
24
- .catch((error) => console.log(error))
25
- ```
26
-
27
- ### Documentation
28
-
29
- For more detailed reference documentation, have a look at the [Todoist API v1 Documentation](https://todoist.com/api/v1/docs).
30
-
31
- ### Migration Guide
32
-
33
- If you're migrating from an older version of the Todoist API (v9), please refer to the [official migration guide](https://todoist.com/api/v1/docs#tag/Migrating-from-v9) for detailed information about the changes and breaking updates.
34
-
35
- Key changes in v1 include:
36
-
37
- - Updated endpoint structure
38
- - New pagination system
39
- - Unified error response format
40
- - Object renames (e.g., items → tasks, notes → comments)
41
- - URL renames and endpoint signature changes
42
-
43
- ## Custom HTTP Clients
44
-
45
- The Todoist API client supports custom HTTP implementations to enable usage in environments with specific networking requirements, such as:
46
-
47
- - **Obsidian plugins** - Desktop app with strict CORS policies
48
- - **Browser extensions** - Custom HTTP APIs with different security models
49
- - **Electron apps** - Requests routed through IPC layer
50
- - **React Native** - Different networking stack
51
- - **Enterprise environments** - Proxy configuration, custom headers, or certificate handling
52
-
53
- ### Basic Usage
54
-
55
- ```typescript
56
- import { TodoistApi } from '@doist/todoist-api-typescript'
57
-
58
- // Using the new options-based constructor
59
- const api = new TodoistApi('YOURTOKEN', {
60
- baseUrl: 'https://custom-api.example.com', // optional
61
- customFetch: myCustomFetch, // your custom fetch implementation
62
- })
63
-
64
- // Legacy constructor (deprecated but supported)
65
- const apiLegacy = new TodoistApi('YOURTOKEN', 'https://custom-api.example.com')
66
- ```
67
-
68
- ### Custom Fetch Interface
69
-
70
- Your custom fetch function must implement this interface:
71
-
72
- ```typescript
73
- type CustomFetch = (
74
- url: string,
75
- options?: RequestInit & { timeout?: number },
76
- ) => Promise<CustomFetchResponse>
77
-
78
- type CustomFetchResponse = {
79
- ok: boolean
80
- status: number
81
- statusText: string
82
- headers: Record<string, string>
83
- text(): Promise<string>
84
- json(): Promise<unknown>
85
- }
86
- ```
87
-
88
- ### OAuth with Custom Fetch
89
-
90
- OAuth authentication functions (`getAuthToken`, `revokeAuthToken`, `revokeToken`) support custom fetch through an options object:
91
-
92
- ```typescript
93
- // New options-based usage
94
- const { accessToken } = await getAuthToken(args, {
95
- baseUrl: 'https://custom-auth.example.com',
96
- customFetch: myCustomFetch,
97
- })
98
-
99
- await revokeToken(args, {
100
- customFetch: myCustomFetch,
101
- })
102
-
103
- // Legacy usage (deprecated)
104
- const { accessToken } = await getAuthToken(args, baseUrl)
105
- ```
106
-
107
- ### Important Notes
108
-
109
- - All existing transforms (snake_case ↔ camelCase) work automatically with custom fetch
110
- - Retry logic and error handling are preserved
111
- - File uploads work with custom fetch implementations
112
- - The custom fetch function should handle FormData for multipart uploads
113
- - Timeout parameter is optional and up to your custom implementation
114
-
115
- ## Development and Testing
116
-
117
- Instead of having an example app in the repository to assist development and testing, we have included [ts-node](https://github.com/TypeStrong/ts-node) as a dev dependency. This allows us to have a scratch file locally that can import and utilize the API while developing or reviewing pull requests without having to manage a separate app project.
118
-
119
- - `npm install`
120
- - Add a file named `scratch.ts` in the `src` folder.
121
- - Configure your IDE to run the scratch file with `ts-node` (instructions for [VSCode](https://medium.com/@dupski/debug-typescript-in-vs-code-without-compiling-using-ts-node-9d1f4f9a94a), [WebStorm](https://www.jetbrains.com/help/webstorm/running-and-debugging-typescript.html#ws_ts_run_debug_server_side_ts_node)), or you can optionally run ts-node in a terminal using instructions [here](https://github.com/TypeStrong/ts-node) (`npx ts-node ./src/scratch.ts` should be enough).
122
- - Import and call the relevant modules and run the scratch file.
123
-
124
- Example scratch.ts file:
125
-
126
- ```
127
- /* eslint-disable no-console */
128
- import { TodoistApi } from './todoist-api'
129
-
130
- const token = 'YOURTOKEN'
131
- const api = new TodoistApi(token)
132
-
133
- api.getProjects()
134
- .then((projects) => {
135
- console.log(projects)
136
- })
137
- .catch((error) => console.error(error))
138
- ```
139
-
140
- ### Local API Requests With .env
141
-
142
- For live API verification, you can run raw requests with a local token:
143
-
144
- 1. Copy `.env.example` to `.env`.
145
- 2. Set `TODOIST_API_TOKEN` in `.env`.
146
- 3. Run requests with `npm run api:request -- ...`.
147
- 4. Optional: set `TODOIST_API_BASE_URL` in `.env` (defaults to `https://api.todoist.com`).
148
-
149
- Examples:
5
+ Please update your dependency:
150
6
 
151
7
  ```bash
152
- npm run api:request -- --path /api/v1/tasks
153
- npm run api:request -- --method POST --path /api/v1/tasks --body '{"content":"API smoke test"}'
154
- npm run api:request -- --method POST --path /api/v1/tasks/123 --body '{"due_string":"no date"}'
155
- npm run api:request -- --path /api/v1/tasks --query '{"project_id":"123","limit":10}'
156
- ```
157
-
158
- To see all options:
159
-
160
- ```bash
161
- npm run api:request -- --help
162
- ```
163
-
164
- ## Releases
165
-
166
- This project uses [Release Please](https://github.com/googleapis/release-please) to automate releases. Releases are created automatically based on [Conventional Commits](https://www.conventionalcommits.org/).
167
-
168
- ### For Contributors
169
-
170
- When making changes, use conventional commit messages:
171
-
172
- - `feat:` - New features (triggers a minor version bump)
173
- - `fix:` - Bug fixes (triggers a patch version bump)
174
- - `feat!:` or `BREAKING CHANGE:` - Breaking changes (triggers a major version bump)
175
- - `chore:`, `docs:`, `refactor:`, `perf:` - Other changes (included in changelog)
176
-
177
- Example:
178
-
8
+ npm install @doist/todoist-sdk
179
9
  ```
180
- feat: add support for recurring tasks
181
- fix: resolve issue with date parsing
182
- feat!: remove deprecated getTask method
183
- ```
184
-
185
- ### For Maintainers
186
-
187
- The release process is fully automated:
188
-
189
- 1. **Automatic PR Creation**: When commits are merged to `main`, Release Please automatically creates or updates a release PR with:
190
-
191
- - Updated version in `package.json`
192
- - Updated `CHANGELOG.md`
193
- - Aggregated changes since the last release
194
-
195
- 2. **Review and Merge**: Review the release PR to ensure the version bump and changelog are correct, then merge it.
196
-
197
- 3. **Automatic Release**: Upon merging the release PR:
198
- - A GitHub release is automatically created with the new version tag
199
- - The `publish.yml` workflow is triggered by the tag
200
- - The package is automatically published to NPM
201
-
202
- Users of the API client can then update to the new version in their `package.json`.
203
-
204
- ### Feedback
205
-
206
- Any feedback, such as bugs, questions, comments, etc. can be reported as _Issues_ in this repository, and will be handled by us in Todoist.
207
-
208
- ### Contributions
209
10
 
210
- We would also love contributions in the form of _Pull requests_ in this repository.
11
+ This package will continue to work as a shim for the foreseeable future, but will not receive new features.
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from '@doist/todoist-sdk'
package/index.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('@doist/todoist-sdk')
package/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export * from '@doist/todoist-sdk'
package/package.json CHANGED
@@ -1,101 +1,21 @@
1
1
  {
2
2
  "name": "@doist/todoist-api-typescript",
3
- "version": "7.9.1",
4
- "description": "A typescript wrapper for the Todoist REST API.",
5
- "author": "Doist developers",
6
- "repository": "https://github.com/Doist/todoist-api-typescript",
7
- "homepage": "https://doist.github.io/todoist-api-typescript/",
8
- "license": "MIT",
9
- "type": "module",
10
- "main": "dist/cjs/index.js",
11
- "module": "dist/esm/index.js",
12
- "types": "dist/types/index.d.ts",
3
+ "version": "7.10.0",
4
+ "description": "Deprecated: renamed to @doist/todoist-sdk",
5
+ "main": "index.js",
6
+ "module": "index.mjs",
7
+ "types": "index.d.ts",
13
8
  "exports": {
14
9
  ".": {
15
- "types": "./dist/types/index.d.ts",
16
- "import": "./dist/esm/index.js",
17
- "require": "./dist/cjs/index.js"
10
+ "types": "./index.d.ts",
11
+ "import": "./index.mjs",
12
+ "require": "./index.js"
18
13
  }
19
14
  },
20
- "publishConfig": {
21
- "access": "public",
22
- "provenance": true
23
- },
24
- "sideEffects": false,
25
- "engines": {
26
- "node": ">=20.18.1"
27
- },
28
- "scripts": {
29
- "clean": "rimraf dist",
30
- "format-check": "npx prettier --check \"./**/*.{ts,tsx,json,md,yml,babelrc,html}\" --ignore-path .prettierignore",
31
- "format-fix": "npx prettier --write \"./**/*.{ts,tsx,json,md,yml,babelrc,html}\" --ignore-path .prettierignore",
32
- "lint": "oxlint src --fix",
33
- "lint-check": "oxlint src",
34
- "ts-compile-check": "npx tsc -p tsconfig.typecheck.json",
35
- "audit": "npm audit --audit-level=moderate",
36
- "test": "vitest run",
37
- "test:watch": "vitest",
38
- "test:coverage": "vitest run --coverage",
39
- "api:request": "node ./scripts/todoist-api-request.cjs",
40
- "build:cjs": "npx tsc -p tsconfig.cjs.json",
41
- "build:esm": "npx tsc -p tsconfig.esm.json",
42
- "build:fix-esm": "node scripts/fix-esm-imports.cjs",
43
- "build:fix-dts": "node scripts/fix-dts-imports.cjs",
44
- "build:post": "echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
45
- "build": "npm-run-all clean build:cjs build:esm build:fix-esm build:fix-dts build:post",
46
- "attw": "npx @arethetypeswrong/cli --pack --ignore-rules fallback-condition false-esm",
47
- "integrity-checks": "npm-run-all clean format-check lint-check test build attw",
48
- "prepublishOnly": "npm run integrity-checks",
49
- "prepare": "npm run build"
50
- },
51
15
  "dependencies": {
52
- "camelcase": "6.3.0",
53
- "emoji-regex": "10.6.0",
54
- "form-data": "4.0.5",
55
- "ts-custom-error": "^3.2.0",
56
- "undici": "^7.16.0",
57
- "uuid": "11.1.0",
58
- "zod": "4.3.6"
59
- },
60
- "devDependencies": {
61
- "@doist/prettier-config": "4.0.0",
62
- "@semantic-release/changelog": "6.0.3",
63
- "@semantic-release/exec": "7.1.0",
64
- "@semantic-release/git": "10.0.1",
65
- "conventional-changelog-conventionalcommits": "9.3.0",
66
- "dotenv": "17.3.1",
67
- "husky": "9.1.7",
68
- "lint-staged": "16.2.7",
69
- "msw": "2.12.13",
70
- "npm-run-all2": "8.0.4",
71
- "obsidian": "^1.10.2-1",
72
- "oxlint": "1.57.0",
73
- "prettier": "3.3.2",
74
- "rimraf": "6.1.3",
75
- "semantic-release": "25.0.3",
76
- "ts-node": "10.9.2",
77
- "type-fest": "^5.0.0",
78
- "typescript": "5.9.3",
79
- "vitest": "4.0.14"
16
+ "@doist/todoist-sdk": ">=8.0.0"
80
17
  },
81
- "peerDependencies": {
82
- "type-fest": "^4.12.0"
83
- },
84
- "prettier": "@doist/prettier-config",
85
- "husky": {
86
- "hooks": {
87
- "pre-commit": "npx lint-staged && npm run build"
88
- }
89
- },
90
- "lint-staged": {
91
- "*.{ts,tsx}": "oxlint --fix",
92
- "*.{ts,tsx,json,html,yml,yaml,md}": "prettier --check"
93
- },
94
- "files": [
95
- "dist/cjs/**/*",
96
- "dist/esm/**/*",
97
- "dist/types/**/*",
98
- "!dist/**/*.test.js",
99
- "!dist/**/*.test.d.ts"
100
- ]
18
+ "publishConfig": {
19
+ "access": "public"
20
+ }
101
21
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2020 Doist
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,204 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PERMISSIONS = void 0;
4
- exports.getAuthStateParameter = getAuthStateParameter;
5
- exports.getAuthorizationUrl = getAuthorizationUrl;
6
- exports.getAuthToken = getAuthToken;
7
- exports.revokeToken = revokeToken;
8
- exports.migratePersonalToken = migratePersonalToken;
9
- const http_client_1 = require("./transport/http-client");
10
- const uuid_1 = require("uuid");
11
- const types_1 = require("./types");
12
- const endpoints_1 = require("./consts/endpoints");
13
- /** Available OAuth2 permission scopes. */
14
- exports.PERMISSIONS = [
15
- 'task:add',
16
- 'data:read',
17
- 'data:read_write',
18
- 'data:delete',
19
- 'project:delete',
20
- 'backups:read',
21
- ];
22
- /**
23
- * Creates a Basic Authentication header value from client credentials.
24
- * @param clientId - The OAuth client ID
25
- * @param clientSecret - The OAuth client secret
26
- * @returns The Basic Auth header value (without the 'Basic ' prefix)
27
- */
28
- function createBasicAuthHeader(clientId, clientSecret) {
29
- const credentials = `${clientId}:${clientSecret}`;
30
- return Buffer.from(credentials).toString('base64');
31
- }
32
- /**
33
- * Generates a random state parameter for OAuth2 authorization.
34
- * The state parameter helps prevent CSRF attacks.
35
- *
36
- * @example
37
- * ```typescript
38
- * const state = getAuthStateParameter()
39
- * // Store state in session
40
- * const authUrl = getAuthorizationUrl(clientId, ['data:read'], state)
41
- * ```
42
- *
43
- * @returns A random UUID v4 string
44
- */
45
- function getAuthStateParameter() {
46
- return (0, uuid_1.v4)();
47
- }
48
- /**
49
- * Generates the authorization URL for the OAuth2 flow.
50
- *
51
- * @example
52
- * ```typescript
53
- * const url = getAuthorizationUrl(
54
- * 'your-client-id',
55
- * ['data:read', 'task:add'],
56
- * state
57
- * )
58
- * // Redirect user to url
59
- * ```
60
- *
61
- * @returns The full authorization URL to redirect users to
62
- * @see https://developer.todoist.com/api/v1/#tag/Authorization/OAuth
63
- */
64
- function getAuthorizationUrl({ clientId, permissions, state, baseUrl, }) {
65
- if (!(permissions === null || permissions === void 0 ? void 0 : permissions.length)) {
66
- throw new Error('At least one scope value should be passed for permissions.');
67
- }
68
- const scope = permissions.join(',');
69
- return `${(0, endpoints_1.getAuthBaseUri)(baseUrl)}${endpoints_1.ENDPOINT_AUTHORIZATION}?client_id=${clientId}&scope=${scope}&state=${state}`;
70
- }
71
- /**
72
- * Exchanges an authorization code for an access token.
73
- *
74
- * @example
75
- * ```typescript
76
- * const { accessToken } = await getAuthToken({
77
- * clientId: 'your-client-id',
78
- * clientSecret: 'your-client-secret',
79
- * code: authCode
80
- * })
81
- * ```
82
- *
83
- * @returns The access token response
84
- * @throws {@link TodoistRequestError} If the token exchange fails
85
- */
86
- async function getAuthToken(args, options) {
87
- var _a;
88
- if (typeof options === 'string') {
89
- throw new TypeError('Passing baseUrl as a string is no longer supported. Use an options object instead: getAuthToken(args, { baseUrl })');
90
- }
91
- const baseUrl = options === null || options === void 0 ? void 0 : options.baseUrl;
92
- const customFetch = options === null || options === void 0 ? void 0 : options.customFetch;
93
- try {
94
- const response = await (0, http_client_1.request)({
95
- httpMethod: 'POST',
96
- baseUri: (0, endpoints_1.getAuthBaseUri)(baseUrl),
97
- relativePath: endpoints_1.ENDPOINT_GET_TOKEN,
98
- apiToken: undefined,
99
- payload: args,
100
- customFetch,
101
- });
102
- if (response.status !== 200 || !((_a = response.data) === null || _a === void 0 ? void 0 : _a.accessToken)) {
103
- throw new types_1.TodoistRequestError('Authentication token exchange failed.', response.status, response.data);
104
- }
105
- return response.data;
106
- }
107
- catch (error) {
108
- // Re-throw with custom message for authentication failures
109
- const err = error;
110
- throw new types_1.TodoistRequestError('Authentication token exchange failed.', err.httpStatusCode, err.responseData);
111
- }
112
- }
113
- /**
114
- * Revokes a token using the RFC 7009 OAuth 2.0 Token Revocation standard.
115
- *
116
- * This function uses HTTP Basic Authentication with client credentials and follows
117
- * the RFC 7009 specification for token revocation.
118
- *
119
- * @example
120
- * ```typescript
121
- * await revokeToken({
122
- * clientId: 'your-client-id',
123
- * clientSecret: 'your-client-secret',
124
- * token: 'access-token-to-revoke'
125
- * })
126
- * ```
127
- *
128
- * @returns True if revocation was successful
129
- * @see https://datatracker.ietf.org/doc/html/rfc7009
130
- * @see https://developer.todoist.com/api/v1/#tag/Authorization
131
- */
132
- async function revokeToken(args, options) {
133
- if (typeof options === 'string') {
134
- throw new TypeError('Passing baseUrl as a string is no longer supported. Use an options object instead: revokeToken(args, { baseUrl })');
135
- }
136
- const baseUrl = options === null || options === void 0 ? void 0 : options.baseUrl;
137
- const customFetch = options === null || options === void 0 ? void 0 : options.customFetch;
138
- const { clientId, clientSecret, token } = args;
139
- // Create Basic Auth header as per RFC 7009
140
- const basicAuth = createBasicAuthHeader(clientId, clientSecret);
141
- const customHeaders = {
142
- Authorization: `Basic ${basicAuth}`,
143
- };
144
- // Request body only contains the token and optional token_type_hint
145
- const requestBody = {
146
- token,
147
- token_type_hint: 'access_token',
148
- };
149
- const response = await (0, http_client_1.request)({
150
- httpMethod: 'POST',
151
- baseUri: (0, endpoints_1.getSyncBaseUri)(baseUrl),
152
- relativePath: endpoints_1.ENDPOINT_REVOKE,
153
- apiToken: undefined,
154
- payload: requestBody,
155
- requestId: undefined,
156
- hasSyncCommands: false,
157
- customHeaders: customHeaders,
158
- customFetch,
159
- });
160
- return (0, http_client_1.isSuccess)(response);
161
- }
162
- /**
163
- * Migrates a personal API token to an OAuth access token.
164
- *
165
- * This allows applications to transition users from personal API tokens
166
- * to proper OAuth tokens without requiring the user to go through the
167
- * full OAuth authorization flow.
168
- *
169
- * @example
170
- * ```typescript
171
- * const { accessToken } = await migratePersonalToken({
172
- * clientId: 'your-client-id',
173
- * clientSecret: 'your-client-secret',
174
- * personalToken: 'user-personal-token',
175
- * scope: 'data:read_write,data:delete'
176
- * })
177
- * ```
178
- *
179
- * @returns The new OAuth token response
180
- * @throws {@link TodoistRequestError} If the migration fails
181
- */
182
- async function migratePersonalToken(args, options) {
183
- var _a;
184
- const baseUrl = options === null || options === void 0 ? void 0 : options.baseUrl;
185
- const customFetch = options === null || options === void 0 ? void 0 : options.customFetch;
186
- try {
187
- const response = await (0, http_client_1.request)({
188
- httpMethod: 'POST',
189
- baseUri: (0, endpoints_1.getSyncBaseUri)(baseUrl),
190
- relativePath: endpoints_1.ENDPOINT_REST_ACCESS_TOKENS_MIGRATE,
191
- apiToken: undefined,
192
- payload: Object.assign(Object.assign({}, args), { scope: args.scope.join(',') }),
193
- customFetch,
194
- });
195
- if (response.status !== 200 || !((_a = response.data) === null || _a === void 0 ? void 0 : _a.accessToken)) {
196
- throw new types_1.TodoistRequestError('Personal token migration failed.', response.status, response.data);
197
- }
198
- return response.data;
199
- }
200
- catch (error) {
201
- const err = error;
202
- throw new types_1.TodoistRequestError('Personal token migration failed.', err.httpStatusCode, err.responseData);
203
- }
204
- }