コンテンツにスキップ

ユーザー

ユーザー参加チャンネルのお問い合わせ

アプリユーザーが参加したチャンネルのリストを取得するには、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) {
            // チャンネルを取得
        }
    }
});
#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) {
            // チャンネルを取得
        }
    }
});
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 {
                // チャンネルを取得
            }
        }
    }
})
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 ブロックされたユーザーのPlayerID 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
        }
    }
});
#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
    }
});
#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
    }
}];