@oxyhq/services 5.10.3 → 5.10.5
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/README.md +62 -14
- package/lib/commonjs/core/OxyServices.js +796 -4
- package/lib/commonjs/core/OxyServices.js.map +1 -1
- package/lib/commonjs/core/index.js +8 -83
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +12 -12
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +2 -2
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/followStore.js +4 -4
- package/lib/commonjs/ui/stores/followStore.js.map +1 -1
- package/lib/module/core/OxyServices.js +795 -3
- package/lib/module/core/OxyServices.js.map +1 -1
- package/lib/module/core/index.js +9 -24
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +12 -12
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +2 -2
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +1 -1
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
- package/lib/module/ui/stores/followStore.js +4 -4
- package/lib/module/ui/stores/followStore.js.map +1 -1
- package/lib/typescript/core/OxyServices.d.ts +290 -1
- package/lib/typescript/core/OxyServices.d.ts.map +1 -1
- package/lib/typescript/core/index.d.ts +7 -16
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/OxyServices.ts +880 -47
- package/src/core/index.ts +9 -24
- package/src/ui/screens/FileManagementScreen.tsx +12 -12
- package/src/ui/screens/ProfileScreen.tsx +3 -3
- package/src/ui/screens/SignInScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaCenterScreen.tsx +2 -2
- package/src/ui/screens/karma/KarmaLeaderboardScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaRulesScreen.tsx +1 -1
- package/src/ui/stores/followStore.ts +4 -4
- package/lib/commonjs/core/OxyServicesMain.js +0 -51
- package/lib/commonjs/core/OxyServicesMain.js.map +0 -1
- package/lib/commonjs/core/analytics/AnalyticsService.js +0 -67
- package/lib/commonjs/core/analytics/AnalyticsService.js.map +0 -1
- package/lib/commonjs/core/auth/AuthService.js +0 -538
- package/lib/commonjs/core/auth/AuthService.js.map +0 -1
- package/lib/commonjs/core/devices/DeviceService.js +0 -61
- package/lib/commonjs/core/devices/DeviceService.js.map +0 -1
- package/lib/commonjs/core/files/FileService.js +0 -180
- package/lib/commonjs/core/files/FileService.js.map +0 -1
- package/lib/commonjs/core/karma/KarmaService.js +0 -100
- package/lib/commonjs/core/karma/KarmaService.js.map +0 -1
- package/lib/commonjs/core/locations/LocationService.js +0 -131
- package/lib/commonjs/core/locations/LocationService.js.map +0 -1
- package/lib/commonjs/core/payments/PaymentService.js +0 -124
- package/lib/commonjs/core/payments/PaymentService.js.map +0 -1
- package/lib/commonjs/core/users/UserService.js +0 -234
- package/lib/commonjs/core/users/UserService.js.map +0 -1
- package/lib/module/core/OxyServicesMain.js +0 -47
- package/lib/module/core/OxyServicesMain.js.map +0 -1
- package/lib/module/core/analytics/AnalyticsService.js +0 -62
- package/lib/module/core/analytics/AnalyticsService.js.map +0 -1
- package/lib/module/core/auth/AuthService.js +0 -533
- package/lib/module/core/auth/AuthService.js.map +0 -1
- package/lib/module/core/devices/DeviceService.js +0 -57
- package/lib/module/core/devices/DeviceService.js.map +0 -1
- package/lib/module/core/files/FileService.js +0 -175
- package/lib/module/core/files/FileService.js.map +0 -1
- package/lib/module/core/karma/KarmaService.js +0 -95
- package/lib/module/core/karma/KarmaService.js.map +0 -1
- package/lib/module/core/locations/LocationService.js +0 -127
- package/lib/module/core/locations/LocationService.js.map +0 -1
- package/lib/module/core/payments/PaymentService.js +0 -119
- package/lib/module/core/payments/PaymentService.js.map +0 -1
- package/lib/module/core/users/UserService.js +0 -230
- package/lib/module/core/users/UserService.js.map +0 -1
- package/lib/typescript/core/OxyServicesMain.d.ts +0 -33
- package/lib/typescript/core/OxyServicesMain.d.ts.map +0 -1
- package/lib/typescript/core/analytics/AnalyticsService.d.ts +0 -26
- package/lib/typescript/core/analytics/AnalyticsService.d.ts.map +0 -1
- package/lib/typescript/core/auth/AuthService.d.ts +0 -165
- package/lib/typescript/core/auth/AuthService.d.ts.map +0 -1
- package/lib/typescript/core/devices/DeviceService.d.ts +0 -20
- package/lib/typescript/core/devices/DeviceService.d.ts.map +0 -1
- package/lib/typescript/core/files/FileService.d.ts +0 -59
- package/lib/typescript/core/files/FileService.d.ts.map +0 -1
- package/lib/typescript/core/karma/KarmaService.d.ts +0 -50
- package/lib/typescript/core/karma/KarmaService.d.ts.map +0 -1
- package/lib/typescript/core/locations/LocationService.d.ts +0 -39
- package/lib/typescript/core/locations/LocationService.d.ts.map +0 -1
- package/lib/typescript/core/payments/PaymentService.d.ts +0 -50
- package/lib/typescript/core/payments/PaymentService.d.ts.map +0 -1
- package/lib/typescript/core/users/UserService.d.ts +0 -111
- package/lib/typescript/core/users/UserService.d.ts.map +0 -1
- package/src/core/OxyServicesMain.ts +0 -57
- package/src/core/analytics/AnalyticsService.ts +0 -64
- package/src/core/auth/AuthService.ts +0 -560
- package/src/core/devices/DeviceService.ts +0 -55
- package/src/core/files/FileService.ts +0 -198
- package/src/core/karma/KarmaService.ts +0 -104
- package/src/core/locations/LocationService.ts +0 -141
- package/src/core/payments/PaymentService.ts +0 -133
- package/src/core/users/UserService.ts +0 -241
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { OxyServices } from '../OxyServices';
|
|
2
|
-
import { User, Notification } from '../../models/interfaces';
|
|
3
|
-
import { buildSearchParams, buildPaginationParams, PaginationParams } from '../../utils/apiUtils';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* User service for handling user operations, profiles, and social features
|
|
7
|
-
*/
|
|
8
|
-
export class UserService extends OxyServices {
|
|
9
|
-
/**
|
|
10
|
-
* Get profile by username
|
|
11
|
-
*/
|
|
12
|
-
async getProfileByUsername(username: string): Promise<User> {
|
|
13
|
-
try {
|
|
14
|
-
const res = await this.getClient().get(`/api/profiles/username/${username}`);
|
|
15
|
-
return res.data;
|
|
16
|
-
} catch (error) {
|
|
17
|
-
throw this.handleError(error);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Search user profiles
|
|
23
|
-
*/
|
|
24
|
-
async searchProfiles(query: string, pagination?: PaginationParams): Promise<User[]> {
|
|
25
|
-
try {
|
|
26
|
-
const params = { query, ...pagination };
|
|
27
|
-
const searchParams = buildSearchParams(params);
|
|
28
|
-
|
|
29
|
-
const res = await this.getClient().get(`/api/profiles/search?${searchParams.toString()}`);
|
|
30
|
-
return res.data;
|
|
31
|
-
} catch (error) {
|
|
32
|
-
throw this.handleError(error);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Get profile recommendations
|
|
38
|
-
*/
|
|
39
|
-
async getProfileRecommendations(): Promise<Array<{
|
|
40
|
-
id: string;
|
|
41
|
-
username: string;
|
|
42
|
-
name?: { first?: string; last?: string; full?: string };
|
|
43
|
-
description?: string;
|
|
44
|
-
_count?: { followers: number; following: number };
|
|
45
|
-
[key: string]: any;
|
|
46
|
-
}>> {
|
|
47
|
-
try {
|
|
48
|
-
const res = await this.getClient().get('/api/profiles/recommendations');
|
|
49
|
-
return res.data;
|
|
50
|
-
} catch (error) {
|
|
51
|
-
throw this.handleError(error);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Get user by ID
|
|
57
|
-
*/
|
|
58
|
-
async getUserById(userId: string): Promise<User> {
|
|
59
|
-
try {
|
|
60
|
-
const res = await this.getClient().get(`/api/users/${userId}`);
|
|
61
|
-
return res.data;
|
|
62
|
-
} catch (error) {
|
|
63
|
-
throw this.handleError(error);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Get current user
|
|
69
|
-
*/
|
|
70
|
-
async getCurrentUser(): Promise<User> {
|
|
71
|
-
try {
|
|
72
|
-
const res = await this.getClient().get('/api/users/me');
|
|
73
|
-
return res.data;
|
|
74
|
-
} catch (error) {
|
|
75
|
-
throw this.handleError(error);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Update user profile
|
|
81
|
-
*/
|
|
82
|
-
async updateProfile(updates: Record<string, any>): Promise<User> {
|
|
83
|
-
try {
|
|
84
|
-
const res = await this.getClient().put('/api/users/me', updates);
|
|
85
|
-
return res.data;
|
|
86
|
-
} catch (error) {
|
|
87
|
-
throw this.handleError(error);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Update user by ID (admin function)
|
|
93
|
-
*/
|
|
94
|
-
async updateUser(userId: string, updates: Record<string, any>): Promise<User> {
|
|
95
|
-
try {
|
|
96
|
-
const res = await this.getClient().put(`/api/users/${userId}`, updates);
|
|
97
|
-
return res.data;
|
|
98
|
-
} catch (error) {
|
|
99
|
-
throw this.handleError(error);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Follow a user
|
|
105
|
-
*/
|
|
106
|
-
async followUser(userId: string): Promise<{ success: boolean; message: string }> {
|
|
107
|
-
try {
|
|
108
|
-
const res = await this.getClient().post(`/api/users/${userId}/follow`);
|
|
109
|
-
return res.data;
|
|
110
|
-
} catch (error) {
|
|
111
|
-
throw this.handleError(error);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Unfollow a user
|
|
117
|
-
*/
|
|
118
|
-
async unfollowUser(userId: string): Promise<{ success: boolean; message: string }> {
|
|
119
|
-
try {
|
|
120
|
-
const res = await this.getClient().delete(`/api/users/${userId}/follow`);
|
|
121
|
-
return res.data;
|
|
122
|
-
} catch (error) {
|
|
123
|
-
throw this.handleError(error);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Get follow status
|
|
129
|
-
*/
|
|
130
|
-
async getFollowStatus(userId: string): Promise<{ isFollowing: boolean }> {
|
|
131
|
-
try {
|
|
132
|
-
const res = await this.getClient().get(`/api/users/${userId}/following-status`);
|
|
133
|
-
return res.data;
|
|
134
|
-
} catch (error) {
|
|
135
|
-
throw this.handleError(error);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Get user followers
|
|
141
|
-
*/
|
|
142
|
-
async getUserFollowers(
|
|
143
|
-
userId: string,
|
|
144
|
-
pagination?: PaginationParams
|
|
145
|
-
): Promise<{ followers: User[]; total: number; hasMore: boolean }> {
|
|
146
|
-
try {
|
|
147
|
-
const searchParams = buildPaginationParams(pagination || {});
|
|
148
|
-
|
|
149
|
-
const res = await this.getClient().get(`/api/users/${userId}/followers?${searchParams.toString()}`);
|
|
150
|
-
return res.data;
|
|
151
|
-
} catch (error) {
|
|
152
|
-
throw this.handleError(error);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Get user following
|
|
158
|
-
*/
|
|
159
|
-
async getUserFollowing(
|
|
160
|
-
userId: string,
|
|
161
|
-
pagination?: PaginationParams
|
|
162
|
-
): Promise<{ following: User[]; total: number; hasMore: boolean }> {
|
|
163
|
-
try {
|
|
164
|
-
const searchParams = buildPaginationParams(pagination || {});
|
|
165
|
-
|
|
166
|
-
const res = await this.getClient().get(`/api/users/${userId}/following?${searchParams.toString()}`);
|
|
167
|
-
return res.data;
|
|
168
|
-
} catch (error) {
|
|
169
|
-
throw this.handleError(error);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Get notifications
|
|
175
|
-
*/
|
|
176
|
-
async getNotifications(): Promise<Notification[]> {
|
|
177
|
-
try {
|
|
178
|
-
const res = await this.getClient().get('/api/notifications');
|
|
179
|
-
return res.data;
|
|
180
|
-
} catch (error) {
|
|
181
|
-
throw this.handleError(error);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Get unread notification count
|
|
187
|
-
*/
|
|
188
|
-
async getUnreadCount(): Promise<number> {
|
|
189
|
-
try {
|
|
190
|
-
const res = await this.getClient().get('/api/notifications/unread-count');
|
|
191
|
-
return res.data.count;
|
|
192
|
-
} catch (error) {
|
|
193
|
-
throw this.handleError(error);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Create notification
|
|
199
|
-
*/
|
|
200
|
-
async createNotification(data: Partial<Notification>): Promise<Notification> {
|
|
201
|
-
try {
|
|
202
|
-
const res = await this.getClient().post('/api/notifications', data);
|
|
203
|
-
return res.data;
|
|
204
|
-
} catch (error) {
|
|
205
|
-
throw this.handleError(error);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Mark notification as read
|
|
211
|
-
*/
|
|
212
|
-
async markNotificationAsRead(notificationId: string): Promise<void> {
|
|
213
|
-
try {
|
|
214
|
-
await this.getClient().put(`/api/notifications/${notificationId}/read`);
|
|
215
|
-
} catch (error) {
|
|
216
|
-
throw this.handleError(error);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Mark all notifications as read
|
|
222
|
-
*/
|
|
223
|
-
async markAllNotificationsAsRead(): Promise<void> {
|
|
224
|
-
try {
|
|
225
|
-
await this.getClient().put('/api/notifications/read-all');
|
|
226
|
-
} catch (error) {
|
|
227
|
-
throw this.handleError(error);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Delete notification
|
|
233
|
-
*/
|
|
234
|
-
async deleteNotification(notificationId: string): Promise<void> {
|
|
235
|
-
try {
|
|
236
|
-
await this.getClient().delete(`/api/notifications/${notificationId}`);
|
|
237
|
-
} catch (error) {
|
|
238
|
-
throw this.handleError(error);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|