@taruvi/sdk 1.3.6 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taruvi/sdk",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "description": "Taruvi SDK",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -24,7 +24,7 @@ export type { TaruviConfig, TaruviResponse, PaginationInfo, StorageFilters, Data
24
24
  export type { AuthTokens } from "./lib-internal/token/TokenClient.js"
25
25
 
26
26
  // User types
27
- export type { UserCreateRequest, UserData, UserUpdateRequest, UserListFilters, UserApp, UserResponse, UserListResponse, UserAppsResponse, AssignRolesRequest, RevokeRolesRequest, RolesResponse, UserGroup, UserPermission, UserRole } from "./lib/users/types.js"
27
+ export type { UserCreateRequest, UserData, UserUpdateRequest, UserListFilters, UserApp, UserResponse, UserListResponse, UserAppsResponse, AssignRolesRequest, RevokeRolesRequest, RolesResponse, UserGroup, UserPermission, UserRole, UserPreferences, UserPreferencesUpdate, UserPreferencesResponse } from "./lib/users/types.js"
28
28
 
29
29
  // Policy types
30
30
  export type { Principal, Resource, Resources, PolicyCheckResult, PolicyCheckBatchResult, ResourceCheckResponse } from "./lib/policy/types.js"
@@ -1,5 +1,5 @@
1
1
  import type { Client } from "../../client.js";
2
- import type { UserCreateRequest, UserResponse, UserListResponse, UserListFilters, UserUpdateRequest, UserAppsResponse, AssignRolesRequest, RevokeRolesRequest, RolesResponse } from "./types.js";
2
+ import type { UserCreateRequest, UserResponse, UserListResponse, UserListFilters, UserUpdateRequest, UserAppsResponse, AssignRolesRequest, RevokeRolesRequest, RolesResponse, UserPreferencesResponse, UserPreferencesUpdate } from "./types.js";
3
3
  import { UserRoutes } from "../../lib-internal/routes/UserRoutes.js";
4
4
  import { buildQueryString } from "../../utils/utils.js";
5
5
 
@@ -52,4 +52,12 @@ export class User {
52
52
  request
53
53
  )
54
54
  }
55
+
56
+ async getPreferences(): Promise<UserPreferencesResponse> {
57
+ return await this.client.httpClient.get<UserPreferencesResponse>(UserRoutes.getPreferences())
58
+ }
59
+
60
+ async updatePreferences(body: UserPreferencesUpdate): Promise<UserPreferencesResponse> {
61
+ return await this.client.httpClient.put<UserPreferencesResponse>(UserRoutes.getPreferences(), body)
62
+ }
55
63
  }
@@ -88,6 +88,24 @@ export type UserResponse = TaruviResponse<UserData>
88
88
  export type UserListResponse = TaruviResponse<UserData[]>
89
89
  export type UserAppsResponse = TaruviResponse<UserApp[]>
90
90
 
91
+ export interface UserPreferences {
92
+ date_format: string
93
+ time_format: string
94
+ timezone: string
95
+ theme: string
96
+ widget_config: Record<string, unknown>
97
+ }
98
+
99
+ export interface UserPreferencesUpdate {
100
+ date_format?: string
101
+ time_format?: string
102
+ timezone?: string
103
+ theme?: string
104
+ widget_config?: Record<string, unknown>
105
+ }
106
+
107
+ export type UserPreferencesResponse = TaruviResponse<UserPreferences>
108
+
91
109
  export interface AssignRolesRequest {
92
110
  roles: string[]
93
111
  usernames: string[]
@@ -6,6 +6,7 @@ export const UserRoutes = {
6
6
  deleteUser: (username: string) => `${UserRoutes.baseUrl}${username}/`,
7
7
  listUser: (filter: string) => `${UserRoutes.baseUrl}${filter}`,
8
8
  getUserApps: (username: string) => `${UserRoutes.baseUrl}${username}/apps/`,
9
+ getPreferences: () => `${UserRoutes.baseUrl}me/preferences/`,
9
10
  assignRoles: () => `api/assign/roles/`,
10
11
  revokeRoles: () => `api/revoke/roles/`
11
12
  } as const