@elobdev/zoho-projects-wrapper 0.0.0-stage → 0.1.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.
@@ -0,0 +1,68 @@
1
+ import { ResourceBase } from '@/resource-base.ts';
2
+ import type { ZohoFilter, ZohoListResponse, ZohoPageParams } from '@/types.ts';
3
+
4
+ export class PhasesResource extends ResourceBase {
5
+ listAll(portalId: string | number, params: ZohoPageParams & { sort_by?: string; view_id?: string | number; milestone_ids?: string; filter?: ZohoFilter } = {}): Promise<ZohoListResponse<Record<string, unknown>>> {
6
+ return this.get(this.portalPath(portalId, 'phases'), this.withFilter(params, params.filter));
7
+ }
8
+
9
+ list(portalId: string | number, projectId: string | number, params: ZohoPageParams & { sort_by?: string; view_id?: string | number; milestone_ids?: string; filter?: ZohoFilter } = {}): Promise<ZohoListResponse<Record<string, unknown>>> {
10
+ return this.get(this.projectPath(portalId, projectId, 'phases'), this.withFilter(params, params.filter));
11
+ }
12
+
13
+ getById(portalId: string | number, projectId: string | number, phaseId: string | number): Promise<Record<string, unknown>> {
14
+ return this.get(this.projectPath(portalId, projectId, 'phases', phaseId));
15
+ }
16
+
17
+ create(portalId: string | number, projectId: string | number, body: Record<string, unknown>): Promise<Record<string, unknown>> {
18
+ return this.post(this.projectPath(portalId, projectId, 'phases'), body);
19
+ }
20
+
21
+ update(portalId: string | number, projectId: string | number, phaseId: string | number, body: Record<string, unknown>): Promise<Record<string, unknown>> {
22
+ return this.patch(this.projectPath(portalId, projectId, 'phases', phaseId), body);
23
+ }
24
+
25
+ deleteById(portalId: string | number, projectId: string | number, phaseId: string | number): Promise<unknown> {
26
+ return this.delete(this.projectPath(portalId, projectId, 'phases', phaseId));
27
+ }
28
+
29
+ statusTimeline(portalId: string | number, projectId: string | number, phaseId: string | number): Promise<unknown> {
30
+ return this.get(this.projectPath(portalId, projectId, 'phases', phaseId, 'status-timeline'));
31
+ }
32
+
33
+ move(portalId: string | number, projectId: string | number, phaseId: string | number, body: { to_project: string | number }): Promise<unknown> {
34
+ return this.patch(this.projectPath(portalId, projectId, 'phases', phaseId, 'move'), body);
35
+ }
36
+
37
+ getFollowers(portalId: string | number, projectId: string | number, phaseId: string | number, query?: Record<string, unknown>): Promise<unknown> {
38
+ return this.get(this.projectPath(portalId, projectId, 'phases', phaseId, 'followers'), query);
39
+ }
40
+
41
+ addFollowers(portalId: string | number, projectId: string | number, phaseId: string | number, body: { followers: Array<string | number> }): Promise<unknown> {
42
+ return this.post(this.projectPath(portalId, projectId, 'phases', phaseId, 'follow'), body);
43
+ }
44
+
45
+ removeFollowers(portalId: string | number, projectId: string | number, phaseId: string | number, body: { follower_ids: Array<string | number> }): Promise<unknown> {
46
+ return this.delete(this.projectPath(portalId, projectId, 'phases', phaseId, 'unfollow'), body);
47
+ }
48
+
49
+ listComments(portalId: string | number, projectId: string | number, phaseId: string | number, params: ZohoPageParams & { sort_by?: string; filter?: ZohoFilter } = {}): Promise<ZohoListResponse<Record<string, unknown>>> {
50
+ return this.get(this.projectPath(portalId, projectId, 'phases', phaseId, 'comments'), this.withFilter(params, params.filter));
51
+ }
52
+
53
+ getComment(portalId: string | number, projectId: string | number, phaseId: string | number, commentId: string | number): Promise<Record<string, unknown>> {
54
+ return this.get(this.projectPath(portalId, projectId, 'phases', phaseId, 'comments', commentId));
55
+ }
56
+
57
+ addComment(portalId: string | number, projectId: string | number, phaseId: string | number, body: { content: string; attachments?: Array<string | number> }): Promise<Record<string, unknown>> {
58
+ return this.post(this.projectPath(portalId, projectId, 'phases', phaseId, 'comments'), body);
59
+ }
60
+
61
+ updateComment(portalId: string | number, projectId: string | number, phaseId: string | number, commentId: string | number, body: { content: string; attachments?: Array<string | number> }): Promise<Record<string, unknown>> {
62
+ return this.patch(this.projectPath(portalId, projectId, 'phases', phaseId, 'comments', commentId), body);
63
+ }
64
+
65
+ deleteComment(portalId: string | number, projectId: string | number, phaseId: string | number, commentId: string | number): Promise<unknown> {
66
+ return this.delete(this.projectPath(portalId, projectId, 'phases', phaseId, 'comments', commentId));
67
+ }
68
+ }
@@ -0,0 +1,46 @@
1
+ import { ResourceBase } from '@/resource-base.ts';
2
+ import type { PortalTrashRequest, ZohoListResponse, ZohoPortal, ZohoPortalDetails, ZohoPortalExportStatus } from '@/types.ts';
3
+
4
+ export class PortalsResource extends ResourceBase {
5
+ listPortals(): Promise<ZohoListResponse<ZohoPortal>> {
6
+ return this.get('portal');
7
+ }
8
+
9
+ getPortalDetails(portalId: string | number): Promise<ZohoPortalDetails> {
10
+ return this.get(this.portalPath(portalId));
11
+ }
12
+
13
+ scheduleDataBackup(portalId: string | number, accessCode: string): Promise<ZohoPortalExportStatus> {
14
+ const form = new FormData();
15
+ form.set('access_code', accessCode);
16
+ return this.request(this.portalPath(portalId, 'portal_export'), { method: 'POST', formData: form });
17
+ }
18
+
19
+ getDataBackupStatus(portalId: string | number, exportId: string | number): Promise<ZohoPortalExportStatus> {
20
+ return this.get(this.portalPath(portalId, 'portal_export', exportId, 'status'));
21
+ }
22
+
23
+ getDataBackupHistory(portalId: string | number): Promise<ZohoListResponse<ZohoPortalExportStatus>> {
24
+ return this.get(this.portalPath(portalId, 'portal_export', 'history'));
25
+ }
26
+
27
+ getTrashedRecords(portalId: string | number, query?: Record<string, unknown>): Promise<unknown> {
28
+ return this.get(this.portalPath(portalId, 'bin'), query);
29
+ }
30
+
31
+ moveRecordsToTrash(portalId: string | number, body: PortalTrashRequest): Promise<unknown> {
32
+ return this.post(this.portalPath(portalId, 'trash'), body);
33
+ }
34
+
35
+ deleteRecords(portalId: string | number, body: PortalTrashRequest | PortalTrashRequest[]): Promise<unknown> {
36
+ return this.delete(this.portalPath(portalId, 'bin'), body);
37
+ }
38
+
39
+ restoreRecordsFromTrash(portalId: string | number, body: PortalTrashRequest | PortalTrashRequest[]): Promise<unknown> {
40
+ return this.post(this.portalPath(portalId, 'bin', 'restore'), body);
41
+ }
42
+
43
+ emptyRecycleBin(portalId: string | number): Promise<unknown> {
44
+ return this.delete(this.portalPath(portalId, 'bin'));
45
+ }
46
+ }
@@ -0,0 +1,24 @@
1
+ import { ResourceBase } from '@/resource-base.ts';
2
+ import type { ZohoListResponse, ZohoPageParams, ZohoProjectGroup } from '@/types.ts';
3
+
4
+ export class ProjectGroupsResource extends ResourceBase {
5
+ list(portalId: string | number, params: ZohoPageParams = {}): Promise<ZohoListResponse<ZohoProjectGroup>> {
6
+ return this.get(this.portalPath(portalId, 'project-groups'), params);
7
+ }
8
+
9
+ listMine(portalId: string | number, params: ZohoPageParams = {}): Promise<ZohoListResponse<ZohoProjectGroup>> {
10
+ return this.get(this.portalPath(portalId, 'my-project-groups'), params);
11
+ }
12
+
13
+ create(portalId: string | number, body: { name: string; type: 'public' | 'private'; prefix?: string }): Promise<ZohoProjectGroup> {
14
+ return this.post(this.portalPath(portalId, 'project-groups'), body);
15
+ }
16
+
17
+ update(portalId: string | number, groupId: string | number, body: { name?: string; type?: 'public' | 'private'; prefix?: string }): Promise<ZohoProjectGroup> {
18
+ return this.patch(this.portalPath(portalId, 'project-groups', groupId), body);
19
+ }
20
+
21
+ deleteById(portalId: string | number, groupId: string | number): Promise<unknown> {
22
+ return this.delete(this.portalPath(portalId, 'project-groups', groupId));
23
+ }
24
+ }
@@ -0,0 +1,56 @@
1
+ import { ResourceBase } from '@/resource-base.ts';
2
+ import type { ZohoFilter, ZohoListResponse, ZohoPageParams, ZohoProject } from '@/types.ts';
3
+
4
+ export class ProjectsResource extends ResourceBase {
5
+ list(portalId: string | number, params: ZohoPageParams & { sort_by?: string; view_id?: string | number; milestone_ids?: string; filter?: ZohoFilter } = {}): Promise<ZohoListResponse<ZohoProject>> {
6
+ return this.get(this.portalPath(portalId, 'projects'), this.withFilter(params, params.filter));
7
+ }
8
+
9
+ getById(portalId: string | number, projectId: string | number): Promise<ZohoProject> {
10
+ return this.get(this.portalPath(portalId, 'projects', projectId));
11
+ }
12
+
13
+ create(portalId: string | number, body: Partial<ZohoProject>): Promise<ZohoProject> {
14
+ return this.post(this.portalPath(portalId, 'projects'), body);
15
+ }
16
+
17
+ update(portalId: string | number, projectId: string | number, body: Partial<ZohoProject>): Promise<ZohoProject> {
18
+ return this.patch(this.portalPath(portalId, 'projects', projectId), body);
19
+ }
20
+
21
+ deleteById(portalId: string | number, projectId: string | number): Promise<unknown> {
22
+ return this.delete(this.portalPath(portalId, 'projects', projectId));
23
+ }
24
+
25
+ trash(portalId: string | number, projectId: string | number): Promise<unknown> {
26
+ return this.post(this.projectPath(portalId, projectId, 'trash'));
27
+ }
28
+
29
+ markFavouriteCustomView(portalId: string | number, customViewId: string | number): Promise<unknown> {
30
+ return this.post(this.buildPath(['portal', portalId, 'projects', 'customview', customViewId, 'markfavourite']));
31
+ }
32
+
33
+ listComments(
34
+ portalId: string | number,
35
+ projectId: string | number,
36
+ params: ZohoPageParams & { sort_by?: string; view_id?: string | number; milestone_ids?: string; filter?: ZohoFilter } = {},
37
+ ): Promise<ZohoListResponse<Record<string, unknown>>> {
38
+ return this.get(this.projectPath(portalId, projectId, 'comments'), this.withFilter(params, params.filter));
39
+ }
40
+
41
+ getComment(portalId: string | number, projectId: string | number, commentId: string | number): Promise<Record<string, unknown>> {
42
+ return this.get(this.projectPath(portalId, projectId, 'comments', commentId));
43
+ }
44
+
45
+ addComment(portalId: string | number, projectId: string | number, body: { content: string; attachments?: Array<string | number> }): Promise<Record<string, unknown>> {
46
+ return this.post(this.projectPath(portalId, projectId, 'comments'), body);
47
+ }
48
+
49
+ updateComment(portalId: string | number, projectId: string | number, commentId: string | number, body: { content: string; attachments?: Array<string | number> }): Promise<Record<string, unknown>> {
50
+ return this.patch(this.projectPath(portalId, projectId, 'comments', commentId), body);
51
+ }
52
+
53
+ deleteComment(portalId: string | number, projectId: string | number, commentId: string | number): Promise<unknown> {
54
+ return this.delete(this.projectPath(portalId, projectId, 'comments', commentId));
55
+ }
56
+ }
@@ -0,0 +1,40 @@
1
+ import { ResourceBase } from '@/resource-base.ts';
2
+ import type { ZohoFollower } from '@/types.ts';
3
+
4
+ export class RecordsResource extends ResourceBase {
5
+ createRecord(portalId: string | number, moduleName: string, body: Record<string, unknown>): Promise<unknown> {
6
+ return this.post(this.buildPath(['portal', portalId, 'module', moduleName, 'entities']), body);
7
+ }
8
+
9
+ listEntityEdits(portalId: string | number, moduleName: string, entityId: string | number, query?: Record<string, unknown>): Promise<unknown> {
10
+ return this.get(this.buildPath(['portal', portalId, 'module', moduleName, 'entity', entityId, 'edits']), query);
11
+ }
12
+
13
+ getEditsByAuditId(portalId: string | number, moduleName: string, entityId: string | number, editId: string | number): Promise<unknown> {
14
+ return this.get(this.buildPath(['portal', portalId, 'module', moduleName, 'entity', entityId, 'edits', editId]));
15
+ }
16
+
17
+ getAttachmentCount(portalId: string | number, moduleName: string, entityId: string | number): Promise<{ attachment_count?: string | number }> {
18
+ return this.get(this.buildPath(['portal', portalId, 'module', moduleName, 'entity', entityId, 'attachmentcount']));
19
+ }
20
+
21
+ getFollowers(portalId: string | number, moduleName: string, entityId: string | number, query?: Record<string, unknown>): Promise<{ followers?: ZohoFollower[] }> {
22
+ return this.get(this.buildPath(['portal', portalId, 'module', moduleName, 'entity', entityId, 'followers']), query);
23
+ }
24
+
25
+ addFollower(portalId: string | number, moduleName: string, entityId: string | number): Promise<unknown> {
26
+ return this.post(this.buildPath(['portal', portalId, 'module', moduleName, 'entity', entityId, 'follow']));
27
+ }
28
+
29
+ addOrRemoveFollowers(portalId: string | number, moduleName: string, entityId: string | number, body: Record<string, unknown>): Promise<unknown> {
30
+ return this.post(this.buildPath(['portal', portalId, 'module', moduleName, 'entity', entityId, 'followers']), body);
31
+ }
32
+
33
+ removeFollower(portalId: string | number, moduleName: string, entityId: string | number): Promise<unknown> {
34
+ return this.delete(this.buildPath(['portal', portalId, 'module', moduleName, 'entity', entityId, 'unfollow']));
35
+ }
36
+
37
+ addComment(portalId: string | number, moduleName: string, entityId: string | number, body: { content: string; attachments?: Array<Record<string, unknown>> }): Promise<unknown> {
38
+ return this.post(this.buildPath(['portal', portalId, 'module', moduleName, 'entity', entityId, 'comment']), body);
39
+ }
40
+ }
@@ -0,0 +1,132 @@
1
+ import { ResourceBase } from '@/resource-base.ts';
2
+ import type { ModuleBulkOptionsRequest, ZohoCustomField, ZohoListResponse, ZohoModule } from '@/types.ts';
3
+
4
+ export class SettingsResource extends ResourceBase {
5
+ listModules(portalId: string | number, query?: Record<string, unknown>): Promise<ZohoListResponse<ZohoModule>> {
6
+ return this.get(this.portalPath(portalId, 'settings', 'modules'), query);
7
+ }
8
+
9
+ getModule(portalId: string | number, moduleName: string): Promise<ZohoModule> {
10
+ return this.get(this.portalPath(portalId, 'settings', 'modules', moduleName));
11
+ }
12
+
13
+ createModule(portalId: string | number, body: Record<string, unknown>): Promise<ZohoModule> {
14
+ return this.post(this.portalPath(portalId, 'settings', 'modules'), body);
15
+ }
16
+
17
+ updateModule(portalId: string | number, moduleName: string, body: Record<string, unknown>): Promise<ZohoModule> {
18
+ return this.patch(this.portalPath(portalId, 'settings', 'modules', moduleName), body);
19
+ }
20
+
21
+ updateModuleStatus(portalId: string | number, moduleName: string, body: Record<string, unknown>): Promise<unknown> {
22
+ return this.post(this.portalPath(portalId, 'settings', 'modules', moduleName, 'status'), body);
23
+ }
24
+
25
+ activateModule(portalId: string | number, moduleName: string): Promise<unknown> {
26
+ return this.patch(this.portalPath(portalId, 'settings', 'modules', moduleName, 'activate'));
27
+ }
28
+
29
+ deactivateModule(portalId: string | number, moduleName: string): Promise<unknown> {
30
+ return this.patch(this.portalPath(portalId, 'settings', 'modules', moduleName, 'deactivate'));
31
+ }
32
+
33
+ trashModule(portalId: string | number, moduleName: string, body: Record<string, unknown>): Promise<unknown> {
34
+ return this.post(this.portalPath(portalId, 'settings', 'modules', moduleName, 'trash'), body);
35
+ }
36
+
37
+ deleteModule(portalId: string | number, moduleName: string): Promise<unknown> {
38
+ return this.delete(this.portalPath(portalId, 'settings', 'modules', moduleName));
39
+ }
40
+
41
+ restoreModule(portalId: string | number, moduleName: string, body: Record<string, unknown>): Promise<unknown> {
42
+ return this.post(this.portalPath(portalId, 'settings', 'modules', moduleName, 'restore'), body);
43
+ }
44
+
45
+ getModuleConfiguration(portalId: string | number, moduleName: string): Promise<unknown> {
46
+ return this.get(this.portalPath(portalId, 'settings', 'modules', moduleName, 'configuration'));
47
+ }
48
+
49
+ listLayouts(portalId: string | number, query?: Record<string, unknown>): Promise<ZohoListResponse<Record<string, unknown>>> {
50
+ return this.get(this.portalPath(portalId, 'settings', 'layouts'), query);
51
+ }
52
+
53
+ getDefaultLayout(portalId: string | number, query?: Record<string, unknown>): Promise<Record<string, unknown>> {
54
+ return this.get(this.portalPath(portalId, 'settings', 'layouts', 'default-layout'), query);
55
+ }
56
+
57
+ getLayoutDetails(portalId: string | number, layoutId: string | number): Promise<Record<string, unknown>> {
58
+ return this.get(this.portalPath(portalId, 'settings', 'layouts', layoutId));
59
+ }
60
+
61
+ createLayout(portalId: string | number, body: Record<string, unknown>): Promise<Record<string, unknown>> {
62
+ return this.post(this.portalPath(portalId, 'settings', 'layouts'), body);
63
+ }
64
+
65
+ updateLayout(portalId: string | number, layoutId: string | number, body: Record<string, unknown>): Promise<Record<string, unknown>> {
66
+ return this.patch(this.portalPath(portalId, 'settings', 'layouts', layoutId), body);
67
+ }
68
+
69
+ deleteLayout(portalId: string | number, layoutId: string | number): Promise<unknown> {
70
+ return this.delete(this.portalPath(portalId, 'settings', 'layouts', layoutId));
71
+ }
72
+
73
+ disassociateFieldFromLayout(portalId: string | number, layoutId: string | number, fieldId: string | number, body?: Record<string, unknown>): Promise<unknown> {
74
+ return this.delete(this.portalPath(portalId, 'settings', 'layouts', layoutId, 'fields', fieldId), body);
75
+ }
76
+
77
+ getAssociatedEntitiesOfLayout(portalId: string | number, layoutId: string | number, query?: Record<string, unknown>): Promise<unknown> {
78
+ return this.get(this.portalPath(portalId, 'settings', 'layouts', layoutId, 'entities'), query);
79
+ }
80
+
81
+ createOrUpdateSection(portalId: string | number, layoutId: string | number, body: Record<string, unknown>): Promise<unknown> {
82
+ return this.put(this.portalPath(portalId, 'settings', 'layouts', layoutId, 'sections'), body);
83
+ }
84
+
85
+ deleteSection(portalId: string | number, layoutId: string | number, body?: Record<string, unknown>): Promise<unknown> {
86
+ return this.delete(this.portalPath(portalId, 'settings', 'layouts', layoutId, 'sections'), body);
87
+ }
88
+
89
+ listFields(portalId: string | number, query: Record<string, unknown> & { module: string }): Promise<ZohoListResponse<ZohoCustomField>> {
90
+ return this.get(this.portalPath(portalId, 'settings', 'fields'), query);
91
+ }
92
+
93
+ createOrUpdateField(portalId: string | number, body: Record<string, unknown>): Promise<unknown> {
94
+ return this.put(this.portalPath(portalId, 'settings', 'fields'), body);
95
+ }
96
+
97
+ deleteField(portalId: string | number, body: Record<string, unknown>): Promise<unknown> {
98
+ return this.delete(this.portalPath(portalId, 'settings', 'fields'), body);
99
+ }
100
+
101
+ getAssociatedLayouts(portalId: string | number, fieldId: string | number, query: Record<string, unknown> & { module: string }): Promise<unknown> {
102
+ return this.get(this.portalPath(portalId, 'settings', 'fields', fieldId, 'associated-layouts'), query);
103
+ }
104
+
105
+ getOptionsListForField(portalId: string | number, query: Record<string, unknown> & { module: string; field: string | number }): Promise<ZohoListResponse<Record<string, unknown>>> {
106
+ return this.get(this.portalPath(portalId, 'settings', 'options'), query);
107
+ }
108
+
109
+ createBulkOptions(portalId: string | number, body: ModuleBulkOptionsRequest): Promise<unknown> {
110
+ return this.post(this.portalPath(portalId, 'settings', 'options'), body);
111
+ }
112
+
113
+ deleteOrDisassociateBulkOptions(portalId: string | number, body: ModuleBulkOptionsRequest): Promise<unknown> {
114
+ return this.delete(this.portalPath(portalId, 'settings', 'options'), body);
115
+ }
116
+
117
+ updateBulkOptions(portalId: string | number, body: ModuleBulkOptionsRequest): Promise<unknown> {
118
+ return this.patch(this.portalPath(portalId, 'settings', 'options'), body);
119
+ }
120
+
121
+ getModuleIntegrationField(portalId: string | number, serviceId: string | number, moduleId: string | number): Promise<unknown> {
122
+ return this.get(this.buildPath(['portal', portalId, 'integration-field', 'service', serviceId, 'module', moduleId, 'fields']));
123
+ }
124
+
125
+ getViews(portalId: string | number, viewId: string | number, query?: Record<string, unknown>): Promise<unknown> {
126
+ return this.get(this.portalPath(portalId, 'views', viewId), query);
127
+ }
128
+
129
+ getFieldInfoForModule(portalId: string | number, query: Record<string, unknown> & { module: string }): Promise<ZohoListResponse<ZohoCustomField>> {
130
+ return this.get(this.portalPath(portalId, 'settings', 'fields'), query);
131
+ }
132
+ }
@@ -0,0 +1,94 @@
1
+ import { ResourceBase } from '@/resource-base.ts';
2
+ import type { ZohoCommentPage, ZohoFilter, ZohoListResponse, ZohoPageParams, ZohoTaskList } from '@/types.ts';
3
+
4
+ export class TasklistsResource extends ResourceBase {
5
+ list(portalId: string | number, projectId: string | number, params: ZohoPageParams & { sort_by?: string; view_id?: string | number; filter?: ZohoFilter } = {}): Promise<ZohoListResponse<ZohoTaskList>> {
6
+ return this.get(this.projectPath(portalId, projectId, 'tasklists'), this.withFilter(params, params.filter));
7
+ }
8
+
9
+ getById(portalId: string | number, projectId: string | number, tasklistId: string | number): Promise<ZohoTaskList> {
10
+ return this.get(this.projectPath(portalId, projectId, 'tasklists', tasklistId));
11
+ }
12
+
13
+ create(portalId: string | number, projectId: string | number, body: Partial<ZohoTaskList>): Promise<ZohoTaskList> {
14
+ return this.post(this.projectPath(portalId, projectId, 'tasklists'), body);
15
+ }
16
+
17
+ createDefault(portalId: string | number, projectId: string | number, flag: 'internal' | 'external'): Promise<ZohoTaskList> {
18
+ return this.post(this.projectPath(portalId, projectId, 'default-tasklists'), { flag });
19
+ }
20
+
21
+ update(portalId: string | number, projectId: string | number, tasklistId: string | number, body: Partial<ZohoTaskList>): Promise<ZohoTaskList> {
22
+ return this.patch(this.projectPath(portalId, projectId, 'tasklists', tasklistId), body);
23
+ }
24
+
25
+ deleteById(portalId: string | number, projectId: string | number, tasklistId: string | number): Promise<unknown> {
26
+ return this.delete(this.projectPath(portalId, projectId, 'tasklists', tasklistId));
27
+ }
28
+
29
+ updateComment(
30
+ portalId: string | number,
31
+ projectId: string | number,
32
+ tasklistId: string | number,
33
+ commentId: string | number,
34
+ body: { comment: string; attachments?: Array<string | number> },
35
+ ): Promise<unknown> {
36
+ return this.patch(this.projectPath(portalId, projectId, 'tasklists', tasklistId, 'comments', commentId), body);
37
+ }
38
+
39
+ listAll(portalId: string | number, params: ZohoPageParams & { sort_by?: string; view_id?: string | number; filter?: ZohoFilter } = {}): Promise<ZohoListResponse<ZohoTaskList>> {
40
+ return this.get(this.portalPath(portalId, 'all-tasklists'), this.withFilter(params, params.filter));
41
+ }
42
+
43
+ getComments(
44
+ portalId: string | number,
45
+ projectId: string | number,
46
+ tasklistId: string | number,
47
+ params: ZohoPageParams & { sort_by?: string; filter?: ZohoFilter } = {},
48
+ ): Promise<ZohoCommentPage<Record<string, unknown>>> {
49
+ return this.get(this.projectPath(portalId, projectId, 'tasklists', tasklistId, 'comments'), this.withFilter(params, params.filter));
50
+ }
51
+
52
+ getComment(
53
+ portalId: string | number,
54
+ projectId: string | number,
55
+ tasklistId: string | number,
56
+ commentId: string | number,
57
+ ): Promise<Record<string, unknown>> {
58
+ return this.get(this.projectPath(portalId, projectId, 'tasklists', tasklistId, 'comments', commentId));
59
+ }
60
+
61
+ addComment(
62
+ portalId: string | number,
63
+ projectId: string | number,
64
+ tasklistId: string | number,
65
+ body: { content: string; attachments?: Array<string | number> },
66
+ ): Promise<unknown> {
67
+ return this.post(this.projectPath(portalId, projectId, 'tasklists', tasklistId, 'comments'), body);
68
+ }
69
+
70
+ deleteComment(
71
+ portalId: string | number,
72
+ projectId: string | number,
73
+ tasklistId: string | number,
74
+ commentId: string | number,
75
+ ): Promise<unknown> {
76
+ return this.delete(this.projectPath(portalId, projectId, 'tasklists', tasklistId, 'comments', commentId));
77
+ }
78
+
79
+ makeAsTemplate(portalId: string | number, projectId: string | number, tasklistId: string | number): Promise<unknown> {
80
+ return this.post(this.projectPath(portalId, projectId, 'tasklists', tasklistId, 'make-as-template'));
81
+ }
82
+
83
+ getFollowers(portalId: string | number, projectId: string | number, tasklistId: string | number, query?: Record<string, unknown>): Promise<unknown> {
84
+ return this.get(this.projectPath(portalId, projectId, 'tasklists', tasklistId, 'followers'), query);
85
+ }
86
+
87
+ addFollowers(portalId: string | number, projectId: string | number, tasklistId: string | number, body: Record<string, unknown>): Promise<unknown> {
88
+ return this.post(this.projectPath(portalId, projectId, 'tasklists', tasklistId, 'follow'), body);
89
+ }
90
+
91
+ removeFollowers(portalId: string | number, projectId: string | number, tasklistId: string | number, body: Record<string, unknown>): Promise<unknown> {
92
+ return this.delete(this.projectPath(portalId, projectId, 'tasklists', tasklistId, 'unfollow'), body);
93
+ }
94
+ }
@@ -0,0 +1,43 @@
1
+ import { ResourceBase } from '@/resource-base.ts';
2
+ import type { ZohoFilter, ZohoListResponse, ZohoPageParams, ZohoTask, ZohoTaskUpsertBody } from '@/types.ts';
3
+
4
+ export class TasksResource extends ResourceBase {
5
+ listAll(portalId: string | number, params: ZohoPageParams & { sort_by?: string; view_id?: string | number; filter?: ZohoFilter } = {}): Promise<ZohoListResponse<ZohoTask>> {
6
+ return this.get(this.portalPath(portalId, 'tasks'), this.withFilter(params, params.filter));
7
+ }
8
+
9
+ listMyTasks(portalId: string | number, params: ZohoPageParams & { sort_by?: string; view_id?: string | number; filter?: ZohoFilter } = {}): Promise<ZohoListResponse<ZohoTask>> {
10
+ return this.get(this.portalPath(portalId, 'mytasks'), this.withFilter(params, params.filter));
11
+ }
12
+
13
+ list(portalId: string | number, projectId: string | number, params: ZohoPageParams & { sort_by?: string; view_id?: string | number; filter?: ZohoFilter } = {}): Promise<ZohoListResponse<ZohoTask>> {
14
+ return this.get(this.projectPath(portalId, projectId, 'tasks'), this.withFilter(params, params.filter));
15
+ }
16
+
17
+ getById(portalId: string | number, projectId: string | number, taskId: string | number): Promise<ZohoTask> {
18
+ return this.get(this.projectPath(portalId, projectId, 'tasks', taskId));
19
+ }
20
+
21
+ create(portalId: string | number, projectId: string | number, body: ZohoTaskUpsertBody): Promise<ZohoTask> {
22
+ return this.post(this.projectPath(portalId, projectId, 'tasks'), body);
23
+ }
24
+
25
+ update(portalId: string | number, projectId: string | number, taskId: string | number, body: ZohoTaskUpsertBody): Promise<ZohoTask> {
26
+ return this.patch(this.projectPath(portalId, projectId, 'tasks', taskId), body);
27
+ }
28
+
29
+ deleteById(portalId: string | number, projectId: string | number, taskId: string | number): Promise<unknown> {
30
+ return this.delete(this.projectPath(portalId, projectId, 'tasks', taskId));
31
+ }
32
+
33
+ getStatusHistory(portalId: string | number, projectId: string | number, query?: Record<string, unknown>): Promise<unknown> {
34
+ return this.get(this.projectPath(portalId, projectId, 'taskstatushistory'), query);
35
+ }
36
+
37
+ getAssociatedTasksByIssues(portalId: string | number, issueIds: Array<string | number>, query?: Record<string, unknown>): Promise<unknown> {
38
+ return this.get(this.buildPath(['portal', portalId, 'issues', 'associated-tasks']), {
39
+ ...query,
40
+ issue_ids: issueIds,
41
+ });
42
+ }
43
+ }