@dereekb/zoho 13.7.0 → 13.9.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 (38) hide show
  1. package/cli/LICENSE +21 -0
  2. package/cli/index.js +4 -0
  3. package/cli/package.json +20 -0
  4. package/index.cjs.js +2553 -242
  5. package/index.esm.js +2490 -243
  6. package/nestjs/index.cjs.js +864 -203
  7. package/nestjs/index.esm.js +861 -205
  8. package/nestjs/package.json +6 -6
  9. package/nestjs/src/lib/desk/desk.api.d.ts +213 -0
  10. package/nestjs/src/lib/desk/desk.config.d.ts +27 -0
  11. package/nestjs/src/lib/desk/desk.module.d.ts +62 -0
  12. package/nestjs/src/lib/desk/index.d.ts +3 -0
  13. package/nestjs/src/lib/index.d.ts +1 -0
  14. package/package.json +13 -6
  15. package/src/lib/desk/desk.agent.d.ts +45 -0
  16. package/src/lib/desk/desk.api.activities.d.ts +43 -0
  17. package/src/lib/desk/desk.api.agents.d.ts +91 -0
  18. package/src/lib/desk/desk.api.attachments.d.ts +47 -0
  19. package/src/lib/desk/desk.api.comments.d.ts +86 -0
  20. package/src/lib/desk/desk.api.contacts.d.ts +81 -0
  21. package/src/lib/desk/desk.api.departments.d.ts +47 -0
  22. package/src/lib/desk/desk.api.followers.d.ts +57 -0
  23. package/src/lib/desk/desk.api.page.d.ts +72 -0
  24. package/src/lib/desk/desk.api.tags.d.ts +102 -0
  25. package/src/lib/desk/desk.api.threads.d.ts +60 -0
  26. package/src/lib/desk/desk.api.tickets.d.ts +227 -0
  27. package/src/lib/desk/desk.api.time.d.ts +109 -0
  28. package/src/lib/desk/desk.config.d.ts +75 -0
  29. package/src/lib/desk/desk.contact.d.ts +50 -0
  30. package/src/lib/desk/desk.d.ts +44 -0
  31. package/src/lib/desk/desk.department.d.ts +27 -0
  32. package/src/lib/desk/desk.error.api.d.ts +33 -0
  33. package/src/lib/desk/desk.factory.d.ts +47 -0
  34. package/src/lib/desk/desk.limit.d.ts +39 -0
  35. package/src/lib/desk/desk.ticket.d.ts +308 -0
  36. package/src/lib/desk/index.d.ts +21 -0
  37. package/src/lib/index.d.ts +1 -0
  38. package/src/lib/zoho.limit.d.ts +66 -10
@@ -0,0 +1,86 @@
1
+ import { type ArrayOrValue } from '@dereekb/util';
2
+ import { type ZohoDeskContext } from './desk.config';
3
+ import { type ZohoDeskTicketId } from './desk';
4
+ import { type ZohoDeskTicketComment, type ZohoDeskCommentSortBy, type ZohoDeskCommentInclude, type ZohoDeskCommentContentType } from './desk.ticket';
5
+ import { type ZohoDeskPageFilter, type ZohoDeskPageResult } from './desk.api.page';
6
+ /**
7
+ * Input parameters for listing comments on a ticket via `GET /tickets/{ticketId}/comments`.
8
+ */
9
+ export interface ZohoDeskGetTicketCommentsInput extends ZohoDeskPageFilter {
10
+ readonly ticketId: ZohoDeskTicketId;
11
+ readonly sortBy?: ZohoDeskCommentSortBy;
12
+ readonly include?: ArrayOrValue<ZohoDeskCommentInclude>;
13
+ }
14
+ /**
15
+ * Response from listing ticket comments.
16
+ */
17
+ export type ZohoDeskGetTicketCommentsResponse = ZohoDeskPageResult<ZohoDeskTicketComment>;
18
+ /**
19
+ * Function that retrieves comments for a specific ticket.
20
+ */
21
+ export type ZohoDeskGetTicketCommentsFunction = (input: ZohoDeskGetTicketCommentsInput) => Promise<ZohoDeskGetTicketCommentsResponse>;
22
+ /**
23
+ * Creates a {@link ZohoDeskGetTicketCommentsFunction} bound to the given context.
24
+ *
25
+ * @param context - Authenticated Zoho Desk context
26
+ * @returns Function that retrieves comments for a ticket
27
+ */
28
+ export declare function zohoDeskGetTicketComments(context: ZohoDeskContext): ZohoDeskGetTicketCommentsFunction;
29
+ /**
30
+ * Input parameters for retrieving a single comment via `GET /tickets/{ticketId}/comments/{commentId}`.
31
+ */
32
+ export interface ZohoDeskGetTicketCommentByIdInput {
33
+ readonly ticketId: ZohoDeskTicketId;
34
+ readonly commentId: string;
35
+ readonly include?: ArrayOrValue<ZohoDeskCommentInclude>;
36
+ }
37
+ /**
38
+ * Function that retrieves a single comment by ID.
39
+ */
40
+ export type ZohoDeskGetTicketCommentByIdFunction = (input: ZohoDeskGetTicketCommentByIdInput) => Promise<ZohoDeskTicketComment>;
41
+ /**
42
+ * Creates a {@link ZohoDeskGetTicketCommentByIdFunction} bound to the given context.
43
+ *
44
+ * @param context - Authenticated Zoho Desk context
45
+ * @returns Function that retrieves a single comment
46
+ */
47
+ export declare function zohoDeskGetTicketCommentById(context: ZohoDeskContext): ZohoDeskGetTicketCommentByIdFunction;
48
+ /**
49
+ * Input parameters for creating a comment on a ticket via `POST /tickets/{ticketId}/comments`.
50
+ */
51
+ export interface ZohoDeskCreateTicketCommentInput {
52
+ readonly ticketId: ZohoDeskTicketId;
53
+ readonly content: string;
54
+ readonly isPublic?: boolean;
55
+ readonly contentType?: ZohoDeskCommentContentType;
56
+ readonly attachmentIds?: string[];
57
+ }
58
+ /**
59
+ * Function that creates a comment on a ticket.
60
+ */
61
+ export type ZohoDeskCreateTicketCommentFunction = (input: ZohoDeskCreateTicketCommentInput) => Promise<ZohoDeskTicketComment>;
62
+ /**
63
+ * Creates a {@link ZohoDeskCreateTicketCommentFunction} bound to the given context.
64
+ *
65
+ * @param context - Authenticated Zoho Desk context
66
+ * @returns Function that creates a comment on a ticket
67
+ */
68
+ export declare function zohoDeskCreateTicketComment(context: ZohoDeskContext): ZohoDeskCreateTicketCommentFunction;
69
+ /**
70
+ * Input parameters for deleting a comment from a ticket via `DELETE /tickets/{ticketId}/comments/{commentId}`.
71
+ */
72
+ export interface ZohoDeskDeleteTicketCommentInput {
73
+ readonly ticketId: ZohoDeskTicketId;
74
+ readonly commentId: string;
75
+ }
76
+ /**
77
+ * Function that deletes a comment from a ticket.
78
+ */
79
+ export type ZohoDeskDeleteTicketCommentFunction = (input: ZohoDeskDeleteTicketCommentInput) => Promise<void>;
80
+ /**
81
+ * Creates a {@link ZohoDeskDeleteTicketCommentFunction} bound to the given context.
82
+ *
83
+ * @param context - Authenticated Zoho Desk context
84
+ * @returns Function that deletes a comment from a ticket
85
+ */
86
+ export declare function zohoDeskDeleteTicketComment(context: ZohoDeskContext): ZohoDeskDeleteTicketCommentFunction;
@@ -0,0 +1,81 @@
1
+ import { type Maybe, type ArrayOrValue } from '@dereekb/util';
2
+ import { type FetchPage, type FetchPageFactoryOptions } from '@dereekb/util/fetch';
3
+ import { type ZohoDeskContext } from './desk.config';
4
+ import { type ZohoDeskContactId } from './desk';
5
+ import { type ZohoDeskContact, type ZohoDeskContactSortBy, type ZohoDeskContactInclude } from './desk.contact';
6
+ import { type ZohoDeskPageFilter, type ZohoDeskPageResult } from './desk.api.page';
7
+ /**
8
+ * Input parameters for listing contacts via `GET /contacts`.
9
+ */
10
+ export interface ZohoDeskGetContactsInput extends ZohoDeskPageFilter {
11
+ readonly sortBy?: ZohoDeskContactSortBy;
12
+ readonly include?: ArrayOrValue<ZohoDeskContactInclude>;
13
+ readonly viewId?: string;
14
+ readonly fields?: string;
15
+ }
16
+ /**
17
+ * Response from listing contacts.
18
+ */
19
+ export type ZohoDeskGetContactsResponse = ZohoDeskPageResult<ZohoDeskContact>;
20
+ /**
21
+ * Function that retrieves a paginated list of contacts.
22
+ */
23
+ export type ZohoDeskGetContactsFunction = (input: ZohoDeskGetContactsInput) => Promise<ZohoDeskGetContactsResponse>;
24
+ /**
25
+ * Creates a {@link ZohoDeskGetContactsFunction} bound to the given context.
26
+ *
27
+ * Retrieves a paginated list of contacts from Zoho Desk, with optional sorting,
28
+ * inline expansion of related entities, and custom view filtering.
29
+ *
30
+ * @param context - Authenticated Zoho Desk context
31
+ * @returns Function that retrieves paginated contacts
32
+ */
33
+ export declare function zohoDeskGetContacts(context: ZohoDeskContext): ZohoDeskGetContactsFunction;
34
+ /**
35
+ * Input parameters for retrieving a single contact via `GET /contacts/{contactId}`.
36
+ */
37
+ export interface ZohoDeskGetContactByIdInput {
38
+ readonly contactId: ZohoDeskContactId;
39
+ readonly include?: ArrayOrValue<ZohoDeskContactInclude>;
40
+ }
41
+ /**
42
+ * Function that retrieves a single contact by ID.
43
+ */
44
+ export type ZohoDeskGetContactByIdFunction = (input: ZohoDeskGetContactByIdInput) => Promise<ZohoDeskContact>;
45
+ /**
46
+ * Creates a {@link ZohoDeskGetContactByIdFunction} bound to the given context.
47
+ *
48
+ * @param context - Authenticated Zoho Desk context
49
+ * @returns Function that retrieves a single contact
50
+ */
51
+ export declare function zohoDeskGetContactById(context: ZohoDeskContext): ZohoDeskGetContactByIdFunction;
52
+ /**
53
+ * Input parameters for retrieving multiple contacts by their IDs via `GET /contacts/contactsByIds`.
54
+ */
55
+ export interface ZohoDeskGetContactsByIdsInput {
56
+ readonly contactIds: ArrayOrValue<ZohoDeskContactId>;
57
+ }
58
+ /**
59
+ * Function that retrieves multiple contacts by their IDs.
60
+ */
61
+ export type ZohoDeskGetContactsByIdsFunction = (input: ZohoDeskGetContactsByIdsInput) => Promise<ZohoDeskContact[]>;
62
+ /**
63
+ * Creates a {@link ZohoDeskGetContactsByIdsFunction} bound to the given context.
64
+ *
65
+ * Retrieves multiple contacts in a single request by providing their IDs.
66
+ *
67
+ * @param context - Authenticated Zoho Desk context
68
+ * @returns Function that retrieves contacts by IDs
69
+ */
70
+ export declare function zohoDeskGetContactsByIds(context: ZohoDeskContext): ZohoDeskGetContactsByIdsFunction;
71
+ /**
72
+ * Factory that creates paginated iterators for contact list queries.
73
+ */
74
+ export type ZohoDeskGetContactsPageFactory = (input: ZohoDeskGetContactsInput, options?: Maybe<FetchPageFactoryOptions<ZohoDeskGetContactsInput, ZohoDeskGetContactsResponse>>) => FetchPage<ZohoDeskGetContactsInput, ZohoDeskGetContactsResponse>;
75
+ /**
76
+ * Creates a {@link ZohoDeskGetContactsPageFactory} bound to the given context.
77
+ *
78
+ * @param context - Authenticated Zoho Desk context
79
+ * @returns Page factory for iterating over contact results
80
+ */
81
+ export declare function zohoDeskGetContactsPageFactory(context: ZohoDeskContext): ZohoDeskGetContactsPageFactory;
@@ -0,0 +1,47 @@
1
+ import { type ZohoDeskContext } from './desk.config';
2
+ import { type ZohoDeskDepartmentId } from './desk';
3
+ import { type ZohoDeskDepartment, type ZohoDeskDepartmentChatStatus } from './desk.department';
4
+ import { type ZohoDeskPageFilter, type ZohoDeskPageResult } from './desk.api.page';
5
+ /**
6
+ * Input parameters for listing departments via `GET /departments`.
7
+ */
8
+ export interface ZohoDeskGetDepartmentsInput extends ZohoDeskPageFilter {
9
+ readonly chatStatus?: ZohoDeskDepartmentChatStatus;
10
+ readonly searchStr?: string;
11
+ readonly isEnabled?: boolean;
12
+ }
13
+ /**
14
+ * Response from listing departments.
15
+ */
16
+ export type ZohoDeskGetDepartmentsResponse = ZohoDeskPageResult<ZohoDeskDepartment>;
17
+ /**
18
+ * Function that retrieves a paginated list of departments.
19
+ */
20
+ export type ZohoDeskGetDepartmentsFunction = (input: ZohoDeskGetDepartmentsInput) => Promise<ZohoDeskGetDepartmentsResponse>;
21
+ /**
22
+ * Creates a {@link ZohoDeskGetDepartmentsFunction} bound to the given context.
23
+ *
24
+ * Retrieves a paginated list of departments from Zoho Desk, with optional filtering
25
+ * by chat status, search string, and enabled state.
26
+ *
27
+ * @param context - Authenticated Zoho Desk context
28
+ * @returns Function that retrieves paginated departments
29
+ */
30
+ export declare function zohoDeskGetDepartments(context: ZohoDeskContext): ZohoDeskGetDepartmentsFunction;
31
+ /**
32
+ * Input parameters for retrieving a single department via `GET /departments/{departmentId}`.
33
+ */
34
+ export interface ZohoDeskGetDepartmentByIdInput {
35
+ readonly departmentId: ZohoDeskDepartmentId;
36
+ }
37
+ /**
38
+ * Function that retrieves a single department by ID.
39
+ */
40
+ export type ZohoDeskGetDepartmentByIdFunction = (input: ZohoDeskGetDepartmentByIdInput) => Promise<ZohoDeskDepartment>;
41
+ /**
42
+ * Creates a {@link ZohoDeskGetDepartmentByIdFunction} bound to the given context.
43
+ *
44
+ * @param context - Authenticated Zoho Desk context
45
+ * @returns Function that retrieves a single department
46
+ */
47
+ export declare function zohoDeskGetDepartmentById(context: ZohoDeskContext): ZohoDeskGetDepartmentByIdFunction;
@@ -0,0 +1,57 @@
1
+ import { type ArrayOrValue } from '@dereekb/util';
2
+ import { type ZohoDeskContext } from './desk.config';
3
+ import { type ZohoDeskTicketId, type ZohoDeskAgentId } from './desk';
4
+ import { type ZohoDeskTicketFollower } from './desk.ticket';
5
+ /**
6
+ * Input parameters for listing followers of a ticket via `GET /tickets/{ticketId}/followers`.
7
+ */
8
+ export interface ZohoDeskGetTicketFollowersInput {
9
+ readonly ticketId: ZohoDeskTicketId;
10
+ }
11
+ /**
12
+ * Function that retrieves followers for a specific ticket.
13
+ */
14
+ export type ZohoDeskGetTicketFollowersFunction = (input: ZohoDeskGetTicketFollowersInput) => Promise<ZohoDeskTicketFollower[]>;
15
+ /**
16
+ * Creates a {@link ZohoDeskGetTicketFollowersFunction} bound to the given context.
17
+ *
18
+ * @param context - Authenticated Zoho Desk context
19
+ * @returns Function that retrieves followers for a ticket
20
+ */
21
+ export declare function zohoDeskGetTicketFollowers(context: ZohoDeskContext): ZohoDeskGetTicketFollowersFunction;
22
+ /**
23
+ * Input parameters for adding followers to a ticket via `POST /tickets/{ticketId}/followers`.
24
+ */
25
+ export interface ZohoDeskAddTicketFollowersInput {
26
+ readonly ticketId: ZohoDeskTicketId;
27
+ readonly agentIds: ArrayOrValue<ZohoDeskAgentId>;
28
+ }
29
+ /**
30
+ * Function that adds followers to a ticket.
31
+ */
32
+ export type ZohoDeskAddTicketFollowersFunction = (input: ZohoDeskAddTicketFollowersInput) => Promise<void>;
33
+ /**
34
+ * Creates a {@link ZohoDeskAddTicketFollowersFunction} bound to the given context.
35
+ *
36
+ * @param context - Authenticated Zoho Desk context
37
+ * @returns Function that adds followers to a ticket
38
+ */
39
+ export declare function zohoDeskAddTicketFollowers(context: ZohoDeskContext): ZohoDeskAddTicketFollowersFunction;
40
+ /**
41
+ * Input parameters for removing followers from a ticket via `DELETE /tickets/{ticketId}/followers`.
42
+ */
43
+ export interface ZohoDeskRemoveTicketFollowersInput {
44
+ readonly ticketId: ZohoDeskTicketId;
45
+ readonly agentIds: ArrayOrValue<ZohoDeskAgentId>;
46
+ }
47
+ /**
48
+ * Function that removes followers from a ticket.
49
+ */
50
+ export type ZohoDeskRemoveTicketFollowersFunction = (input: ZohoDeskRemoveTicketFollowersInput) => Promise<void>;
51
+ /**
52
+ * Creates a {@link ZohoDeskRemoveTicketFollowersFunction} bound to the given context.
53
+ *
54
+ * @param context - Authenticated Zoho Desk context
55
+ * @returns Function that removes followers from a ticket
56
+ */
57
+ export declare function zohoDeskRemoveTicketFollowers(context: ZohoDeskContext): ZohoDeskRemoveTicketFollowersFunction;
@@ -0,0 +1,72 @@
1
+ import { type Maybe } from '@dereekb/util';
2
+ import { type FetchPageFactoryConfigDefaults } from '@dereekb/util/fetch';
3
+ /**
4
+ * Maximum number of records per page for Zoho Desk list endpoints.
5
+ */
6
+ export declare const ZOHO_DESK_MAX_PAGE_LIMIT = 50;
7
+ /**
8
+ * Default number of records per page for Zoho Desk list endpoints.
9
+ */
10
+ export declare const ZOHO_DESK_DEFAULT_PAGE_LIMIT = 25;
11
+ /**
12
+ * Pagination parameters for Zoho Desk list endpoints.
13
+ *
14
+ * Unlike CRM/Recruit which use `page`/`per_page`, Zoho Desk uses an offset-based
15
+ * model with `from` (1-based offset) and `limit` (max 50).
16
+ */
17
+ export interface ZohoDeskPageFilter {
18
+ /**
19
+ * 1-based offset index of the first record to return.
20
+ *
21
+ * Defaults to 1.
22
+ */
23
+ readonly from?: number;
24
+ /**
25
+ * Number of records to return per page.
26
+ *
27
+ * Defaults to {@link ZOHO_DESK_DEFAULT_PAGE_LIMIT}. Maximum is {@link ZOHO_DESK_MAX_PAGE_LIMIT}.
28
+ */
29
+ readonly limit?: number;
30
+ }
31
+ /**
32
+ * Paginated response from a Zoho Desk list endpoint.
33
+ *
34
+ * Zoho Desk returns records as a plain array in the `data` key.
35
+ * Unlike CRM, there is no `more_records` metadata; pagination is determined
36
+ * by comparing the returned array length against the requested limit.
37
+ */
38
+ export interface ZohoDeskPageResult<T> {
39
+ /**
40
+ * Array of records for the current page.
41
+ */
42
+ readonly data: T[];
43
+ }
44
+ /**
45
+ * A fetch function that accepts paginated input and returns a {@link ZohoDeskPageResult}.
46
+ * Used as the underlying data source for {@link zohoDeskFetchPageFactory}.
47
+ */
48
+ export type ZohoDeskFetchPageFetchFunction<I extends ZohoDeskPageFilter, R extends ZohoDeskPageResult<any>> = (input: I) => Promise<R>;
49
+ /**
50
+ * Creates a page factory that wraps a Zoho Desk fetch function with automatic offset-based pagination.
51
+ *
52
+ * The factory determines whether additional pages exist by comparing the number of returned records
53
+ * against the requested `limit`. If `data.length >= limit`, more records are assumed to exist.
54
+ * The `from` offset is automatically advanced by `limit` for subsequent requests.
55
+ *
56
+ * @param fetch - The Zoho Desk fetch function to paginate over
57
+ * @param defaults - Optional default configuration for the page factory
58
+ * @returns A page factory that produces iterable page fetchers
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const pageFactory = zohoDeskFetchPageFactory(zohoDeskGetTickets(context));
63
+ *
64
+ * const fetchPage = pageFactory({ limit: 25 });
65
+ * const firstPage = await fetchPage.fetchNext();
66
+ *
67
+ * if (firstPage.result.data.length >= 25) {
68
+ * const secondPage = await firstPage.fetchNext();
69
+ * }
70
+ * ```
71
+ */
72
+ export declare function zohoDeskFetchPageFactory<I extends ZohoDeskPageFilter, R extends ZohoDeskPageResult<any>>(fetch: ZohoDeskFetchPageFetchFunction<I, R>, defaults?: Maybe<FetchPageFactoryConfigDefaults>): import("@dereekb/util/fetch").FetchPageFactory<I, R>;
@@ -0,0 +1,102 @@
1
+ import { type ArrayOrValue } from '@dereekb/util';
2
+ import { type ZohoDeskContext } from './desk.config';
3
+ import { type ZohoDeskTicketId, type ZohoDeskDepartmentId } from './desk';
4
+ import { type ZohoDeskTicketTag } from './desk.ticket';
5
+ import { type ZohoDeskPageFilter, type ZohoDeskPageResult } from './desk.api.page';
6
+ /**
7
+ * Input parameters for listing tags on a ticket via `GET /tickets/{ticketId}/tags`.
8
+ */
9
+ export interface ZohoDeskGetTicketTagsInput {
10
+ readonly ticketId: ZohoDeskTicketId;
11
+ }
12
+ /**
13
+ * Function that retrieves tags for a specific ticket.
14
+ */
15
+ export type ZohoDeskGetTicketTagsFunction = (input: ZohoDeskGetTicketTagsInput) => Promise<ZohoDeskTicketTag[]>;
16
+ /**
17
+ * Creates a {@link ZohoDeskGetTicketTagsFunction} bound to the given context.
18
+ *
19
+ * @param context - Authenticated Zoho Desk context
20
+ * @returns Function that retrieves tags for a ticket
21
+ */
22
+ export declare function zohoDeskGetTicketTags(context: ZohoDeskContext): ZohoDeskGetTicketTagsFunction;
23
+ /**
24
+ * Input parameters for associating tags with a ticket via `POST /tickets/{ticketId}/tags`.
25
+ */
26
+ export interface ZohoDeskAssociateTicketTagsInput {
27
+ readonly ticketId: ZohoDeskTicketId;
28
+ readonly tags: ArrayOrValue<string>;
29
+ }
30
+ /**
31
+ * Function that associates tags with a ticket.
32
+ */
33
+ export type ZohoDeskAssociateTicketTagsFunction = (input: ZohoDeskAssociateTicketTagsInput) => Promise<ZohoDeskTicketTag[]>;
34
+ /**
35
+ * Creates a {@link ZohoDeskAssociateTicketTagsFunction} bound to the given context.
36
+ *
37
+ * Associates one or more tags with a ticket. If the tag does not exist, it will be created.
38
+ *
39
+ * @param context - Authenticated Zoho Desk context
40
+ * @returns Function that associates tags with a ticket
41
+ */
42
+ export declare function zohoDeskAssociateTicketTags(context: ZohoDeskContext): ZohoDeskAssociateTicketTagsFunction;
43
+ /**
44
+ * Input parameters for removing a tag from a ticket via `DELETE /tickets/{ticketId}/tags/{tagId}`.
45
+ */
46
+ export interface ZohoDeskDissociateTicketTagInput {
47
+ readonly ticketId: ZohoDeskTicketId;
48
+ readonly tagId: string;
49
+ }
50
+ /**
51
+ * Function that removes a tag from a ticket.
52
+ */
53
+ export type ZohoDeskDissociateTicketTagFunction = (input: ZohoDeskDissociateTicketTagInput) => Promise<void>;
54
+ /**
55
+ * Creates a {@link ZohoDeskDissociateTicketTagFunction} bound to the given context.
56
+ *
57
+ * @param context - Authenticated Zoho Desk context
58
+ * @returns Function that removes a tag from a ticket
59
+ */
60
+ export declare function zohoDeskDissociateTicketTag(context: ZohoDeskContext): ZohoDeskDissociateTicketTagFunction;
61
+ /**
62
+ * Input parameters for searching tags via `GET /tags/search`.
63
+ */
64
+ export interface ZohoDeskSearchTagsInput extends ZohoDeskPageFilter {
65
+ readonly departmentId?: ZohoDeskDepartmentId;
66
+ readonly searchVal?: string;
67
+ }
68
+ /**
69
+ * Function that searches for ticket tags.
70
+ */
71
+ export type ZohoDeskSearchTagsFunction = (input: ZohoDeskSearchTagsInput) => Promise<ZohoDeskPageResult<ZohoDeskTicketTag>>;
72
+ /**
73
+ * Creates a {@link ZohoDeskSearchTagsFunction} bound to the given context.
74
+ *
75
+ * @param context - Authenticated Zoho Desk context
76
+ * @returns Function that searches for tags
77
+ */
78
+ export declare function zohoDeskSearchTags(context: ZohoDeskContext): ZohoDeskSearchTagsFunction;
79
+ /**
80
+ * Input parameters for listing all ticket tags via `GET /ticketTags`.
81
+ *
82
+ * The Zoho Desk API requires `departmentId` for this endpoint.
83
+ */
84
+ export interface ZohoDeskGetAllTagsInput extends ZohoDeskPageFilter {
85
+ readonly departmentId: ZohoDeskDepartmentId;
86
+ readonly sortBy?: ZohoDeskTicketTagSortBy;
87
+ }
88
+ /**
89
+ * Sort keys for ticket tags.
90
+ */
91
+ export type ZohoDeskTicketTagSortBy = 'createdTime' | 'count';
92
+ /**
93
+ * Function that retrieves all ticket tags.
94
+ */
95
+ export type ZohoDeskGetAllTagsFunction = (input: ZohoDeskGetAllTagsInput) => Promise<ZohoDeskPageResult<ZohoDeskTicketTag>>;
96
+ /**
97
+ * Creates a {@link ZohoDeskGetAllTagsFunction} bound to the given context.
98
+ *
99
+ * @param context - Authenticated Zoho Desk context
100
+ * @returns Function that retrieves all tags
101
+ */
102
+ export declare function zohoDeskGetAllTags(context: ZohoDeskContext): ZohoDeskGetAllTagsFunction;
@@ -0,0 +1,60 @@
1
+ import { type Maybe, type ArrayOrValue } from '@dereekb/util';
2
+ import { type FetchPage, type FetchPageFactoryOptions } from '@dereekb/util/fetch';
3
+ import { type ZohoDeskContext } from './desk.config';
4
+ import { type ZohoDeskTicketId } from './desk';
5
+ import { type ZohoDeskTicketThread, type ZohoDeskThreadInclude } from './desk.ticket';
6
+ import { type ZohoDeskPageFilter, type ZohoDeskPageResult } from './desk.api.page';
7
+ /**
8
+ * Input parameters for listing threads on a ticket via `GET /tickets/{ticketId}/threads`.
9
+ */
10
+ export interface ZohoDeskGetTicketThreadsInput extends ZohoDeskPageFilter {
11
+ readonly ticketId: ZohoDeskTicketId;
12
+ readonly include?: ArrayOrValue<ZohoDeskThreadInclude>;
13
+ }
14
+ /**
15
+ * Response from listing ticket threads.
16
+ */
17
+ export type ZohoDeskGetTicketThreadsResponse = ZohoDeskPageResult<ZohoDeskTicketThread>;
18
+ /**
19
+ * Function that retrieves threads for a specific ticket.
20
+ */
21
+ export type ZohoDeskGetTicketThreadsFunction = (input: ZohoDeskGetTicketThreadsInput) => Promise<ZohoDeskGetTicketThreadsResponse>;
22
+ /**
23
+ * Creates a {@link ZohoDeskGetTicketThreadsFunction} bound to the given context.
24
+ *
25
+ * Retrieves a paginated list of conversation threads (emails, replies, notes) for a ticket.
26
+ *
27
+ * @param context - Authenticated Zoho Desk context
28
+ * @returns Function that retrieves threads for a ticket
29
+ */
30
+ export declare function zohoDeskGetTicketThreads(context: ZohoDeskContext): ZohoDeskGetTicketThreadsFunction;
31
+ /**
32
+ * Input parameters for retrieving a single thread via `GET /tickets/{ticketId}/threads/{threadId}`.
33
+ */
34
+ export interface ZohoDeskGetTicketThreadByIdInput {
35
+ readonly ticketId: ZohoDeskTicketId;
36
+ readonly threadId: string;
37
+ readonly include?: ArrayOrValue<ZohoDeskThreadInclude>;
38
+ }
39
+ /**
40
+ * Function that retrieves a single thread by ID.
41
+ */
42
+ export type ZohoDeskGetTicketThreadByIdFunction = (input: ZohoDeskGetTicketThreadByIdInput) => Promise<ZohoDeskTicketThread>;
43
+ /**
44
+ * Creates a {@link ZohoDeskGetTicketThreadByIdFunction} bound to the given context.
45
+ *
46
+ * @param context - Authenticated Zoho Desk context
47
+ * @returns Function that retrieves a single thread
48
+ */
49
+ export declare function zohoDeskGetTicketThreadById(context: ZohoDeskContext): ZohoDeskGetTicketThreadByIdFunction;
50
+ /**
51
+ * Factory that creates paginated iterators for ticket thread queries.
52
+ */
53
+ export type ZohoDeskGetTicketThreadsPageFactory = (input: ZohoDeskGetTicketThreadsInput, options?: Maybe<FetchPageFactoryOptions<ZohoDeskGetTicketThreadsInput, ZohoDeskGetTicketThreadsResponse>>) => FetchPage<ZohoDeskGetTicketThreadsInput, ZohoDeskGetTicketThreadsResponse>;
54
+ /**
55
+ * Creates a {@link ZohoDeskGetTicketThreadsPageFactory} bound to the given context.
56
+ *
57
+ * @param context - Authenticated Zoho Desk context
58
+ * @returns Page factory for iterating over thread results
59
+ */
60
+ export declare function zohoDeskGetTicketThreadsPageFactory(context: ZohoDeskContext): ZohoDeskGetTicketThreadsPageFactory;