跳转至

用户

用户参与渠道查询

要检索应用用户参与的频道列表,请调用Chat类的getChannelsByUser()方法。

Channel对象作为响应传递,结构如下。

渠道

字段名称 描述 类型
channelId 频道 ID 字符串
type 频道类型 (PRIVATE, PUBLIC, GROUP) 枚举
owner 频道拥有者的 Hive PlayerID 字符串
channelName 频道名称 字符串
maxMemberCount 频道参与者的最大数量 整数
regTime 频道创建日期和时间(基于 UTC+0,格式为 yyyy-MM-dd'T'HH:mm:ss.SSSZ 字符串

这是一个示例代码,用于检索用户参与的频道列表。

using hive;

Chat.getChannelsByUser((ResultAPI result, List<Channel> channels) => {
    if (result.isSuccess()) {
        foreach (Channel channel in channels) {
            // Retrieve Channel
        }
    }
});
#include "HiveChat.h"
FHiveChat::GetChannelsByUser(FHiveChatOnGetChannelsByUserDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TArray<FHiveChannel>& channels) {
    if (Result.IsSuccess) {
        for (const FHiveChannel& channel : channels) {
            // Retrieve Channel
        }
    }
}));
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;

Chat::getChannelsByUser([=](ResultAPI const & result, std::vector<Channel> channels) {
    if (result.isSuccess()) {
        for (Chat::Channel channel : channels) {
            // Retrieve Channel
        }
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

Chat.getChannelsByUser(object: Chat.GetChannelsByUserListener{
    override fun onResult(result: ResultAPI, channels: ArrayList<Chat.Channel>) {
        if (result.isSuccess) {
            channels.forEach {
                // Retrieve Channel
            }
        }
    }
})
import com.hive.Chat;

Chat.getChannelsByUser((result, channels) -> {
    if (result.isSuccess()) {
        for (Chat.Channel channel : channels) {
            // Retrieve Channel
        }
    }
});
import HIVEService

ChatInterface.getChannelsByUser { result, channels in
    if result.isSuccess {
        channels.forEach {
                // Retrieve Channel
            }
    }
}
#import "HIVEService.h"

[HiveChat getChannelsByUserWithHandler:^(HIVEResultAPI * result, NSArray<HiveChatChannelContent *> * channels) {
    if (result.isSuccess) {
        for (HiveChatChannelContent *channel in channels) {
            // Retrieve Channel
        }
    }
}];

用户黑名单查询

要查看应用用户阻止的成员列表,请调用Chat类的getBlockMembers()方法。

响应将包括一个 BlockMember 对象,结构如下。

阻止成员

字段名称 描述 类型
playerId 被阻止用户的玩家ID long
blockedTime 被阻止时间(基于 UTC+0,格式 yyyy-MM-dd'T'HH:mm:ss.SSSZ string

以下是一个示例代码,用于检索被用户阻止的成员列表。

using hive;

Chat.getBlockMembers((ResultAPI result, List<BlockMember> blockMembers) => {
    if (result.isSuccess()) {
        foreach (BlockMember blockMember in blockMembers) {
            // Retrieve BlockMember
        }
    }
});
FHiveChat::GetBlockMembers(FHiveChatOnGetBlockMembersDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TArray<FHiveBlockMember>& blockMembers) {
    if (Result.IsSuccess) {
        for (const FHiveBlockMember& blockMember : blockMembers) {
            // Retrieve BlockMember
        }
    }
}));
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;

Chat::getBlockMembers([=](ResultAPI const & result, std::vector<BlockMember> blockMembers) {
    if (result.isSuccess()) {
        for (Chat::BlockMember blockMember : blockMembers) {
            // Retrieve BlockMember
        }
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

Chat.getBlockMembers(object: Chat.GetBlockMembersListener{
    override fun onResult(result: ResultAPI, blockMembers: ArrayList<Chat.BlockMember>) {
        if (result.isSuccess) {
            blockMembers.forEach {
                // Retrieve BlockMember
            }
        }
    }
})
import com.hive.Chat;

Chat.getBlockMembers((result, blockMembers) -> {
    if (result.isSuccess()) {
        for (Chat.BlockMember blockMember : blockMembers) {
            // Retrieve BlockMember
        }
    }
});
import HIVEService

ChatInterface.getBlockMembers { result, blockMembers in
    if result.isSuccess {
        blockMembers.forEach {
            // Retrieve BlockMember
        }
    }
}
#import "HIVEService.h"

[HiveChat getBlockMembersWithHandler:^(HIVEResultAPI * result, NSArray<HiveChatBlockMember *> * blockMembers) {
    if (result.isSuccess) {
        for (HiveChatBlockMember* blockMember in blockMembers) {
            // Retrieve BlockMember
        }
    }
}];

用户块

要阻止特定成员,应用程序用户调用Chat类的blockMember()方法。

以下是一个用户阻止特定成员的示例代码。

using hive;

Int64 blockPlayerId = 12345678;
Chat.blockMember(blockPlayerId, (ResultAPI result) => {
    if (result.isSuccess()) {
        // API Call Success
    }
});
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;

int64_t blockPlayerId = 12345678;
Chat::blockMember(blockPlayerId, [=](ResultAPI const & result) {
    if (result.isSuccess()) {
        // API Call Success
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

val blockPlayerId = 12345678L
Chat.blockMember(blockPlayerId, object : Chat.BlockMemberListener {
    override fun onResult(result: ResultAPI) {
        if (result.isSuccess) {
            // API Call Success
        }
    }
})
import com.hive.Chat;

long blockPlayerId = 12345678;
Chat.blockMember(blockPlayerId, result -> {
    if (result.isSuccess()) {
        // API Call Success
    }
});
import HIVEService

let blockPlayerId: Int64 = 12345678
ChatInterface.blockMember(blockPlayerId: blockPlayerId) { result in
    if result.isSuccess {
        // API Call Success
    }
}
#import "HIVEService.h"

int64_t blockPlayerId = 12345678;
[HiveChat blockMemberWithBlockPlayerId:blockPlayerId handler:^(HIVEResultAPI * result) {
    if (result.isSuccess) {
        // API Call Success
    }
}];

解锁用户

要解除对成员的封锁,请调用Chat类的unblockMember()方法。

以下是用户解锁成员的示例代码。

using hive;

Int64 blockedPlayerId = 12345678;
Chat.unblockMember(blockedPlayerId, (ResultAPI result) => {
    if (result.isSuccess()) {
        // API Call Success
    }
});

```cpp

include "HiveChat.h"

int64 blockedPlayerId = 12345678; FHiveChat::UnblockMember(blockedPlayerId, FHiveChatOnResultDelegate::CreateLambda(this { if (Result.IsSuccess) { // API Call Success } })); ```

#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;

int64_t blockedPlayerId = 12345678;
Chat::unblockMember(blockPlayerId, [=](ResultAPI const & result) {
    if (result.isSuccess()) {
        // API Call Success
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

val blockedPlayerId = 12345678L
Chat.unblockMember(blockedPlayerId, object : Chat.UnblockMemberListener {
    override fun onResult(result: ResultAPI) {
        if (result.isSuccess) {
            // API Call Success
        }
    }
})
import com.hive.Chat;

long blockedPlayerId = 12345678;
Chat.unblockMember(blockedPlayerId, result -> {
    if (result.isSuccess()) {
        // API Call Success
    }
});
import HIVEService

let blockedPlayerId: Int64 = 12345678
ChatInterface.unblockMember(blockedPlayerId: blockedPlayerId) { result in
    if result.isSuccess {
        // API Call Success
    }
}
#import "HIVEService.h"

int64_t blockedPlayerId = 12345678;
[HiveChat unblockMemberWithBlockPlayerId:blockedPlayerId handler:^(HIVEResultAPI * result) {
    if (result.isSuccess) {
        // API Call Success
    }
}];