feat: update OpenIMSDK with new friend and group application handling methods

This commit is contained in:
kevin
2025-06-05 15:07:30 +08:00
parent 268d20c030
commit 95f9af2497
12 changed files with 127 additions and 25 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

15
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@openim/electron-client-sdk",
"version": "1.1.5",
"version": "3.8.3-patch.8",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@openim/electron-client-sdk",
"version": "1.1.5",
"version": "3.8.3-patch.8",
"license": "MIT",
"dependencies": {
"koffi": "2.8.0",
@@ -15,7 +15,7 @@
"devDependencies": {
"@commitlint/cli": "^16.2.4",
"@commitlint/config-conventional": "^16.2.4",
"@openim/wasm-client-sdk": "^3.8.3",
"@openim/wasm-client-sdk": "^3.8.3-patch.8",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-terser": "^0.4.4",
"@types/ffi-napi": "^4.0.10",
@@ -43,7 +43,7 @@
"node": ">=12.0"
},
"peerDependencies": {
"@openim/wasm-client-sdk": "^3.8.3",
"@openim/wasm-client-sdk": "^3.8.3-patch.3",
"electron": ">=12.0.0"
}
},
@@ -1882,10 +1882,11 @@
}
},
"node_modules/@openim/wasm-client-sdk": {
"version": "3.8.3",
"resolved": "https://registry.npmjs.org/@openim/wasm-client-sdk/-/wasm-client-sdk-3.8.3.tgz",
"integrity": "sha512-Kly5qibTdPTaIX8SClbzke46X/hl6vjYY8i0iMAqktrNak+Vn80dxMpY9QhIdwqhYA8MU2ffcdJkd9JXm+QK2Q==",
"version": "3.8.3-patch.8",
"resolved": "https://registry.npmjs.org/@openim/wasm-client-sdk/-/wasm-client-sdk-3.8.3-patch.8.tgz",
"integrity": "sha512-kv0KZo5dFwWuzqoefjVaDrS94FVpTPdf/gWO2ppnpApHIGoSVhyHyLNhRgOBqa7MlOtpxZ8T8u0cdOMuZe5uRA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12.0"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@openim/electron-client-sdk",
"version": "3.8.3-patch.3",
"version": "3.8.3-patch.8",
"description": "open im sdk for node",
"source": "src/index.ts",
"main": "lib/index.js",
@@ -43,7 +43,7 @@
"devDependencies": {
"@commitlint/cli": "^16.2.4",
"@commitlint/config-conventional": "^16.2.4",
"@openim/wasm-client-sdk": "^3.8.3-patch.3",
"@openim/wasm-client-sdk": "^3.8.3-patch.8",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-terser": "^0.4.4",
"@types/ffi-napi": "^4.0.10",

View File

@@ -623,13 +623,19 @@ class OpenIMSDK
'__stdcall',
'get_friend_application_list_as_recipient',
'void',
['baseCallback *', 'str']
['baseCallback *', 'str', 'str']
);
this.libOpenIMSDK.get_friend_application_list_as_applicant = this.lib.func(
'__stdcall',
'get_friend_application_list_as_applicant',
'void',
['baseCallback *', 'str']
['baseCallback *', 'str', 'str']
);
this.libOpenIMSDK.get_friend_application_unhandled_count = this.lib.func(
'__stdcall',
'get_friend_application_unhandled_count',
'void',
['baseCallback *', 'str', 'str']
);
this.libOpenIMSDK.accept_friend_application = this.lib.func(
'__stdcall',
@@ -789,13 +795,19 @@ class OpenIMSDK
'__stdcall',
'get_group_application_list_as_recipient',
'void',
['baseCallback *', 'str']
['baseCallback *', 'str', 'str']
);
this.libOpenIMSDK.get_group_application_list_as_applicant = this.lib.func(
'__stdcall',
'get_group_application_list_as_applicant',
'void',
['baseCallback *', 'str']
['baseCallback *', 'str', 'str']
);
this.libOpenIMSDK.get_group_application_unhandled_count = this.lib.func(
'__stdcall',
'get_group_application_unhandled_count',
'void',
['baseCallback *', 'str', 'str']
);
this.libOpenIMSDK.accept_group_application = this.lib.func(
'__stdcall',
@@ -1295,6 +1307,7 @@ class OpenIMSDK
) => Promise<BaseResponse<void>>;
getFriendApplicationListAsApplicant!: FriendModuleApi['getFriendApplicationListAsApplicant'];
getFriendApplicationListAsRecipient!: FriendModuleApi['getFriendApplicationListAsRecipient'];
getFriendApplicationUnhandledCount!: FriendModuleApi['getFriendApplicationUnhandledCount'];
getFriendList!: FriendModuleApi['getFriendList'];
getFriendListPage!: FriendModuleApi['getFriendListPage'];
getSpecifiedFriendsInfo!: FriendModuleApi['getSpecifiedFriendsInfo'];
@@ -1315,6 +1328,7 @@ class OpenIMSDK
setGroupInfo!: GroupModuleApi['setGroupInfo'];
getGroupApplicationListAsRecipient!: GroupModuleApi['getGroupApplicationListAsRecipient'];
getGroupApplicationListAsApplicant!: GroupModuleApi['getGroupApplicationListAsApplicant'];
getGroupApplicationUnhandledCount!: GroupModuleApi['getGroupApplicationUnhandledCount'];
acceptGroupApplication!: GroupModuleApi['acceptGroupApplication'];
refuseGroupApplication!: GroupModuleApi['refuseGroupApplication'];
getGroupMemberList!: GroupModuleApi['getGroupMemberList'];

View File

@@ -6,6 +6,9 @@ import {
AccessFriendApplicationParams,
AddBlackParams,
AddFriendParams,
GetFriendApplicationListAsApplicationParams,
GetFriendApplicationListAsRecipientParams,
GetSelfUnhandledApplyCountParams,
GetSpecifiedFriendsParams,
OffsetParams,
PinFriendParams,
@@ -93,19 +96,45 @@ export function setupFriendModule(openIMSDK: OpenIMSDK) {
);
}),
getFriendApplicationListAsApplicant: (opid = uuidV4()) =>
getFriendApplicationListAsApplicant: (
params: GetFriendApplicationListAsApplicationParams = {
offset: 0,
count: 0,
},
opid = uuidV4()
) =>
new Promise<BaseResponse<FriendApplicationItem[]>>((resolve, reject) => {
openIMSDK.libOpenIMSDK.get_friend_application_list_as_applicant(
openIMSDK.baseCallbackWrap<FriendApplicationItem[]>(resolve, reject),
opid
opid,
JSON.stringify(params)
);
}),
getFriendApplicationListAsRecipient: (opid = uuidV4()) =>
getFriendApplicationListAsRecipient: (
params: GetFriendApplicationListAsRecipientParams = {
handleResults: [],
offset: 0,
count: 0,
},
opid = uuidV4()
) =>
new Promise<BaseResponse<FriendApplicationItem[]>>((resolve, reject) => {
openIMSDK.libOpenIMSDK.get_friend_application_list_as_recipient(
openIMSDK.baseCallbackWrap<FriendApplicationItem[]>(resolve, reject),
opid
opid,
JSON.stringify(params)
);
}),
getFriendApplicationUnhandledCount: (
params: GetSelfUnhandledApplyCountParams,
opid = uuidV4()
) =>
new Promise<BaseResponse<number>>((resolve, reject) => {
openIMSDK.libOpenIMSDK.get_friend_application_unhandled_count(
openIMSDK.baseCallbackWrap<number>(resolve, reject),
opid,
JSON.stringify(params)
);
}),
@@ -227,11 +256,17 @@ export interface FriendModuleApi {
) => Promise<BaseResponse<void>>;
getBlackList: (opid?: string) => Promise<BaseResponse<BlackUserItem[]>>;
getFriendApplicationListAsApplicant: (
params: GetFriendApplicationListAsApplicationParams,
opid?: string
) => Promise<BaseResponse<FriendApplicationItem[]>>;
getFriendApplicationListAsRecipient: (
params: GetFriendApplicationListAsRecipientParams,
opid?: string
) => Promise<BaseResponse<FriendApplicationItem[]>>;
getFriendApplicationUnhandledCount: (
params: GetSelfUnhandledApplyCountParams,
opid?: string
) => Promise<BaseResponse<number>>;
getFriendList: (
filterBlack?: boolean,
opid?: string

View File

@@ -20,6 +20,8 @@ import {
TransferGroupParams,
AccessToGroupParams,
OffsetParams,
GetSelfUnhandledApplyCountParams,
GetGroupApplicationListParams,
} from '@openim/wasm-client-sdk/lib/types/params';
export function setupGroupModule(openIMSDK: OpenIMSDK) {
@@ -101,19 +103,49 @@ export function setupGroupModule(openIMSDK: OpenIMSDK) {
);
}),
getGroupApplicationListAsRecipient: (opid = uuidV4()) =>
getGroupApplicationListAsRecipient: (
params: GetGroupApplicationListParams = {
groupID: [],
handleResults: [],
offset: 0,
count: 0,
},
opid = uuidV4()
) =>
new Promise<BaseResponse<GroupApplicationItem[]>>((resolve, reject) => {
openIMSDK.libOpenIMSDK.get_group_application_list_as_recipient(
openIMSDK.baseCallbackWrap<GroupApplicationItem[]>(resolve, reject),
opid
opid,
JSON.stringify(params)
);
}),
getGroupApplicationListAsApplicant: (opid = uuidV4()) =>
getGroupApplicationListAsApplicant: (
params: GetGroupApplicationListParams = {
groupID: [],
handleResults: [],
offset: 0,
count: 0,
},
opid = uuidV4()
) =>
new Promise<BaseResponse<GroupApplicationItem[]>>((resolve, reject) => {
openIMSDK.libOpenIMSDK.get_group_application_list_as_applicant(
openIMSDK.baseCallbackWrap<GroupApplicationItem[]>(resolve, reject),
opid
opid,
JSON.stringify(params)
);
}),
getGroupApplicationUnhandledCount: (
params: GetSelfUnhandledApplyCountParams,
opid = uuidV4()
) =>
new Promise<BaseResponse<number>>((resolve, reject) => {
openIMSDK.libOpenIMSDK.get_group_application_unhandled_count(
openIMSDK.baseCallbackWrap<number>(resolve, reject),
opid,
JSON.stringify(params)
);
}),
@@ -331,11 +363,17 @@ export interface GroupModuleApi {
opid?: string
) => Promise<BaseResponse<void>>;
getGroupApplicationListAsRecipient: (
params: GetGroupApplicationListParams,
opid?: string
) => Promise<BaseResponse<GroupApplicationItem[]>>;
getGroupApplicationListAsApplicant: (
params: GetGroupApplicationListParams,
opid?: string
) => Promise<BaseResponse<GroupApplicationItem[]>>;
getGroupApplicationUnhandledCount: (
params: GetSelfUnhandledApplyCountParams,
opid?: string
) => Promise<BaseResponse<number>>;
acceptGroupApplication: (
params: AccessGroupApplicationParams,
opid?: string

View File

@@ -408,11 +408,18 @@ declare module 'libOpenIMSDK' {
): void;
get_friend_application_list_as_recipient(
cCallback: CB_S_I_S_S,
operationID: string
operationID: string,
param: string
): void;
get_friend_application_list_as_applicant(
cCallback: CB_S_I_S_S,
operationID: string
operationID: string,
param: string
): void;
get_friend_application_unhandled_count(
cCallback: CB_S_I_S_S,
operationID: string,
param: string
): void;
accept_friend_application(
cCallback: CB_S_I_S_S,
@@ -569,11 +576,18 @@ declare module 'libOpenIMSDK' {
): void;
get_group_application_list_as_recipient(
cCallback: CB_S_I_S_S,
operationID: string
operationID: string,
param: string
): void;
get_group_application_list_as_applicant(
cCallback: CB_S_I_S_S,
operationID: string
operationID: string,
param: string
): void;
get_group_application_unhandled_count(
cCallback: CB_S_I_S_S,
operationID: string,
param: string
): void;
accept_group_application(
cCallback: CB_S_I_S_S,