Add Player Block
Explains how to add a specific player to the block list.
URL Verification
This API uses the service-api.playnanoo.com domain.
API Information
- URL:
https://service-api.playnanoo.com/chat/v20211101/block/add - Method:
PUT - Authentication Required: Yes
Request Parameters
The Req class inherits from DeviceInfo.
| Field | Type | Description |
|---|---|---|
| block_user_id | string | User ID to block |
| block_user_name | string | User name to block |
Response Data
Res
| Field | Type | Description |
|---|---|---|
| Status | string | Processing status |
Unity C# Implementation
using System;
using System.Collections;
using UnityEngine.Networking;
public class BlockPlayerAdd
{
static string path = "https://service-api.playnanoo.com/chat/v20211101/block/add";
[Serializable]
public class Req : DeviceInfo
{
public string block_user_id;
public string block_user_name;
public IEnumerator Send(string blockUserId, string blockUserName, Action<Res> onSuccess, Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(blockUserId)) this.block_user_id = blockUserId;
if (!string.IsNullOrEmpty(blockUserName)) this.block_user_name = blockUserName;
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public string Status;
}
}
Usage Example
using UnityEngine;
public class ChatExample : MonoBehaviour
{
public void BlockAdd()
{
string blockUserId = "CRCVTE1OMB8NPSW";
string blockUserName = "Email Verified";
BlockPlayerAdd.Req req = new BlockPlayerAdd.Req();
StartCoroutine(req.Send(
blockUserId: blockUserId,
blockUserName: blockUserName,
onSuccess: res =>
{
Debug.Log($"Status : {res.Status}");
},
onError: (error) =>
{
Debug.LogError($"BlockAdd failed: [{error.ErrorCode}] {error.Message}");
}
));
}
}