@ikonintegration/module-contractor-api 1.0.18 → 1.0.20

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.
package/Api.ts CHANGED
@@ -17,6 +17,66 @@ export interface ErrorResponse {
17
17
  errCode: string
18
18
  }
19
19
 
20
+ export interface CreateCodeSchema {
21
+ /** Unique code identifier (1-50 alphanumeric characters) */
22
+ codeID: CodeIDSchema
23
+ /**
24
+ * ID of the department this code belongs to
25
+ * @minLength 1
26
+ * @example "DEPT-2a1b3c4d5e6f"
27
+ */
28
+ departmentID: string
29
+ /**
30
+ * Description of the code (1-255 characters)
31
+ * @minLength 1
32
+ * @maxLength 255
33
+ * @example "Consulting services for safety audits"
34
+ */
35
+ description: string
36
+ }
37
+
38
+ /**
39
+ * Unique code identifier (1-50 alphanumeric characters)
40
+ * @minLength 1
41
+ * @maxLength 50
42
+ * @pattern ^[a-zA-Z0-9]+$
43
+ * @example "ACC001"
44
+ */
45
+ export type CodeIDSchema = string
46
+
47
+ /** Created code */
48
+ export interface PostCodeResponseSchema {
49
+ /** Code identifier */
50
+ codeID: string
51
+ /** Associated department ID */
52
+ departmentID: string
53
+ /** Code description */
54
+ description: string
55
+ }
56
+
57
+ export interface UpdateCodeSchema {
58
+ /**
59
+ * Updated description of the code (1-255 characters)
60
+ * @minLength 1
61
+ * @maxLength 255
62
+ * @example "Updated consulting services description"
63
+ */
64
+ description: string
65
+ }
66
+
67
+ /** Updated code */
68
+ export interface PutCodeResponseSchema {
69
+ /** Code identifier */
70
+ codeID: string
71
+ /** Associated department ID */
72
+ departmentID: string
73
+ /** Updated code description */
74
+ description: string
75
+ }
76
+
77
+ /** Code deletion result (empty body) */
78
+ export type DeleteCodeResponseSchema = object
79
+
20
80
  /** Codes list */
21
81
  export interface GetCodesResponseSchema {
22
82
  /** List of codes */
@@ -300,6 +360,24 @@ export interface UserSearchResult {
300
360
  localStatus?: string
301
361
  }
302
362
 
363
+ export interface IDMUserSearchInput {
364
+ /**
365
+ * Full-text IDM search term
366
+ * @example "vitor"
367
+ */
368
+ searchTerm?: string
369
+ /** Optional IDM filter object, forwarded verbatim to IDM */
370
+ filter?: Record<string, any>
371
+ }
372
+
373
+ /** IDM directory user search results (proxied) */
374
+ export interface IDMUserSearchResponse {
375
+ /** IDM user records (Elasticsearch-hit shape) as returned by IDM */
376
+ users: any[]
377
+ /** Total matching records reported by IDM */
378
+ total: number
379
+ }
380
+
303
381
  export interface CreateDepartmentSchema {
304
382
  /**
305
383
  * Name of the department (1-150 characters)
@@ -1100,58 +1178,51 @@ export interface PostApproveResponseSchema {
1100
1178
  status: string
1101
1179
  }
1102
1180
 
1103
- export interface CreateSubmissionCodeSchema {
1181
+ export interface AttachSubmissionCodeSchema {
1104
1182
  /**
1105
- * Description of the code (1-255 characters)
1106
- * @minLength 1
1107
- * @maxLength 255
1108
- * @example "Consulting services for safety audits"
1183
+ * The submission section the code is associated with
1184
+ * @example "Service"
1109
1185
  */
1110
- description: string
1186
+ section: AttachSubmissionCodeSchemaSectionEnum
1187
+ /**
1188
+ * Optional note for the code association (max 500 characters)
1189
+ * @maxLength 500
1190
+ * @example "Charge 20% to this code"
1191
+ */
1192
+ note?: string
1111
1193
  }
1112
1194
 
1113
- export interface SubmissionCodeMutationResponseSchema {
1114
- /** Code identifier */
1195
+ export interface SubmissionCodeAssociationResponseSchema {
1196
+ /** Parent submission ID */
1197
+ submissionID: string
1198
+ /**
1199
+ * The submission section the code is associated with
1200
+ * @example "Service"
1201
+ */
1202
+ section: SubmissionCodeAssociationResponseSchemaSectionEnum
1203
+ /** Associated catalog code ID */
1115
1204
  codeID: string
1116
- /** Derived department ID */
1117
- departmentID: string
1118
- /** Code description */
1119
- description: string
1205
+ /** Note for the association, or null when unset */
1206
+ note: string | null
1120
1207
  }
1121
1208
 
1122
- export interface UpdateSubmissionCodeSchema {
1209
+ export interface UpdateSubmissionCodeNoteSchema {
1123
1210
  /**
1124
- * Description of the code (1-255 characters)
1125
- * @minLength 1
1126
- * @maxLength 255
1127
- * @example "Consulting services for safety audits"
1211
+ * The submission section the code is associated with
1212
+ * @example "Service"
1128
1213
  */
1129
- description: string
1214
+ section: UpdateSubmissionCodeNoteSchemaSectionEnum
1215
+ /**
1216
+ * Optional note for the code association (max 500 characters)
1217
+ * @maxLength 500
1218
+ * @example "Charge 20% to this code"
1219
+ */
1220
+ note?: string
1130
1221
  }
1131
1222
 
1132
- /** Deletion result (empty body) */
1223
+ /** Detach result (empty body) */
1133
1224
  export type DeleteSubmissionCodeResponseSchema = object
1134
1225
 
1135
- export interface PutSubmissionCodesSchema {
1136
- /** Array of codes to assign to the submission sections */
1137
- codes: SubmissionCodeItemSchema[]
1138
- }
1139
-
1140
- /** Code assignment result */
1141
- export interface PutSubmissionCodesResponseSchema {
1142
- /** Submission ID */
1143
- submissionID: string
1144
- /** Assigned codes */
1145
- codes: {
1146
- /** Section (Service or Reimbursement) */
1147
- section: string
1148
- /** Billing code ID */
1149
- codeID: string
1150
- /** Optional note */
1151
- note: string | null
1152
- }[]
1153
- }
1154
-
1155
1226
  /** Request a presigned upload URL for a file attachment */
1156
1227
  export interface FileUploadRequestSchema {
1157
1228
  /**
@@ -1630,6 +1701,33 @@ export enum UpdateExpenseInputSchemaTransportationTypeEnum {
1630
1701
  Other = 'Other',
1631
1702
  }
1632
1703
 
1704
+ /**
1705
+ * The submission section the code is associated with
1706
+ * @example "Service"
1707
+ */
1708
+ export enum AttachSubmissionCodeSchemaSectionEnum {
1709
+ Service = 'Service',
1710
+ Reimbursement = 'Reimbursement',
1711
+ }
1712
+
1713
+ /**
1714
+ * The submission section the code is associated with
1715
+ * @example "Service"
1716
+ */
1717
+ export enum SubmissionCodeAssociationResponseSchemaSectionEnum {
1718
+ Service = 'Service',
1719
+ Reimbursement = 'Reimbursement',
1720
+ }
1721
+
1722
+ /**
1723
+ * The submission section the code is associated with
1724
+ * @example "Service"
1725
+ */
1726
+ export enum UpdateSubmissionCodeNoteSchemaSectionEnum {
1727
+ Service = 'Service',
1728
+ Reimbursement = 'Reimbursement',
1729
+ }
1730
+
1633
1731
  /** Content type */
1634
1732
  export enum GetPdfResponseSchemaContentTypeEnum {
1635
1733
  ApplicationPdf = 'application/pdf',
@@ -1643,6 +1741,18 @@ export enum GuestFileMetadataSchemaContentTypeEnum {
1643
1741
  ApplicationPdf = 'application/pdf',
1644
1742
  }
1645
1743
 
1744
+ export type CreateCodeData = PostCodeResponseSchema
1745
+
1746
+ export type CreateCodeError = ErrorResponse
1747
+
1748
+ export type UpdateCodeData = PutCodeResponseSchema
1749
+
1750
+ export type UpdateCodeError = ErrorResponse
1751
+
1752
+ export type DeleteCodeData = DeleteCodeResponseSchema
1753
+
1754
+ export type DeleteCodeError = ErrorResponse
1755
+
1646
1756
  export interface ListCodesParams {
1647
1757
  /**
1648
1758
  * Filter codes by department. If omitted, all codes are returned.
@@ -1719,6 +1829,10 @@ export type CreateSearchResult = UserSearchResponse
1719
1829
 
1720
1830
  export type CreateSearchFail = ErrorResponse
1721
1831
 
1832
+ export type CreateSearchIdmData = IDMUserSearchResponse
1833
+
1834
+ export type CreateSearchIdmError = ErrorResponse
1835
+
1722
1836
  export type CreateDepartmentData = PostDepartmentResponseSchema
1723
1837
 
1724
1838
  export type CreateDepartmentError = ErrorResponse
@@ -1805,21 +1919,61 @@ export type CreateApproveData = PostApproveResponseSchema
1805
1919
 
1806
1920
  export type CreateApproveError = ErrorResponse
1807
1921
 
1808
- export type CreateCodeData = SubmissionCodeMutationResponseSchema
1922
+ export type CreateCodeResult = SubmissionCodeAssociationResponseSchema
1809
1923
 
1810
- export type CreateCodeError = ErrorResponse
1924
+ export type CreateCodeFail = ErrorResponse
1811
1925
 
1812
- export type UpdateCodeData = SubmissionCodeMutationResponseSchema
1926
+ export type UpdateCodeResult = SubmissionCodeAssociationResponseSchema
1813
1927
 
1814
- export type UpdateCodeError = ErrorResponse
1928
+ export type UpdateCodeFail = ErrorResponse
1815
1929
 
1816
- export type DeleteCodeData = DeleteSubmissionCodeResponseSchema
1930
+ export interface DeleteCodeParams1 {
1931
+ /**
1932
+ * The submission section the code is associated with
1933
+ * @example "Service"
1934
+ */
1935
+ section: SectionEnum
1936
+ /**
1937
+ * Owner user identifier (submission partition key)
1938
+ * @minLength 1
1939
+ * @example "USR-2RvYIFNJR3CrJHKO0NqgGa1EwcS"
1940
+ */
1941
+ userId: string
1942
+ /**
1943
+ * Submission identifier
1944
+ * @minLength 1
1945
+ * @example "SUB-2RvYIFNJR3CrJHKO0NqgGa1EwcS"
1946
+ */
1947
+ submissionId: string
1948
+ /**
1949
+ * Code identifier
1950
+ * @minLength 1
1951
+ * @example "CODE-2RvYIFNJR3CrJHKO0NqgGa1EwcS"
1952
+ */
1953
+ codeId: string
1954
+ }
1817
1955
 
1818
- export type DeleteCodeError = ErrorResponse
1956
+ /**
1957
+ * The submission section the code is associated with
1958
+ * @example "Service"
1959
+ */
1960
+ export enum SectionEnum {
1961
+ Service = 'Service',
1962
+ Reimbursement = 'Reimbursement',
1963
+ }
1819
1964
 
1820
- export type UpdateCodesData = PutSubmissionCodesResponseSchema
1965
+ export type DeleteCodeResult = DeleteSubmissionCodeResponseSchema
1821
1966
 
1822
- export type UpdateCodesError = ErrorResponse
1967
+ export type DeleteCodeFail = ErrorResponse
1968
+
1969
+ /**
1970
+ * The submission section the code is associated with
1971
+ * @example "Service"
1972
+ */
1973
+ export enum DeleteCodeParams2SectionEnum {
1974
+ Service = 'Service',
1975
+ Reimbursement = 'Reimbursement',
1976
+ }
1823
1977
 
1824
1978
  export type CreateFileData = PostFileResponseSchema
1825
1979
 
@@ -1952,7 +2106,7 @@ export type ListExportData = GetSubmissionsExportResponseSchema
1952
2106
 
1953
2107
  export type ListExportError = ErrorResponse
1954
2108
 
1955
- export type CreateSearchData1 = SubmissionSearchResponse
2109
+ export type CreateSearchResult1 = SubmissionSearchResponse
1956
2110
 
1957
2111
  export type CreateSearchErrorData = ErrorResponse
1958
2112
 
@@ -2094,11 +2248,70 @@ export class HttpClient<SecurityDataType = unknown> {
2094
2248
 
2095
2249
  /**
2096
2250
  * @title Contractor Module API
2097
- * @version 1.0.18
2251
+ * @version 1.0.20
2098
2252
  * @baseUrl http://localhost:8080
2099
2253
  * @contact Ikon Integration <ikon@ikonintegration.com> (http://example.com)
2100
2254
  */
2101
2255
  export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
2256
+ code = {
2257
+ /**
2258
+ * @description Creates a new charging code associated with a department. Only Super Administrators can create codes.
2259
+ *
2260
+ * @tags Codes
2261
+ * @name CreateCode
2262
+ * @summary Create Code
2263
+ * @request POST:/code
2264
+ * @secure
2265
+ */
2266
+ createCode: (data: CreateCodeSchema, params: RequestParams = {}) =>
2267
+ this.request<CreateCodeData, CreateCodeError>({
2268
+ path: `/code`,
2269
+ method: 'POST',
2270
+ body: data,
2271
+ secure: true,
2272
+ type: ContentType.Json,
2273
+ format: 'json',
2274
+ ...params,
2275
+ }),
2276
+
2277
+ /**
2278
+ * @description Updates an existing charging code description. Only Super Administrators can update codes.
2279
+ *
2280
+ * @tags Codes
2281
+ * @name UpdateCode
2282
+ * @summary Update Code
2283
+ * @request PUT:/code/{codeID}
2284
+ * @secure
2285
+ */
2286
+ updateCode: (codeId: string, data: UpdateCodeSchema, params: RequestParams = {}) =>
2287
+ this.request<UpdateCodeData, UpdateCodeError>({
2288
+ path: `/code/${codeId}`,
2289
+ method: 'PUT',
2290
+ body: data,
2291
+ secure: true,
2292
+ type: ContentType.Json,
2293
+ format: 'json',
2294
+ ...params,
2295
+ }),
2296
+
2297
+ /**
2298
+ * @description Deletes a charging code. Prevents deletion if the code is referenced by existing submissions. Only Super Administrators can delete codes.
2299
+ *
2300
+ * @tags Codes
2301
+ * @name DeleteCode
2302
+ * @summary Delete Code
2303
+ * @request DELETE:/code/{codeID}
2304
+ * @secure
2305
+ */
2306
+ deleteCode: (codeId: string, params: RequestParams = {}) =>
2307
+ this.request<DeleteCodeData, DeleteCodeError>({
2308
+ path: `/code/${codeId}`,
2309
+ method: 'DELETE',
2310
+ secure: true,
2311
+ format: 'json',
2312
+ ...params,
2313
+ }),
2314
+ }
2102
2315
  codes = {
2103
2316
  /**
2104
2317
  * @description Returns all codes or codes filtered by department. Administrators and above can list codes.
@@ -2255,20 +2468,39 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2255
2468
  format: 'json',
2256
2469
  ...params,
2257
2470
  }),
2258
- }
2259
- users = {
2471
+
2260
2472
  /**
2261
2473
  * @description Search users by name, email, phone, role, or status.
2262
2474
  *
2263
2475
  * @tags Users
2264
2476
  * @name CreateSearch
2265
2477
  * @summary Search users
2266
- * @request POST:/users/search
2478
+ * @request POST:/contractors/search
2267
2479
  * @secure
2268
2480
  */
2269
2481
  createSearch: (data: UserSearchInput, params: RequestParams = {}) =>
2270
2482
  this.request<CreateSearchResult, CreateSearchFail>({
2271
- path: `/users/search`,
2483
+ path: `/contractors/search`,
2484
+ method: 'POST',
2485
+ body: data,
2486
+ secure: true,
2487
+ type: ContentType.Json,
2488
+ format: 'json',
2489
+ ...params,
2490
+ }),
2491
+
2492
+ /**
2493
+ * @description Search the full customer IDM user directory. Authenticated server-side with the customer IDM credentials so results are consistent for all administrators. Admin/Sysadmin only.
2494
+ *
2495
+ * @tags Users
2496
+ * @name CreateSearchIdm
2497
+ * @summary Search IDM users (directory proxy)
2498
+ * @request POST:/contractors/search/idm
2499
+ * @secure
2500
+ */
2501
+ createSearchIdm: (data: IDMUserSearchInput, params: RequestParams = {}) =>
2502
+ this.request<CreateSearchIdmData, CreateSearchIdmError>({
2503
+ path: `/contractors/search/idm`,
2272
2504
  method: 'POST',
2273
2505
  body: data,
2274
2506
  secure: true,
@@ -2516,17 +2748,23 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2516
2748
  }),
2517
2749
 
2518
2750
  /**
2519
- * @description Creates a new billing code bound to the parent submission's department. The codeID is System-generated and the departmentID is derived from the submission, so neither is taken from the request. Admin only.
2751
+ * @description Attaches an existing catalog code (addressed by codeID within the submission's department) to a submission's Service or Reimbursement section, with an optional note. Operates on the SubmissionCode association. Admin only.
2520
2752
  *
2521
2753
  * @tags Submissions
2522
2754
  * @name CreateCode
2523
- * @summary Create code on submission
2524
- * @request POST:/submission/{userID}/{submissionID}/code
2755
+ * @summary Attach a catalog code to a submission section
2756
+ * @request POST:/submission/{userID}/{submissionID}/code/{codeID}
2525
2757
  * @secure
2526
2758
  */
2527
- createCode: (userId: string, submissionId: string, data: CreateSubmissionCodeSchema, params: RequestParams = {}) =>
2528
- this.request<CreateCodeData, CreateCodeError>({
2529
- path: `/submission/${userId}/${submissionId}/code`,
2759
+ createCode: (
2760
+ userId: string,
2761
+ submissionId: string,
2762
+ codeId: string,
2763
+ data: AttachSubmissionCodeSchema,
2764
+ params: RequestParams = {}
2765
+ ) =>
2766
+ this.request<CreateCodeResult, CreateCodeFail>({
2767
+ path: `/submission/${userId}/${submissionId}/code/${codeId}`,
2530
2768
  method: 'POST',
2531
2769
  body: data,
2532
2770
  secure: true,
@@ -2536,11 +2774,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2536
2774
  }),
2537
2775
 
2538
2776
  /**
2539
- * @description Updates the description of a billing code addressed by codeID and derived from the parent submission's department. Admin only.
2777
+ * @description Updates the note of a catalog code attached to a submission's Service or Reimbursement section. Operates on the SubmissionCode association. Admin only.
2540
2778
  *
2541
2779
  * @tags Submissions
2542
2780
  * @name UpdateCode
2543
- * @summary Update a submission code
2781
+ * @summary Update an attached submission code note
2544
2782
  * @request PUT:/submission/{userID}/{submissionID}/code/{codeID}
2545
2783
  * @secure
2546
2784
  */
@@ -2548,10 +2786,10 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2548
2786
  userId: string,
2549
2787
  submissionId: string,
2550
2788
  codeId: string,
2551
- data: UpdateSubmissionCodeSchema,
2789
+ data: UpdateSubmissionCodeNoteSchema,
2552
2790
  params: RequestParams = {}
2553
2791
  ) =>
2554
- this.request<UpdateCodeData, UpdateCodeError>({
2792
+ this.request<UpdateCodeResult, UpdateCodeFail>({
2555
2793
  path: `/submission/${userId}/${submissionId}/code/${codeId}`,
2556
2794
  method: 'PUT',
2557
2795
  body: data,
@@ -2562,43 +2800,24 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2562
2800
  }),
2563
2801
 
2564
2802
  /**
2565
- * @description Deletes a billing code owned by the submission's department. The owning departmentID is derived from the parent submission. Fails if the code is still referenced by any submission. Admin only.
2803
+ * @description Detaches an attached catalog code (addressed by codeID) from a submission's Service or Reimbursement section, identified by the required 'section' query parameter. Operates on the SubmissionCode association. Admin only.
2566
2804
  *
2567
2805
  * @tags Submissions
2568
2806
  * @name DeleteCode
2569
- * @summary Delete a code from a submission
2807
+ * @summary Detach a catalog code from a submission section
2570
2808
  * @request DELETE:/submission/{userID}/{submissionID}/code/{codeID}
2571
2809
  * @secure
2572
2810
  */
2573
- deleteCode: (userId: string, submissionId: string, codeId: string, params: RequestParams = {}) =>
2574
- this.request<DeleteCodeData, DeleteCodeError>({
2811
+ deleteCode: ({ userId, submissionId, codeId, ...query }: DeleteCodeParams1, params: RequestParams = {}) =>
2812
+ this.request<DeleteCodeResult, DeleteCodeFail>({
2575
2813
  path: `/submission/${userId}/${submissionId}/code/${codeId}`,
2576
2814
  method: 'DELETE',
2815
+ query: query,
2577
2816
  secure: true,
2578
2817
  format: 'json',
2579
2818
  ...params,
2580
2819
  }),
2581
2820
 
2582
- /**
2583
- * @description Assigns codes to Service and/or Reimbursement sections of a submission with optional notes. Only codes belonging to the submission's assigned department are allowed. Admin only.
2584
- *
2585
- * @tags Submissions
2586
- * @name UpdateCodes
2587
- * @summary Assign codes to submission sections
2588
- * @request PUT:/submission/{userID}/{submissionID}/codes
2589
- * @secure
2590
- */
2591
- updateCodes: (userId: string, submissionId: string, data: PutSubmissionCodesSchema, params: RequestParams = {}) =>
2592
- this.request<UpdateCodesData, UpdateCodesError>({
2593
- path: `/submission/${userId}/${submissionId}/codes`,
2594
- method: 'PUT',
2595
- body: data,
2596
- secure: true,
2597
- type: ContentType.Json,
2598
- format: 'json',
2599
- ...params,
2600
- }),
2601
-
2602
2821
  /**
2603
2822
  * @description Validates file constraints (size, type, count) and returns a presigned IKFS URL for uploading a file attachment to a submission line item. Max 10 MB, max 5 files per line item.
2604
2823
  *
@@ -2797,7 +3016,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2797
3016
  }),
2798
3017
 
2799
3018
  /**
2800
- * @description Generate an Excel export of submissions scoped by role. Contractors see only their own submissions. Administrators see their department. Accountants and Super Administrators see all. Maximum 10,000 rows.
3019
+ * @description Generate an Excel export of submissions scoped by role. Contractors see only their own submissions. Administrators see their departments. Accountants and Super Administrators see all. Maximum 10,000 rows.
2801
3020
  *
2802
3021
  * @tags Submissions
2803
3022
  * @name ListExport
@@ -2824,7 +3043,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2824
3043
  * @secure
2825
3044
  */
2826
3045
  createSearch: (data: SubmissionSearchInput, params: RequestParams = {}) =>
2827
- this.request<CreateSearchData1, CreateSearchErrorData>({
3046
+ this.request<CreateSearchResult1, CreateSearchErrorData>({
2828
3047
  path: `/submissions/search`,
2829
3048
  method: 'POST',
2830
3049
  body: data,