@oxyhq/core 3.4.19 → 3.5.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.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/mixins/OxyServices.user.js +19 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/mixins/OxyServices.user.js +19 -0
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/mixins/OxyServices.user.d.ts +25 -0
- package/package.json +1 -1
- package/src/index.ts +4 -0
- package/src/mixins/OxyServices.user.ts +37 -0
package/dist/types/index.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export type { ServiceTokenResponse } from './mixins/OxyServices.auth';
|
|
|
33
33
|
export type { ServiceApp, ServiceActingAsVerification } from './mixins/OxyServices.utility';
|
|
34
34
|
export type { CreateManagedAccountInput, ManagedAccountManager, ManagedAccount, } from './mixins/OxyServices.managedAccounts';
|
|
35
35
|
export type { ContactDiscoveryMatch, ContactDiscoveryResponse, } from './mixins/OxyServices.contacts';
|
|
36
|
+
export type { BulkFollowEntry, BulkFollowResult, } from './mixins/OxyServices.user';
|
|
36
37
|
export { OxyAppDataIdentifierError } from './mixins/OxyServices.appData';
|
|
37
38
|
export { getNormalizedUserId, normalizeUserIdentity, normalizeUserIdentityOrNull, } from './utils/userIdentity';
|
|
38
39
|
export { getCanonicalUserHandle, getNormalizedUserHandle, } from './utils/userHandle';
|
|
@@ -5,6 +5,22 @@ import type { User, Notification, NotificationPreferences, UserPreferences, Sear
|
|
|
5
5
|
import type { UserNameResponse, UserProfileUpdate } from '@oxyhq/contracts';
|
|
6
6
|
import type { OxyServicesBase } from '../OxyServices.base';
|
|
7
7
|
import { type PaginationParams } from '../utils/apiUtils';
|
|
8
|
+
/** Per-user outcome returned by `POST /users/follow/bulk`. */
|
|
9
|
+
export interface BulkFollowEntry {
|
|
10
|
+
/** The user ID that was processed. */
|
|
11
|
+
userId: string;
|
|
12
|
+
/** Whether the follow was applied (or already in place) without error. */
|
|
13
|
+
success: boolean;
|
|
14
|
+
/** Whether the caller was already following this user before the request. */
|
|
15
|
+
alreadyFollowing: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Response shape of `POST /users/follow/bulk`. */
|
|
18
|
+
export interface BulkFollowResult {
|
|
19
|
+
/** Per-user outcomes, in request order. */
|
|
20
|
+
results: BulkFollowEntry[];
|
|
21
|
+
/** Number of users newly followed by this request. */
|
|
22
|
+
followedCount: number;
|
|
23
|
+
}
|
|
8
24
|
export declare function OxyServicesUserMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
9
25
|
new (...args: any[]): {
|
|
10
26
|
/**
|
|
@@ -167,6 +183,15 @@ export declare function OxyServicesUserMixin<T extends typeof OxyServicesBase>(B
|
|
|
167
183
|
success: boolean;
|
|
168
184
|
message: string;
|
|
169
185
|
}>;
|
|
186
|
+
/**
|
|
187
|
+
* Follow multiple users in a single request.
|
|
188
|
+
*
|
|
189
|
+
* POSTs `/users/follow/bulk` with `{ userIds }` (server caps the batch at
|
|
190
|
+
* 200). Returns the per-user outcomes and the count of users newly
|
|
191
|
+
* followed. An empty `userIds` array resolves immediately with an empty
|
|
192
|
+
* result and performs no network call.
|
|
193
|
+
*/
|
|
194
|
+
followUsers(userIds: string[]): Promise<BulkFollowResult>;
|
|
170
195
|
/**
|
|
171
196
|
* Unfollow a user
|
|
172
197
|
*/
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -61,6 +61,10 @@ export type {
|
|
|
61
61
|
ContactDiscoveryMatch,
|
|
62
62
|
ContactDiscoveryResponse,
|
|
63
63
|
} from './mixins/OxyServices.contacts';
|
|
64
|
+
export type {
|
|
65
|
+
BulkFollowEntry,
|
|
66
|
+
BulkFollowResult,
|
|
67
|
+
} from './mixins/OxyServices.user';
|
|
64
68
|
export { OxyAppDataIdentifierError } from './mixins/OxyServices.appData';
|
|
65
69
|
|
|
66
70
|
// ---------------------------------------------------------------------------
|
|
@@ -17,6 +17,24 @@ import { KeyManager } from '../crypto/keyManager';
|
|
|
17
17
|
import { SignatureService } from '../crypto/signatureService';
|
|
18
18
|
import { normalizeUserIdentity, normalizeUserIdentityOrNull } from '../utils/userIdentity';
|
|
19
19
|
|
|
20
|
+
/** Per-user outcome returned by `POST /users/follow/bulk`. */
|
|
21
|
+
export interface BulkFollowEntry {
|
|
22
|
+
/** The user ID that was processed. */
|
|
23
|
+
userId: string;
|
|
24
|
+
/** Whether the follow was applied (or already in place) without error. */
|
|
25
|
+
success: boolean;
|
|
26
|
+
/** Whether the caller was already following this user before the request. */
|
|
27
|
+
alreadyFollowing: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Response shape of `POST /users/follow/bulk`. */
|
|
31
|
+
export interface BulkFollowResult {
|
|
32
|
+
/** Per-user outcomes, in request order. */
|
|
33
|
+
results: BulkFollowEntry[];
|
|
34
|
+
/** Number of users newly followed by this request. */
|
|
35
|
+
followedCount: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
20
38
|
export function OxyServicesUserMixin<T extends typeof OxyServicesBase>(Base: T) {
|
|
21
39
|
return class extends Base {
|
|
22
40
|
constructor(...args: any[]) {
|
|
@@ -404,6 +422,25 @@ export function OxyServicesUserMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
404
422
|
}
|
|
405
423
|
}
|
|
406
424
|
|
|
425
|
+
/**
|
|
426
|
+
* Follow multiple users in a single request.
|
|
427
|
+
*
|
|
428
|
+
* POSTs `/users/follow/bulk` with `{ userIds }` (server caps the batch at
|
|
429
|
+
* 200). Returns the per-user outcomes and the count of users newly
|
|
430
|
+
* followed. An empty `userIds` array resolves immediately with an empty
|
|
431
|
+
* result and performs no network call.
|
|
432
|
+
*/
|
|
433
|
+
async followUsers(userIds: string[]): Promise<BulkFollowResult> {
|
|
434
|
+
if (userIds.length === 0) {
|
|
435
|
+
return { results: [], followedCount: 0 };
|
|
436
|
+
}
|
|
437
|
+
try {
|
|
438
|
+
return await this.makeRequest<BulkFollowResult>('POST', '/users/follow/bulk', { userIds }, { cache: false });
|
|
439
|
+
} catch (error) {
|
|
440
|
+
throw this.handleError(error);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
407
444
|
/**
|
|
408
445
|
* Unfollow a user
|
|
409
446
|
*/
|