feat: incr sync version.
This commit is contained in:
32
go/chao-sdk-core/testv2/callback.go
Normal file
32
go/chao-sdk-core/testv2/callback.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
import "fmt"
|
||||
|
||||
type TestSendMsg struct {
|
||||
}
|
||||
|
||||
func (TestSendMsg) OnSuccess(data string) {
|
||||
fmt.Println("testSendImg, OnSuccess, output: ", data)
|
||||
}
|
||||
|
||||
func (TestSendMsg) OnError(code int32, msg string) {
|
||||
fmt.Println("testSendImg, OnError, ", code, msg)
|
||||
}
|
||||
|
||||
func (TestSendMsg) OnProgress(progress int) {
|
||||
fmt.Println("progress: ", progress)
|
||||
}
|
||||
44
go/chao-sdk-core/testv2/config.go
Normal file
44
go/chao-sdk-core/testv2/config.go
Normal file
@@ -0,0 +1,44 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
import (
|
||||
"github.com/openimsdk/openim-sdk-core/v3/sdk_struct"
|
||||
"github.com/openimsdk/protocol/constant"
|
||||
)
|
||||
|
||||
const (
|
||||
//APIADDR = "http://172.16.8.48:10002"
|
||||
//WSADDR = "ws://172.16.8.48:10001"
|
||||
|
||||
APIADDR = "http://127.0.0.1:10002"
|
||||
WSADDR = "ws://127.0.0.1:10001"
|
||||
|
||||
UserID = "6864873394"
|
||||
friendUserID = "3281432310"
|
||||
)
|
||||
|
||||
func getConf(APIADDR, WSADDR string) sdk_struct.IMConfig {
|
||||
var cf sdk_struct.IMConfig
|
||||
cf.ApiAddr = APIADDR
|
||||
cf.WsAddr = WSADDR
|
||||
cf.DataDir = "../"
|
||||
cf.LogLevel = 6
|
||||
cf.IsExternalExtensions = true
|
||||
cf.PlatformID = constant.LinuxPlatformID
|
||||
cf.LogFilePath = ""
|
||||
cf.IsLogStandardOutput = true
|
||||
return cf
|
||||
}
|
||||
308
go/chao-sdk-core/testv2/conversation_test.go
Normal file
308
go/chao-sdk-core/testv2/conversation_test.go
Normal file
@@ -0,0 +1,308 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/openimsdk/openim-sdk-core/v3/open_im_sdk"
|
||||
"github.com/openimsdk/openim-sdk-core/v3/pkg/sdk_params_callback"
|
||||
"github.com/openimsdk/openim-sdk-core/v3/sdk_struct"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_GetAllConversationList(t *testing.T) {
|
||||
conversations, err := open_im_sdk.UserForSDK.Conversation().GetAllConversationList(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, conversation := range conversations {
|
||||
t.Log(conversation)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetConversationListSplit(t *testing.T) {
|
||||
conversations, err := open_im_sdk.UserForSDK.Conversation().GetConversationListSplit(ctx, 0, 20)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, conversation := range conversations {
|
||||
t.Log(conversation)
|
||||
}
|
||||
}
|
||||
|
||||
//func Test_SetConversationRecvMessageOpt(t *testing.T) {
|
||||
// err := open_im_sdk.UserForSDK.Conversation().SetConversationRecvMessageOpt(ctx, []string{"asdasd"}, 1)
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
//}
|
||||
|
||||
func Test_HideConversation(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().HideConversation(ctx, "asdasd")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetConversationRecvMessageOpt(t *testing.T) {
|
||||
opts, err := open_im_sdk.UserForSDK.Conversation().GetConversationRecvMessageOpt(ctx, []string{"asdasd"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, v := range opts {
|
||||
t.Log(v.ConversationID, *v.Result)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetGlobalRecvMessageOpt(t *testing.T) {
|
||||
opt, err := open_im_sdk.UserForSDK.Conversation().GetOneConversation(ctx, 2, "1772958501")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(*opt)
|
||||
}
|
||||
|
||||
func Test_GetGetMultipleConversation(t *testing.T) {
|
||||
conversations, err := open_im_sdk.UserForSDK.Conversation().GetMultipleConversation(ctx, []string{"asdasd"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, v := range conversations {
|
||||
t.Log(v)
|
||||
}
|
||||
}
|
||||
|
||||
// funcation Test_DeleteConversation(t *testing.T) {
|
||||
// err := open_im_sdk.UserForSDK.Conversation().DeleteConversation(ctx, "group_17729585012")
|
||||
// if err != nil {
|
||||
// if !strings.Contains(err.Error(), "no update") {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
func Test_SetConversationDraft(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().SetConversationDraft(ctx, "group_17729585012", "draft")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_ResetConversationGroupAtType(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().ResetConversationGroupAtType(ctx, "group_17729585012")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_PinConversation(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().PinConversation(ctx, "group_17729585012", true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_SetOneConversationPrivateChat(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().SetOneConversationPrivateChat(ctx, "single_3411008330", true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_SetOneConversationBurnDuration(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().SetOneConversationBurnDuration(ctx, "single_3411008330", 10)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_SetOneConversationRecvMessageOpt(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().SetOneConversationRecvMessageOpt(ctx, "single_3411008330", 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetTotalUnreadMsgCount(t *testing.T) {
|
||||
count, err := open_im_sdk.UserForSDK.Conversation().GetTotalUnreadMsgCount(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(count)
|
||||
}
|
||||
|
||||
func Test_SendMessage(t *testing.T) {
|
||||
ctx = context.WithValue(ctx, "callback", TestSendMsg{})
|
||||
msg, _ := open_im_sdk.UserForSDK.Conversation().CreateTextMessage(ctx, "textMsg")
|
||||
_, err := open_im_sdk.UserForSDK.Conversation().SendMessage(ctx, msg, "3411008330", "", nil, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_SendMessageNotOss(t *testing.T) {
|
||||
ctx = context.WithValue(ctx, "callback", TestSendMsg{})
|
||||
msg, _ := open_im_sdk.UserForSDK.Conversation().CreateTextMessage(ctx, "textMsg")
|
||||
_, err := open_im_sdk.UserForSDK.Conversation().SendMessageNotOss(ctx, msg, "3411008330", "", nil, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_FindMessageList(t *testing.T) {
|
||||
msgs, err := open_im_sdk.UserForSDK.Conversation().FindMessageList(ctx, []*sdk_params_callback.ConversationArgs{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(msgs.TotalCount)
|
||||
for _, v := range msgs.FindResultItems {
|
||||
t.Log(v)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetAdvancedHistoryMessageList(t *testing.T) {
|
||||
msgs, err := open_im_sdk.UserForSDK.Conversation().GetAdvancedHistoryMessageList(ctx, sdk_params_callback.GetAdvancedHistoryMessageListParams{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, v := range msgs.MessageList {
|
||||
t.Log(v)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetAdvancedHistoryMessageListReverse(t *testing.T) {
|
||||
msgs, err := open_im_sdk.UserForSDK.Conversation().GetAdvancedHistoryMessageListReverse(ctx, sdk_params_callback.GetAdvancedHistoryMessageListParams{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, v := range msgs.MessageList {
|
||||
t.Log(v)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_InsertSingleMessageToLocalStorage(t *testing.T) {
|
||||
_, err := open_im_sdk.UserForSDK.Conversation().InsertSingleMessageToLocalStorage(ctx, &sdk_struct.MsgStruct{}, "3411008330", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_InsertGroupMessageToLocalStorage(t *testing.T) {
|
||||
_, err := open_im_sdk.UserForSDK.Conversation().InsertGroupMessageToLocalStorage(ctx, &sdk_struct.MsgStruct{}, "group_17729585012", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_SearchLocalMessages(t *testing.T) {
|
||||
msgs, err := open_im_sdk.UserForSDK.Conversation().SearchLocalMessages(ctx, &sdk_params_callback.SearchLocalMessagesParams{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, v := range msgs.SearchResultItems {
|
||||
t.Log(v)
|
||||
}
|
||||
}
|
||||
|
||||
// // delete
|
||||
// funcation Test_DeleteMessageFromLocalStorage(t *testing.T) {
|
||||
// err := open_im_sdk.UserForSDK.Conversation().DeleteMessageFromLocalStorage(ctx, &sdk_struct.MsgStruct{SessionType: 1, ContentType: 1203,
|
||||
// ClientMsgID: "ef02943b05b02d02f92b0e92516099a3", Seq: 31, SendID: "kernaltestuid8", RecvID: "kernaltestuid9"})
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// funcation Test_DeleteMessage(t *testing.T) {
|
||||
// err := open_im_sdk.UserForSDK.Conversation().DeleteMessage(ctx, &sdk_struct.MsgStruct{SessionType: 1, ContentType: 1203,
|
||||
// ClientMsgID: "ef02943b05b02d02f92b0e92516099a3", Seq: 31, SendID: "kernaltestuid8", RecvID: "kernaltestuid9"})
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
// }
|
||||
|
||||
func Test_DeleteAllMsgFromLocalAndSvr(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().DeleteAllMsgFromLocalAndSvr(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_DeleteAllMessageFromLocalStorage(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().DeleteAllMessageFromLocalStorage(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_ClearConversationAndDeleteAllMsg(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().ClearConversationAndDeleteAllMsg(ctx, "si_3271407977_7152307910")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// func Test_RevokeMessage(t *testing.T) {
|
||||
// err := open_im_sdk.UserForSDK.Conversation().RevokeMessage(ctx, &sdk_struct.MsgStruct{SessionType: 1, ContentType: 101,
|
||||
// ClientMsgID: "380e2eb1709875340d769880982ebb21", Seq: 57, SendID: "9169012630", RecvID: "2456093263"})
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
// time.Sleep(time.Second * 10)
|
||||
// }
|
||||
|
||||
func Test_MarkConversationMessageAsRead(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().MarkConversationMessageAsRead(ctx, "si_2688118337_7249315132")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_MarkMsgsAsRead(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().MarkMessagesAsReadByMsgID(ctx, "si_2688118337_7249315132",
|
||||
[]string{"fb56ed151b675e0837ed3af79dbf66b1",
|
||||
"635715c539be2e7812a0fc802f0cdc54", "1aba3fae3dc3f61c17e8eb09519cf8e1"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_SendImgMsg(t *testing.T) {
|
||||
ctx = context.WithValue(ctx, "callback", TestSendMsg{})
|
||||
msg, err := open_im_sdk.UserForSDK.Conversation().CreateImageMessage(ctx, "C:\\Users\\Admin\\Desktop\\test.png")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
res, err := open_im_sdk.UserForSDK.Conversation().SendMessage(ctx, msg, "1919501984", "", nil, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("send smg => %+v\n", res)
|
||||
}
|
||||
func Test_SetConversationEx(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().SetOneConversationEx(ctx, "si_1_2", "abc")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func Test_SearchConversation(t *testing.T) {
|
||||
result, err := open_im_sdk.UserForSDK.Conversation().SearchConversation(ctx, "a")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, v := range result {
|
||||
t.Log(v)
|
||||
}
|
||||
}
|
||||
186
go/chao-sdk-core/testv2/create_msg_test.go
Normal file
186
go/chao-sdk-core/testv2/create_msg_test.go
Normal file
@@ -0,0 +1,186 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
import (
|
||||
"github.com/openimsdk/openim-sdk-core/v3/open_im_sdk"
|
||||
"github.com/openimsdk/openim-sdk-core/v3/sdk_struct"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_CreateTextMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateTextMessage(ctx, "textMsg")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateAdvancedTextMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateAdvancedTextMessage(ctx, "textAdMsg", []*sdk_struct.MessageEntity{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateTextAtMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateTextAtMessage(ctx, "textATtsg", []string{}, []*sdk_struct.AtInfo{}, &sdk_struct.MsgStruct{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateQuoteMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateQuoteMessage(ctx, "textATtsg", &sdk_struct.MsgStruct{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateAdvancedQuoteMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateAdvancedQuoteMessage(ctx, "textATtsg", &sdk_struct.MsgStruct{}, []*sdk_struct.MessageEntity{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateVideoMessageFromFullPath(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateVideoMessageFromFullPath(ctx, ".\\test.png", "mp4", 10, ".\\test.png")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateCardMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateCardMessage(ctx, &sdk_struct.CardElem{
|
||||
UserID: "123456",
|
||||
Nickname: "testname",
|
||||
FaceURL: "",
|
||||
})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateImageMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateImageMessage(ctx, ".\\test.png")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateImageMessageByURL(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateImageMessageByURL(ctx, "",
|
||||
sdk_struct.PictureBaseInfo{}, sdk_struct.PictureBaseInfo{}, sdk_struct.PictureBaseInfo{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateSoundMessageByURL(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateSoundMessageByURL(ctx, &sdk_struct.SoundBaseInfo{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateSoundMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateSoundMessage(ctx, ".\\test.png", 20)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateVideoMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateVideoMessage(ctx, ".\\test.png", "mp4", 10, "")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateVideoMessageByURL(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateVideoMessageByURL(ctx, sdk_struct.VideoBaseInfo{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateFileMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateFileMessage(ctx, ".\\test.png", "png")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateFileMessageByURL(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateFileMessageByURL(ctx, sdk_struct.FileBaseInfo{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateLocationMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateLocationMessage(ctx, "", 0, 0)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateCustomMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateCustomMessage(ctx, "", "", "")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateMergerMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateMergerMessage(ctx, []*sdk_struct.MsgStruct{}, "title", []string{"summary"})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateFaceMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateFaceMessage(ctx, 0, "www.faceURL.com")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
|
||||
func Test_CreateForwardMessage(t *testing.T) {
|
||||
message, err := open_im_sdk.UserForSDK.Conversation().CreateForwardMessage(ctx, &sdk_struct.MsgStruct{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(message)
|
||||
}
|
||||
42
go/chao-sdk-core/testv2/empty_test.go
Normal file
42
go/chao-sdk-core/testv2/empty_test.go
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
import (
|
||||
"github.com/openimsdk/openim-sdk-core/v3/open_im_sdk"
|
||||
"github.com/openimsdk/tools/log"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Test_ChangeInputState(t *testing.T) {
|
||||
for {
|
||||
err := open_im_sdk.UserForSDK.Conversation().ChangeInputStates(ctx, "sg_2309860938", true)
|
||||
if err != nil {
|
||||
log.ZError(ctx, "ChangeInputStates", err)
|
||||
}
|
||||
time.Sleep(time.Second * 1)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_Empty(t *testing.T) {
|
||||
for {
|
||||
time.Sleep(time.Second * 1)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_RunWait(t *testing.T) {
|
||||
time.Sleep(time.Second * 10)
|
||||
}
|
||||
38
go/chao-sdk-core/testv2/file_test.go
Normal file
38
go/chao-sdk-core/testv2/file_test.go
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
import (
|
||||
"github.com/openimsdk/openim-sdk-core/v3/internal/file"
|
||||
"github.com/openimsdk/openim-sdk-core/v3/open_im_sdk"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUploadFile(t *testing.T) {
|
||||
|
||||
fp := `C:\Users\openIM\Desktop\dist.zip`
|
||||
|
||||
resp, err := open_im_sdk.UserForSDK.File().UploadFile(ctx, &file.UploadFileReq{
|
||||
Filepath: fp,
|
||||
Name: filepath.Base(fp),
|
||||
Cause: "test",
|
||||
}, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(resp)
|
||||
|
||||
}
|
||||
182
go/chao-sdk-core/testv2/friend_test.go
Normal file
182
go/chao-sdk-core/testv2/friend_test.go
Normal file
@@ -0,0 +1,182 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
import (
|
||||
"github.com/openimsdk/openim-sdk-core/v3/open_im_sdk"
|
||||
"github.com/openimsdk/openim-sdk-core/v3/pkg/sdk_params_callback"
|
||||
"github.com/openimsdk/protocol/wrapperspb"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
friend2 "github.com/openimsdk/protocol/relation"
|
||||
)
|
||||
|
||||
func Test_GetSpecifiedFriendsInfo(t *testing.T) {
|
||||
info, err := open_im_sdk.UserForSDK.Friend().GetSpecifiedFriendsInfo(ctx, []string{"45644221123"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("GetDesignatedFriendsInfo success", ctx.Value("operationID"))
|
||||
for _, userInfo := range info {
|
||||
t.Log(userInfo)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_AddFriend(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Friend().AddFriend(ctx, &friend2.ApplyToAddFriendReq{
|
||||
ToUserID: "2",
|
||||
ReqMsg: "test add",
|
||||
Ex: "add",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("AddFriend success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
//funcation Test_GetRecvFriendApplicationList(t *testing.T) {
|
||||
// infos, err := open_im_sdk.UserForSDK.Friend().GetRecvFriendApplicationList(ctx)
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
// for _, info := range infos {
|
||||
// t.Logf("%#v", info)
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//funcation Test_GetSendFriendApplicationList(t *testing.T) {
|
||||
// infos, err := open_im_sdk.UserForSDK.Friend().GetSendFriendApplicationList(ctx)
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
// for _, info := range infos {
|
||||
// t.Logf("%#v", info)
|
||||
// }
|
||||
//}
|
||||
|
||||
func Test_AcceptFriendApplication(t *testing.T) {
|
||||
req := &sdk_params_callback.ProcessFriendApplicationParams{ToUserID: "1", HandleMsg: "test accept"}
|
||||
err := open_im_sdk.UserForSDK.Friend().AcceptFriendApplication(ctx, req)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("AcceptFriendApplication success", ctx.Value("operationID"))
|
||||
time.Sleep(time.Second * 30)
|
||||
}
|
||||
|
||||
func Test_RefuseFriendApplication(t *testing.T) {
|
||||
req := &sdk_params_callback.ProcessFriendApplicationParams{ToUserID: "6754269405", HandleMsg: "test refuse"}
|
||||
err := open_im_sdk.UserForSDK.Friend().RefuseFriendApplication(ctx, req)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("RefuseFriendApplication success", ctx.Value("operationID"))
|
||||
time.Sleep(time.Second * 30)
|
||||
}
|
||||
|
||||
func Test_CheckFriend(t *testing.T) {
|
||||
res, err := open_im_sdk.UserForSDK.Friend().CheckFriend(ctx, []string{"863454357", "45644221123"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("CheckFriend success", ctx.Value("operationID"))
|
||||
for _, re := range res {
|
||||
t.Log(re)
|
||||
}
|
||||
}
|
||||
func Test_PinFriend(t *testing.T) {
|
||||
pinParams := &sdk_params_callback.SetFriendPinParams{
|
||||
ToUserIDs: []string{"2", "3"},
|
||||
IsPinned: &wrapperspb.BoolValue{Value: false},
|
||||
}
|
||||
|
||||
err := open_im_sdk.UserForSDK.Friend().PinFriends(ctx, pinParams)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("CheckFriend success", ctx.Value("operationID"))
|
||||
}
|
||||
func Test_DeleteFriend(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Friend().DeleteFriend(ctx, "863454357")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("DeleteFriend success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_GetFriendList(t *testing.T) {
|
||||
infos, err := open_im_sdk.UserForSDK.Friend().GetFriendList(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("GetFriendList success", ctx.Value("operationID"))
|
||||
for _, info := range infos {
|
||||
t.Logf("PublicInfo: %#v, FriendInfo: %#v, BlackInfo: %#v", info.PublicInfo, info.FriendInfo, info.BlackInfo)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_SearchFriends(t *testing.T) {
|
||||
info, err := open_im_sdk.UserForSDK.Friend().SearchFriends(ctx, &sdk_params_callback.SearchFriendsParam{KeywordList: []string{"863454357"}, IsSearchUserID: true})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("SearchFriends success", ctx.Value("operationID"))
|
||||
for _, item := range info {
|
||||
t.Log(*item)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_SetFriendRemark(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Friend().SetFriendRemark(ctx, &sdk_params_callback.SetFriendRemarkParams{ToUserID: "863454357", Remark: "testRemark"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("SetFriendRemark success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_AddBlack(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Friend().AddBlack(ctx, "863454357", "ex")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("AddBlack success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_RemoveBlack(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Friend().RemoveBlack(ctx, "863454357")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("RemoveBlack success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_GetBlackList(t *testing.T) {
|
||||
info, err := open_im_sdk.UserForSDK.Friend().GetBlackList(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("GetBlackList success", ctx.Value("operationID"))
|
||||
for _, item := range info {
|
||||
t.Log(*item)
|
||||
}
|
||||
}
|
||||
func Test_SetFriendsEx(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Friend().SetFriendsEx(ctx, []string{"2"}, "exx")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
316
go/chao-sdk-core/testv2/group_test.go
Normal file
316
go/chao-sdk-core/testv2/group_test.go
Normal file
@@ -0,0 +1,316 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
import (
|
||||
"github.com/openimsdk/openim-sdk-core/v3/open_im_sdk"
|
||||
"github.com/openimsdk/openim-sdk-core/v3/pkg/constant"
|
||||
"github.com/openimsdk/openim-sdk-core/v3/pkg/sdk_params_callback"
|
||||
"github.com/openimsdk/protocol/group"
|
||||
"github.com/openimsdk/protocol/sdkws"
|
||||
"github.com/openimsdk/protocol/wrapperspb"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_CreateGroupV2(t *testing.T) {
|
||||
req := &group.CreateGroupReq{
|
||||
MemberUserIDs: []string{"7299270930"},
|
||||
AdminUserIDs: []string{"1"},
|
||||
OwnerUserID: UserID,
|
||||
GroupInfo: &sdkws.GroupInfo{
|
||||
GroupName: "test",
|
||||
GroupType: 2,
|
||||
},
|
||||
}
|
||||
info, err := open_im_sdk.UserForSDK.Group().CreateGroup(ctx, req)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("group info: %s", info.String())
|
||||
}
|
||||
|
||||
func Test_JoinGroup(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().JoinGroup(ctx, "3889561099", "1234", 3, "ex")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("InviteUserToGroup success")
|
||||
}
|
||||
|
||||
func Test_QuitGroup(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().QuitGroup(ctx, "xadxwr24")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("QuitGroup success")
|
||||
}
|
||||
|
||||
func Test_DismissGroup(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().DismissGroup(ctx, "1728503199")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("DismissGroup success")
|
||||
}
|
||||
|
||||
func Test_ChangeGroupMute(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().ChangeGroupMute(ctx, "3459296007", true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("ChangeGroupMute success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_CancelMuteGroup(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().ChangeGroupMute(ctx, "3459296007", false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("ChangeGroupMute success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_ChangeGroupMemberMute(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().ChangeGroupMemberMute(ctx, "3459296007", UserID, 10000)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("ChangeGroupMute success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_CancelChangeGroupMemberMute(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().ChangeGroupMemberMute(ctx, "3459296007", UserID, 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("CancelChangeGroupMemberMute success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_SetGroupMemberRoleLevel(t *testing.T) {
|
||||
// 1:普通成员 2:群主 3:管理员
|
||||
err := open_im_sdk.UserForSDK.Group().SetGroupMemberRoleLevel(ctx, "3459296007", "45644221123", 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("SetGroupMemberRoleLevel success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_SetGroupMemberNickname(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().SetGroupMemberNickname(ctx, "3459296007", "45644221123", "test1234")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("SetGroupMemberNickname success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_SetGroupMemberInfo(t *testing.T) {
|
||||
// 1:普通成员 2:群主 3:管理员
|
||||
err := open_im_sdk.UserForSDK.Group().SetGroupMemberInfo(ctx, &group.SetGroupMemberInfo{
|
||||
GroupID: "3889561099",
|
||||
UserID: UserID,
|
||||
FaceURL: wrapperspb.String("https://doc.rentsoft.cn/images/logo.png"),
|
||||
Nickname: wrapperspb.String("testupdatename"),
|
||||
Ex: wrapperspb.String("a"),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("SetGroupMemberNickname success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_GetJoinedGroupList(t *testing.T) {
|
||||
info, err := open_im_sdk.UserForSDK.Group().GetJoinedGroupList(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("GetJoinedGroupList: %d\n", len(info))
|
||||
for _, localGroup := range info {
|
||||
t.Logf("%#v", localGroup)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetSpecifiedGroupsInfo(t *testing.T) {
|
||||
info, err := open_im_sdk.UserForSDK.Group().GetSpecifiedGroupsInfo(ctx, []string{"test"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("GetGroupsInfo: %d\n", len(info))
|
||||
for _, localGroup := range info {
|
||||
t.Logf("%#v", localGroup)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetGroupApplicationListAsRecipient(t *testing.T) {
|
||||
info, err := open_im_sdk.UserForSDK.Group().GetGroupApplicationListAsRecipient(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("GetRecvGroupApplicationList: %d\n", len(info))
|
||||
for _, localGroup := range info {
|
||||
t.Logf("%#v", localGroup)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetGroupApplicationListAsApplicant(t *testing.T) {
|
||||
info, err := open_im_sdk.UserForSDK.Group().GetGroupApplicationListAsApplicant(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("GetSendGroupApplicationList: %d\n", len(info))
|
||||
for _, localGroup := range info {
|
||||
t.Logf("%#v", localGroup)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_AcceptGroupApplication(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().AcceptGroupApplication(ctx, "3459296007", "863454357", "test accept")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("AcceptGroupApplication success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_RefuseGroupApplication(t *testing.T) {
|
||||
t.Log("operationID:", ctx.Value("operationID"))
|
||||
err := open_im_sdk.UserForSDK.Group().RefuseGroupApplication(ctx, "3459296007", "863454357", "test refuse")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("AcceptGroupApplication success")
|
||||
}
|
||||
|
||||
func Test_HandlerGroupApplication(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().HandlerGroupApplication(ctx, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("AcceptGroupApplication success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_SearchGroupMembers(t *testing.T) {
|
||||
info, err := open_im_sdk.UserForSDK.Group().SearchGroupMembers(ctx, &sdk_params_callback.SearchGroupMembersParam{
|
||||
GroupID: "3459296007",
|
||||
KeywordList: []string{""},
|
||||
IsSearchUserID: false,
|
||||
IsSearchMemberNickname: false,
|
||||
Offset: 0,
|
||||
Count: 10,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("SearchGroupMembers: %d\n", len(info))
|
||||
for _, localGroup := range info {
|
||||
t.Logf("%#v", localGroup)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_KickGroupMember(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().KickGroupMember(ctx, "3459296007", "test", []string{"863454357"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("InviteUserToGroup success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_TransferGroupOwner(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().TransferGroupOwner(ctx, "1728503199", "5226390099")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("TransferGroupOwner success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
func Test_InviteUserToGroup(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().InviteUserToGroup(ctx, "3459296007", "test", []string{"45644221123"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("InviteUserToGroup success", ctx.Value("operationID"))
|
||||
}
|
||||
|
||||
//func Test_SyncGroup(t *testing.T) {
|
||||
// err := open_im_sdk.UserForSDK.Group().SyncGroupMember(ctx, "3179997540")
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
// time.Sleep(time.Second * 100000)
|
||||
//}
|
||||
|
||||
func Test_GetGroup(t *testing.T) {
|
||||
t.Log("--------------------------")
|
||||
infos, err := open_im_sdk.UserForSDK.Group().GetSpecifiedGroupsInfo(ctx, []string{"3179997540"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for i, info := range infos {
|
||||
t.Logf("%d: %#v", i, info)
|
||||
}
|
||||
// time.Sleep(time.Second * 100000)
|
||||
}
|
||||
func Test_GetGroupApplicantsList(t *testing.T) {
|
||||
t.Log("--------------------------")
|
||||
infos, err := open_im_sdk.UserForSDK.Group().GetGroupApplicationListAsRecipient(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for i, info := range infos {
|
||||
t.Logf("%d: %#v", i, info)
|
||||
}
|
||||
// time.Sleep(time.Second * 100000)
|
||||
}
|
||||
func Test_IsJoinGroup(t *testing.T) {
|
||||
t.Log("--------------------------")
|
||||
join, err := open_im_sdk.UserForSDK.Group().IsJoinGroup(ctx, "3889561099")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("join:", join)
|
||||
}
|
||||
|
||||
func Test_GetGroupMemberList(t *testing.T) {
|
||||
t.Log("--------------------------")
|
||||
m := map[int32]string{
|
||||
constant.GroupOwner: "群主",
|
||||
constant.GroupAdmin: "管理员",
|
||||
constant.GroupOrdinaryUsers: "成员",
|
||||
}
|
||||
|
||||
members, err := open_im_sdk.UserForSDK.Group().GetGroupMemberList(ctx, "3889561099", 0, 0, 9999999)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for i, member := range members {
|
||||
name := m[member.RoleLevel]
|
||||
t.Log(i, member.UserID, member.Nickname, name)
|
||||
}
|
||||
|
||||
t.Log("--------------------------")
|
||||
}
|
||||
|
||||
func Test_SyncAllGroupMember(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().SyncAllGroupMember(ctx, "3889561099")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func Test_SetGroupInfo(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Group().SetGroupInfo(ctx, &sdkws.GroupInfoForSet{
|
||||
GroupID: "3889561099",
|
||||
Ex: &wrapperspb.StringValue{Value: "groupex"},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
336
go/chao-sdk-core/testv2/init.go
Normal file
336
go/chao-sdk-core/testv2/init.go
Normal file
@@ -0,0 +1,336 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/openimsdk/openim-sdk-core/v3/open_im_sdk"
|
||||
"github.com/openimsdk/openim-sdk-core/v3/pkg/ccontext"
|
||||
"github.com/openimsdk/protocol/constant"
|
||||
"io"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/openimsdk/tools/log"
|
||||
)
|
||||
|
||||
var (
|
||||
ctx context.Context
|
||||
)
|
||||
|
||||
func init() {
|
||||
fmt.Println("------------------------>>>>>>>>>>>>>>>>>>> test v2 init funcation <<<<<<<<<<<<<<<<<<<------------------------")
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
listner := &OnConnListener{}
|
||||
config := getConf(APIADDR, WSADDR)
|
||||
config.DataDir = "./"
|
||||
configData, err := json.Marshal(config)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
isInit := open_im_sdk.InitSDK(listner, "test", string(configData))
|
||||
if !isInit {
|
||||
panic("init sdk failed")
|
||||
}
|
||||
ctx = open_im_sdk.UserForSDK.Context()
|
||||
ctx = ccontext.WithOperationID(ctx, "initOperationID_"+strconv.Itoa(int(time.Now().UnixMilli())))
|
||||
token, err := GetUserToken(ctx, UserID)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := open_im_sdk.UserForSDK.Login(ctx, UserID, token); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
open_im_sdk.UserForSDK.SetConversationListener(&onConversationListener{ctx: ctx})
|
||||
open_im_sdk.UserForSDK.SetGroupListener(&onGroupListener{ctx: ctx})
|
||||
open_im_sdk.UserForSDK.SetAdvancedMsgListener(&onAdvancedMsgListener{ctx: ctx})
|
||||
open_im_sdk.UserForSDK.SetFriendListener(&onFriendListener{ctx: ctx})
|
||||
open_im_sdk.UserForSDK.SetUserListener(&onUserListener{ctx: ctx})
|
||||
time.Sleep(time.Second * 2)
|
||||
}
|
||||
|
||||
func GetUserToken(ctx context.Context, userID string) (string, error) {
|
||||
jsonReqData, err := json.Marshal(map[string]any{
|
||||
"userID": userID,
|
||||
"platformID": constant.LinuxPlatformID,
|
||||
"secret": "openIM123",
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
path := APIADDR + "/auth/user_token"
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, path, bytes.NewReader(jsonReqData))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
req.Header.Set("operationID", ctx.Value("operationID").(string))
|
||||
client := http.Client{Timeout: time.Second * 3}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
type Result struct {
|
||||
ErrCode int `json:"errCode"`
|
||||
ErrMsg string `json:"errMsg"`
|
||||
ErrDlt string `json:"errDlt"`
|
||||
Data struct {
|
||||
Token string `json:"token"`
|
||||
ExpireTimeSeconds int `json:"expireTimeSeconds"`
|
||||
} `json:"data"`
|
||||
}
|
||||
var result Result
|
||||
if err := json.Unmarshal(body, &result); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if result.ErrCode != 0 {
|
||||
return "", fmt.Errorf("errCode:%d, errMsg:%s, errDlt:%s", result.ErrCode, result.ErrMsg, result.ErrDlt)
|
||||
}
|
||||
return result.Data.Token, nil
|
||||
}
|
||||
|
||||
type onListenerForService struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func (o *onListenerForService) OnGroupApplicationAdded(groupApplication string) {
|
||||
log.ZInfo(o.ctx, "OnGroupApplicationAdded", "groupApplication", groupApplication)
|
||||
}
|
||||
|
||||
func (o *onListenerForService) OnGroupApplicationAccepted(groupApplication string) {
|
||||
log.ZInfo(o.ctx, "OnGroupApplicationAccepted", "groupApplication", groupApplication)
|
||||
}
|
||||
|
||||
func (o *onListenerForService) OnFriendApplicationAdded(friendApplication string) {
|
||||
log.ZInfo(o.ctx, "OnFriendApplicationAdded", "friendApplication", friendApplication)
|
||||
}
|
||||
|
||||
func (o *onListenerForService) OnFriendApplicationAccepted(groupApplication string) {
|
||||
log.ZInfo(o.ctx, "OnFriendApplicationAccepted", "groupApplication", groupApplication)
|
||||
}
|
||||
|
||||
func (o *onListenerForService) OnRecvNewMessage(message string) {
|
||||
log.ZInfo(o.ctx, "OnRecvNewMessage", "message", message)
|
||||
}
|
||||
|
||||
type onConversationListener struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func (o *onConversationListener) OnSyncServerStart() {
|
||||
log.ZInfo(o.ctx, "OnSyncServerStart")
|
||||
}
|
||||
|
||||
func (o *onConversationListener) OnSyncServerFinish() {
|
||||
log.ZInfo(o.ctx, "OnSyncServerFinish")
|
||||
}
|
||||
|
||||
func (o *onConversationListener) OnSyncServerFailed() {
|
||||
log.ZInfo(o.ctx, "OnSyncServerFailed")
|
||||
}
|
||||
|
||||
func (o *onConversationListener) OnNewConversation(conversationList string) {
|
||||
log.ZInfo(o.ctx, "OnNewConversation", "conversationList", conversationList)
|
||||
}
|
||||
|
||||
func (o *onConversationListener) OnConversationChanged(conversationList string) {
|
||||
log.ZInfo(o.ctx, "OnConversationChanged", "conversationList", conversationList)
|
||||
}
|
||||
|
||||
func (o *onConversationListener) OnTotalUnreadMessageCountChanged(totalUnreadCount int32) {
|
||||
log.ZInfo(o.ctx, "OnTotalUnreadMessageCountChanged", "totalUnreadCount", totalUnreadCount)
|
||||
}
|
||||
|
||||
func (o *onConversationListener) OnConversationUserInputStatusChanged(change string) {
|
||||
log.ZInfo(o.ctx, "OnConversationUserInputStatusChanged", "change", change)
|
||||
}
|
||||
|
||||
type onGroupListener struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func (o *onGroupListener) OnGroupDismissed(groupInfo string) {
|
||||
log.ZInfo(o.ctx, "OnGroupDismissed", "groupInfo", groupInfo)
|
||||
}
|
||||
|
||||
func (o *onGroupListener) OnJoinedGroupAdded(groupInfo string) {
|
||||
log.ZInfo(o.ctx, "OnJoinedGroupAdded", "groupInfo", groupInfo)
|
||||
}
|
||||
|
||||
func (o *onGroupListener) OnJoinedGroupDeleted(groupInfo string) {
|
||||
log.ZInfo(o.ctx, "OnJoinedGroupDeleted", "groupInfo", groupInfo)
|
||||
}
|
||||
|
||||
func (o *onGroupListener) OnGroupMemberAdded(groupMemberInfo string) {
|
||||
log.ZInfo(o.ctx, "OnGroupMemberAdded", "groupMemberInfo", groupMemberInfo)
|
||||
}
|
||||
|
||||
func (o *onGroupListener) OnGroupMemberDeleted(groupMemberInfo string) {
|
||||
log.ZInfo(o.ctx, "OnGroupMemberDeleted", "groupMemberInfo", groupMemberInfo)
|
||||
}
|
||||
|
||||
func (o *onGroupListener) OnGroupApplicationAdded(groupApplication string) {
|
||||
log.ZInfo(o.ctx, "OnGroupApplicationAdded", "groupApplication", groupApplication)
|
||||
}
|
||||
|
||||
func (o *onGroupListener) OnGroupApplicationDeleted(groupApplication string) {
|
||||
log.ZInfo(o.ctx, "OnGroupApplicationDeleted", "groupApplication", groupApplication)
|
||||
}
|
||||
|
||||
func (o *onGroupListener) OnGroupInfoChanged(groupInfo string) {
|
||||
log.ZInfo(o.ctx, "OnGroupInfoChanged", "groupInfo", groupInfo)
|
||||
}
|
||||
|
||||
func (o *onGroupListener) OnGroupMemberInfoChanged(groupMemberInfo string) {
|
||||
log.ZInfo(o.ctx, "OnGroupMemberInfoChanged", "groupMemberInfo", groupMemberInfo)
|
||||
}
|
||||
|
||||
func (o *onGroupListener) OnGroupApplicationAccepted(groupApplication string) {
|
||||
log.ZInfo(o.ctx, "OnGroupApplicationAccepted", "groupApplication", groupApplication)
|
||||
}
|
||||
|
||||
func (o *onGroupListener) OnGroupApplicationRejected(groupApplication string) {
|
||||
log.ZInfo(o.ctx, "OnGroupApplicationRejected", "groupApplication", groupApplication)
|
||||
}
|
||||
|
||||
type onAdvancedMsgListener struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func (o *onAdvancedMsgListener) OnRecvOnlineOnlyMessage(message string) {
|
||||
log.ZDebug(o.ctx, "OnRecvOnlineOnlyMessage", "message", message)
|
||||
}
|
||||
|
||||
func (o *onAdvancedMsgListener) OnRecvOfflineNewMessage(message string) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (o *onAdvancedMsgListener) OnMsgDeleted(message string) {
|
||||
log.ZInfo(o.ctx, "OnMsgDeleted", "message", message)
|
||||
}
|
||||
|
||||
//funcation (o *onAdvancedMsgListener) OnMsgDeleted(messageList string) {
|
||||
// log.ZInfo(o.ctx, "OnRecvOfflineNewMessages", "messageList", messageList)
|
||||
//}
|
||||
//
|
||||
//funcation (o *onAdvancedMsgListener) OnMsgDeleted(message string) {
|
||||
// log.ZInfo(o.ctx, "OnMsgDeleted", "message", message)
|
||||
//}
|
||||
|
||||
func (o *onAdvancedMsgListener) OnRecvOfflineNewMessages(messageList string) {
|
||||
log.ZInfo(o.ctx, "OnRecvOfflineNewMessages", "messageList", messageList)
|
||||
}
|
||||
|
||||
func (o *onAdvancedMsgListener) OnRecvNewMessage(message string) {
|
||||
log.ZInfo(o.ctx, "OnRecvNewMessage", "message", message)
|
||||
}
|
||||
|
||||
func (o *onAdvancedMsgListener) OnRecvC2CReadReceipt(msgReceiptList string) {
|
||||
log.ZInfo(o.ctx, "OnRecvC2CReadReceipt", "msgReceiptList", msgReceiptList)
|
||||
}
|
||||
|
||||
func (o *onAdvancedMsgListener) OnRecvGroupReadReceipt(groupMsgReceiptList string) {
|
||||
log.ZInfo(o.ctx, "OnRecvGroupReadReceipt", "groupMsgReceiptList", groupMsgReceiptList)
|
||||
}
|
||||
|
||||
func (o *onAdvancedMsgListener) OnRecvMessageRevoked(msgID string) {
|
||||
log.ZInfo(o.ctx, "OnRecvMessageRevoked", "msgID", msgID)
|
||||
}
|
||||
|
||||
func (o *onAdvancedMsgListener) OnNewRecvMessageRevoked(messageRevoked string) {
|
||||
log.ZInfo(o.ctx, "OnNewRecvMessageRevoked", "messageRevoked", messageRevoked)
|
||||
}
|
||||
|
||||
func (o *onAdvancedMsgListener) OnRecvMessageExtensionsChanged(msgID string, reactionExtensionList string) {
|
||||
log.ZInfo(o.ctx, "OnRecvMessageExtensionsChanged", "msgID", msgID, "reactionExtensionList", reactionExtensionList)
|
||||
}
|
||||
|
||||
func (o *onAdvancedMsgListener) OnRecvMessageExtensionsDeleted(msgID string, reactionExtensionKeyList string) {
|
||||
log.ZInfo(o.ctx, "OnRecvMessageExtensionsDeleted", "msgID", msgID, "reactionExtensionKeyList", reactionExtensionKeyList)
|
||||
}
|
||||
|
||||
func (o *onAdvancedMsgListener) OnRecvMessageExtensionsAdded(msgID string, reactionExtensionList string) {
|
||||
log.ZInfo(o.ctx, "OnRecvMessageExtensionsAdded", "msgID", msgID, "reactionExtensionList", reactionExtensionList)
|
||||
}
|
||||
|
||||
type onFriendListener struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func (o *onFriendListener) OnFriendApplicationAdded(friendApplication string) {
|
||||
log.ZDebug(context.Background(), "OnFriendApplicationAdded", "friendApplication", friendApplication)
|
||||
}
|
||||
|
||||
func (o *onFriendListener) OnFriendApplicationDeleted(friendApplication string) {
|
||||
log.ZDebug(context.Background(), "OnFriendApplicationDeleted", "friendApplication", friendApplication)
|
||||
}
|
||||
|
||||
func (o *onFriendListener) OnFriendApplicationAccepted(friendApplication string) {
|
||||
log.ZDebug(context.Background(), "OnFriendApplicationAccepted", "friendApplication", friendApplication)
|
||||
}
|
||||
|
||||
func (o *onFriendListener) OnFriendApplicationRejected(friendApplication string) {
|
||||
log.ZDebug(context.Background(), "OnFriendApplicationRejected", "friendApplication", friendApplication)
|
||||
}
|
||||
|
||||
func (o *onFriendListener) OnFriendAdded(friendInfo string) {
|
||||
log.ZDebug(context.Background(), "OnFriendAdded", "friendInfo", friendInfo)
|
||||
}
|
||||
|
||||
func (o *onFriendListener) OnFriendDeleted(friendInfo string) {
|
||||
log.ZDebug(context.Background(), "OnFriendDeleted", "friendInfo", friendInfo)
|
||||
}
|
||||
|
||||
func (o *onFriendListener) OnFriendInfoChanged(friendInfo string) {
|
||||
log.ZDebug(context.Background(), "OnFriendInfoChanged", "friendInfo", friendInfo)
|
||||
}
|
||||
|
||||
func (o *onFriendListener) OnBlackAdded(blackInfo string) {
|
||||
log.ZDebug(context.Background(), "OnBlackAdded", "blackInfo", blackInfo)
|
||||
}
|
||||
|
||||
func (o *onFriendListener) OnBlackDeleted(blackInfo string) {
|
||||
log.ZDebug(context.Background(), "OnBlackDeleted", "blackInfo", blackInfo)
|
||||
}
|
||||
|
||||
type onUserListener struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func (o *onUserListener) OnSelfInfoUpdated(userInfo string) {
|
||||
log.ZDebug(context.Background(), "OnSelfInfoUpdated", "userInfo", userInfo)
|
||||
}
|
||||
func (o *onUserListener) OnUserCommandAdd(userInfo string) {
|
||||
log.ZDebug(context.Background(), "OnUserCommandAdd", "blackInfo", userInfo)
|
||||
}
|
||||
func (o *onUserListener) OnUserCommandDelete(userInfo string) {
|
||||
log.ZDebug(context.Background(), "OnUserCommandDelete", "blackInfo", userInfo)
|
||||
}
|
||||
func (o *onUserListener) OnUserCommandUpdate(userInfo string) {
|
||||
log.ZDebug(context.Background(), "OnUserCommandUpdate", "blackInfo", userInfo)
|
||||
}
|
||||
func (o *onUserListener) OnUserStatusChanged(statusMap string) {
|
||||
log.ZDebug(context.Background(), "OnUserStatusChanged", "OnUserStatusChanged", statusMap)
|
||||
}
|
||||
39
go/chao-sdk-core/testv2/listener.go
Normal file
39
go/chao-sdk-core/testv2/listener.go
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
type OnConnListener struct{}
|
||||
|
||||
func (c *OnConnListener) OnUserTokenInvalid(errMsg string) {}
|
||||
|
||||
func (c *OnConnListener) OnConnecting() {
|
||||
// fmt.Println("OnConnecting")
|
||||
}
|
||||
|
||||
func (c *OnConnListener) OnConnectSuccess() {
|
||||
// fmt.Println("OnConnectSuccess")
|
||||
}
|
||||
|
||||
func (c *OnConnListener) OnConnectFailed(errCode int32, errMsg string) {
|
||||
// fmt.Println("OnConnectFailed")
|
||||
}
|
||||
|
||||
func (c *OnConnListener) OnKickedOffline() {
|
||||
// fmt.Println("OnKickedOffline")
|
||||
}
|
||||
|
||||
func (c *OnConnListener) OnUserTokenExpired() {
|
||||
// fmt.Println("OnUserTokenExpired")
|
||||
}
|
||||
148
go/chao-sdk-core/testv2/signaling_test.go
Normal file
148
go/chao-sdk-core/testv2/signaling_test.go
Normal file
@@ -0,0 +1,148 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
// func Test_SignalingInviteInGroup(t *testing.T) {
|
||||
// resp, err := open_im_sdk.UserForSDK.Signaling().SignalingInviteInGroup(ctx, &sdkws.SignalInviteInGroupReq{
|
||||
// Invitation: &sdkws.InvitationInfo{
|
||||
// InviterUserID: UserID,
|
||||
// InviteeUserIDList: []string{"targetUser"},
|
||||
// CustomData: "",
|
||||
// GroupID: "testgroup",
|
||||
// RoomID: "testgroup",
|
||||
// Timeout: 30,
|
||||
// MediaType: "video",
|
||||
// PlatformID: 1,
|
||||
// SessionType: 3,
|
||||
// },
|
||||
// })
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
// t.Log(resp)
|
||||
// }
|
||||
|
||||
// func Test_SignalingInite(t *testing.T) {
|
||||
// resp, err := open_im_sdk.UserForSDK.Signaling().SignalingInvite(ctx, &sdkws.SignalInviteReq{
|
||||
// Invitation: &sdkws.InvitationInfo{
|
||||
// InviterUserID: UserID,
|
||||
// InviteeUserIDList: []string{"targetUser"},
|
||||
// CustomData: "",
|
||||
// GroupID: "",
|
||||
// RoomID: "testroomID",
|
||||
// Timeout: 30,
|
||||
// MediaType: "video",
|
||||
// PlatformID: 1,
|
||||
// SessionType: 1,
|
||||
// },
|
||||
// })
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
// t.Log(resp)
|
||||
// }
|
||||
|
||||
// func Test_SignalingAccept(t *testing.T) {
|
||||
// resp, err := open_im_sdk.UserForSDK.Signaling().SignalingAccept(ctx, &sdkws.SignalAcceptReq{
|
||||
// Invitation: &sdkws.InvitationInfo{
|
||||
// InviterUserID: UserID,
|
||||
// InviteeUserIDList: []string{"targetUser"},
|
||||
// CustomData: "",
|
||||
// GroupID: "",
|
||||
// RoomID: "testroomID",
|
||||
// Timeout: 30,
|
||||
// MediaType: "video",
|
||||
// PlatformID: 1,
|
||||
// SessionType: 1,
|
||||
// },
|
||||
// })
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
// t.Log(resp)
|
||||
// }
|
||||
|
||||
// func Test_SignalingReject(t *testing.T) {
|
||||
// err := open_im_sdk.UserForSDK.Signaling().SignalingReject(ctx, &sdkws.SignalRejectReq{
|
||||
// Invitation: &sdkws.InvitationInfo{
|
||||
// InviterUserID: UserID,
|
||||
// InviteeUserIDList: []string{"targetUser"},
|
||||
// CustomData: "",
|
||||
// GroupID: "",
|
||||
// RoomID: "testroomID",
|
||||
// Timeout: 30,
|
||||
// MediaType: "video",
|
||||
// PlatformID: 1,
|
||||
// SessionType: 1,
|
||||
// },
|
||||
// })
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
// }
|
||||
|
||||
// func Test_SignalingCancel(t *testing.T) {
|
||||
// err := open_im_sdk.UserForSDK.Signaling().SignalingCancel(ctx, &sdkws.SignalCancelReq{
|
||||
// Invitation: &sdkws.InvitationInfo{
|
||||
// InviterUserID: UserID,
|
||||
// InviteeUserIDList: []string{"targetUser"},
|
||||
// CustomData: "",
|
||||
// GroupID: "",
|
||||
// RoomID: "testroomID",
|
||||
// Timeout: 30,
|
||||
// MediaType: "video",
|
||||
// PlatformID: 1,
|
||||
// SessionType: 1,
|
||||
// },
|
||||
// })
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
// }
|
||||
|
||||
// func Test_SignalingHungUp(t *testing.T) {
|
||||
// err := open_im_sdk.UserForSDK.Signaling().SignalingHungUp(ctx, &sdkws.SignalHungUpReq{
|
||||
// Invitation: &sdkws.InvitationInfo{
|
||||
// InviterUserID: UserID,
|
||||
// InviteeUserIDList: []string{"targetUser"},
|
||||
// CustomData: "",
|
||||
// GroupID: "",
|
||||
// RoomID: "testroomID",
|
||||
// Timeout: 30,
|
||||
// MediaType: "video",
|
||||
// PlatformID: 1,
|
||||
// SessionType: 1,
|
||||
// },
|
||||
// })
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
// }
|
||||
|
||||
// func Test_SignalingGetRoomByGroupID(t *testing.T) {
|
||||
// resp, err := open_im_sdk.UserForSDK.Signaling().SignalingGetRoomByGroupID(ctx, "testgroupID")
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
// t.Log(resp)
|
||||
// }
|
||||
|
||||
// func Test_SignalingGetTokenByRoomID(t *testing.T) {
|
||||
// resp, err := open_im_sdk.UserForSDK.Signaling().SignalingGetTokenByRoomID(ctx, "testroomID")
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
// t.Log(resp)
|
||||
// }
|
||||
71
go/chao-sdk-core/testv2/sync2_test.go
Normal file
71
go/chao-sdk-core/testv2/sync2_test.go
Normal file
@@ -0,0 +1,71 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/openimsdk/openim-sdk-core/v3/open_im_sdk"
|
||||
"github.com/openimsdk/protocol/constant"
|
||||
"github.com/openimsdk/protocol/group"
|
||||
"github.com/openimsdk/protocol/sdkws"
|
||||
"github.com/openimsdk/tools/log"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestSyncFriend2(t *testing.T) {
|
||||
for i := 0; ; i++ {
|
||||
if err := open_im_sdk.UserForSDK.Friend().IncrSyncFriends(ctx); err != nil {
|
||||
t.Log("IncrSyncFriends error-->", err)
|
||||
continue
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSyncJoinGroup2(t *testing.T) {
|
||||
for i := 0; ; i++ {
|
||||
if err := open_im_sdk.UserForSDK.Group().IncrSyncJoinGroup(ctx); err != nil {
|
||||
t.Log("IncrSyncJoinGroup error-->", err)
|
||||
continue
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSyncGroupMember2(t *testing.T) {
|
||||
for i := 0; ; i++ {
|
||||
if err := open_im_sdk.UserForSDK.Group().IncrSyncJoinGroupMember(ctx); err != nil {
|
||||
t.Log("IncrSyncGroupAndMember error-->", err)
|
||||
continue
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
func TestName(t *testing.T) {
|
||||
for i := 1; i <= 600; i++ {
|
||||
_, err := open_im_sdk.UserForSDK.Group().CreateGroup(ctx, &group.CreateGroupReq{
|
||||
GroupInfo: &sdkws.GroupInfo{
|
||||
GroupType: constant.WorkingGroup,
|
||||
GroupName: fmt.Sprintf("group_%d", i),
|
||||
},
|
||||
MemberUserIDs: []string{"9556972319", "9719689061", "3872159645"},
|
||||
})
|
||||
if err != nil {
|
||||
log.ZError(ctx, "group create failed", err, "index", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
89
go/chao-sdk-core/testv2/sync_test.go
Normal file
89
go/chao-sdk-core/testv2/sync_test.go
Normal file
@@ -0,0 +1,89 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
import (
|
||||
"github.com/openimsdk/openim-sdk-core/v3/open_im_sdk"
|
||||
"testing"
|
||||
)
|
||||
|
||||
//func Test_SyncJoinGroup(t *testing.T) {
|
||||
// err := open_im_sdk.UserForSDK.Group().SyncJoinedGroup(ctx)
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
//}
|
||||
|
||||
func Test_SyncGroupMember(t *testing.T) {
|
||||
//groups, err := open_im_sdk.UserForSDK.Group().GetServerJoinGroup(ctx)
|
||||
//if err != nil {
|
||||
// t.Fatal(err)
|
||||
//}
|
||||
//for _, group := range groups {
|
||||
// err := open_im_sdk.UserForSDK.Group().SyncGroupMember(ctx, group.GroupID)
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
//func Test_SyncSelfGroupApplication(t *testing.T) {
|
||||
// err := open_im_sdk.UserForSDK.Group().SyncSelfGroupApplication(ctx)
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
//}
|
||||
|
||||
//func Test_SyncAdminGroupApplication(t *testing.T) {
|
||||
// err := open_im_sdk.UserForSDK.Group().SyncAdminGroupApplication(ctx)
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
//}
|
||||
|
||||
func Test_SyncSelfFriendApplication(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Friend().SyncAllSelfFriendApplication(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_SyncFriendApplication(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Friend().SyncAllFriendApplication(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_SyncFriend(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Friend().SyncAllFriendList(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_SyncBlack(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Friend().SyncAllBlackList(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_SyncAllConversation(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.Conversation().SyncAllConversations(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
226
go/chao-sdk-core/testv2/user_test.go
Normal file
226
go/chao-sdk-core/testv2/user_test.go
Normal file
@@ -0,0 +1,226 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package testv2
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/openimsdk/protocol/user"
|
||||
"github.com/openimsdk/protocol/wrapperspb"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/openimsdk/openim-sdk-core/v3/open_im_sdk"
|
||||
|
||||
"github.com/openimsdk/protocol/sdkws"
|
||||
)
|
||||
|
||||
func Test_GetSelfUserInfo(t *testing.T) {
|
||||
userInfo, err := open_im_sdk.UserForSDK.User().GetSelfUserInfo(ctx)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
t.Log(userInfo)
|
||||
}
|
||||
|
||||
func Test_GetUsersInfo(t *testing.T) {
|
||||
userInfo, err := open_im_sdk.UserForSDK.Full().GetUsersInfo(ctx, []string{"friendUserID"})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if userInfo[0].BlackInfo != nil {
|
||||
t.Log(userInfo[0].BlackInfo)
|
||||
}
|
||||
if userInfo[0].FriendInfo != nil {
|
||||
t.Log(userInfo[0].FriendInfo)
|
||||
}
|
||||
if userInfo[0].PublicInfo != nil {
|
||||
t.Log(userInfo[0].PublicInfo)
|
||||
}
|
||||
}
|
||||
func Test_GetUsersInfoWithCache(t *testing.T) {
|
||||
userInfo, err := open_im_sdk.UserForSDK.Full().GetUsersInfoWithCache(ctx, []string{"1"}, "")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if userInfo[0].BlackInfo != nil {
|
||||
t.Log(userInfo[0].BlackInfo)
|
||||
}
|
||||
if userInfo[0].FriendInfo != nil {
|
||||
t.Log(userInfo[0].FriendInfo)
|
||||
}
|
||||
if userInfo[0].PublicInfo != nil {
|
||||
t.Log(userInfo[0].PublicInfo)
|
||||
}
|
||||
}
|
||||
func Test_SetSelfInfo(t *testing.T) {
|
||||
newNickName := "test"
|
||||
//newFaceURL := "http://test.com"
|
||||
err := open_im_sdk.UserForSDK.User().SetSelfInfo(ctx, &sdkws.UserInfo{
|
||||
Nickname: newNickName,
|
||||
//FaceURL: newFaceURL,
|
||||
})
|
||||
newFaceURL := "http://test.com"
|
||||
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
userInfo, err := open_im_sdk.UserForSDK.User().GetSelfUserInfo(ctx)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if userInfo.UserID != UserID && userInfo.Nickname != newNickName && userInfo.FaceURL != newFaceURL {
|
||||
t.Error("user id not match")
|
||||
}
|
||||
t.Log(userInfo)
|
||||
time.Sleep(time.Second * 10)
|
||||
}
|
||||
func Test_SetSelfInfoEx(t *testing.T) {
|
||||
newNickName := "test"
|
||||
//newFaceURL := "http://test.com"
|
||||
err := open_im_sdk.UserForSDK.User().SetSelfInfoEx(ctx, &sdkws.UserInfoWithEx{
|
||||
Nickname: &wrapperspb.StringValue{
|
||||
Value: newNickName,
|
||||
},
|
||||
//FaceURL: newFaceURL,
|
||||
Ex: &wrapperspb.StringValue{
|
||||
Value: "ASD",
|
||||
},
|
||||
})
|
||||
newFaceURL := "http://test.com"
|
||||
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
userInfo, err := open_im_sdk.UserForSDK.User().GetSelfUserInfo(ctx)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if userInfo.UserID != UserID && userInfo.Nickname != newNickName && userInfo.FaceURL != newFaceURL {
|
||||
t.Error("user id not match")
|
||||
}
|
||||
t.Log(userInfo)
|
||||
time.Sleep(time.Second * 10)
|
||||
}
|
||||
|
||||
func Test_UpdateMsgSenderInfo(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.User().UpdateMsgSenderInfo(ctx, "test", "http://test.com")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
userInfo, err := open_im_sdk.UserForSDK.User().GetSelfUserInfo(ctx)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(userInfo)
|
||||
}
|
||||
|
||||
func Test_SetSetGlobalRecvMessageOpt(t *testing.T) {
|
||||
err := open_im_sdk.UserForSDK.User().SetGlobalRecvMessageOpt(ctx, 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_Sub(t *testing.T) {
|
||||
var users []string
|
||||
users = append(users, "2926672950")
|
||||
status, err := open_im_sdk.UserForSDK.User().SubscribeUsersStatus(ctx, users)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(status)
|
||||
|
||||
for i := 0; i < 20; i++ {
|
||||
status, err = open_im_sdk.UserForSDK.User().SubscribeUsersStatus(ctx, users)
|
||||
t.Log(status)
|
||||
time.Sleep(time.Second * 3)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetSubscribeUsersStatus(t *testing.T) {
|
||||
status, err := open_im_sdk.UserForSDK.User().GetSubscribeUsersStatus(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
t.Log(status)
|
||||
}
|
||||
|
||||
func Test_GetUserStatus(t *testing.T) {
|
||||
var UserIDs []string
|
||||
UserIDs = append(UserIDs, "2926672950")
|
||||
status, err := open_im_sdk.UserForSDK.User().GetUserStatus(ctx, UserIDs)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
t.Log(status)
|
||||
}
|
||||
|
||||
func Test_UnSub(t *testing.T) {
|
||||
var users []string
|
||||
users = append(users, "2926672950")
|
||||
err := open_im_sdk.UserForSDK.User().UnsubscribeUsersStatus(ctx, users)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_UserCommandAdd(t *testing.T) {
|
||||
// Creating a request with a pointer
|
||||
req := &user.ProcessUserCommandAddReq{
|
||||
UserID: "3",
|
||||
Type: 8,
|
||||
Uuid: "1",
|
||||
Value: &wrapperspb.StringValue{
|
||||
Value: "ASD",
|
||||
},
|
||||
Ex: &wrapperspb.StringValue{
|
||||
Value: "ASD",
|
||||
},
|
||||
}
|
||||
|
||||
// Passing the pointer to the function
|
||||
err := open_im_sdk.UserForSDK.User().ProcessUserCommandAdd(ctx, req)
|
||||
if err != nil {
|
||||
// Handle the error
|
||||
t.Errorf("Failed to add favorite: %v", err)
|
||||
}
|
||||
}
|
||||
func Test_UserCommandGet(t *testing.T) {
|
||||
// Creating a request with a pointer
|
||||
|
||||
// Passing the pointer to the function
|
||||
result, err := open_im_sdk.UserForSDK.User().ProcessUserCommandGetAll(ctx)
|
||||
if err != nil {
|
||||
// Handle the error
|
||||
t.Errorf("Failed to add favorite: %v", err)
|
||||
}
|
||||
fmt.Printf("%v\n", result)
|
||||
}
|
||||
func Test_UserCommandDelete(t *testing.T) {
|
||||
// Creating a request with a pointer
|
||||
req := &user.ProcessUserCommandDeleteReq{
|
||||
UserID: "3",
|
||||
Type: 8,
|
||||
Uuid: "1",
|
||||
}
|
||||
|
||||
// Passing the pointer to the function
|
||||
err := open_im_sdk.UserForSDK.User().ProcessUserCommandDelete(ctx, req)
|
||||
if err != nil {
|
||||
// Handle the error
|
||||
t.Errorf("Failed to add favorite: %v", err)
|
||||
}
|
||||
}
|
||||
43
go/chao-sdk-core/testv2/work_moment_test.go
Normal file
43
go/chao-sdk-core/testv2/work_moment_test.go
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
package testv2
|
||||
|
||||
//
|
||||
//import (
|
||||
// "open_im_sdk/open_im_sdk"
|
||||
// "testing"
|
||||
//)
|
||||
//
|
||||
//funcation Test_GetWorkMomentsUnReadCount(t *testing.T) {
|
||||
// unreadCount, err := open_im_sdk.UserForSDK.WorkMoments().GetWorkMomentsUnReadCount(ctx)
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
// t.Log(unreadCount)
|
||||
//}
|
||||
//
|
||||
//funcation Test_GetWorkMomentsNotification(t *testing.T) {
|
||||
// notifications, err := open_im_sdk.UserForSDK.WorkMoments().GetWorkMomentsNotification(ctx, 0, 10)
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
// t.Log(notifications)
|
||||
//}
|
||||
//
|
||||
//funcation Test_ClearWorkMomentsNotification(t *testing.T) {
|
||||
// err := open_im_sdk.UserForSDK.WorkMoments().ClearWorkMomentsNotification(ctx)
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user