@knowledge-stack/ksapi 3.9.1 → 3.10.1

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.
@@ -49,6 +49,10 @@ export interface UpdateOnboardingProfileRequest {
49
49
  onboardingProfileRequest: OnboardingProfileRequest;
50
50
  }
51
51
 
52
+ export interface UploadMyAvatarRequest {
53
+ file: Blob;
54
+ }
55
+
52
56
  /**
53
57
  * UsersApi - interface
54
58
  *
@@ -56,6 +60,28 @@ export interface UpdateOnboardingProfileRequest {
56
60
  * @interface UsersApiInterface
57
61
  */
58
62
  export interface UsersApiInterface {
63
+ /**
64
+ * Creates request options for deleteMyAvatar without sending the request
65
+ * @throws {RequiredError}
66
+ * @memberof UsersApiInterface
67
+ */
68
+ deleteMyAvatarRequestOpts(): Promise<runtime.RequestOpts>;
69
+
70
+ /**
71
+ * Remove the profile photo for the current tenant. No photo is a no-op.
72
+ * @summary Delete My Avatar Handler
73
+ * @param {*} [options] Override http request option.
74
+ * @throws {RequiredError}
75
+ * @memberof UsersApiInterface
76
+ */
77
+ deleteMyAvatarRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserResponse>>;
78
+
79
+ /**
80
+ * Remove the profile photo for the current tenant. No photo is a no-op.
81
+ * Delete My Avatar Handler
82
+ */
83
+ deleteMyAvatar(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserResponse>;
84
+
59
85
  /**
60
86
  * Creates request options for getMe without sending the request
61
87
  * @throws {RequiredError}
@@ -109,7 +135,7 @@ export interface UsersApiInterface {
109
135
  updateMeRequestOpts(requestParameters: UpdateMeRequest): Promise<runtime.RequestOpts>;
110
136
 
111
137
  /**
112
- * Update the user\'s profile (default tenant, name fields). When updating default_tenant_id, the user must belong to the specified tenant.
138
+ * Update the user\'s name and default tenant, and the membership\'s profile. When updating default_tenant_id, the user must belong to the specified tenant.
113
139
  * @summary Update Me Handler
114
140
  * @param {UpdateUserRequest} updateUserRequest
115
141
  * @param {*} [options] Override http request option.
@@ -119,7 +145,7 @@ export interface UsersApiInterface {
119
145
  updateMeRaw(requestParameters: UpdateMeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserResponse>>;
120
146
 
121
147
  /**
122
- * Update the user\'s profile (default tenant, name fields). When updating default_tenant_id, the user must belong to the specified tenant.
148
+ * Update the user\'s name and default tenant, and the membership\'s profile. When updating default_tenant_id, the user must belong to the specified tenant.
123
149
  * Update Me Handler
124
150
  */
125
151
  updateMe(requestParameters: UpdateMeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserResponse>;
@@ -157,7 +183,7 @@ export interface UsersApiInterface {
157
183
  updateOnboardingProfileRequestOpts(requestParameters: UpdateOnboardingProfileRequest): Promise<runtime.RequestOpts>;
158
184
 
159
185
  /**
160
- * Step 2 (final) of onboarding: per-user profile for the current tenant. Writes name to the User row (global) and job_title to the TenantUser row (per-tenant), then stamps ``onboarding_completed_at`` on the membership. Returns 409 if onboarding has already been completed or skipped — post-onboarding edits go through PATCH /v1/users (name) or a future per-membership profile endpoint (job_title).
186
+ * Step 2 (final) of onboarding: per-user profile for the current tenant. Writes name to the User row (global) and job_title to the TenantUser row (per-tenant), then stamps ``onboarding_completed_at`` on the membership. Returns 409 if onboarding has already been completed or skipped — post-onboarding edits go through PATCH /v1/users.
161
187
  * @summary Update Onboarding Profile Handler
162
188
  * @param {OnboardingProfileRequest} onboardingProfileRequest
163
189
  * @param {*} [options] Override http request option.
@@ -167,11 +193,35 @@ export interface UsersApiInterface {
167
193
  updateOnboardingProfileRaw(requestParameters: UpdateOnboardingProfileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserResponse>>;
168
194
 
169
195
  /**
170
- * Step 2 (final) of onboarding: per-user profile for the current tenant. Writes name to the User row (global) and job_title to the TenantUser row (per-tenant), then stamps ``onboarding_completed_at`` on the membership. Returns 409 if onboarding has already been completed or skipped — post-onboarding edits go through PATCH /v1/users (name) or a future per-membership profile endpoint (job_title).
196
+ * Step 2 (final) of onboarding: per-user profile for the current tenant. Writes name to the User row (global) and job_title to the TenantUser row (per-tenant), then stamps ``onboarding_completed_at`` on the membership. Returns 409 if onboarding has already been completed or skipped — post-onboarding edits go through PATCH /v1/users.
171
197
  * Update Onboarding Profile Handler
172
198
  */
173
199
  updateOnboardingProfile(requestParameters: UpdateOnboardingProfileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserResponse>;
174
200
 
201
+ /**
202
+ * Creates request options for uploadMyAvatar without sending the request
203
+ * @param {Blob} file
204
+ * @throws {RequiredError}
205
+ * @memberof UsersApiInterface
206
+ */
207
+ uploadMyAvatarRequestOpts(requestParameters: UploadMyAvatarRequest): Promise<runtime.RequestOpts>;
208
+
209
+ /**
210
+ * Set the profile photo for the current tenant. PNG, JPEG, WebP or GIF, at most 2 MB and 4096 px per side; the format is read from the bytes, not the content type.
211
+ * @summary Upload My Avatar Handler
212
+ * @param {Blob} file
213
+ * @param {*} [options] Override http request option.
214
+ * @throws {RequiredError}
215
+ * @memberof UsersApiInterface
216
+ */
217
+ uploadMyAvatarRaw(requestParameters: UploadMyAvatarRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserResponse>>;
218
+
219
+ /**
220
+ * Set the profile photo for the current tenant. PNG, JPEG, WebP or GIF, at most 2 MB and 4096 px per side; the format is read from the bytes, not the content type.
221
+ * Upload My Avatar Handler
222
+ */
223
+ uploadMyAvatar(requestParameters: UploadMyAvatarRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserResponse>;
224
+
175
225
  }
176
226
 
177
227
  /**
@@ -179,6 +229,53 @@ export interface UsersApiInterface {
179
229
  */
180
230
  export class UsersApi extends runtime.BaseAPI implements UsersApiInterface {
181
231
 
232
+ /**
233
+ * Creates request options for deleteMyAvatar without sending the request
234
+ */
235
+ async deleteMyAvatarRequestOpts(): Promise<runtime.RequestOpts> {
236
+ const queryParameters: any = {};
237
+
238
+ const headerParameters: runtime.HTTPHeaders = {};
239
+
240
+ if (this.configuration && this.configuration.accessToken) {
241
+ const token = this.configuration.accessToken;
242
+ const tokenString = await token("bearerAuth", []);
243
+
244
+ if (tokenString) {
245
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
246
+ }
247
+ }
248
+
249
+ let urlPath = `/v1/users/me/avatar`;
250
+
251
+ return {
252
+ path: urlPath,
253
+ method: 'DELETE',
254
+ headers: headerParameters,
255
+ query: queryParameters,
256
+ };
257
+ }
258
+
259
+ /**
260
+ * Remove the profile photo for the current tenant. No photo is a no-op.
261
+ * Delete My Avatar Handler
262
+ */
263
+ async deleteMyAvatarRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserResponse>> {
264
+ const requestOptions = await this.deleteMyAvatarRequestOpts();
265
+ const response = await this.request(requestOptions, initOverrides);
266
+
267
+ return new runtime.JSONApiResponse(response, (jsonValue) => UserResponseFromJSON(jsonValue));
268
+ }
269
+
270
+ /**
271
+ * Remove the profile photo for the current tenant. No photo is a no-op.
272
+ * Delete My Avatar Handler
273
+ */
274
+ async deleteMyAvatar(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserResponse> {
275
+ const response = await this.deleteMyAvatarRaw(initOverrides);
276
+ return await response.value();
277
+ }
278
+
182
279
  /**
183
280
  * Creates request options for getMe without sending the request
184
281
  */
@@ -311,7 +408,7 @@ export class UsersApi extends runtime.BaseAPI implements UsersApiInterface {
311
408
  }
312
409
 
313
410
  /**
314
- * Update the user\'s profile (default tenant, name fields). When updating default_tenant_id, the user must belong to the specified tenant.
411
+ * Update the user\'s name and default tenant, and the membership\'s profile. When updating default_tenant_id, the user must belong to the specified tenant.
315
412
  * Update Me Handler
316
413
  */
317
414
  async updateMeRaw(requestParameters: UpdateMeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserResponse>> {
@@ -322,7 +419,7 @@ export class UsersApi extends runtime.BaseAPI implements UsersApiInterface {
322
419
  }
323
420
 
324
421
  /**
325
- * Update the user\'s profile (default tenant, name fields). When updating default_tenant_id, the user must belong to the specified tenant.
422
+ * Update the user\'s name and default tenant, and the membership\'s profile. When updating default_tenant_id, the user must belong to the specified tenant.
326
423
  * Update Me Handler
327
424
  */
328
425
  async updateMe(requestParameters: UpdateMeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserResponse> {
@@ -425,7 +522,7 @@ export class UsersApi extends runtime.BaseAPI implements UsersApiInterface {
425
522
  }
426
523
 
427
524
  /**
428
- * Step 2 (final) of onboarding: per-user profile for the current tenant. Writes name to the User row (global) and job_title to the TenantUser row (per-tenant), then stamps ``onboarding_completed_at`` on the membership. Returns 409 if onboarding has already been completed or skipped — post-onboarding edits go through PATCH /v1/users (name) or a future per-membership profile endpoint (job_title).
525
+ * Step 2 (final) of onboarding: per-user profile for the current tenant. Writes name to the User row (global) and job_title to the TenantUser row (per-tenant), then stamps ``onboarding_completed_at`` on the membership. Returns 409 if onboarding has already been completed or skipped — post-onboarding edits go through PATCH /v1/users.
429
526
  * Update Onboarding Profile Handler
430
527
  */
431
528
  async updateOnboardingProfileRaw(requestParameters: UpdateOnboardingProfileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserResponse>> {
@@ -436,7 +533,7 @@ export class UsersApi extends runtime.BaseAPI implements UsersApiInterface {
436
533
  }
437
534
 
438
535
  /**
439
- * Step 2 (final) of onboarding: per-user profile for the current tenant. Writes name to the User row (global) and job_title to the TenantUser row (per-tenant), then stamps ``onboarding_completed_at`` on the membership. Returns 409 if onboarding has already been completed or skipped — post-onboarding edits go through PATCH /v1/users (name) or a future per-membership profile endpoint (job_title).
536
+ * Step 2 (final) of onboarding: per-user profile for the current tenant. Writes name to the User row (global) and job_title to the TenantUser row (per-tenant), then stamps ``onboarding_completed_at`` on the membership. Returns 409 if onboarding has already been completed or skipped — post-onboarding edits go through PATCH /v1/users.
440
537
  * Update Onboarding Profile Handler
441
538
  */
442
539
  async updateOnboardingProfile(requestParameters: UpdateOnboardingProfileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserResponse> {
@@ -444,4 +541,79 @@ export class UsersApi extends runtime.BaseAPI implements UsersApiInterface {
444
541
  return await response.value();
445
542
  }
446
543
 
544
+ /**
545
+ * Creates request options for uploadMyAvatar without sending the request
546
+ */
547
+ async uploadMyAvatarRequestOpts(requestParameters: UploadMyAvatarRequest): Promise<runtime.RequestOpts> {
548
+ if (requestParameters['file'] == null) {
549
+ throw new runtime.RequiredError(
550
+ 'file',
551
+ 'Required parameter "file" was null or undefined when calling uploadMyAvatar().'
552
+ );
553
+ }
554
+
555
+ const queryParameters: any = {};
556
+
557
+ const headerParameters: runtime.HTTPHeaders = {};
558
+
559
+ if (this.configuration && this.configuration.accessToken) {
560
+ const token = this.configuration.accessToken;
561
+ const tokenString = await token("bearerAuth", []);
562
+
563
+ if (tokenString) {
564
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
565
+ }
566
+ }
567
+ const consumes: runtime.Consume[] = [
568
+ { contentType: 'multipart/form-data' },
569
+ ];
570
+ // @ts-ignore: canConsumeForm may be unused
571
+ const canConsumeForm = runtime.canConsumeForm(consumes);
572
+
573
+ let formParams: { append(param: string, value: any): any };
574
+ let useForm = false;
575
+ // use FormData to transmit files using content-type "multipart/form-data"
576
+ useForm = canConsumeForm;
577
+ if (useForm) {
578
+ formParams = new FormData();
579
+ } else {
580
+ formParams = new URLSearchParams();
581
+ }
582
+
583
+ if (requestParameters['file'] != null) {
584
+ formParams.append('file', requestParameters['file'] as any);
585
+ }
586
+
587
+
588
+ let urlPath = `/v1/users/me/avatar`;
589
+
590
+ return {
591
+ path: urlPath,
592
+ method: 'POST',
593
+ headers: headerParameters,
594
+ query: queryParameters,
595
+ body: formParams,
596
+ };
597
+ }
598
+
599
+ /**
600
+ * Set the profile photo for the current tenant. PNG, JPEG, WebP or GIF, at most 2 MB and 4096 px per side; the format is read from the bytes, not the content type.
601
+ * Upload My Avatar Handler
602
+ */
603
+ async uploadMyAvatarRaw(requestParameters: UploadMyAvatarRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserResponse>> {
604
+ const requestOptions = await this.uploadMyAvatarRequestOpts(requestParameters);
605
+ const response = await this.request(requestOptions, initOverrides);
606
+
607
+ return new runtime.JSONApiResponse(response, (jsonValue) => UserResponseFromJSON(jsonValue));
608
+ }
609
+
610
+ /**
611
+ * Set the profile photo for the current tenant. PNG, JPEG, WebP or GIF, at most 2 MB and 4096 px per side; the format is read from the bytes, not the content type.
612
+ * Upload My Avatar Handler
613
+ */
614
+ async uploadMyAvatar(requestParameters: UploadMyAvatarRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserResponse> {
615
+ const response = await this.uploadMyAvatarRaw(requestParameters, initOverrides);
616
+ return await response.value();
617
+ }
618
+
447
619
  }
@@ -32,11 +32,29 @@ export interface UpdateUserRequest {
32
32
  */
33
33
  firstName?: string | null;
34
34
  /**
35
- * Last name of the user
35
+ * Last name of the user. Directory-synced users cannot set it.
36
36
  * @type {string}
37
37
  * @memberof UpdateUserRequest
38
38
  */
39
39
  lastName?: string | null;
40
+ /**
41
+ * Job title at the current tenant; omit to leave unchanged, empty string to clear. Directory-synced users cannot set it.
42
+ * @type {string}
43
+ * @memberof UpdateUserRequest
44
+ */
45
+ jobTitle?: string | null;
46
+ /**
47
+ * Department at the current tenant; omit to leave unchanged, empty string to clear. Directory-synced users cannot set it.
48
+ * @type {string}
49
+ * @memberof UpdateUserRequest
50
+ */
51
+ department?: string | null;
52
+ /**
53
+ * About the user at the current tenant, read by the chat agent; omit to leave unchanged, empty string to clear.
54
+ * @type {string}
55
+ * @memberof UpdateUserRequest
56
+ */
57
+ bio?: string | null;
40
58
  }
41
59
  export const UpdateUserRequestPropertyValidationAttributesMap: {
42
60
  [property: string]: {
@@ -53,6 +71,21 @@ export const UpdateUserRequestPropertyValidationAttributesMap: {
53
71
  uniqueItems?: boolean
54
72
  }
55
73
  } = {
74
+ firstName: {
75
+ maxLength: 255,
76
+ },
77
+ lastName: {
78
+ maxLength: 255,
79
+ },
80
+ jobTitle: {
81
+ maxLength: 120,
82
+ },
83
+ department: {
84
+ maxLength: 120,
85
+ },
86
+ bio: {
87
+ maxLength: 1000,
88
+ },
56
89
  }
57
90
 
58
91
 
@@ -76,6 +109,9 @@ export function UpdateUserRequestFromJSONTyped(json: any, ignoreDiscriminator: b
76
109
  'defaultTenantId': json['default_tenant_id'] == null ? undefined : json['default_tenant_id'],
77
110
  'firstName': json['first_name'] == null ? undefined : json['first_name'],
78
111
  'lastName': json['last_name'] == null ? undefined : json['last_name'],
112
+ 'jobTitle': json['job_title'] == null ? undefined : json['job_title'],
113
+ 'department': json['department'] == null ? undefined : json['department'],
114
+ 'bio': json['bio'] == null ? undefined : json['bio'],
79
115
  };
80
116
  }
81
117
 
@@ -93,6 +129,9 @@ export function UpdateUserRequestToJSONTyped(value?: UpdateUserRequest | null, i
93
129
  'default_tenant_id': value['defaultTenantId'],
94
130
  'first_name': value['firstName'],
95
131
  'last_name': value['lastName'],
132
+ 'job_title': value['jobTitle'],
133
+ 'department': value['department'],
134
+ 'bio': value['bio'],
96
135
  };
97
136
  }
98
137
 
@@ -94,6 +94,24 @@ export interface UserResponse {
94
94
  * @memberof UserResponse
95
95
  */
96
96
  jobTitle?: string | null;
97
+ /**
98
+ * User's department at the current tenant (per-membership)
99
+ * @type {string}
100
+ * @memberof UserResponse
101
+ */
102
+ department?: string | null;
103
+ /**
104
+ * What the user wrote about themselves at the current tenant. The chat agent reads it on every turn.
105
+ * @type {string}
106
+ * @memberof UserResponse
107
+ */
108
+ bio?: string | null;
109
+ /**
110
+ * Presigned URL of the user's profile photo at the current tenant. Expires after six hours; read GET /v1/users/me again for a fresh one.
111
+ * @type {string}
112
+ * @memberof UserResponse
113
+ */
114
+ avatarUrl?: string | null;
97
115
  /**
98
116
  * When the user finished onboarding for the current tenant. NULL = wizard should be shown.
99
117
  * @type {Date}
@@ -156,6 +174,9 @@ export function UserResponseFromJSONTyped(json: any, ignoreDiscriminator: boolea
156
174
  'currentTenantRole': TenantUserRoleFromJSON(json['current_tenant_role']),
157
175
  'defaultTenantId': json['default_tenant_id'],
158
176
  'jobTitle': json['job_title'] == null ? undefined : json['job_title'],
177
+ 'department': json['department'] == null ? undefined : json['department'],
178
+ 'bio': json['bio'] == null ? undefined : json['bio'],
179
+ 'avatarUrl': json['avatar_url'] == null ? undefined : json['avatar_url'],
159
180
  'onboardingCompletedAt': json['onboarding_completed_at'] == null ? undefined : (new Date(json['onboarding_completed_at'])),
160
181
  };
161
182
  }
@@ -181,6 +202,9 @@ export function UserResponseToJSONTyped(value?: UserResponse | null, ignoreDiscr
181
202
  'current_tenant_role': TenantUserRoleToJSON(value['currentTenantRole']),
182
203
  'default_tenant_id': value['defaultTenantId'],
183
204
  'job_title': value['jobTitle'],
205
+ 'department': value['department'],
206
+ 'bio': value['bio'],
207
+ 'avatar_url': value['avatarUrl'],
184
208
  'onboarding_completed_at': value['onboardingCompletedAt'] == null ? value['onboardingCompletedAt'] : value['onboardingCompletedAt'].toISOString(),
185
209
  };
186
210
  }