@nizam-os/customer-sdk 2.4.3 → 2.6.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 (80) hide show
  1. package/dist/Client.d.ts +3 -0
  2. package/dist/Client.js +10 -6
  3. package/dist/api/errors/BadRequestError.d.ts +6 -0
  4. package/dist/api/errors/BadRequestError.js +54 -0
  5. package/dist/api/errors/ContentTooLargeError.d.ts +6 -0
  6. package/dist/api/errors/ContentTooLargeError.js +54 -0
  7. package/dist/api/errors/GoneError.d.ts +6 -0
  8. package/dist/api/errors/GoneError.js +54 -0
  9. package/dist/api/errors/NotFoundError.d.ts +6 -0
  10. package/dist/api/errors/NotFoundError.js +54 -0
  11. package/dist/api/errors/UnprocessableEntityError.d.ts +6 -0
  12. package/dist/api/errors/UnprocessableEntityError.js +54 -0
  13. package/dist/api/errors/index.d.ts +5 -0
  14. package/dist/api/errors/index.js +5 -0
  15. package/dist/api/resources/files/client/Client.d.ts +188 -0
  16. package/dist/api/resources/files/client/Client.js +608 -0
  17. package/dist/api/resources/files/client/index.d.ts +1 -0
  18. package/dist/api/resources/files/client/index.js +17 -0
  19. package/dist/api/resources/files/client/requests/CancelFileUploadRequest.d.ts +9 -0
  20. package/dist/api/resources/files/client/requests/CancelFileUploadRequest.js +3 -0
  21. package/dist/api/resources/files/client/requests/CompleteFileUploadRequest.d.ts +15 -0
  22. package/dist/api/resources/files/client/requests/CompleteFileUploadRequest.js +3 -0
  23. package/dist/api/resources/files/client/requests/CreateFileDownloadUrlRequest.d.ts +9 -0
  24. package/dist/api/resources/files/client/requests/CreateFileDownloadUrlRequest.js +3 -0
  25. package/dist/api/resources/files/client/requests/DeleteFileRequest.d.ts +9 -0
  26. package/dist/api/resources/files/client/requests/DeleteFileRequest.js +3 -0
  27. package/dist/api/resources/files/client/requests/GetFileRequest.d.ts +9 -0
  28. package/dist/api/resources/files/client/requests/GetFileRequest.js +3 -0
  29. package/dist/api/resources/files/client/requests/InitiateFileUploadRequest.d.ts +41 -0
  30. package/dist/api/resources/files/client/requests/InitiateFileUploadRequest.js +17 -0
  31. package/dist/api/resources/files/client/requests/ListFilesRequest.d.ts +27 -0
  32. package/dist/api/resources/files/client/requests/ListFilesRequest.js +3 -0
  33. package/dist/api/resources/files/client/requests/ResumeFileUploadRequest.d.ts +9 -0
  34. package/dist/api/resources/files/client/requests/ResumeFileUploadRequest.js +3 -0
  35. package/dist/api/resources/files/client/requests/index.d.ts +8 -0
  36. package/dist/api/resources/files/client/requests/index.js +5 -0
  37. package/dist/api/resources/files/exports.d.ts +2 -0
  38. package/dist/api/resources/files/exports.js +21 -0
  39. package/dist/api/resources/files/index.d.ts +1 -0
  40. package/dist/api/resources/files/index.js +17 -0
  41. package/dist/api/resources/index.d.ts +3 -0
  42. package/dist/api/resources/index.js +7 -1
  43. package/dist/api/resources/users/client/Client.d.ts +43 -0
  44. package/dist/api/resources/users/client/Client.js +142 -0
  45. package/dist/api/resources/users/client/index.d.ts +1 -1
  46. package/dist/api/resources/users/client/index.js +15 -0
  47. package/dist/api/resources/users/client/requests/GetUserProfilePictureRequest.d.ts +11 -0
  48. package/dist/api/resources/users/client/requests/GetUserProfilePictureRequest.js +3 -0
  49. package/dist/api/resources/users/client/requests/InitiateProfilePictureUploadRequest.d.ts +19 -0
  50. package/dist/api/resources/users/client/requests/InitiateProfilePictureUploadRequest.js +3 -0
  51. package/dist/api/resources/users/client/requests/index.d.ts +2 -0
  52. package/dist/api/resources/users/client/requests/index.js +2 -0
  53. package/dist/api/types/CaptureTaskAttemptPhotoRequest.d.ts +37 -0
  54. package/dist/api/types/CaptureTaskAttemptPhotoRequest.js +20 -0
  55. package/dist/api/types/FileDownloadUrl.d.ts +16 -0
  56. package/dist/api/types/FileDownloadUrl.js +10 -0
  57. package/dist/api/types/FileUploadPart.d.ts +13 -0
  58. package/dist/api/types/FileUploadPart.js +3 -0
  59. package/dist/api/types/FileUploadPartReport.d.ts +9 -0
  60. package/dist/api/types/FileUploadPartReport.js +3 -0
  61. package/dist/api/types/FileUploadSession.d.ts +51 -0
  62. package/dist/api/types/FileUploadSession.js +28 -0
  63. package/dist/api/types/File_.d.ts +86 -0
  64. package/dist/api/types/File_.js +40 -0
  65. package/dist/api/types/Job.d.ts +2 -0
  66. package/dist/api/types/Job.js +2 -0
  67. package/dist/api/types/ListResponseFile.d.ts +27 -0
  68. package/dist/api/types/ListResponseFile.js +11 -0
  69. package/dist/api/types/TaskAttemptPhoto.d.ts +30 -0
  70. package/dist/api/types/TaskAttemptPhoto.js +10 -0
  71. package/dist/api/types/TaskAttemptPhotoThumbnail.d.ts +9 -0
  72. package/dist/api/types/TaskAttemptPhotoThumbnail.js +3 -0
  73. package/dist/api/types/UploadInitiation.d.ts +22 -0
  74. package/dist/api/types/UploadInitiation.js +10 -0
  75. package/dist/api/types/UploadInitiationPart.d.ts +13 -0
  76. package/dist/api/types/UploadInitiationPart.js +3 -0
  77. package/dist/api/types/User.d.ts +2 -0
  78. package/dist/api/types/index.d.ts +11 -0
  79. package/dist/api/types/index.js +11 -0
  80. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "00000000-0000-0000-0000-000000000000"
5
+ * }
6
+ */
7
+ export interface CreateFileDownloadUrlRequest {
8
+ id: string;
9
+ }
@@ -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,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "00000000-0000-0000-0000-000000000000"
5
+ * }
6
+ */
7
+ export interface DeleteFileRequest {
8
+ id: string;
9
+ }
@@ -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,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "00000000-0000-0000-0000-000000000000"
5
+ * }
6
+ */
7
+ export interface GetFileRequest {
8
+ id: string;
9
+ }
@@ -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,41 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * kind: "profile_picture",
5
+ * subject_type: "task_attempt",
6
+ * subject_id: "b3c4d5e6-7f8a-9b0c-1d2e-3f4a5b6c7d8e",
7
+ * filename: "pod-photo.jpg",
8
+ * content_type: "image/jpeg",
9
+ * size_bytes: 2048576,
10
+ * checksum_sha256: "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
11
+ * }
12
+ */
13
+ export interface InitiateFileUploadRequest {
14
+ /** What the bytes are for the platform — fixes the policy applied to them. */
15
+ kind: InitiateFileUploadRequest.Kind;
16
+ /** Type of the business entity this file documents (optional at upload time; can also be attached later). */
17
+ subject_type?: string;
18
+ /** Id of the business entity this file documents. Requires subject_type. */
19
+ subject_id?: string;
20
+ /** Original filename; served back via Content-Disposition on download. */
21
+ filename: string;
22
+ /** Declared MIME type. Must be on the kind's allow-list; re-verified by server-side detection at completion. */
23
+ content_type: string;
24
+ /** Exact byte size of the file. Verified against storage at completion. */
25
+ size_bytes?: number;
26
+ /** SHA-256 of the content as 64 lowercase hex characters (compute with crypto.subtle.digest). Re-verified server-side by the scan pipeline. */
27
+ checksum_sha256: string;
28
+ }
29
+ export declare namespace InitiateFileUploadRequest {
30
+ /** What the bytes are for the platform — fixes the policy applied to them. */
31
+ const Kind: {
32
+ readonly ProfilePicture: "profile_picture";
33
+ readonly ChatAttachment: "chat_attachment";
34
+ readonly TaskPodPhoto: "task_pod_photo";
35
+ readonly ImportSource: "import_source";
36
+ readonly ImportReport: "import_report";
37
+ readonly SignedDocument: "signed_document";
38
+ readonly ProductImage: "product_image";
39
+ };
40
+ type Kind = (typeof Kind)[keyof typeof Kind];
41
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.InitiateFileUploadRequest = void 0;
5
+ var InitiateFileUploadRequest;
6
+ (function (InitiateFileUploadRequest) {
7
+ /** What the bytes are for the platform — fixes the policy applied to them. */
8
+ InitiateFileUploadRequest.Kind = {
9
+ ProfilePicture: "profile_picture",
10
+ ChatAttachment: "chat_attachment",
11
+ TaskPodPhoto: "task_pod_photo",
12
+ ImportSource: "import_source",
13
+ ImportReport: "import_report",
14
+ SignedDocument: "signed_document",
15
+ ProductImage: "product_image",
16
+ };
17
+ })(InitiateFileUploadRequest || (exports.InitiateFileUploadRequest = InitiateFileUploadRequest = {}));
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * subject_type: "<string>",
5
+ * subject_id: "00000000-0000-0000-0000-000000000000",
6
+ * starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
7
+ * ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
8
+ * }
9
+ */
10
+ export interface ListFilesRequest {
11
+ /** Filter by file kind. Comma-separated; values: `profile_picture`, `chat_attachment`, `task_pod_photo`, `import_source`, `import_report`, `signed_document`, `product_image`. */
12
+ kind?: string | string[];
13
+ /** Filter by lifecycle status. Comma-separated; values: `active`, `quarantined`, `deleted`. */
14
+ status?: string | string[];
15
+ /** Filter by the documented entity's type (pairs with `subject_id`). */
16
+ subject_type?: string;
17
+ /** Filter by the documented entity's id (requires `subject_type`). */
18
+ subject_id?: string;
19
+ /** Sort order. Allowed fields: `created_at`. Prefix a field with `-` for descending (e.g. `-created_at`); unknown fields are rejected with `400 validation_failed`. */
20
+ sort?: string | string[];
21
+ /** Page size. Default 20, maximum 100. Out-of-range values are silently clamped; the response body's `limit` field reflects what was applied. */
22
+ limit?: number;
23
+ /** Opaque cursor — return the page starting strictly after this entity in the sort order. Mutually exclusive with `ending_before`. */
24
+ starting_after?: string;
25
+ /** Opaque cursor — return the page ending strictly before this entity in the sort order. Mutually exclusive with `starting_after`. */
26
+ ending_before?: string;
27
+ }
@@ -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,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "00000000-0000-0000-0000-000000000000"
5
+ * }
6
+ */
7
+ export interface ResumeFileUploadRequest {
8
+ id: string;
9
+ }
@@ -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,8 @@
1
+ export type { CancelFileUploadRequest } from "./CancelFileUploadRequest.js";
2
+ export type { CompleteFileUploadRequest } from "./CompleteFileUploadRequest.js";
3
+ export type { CreateFileDownloadUrlRequest } from "./CreateFileDownloadUrlRequest.js";
4
+ export type { DeleteFileRequest } from "./DeleteFileRequest.js";
5
+ export type { GetFileRequest } from "./GetFileRequest.js";
6
+ export { InitiateFileUploadRequest } from "./InitiateFileUploadRequest.js";
7
+ export type { ListFilesRequest } from "./ListFilesRequest.js";
8
+ export type { ResumeFileUploadRequest } from "./ResumeFileUploadRequest.js";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InitiateFileUploadRequest = void 0;
4
+ var InitiateFileUploadRequest_js_1 = require("./InitiateFileUploadRequest.js");
5
+ Object.defineProperty(exports, "InitiateFileUploadRequest", { enumerable: true, get: function () { return InitiateFileUploadRequest_js_1.InitiateFileUploadRequest; } });
@@ -0,0 +1,2 @@
1
+ export { FilesClient } 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.FilesClient = void 0;
19
+ var Client_js_1 = require("./client/Client.js");
20
+ Object.defineProperty(exports, "FilesClient", { enumerable: true, get: function () { return Client_js_1.FilesClient; } });
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);
@@ -1,3 +1,6 @@
1
+ export * from "./files/client/requests/index.js";
2
+ export * as files from "./files/index.js";
1
3
  export * as lookups from "./lookups/index.js";
2
4
  export * as realtime from "./realtime/index.js";
5
+ export * from "./users/client/requests/index.js";
3
6
  export * as users from "./users/index.js";
@@ -15,6 +15,9 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
18
21
  var __importStar = (this && this.__importStar) || (function () {
19
22
  var ownKeys = function(o) {
20
23
  ownKeys = Object.getOwnPropertyNames || function (o) {
@@ -33,7 +36,10 @@ var __importStar = (this && this.__importStar) || (function () {
33
36
  };
34
37
  })();
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.users = exports.realtime = exports.lookups = void 0;
39
+ exports.users = exports.realtime = exports.lookups = exports.files = void 0;
40
+ __exportStar(require("./files/client/requests/index.js"), exports);
41
+ exports.files = __importStar(require("./files/index.js"));
37
42
  exports.lookups = __importStar(require("./lookups/index.js"));
38
43
  exports.realtime = __importStar(require("./realtime/index.js"));
44
+ __exportStar(require("./users/client/requests/index.js"), exports);
39
45
  exports.users = __importStar(require("./users/index.js"));
@@ -38,4 +38,47 @@ export declare class UsersClient {
38
38
  */
39
39
  me(requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<NizamCustomer.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 {NizamCustomer.InitiateProfilePictureUploadRequest} request
45
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
46
+ *
47
+ * @throws {@link NizamCustomer.BadRequestError}
48
+ * @throws {@link NizamCustomer.UnauthorizedError}
49
+ * @throws {@link NizamCustomer.ForbiddenError}
50
+ * @throws {@link NizamCustomer.ContentTooLargeError}
51
+ * @throws {@link NizamCustomer.UnprocessableEntityError}
52
+ * @throws {@link NizamCustomer.TooManyRequestsError}
53
+ * @throws {@link NizamCustomer.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: NizamCustomer.InitiateProfilePictureUploadRequest, requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<NizamCustomer.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 {NizamCustomer.GetUserProfilePictureRequest} request
69
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
70
+ *
71
+ * @throws {@link NizamCustomer.UnauthorizedError}
72
+ * @throws {@link NizamCustomer.ForbiddenError}
73
+ * @throws {@link NizamCustomer.NotFoundError}
74
+ * @throws {@link NizamCustomer.TooManyRequestsError}
75
+ * @throws {@link NizamCustomer.InternalServerError}
76
+ *
77
+ * @example
78
+ * await client.users.getUserProfilePicture({
79
+ * id: "00000000-0000-0000-0000-000000000000"
80
+ * })
81
+ */
82
+ getUserProfilePicture(request: NizamCustomer.GetUserProfilePictureRequest, requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<void>;
83
+ private __getUserProfilePicture;
41
84
  }
@@ -116,5 +116,147 @@ 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 {NizamCustomer.InitiateProfilePictureUploadRequest} request
123
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
124
+ *
125
+ * @throws {@link NizamCustomer.BadRequestError}
126
+ * @throws {@link NizamCustomer.UnauthorizedError}
127
+ * @throws {@link NizamCustomer.ForbiddenError}
128
+ * @throws {@link NizamCustomer.ContentTooLargeError}
129
+ * @throws {@link NizamCustomer.UnprocessableEntityError}
130
+ * @throws {@link NizamCustomer.TooManyRequestsError}
131
+ * @throws {@link NizamCustomer.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.NizamCustomerEnvironment.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 { data: _response.body, rawResponse: _response.rawResponse };
165
+ }
166
+ if (_response.error.reason === "status-code") {
167
+ switch (_response.error.statusCode) {
168
+ case 400:
169
+ throw new NizamCustomer.BadRequestError(_response.error.body, _response.rawResponse);
170
+ case 401:
171
+ throw new NizamCustomer.UnauthorizedError(_response.error.body, _response.rawResponse);
172
+ case 403:
173
+ throw new NizamCustomer.ForbiddenError(_response.error.body, _response.rawResponse);
174
+ case 413:
175
+ throw new NizamCustomer.ContentTooLargeError(_response.error.body, _response.rawResponse);
176
+ case 422:
177
+ throw new NizamCustomer.UnprocessableEntityError(_response.error.body, _response.rawResponse);
178
+ case 429:
179
+ throw new NizamCustomer.TooManyRequestsError(_response.error.body, _response.rawResponse);
180
+ case 500:
181
+ throw new NizamCustomer.InternalServerError(_response.error.body, _response.rawResponse);
182
+ default:
183
+ throw new errors.NizamCustomerError({
184
+ statusCode: _response.error.statusCode,
185
+ body: _response.error.body,
186
+ rawResponse: _response.rawResponse,
187
+ });
188
+ }
189
+ }
190
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/me/profile-picture");
191
+ }
192
+ /**
193
+ * 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).
194
+ *
195
+ * @param {NizamCustomer.GetUserProfilePictureRequest} request
196
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
197
+ *
198
+ * @throws {@link NizamCustomer.UnauthorizedError}
199
+ * @throws {@link NizamCustomer.ForbiddenError}
200
+ * @throws {@link NizamCustomer.NotFoundError}
201
+ * @throws {@link NizamCustomer.TooManyRequestsError}
202
+ * @throws {@link NizamCustomer.InternalServerError}
203
+ *
204
+ * @example
205
+ * await client.users.getUserProfilePicture({
206
+ * id: "00000000-0000-0000-0000-000000000000"
207
+ * })
208
+ */
209
+ getUserProfilePicture(request, requestOptions) {
210
+ return core.HttpResponsePromise.fromPromise(this.__getUserProfilePicture(request, requestOptions));
211
+ }
212
+ async __getUserProfilePicture(request, requestOptions) {
213
+ const { id, size } = request;
214
+ const _queryParams = {
215
+ size,
216
+ };
217
+ const _authRequest = await this._options.authProvider.getAuthRequest();
218
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
219
+ const _response = await core.fetcher({
220
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
221
+ (await core.Supplier.get(this._options.environment)) ??
222
+ environments.NizamCustomerEnvironment.Production, `v1/users/${core.url.encodePathParam(id)}/profile-picture`),
223
+ method: "GET",
224
+ headers: _headers,
225
+ queryString: core.url
226
+ .queryBuilder()
227
+ .addMany(_queryParams)
228
+ .mergeAdditional(requestOptions?.queryParams)
229
+ .build(),
230
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
231
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
232
+ abortSignal: requestOptions?.abortSignal,
233
+ fetchFn: this._options?.fetch,
234
+ logging: this._options.logging,
235
+ });
236
+ if (_response.ok) {
237
+ return { data: undefined, rawResponse: _response.rawResponse };
238
+ }
239
+ if (_response.error.reason === "status-code") {
240
+ switch (_response.error.statusCode) {
241
+ case 401:
242
+ throw new NizamCustomer.UnauthorizedError(_response.error.body, _response.rawResponse);
243
+ case 403:
244
+ throw new NizamCustomer.ForbiddenError(_response.error.body, _response.rawResponse);
245
+ case 404:
246
+ throw new NizamCustomer.NotFoundError(_response.error.body, _response.rawResponse);
247
+ case 429:
248
+ throw new NizamCustomer.TooManyRequestsError(_response.error.body, _response.rawResponse);
249
+ case 500:
250
+ throw new NizamCustomer.InternalServerError(_response.error.body, _response.rawResponse);
251
+ default:
252
+ throw new errors.NizamCustomerError({
253
+ statusCode: _response.error.statusCode,
254
+ body: _response.error.body,
255
+ rawResponse: _response.rawResponse,
256
+ });
257
+ }
258
+ }
259
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/users/{id}/profile-picture");
260
+ }
119
261
  }
120
262
  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
+ }
@@ -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 type { GetUserProfilePictureRequest } from "./GetUserProfilePictureRequest.js";
2
+ export type { InitiateProfilePictureUploadRequest } from "./InitiateProfilePictureUploadRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Declares a POD photo upload for a task attempt and requests presigned part URLs.
3
+ */
4
+ export interface CaptureTaskAttemptPhotoRequest {
5
+ /** Original filename. */
6
+ filename: string;
7
+ /** Declared MIME type — POD photos accept image/jpeg, image/png, image/webp, image/heic, image/heif. */
8
+ content_type: string;
9
+ /** Exact byte size; verified against storage at completion. */
10
+ size_bytes?: number | undefined;
11
+ /** Client-computed SHA-256 of the content, lowercase hex; re-verified server-side by the pipeline. */
12
+ checksum_sha256: string;
13
+ /** Display order within the attempt; defaults to the next free slot. */
14
+ sequence?: number | undefined;
15
+ /** Photo category: `proof_of_delivery`, `placement`, `contents`, `damage`, `door`, `signature`, `id_verification`, `barcode`, `site_condition`, `other`. Omit for a free capture. */
16
+ photo_type?: CaptureTaskAttemptPhotoRequest.PhotoType | undefined;
17
+ /** Operator-entered caption. */
18
+ caption?: string | undefined;
19
+ /** Capture timestamp from the device (EXIF time) — distinct from the upload time, which may lag over flaky mobile connections. */
20
+ taken_at?: string | undefined;
21
+ }
22
+ export declare namespace CaptureTaskAttemptPhotoRequest {
23
+ /** Photo category: `proof_of_delivery`, `placement`, `contents`, `damage`, `door`, `signature`, `id_verification`, `barcode`, `site_condition`, `other`. Omit for a free capture. */
24
+ const PhotoType: {
25
+ readonly ProofOfDelivery: "proof_of_delivery";
26
+ readonly Placement: "placement";
27
+ readonly Contents: "contents";
28
+ readonly Damage: "damage";
29
+ readonly Door: "door";
30
+ readonly Signature: "signature";
31
+ readonly IdVerification: "id_verification";
32
+ readonly Barcode: "barcode";
33
+ readonly SiteCondition: "site_condition";
34
+ readonly Other: "other";
35
+ };
36
+ type PhotoType = (typeof PhotoType)[keyof typeof PhotoType];
37
+ }
@@ -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,16 @@
1
+ /**
2
+ * A short-lived URL granting read access to the file's bytes. Fetch it promptly — request a fresh grant after expiry.
3
+ */
4
+ export interface FileDownloadUrl {
5
+ /** The URL to GET the bytes from. */
6
+ url?: string | undefined;
7
+ /** When the URL stops working. */
8
+ expires_at?: string | undefined;
9
+ object?: FileDownloadUrl.Object_ | undefined;
10
+ }
11
+ export declare namespace FileDownloadUrl {
12
+ const Object_: {
13
+ readonly FileDownloadUrl: "file_download_url";
14
+ };
15
+ type Object_ = (typeof Object_)[keyof typeof Object_];
16
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.FileDownloadUrl = void 0;
5
+ var FileDownloadUrl;
6
+ (function (FileDownloadUrl) {
7
+ FileDownloadUrl.Object_ = {
8
+ FileDownloadUrl: "file_download_url",
9
+ };
10
+ })(FileDownloadUrl || (exports.FileDownloadUrl = FileDownloadUrl = {}));
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A presigned PUT for one part. Send the raw part bytes; repeat `headers` verbatim; keep the response's `ETag` header for completion.
3
+ */
4
+ export interface FileUploadPart {
5
+ /** 1-based part number. */
6
+ part_number?: number | undefined;
7
+ /** Presigned URL to PUT the part's bytes to. */
8
+ url?: string | undefined;
9
+ /** Headers that were signed into the URL — the PUT must repeat them verbatim. */
10
+ headers?: Record<string, string> | undefined;
11
+ /** When this URL stops working (re-issue via resume). */
12
+ url_expires_at?: string | undefined;
13
+ }
@@ -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 });