Cloud Save 客户端SDK接入指南
Cloud Save 客户端SDK接入指南
1.安装配置 UOS Launcher
参考 Launcher 教程,安装 Launcher 后,关联 UOS APP, 开启 Cloud Save 服务并安装 Cloud Save SDK。
注意: 请务必确认在进行后续教程之前,已经成功完成了 Launcher 教程的安装步骤,否则可能导致后续接入无法顺利进行。
2.初始化
初始化SDK
// 使用 UOS Launcher 方式初始化SDK, 更多SDK初始化方式见 sdk package sample 目录
try
{
await CloudSaveSDK.InitializeAsync();
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat($"failed to initialize sdk, clientEx: {e}");
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat($"failed to initialize sdk, serverEx: {e}");
throw;
}SDK鉴权
请您在使用 当前服务的SDK 之前,先确认是否需要同步启用我们的 UOS Passport 服务。
启用 UOS Passport 服务,可实现 UOS 系统账号体系打通(即多服务共用同一套 UOS Passport 账号,无需重复授权登录),简化账号管理流程。
特别注意 : UOS Passport 服务为独立计费服务,启用后将根据其专属计费规则额外计费: UOS Passport 计费规则
- 不使用 UOS Passport。 请确保在调用 当前服务的SDK 提供的方法之前 已经完成用户授权:
using Unity.UOS.Auth;
// 用户授权 (每次初始化服务SDK 需进行用户授权)
string userId = <userId>; // 需要授权的 UserId
string userName = <userName>; // 可选, 需要授权的 UserName
await AuthTokenManager.GenerateAccessToken(userId, userName);使用 UOS Passport。 请确保 已开通 UOS Passport 服务 并在调用 当前服务的SDK 提供的方法之前 用户已经完成 Passport 用户登录:
- 方式一:使用「Passport 外部账号系统接入」进行登录
- 方式二:使用「Passport Login」进行登录
3.存档集成示例
创建文档
通过字节数组创建一个文件存档
string name = <name>; // 存档名称
byte[] bytes = <bytes>; // 存档文件
CreateOptions options = <options>; // 存档选项, 非必填项
try
{
string saveId = await CloudSaveSDK.Instance.Files.CreateAsync(name, bytes, options);
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat($"failed to save file, name {0}, clientEx: {1}", name, e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat($"failed to save file, name {0}, serverEx: {1}", name, e);
throw;
}
public class CreateOptions
{
// 存档所属命名空间, 不传默认为"Default"
public string Namespace;
// 存档描述
public string Description;
// 存档模式, 不传默认为"Multi"
public ProgressType ProgressType;
// 存档属性
public Dictionary<string, string> Properties;
// 封面文件 (可选)
public FileOptions Cover;
}
public class FileOptions
{
// 更新文件方式,默认为Unknown, 代表不更新文件
public UpdateFileWay UpdateFileWay;
// 更新文件方式为 ByFilepath 时,需填写该项 (不支持WebGL平台)
public string Filepath;
// 更新文件方式为 ByFileStream 时,需填写该项
public Stream FileStream;
// 更新文件方式为 ByFileBytes 时,需填写该项
public byte[] FileBytes;
}查看信息
查看指定存档元数据信息
string saveId = <saveId>;
try
{
SaveItem saveItem = await CloudSaveSDK.Instance.Files.GetMetadataAsync(saveId);
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat("failed to get file metadata, id {0}, clientEx: {1}", saveId, e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat("failed to get file metadata, id {0}, serverEx: {1}", saveId, e);
throw;
}
public class SaveItem
{
// 存档Id
public string SaveId;
// 用户Id
public string UserId;
// 角色Id
public string PersonaId;
// 存档所属命名空间
public string Namespace;
// 存档文件大小
public long? Size;
// 存档名称
public string Name;
// 存档描述
public string Description;
// 存档属性
public Dictionary<string, string> Properties;
// 存档创建时间
public DateTime CreatedAt;
// 存档修改时间
public DateTime? ModifiedAt;
// 存档封面
public byte[] Cover;
// 存档模式
public ProgressType ProgressType;
// 存档文件下载地址
public string FileDownloadURL;
}获取存档文件内容
string saveId = <saveId>;
try
{
byte[] bytes = await CloudSaveSDK.Instance.Files.LoadBytesAsync(saveId);
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat("failed to load file, id {0}, clientEx: {1}", saveId, e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat("failed to load file, id {0}, serverEx: {1}", saveId, e);
throw;
}更新存档
string saveId = <id>; // 存档Id
UpdateOptions options = <options>; // 更新存档选项,可以通过该方法更新存档文件,也可以仅更新存档配置
try
{
await CloudSaveSDK.Instance.Files.UpdateAsync(id, options);
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat("failed to update file, id {0}, clientEx: {1}", saveId, e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat("failed to update file, id {0}, serverEx: {1}", saveId, e);
throw;
}
public class UpdateOptions
{
// 存档名称
public string Name;
// 存档描述
public string Description;
// 存档属性
public Dictionary<string, string> Properties;
// 存档文件 (可选)
public FileOptions File;
// 封面文件 (可选)
public FileOptions Cover;
}
public class FileOptions
{
// 更新文件方式,默认为Unknown,代表不更新文件
public UpdateFileWay UpdateFileWay;
// 更新文件方式为 ByFilepath 时,需填写该项 (不支持WebGL平台)
public string Filepath;
// 更新文件方式为 ByFileStream 时,需填写该项
public Stream FileStream;
// 更新文件方式为 ByFileBytes 时,需填写该项
public byte[] FileBytes;
}删除存档
try
{
string saveId = <saveId>;
await CloudSaveSDK.Instance.Files.DeleteAsync(saveId);
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat("failed to delete file, id {0}, clientEx: {1}", saveId, e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat("failed to delete file, id {0}, serverEx: {1}", saveId, e);
throw;
}列出所有存档
列出所有存档元数据信息
try
{
ListOptions options = <options>; // list选项, 非必填项
// CloudSaveSDK.Instance 包含了用户的 userId 信息
// ListAllAsync 会根据 options 列出该用户的存档,按时间倒序排列,最新的存档在前
List<SaveItem> saveItems = await CloudSaveSDK.Instance.Files.ListAllAsync(options);
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat("failed to list files metadata, clientEx: {0}", e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat("failed to list files metadata, serverEx: {0}", e);
throw;
}
public class ListOptions
{
// 存档所属命名空间列表
public List<string> Namespaces;
// 角色Id
public string PersonaId;
// 存档类型, 不传代表 list 所有
public ProgressType ProgressType;
}查看单存档
查看单存档元数据信息
// 获取指定命名空间和角色下单存档的元数据信息,为空表示该角色在此命名空间下无单存档
string targetNamespace = <targetNamespace>; // 存档的命名空间
try
{
SaveItem saveItem = await CloudSaveSDK.Instance.Files.GetLinearAsync(targetNamespace);
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat("failed to get metadata of linear save, clientEx: {0}", e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat("failed to get metadata of linear save, serverEx: {0}", e);
throw;
}保存单存档
// 对指定命名空间和角色下的单存档进行存档操作。若之前无单存档,会创建一个新的单存档。成功后返回存档Id
string targetNamespace = <targetNamespace>; // 存档的命名空间
UpdateOptions options = <options>; // 存档选项
try
{
string saveId = await CloudSaveSDK.Instance.Files.SaveLinearAsync(targetNamespace, options);
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat("failed to create or update linear save, clientEx: {0}", e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat("failed to create or update linear save, serverEx: {0}", e);
throw;
}4.头像集成示例
上传头像
// 可通过字节数组、文件流、文件路径方式上传头像
byte[] bytes = <bytes>; // 头像文件
Stream stream = <stream>; // 头像文件流
string path = <path>; // 头像文件路径 (此方式不支持WebGL平台)
ProfilePictureFormat format = <format>; // 头像文件的格式,支持 JPEG, JPG, PNG, GIF, SVG 等格式
try
{
// 通过字节数组上传头像
SavePFPResponse res = await CloudSaveSDK.Instance.Files.SaveProfilePictureAsync(bytes, format);
// 还可以通过文件流、文件路径方式上传头像,其中文件路径方式上传头像不支持 WebGL 平台
// await CloudSaveSDK.Instance.Files.SaveProfilePictureAsync(stream, format);
// await CloudSaveSDK.Instance.Files.SaveProfilePictureAsync(path, format);
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat(
"failed to save user's profile picture, format {0}, clientEx: {1}", format, e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat(
"failed to save user's profile picture, format {0}, serverEx: {1}", format, e);
throw;
}
public class SavePFPOptions
{
// 角色Id
public string PersonaId;
}
public class SavePFPResponse
{
// 头像Id
public string PfpId;
// 头像链接
public string DownloadUrl;
}
public enum ProfilePictureFormat
{
// 头像文件的可选格式,包括 JPEG, JPG, PNG, GIF, SVG 等格式
Jpeg = 1,
Jpg = 2,
Png = 3,
Gif = 4,
Svg = 5
}获取头像
try
{
// 用户可通过获取到的头像信息 (PFPItem) 中的下载链接 (DownloadUrl) 下载头像。如果用户没有头像信息,返回结果中将不包含头像id (PFPId) 和下载链接 (DownloadUrl)
PFPItem profilePicture = await CloudSaveSDK.Instance.Files.GetProfilePictureAsync();
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat("failed to get user's profile picture, clientEx: {0}", e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat("failed to get user's profile picture, serverEx: {0}", e);
throw;
}
public class PFPItem
{
// 头像Id
public string PfpId;
// 是否为默认头像
public bool IsDefaultPfp;
// 用户Id
public string UserId;
// 角色Id
public string PersonaId;
// 头像格式
public string Format;
// 头像大小
public int Size;
// 下载链接
public string DownloadUrl;
// 头像创建时间
public DateTime? CreatedAt;
// 头像创建者
public string CreatedBy;
// 头像更新时间
public DateTime? ModifiedAt;
// 头像更新者
public string ModifiedBy;
// 默认头像使用人数
public int? ActivePlayers;
}删除头像
try
{
await CloudSaveSDK.Instance.Files.DeleteProfilePicturesAsync();
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat("failed to delete user's profile picture, clientEx: {0}", e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat("failed to delete user's profile picture, serverEx: {0}", e);
throw;
}列出选定用户的头像信息
List<Player> players = <players> // 指定需要查看的用户列表。用户Id (UserId) 不可为空;如果需要查看指定角色Id (PersonaId) 下的头像需要同时填写用户Id和角色Id
try
{
// 如果以用户Id和角色Id标识的头像不存在,则返回空列表
List<PFPItem> profilePictures = await CloudSaveSDK.Instance.Files.ListProfilePicturesAsync(players);
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat("failed to list profile pictures, clientEx: {0}", e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat("failed to list profile pictures, serverEx: {0}", e);
throw;
}
public class Player
{
// 用户Id
public string UserId;
// 角色Id
public string PersonaId;
}列出开发者设置的默认头像
// 如果开发者未上传默认头像,将返回空列表
try
{
List<PFPItem> profilePictures = await CloudSaveSDK.Instance.Files.ListDefaultProfilePicturesAsync();
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat("failed to list default profile pictures, clientEx: {0}", e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat("failed to list default profile pictures, serverEx: {0}", e);
throw;
}选择默认头像作为头像
// 选择默认头像作为用户头像 (仅在开发者配置成功默认头像后生效,开发者可以通过“用户头像”界面或使用服务端API上传默认头像)
string id = <id>; // 用户选择的默认头像id
try
{
await CloudSaveSDK.Instance.Files.SaveProfilePictureByIdAsync(id, options);
}
catch (CloudSaveClientException e)
{
Debug.LogErrorFormat(
"failed to save user's profile picture by default picture, id {0}, clientEx: {1}", id, e);
throw;
}
catch (CloudSaveServerException e)
{
Debug.LogErrorFormat(
"failed to save user's profile picture by default picture, id {0}, serverEx: {1}", id, e);
throw;
}附录
文件存档核心类&接口
public interface IFilesService
{
/// <summary>
/// 通过文件流创建一个存档
/// </summary>
/// <param name="name">存档名称</param>
/// <param name="stream">文件流</param>
/// <param name="options">存档选项(存档描述,封面路径等信息)</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败,文件路径不存在,文件过大等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 存档Id</returns>
Task<string> CreateAsync(string name, Stream stream, CreateOptions options = null);
/// <summary>
/// 通过字节数组创建一个存档
/// </summary>
/// <param name="name">存档名称</param>
/// <param name="bytes">文件字节数组</param>
/// <param name="options">存档选项(存档描述,封面路径等信息)</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败,文件路径不存在,文件过大等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 存档Id</returns>
Task<string> CreateAsync(string name, byte[] bytes, CreateOptions options = null);
/// <summary>
/// 通过本地文件路径创建一个存档
/// </summary>
/// <param name="name">存档名称</param>
/// <param name="filePath">本地文件路径</param>
/// <param name="options">存档选项(存档描述,封面路径等信息)</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败,文件路径不存在,文件过大等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 存档Id</returns>
Task<string> CreateAsync(string name, string filePath, CreateOptions options = null);
/// <summary>
/// 获取指定存档Id的元数据信息(包括存档名称,描述,封面等信息)
/// </summary>
/// <param name="saveId">存档Id</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败,saveId不存在等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 存档信息</returns>
Task<SaveItem> GetMetadataAsync(string saveId);
/// <summary>
/// 获取指定命名空间下单存档的元数据信息(包括存档名称,描述,封面等信息),为空表示角色在此命名空间下无单存档
/// </summary>
/// <param name="targetNamespace">存档的命名空间</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如命名空间为空等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
Task<SaveItem> GetLinearAsync(string targetNamespace);
/// <summary>
/// 对指定命名空间下的单存档进行存档操作(包括存档名称、描述、属性、存档文件等)。若之前无单存档,会创建一个新的单存档。成功后返回存档Id
/// </summary>
/// <param name="targetNamespace">存档的命名空间</param>
/// <param name="options">存档选项(存档名称,描述,存档属性,存档文件等信息)</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败,文件路径不存在,文件过大等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
Task<string> SaveLinearAsync(string targetNamespace, UpdateOptions options);
/// <summary>
/// 获取指定命名空间下所有多存档的元数据信息(包括存档名称,描述,封面等信息)
/// </summary>
/// <param name="targetNamespace">存档的命名空间</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如targetNamespace为空等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
Task<List<SaveItem>> GetMultiAsync(string targetNamespace);
/// <summary>
/// 获取存档文件
/// </summary>
/// <param name="saveId">存档Id</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败,saveId不存在等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 文件流</returns>
Task<Stream> LoadStreamAsync(string saveId);
/// <summary>
/// 获取存档文件
/// </summary>
/// <param name="saveId">存档Id</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败,saveId不存在等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 文件字节数组</returns>
Task<byte[]> LoadBytesAsync(string saveId);
/// <summary>
/// 更新指定存档,可以仅更新存档名称,描述,存档属性等信息,亦可以更新存档文件
/// </summary>
/// <param name="saveId">存档Id</param>
/// <param name="options">存档选项(存档名称,描述,存档属性,存档文件等信息)</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败,文件路径不存在,文件过大等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
Task UpdateAsync(string saveId, UpdateOptions options = null);
/// <summary>
/// 删除一个存档
/// </summary>
/// <param name="saveId">存档Id</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败,saveId不存在等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
Task DeleteAsync(string saveId);
/// <summary>
/// 获取所有存档的元数据信息
/// </summary>
/// <param name="options">list选项,可列出指定personaId, 进度类型或是namespace下的存档</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 存档列表</returns>
Task<List<SaveItem>> ListAllAsync(ListOptions options = null);
}头像相关核心类&接口
public interface IFilesService
{
/// <summary>
/// 通过头像Id选取一个默认头像,保存为玩家头像
/// </summary>
/// <param name="id">PFP Id</param>
/// <param name="options">存档选项(personaId等)</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 头像Id</returns>
Task<string> SaveProfilePictureByIdAsync(string id, SavePFPOptions options = null);
/// <summary>
/// 通过字节数组上传一张图片作为玩家头像
/// </summary>
/// <param name="bytes"></param>字节数组
/// <param name="format"></param>图片格式
/// <param name="options">存档选项(personaId等)</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败,文件路径不存在,文件过大等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 头像Id</returns>
Task<string> SaveProfilePictureAsync(byte[] bytes, ProfilePictureFormat format, SavePFPOptions options = null);
/// <summary>
/// 通过文件流上传一张图片作为玩家头像
/// </summary>
/// <param name="stream"></param>文件流
/// <param name="format"></param>图片格式
/// <param name="options">存档选项(personaId等)</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败,文件路径不存在,文件过大等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 头像Id</returns>
Task<string> SaveProfilePictureAsync(Stream stream, ProfilePictureFormat format, SavePFPOptions options = null);
/// <summary>
/// 通过本地文件路径上传一张图片作为玩家头像
/// </summary>
/// <param name="path"></param>文件本地路径
/// <param name="format"></param>图片格式
/// <param name="options">存档选项(personaId等)</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败,文件路径不存在,文件过大等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 头像Id</returns>
Task<string> SaveProfilePictureAsync(string path, ProfilePictureFormat format, SavePFPOptions options = null);
/// <summary>
/// 获取玩家头像信息
/// </summary>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 头像信息</returns>
Task<PFPItem> GetProfilePictureAsync();
/// <summary>
/// 列出默认头像信息的列表
/// </summary>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 头像列表</returns>
Task<List<PFPItem>> ListDefaultProfilePicturesAsync();
/// <summary>
/// 列出选定玩家的头像信息的列表
/// </summary>
/// <param name="players">玩家列表</param>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
/// <returns> 头像列表</returns>
Task<List<PFPItem>> ListProfilePicturesAsync(List<Player> players);
/// <summary>
/// 删除玩家头像
/// </summary>
/// <exception cref="CloudSaveClientException">抛出该异常时代表用户端传参错误导致调用api失败,比如认证失败等情况.</exception>
/// <exception cref="CloudSaveServerException">抛出该异常时代表服务端异常,可稍后重试或联系我们</exception>
Task DeleteProfilePicturesAsync();
}异常类
//抛出该异常时代表客户端错误,如认证失败,参数无效,文件大小超出限制等情况,详细错误信息可查看 exception message
public class CloudSaveClientException : CloudSaveException
{
public CloudSaveClientException(int errorCode, string message, System.Exception innerException) :
base(errorCode, message, innerException)
{
}
}
//抛出该异常时代表服务端异常,可稍后重试或联系我们
public class CloudSaveServerException : CloudSaveException
{
public CloudSaveServerException(int errorCode, string message, System.Exception innerException) :
base(errorCode, message, innerException)
{
}
}更多示例
更多 SDK 使用示例参见 SDK Package Sample 目录