@nizam-os/operator-sdk 2.5.2 → 2.7.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 (109) hide show
  1. package/dist/Client.d.ts +9 -0
  2. package/dist/Client.js +20 -8
  3. package/dist/api/errors/BadGatewayError.d.ts +6 -0
  4. package/dist/api/errors/BadGatewayError.js +54 -0
  5. package/dist/api/errors/BadRequestError.d.ts +6 -0
  6. package/dist/api/errors/BadRequestError.js +54 -0
  7. package/dist/api/errors/ContentTooLargeError.d.ts +6 -0
  8. package/dist/api/errors/ContentTooLargeError.js +54 -0
  9. package/dist/api/errors/index.d.ts +3 -0
  10. package/dist/api/errors/index.js +3 -0
  11. package/dist/api/resources/files/client/Client.d.ts +188 -0
  12. package/dist/api/resources/files/client/Client.js +617 -0
  13. package/dist/api/resources/files/client/index.d.ts +1 -0
  14. package/dist/api/resources/files/client/index.js +17 -0
  15. package/dist/api/resources/files/client/requests/CancelFileUploadRequest.d.ts +9 -0
  16. package/dist/api/resources/files/client/requests/CancelFileUploadRequest.js +3 -0
  17. package/dist/api/resources/files/client/requests/CompleteFileUploadRequest.d.ts +15 -0
  18. package/dist/api/resources/files/client/requests/CompleteFileUploadRequest.js +3 -0
  19. package/dist/api/resources/files/client/requests/CreateFileDownloadUrlRequest.d.ts +9 -0
  20. package/dist/api/resources/files/client/requests/CreateFileDownloadUrlRequest.js +3 -0
  21. package/dist/api/resources/files/client/requests/DeleteFileRequest.d.ts +9 -0
  22. package/dist/api/resources/files/client/requests/DeleteFileRequest.js +3 -0
  23. package/dist/api/resources/files/client/requests/GetFileRequest.d.ts +9 -0
  24. package/dist/api/resources/files/client/requests/GetFileRequest.js +3 -0
  25. package/dist/api/resources/files/client/requests/InitiateFileUploadRequest.d.ts +41 -0
  26. package/dist/api/resources/files/client/requests/InitiateFileUploadRequest.js +17 -0
  27. package/dist/api/resources/files/client/requests/ListFilesRequest.d.ts +27 -0
  28. package/dist/api/resources/files/client/requests/ListFilesRequest.js +3 -0
  29. package/dist/api/resources/files/client/requests/ResumeFileUploadRequest.d.ts +9 -0
  30. package/dist/api/resources/files/client/requests/ResumeFileUploadRequest.js +3 -0
  31. package/dist/api/resources/files/client/requests/index.d.ts +8 -0
  32. package/dist/api/resources/files/client/requests/index.js +5 -0
  33. package/dist/api/resources/files/exports.d.ts +2 -0
  34. package/dist/api/resources/files/exports.js +21 -0
  35. package/dist/api/resources/files/index.d.ts +1 -0
  36. package/dist/api/resources/files/index.js +17 -0
  37. package/dist/api/resources/index.d.ts +6 -0
  38. package/dist/api/resources/index.js +7 -1
  39. package/dist/api/resources/positions/client/Client.d.ts +31 -0
  40. package/dist/api/resources/positions/client/Client.js +114 -0
  41. package/dist/api/resources/positions/client/index.d.ts +1 -0
  42. package/dist/api/resources/positions/client/index.js +2 -0
  43. package/dist/api/resources/positions/exports.d.ts +2 -0
  44. package/dist/api/resources/positions/exports.js +21 -0
  45. package/dist/api/resources/positions/index.d.ts +1 -0
  46. package/dist/api/resources/positions/index.js +17 -0
  47. package/dist/api/resources/taskAttempts/client/Client.d.ts +65 -0
  48. package/dist/api/resources/taskAttempts/client/Client.js +214 -0
  49. package/dist/api/resources/taskAttempts/client/index.d.ts +1 -0
  50. package/dist/api/resources/taskAttempts/client/index.js +17 -0
  51. package/dist/api/resources/taskAttempts/client/requests/CaptureTaskAttemptPhotoRequest.d.ts +49 -0
  52. package/dist/api/resources/taskAttempts/client/requests/CaptureTaskAttemptPhotoRequest.js +20 -0
  53. package/dist/api/resources/taskAttempts/client/requests/ListTaskAttemptPhotosRequest.d.ts +17 -0
  54. package/dist/api/resources/taskAttempts/client/requests/ListTaskAttemptPhotosRequest.js +3 -0
  55. package/dist/api/resources/taskAttempts/client/requests/index.d.ts +2 -0
  56. package/dist/api/resources/taskAttempts/client/requests/index.js +5 -0
  57. package/dist/api/resources/taskAttempts/exports.d.ts +2 -0
  58. package/dist/api/resources/taskAttempts/exports.js +21 -0
  59. package/dist/api/resources/taskAttempts/index.d.ts +1 -0
  60. package/dist/api/resources/taskAttempts/index.js +17 -0
  61. package/dist/api/resources/users/client/Client.d.ts +43 -0
  62. package/dist/api/resources/users/client/Client.js +145 -0
  63. package/dist/api/resources/users/client/index.d.ts +1 -1
  64. package/dist/api/resources/users/client/index.js +15 -0
  65. package/dist/api/resources/users/client/requests/GetUserProfilePictureRequest.d.ts +11 -0
  66. package/dist/api/resources/users/client/requests/GetUserProfilePictureRequest.js +3 -0
  67. package/dist/api/resources/users/client/requests/InitiateProfilePictureUploadRequest.d.ts +19 -0
  68. package/dist/api/resources/users/client/requests/InitiateProfilePictureUploadRequest.js +3 -0
  69. package/dist/api/resources/users/client/requests/index.d.ts +2 -0
  70. package/dist/api/resources/users/client/requests/index.js +2 -0
  71. package/dist/api/types/FileDownloadUrl.d.ts +16 -0
  72. package/dist/api/types/FileDownloadUrl.js +10 -0
  73. package/dist/api/types/FileUploadPart.d.ts +13 -0
  74. package/dist/api/types/FileUploadPart.js +3 -0
  75. package/dist/api/types/FileUploadPartReport.d.ts +9 -0
  76. package/dist/api/types/FileUploadPartReport.js +3 -0
  77. package/dist/api/types/FileUploadSession.d.ts +51 -0
  78. package/dist/api/types/FileUploadSession.js +28 -0
  79. package/dist/api/types/File_.d.ts +86 -0
  80. package/dist/api/types/File_.js +40 -0
  81. package/dist/api/types/HeatmapCell.d.ts +18 -0
  82. package/dist/api/types/HeatmapCell.js +10 -0
  83. package/dist/api/types/Job.d.ts +2 -0
  84. package/dist/api/types/Job.js +2 -0
  85. package/dist/api/types/ListResponseFile.d.ts +27 -0
  86. package/dist/api/types/ListResponseFile.js +11 -0
  87. package/dist/api/types/ListResponseHeatmapCell.d.ts +27 -0
  88. package/dist/api/types/ListResponseHeatmapCell.js +11 -0
  89. package/dist/api/types/ListResponseOperatorPosition.d.ts +27 -0
  90. package/dist/api/types/ListResponseOperatorPosition.js +11 -0
  91. package/dist/api/types/ListResponsePosition.d.ts +27 -0
  92. package/dist/api/types/ListResponsePosition.js +11 -0
  93. package/dist/api/types/MqttToken.d.ts +12 -0
  94. package/dist/api/types/MqttToken.js +3 -0
  95. package/dist/api/types/OperatorPosition.d.ts +28 -0
  96. package/dist/api/types/OperatorPosition.js +10 -0
  97. package/dist/api/types/Position.d.ts +30 -0
  98. package/dist/api/types/Position.js +10 -0
  99. package/dist/api/types/TaskAttemptPhoto.d.ts +30 -0
  100. package/dist/api/types/TaskAttemptPhoto.js +10 -0
  101. package/dist/api/types/TaskAttemptPhotoThumbnail.d.ts +9 -0
  102. package/dist/api/types/TaskAttemptPhotoThumbnail.js +3 -0
  103. package/dist/api/types/UploadInitiation.d.ts +22 -0
  104. package/dist/api/types/UploadInitiation.js +10 -0
  105. package/dist/api/types/UploadInitiationPart.d.ts +13 -0
  106. package/dist/api/types/UploadInitiationPart.js +3 -0
  107. package/dist/api/types/index.d.ts +17 -0
  108. package/dist/api/types/index.js +17 -0
  109. package/package.json +1 -1
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.TaskAttemptsClient = void 0;
38
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
39
+ const headers_js_1 = require("../../../../core/headers.js");
40
+ const core = __importStar(require("../../../../core/index.js"));
41
+ const environments = __importStar(require("../../../../environments.js"));
42
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
43
+ const errors = __importStar(require("../../../../errors/index.js"));
44
+ const NizamOperatorRuntime = __importStar(require("../../../index.js"));
45
+ class TaskAttemptsClient {
46
+ constructor(options) {
47
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
48
+ }
49
+ /**
50
+ * The attempt's photos in capture order, each with its scan-gated downloadability and rendered thumbnail variants. Bytes are requested per file via the generic download-URL endpoint (access-logged for this kind).
51
+ *
52
+ * @param {NizamOperatorRuntime.ListTaskAttemptPhotosRequest} request
53
+ * @param {TaskAttemptsClient.RequestOptions} requestOptions - Request-specific configuration.
54
+ *
55
+ * @throws {@link NizamOperatorRuntime.BadRequestError}
56
+ * @throws {@link NizamOperatorRuntime.UnauthorizedError}
57
+ * @throws {@link NizamOperatorRuntime.ForbiddenError}
58
+ * @throws {@link NizamOperatorRuntime.NotFoundError}
59
+ * @throws {@link NizamOperatorRuntime.TooManyRequestsError}
60
+ * @throws {@link NizamOperatorRuntime.InternalServerError}
61
+ *
62
+ * @example
63
+ * await client.taskAttempts.listTaskAttemptPhotos({
64
+ * attemptId: "00000000-0000-0000-0000-000000000000",
65
+ * starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
66
+ * ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
67
+ * })
68
+ */
69
+ listTaskAttemptPhotos(request, requestOptions) {
70
+ return core.HttpResponsePromise.fromPromise(this.__listTaskAttemptPhotos(request, requestOptions));
71
+ }
72
+ async __listTaskAttemptPhotos(request, requestOptions) {
73
+ const { attemptId, limit, starting_after: startingAfter, ending_before: endingBefore } = request;
74
+ const _queryParams = {
75
+ limit,
76
+ starting_after: startingAfter,
77
+ ending_before: endingBefore,
78
+ };
79
+ const _authRequest = await this._options.authProvider.getAuthRequest();
80
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
81
+ const _response = await core.fetcher({
82
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
83
+ (await core.Supplier.get(this._options.environment)) ??
84
+ environments.NizamOperatorRuntimeEnvironment.Production, `v1/task-attempts/${core.url.encodePathParam(attemptId)}/photos`),
85
+ method: "GET",
86
+ headers: _headers,
87
+ queryString: core.url
88
+ .queryBuilder()
89
+ .addMany(_queryParams)
90
+ .mergeAdditional(requestOptions?.queryParams)
91
+ .build(),
92
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
93
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
94
+ abortSignal: requestOptions?.abortSignal,
95
+ fetchFn: this._options?.fetch,
96
+ logging: this._options.logging,
97
+ });
98
+ if (_response.ok) {
99
+ return {
100
+ data: _response.body,
101
+ rawResponse: _response.rawResponse,
102
+ };
103
+ }
104
+ if (_response.error.reason === "status-code") {
105
+ switch (_response.error.statusCode) {
106
+ case 400:
107
+ throw new NizamOperatorRuntime.BadRequestError(_response.error.body, _response.rawResponse);
108
+ case 401:
109
+ throw new NizamOperatorRuntime.UnauthorizedError(_response.error.body, _response.rawResponse);
110
+ case 403:
111
+ throw new NizamOperatorRuntime.ForbiddenError(_response.error.body, _response.rawResponse);
112
+ case 404:
113
+ throw new NizamOperatorRuntime.NotFoundError(_response.error.body, _response.rawResponse);
114
+ case 429:
115
+ throw new NizamOperatorRuntime.TooManyRequestsError(_response.error.body, _response.rawResponse);
116
+ case 500:
117
+ throw new NizamOperatorRuntime.InternalServerError(_response.error.body, _response.rawResponse);
118
+ default:
119
+ throw new errors.NizamOperatorRuntimeError({
120
+ statusCode: _response.error.statusCode,
121
+ body: _response.error.body,
122
+ rawResponse: _response.rawResponse,
123
+ });
124
+ }
125
+ }
126
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/task-attempts/{attemptId}/photos");
127
+ }
128
+ /**
129
+ * Declares a proof-of-delivery photo upload for the attempt and returns presigned part URLs. PUT the bytes, then complete via the generic file-uploads endpoint — completion records the photo (with the capture facts declared here) atomically and queues the malware scan; the photo becomes downloadable only after a CLEAN verdict.
130
+ *
131
+ * @param {NizamOperatorRuntime.CaptureTaskAttemptPhotoRequest} request
132
+ * @param {TaskAttemptsClient.RequestOptions} requestOptions - Request-specific configuration.
133
+ *
134
+ * @throws {@link NizamOperatorRuntime.BadRequestError}
135
+ * @throws {@link NizamOperatorRuntime.UnauthorizedError}
136
+ * @throws {@link NizamOperatorRuntime.ForbiddenError}
137
+ * @throws {@link NizamOperatorRuntime.NotFoundError}
138
+ * @throws {@link NizamOperatorRuntime.ContentTooLargeError}
139
+ * @throws {@link NizamOperatorRuntime.UnprocessableEntityError}
140
+ * @throws {@link NizamOperatorRuntime.TooManyRequestsError}
141
+ * @throws {@link NizamOperatorRuntime.InternalServerError}
142
+ *
143
+ * @example
144
+ * await client.taskAttempts.captureTaskAttemptPhoto({
145
+ * attemptId: "00000000-0000-0000-0000-000000000000",
146
+ * filename: "delivery-door.jpg",
147
+ * content_type: "image/jpeg",
148
+ * size_bytes: 2048576,
149
+ * checksum_sha256: "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
150
+ * sequence: 0,
151
+ * photo_type: "placement",
152
+ * caption: "Left at the front door as instructed",
153
+ * taken_at: "2026-06-12T09:41:00Z"
154
+ * })
155
+ */
156
+ captureTaskAttemptPhoto(request, requestOptions) {
157
+ return core.HttpResponsePromise.fromPromise(this.__captureTaskAttemptPhoto(request, requestOptions));
158
+ }
159
+ async __captureTaskAttemptPhoto(request, requestOptions) {
160
+ const { attemptId, ..._body } = request;
161
+ const _authRequest = await this._options.authProvider.getAuthRequest();
162
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
163
+ const _response = await core.fetcher({
164
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
165
+ (await core.Supplier.get(this._options.environment)) ??
166
+ environments.NizamOperatorRuntimeEnvironment.Production, `v1/task-attempts/${core.url.encodePathParam(attemptId)}/photos`),
167
+ method: "POST",
168
+ headers: _headers,
169
+ contentType: "application/json",
170
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
171
+ requestType: "json",
172
+ body: _body,
173
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
174
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
175
+ abortSignal: requestOptions?.abortSignal,
176
+ fetchFn: this._options?.fetch,
177
+ logging: this._options.logging,
178
+ });
179
+ if (_response.ok) {
180
+ return {
181
+ data: _response.body,
182
+ rawResponse: _response.rawResponse,
183
+ };
184
+ }
185
+ if (_response.error.reason === "status-code") {
186
+ switch (_response.error.statusCode) {
187
+ case 400:
188
+ throw new NizamOperatorRuntime.BadRequestError(_response.error.body, _response.rawResponse);
189
+ case 401:
190
+ throw new NizamOperatorRuntime.UnauthorizedError(_response.error.body, _response.rawResponse);
191
+ case 403:
192
+ throw new NizamOperatorRuntime.ForbiddenError(_response.error.body, _response.rawResponse);
193
+ case 404:
194
+ throw new NizamOperatorRuntime.NotFoundError(_response.error.body, _response.rawResponse);
195
+ case 413:
196
+ throw new NizamOperatorRuntime.ContentTooLargeError(_response.error.body, _response.rawResponse);
197
+ case 422:
198
+ throw new NizamOperatorRuntime.UnprocessableEntityError(_response.error.body, _response.rawResponse);
199
+ case 429:
200
+ throw new NizamOperatorRuntime.TooManyRequestsError(_response.error.body, _response.rawResponse);
201
+ case 500:
202
+ throw new NizamOperatorRuntime.InternalServerError(_response.error.body, _response.rawResponse);
203
+ default:
204
+ throw new errors.NizamOperatorRuntimeError({
205
+ statusCode: _response.error.statusCode,
206
+ body: _response.error.body,
207
+ rawResponse: _response.rawResponse,
208
+ });
209
+ }
210
+ }
211
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/task-attempts/{attemptId}/photos");
212
+ }
213
+ }
214
+ exports.TaskAttemptsClient = TaskAttemptsClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * attemptId: "00000000-0000-0000-0000-000000000000",
5
+ * filename: "delivery-door.jpg",
6
+ * content_type: "image/jpeg",
7
+ * size_bytes: 2048576,
8
+ * checksum_sha256: "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
9
+ * sequence: 0,
10
+ * photo_type: "placement",
11
+ * caption: "Left at the front door as instructed",
12
+ * taken_at: "2026-06-12T09:41:00Z"
13
+ * }
14
+ */
15
+ export interface CaptureTaskAttemptPhotoRequest {
16
+ attemptId: string;
17
+ /** Original filename. */
18
+ filename: string;
19
+ /** Declared MIME type — POD photos accept image/jpeg, image/png, image/webp, image/heic, image/heif. */
20
+ content_type: string;
21
+ /** Exact byte size; verified against storage at completion. */
22
+ size_bytes?: number;
23
+ /** Client-computed SHA-256 of the content, lowercase hex; re-verified server-side by the pipeline. */
24
+ checksum_sha256: string;
25
+ /** Display order within the attempt; defaults to the next free slot. */
26
+ sequence?: number;
27
+ /** Photo category: `proof_of_delivery`, `placement`, `contents`, `damage`, `door`, `signature`, `id_verification`, `barcode`, `site_condition`, `other`. Omit for a free capture. */
28
+ photo_type?: CaptureTaskAttemptPhotoRequest.PhotoType;
29
+ /** Operator-entered caption. */
30
+ caption?: string;
31
+ /** Capture timestamp from the device (EXIF time) — distinct from the upload time, which may lag over flaky mobile connections. */
32
+ taken_at?: string;
33
+ }
34
+ export declare namespace CaptureTaskAttemptPhotoRequest {
35
+ /** Photo category: `proof_of_delivery`, `placement`, `contents`, `damage`, `door`, `signature`, `id_verification`, `barcode`, `site_condition`, `other`. Omit for a free capture. */
36
+ const PhotoType: {
37
+ readonly ProofOfDelivery: "proof_of_delivery";
38
+ readonly Placement: "placement";
39
+ readonly Contents: "contents";
40
+ readonly Damage: "damage";
41
+ readonly Door: "door";
42
+ readonly Signature: "signature";
43
+ readonly IdVerification: "id_verification";
44
+ readonly Barcode: "barcode";
45
+ readonly SiteCondition: "site_condition";
46
+ readonly Other: "other";
47
+ };
48
+ type PhotoType = (typeof PhotoType)[keyof typeof PhotoType];
49
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CaptureTaskAttemptPhotoRequest = void 0;
5
+ var CaptureTaskAttemptPhotoRequest;
6
+ (function (CaptureTaskAttemptPhotoRequest) {
7
+ /** Photo category: `proof_of_delivery`, `placement`, `contents`, `damage`, `door`, `signature`, `id_verification`, `barcode`, `site_condition`, `other`. Omit for a free capture. */
8
+ CaptureTaskAttemptPhotoRequest.PhotoType = {
9
+ ProofOfDelivery: "proof_of_delivery",
10
+ Placement: "placement",
11
+ Contents: "contents",
12
+ Damage: "damage",
13
+ Door: "door",
14
+ Signature: "signature",
15
+ IdVerification: "id_verification",
16
+ Barcode: "barcode",
17
+ SiteCondition: "site_condition",
18
+ Other: "other",
19
+ };
20
+ })(CaptureTaskAttemptPhotoRequest || (exports.CaptureTaskAttemptPhotoRequest = CaptureTaskAttemptPhotoRequest = {}));
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * attemptId: "00000000-0000-0000-0000-000000000000",
5
+ * starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
6
+ * ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
7
+ * }
8
+ */
9
+ export interface ListTaskAttemptPhotosRequest {
10
+ attemptId: string;
11
+ /** Page size. Default 20, maximum 100. Out-of-range values are silently clamped; the response body's `limit` field reflects what was applied. */
12
+ limit?: number;
13
+ /** Opaque cursor — return the page starting strictly after this entity in the sort order. Mutually exclusive with `ending_before`. */
14
+ starting_after?: string;
15
+ /** Opaque cursor — return the page ending strictly before this entity in the sort order. Mutually exclusive with `starting_after`. */
16
+ ending_before?: string;
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { CaptureTaskAttemptPhotoRequest } from "./CaptureTaskAttemptPhotoRequest.js";
2
+ export type { ListTaskAttemptPhotosRequest } from "./ListTaskAttemptPhotosRequest.js";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CaptureTaskAttemptPhotoRequest = void 0;
4
+ var CaptureTaskAttemptPhotoRequest_js_1 = require("./CaptureTaskAttemptPhotoRequest.js");
5
+ Object.defineProperty(exports, "CaptureTaskAttemptPhotoRequest", { enumerable: true, get: function () { return CaptureTaskAttemptPhotoRequest_js_1.CaptureTaskAttemptPhotoRequest; } });
@@ -0,0 +1,2 @@
1
+ export { TaskAttemptsClient } from "./client/Client.js";
2
+ export * from "./client/index.js";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.TaskAttemptsClient = void 0;
19
+ var Client_js_1 = require("./client/Client.js");
20
+ Object.defineProperty(exports, "TaskAttemptsClient", { enumerable: true, get: function () { return Client_js_1.TaskAttemptsClient; } });
21
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -38,4 +38,47 @@ export declare class UsersClient {
38
38
  */
39
39
  me(requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<NizamOperatorRuntime.User>;
40
40
  private __me;
41
+ /**
42
+ * Declares a profile-picture upload for the AUTHENTICATED user (the subject is pinned server-side) and returns presigned part URLs. PUT the bytes to the URLs, then complete via the generic file-uploads endpoint — completion re-points the profile and soft-deletes the replaced picture; thumbnails (256/128/64 px) render asynchronously. The reference upload flow of epic #151 (#166).
43
+ *
44
+ * @param {NizamOperatorRuntime.InitiateProfilePictureUploadRequest} request
45
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
46
+ *
47
+ * @throws {@link NizamOperatorRuntime.BadRequestError}
48
+ * @throws {@link NizamOperatorRuntime.UnauthorizedError}
49
+ * @throws {@link NizamOperatorRuntime.ForbiddenError}
50
+ * @throws {@link NizamOperatorRuntime.ContentTooLargeError}
51
+ * @throws {@link NizamOperatorRuntime.UnprocessableEntityError}
52
+ * @throws {@link NizamOperatorRuntime.TooManyRequestsError}
53
+ * @throws {@link NizamOperatorRuntime.InternalServerError}
54
+ *
55
+ * @example
56
+ * await client.users.initiateProfilePictureUpload({
57
+ * filename: "avatar.png",
58
+ * content_type: "image/png",
59
+ * size_bytes: 204857,
60
+ * checksum_sha256: "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
61
+ * })
62
+ */
63
+ initiateProfilePictureUpload(request: NizamOperatorRuntime.InitiateProfilePictureUploadRequest, requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<NizamOperatorRuntime.UploadInitiation>;
64
+ private __initiateProfilePictureUpload;
65
+ /**
66
+ * 302-redirects to a short-lived URL for the thumbnail variant nearest the requested `size` (smallest rendered variant that still covers it; the original while thumbnails are still rendering). Cross-tenant callers get 404: the picture's file row is only visible inside the organization it was uploaded in (RLS).
67
+ *
68
+ * @param {NizamOperatorRuntime.GetUserProfilePictureRequest} request
69
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
70
+ *
71
+ * @throws {@link NizamOperatorRuntime.UnauthorizedError}
72
+ * @throws {@link NizamOperatorRuntime.ForbiddenError}
73
+ * @throws {@link NizamOperatorRuntime.NotFoundError}
74
+ * @throws {@link NizamOperatorRuntime.TooManyRequestsError}
75
+ * @throws {@link NizamOperatorRuntime.InternalServerError}
76
+ *
77
+ * @example
78
+ * await client.users.getUserProfilePicture({
79
+ * id: "00000000-0000-0000-0000-000000000000"
80
+ * })
81
+ */
82
+ getUserProfilePicture(request: NizamOperatorRuntime.GetUserProfilePictureRequest, requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<void>;
83
+ private __getUserProfilePicture;
41
84
  }
@@ -116,5 +116,150 @@ class UsersClient {
116
116
  }
117
117
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/me");
118
118
  }
119
+ /**
120
+ * Declares a profile-picture upload for the AUTHENTICATED user (the subject is pinned server-side) and returns presigned part URLs. PUT the bytes to the URLs, then complete via the generic file-uploads endpoint — completion re-points the profile and soft-deletes the replaced picture; thumbnails (256/128/64 px) render asynchronously. The reference upload flow of epic #151 (#166).
121
+ *
122
+ * @param {NizamOperatorRuntime.InitiateProfilePictureUploadRequest} request
123
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
124
+ *
125
+ * @throws {@link NizamOperatorRuntime.BadRequestError}
126
+ * @throws {@link NizamOperatorRuntime.UnauthorizedError}
127
+ * @throws {@link NizamOperatorRuntime.ForbiddenError}
128
+ * @throws {@link NizamOperatorRuntime.ContentTooLargeError}
129
+ * @throws {@link NizamOperatorRuntime.UnprocessableEntityError}
130
+ * @throws {@link NizamOperatorRuntime.TooManyRequestsError}
131
+ * @throws {@link NizamOperatorRuntime.InternalServerError}
132
+ *
133
+ * @example
134
+ * await client.users.initiateProfilePictureUpload({
135
+ * filename: "avatar.png",
136
+ * content_type: "image/png",
137
+ * size_bytes: 204857,
138
+ * checksum_sha256: "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
139
+ * })
140
+ */
141
+ initiateProfilePictureUpload(request, requestOptions) {
142
+ return core.HttpResponsePromise.fromPromise(this.__initiateProfilePictureUpload(request, requestOptions));
143
+ }
144
+ async __initiateProfilePictureUpload(request, requestOptions) {
145
+ const _authRequest = await this._options.authProvider.getAuthRequest();
146
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
147
+ const _response = await core.fetcher({
148
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
149
+ (await core.Supplier.get(this._options.environment)) ??
150
+ environments.NizamOperatorRuntimeEnvironment.Production, "v1/me/profile-picture"),
151
+ method: "POST",
152
+ headers: _headers,
153
+ contentType: "application/json",
154
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
155
+ requestType: "json",
156
+ body: request,
157
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
158
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
159
+ abortSignal: requestOptions?.abortSignal,
160
+ fetchFn: this._options?.fetch,
161
+ logging: this._options.logging,
162
+ });
163
+ if (_response.ok) {
164
+ return {
165
+ data: _response.body,
166
+ rawResponse: _response.rawResponse,
167
+ };
168
+ }
169
+ if (_response.error.reason === "status-code") {
170
+ switch (_response.error.statusCode) {
171
+ case 400:
172
+ throw new NizamOperatorRuntime.BadRequestError(_response.error.body, _response.rawResponse);
173
+ case 401:
174
+ throw new NizamOperatorRuntime.UnauthorizedError(_response.error.body, _response.rawResponse);
175
+ case 403:
176
+ throw new NizamOperatorRuntime.ForbiddenError(_response.error.body, _response.rawResponse);
177
+ case 413:
178
+ throw new NizamOperatorRuntime.ContentTooLargeError(_response.error.body, _response.rawResponse);
179
+ case 422:
180
+ throw new NizamOperatorRuntime.UnprocessableEntityError(_response.error.body, _response.rawResponse);
181
+ case 429:
182
+ throw new NizamOperatorRuntime.TooManyRequestsError(_response.error.body, _response.rawResponse);
183
+ case 500:
184
+ throw new NizamOperatorRuntime.InternalServerError(_response.error.body, _response.rawResponse);
185
+ default:
186
+ throw new errors.NizamOperatorRuntimeError({
187
+ statusCode: _response.error.statusCode,
188
+ body: _response.error.body,
189
+ rawResponse: _response.rawResponse,
190
+ });
191
+ }
192
+ }
193
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/me/profile-picture");
194
+ }
195
+ /**
196
+ * 302-redirects to a short-lived URL for the thumbnail variant nearest the requested `size` (smallest rendered variant that still covers it; the original while thumbnails are still rendering). Cross-tenant callers get 404: the picture's file row is only visible inside the organization it was uploaded in (RLS).
197
+ *
198
+ * @param {NizamOperatorRuntime.GetUserProfilePictureRequest} request
199
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
200
+ *
201
+ * @throws {@link NizamOperatorRuntime.UnauthorizedError}
202
+ * @throws {@link NizamOperatorRuntime.ForbiddenError}
203
+ * @throws {@link NizamOperatorRuntime.NotFoundError}
204
+ * @throws {@link NizamOperatorRuntime.TooManyRequestsError}
205
+ * @throws {@link NizamOperatorRuntime.InternalServerError}
206
+ *
207
+ * @example
208
+ * await client.users.getUserProfilePicture({
209
+ * id: "00000000-0000-0000-0000-000000000000"
210
+ * })
211
+ */
212
+ getUserProfilePicture(request, requestOptions) {
213
+ return core.HttpResponsePromise.fromPromise(this.__getUserProfilePicture(request, requestOptions));
214
+ }
215
+ async __getUserProfilePicture(request, requestOptions) {
216
+ const { id, size } = request;
217
+ const _queryParams = {
218
+ size,
219
+ };
220
+ const _authRequest = await this._options.authProvider.getAuthRequest();
221
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
222
+ const _response = await core.fetcher({
223
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
224
+ (await core.Supplier.get(this._options.environment)) ??
225
+ environments.NizamOperatorRuntimeEnvironment.Production, `v1/users/${core.url.encodePathParam(id)}/profile-picture`),
226
+ method: "GET",
227
+ headers: _headers,
228
+ queryString: core.url
229
+ .queryBuilder()
230
+ .addMany(_queryParams)
231
+ .mergeAdditional(requestOptions?.queryParams)
232
+ .build(),
233
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
234
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
235
+ abortSignal: requestOptions?.abortSignal,
236
+ fetchFn: this._options?.fetch,
237
+ logging: this._options.logging,
238
+ });
239
+ if (_response.ok) {
240
+ return { data: undefined, rawResponse: _response.rawResponse };
241
+ }
242
+ if (_response.error.reason === "status-code") {
243
+ switch (_response.error.statusCode) {
244
+ case 401:
245
+ throw new NizamOperatorRuntime.UnauthorizedError(_response.error.body, _response.rawResponse);
246
+ case 403:
247
+ throw new NizamOperatorRuntime.ForbiddenError(_response.error.body, _response.rawResponse);
248
+ case 404:
249
+ throw new NizamOperatorRuntime.NotFoundError(_response.error.body, _response.rawResponse);
250
+ case 429:
251
+ throw new NizamOperatorRuntime.TooManyRequestsError(_response.error.body, _response.rawResponse);
252
+ case 500:
253
+ throw new NizamOperatorRuntime.InternalServerError(_response.error.body, _response.rawResponse);
254
+ default:
255
+ throw new errors.NizamOperatorRuntimeError({
256
+ statusCode: _response.error.statusCode,
257
+ body: _response.error.body,
258
+ rawResponse: _response.rawResponse,
259
+ });
260
+ }
261
+ }
262
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/users/{id}/profile-picture");
263
+ }
119
264
  }
120
265
  exports.UsersClient = UsersClient;
@@ -1 +1 @@
1
- export {};
1
+ export * from "./requests/index.js";
@@ -1,2 +1,17 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "00000000-0000-0000-0000-000000000000"
5
+ * }
6
+ */
7
+ export interface GetUserProfilePictureRequest {
8
+ id: string;
9
+ /** Desired bounding-box size in px (rendered variants: 256/128/64). */
10
+ size?: number;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * filename: "avatar.png",
5
+ * content_type: "image/png",
6
+ * size_bytes: 204857,
7
+ * checksum_sha256: "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
8
+ * }
9
+ */
10
+ export interface InitiateProfilePictureUploadRequest {
11
+ /** Original filename. */
12
+ filename: string;
13
+ /** Declared MIME type — profile pictures accept image/jpeg, image/png, image/webp; re-verified server-side at completion. */
14
+ content_type: string;
15
+ /** Exact byte size; verified against storage at completion. */
16
+ size_bytes?: number;
17
+ /** Client-computed SHA-256 of the content, lowercase hex; re-verified server-side by the pipeline. */
18
+ checksum_sha256: string;
19
+ }