34 files changed
+2427
-211
No files matched your search
@@ -2,6 +2,8 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Add typed public contact profiles and opt-in friend-list enrichment via `getFriendList({ withProfile: true })` or `with_profile` on either list action; existing request options remain compatible. See [contact profiles](../onebot/CONTACT_PROFILES.md).
|
||||
|
||||
- Add a Node reverse WebSocket server with authenticated per-account sessions, Universal and paired API/Event channels, existing action/event/stream helpers, bounded buffers and explicit disconnect handling; see [REVERSE_WEBSOCKET.md](REVERSE_WEBSOCKET.md).
|
||||
|
||||
- Add one-step local media sends, the optional `@snowluma/sdk/node` file source, stage-aware errors, explicit quoted replies, and cancellable WebSocket event waits; see [MESSAGING.md](MESSAGING.md). Existing methods and handler/context types remain compatible.
|
||||
|
||||
@@ -297,8 +297,12 @@ export abstract class SnowLumaApiClient {
|
||||
return this.call('delete_msg', { message_id: messageId }, options);
|
||||
}
|
||||
|
||||
getFriendList(options?: RequestOptions) {
|
||||
return this.call('get_friend_list', {}, options);
|
||||
getFriendList(options?: RequestOptions & { withProfile?: boolean }) {
|
||||
return this.call(
|
||||
'get_friend_list',
|
||||
options?.withProfile === undefined ? {} : { with_profile: options.withProfile },
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
getStrangerInfo(userId: number, options?: RequestOptions) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { JsonArray, JsonObject, JsonValue } from './json.js';
|
||||
import type {
|
||||
GetFriendListParams,
|
||||
CreateGroupFileFolderParams,
|
||||
DeleteFriendParams,
|
||||
DeleteGroupFileFolderParams,
|
||||
@@ -149,6 +150,8 @@ import type {
|
||||
EmptyData,
|
||||
ForwardMessageResult,
|
||||
FriendCategoryResult,
|
||||
FriendInfo,
|
||||
StrangerInfo,
|
||||
FriendMessageHistory,
|
||||
GroupAdminSettings,
|
||||
GroupAdminPermissions,
|
||||
@@ -230,8 +233,8 @@ export interface SnowLumaActionMap {
|
||||
send_group_msg: { params: SendGroupMsgParams; data: SendMessageResult };
|
||||
get_msg: { params: MessageIdParams; data: JsonObject };
|
||||
delete_msg: { params: MessageIdParams; data: EmptyData };
|
||||
get_friend_list: { params: JsonObject; data: JsonObject[] };
|
||||
get_stranger_info: { params: UserIdParams; data: JsonObject };
|
||||
get_friend_list: { params: GetFriendListParams; data: FriendInfo[] };
|
||||
get_stranger_info: { params: UserIdParams; data: StrangerInfo };
|
||||
delete_friend: { params: DeleteFriendParams; data: EmptyData };
|
||||
get_group_list: { params: GetGroupListParams; data: JsonObject[] };
|
||||
get_group_info: { params: GetGroupInfoParams; data: JsonObject };
|
||||
@@ -330,7 +333,7 @@ export interface SnowLumaActionMap {
|
||||
fetch_super_face_id: { params: FetchFaceEntityParams; data: SuperFaceInfo };
|
||||
get_emoji_likes: { params: GetEmojiLikesParams; data: JsonObject };
|
||||
fetch_emoji_like: { params: FetchEmojiLikeParams; data: JsonObject };
|
||||
get_friends_with_category: { params: JsonObject; data: FriendCategoryResult[] };
|
||||
get_friends_with_category: { params: GetFriendListParams; data: FriendCategoryResult[] };
|
||||
set_friends_category: { params: SetFriendsCategoryParams; data: EmptyData };
|
||||
get_online_clients: { params: GetOnlineClientsParams; data: OnlineClientsInfo };
|
||||
_get_model_show: { params: JsonObject; data: { variants: JsonArray } };
|
||||
|
||||
@@ -804,3 +804,7 @@ export type DownloadFileStreamParams = JsonObject & {
|
||||
export interface TestDownloadStreamParams extends JsonObject {
|
||||
error?: ActionBooleanInput;
|
||||
}
|
||||
export interface GetFriendListParams extends JsonObject {
|
||||
/** Query missing public profiles explicitly; cached per account for five minutes. */
|
||||
with_profile?: boolean;
|
||||
}
|
||||
@@ -105,10 +105,58 @@ export interface GroupNoticeInfo {
|
||||
send_to_new_members: boolean;
|
||||
}
|
||||
|
||||
export interface CategorizedFriend {
|
||||
export interface ProfilePrivilege extends JsonObject {
|
||||
type?: number;
|
||||
level?: number;
|
||||
flag?: number;
|
||||
is_big?: number;
|
||||
jump_url?: string;
|
||||
icon_url?: string;
|
||||
deluxe_icon_url?: string;
|
||||
}
|
||||
|
||||
/** Fields are present only when supplied by QQ; empty strings, false and zero are valid. */
|
||||
export interface PublicProfileFields extends JsonObject {
|
||||
long_nick?: string;
|
||||
sex?: 'male' | 'female' | 'unknown';
|
||||
age?: number;
|
||||
level?: number;
|
||||
birthday_year?: number;
|
||||
birthday_month?: number;
|
||||
birthday_day?: number;
|
||||
phone_num?: string;
|
||||
email?: string;
|
||||
country?: string;
|
||||
province?: string;
|
||||
city?: string;
|
||||
college?: string;
|
||||
is_qq_vip?: boolean;
|
||||
is_vip?: boolean;
|
||||
is_years_vip?: boolean;
|
||||
vip_level?: number;
|
||||
privilege_icons?: {
|
||||
jump_url?: string;
|
||||
open: ProfilePrivilege[];
|
||||
closed: ProfilePrivilege[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface FriendInfo extends PublicProfileFields {
|
||||
user_id: number;
|
||||
nickname: string;
|
||||
remark: string;
|
||||
category_id?: number;
|
||||
}
|
||||
|
||||
export interface CategorizedFriend extends FriendInfo {}
|
||||
|
||||
export interface StrangerInfo extends PublicProfileFields {
|
||||
user_id: number;
|
||||
nickname: string;
|
||||
remark: string;
|
||||
sex: 'male' | 'female' | 'unknown';
|
||||
age: number;
|
||||
long_nick: string;
|
||||
}
|
||||
|
||||
export interface FriendCategoryResult {
|
||||
|
||||
@@ -48,6 +48,18 @@ describe('toJsonObject', () => {
|
||||
});
|
||||
|
||||
describe('SnowLumaApiClient.call', () => {
|
||||
it('preserves friend-list request options while enabling public profile enrichment', async () => {
|
||||
const client = okClient([]);
|
||||
await client.getFriendList({ timeoutMs: 60000, withProfile: true });
|
||||
expect(client.calls[0]).toMatchObject({
|
||||
action: 'get_friend_list',
|
||||
params: { with_profile: true },
|
||||
options: { timeoutMs: 60000 },
|
||||
});
|
||||
await client.getFriendList({ timeoutMs: 1000 });
|
||||
expect(client.calls[1]).toMatchObject({ params: {}, options: { timeoutMs: 1000 } });
|
||||
});
|
||||
|
||||
it('returns response data when status is ok and retcode is 0', async () => {
|
||||
const client = okClient({ user_id: 1787882683, nickname: 'luma' });
|
||||
|
||||
|
||||
+32
-1
@@ -30,6 +30,8 @@ const qzonePublicReply = {
|
||||
// The same examples are compiled against the published declarations and parsed
|
||||
// by the real server action definitions. They never invoke QQ or perform I/O.
|
||||
export const actionParams = {
|
||||
get_friend_list: { with_profile: true },
|
||||
get_friends_with_category: { with_profile: false },
|
||||
get_group_admin_permissions: { group_id: '10001', user_id: '10002' },
|
||||
set_group_admin_permissions: {
|
||||
group_id: '10001',
|
||||
@@ -192,6 +194,8 @@ export const actionParams = {
|
||||
// Keep this independent of SnowLumaActionMap: a missing map entry must fail the
|
||||
// consumer's coverage check rather than silently remove that example.
|
||||
export type CoveredAction =
|
||||
| 'get_friend_list'
|
||||
| 'get_friends_with_category'
|
||||
| 'get_group_admin_permissions'
|
||||
| 'set_group_admin_permissions'
|
||||
| 'set_group_admin_receive_verify'
|
||||
@@ -286,6 +290,29 @@ const flashInfo = {
|
||||
};
|
||||
|
||||
export const actionResults = {
|
||||
get_friend_list: [
|
||||
{
|
||||
user_id: 10001,
|
||||
nickname: 'Friend',
|
||||
remark: '',
|
||||
category_id: 0,
|
||||
long_nick: '',
|
||||
age: 0,
|
||||
is_qq_vip: false,
|
||||
privilege_icons: {
|
||||
open: [{ type: 1, icon_url: 'normal', deluxe_icon_url: 'deluxe' }],
|
||||
closed: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
get_friends_with_category: [
|
||||
{
|
||||
categoryId: 0,
|
||||
categoryName: 'Friends',
|
||||
categoryMbCount: 1,
|
||||
buddyList: [{ user_id: 10001, nickname: 'Friend', remark: '', city: 'City' }],
|
||||
},
|
||||
],
|
||||
get_group_admin_permissions: {
|
||||
group_id: 10001,
|
||||
user_id: 10002,
|
||||
@@ -478,7 +505,11 @@ export const actionResults = {
|
||||
},
|
||||
attach_info: 'comments-from-detail',
|
||||
},
|
||||
get_qzone_share_ark: { ark: '{"app":"com.tencent.tuwen.lua"}', requires_confirmation: false, notice: null },
|
||||
get_qzone_share_ark: {
|
||||
ark: '{"app":"com.tencent.tuwen.lua"}',
|
||||
requires_confirmation: false,
|
||||
notice: null,
|
||||
},
|
||||
get_qzone_public_comments: {
|
||||
cell_comment: { comments: [qzonePublicComment] },
|
||||
attach_info: 'next-comments',
|
||||
|
||||
Reference in new issue
Block a user