Files
5.24BuYu/Assets/MyGame/Scripts/Net/APIRequestList_Customer.cs
T

126 lines
4.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Assets.MyGame.Scripts.Net.API;
using Assets.MyGame.Scripts.Net.APIRequest.Objs;
using Assets.MyGame.Scripts.Net.APIRequest.Params;
using Assets.MyGame.Scripts.Net.APIResponses.Customer_SubClass;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
namespace Assets.MyGame.Scripts.Net
{
public static partial class APIRequestList
{
#region Customer
/// <summary>
/// 发起会话(POST)
/// 参数:userId、userName
/// 返回:ConversationInfo(会话信息)
/// </summary>
public static void StartConversation(StartConversationObj req, Action<ConversationInfo> callback)
{
APIManager.Response<ConversationInfo>(APIType.Customer_Start, req, callback);
}
/// <summary>
/// 发送消息(POST)
/// 参数:conversationId、senderType、senderId、senderName、senderAvatar、contentType、content
/// 返回:CustomerMessageInfo(消息信息)
/// </summary>
public static void SendMessage(SendMessageObj req, Action<CustomerMessageInfo> callback)
{
APIManager.Response<CustomerMessageInfo>(APIType.Customer_Message, req, callback);
}
/// <summary>
/// 获取消息列表(GET)
/// 参数:conversationId
/// 返回:List<CustomerMessageInfo>(消息列表)
/// </summary>
public static void GetMessages(string conversationId, Action<List<CustomerMessageInfo>> callback)
{
APIManager.Response<List<CustomerMessageInfo>>(APIType.Customer_Messages, new GetMessagesParam
{
conversationId = conversationId
}, callback);
}
/// <summary>
/// 获取会话列表(GET)
/// 参数:customerId(可选)
/// 返回:List<ConversationInfo>(会话列表)
/// </summary>
public static void GetConversations(Action<List<ConversationInfo>> callback)
{
APIManager.Response<List<ConversationInfo>>(APIType.Customer_Conversations, callback);
}
/// <summary>
/// 获取会话列表(GET,带客服ID筛选)
/// 参数:customerId
/// 返回:List<ConversationInfo>(会话列表)
/// </summary>
public static void GetConversations(string customerId, Action<List<ConversationInfo>> callback)
{
APIManager.Response<List<ConversationInfo>>(APIType.Customer_Conversations, new GetConversationsParam
{
customerId = customerId
}, callback);
}
/// <summary>
/// 结束会话(POST)
/// 参数:conversationId
/// 返回:string(结果提示)
/// </summary>
public static void EndConversation(EndConversationObj req, Action<JObject> callback)
{
APIManager.Response<JObject>(APIType.Customer_End, req, callback);
}
/// <summary>
/// 获取在线客服列表(GET)
/// 返回:List<CustomerOnlineInfo>(在线客服列表)
/// </summary>
public static void GetOnlineCustomers(Action<List<CustomerOnlineInfo>> callback)
{
APIManager.Response<List<CustomerOnlineInfo>>(APIType.Customer_Online, callback);
}
/// <summary>
/// 更新客服状态(POST)
/// 参数:userId、status(0:离线 1:在线)
/// 返回:string(结果提示)
/// </summary>
public static void UpdateCustomerStatus(UpdateCustomerStatusObj req, Action<JObject> callback)
{
APIManager.Response<JObject>(APIType.Customer_Status, req, callback);
}
/// <summary>
/// 获取聊天记录(GET)
/// 参数:conversationId
/// 返回:List<CustomerMessageInfo>(聊天记录列表)
/// </summary>
public static void GetChatLog(string conversationId, Action<List<CustomerMessageInfo>> callback)
{
APIManager.Response<List<CustomerMessageInfo>>(APIType.Customer_ChatLog, new GetMessagesParam
{
conversationId = conversationId
}, callback);
}
/// <summary>
/// 上传客服图片(POST,multipart/form-data)
/// 参数:file(文件二进制)
/// 返回:string(图片URL)
/// </summary>
public static void UploadCustomerImage(string filePath, Action<JObject> callback)
{
APIManager.Response<JObject>(APIType.ImageUpload_Upload, callback);
}
#endregion
}
}