|
1 | | -import { AxiosResponse } from "axios"; |
2 | | - |
3 | 1 | export interface CommentModule { |
4 | | - get: (id: string | number) => Promise<APICommentObject>; |
5 | | - create: (comment: CreatableComment) => Promise<APICommentObject>; |
6 | | - delete: (id: number | string) => Promise<AxiosResponse>; |
7 | | - getAll: (params: CommentSearchableParams) => Promise<APICommentObject[]>; |
8 | | - update: ( |
9 | | - id: number | string, |
10 | | - comment: CommentUpdatableParameters |
11 | | - ) => Promise<AxiosResponse>; |
| 2 | + get: (id: string | number) => Promise<APICommentObject>; |
| 3 | + create: (comment: CreatableComment) => Promise<APICommentObject>; |
| 4 | + delete: (id: number | string) => Promise<Response>; |
| 5 | + getAll: (params: CommentSearchableParams) => Promise<APICommentObject[]>; |
| 6 | + update: ( |
| 7 | + id: number | string, |
| 8 | + comment: CommentUpdatableParameters |
| 9 | + ) => Promise<Response>; |
12 | 10 | } |
13 | 11 |
|
14 | 12 | /* CLIENT-LEVEL INTERFACES */ |
15 | 13 |
|
16 | 14 | export type UserCreatedComment = |
17 | | - | UserCreatedProjectComment |
18 | | - | UserCreatedTaskComment; |
| 15 | + | UserCreatedProjectComment |
| 16 | + | UserCreatedTaskComment; |
19 | 17 |
|
20 | 18 | export type UserCreatedProjectComment = { |
21 | | - task_id?: undefined; |
22 | | - project_id: number; |
23 | | - content?: string; |
24 | | - attachment?: TodoistFile; |
| 19 | + task_id?: undefined; |
| 20 | + project_id: number; |
| 21 | + content?: string; |
| 22 | + attachment?: TodoistFile; |
25 | 23 | }; |
26 | 24 |
|
27 | 25 | export type UserCreatedTaskComment = { |
28 | | - task_id: number; |
29 | | - project_id?: undefined; |
30 | | - content?: string; |
31 | | - attachment?: TodoistFile; |
| 26 | + task_id: number; |
| 27 | + project_id?: undefined; |
| 28 | + content?: string; |
| 29 | + attachment?: TodoistFile; |
32 | 30 | }; |
33 | 31 |
|
34 | 32 | export type CreatableComment = UserCreatedComment & { |
35 | | - content: string; |
| 33 | + content: string; |
36 | 34 | }; |
37 | 35 |
|
38 | 36 | /* API-LEVEL INTERFACES */ |
39 | 37 |
|
40 | 38 | export type APICommentObject = APIProjectCommentObject | APITaskCommentObject; |
41 | 39 |
|
42 | 40 | export type APIProjectCommentObject = { |
43 | | - id: number; |
44 | | - project_id: number; |
45 | | - task_id?: undefined; |
46 | | - posted: string; |
47 | | - content: string; |
48 | | - attachment?: TodoistFile; |
| 41 | + id: number; |
| 42 | + project_id: number; |
| 43 | + task_id?: undefined; |
| 44 | + posted: string; |
| 45 | + content: string; |
| 46 | + attachment?: TodoistFile; |
49 | 47 | }; |
50 | 48 | export type APITaskCommentObject = { |
51 | | - id: number; |
52 | | - task_id: number; |
53 | | - project_id?: undefined; |
54 | | - posted: string; |
55 | | - content: string; |
56 | | - attachment?: TodoistFile; |
| 49 | + id: number; |
| 50 | + task_id: number; |
| 51 | + project_id?: undefined; |
| 52 | + posted: string; |
| 53 | + content: string; |
| 54 | + attachment?: TodoistFile; |
57 | 55 | }; |
58 | 56 |
|
59 | 57 | // See https://developer.todoist.com/rest/v1/#update-a-comment |
60 | 58 | export interface CommentUpdatableParameters { |
61 | | - content: string; |
| 59 | + content: string; |
62 | 60 | } |
63 | 61 |
|
64 | 62 | export type CommentSearchableParams = |
65 | | - | { project_id: number; task_id?: undefined } |
66 | | - | { task_id: number; project_id?: undefined }; |
| 63 | + | { project_id: number; task_id?: undefined } |
| 64 | + | { task_id: number; project_id?: undefined }; |
67 | 65 |
|
68 | 66 | export interface BaseFileProperties { |
69 | | - file_name: string; |
70 | | - file_size: number; |
71 | | - file_type: string; |
72 | | - file_url: string; |
73 | | - upload_state?: "pending" | "completed"; |
| 67 | + file_name: string; |
| 68 | + file_size: number; |
| 69 | + file_type: string; |
| 70 | + file_url: string; |
| 71 | + upload_state?: "pending" | "completed"; |
74 | 72 | } |
75 | 73 |
|
76 | 74 | export interface ImageFileProperties { |
77 | | - tn_l: [string, number, number]; |
78 | | - tn_m: [string, number, number]; |
79 | | - tn_s: [string, number, number]; |
80 | | - file_duration?: undefined; |
| 75 | + tn_l: [string, number, number]; |
| 76 | + tn_m: [string, number, number]; |
| 77 | + tn_s: [string, number, number]; |
| 78 | + file_duration?: undefined; |
81 | 79 | } |
82 | 80 |
|
83 | 81 | export interface AudioFileProperties { |
84 | | - file_duration: number; |
85 | | - tn_l?: undefined; |
86 | | - tn_m?: undefined; |
87 | | - tn_s?: undefined; |
| 82 | + file_duration: number; |
| 83 | + tn_l?: undefined; |
| 84 | + tn_m?: undefined; |
| 85 | + tn_s?: undefined; |
88 | 86 | } |
89 | 87 |
|
90 | 88 | export type TodoistFile = BaseFileProperties & |
91 | | - (ImageFileProperties | AudioFileProperties); |
| 89 | + (ImageFileProperties | AudioFileProperties); |
0 commit comments