@dereekb/zoho 13.0.5 → 13.0.7

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 (56) hide show
  1. package/index.cjs.js +2164 -231
  2. package/index.esm.js +2143 -232
  3. package/nestjs/LICENSE +21 -0
  4. package/nestjs/README.md +11 -0
  5. package/nestjs/docs/configuration.md +165 -0
  6. package/nestjs/docs/crm-getting-started.md +296 -0
  7. package/nestjs/index.cjs.js +653 -5
  8. package/nestjs/index.esm.js +647 -7
  9. package/nestjs/package.json +3 -3
  10. package/nestjs/src/lib/crm/crm.api.d.ts +46 -0
  11. package/nestjs/src/lib/crm/crm.config.d.ts +16 -1
  12. package/nestjs/src/lib/crm/crm.module.d.ts +77 -8
  13. package/nestjs/src/lib/index.d.ts +2 -0
  14. package/nestjs/src/lib/recruit/recruit.api.d.ts +50 -0
  15. package/nestjs/src/lib/recruit/recruit.config.d.ts +16 -1
  16. package/nestjs/src/lib/recruit/recruit.module.d.ts +77 -8
  17. package/nestjs/src/lib/sign/index.d.ts +3 -0
  18. package/nestjs/src/lib/sign/sign.api.d.ts +54 -0
  19. package/nestjs/src/lib/sign/sign.config.d.ts +10 -0
  20. package/nestjs/src/lib/sign/sign.module.d.ts +94 -0
  21. package/package.json +2 -2
  22. package/src/lib/accounts/accounts.api.d.ts +149 -3
  23. package/src/lib/accounts/accounts.factory.d.ts +73 -6
  24. package/src/lib/crm/crm.api.d.ts +599 -62
  25. package/src/lib/crm/crm.api.notes.d.ts +46 -3
  26. package/src/lib/crm/crm.api.tags.d.ts +65 -2
  27. package/src/lib/crm/crm.config.d.ts +30 -0
  28. package/src/lib/crm/crm.criteria.d.ts +60 -3
  29. package/src/lib/crm/crm.error.api.d.ts +42 -0
  30. package/src/lib/crm/crm.factory.d.ts +39 -3
  31. package/src/lib/crm/crm.notes.d.ts +36 -0
  32. package/src/lib/crm/crm.tags.d.ts +3 -0
  33. package/src/lib/index.d.ts +1 -0
  34. package/src/lib/recruit/recruit.api.candidates.d.ts +44 -3
  35. package/src/lib/recruit/recruit.api.d.ts +719 -57
  36. package/src/lib/recruit/recruit.api.notes.d.ts +140 -0
  37. package/src/lib/recruit/recruit.api.tags.d.ts +122 -14
  38. package/src/lib/recruit/recruit.config.d.ts +30 -0
  39. package/src/lib/recruit/recruit.criteria.d.ts +55 -3
  40. package/src/lib/recruit/recruit.error.api.d.ts +39 -0
  41. package/src/lib/recruit/recruit.factory.d.ts +39 -3
  42. package/src/lib/recruit/recruit.notes.d.ts +21 -0
  43. package/src/lib/recruit/recruit.tags.d.ts +3 -0
  44. package/src/lib/shared/criteria.d.ts +95 -11
  45. package/src/lib/shared/criteria.util.d.ts +19 -4
  46. package/src/lib/sign/index.d.ts +6 -0
  47. package/src/lib/sign/sign.api.d.ts +397 -0
  48. package/src/lib/sign/sign.api.page.d.ts +109 -0
  49. package/src/lib/sign/sign.config.d.ts +24 -0
  50. package/src/lib/sign/sign.d.ts +225 -0
  51. package/src/lib/sign/sign.error.api.d.ts +7 -0
  52. package/src/lib/sign/sign.factory.d.ts +58 -0
  53. package/src/lib/zoho.api.page.d.ts +41 -10
  54. package/src/lib/zoho.config.d.ts +24 -9
  55. package/src/lib/zoho.limit.d.ts +41 -9
  56. package/src/lib/zoho.type.d.ts +24 -8
@@ -13,115 +13,311 @@ import { BaseError } from 'make-error';
13
13
  * This is a limit enforced by the Zoho Recruit API
14
14
  */
15
15
  export declare const ZOHO_RECRUIT_CRUD_FUNCTION_MAX_RECORDS_LIMIT = 100;
16
+ /**
17
+ * Paired success/error result from a bulk record update, upsert, or insert operation.
18
+ */
16
19
  export type ZohoRecruitUpdateRecordResult<T> = ZohoRecruitMultiRecordResult<T, ZohoRecruitChangeObjectResponseSuccessEntry, ZohoRecruitChangeObjectResponseErrorEntry>;
20
+ /**
21
+ * Raw API response from record change operations (insert/update/upsert).
22
+ */
17
23
  export type ZohoRecruitUpdateRecordResponse = ZohoRecruitChangeObjectResponse;
24
+ /**
25
+ * Record data with the `id` field omitted, used for creating new records.
26
+ */
18
27
  export type ZohoRecruitCreateRecordData<T> = Omit<T, 'id'>;
28
+ /**
29
+ * Input for inserting a single record into a module.
30
+ */
19
31
  export interface ZohoRecruitCreateSingleRecordInput<T> extends ZohoRecruitModuleNameRef {
20
32
  readonly data: ZohoRecruitCreateRecordData<T>;
21
33
  }
34
+ /**
35
+ * Input for inserting multiple records into a module in a single API call.
36
+ */
22
37
  export interface ZohoRecruitCreateMultiRecordInput<T> extends ZohoRecruitModuleNameRef {
23
38
  readonly data: ZohoRecruitCreateRecordData<T>[];
24
39
  }
40
+ /**
41
+ * Overloaded function signature supporting both single and multi-record creation.
42
+ */
25
43
  export type ZohoRecruitCreateRecordLikeFunction = ZohoRecruitCreateMultiRecordFunction & ZohoRecruitCreateSingleRecordFunction;
26
44
  export type ZohoRecruitCreateSingleRecordFunction = <T>(input: ZohoRecruitCreateSingleRecordInput<T>) => Promise<ZohoRecruitChangeObjectDetails>;
27
45
  export type ZohoRecruitCreateMultiRecordFunction = <T>(input: ZohoRecruitCreateMultiRecordInput<T>) => Promise<ZohoRecruitUpdateRecordResult<T>>;
46
+ /**
47
+ * Union of single or multi-record update input types.
48
+ */
28
49
  export type ZohoRecruitUpdateRecordInput<T> = ZohoRecruitUpdateSingleRecordInput<T> | ZohoRecruitUpdateMultiRecordInput<T>;
50
+ /**
51
+ * Record data that requires an `id` field for identifying which record to update.
52
+ */
29
53
  export type ZohoRecruitUpdateRecordData<T> = UniqueModelWithId & Partial<T>;
54
+ /**
55
+ * Input for updating a single record in a module.
56
+ */
30
57
  export interface ZohoRecruitUpdateSingleRecordInput<T> extends ZohoRecruitModuleNameRef {
31
58
  readonly data: ZohoRecruitUpdateRecordData<T>;
32
59
  }
60
+ /**
61
+ * Input for updating multiple records in a module in a single API call.
62
+ */
33
63
  export interface ZohoRecruitUpdateMultiRecordInput<T> extends ZohoRecruitModuleNameRef {
34
64
  readonly data: ZohoRecruitUpdateRecordData<T>[];
35
65
  }
66
+ /**
67
+ * Overloaded function signature supporting both single and multi-record updates.
68
+ */
36
69
  export type ZohoRecruitUpdateRecordLikeFunction = ZohoRecruitUpdateMultiRecordFunction & ZohoRecruitUpdateSingleRecordFunction;
37
70
  export type ZohoRecruitUpdateMultiRecordFunction = <T>(input: ZohoRecruitUpdateMultiRecordInput<T>) => Promise<ZohoRecruitUpdateRecordResult<T>>;
38
71
  export type ZohoRecruitUpdateSingleRecordFunction = <T>(input: ZohoRecruitUpdateSingleRecordInput<T>) => Promise<ZohoRecruitChangeObjectDetails>;
72
+ /**
73
+ * Record data that may or may not include an `id`, allowing either insert or update semantics.
74
+ */
39
75
  export type ZohoRecruitUpsertRecordData<T> = ZohoRecruitCreateRecordData<T> | ZohoRecruitUpdateRecordData<T>;
76
+ /**
77
+ * Input for upserting a single record in a module.
78
+ */
40
79
  export interface ZohoRecruitUpsertSingleRecordInput<T> extends ZohoRecruitModuleNameRef {
41
80
  readonly data: ZohoRecruitUpsertRecordData<T>;
42
81
  }
82
+ /**
83
+ * Input for upserting multiple records in a module in a single API call.
84
+ */
43
85
  export interface ZohoRecruitUpsertMultiRecordInput<T> extends ZohoRecruitModuleNameRef {
44
86
  readonly data: ZohoRecruitUpsertRecordData<T>[];
45
87
  }
88
+ /**
89
+ * Overloaded function signature supporting both single and multi-record upserts.
90
+ */
46
91
  export type ZohoRecruitUpsertRecordLikeFunction = ZohoRecruitUpsertMultiRecordFunction & ZohoRecruitUpsertSingleRecordFunction;
47
92
  export type ZohoRecruitUpsertMultiRecordFunction = <T>(input: ZohoRecruitUpsertMultiRecordInput<T>) => Promise<ZohoRecruitUpdateRecordResult<T>>;
48
93
  export type ZohoRecruitUpsertSingleRecordFunction = <T>(input: ZohoRecruitUpsertSingleRecordInput<T>) => Promise<ZohoRecruitChangeObjectDetails>;
49
94
  export type ZohoRecruitInsertRecordFunction = ZohoRecruitCreateRecordLikeFunction;
50
95
  /**
51
- * Inserts one or more records into Recruit.
96
+ * Creates a {@link ZohoRecruitInsertRecordFunction} bound to the given context.
97
+ *
98
+ * Inserts one or more records into a Recruit module. When a single record is
99
+ * provided, returns the {@link ZohoRecruitChangeObjectDetails} directly or
100
+ * throws on error. When multiple records are provided, returns a
101
+ * {@link ZohoRecruitUpdateRecordResult} with paired success/error arrays.
102
+ *
103
+ * Maximum of {@link ZOHO_RECRUIT_CRUD_FUNCTION_MAX_RECORDS_LIMIT} records per call.
104
+ *
105
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
106
+ * @returns Function that inserts records into the specified module
52
107
  *
53
- * https://www.zoho.com/recruit/developer-guide/apiv2/insert-records.html
108
+ * @example
109
+ * ```typescript
110
+ * const insertRecord = zohoRecruitInsertRecord(context);
54
111
  *
55
- * @param context
56
- * @returns
112
+ * // Single record — returns details directly or throws on error:
113
+ * const details = await insertRecord({
114
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
115
+ * data: { First_Name: 'Jane', Last_Name: 'Doe', Email: 'jane@example.com' }
116
+ * });
117
+ *
118
+ * // Multiple records — returns paired success/error arrays:
119
+ * const result = await insertRecord({
120
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
121
+ * data: [
122
+ * { First_Name: 'Jane', Last_Name: 'Doe', Email: 'jane@example.com' },
123
+ * { First_Name: 'John', Last_Name: 'Doe', Email: 'john@example.com' }
124
+ * ]
125
+ * });
126
+ * ```
127
+ *
128
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/insert-records.html
57
129
  */
58
130
  export declare function zohoRecruitInsertRecord(context: ZohoRecruitContext): ZohoRecruitInsertRecordFunction;
59
131
  /**
60
- * Upsert function that can do either an insert or and update ased on the input.
132
+ * Upsert function that can do either an insert or an update based on the input.
61
133
  */
62
134
  export type ZohoRecruitUpsertRecordFunction = ZohoRecruitUpsertRecordLikeFunction;
63
135
  /**
64
- * Updates or inserts one or more records in Recruit.
136
+ * Creates a {@link ZohoRecruitUpsertRecordFunction} bound to the given context.
137
+ *
138
+ * Inserts or updates one or more records in a Recruit module based on whether
139
+ * each record includes an `id`. Uses the `/upsert` endpoint. Single-record
140
+ * calls return details directly or throw; multi-record calls return paired
141
+ * success/error arrays.
142
+ *
143
+ * Maximum of {@link ZOHO_RECRUIT_CRUD_FUNCTION_MAX_RECORDS_LIMIT} records per call.
144
+ *
145
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
146
+ * @returns Function that upserts records in the specified module
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * const upsertRecord = zohoRecruitUpsertRecord(context);
151
+ *
152
+ * // Create (no id) — returns details directly:
153
+ * const created = await upsertRecord({
154
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
155
+ * data: { Email: 'new@example.com', Last_Name: 'New' }
156
+ * });
157
+ *
158
+ * // Update (with id) — returns details directly:
159
+ * const updated = await upsertRecord({
160
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
161
+ * data: { id: existingId, First_Name: 'Updated' }
162
+ * });
65
163
  *
66
- * https://www.zoho.com/recruit/developer-guide/apiv2/upsert-records.html
164
+ * // Mixed create and update — returns paired arrays:
165
+ * const result = await upsertRecord({
166
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
167
+ * data: [
168
+ * { Email: 'create@example.com', Last_Name: 'Create' },
169
+ * { id: existingId, First_Name: 'Update' }
170
+ * ]
171
+ * });
172
+ * ```
67
173
  *
68
- * @param context
69
- * @returns
174
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/upsert-records.html
70
175
  */
71
176
  export declare function zohoRecruitUpsertRecord(context: ZohoRecruitContext): ZohoRecruitUpsertRecordFunction;
72
177
  export type ZohoRecruitUpdateRecordFunction = ZohoRecruitUpdateRecordLikeFunction;
73
178
  /**
74
- * Updates one or more records in Recruit.
179
+ * Creates a {@link ZohoRecruitUpdateRecordFunction} bound to the given context.
75
180
  *
76
- * https://www.zoho.com/recruit/developer-guide/apiv2/update-records.html
181
+ * Updates one or more existing records in a Recruit module. Each record must
182
+ * include an `id` field. Single-record calls return details directly or throw;
183
+ * multi-record calls return paired success/error arrays.
77
184
  *
78
- * @param context
79
- * @returns
185
+ * Maximum of {@link ZOHO_RECRUIT_CRUD_FUNCTION_MAX_RECORDS_LIMIT} records per call.
186
+ *
187
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
188
+ * @returns Function that updates records in the specified module
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * const updateRecord = zohoRecruitUpdateRecord(context);
193
+ *
194
+ * // Single record — returns details directly:
195
+ * const details = await updateRecord({
196
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
197
+ * data: { id: recordId, First_Name: 'Updated Name' }
198
+ * });
199
+ *
200
+ * // Multiple records — returns paired arrays:
201
+ * const result = await updateRecord({
202
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
203
+ * data: [
204
+ * { id: recordId1, First_Name: 'Updated 1' },
205
+ * { id: recordId2, First_Name: 'Updated 2' }
206
+ * ]
207
+ * });
208
+ * ```
209
+ *
210
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/update-records.html
80
211
  */
81
212
  export declare function zohoRecruitUpdateRecord(context: ZohoRecruitContext): ZohoRecruitUpdateRecordFunction;
213
+ /**
214
+ * Function that deletes one or more records from a module.
215
+ */
82
216
  export type ZohoRecruitDeleteRecordFunction = (input: ZohoRecruitDeleteRecordInput) => Promise<ZohoRecruitDeleteRecordResponse>;
217
+ /**
218
+ * Input for deleting records from a module.
219
+ */
83
220
  export interface ZohoRecruitDeleteRecordInput extends ZohoRecruitModuleNameRef {
84
221
  /**
85
222
  * Id or array of ids to delete.
86
223
  */
87
224
  readonly ids: ArrayOrValue<ZohoRecruitRecordId>;
225
+ /**
226
+ * Whether to trigger workflow rules on deletion.
227
+ */
88
228
  readonly wf_trigger?: boolean;
89
229
  }
230
+ /**
231
+ * Successful deletion entry containing the deleted record's id.
232
+ */
90
233
  export interface ZohoRecruitDeleteRecordResponseSuccessEntry extends ZohoRecruitChangeObjectLikeResponseSuccessEntryMeta {
91
234
  readonly details: {
92
235
  readonly id: ZohoRecruitRecordId;
93
236
  };
94
237
  }
238
+ /**
239
+ * Response from a delete operation, with entries pre-separated into `successItems` and `errorItems`.
240
+ */
95
241
  export type ZohoRecruitDeleteRecordResponse = ZohoRecruitChangeObjectLikeResponseSuccessAndErrorPairs<ZohoRecruitDeleteRecordResponseSuccessEntry>;
242
+ /**
243
+ * Array of successful deletion entries extracted from a delete response.
244
+ */
96
245
  export type ZohoRecruitDeleteRecordResult = ZohoRecruitChangeObjectResponseSuccessEntry[];
97
246
  /**
98
- * Deletes one or more records from the given module.
247
+ * Creates a {@link ZohoRecruitDeleteRecordFunction} bound to the given context.
248
+ *
249
+ * Deletes one or more records from a Recruit module by their IDs. Supports
250
+ * an optional `wf_trigger` flag to execute workflow rules on deletion. Returns
251
+ * a response with separated success and error entries.
252
+ *
253
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
254
+ * @returns Function that deletes records from the specified module
255
+ *
256
+ * @example
257
+ * ```typescript
258
+ * const deleteRecord = zohoRecruitDeleteRecord(context);
99
259
  *
100
- * https://www.zoho.com/recruit/developer-guide/apiv2/delete-records.html
260
+ * const result = await deleteRecord({
261
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
262
+ * ids: candidateId
263
+ * });
264
+ * ```
101
265
  *
102
- * @param context
103
- * @returns ZohoRecruitDeleteRecordFunction
266
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/delete-records.html
104
267
  */
105
268
  export declare function zohoRecruitDeleteRecord(context: ZohoRecruitContext): ZohoRecruitDeleteRecordFunction;
269
+ /**
270
+ * Input identifying a specific record within a module.
271
+ */
106
272
  export interface ZohoRecruitGetRecordByIdInput extends ZohoRecruitModuleNameRef {
107
273
  readonly id: ZohoRecruitRecordId;
108
274
  }
275
+ /**
276
+ * Raw API response wrapping a single record in a data array.
277
+ */
109
278
  export type ZohoRecruitGetRecordByIdResponse<T = ZohoRecruitRecord> = ZohoDataArrayResultRef<T>;
279
+ /**
280
+ * Unwrapped record returned by {@link ZohoRecruitGetRecordByIdFunction}.
281
+ */
110
282
  export type ZohoRecruitGetRecordByIdResult<T = ZohoRecruitRecord> = T;
283
+ /**
284
+ * Retrieves a single record from a Recruit module by its ID.
285
+ * Throws {@link ZohoRecruitRecordNoContentError} if the record is not found.
286
+ */
111
287
  export type ZohoRecruitGetRecordByIdFunction = <T = ZohoRecruitRecord>(input: ZohoRecruitGetRecordByIdInput) => Promise<ZohoRecruitGetRecordByIdResult<T>>;
112
288
  /**
113
- * Retrieves a specific record from the given module.
289
+ * Creates a {@link ZohoRecruitGetRecordByIdFunction} bound to the given context.
290
+ *
291
+ * Retrieves a single record from a Recruit module by its ID. The response is
292
+ * unwrapped from the standard data array, returning the record directly.
293
+ * Throws if the record is not found.
114
294
  *
115
- * https://www.zoho.com/recruit/developer-guide/apiv2/get-records.html
295
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
296
+ * @returns Function that retrieves a record by module name and ID
116
297
  *
117
- * @param context
118
- * @returns
298
+ * @example
299
+ * ```typescript
300
+ * const getRecordById = zohoRecruitGetRecordById(context);
301
+ *
302
+ * const record = await getRecordById({
303
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
304
+ * id: candidateId
305
+ * });
306
+ * ```
307
+ *
308
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/get-records.html
119
309
  */
120
310
  export declare function zohoRecruitGetRecordById(context: ZohoRecruitContext): ZohoRecruitGetRecordByIdFunction;
311
+ /**
312
+ * Filter options for listing records, extending pagination with conversion and approval status filters.
313
+ */
121
314
  export interface ZohoRecruitGetRecordsPageFilter extends ZohoPageFilter {
122
315
  readonly converted?: ZohoRecruitTrueFalseBoth;
123
316
  readonly approved?: ZohoRecruitTrueFalseBoth;
124
317
  }
318
+ /**
319
+ * Input for fetching records from a module, supporting field selection, sorting, pagination, and view filters.
320
+ */
125
321
  export interface ZohoRecruitGetRecordsInput extends ZohoRecruitModuleNameRef, ZohoRecruitGetRecordsPageFilter {
126
322
  readonly fields?: ZohoRecruitCommaSeparateFieldNames;
127
323
  readonly sort_order?: SortingOrder;
@@ -131,15 +327,35 @@ export interface ZohoRecruitGetRecordsInput extends ZohoRecruitModuleNameRef, Zo
131
327
  readonly include_child?: boolean;
132
328
  readonly $state?: ZohoRecruitDraftOrSaveState;
133
329
  }
330
+ /**
331
+ * Paginated response containing records and page metadata.
332
+ */
134
333
  export type ZohoRecruitGetRecordsResponse<T = ZohoRecruitRecord> = ZohoPageResult<T>;
334
+ /**
335
+ * Retrieves a paginated list of records from a Recruit module.
336
+ */
135
337
  export type ZohoRecruitGetRecordsFunction = <T = ZohoRecruitRecord>(input: ZohoRecruitGetRecordsInput) => Promise<ZohoRecruitGetRecordsResponse<T>>;
136
338
  /**
137
- * Retrieves records from the given module. Used for paginating across all records.
339
+ * Creates a {@link ZohoRecruitGetRecordsFunction} bound to the given context.
340
+ *
341
+ * Retrieves a paginated list of records from a Recruit module. Supports field
342
+ * selection, sorting, custom view filtering, territory filtering, and
343
+ * conversion/approval status filters via {@link ZohoRecruitGetRecordsInput}.
344
+ *
345
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
346
+ * @returns Function that retrieves paginated records from a module
138
347
  *
139
- * https://www.zoho.com/recruit/developer-guide/apiv2/get-records.html
348
+ * @example
349
+ * ```typescript
350
+ * const getRecords = zohoRecruitGetRecords(context);
140
351
  *
141
- * @param context
142
- * @returns
352
+ * const page = await getRecords({
353
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
354
+ * per_page: 10
355
+ * });
356
+ * ```
357
+ *
358
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/get-records.html
143
359
  */
144
360
  export declare function zohoRecruitGetRecords(context: ZohoRecruitContext): ZohoRecruitGetRecordsFunction;
145
361
  /**
@@ -156,19 +372,79 @@ export interface ZohoRecruitSearchRecordsInput<T = ZohoRecruitRecord> extends Zo
156
372
  readonly phone?: Maybe<PhoneNumber>;
157
373
  readonly word?: Maybe<string>;
158
374
  }
375
+ /**
376
+ * Paginated response from a search operation, identical in shape to {@link ZohoRecruitGetRecordsResponse}.
377
+ */
159
378
  export type ZohoRecruitSearchRecordsResponse<T = ZohoRecruitRecord> = ZohoRecruitGetRecordsResponse<T>;
379
+ /**
380
+ * Searches records in a Recruit module using criteria, email, phone, or keyword.
381
+ * Returns a paginated result defaulting to an empty data array when no matches are found.
382
+ */
160
383
  export type ZohoRecruitSearchRecordsFunction = <T = ZohoRecruitRecord>(input: ZohoRecruitSearchRecordsInput<T>) => Promise<ZohoRecruitSearchRecordsResponse<T>>;
161
384
  /**
162
- * Searches records from the given module.
385
+ * Creates a {@link ZohoRecruitSearchRecordsFunction} bound to the given context.
386
+ *
387
+ * Searches records in a Recruit module using one of: criteria tree (compiled
388
+ * via {@link zohoRecruitSearchRecordsCriteriaString}), email, phone, or keyword.
389
+ * At least one search parameter must be provided. Returns a paginated result,
390
+ * defaulting to an empty data array when no matches are found.
391
+ *
392
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
393
+ * @returns Function that searches records in the specified module
394
+ * @throws {Error} If none of `criteria`, `email`, `phone`, or `word` are provided
395
+ *
396
+ * @example
397
+ * ```typescript
398
+ * const searchRecords = zohoRecruitSearchRecords(context);
163
399
  *
164
- * https://www.zoho.com/recruit/developer-guide/apiv2/search-records.html
400
+ * // Search by criteria:
401
+ * const result = await searchRecords({
402
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
403
+ * criteria: [{ field: 'Last_Name', filter: 'starts_with', value: 'Smith' }],
404
+ * per_page: 10
405
+ * });
165
406
  *
166
- * @param context
167
- * @returns
407
+ * // Search by keyword:
408
+ * const wordResult = await searchRecords({
409
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
410
+ * word: 'engineer'
411
+ * });
412
+ * ```
413
+ *
414
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/search-records.html
168
415
  */
169
416
  export declare function zohoRecruitSearchRecords(context: ZohoRecruitContext): ZohoRecruitSearchRecordsFunction;
417
+ /**
418
+ * Factory function type that produces paginated iterators over search results.
419
+ */
170
420
  export type ZohoRecruitSearchRecordsPageFactory = <T = ZohoRecruitRecord>(input: ZohoRecruitSearchRecordsInput<T>, options?: Maybe<FetchPageFactoryOptions<ZohoRecruitSearchRecordsInput<T>, ZohoRecruitSearchRecordsResponse<T>>>) => FetchPage<ZohoRecruitSearchRecordsInput<T>, ZohoRecruitSearchRecordsResponse<T>>;
421
+ /**
422
+ * Creates a {@link ZohoRecruitSearchRecordsPageFactory} bound to the given context.
423
+ *
424
+ * Returns a page factory that automatically handles Zoho Recruit's pagination,
425
+ * making it easy to iterate through all search results across multiple pages.
426
+ *
427
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
428
+ * @returns Page factory for iterating over search results
429
+ *
430
+ * @example
431
+ * ```typescript
432
+ * const pageFactory = zohoRecruitSearchRecordsPageFactory(context);
433
+ *
434
+ * const fetchPage = pageFactory({
435
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
436
+ * criteria: [{ field: 'Last_Name', filter: 'starts_with', value: 'Smith' }],
437
+ * per_page: 5
438
+ * });
439
+ *
440
+ * const firstPage = await fetchPage.fetchNext();
441
+ * const secondPage = await firstPage.fetchNext();
442
+ * ```
443
+ */
171
444
  export declare function zohoRecruitSearchRecordsPageFactory(context: ZohoRecruitContext): ZohoRecruitSearchRecordsPageFactory;
445
+ /**
446
+ * Configuration for creating a related records retrieval function.
447
+ */
172
448
  export interface ZohoRecruitGetRelatedRecordsFunctionConfig {
173
449
  readonly targetModule: ZohoRecruitModuleName;
174
450
  /**
@@ -178,8 +454,17 @@ export interface ZohoRecruitGetRelatedRecordsFunctionConfig {
178
454
  */
179
455
  readonly returnEmptyRecordsInsteadOfNull?: boolean;
180
456
  }
457
+ /**
458
+ * Factory that produces typed functions for fetching related records of a specific target module.
459
+ */
181
460
  export type ZohoRecruitGetRelatedRecordsFunctionFactory = <T = ZohoRecruitRecord>(input: ZohoRecruitGetRelatedRecordsFunctionConfig) => ZohoRecruitGetRelatedRecordsFunction<T>;
461
+ /**
462
+ * Pagination filter for related records requests, equivalent to {@link ZohoPageFilter}.
463
+ */
182
464
  export type ZohoRecruitGetRelatedRecordsPageFilter = ZohoPageFilter;
465
+ /**
466
+ * Request for fetching related records of a specific record in a module.
467
+ */
183
468
  export interface ZohoRecruitGetRelatedRecordsRequest extends ZohoRecruitGetRecordByIdInput, ZohoRecruitGetRelatedRecordsPageFilter {
184
469
  /**
185
470
  * Optional, Use to filter the related records of the primary/target record with said ids.
@@ -192,28 +477,190 @@ export interface ZohoRecruitGetRelatedRecordsRequest extends ZohoRecruitGetRecor
192
477
  */
193
478
  readonly filter?: Maybe<ZohoRecruitGetRelatedRecordsPageFilter>;
194
479
  }
480
+ /**
481
+ * Paginated response containing related records and page metadata.
482
+ */
195
483
  export type ZohoRecruitGetRelatedRecordsResponse<T = ZohoRecruitRecord> = ZohoPageResult<T>;
484
+ /**
485
+ * Typed function for fetching related records of a specific target module from a parent record.
486
+ */
196
487
  export type ZohoRecruitGetRelatedRecordsFunction<T = ZohoRecruitRecord> = (input: ZohoRecruitGetRelatedRecordsRequest) => Promise<ZohoRecruitGetRelatedRecordsResponse<T>>;
197
488
  /**
198
- * Creates a ZohoRecruitGetRelatedRecordsFunctionFactory, which can be used to create ZohoRecruitGetRelatedRecordsFunction<T> that targets retrieving related records of a given type.
489
+ * Creates a {@link ZohoRecruitGetRelatedRecordsFunctionFactory} bound to the given context.
490
+ *
491
+ * Returns a factory that produces typed functions for fetching related records
492
+ * (e.g. Notes, Emails, Attachments) of a specific target module. The factory
493
+ * accepts a {@link ZohoRecruitGetRelatedRecordsFunctionConfig} to specify the
494
+ * target module and empty-result behavior. By default, returns an empty page
495
+ * result instead of null when no records are found.
496
+ *
497
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
498
+ * @returns Factory that creates typed related-records retrieval functions
199
499
  *
200
- * https://www.zoho.com/recruit/developer-guide/apiv2/get-related-records.html
500
+ * @example
501
+ * ```typescript
502
+ * const factory = zohoRecruitGetRelatedRecordsFunctionFactory(context);
201
503
  *
202
- * @param context the ZohoRecruitContext to use
203
- * @returns a ZohoRecruitGetRelatedRecordsFunctionFactory
504
+ * // Create a typed function for fetching related Notes:
505
+ * const getNotesForRecord = factory<ZohoRecruitRecordNote>({
506
+ * targetModule: ZOHO_RECRUIT_NOTES_MODULE
507
+ * });
508
+ *
509
+ * const notes = await getNotesForRecord({
510
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
511
+ * id: candidateId
512
+ * });
513
+ * ```
514
+ *
515
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/get-related-records.html
204
516
  */
205
517
  export declare function zohoRecruitGetRelatedRecordsFunctionFactory(context: ZohoRecruitContext): ZohoRecruitGetRelatedRecordsFunctionFactory;
518
+ /**
519
+ * Request input for fetching emails related to a record.
520
+ */
206
521
  export type ZohoRecruitGetEmailsForRecordRequest = ZohoRecruitGetRelatedRecordsRequest;
522
+ /**
523
+ * Paginated response containing email metadata entries for a record.
524
+ */
207
525
  export type ZohoRecruitGetEmailsForRecordResponse = ZohoPageResult<ZohoRecruitRecordEmailMetadata>;
526
+ /**
527
+ * Retrieves paginated email metadata for a specific record in a module.
528
+ */
208
529
  export type ZohoRecruitGetEmailsForRecordFunction = (input: ZohoRecruitGetEmailsForRecordRequest) => Promise<ZohoRecruitGetEmailsForRecordResponse>;
530
+ /**
531
+ * Creates a {@link ZohoRecruitGetEmailsForRecordFunction} bound to the given context.
532
+ *
533
+ * Retrieves email metadata related to a specific record by targeting the
534
+ * Emails module via the related records API. Returns a paginated result of
535
+ * {@link ZohoRecruitRecordEmailMetadata} entries. When no emails exist for the
536
+ * record, the result contains an empty data array rather than null.
537
+ *
538
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
539
+ * @returns Function that retrieves emails for a record
540
+ *
541
+ * @example
542
+ * ```typescript
543
+ * const getEmailsForRecord = zohoRecruitGetEmailsForRecord(context);
544
+ *
545
+ * const result = await getEmailsForRecord({
546
+ * id: candidateId,
547
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE
548
+ * });
549
+ * ```
550
+ *
551
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/get-related-records.html
552
+ */
209
553
  export declare function zohoRecruitGetEmailsForRecord(context: ZohoRecruitContext): ZohoRecruitGetEmailsForRecordFunction;
554
+ /**
555
+ * Page factory type for paginated email retrieval.
556
+ */
210
557
  export type ZohoRecruitGetEmailsForRecordPageFactory = FetchPageFactory<ZohoRecruitGetEmailsForRecordRequest, ZohoRecruitGetEmailsForRecordResponse>;
558
+ /**
559
+ * Creates a {@link ZohoRecruitGetEmailsForRecordPageFactory} bound to the given context.
560
+ *
561
+ * Returns a page factory for iterating over emails related to a record across
562
+ * multiple pages. Wraps {@link zohoRecruitGetEmailsForRecord} with automatic
563
+ * pagination handling via {@link zohoFetchPageFactory}.
564
+ *
565
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
566
+ * @returns Page factory for iterating over record emails
567
+ *
568
+ * @example
569
+ * ```typescript
570
+ * const pageFactory = zohoRecruitGetEmailsForRecordPageFactory(context);
571
+ *
572
+ * const fetchPage = pageFactory({
573
+ * id: candidateId,
574
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
575
+ * per_page: 5
576
+ * });
577
+ *
578
+ * const firstPage = await fetchPage.fetchNext();
579
+ *
580
+ * if (firstPage.result.info.more_records) {
581
+ * const secondPage = await firstPage.fetchNext();
582
+ * }
583
+ * ```
584
+ *
585
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/get-related-records.html
586
+ */
211
587
  export declare function zohoRecruitGetEmailsForRecordPageFactory(context: ZohoRecruitContext): ZohoRecruitGetEmailsForRecordPageFactory;
588
+ /**
589
+ * Request input for fetching attachments related to a record.
590
+ */
212
591
  export type ZohoRecruitGetAttachmentsForRecordRequest = ZohoRecruitGetRelatedRecordsRequest;
592
+ /**
593
+ * Paginated response containing attachment metadata entries for a record.
594
+ */
213
595
  export type ZohoRecruitGetAttachmentsForRecordResponse = ZohoPageResult<ZohoRecruitRecordAttachmentMetadata>;
596
+ /**
597
+ * Retrieves paginated attachment metadata for a specific record in a module.
598
+ */
214
599
  export type ZohoRecruitGetAttachmentsForRecordFunction = (input: ZohoRecruitGetAttachmentsForRecordRequest) => Promise<ZohoRecruitGetAttachmentsForRecordResponse>;
600
+ /**
601
+ * Creates a {@link ZohoRecruitGetAttachmentsForRecordFunction} bound to the given context.
602
+ *
603
+ * Retrieves attachment metadata related to a specific record by targeting the
604
+ * Attachments module via the related records API. Returns a paginated result of
605
+ * {@link ZohoRecruitRecordAttachmentMetadata} entries including file names, sizes,
606
+ * and category information. When no attachments exist for the record, the result
607
+ * contains an empty data array rather than null.
608
+ *
609
+ * Each attachment entry includes a `$type` field that distinguishes between
610
+ * directly uploaded attachments (`'Attachment'`) and linked attachments.
611
+ *
612
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
613
+ * @returns Function that retrieves attachments for a record
614
+ *
615
+ * @example
616
+ * ```typescript
617
+ * const getAttachmentsForRecord = zohoRecruitGetAttachmentsForRecord(context);
618
+ *
619
+ * const result = await getAttachmentsForRecord({
620
+ * id: candidateId,
621
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE
622
+ * });
623
+ *
624
+ * // Filter to only directly uploaded attachments (downloadable):
625
+ * const downloadable = result.data.filter((x) => x.$type === 'Attachment');
626
+ * ```
627
+ *
628
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/get-related-records.html
629
+ */
215
630
  export declare function zohoRecruitGetAttachmentsForRecord(context: ZohoRecruitContext): ZohoRecruitGetAttachmentsForRecordFunction;
631
+ /**
632
+ * Page factory type for paginated attachment retrieval.
633
+ */
216
634
  export type ZohoRecruitGetAttachmentsForRecordPageFactory = FetchPageFactory<ZohoRecruitGetAttachmentsForRecordRequest, ZohoRecruitGetAttachmentsForRecordResponse>;
635
+ /**
636
+ * Creates a {@link ZohoRecruitGetAttachmentsForRecordPageFactory} bound to the given context.
637
+ *
638
+ * Returns a page factory for iterating over attachments related to a record
639
+ * across multiple pages. Wraps {@link zohoRecruitGetAttachmentsForRecord} with
640
+ * automatic pagination handling via {@link zohoFetchPageFactory}.
641
+ *
642
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
643
+ * @returns Page factory for iterating over record attachments
644
+ *
645
+ * @example
646
+ * ```typescript
647
+ * const pageFactory = zohoRecruitGetAttachmentsForRecordPageFactory(context);
648
+ *
649
+ * const fetchPage = pageFactory({
650
+ * id: candidateId,
651
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
652
+ * per_page: 10
653
+ * });
654
+ *
655
+ * const firstPage = await fetchPage.fetchNext();
656
+ *
657
+ * if (firstPage.result.info.more_records) {
658
+ * const secondPage = await firstPage.fetchNext();
659
+ * }
660
+ * ```
661
+ *
662
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/get-related-records.html
663
+ */
217
664
  export declare function zohoRecruitGetAttachmentsForRecordPageFactory(context: ZohoRecruitContext): ZohoRecruitGetAttachmentsForRecordPageFactory;
218
665
  /**
219
666
  * Maximum attachment size allowed by Zoho Recruit.
@@ -221,80 +668,172 @@ export declare function zohoRecruitGetAttachmentsForRecordPageFactory(context: Z
221
668
  * 20MB
222
669
  */
223
670
  export declare const ZOHO_RECRUIT_ATTACHMENT_MAX_SIZE: number;
671
+ /**
672
+ * Input for uploading an attachment to a record, specifying the file source and category.
673
+ */
224
674
  export interface ZohoRecruitUploadAttachmentForRecordRequest extends ZohoRecruitGetRecordByIdInput {
225
675
  /**
226
- * Requires the use of a FormData object.
227
- *
228
- * Max of 20MB are allowed
676
+ * File to upload as an attachment. Max 20MB.
229
677
  *
230
- * @deprecated Use attachmentUrl instead for now.
678
+ * Either this or attachmentUrl must be provided.
231
679
  */
232
- readonly formData?: FormData;
680
+ readonly file?: Maybe<File>;
233
681
  /**
234
682
  * File url to pull the file from.
235
683
  *
236
- * Either this or formData must be provided.
684
+ * Either this or file must be provided.
237
685
  */
238
686
  readonly attachmentUrl?: WebsiteUrlWithPrefix;
239
687
  /**
240
688
  * The category id(s) of the attachment.
241
689
  *
242
- * Either this or attachments_category must be provided.
690
+ * Either this or attachmentCategoryName must be provided.
243
691
  */
244
692
  readonly attachmentCategoryId?: ArrayOrValue<ZohoRecruitAttachmentCategoryId>;
245
693
  /**
246
694
  * The category name(s) of the attachment.
247
695
  *
248
- * Either this or attachments_category_id must be provided.
696
+ * Either this or attachmentCategoryId must be provided.
249
697
  *
250
698
  * Example: "Resume"
251
699
  */
252
700
  readonly attachmentCategoryName?: ArrayOrValue<KnownZohoRecruitAttachmentCategoryName>;
253
701
  }
702
+ /**
703
+ * Raw fetch {@link Response} from the upload attachment endpoint.
704
+ */
254
705
  export type ZohoRecruitUploadAttachmentForRecordResponse = Response;
706
+ /**
707
+ * Uploads a file or URL-based attachment to a specific record in a module.
708
+ */
255
709
  export type ZohoRecruitUploadAttachmentForRecordFunction = (input: ZohoRecruitUploadAttachmentForRecordRequest) => Promise<ZohoRecruitUploadAttachmentForRecordResponse>;
256
710
  /**
257
- * Uploads an attachment to a record.
711
+ * Creates a {@link ZohoRecruitUploadAttachmentForRecordFunction} bound to the given context.
712
+ *
713
+ * Uploads an attachment to a specific record. Supports either a direct
714
+ * {@link File} upload (sent as multipart/form-data) or a URL from which Zoho
715
+ * will fetch the file. An attachment category must be specified by ID or name.
716
+ * Maximum file size is {@link ZOHO_RECRUIT_ATTACHMENT_MAX_SIZE} (20MB).
717
+ *
718
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
719
+ * @returns Function that uploads an attachment to a record
720
+ * @throws {Error} If neither `file` nor `attachmentUrl` is provided
721
+ * @throws {Error} If neither `attachmentCategoryId` nor `attachmentCategoryName` is provided
258
722
  *
259
- * https://www.zoho.com/recruit/developer-guide/apiv2/upload-attachment.html
723
+ * @example
724
+ * ```typescript
725
+ * const uploadAttachment = zohoRecruitUploadAttachmentForRecord(context);
260
726
  *
261
- * @param context
262
- * @returns
727
+ * // Upload a file directly:
728
+ * await uploadAttachment({
729
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
730
+ * id: candidateId,
731
+ * file: new File(['content'], 'resume.pdf', { type: 'application/pdf' }),
732
+ * attachmentCategoryName: 'Resume'
733
+ * });
734
+ *
735
+ * // Upload from a URL:
736
+ * await uploadAttachment({
737
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
738
+ * id: candidateId,
739
+ * attachmentUrl: 'https://example.com/document.pdf',
740
+ * attachmentCategoryName: 'Others'
741
+ * });
742
+ * ```
743
+ *
744
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/upload-attachment.html
263
745
  */
264
746
  export declare function zohoRecruitUploadAttachmentForRecord(context: ZohoRecruitContext): ZohoRecruitUploadAttachmentForRecordFunction;
747
+ /**
748
+ * Input for downloading a specific attachment from a record.
749
+ */
265
750
  export interface ZohoRecruitDownloadAttachmentForRecordRequest extends ZohoRecruitGetRecordByIdInput {
266
751
  readonly attachment_id: ZohoRecruitAttachmentRecordId;
267
752
  }
753
+ /**
754
+ * Parsed file response containing the downloaded attachment data and metadata (file name, content type, etc.).
755
+ */
268
756
  export type ZohoRecruitDownloadAttachmentForRecordResponse = FetchFileResponse;
757
+ /**
758
+ * Downloads a specific attachment from a record, returning a parsed {@link FetchFileResponse}.
759
+ */
269
760
  export type ZohoRecruitDownloadAttachmentForRecordFunction = (input: ZohoRecruitDownloadAttachmentForRecordRequest) => Promise<ZohoRecruitDownloadAttachmentForRecordResponse>;
270
761
  /**
271
- * Downloads an attachment from a record.
762
+ * Creates a {@link ZohoRecruitDownloadAttachmentForRecordFunction} bound to the given context.
272
763
  *
273
- * https://www.zoho.com/recruit/developer-guide/apiv2/download-attachments.html
764
+ * Downloads a specific attachment from a record. Returns a parsed
765
+ * {@link FetchFileResponse} containing the file data and metadata extracted
766
+ * from the response headers.
274
767
  *
275
- * @param context
276
- * @returns
768
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
769
+ * @returns Function that downloads an attachment by record and attachment ID
770
+ *
771
+ * @example
772
+ * ```typescript
773
+ * const downloadAttachment = zohoRecruitDownloadAttachmentForRecord(context);
774
+ *
775
+ * const fileResponse = await downloadAttachment({
776
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
777
+ * id: candidateId,
778
+ * attachment_id: attachmentId
779
+ * });
780
+ * ```
781
+ *
782
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/download-attachments.html
277
783
  */
278
784
  export declare function zohoRecruitDownloadAttachmentForRecord(context: ZohoRecruitContext): ZohoRecruitDownloadAttachmentForRecordFunction;
785
+ /**
786
+ * Input for deleting a specific attachment from a record.
787
+ */
279
788
  export interface ZohoRecruitDeleteAttachmentFromRecordRequest extends ZohoRecruitGetRecordByIdInput {
280
789
  readonly attachment_id: ZohoRecruitAttachmentRecordId;
281
790
  }
791
+ /**
792
+ * Raw fetch {@link Response} from the delete attachment endpoint.
793
+ */
282
794
  export type ZohoRecruitDeleteAttachmentFromRecordResponse = Response;
795
+ /**
796
+ * Deletes a specific attachment from a record by its attachment ID.
797
+ */
283
798
  export type ZohoRecruitDeleteAttachmentFromRecordFunction = (input: ZohoRecruitDeleteAttachmentFromRecordRequest) => Promise<ZohoRecruitDeleteAttachmentFromRecordResponse>;
284
799
  /**
285
- * Deletes an attachment from a record.
800
+ * Creates a {@link ZohoRecruitDeleteAttachmentFromRecordFunction} bound to the given context.
801
+ *
802
+ * Deletes a specific attachment from a record by its attachment ID.
803
+ * Returns the raw {@link Response}.
804
+ *
805
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
806
+ * @returns Function that deletes an attachment by record and attachment ID
807
+ *
808
+ * @example
809
+ * ```typescript
810
+ * const deleteAttachment = zohoRecruitDeleteAttachmentFromRecord(context);
286
811
  *
287
- * https://www.zoho.com/recruit/developer-guide/apiv2/delete-attachments.html
812
+ * const response = await deleteAttachment({
813
+ * module: ZOHO_RECRUIT_CANDIDATES_MODULE,
814
+ * id: candidateId,
815
+ * attachment_id: attachmentId
816
+ * });
817
+ * ```
288
818
  *
289
- * @param context
290
- * @returns
819
+ * @see https://www.zoho.com/recruit/developer-guide/apiv2/delete-attachments.html
291
820
  */
292
821
  export declare function zohoRecruitDeleteAttachmentFromRecord(context: ZohoRecruitContext): ZohoRecruitDeleteAttachmentFromRecordFunction;
822
+ /**
823
+ * Union of request types for executing a Zoho Recruit serverless function.
824
+ * Either uses the context's OAuth credentials or an explicit API key.
825
+ */
293
826
  export type ZohoRecruitExecuteRestApiFunctionRequest = ZohoRecruitExecuteRestApiFunctionNormalRequest | ZohoRecruitExecuteRestApiFunctionApiSpecificRequest;
827
+ /**
828
+ * Standard request for executing a serverless function using the context's OAuth credentials.
829
+ */
294
830
  export interface ZohoRecruitExecuteRestApiFunctionNormalRequest {
295
831
  readonly functionName: ZohoRecruitRestFunctionApiName;
296
832
  readonly params?: Maybe<ZohoRecruitExecuteRestApiFunctionParams>;
297
833
  }
834
+ /**
835
+ * Request that targets a specific API endpoint using an API key instead of OAuth, allowing cross-environment calls.
836
+ */
298
837
  export interface ZohoRecruitExecuteRestApiFunctionApiSpecificRequest extends ZohoRecruitExecuteRestApiFunctionNormalRequest {
299
838
  /**
300
839
  * If provided the function will use the API key provided instead of the internal oauth
@@ -307,24 +846,45 @@ export interface ZohoRecruitExecuteRestApiFunctionApiSpecificRequest extends Zoh
307
846
  */
308
847
  readonly apiUrl?: ZohoRecruitConfigApiUrlInput;
309
848
  }
849
+ /**
850
+ * API key string used for authenticating serverless function calls outside of OAuth.
851
+ */
310
852
  export type ZohoRecruitRestFunctionApiKey = string;
853
+ /**
854
+ * Key-value parameters passed to a serverless function as query string arguments.
855
+ */
311
856
  export type ZohoRecruitExecuteRestApiFunctionParams = Record<string, string | number | boolean | ZohoDateTimeString>;
857
+ /**
858
+ * Union of success or error responses from a serverless function execution.
859
+ */
312
860
  export type ZohoRecruitExecuteRestApiFunctionResponse = ZohoRecruitExecuteRestApiFunctionSuccessResponse | ZohoRecruitExecuteRestApiFunctionErrorResponse;
861
+ /**
862
+ * Successful response from a serverless function execution, containing the function's output details.
863
+ */
313
864
  export interface ZohoRecruitExecuteRestApiFunctionSuccessResponse {
314
865
  readonly code: 'success';
315
866
  readonly details: ZohoRecruitExecuteRestApiFunctionSuccessDetails;
316
867
  readonly message: string;
317
868
  }
869
+ /**
870
+ * Details payload from a successful serverless function execution, including any user messages and the invoking user's ID.
871
+ */
318
872
  export interface ZohoRecruitExecuteRestApiFunctionSuccessDetails {
319
873
  readonly userMessage: string[];
320
874
  readonly output_type: string;
321
875
  readonly id: ZohoRecruitUserId;
322
876
  }
877
+ /**
878
+ * Error response from a serverless function execution, containing the error code and message.
879
+ */
323
880
  export interface ZohoRecruitExecuteRestApiFunctionErrorResponse {
324
881
  readonly code: string;
325
882
  readonly details: unknown;
326
883
  readonly message: string;
327
884
  }
885
+ /**
886
+ * Thrown when a Zoho Recruit serverless function execution fails, wrapping the error response with the API error code and message.
887
+ */
328
888
  export declare class ZohoRecruitExecuteRestApiFunctionError extends BaseError {
329
889
  readonly error: ZohoRecruitExecuteRestApiFunctionErrorResponse;
330
890
  constructor(error: ZohoRecruitExecuteRestApiFunctionErrorResponse);
@@ -336,52 +896,154 @@ export declare class ZohoRecruitExecuteRestApiFunctionError extends BaseError {
336
896
  */
337
897
  export type ZohoRecruitExecuteRestApiFunctionFunction = (input: ZohoRecruitExecuteRestApiFunctionRequest) => Promise<ZohoRecruitExecuteRestApiFunctionSuccessDetails>;
338
898
  /**
339
- * Creates a ZohoRecruitExecuteRestApiFunctionFunction
899
+ * Creates a function that executes Zoho Recruit serverless functions via the REST API.
900
+ *
901
+ * Supports both OAuth-based and API-key-based authentication. When using an API key, a custom target URL can be specified for cross-environment calls.
340
902
  *
341
903
  * OAuth Details:
342
904
  * - https://www.zoho.com/crm/developer/docs/functions/serverless-fn-oauth.html#OAuth2
343
905
  * - There is no documentation for ZohoRecruit specifically, but it seems to behave the same way
344
906
  * - You will need the following scopes: ZohoRecruit.functions.execute.READ,ZohoRecruit.functions.execute.CREATE
345
907
  *
346
- * @param context
347
- * @returns
908
+ * @param context - Authenticated Zoho Recruit context providing fetch and rate limiting
909
+ * @returns Function that executes serverless functions via the REST API
910
+ * @throws {ZohoRecruitExecuteRestApiFunctionError} If the function execution fails
911
+ *
912
+ * @example
913
+ * ```typescript
914
+ * const executeFunction = zohoRecruitExecuteRestApiFunction(context);
915
+ *
916
+ * // Execute using OAuth credentials:
917
+ * const result = await executeFunction({ functionName: 'my_function' });
918
+ *
919
+ * // Execute with parameters:
920
+ * const paramResult = await executeFunction({
921
+ * functionName: 'process_candidate',
922
+ * params: { candidate_id: '12345', action: 'approve' }
923
+ * });
924
+ *
925
+ * // Execute using an API key (cross-environment):
926
+ * const apiResult = await executeFunction({
927
+ * functionName: 'my_function',
928
+ * apiKey: 'your-api-key',
929
+ * apiUrl: 'production'
930
+ * });
931
+ * ```
348
932
  */
349
933
  export declare function zohoRecruitExecuteRestApiFunction(context: ZohoRecruitContext): ZohoRecruitExecuteRestApiFunctionFunction;
934
+ /**
935
+ * Builds URL search params from input objects, omitting the `module` key since it is used in the URL path rather than query string.
936
+ */
350
937
  export declare function zohoRecruitUrlSearchParamsMinusModule(...input: Maybe<object | Record<string, string | number>>[]): URLSearchParams;
938
+ /**
939
+ * Builds URL search params from input objects, omitting both `id` and `module` keys since they are used in the URL path.
940
+ */
351
941
  export declare function zohoRecruitUrlSearchParamsMinusIdAndModule(...input: Maybe<object | Record<string, string | number>>[]): URLSearchParams;
352
942
  /**
353
943
  * @deprecated use makeUrlSearchParams instead.
354
944
  */
355
945
  export declare const zohoRecruitUrlSearchParams: typeof makeUrlSearchParams;
946
+ /**
947
+ * Constructs a standard {@link FetchJsonInput} for Zoho Recruit API calls with the given HTTP method and optional body.
948
+ */
356
949
  export declare function zohoRecruitApiFetchJsonInput(method: string, body?: Maybe<FetchJsonBody>): FetchJsonInput;
950
+ /**
951
+ * Generic response wrapper for change operations that return an array of per-record results.
952
+ */
357
953
  export type ZohoRecruitChangeObjectLikeResponse<T extends ZohoRecruitChangeObjectLikeResponseEntry = ZohoRecruitChangeObjectLikeResponseEntry> = ZohoDataArrayResultRef<T>;
954
+ /**
955
+ * Union of success or error entry types in a change response.
956
+ */
358
957
  export type ZohoRecruitChangeObjectLikeResponseEntry<E extends ZohoRecruitChangeObjectLikeResponseSuccessEntryMeta = ZohoRecruitChangeObjectLikeResponseSuccessEntryMeta> = E | ZohoRecruitChangeObjectResponseErrorEntry;
958
+ /**
959
+ * Extracts the success entry type from a change response entry union.
960
+ */
359
961
  export type ZohoRecruitChangeObjectLikeResponseSuccessEntryType<T extends ZohoRecruitChangeObjectLikeResponseEntry> = T extends ZohoRecruitChangeObjectLikeResponseEntry<infer E> ? E : never;
962
+ /**
963
+ * Common metadata present on all successful change operation entries.
964
+ */
360
965
  export interface ZohoRecruitChangeObjectLikeResponseSuccessEntryMeta {
361
966
  readonly code: ZohoServerSuccessCode;
362
967
  readonly status: ZohoServerSuccessStatus;
363
968
  readonly message: string;
364
969
  }
970
+ /**
971
+ * Change response augmented with pre-separated success and error entry arrays for convenient access.
972
+ */
365
973
  export type ZohoRecruitChangeObjectLikeResponseSuccessAndErrorPairs<T extends ZohoRecruitChangeObjectLikeResponseEntry> = ZohoRecruitChangeObjectLikeResponse<T> & {
366
974
  readonly successItems: ZohoRecruitChangeObjectLikeResponseSuccessEntryType<T>[];
367
975
  readonly errorItems: ZohoRecruitChangeObjectResponseErrorEntry[];
368
976
  };
977
+ /**
978
+ * Separates a change response's entries into success and error arrays based on their status.
979
+ *
980
+ * Iterates over the `data` array from a Zoho Recruit change operation response and
981
+ * partitions entries into `successItems` and `errorItems` based on their `status` field.
982
+ * The original response is spread into the result, so all original fields remain accessible.
983
+ *
984
+ * Used internally by {@link zohoRecruitDeleteRecord} and similar functions to provide
985
+ * convenient access to separated success/error results.
986
+ *
987
+ * @param response - Raw change operation response containing mixed success/error entries
988
+ * @returns The response augmented with pre-separated `successItems` and `errorItems` arrays
989
+ *
990
+ * @example
991
+ * ```typescript
992
+ * const rawResponse = await context.fetchJson<ZohoRecruitChangeObjectLikeResponse>(...);
993
+ * const result = zohoRecruitChangeObjectLikeResponseSuccessAndErrorPairs(rawResponse);
994
+ *
995
+ * result.successItems; // entries with status === 'success'
996
+ * result.errorItems; // entries with non-success status
997
+ * ```
998
+ */
369
999
  export declare function zohoRecruitChangeObjectLikeResponseSuccessAndErrorPairs<T extends ZohoRecruitChangeObjectLikeResponseEntry>(response: ZohoRecruitChangeObjectLikeResponse<T>): ZohoRecruitChangeObjectLikeResponseSuccessAndErrorPairs<T>;
1000
+ /**
1001
+ * Concrete change response type for insert/update/upsert operations, wrapping an array of per-record entries.
1002
+ */
370
1003
  export type ZohoRecruitChangeObjectResponse<T extends ZohoRecruitChangeObjectResponseEntry = ZohoRecruitChangeObjectResponseEntry> = ZohoRecruitChangeObjectLikeResponse<T>;
1004
+ /**
1005
+ * Union of success or error entry types in an insert/update/upsert response.
1006
+ */
371
1007
  export type ZohoRecruitChangeObjectResponseEntry<E extends ZohoRecruitChangeObjectResponseSuccessEntry = ZohoRecruitChangeObjectResponseSuccessEntry> = ZohoRecruitChangeObjectLikeResponseEntry<E>;
1008
+ /**
1009
+ * Successful change entry that includes the full object details (e.g., created/updated record fields).
1010
+ */
372
1011
  export interface ZohoRecruitChangeObjectResponseSuccessEntry<D extends ZohoRecruitChangeObjectDetails = ZohoRecruitChangeObjectDetails> extends ZohoRecruitChangeObjectLikeResponseSuccessEntryMeta {
373
1012
  readonly details: D;
374
1013
  }
1014
+ /**
1015
+ * Error entry from a change operation, containing the Zoho error status and details.
1016
+ */
375
1017
  export interface ZohoRecruitChangeObjectResponseErrorEntry extends ZohoServerErrorDataWithDetails {
376
1018
  readonly status: ZohoServerErrorStatus;
377
1019
  }
1020
+ /**
1021
+ * Paired result from a bulk operation, correlating each input record with its success or error outcome.
1022
+ */
378
1023
  export interface ZohoRecruitMultiRecordResult<I, OS, OE> {
379
1024
  readonly successItems: ZohoRecruitMultiRecordResultEntry<I, OS>[];
380
1025
  readonly errorItems: ZohoRecruitMultiRecordResultEntry<I, OE>[];
381
1026
  }
1027
+ /**
1028
+ * Constraint interface requiring a status field to distinguish success from error results.
1029
+ */
382
1030
  export interface ZohoRecruitMultiRecordResultItem {
383
1031
  readonly status: ZohoServerSuccessStatus | ZohoServerErrorStatus;
384
1032
  }
1033
+ /**
1034
+ * Pairs each input record with its corresponding API result and separates them into success and error arrays by status.
1035
+ *
1036
+ * Iterates over the `input` and `results` arrays in parallel, matching each input record
1037
+ * to its positional result. Entries are classified as success or error based on
1038
+ * the result's `status` field matching {@link ZOHO_SUCCESS_STATUS}.
1039
+ *
1040
+ * Used internally by {@link updateRecordLikeFunction} to pair input data with API outcomes
1041
+ * for insert, update, and upsert operations.
1042
+ *
1043
+ * @param input - Array of input records that were submitted to the API
1044
+ * @param results - Array of per-record results returned by the API, positionally aligned with `input`
1045
+ * @returns Object with `successItems` and `errorItems`, each containing paired `{ input, result }` entries
1046
+ */
385
1047
  export declare function zohoRecruitMultiRecordResult<I, OS extends ZohoRecruitMultiRecordResultItem, OE extends ZohoRecruitMultiRecordResultItem>(input: I[], results: (OS | OE)[]): ZohoRecruitMultiRecordResult<I, OS, OE>;
386
1048
  export interface ZohoRecruitMultiRecordResultEntry<I, O> {
387
1049
  /**
@@ -389,7 +1051,7 @@ export interface ZohoRecruitMultiRecordResultEntry<I, O> {
389
1051
  */
390
1052
  readonly input: I;
391
1053
  /**
392
- * The result of the insert.
1054
+ * The API result for this record (success or error entry).
393
1055
  */
394
1056
  readonly result: O;
395
1057
  }