2020-02-19 18:50:51 +08:00
|
|
|
|
using System;
|
2020-02-24 17:50:31 +08:00
|
|
|
|
using LeanCloud.Storage;
|
2020-02-19 18:50:51 +08:00
|
|
|
|
using LeanCloud.Storage.Internal.Http;
|
|
|
|
|
|
|
|
|
|
namespace LeanCloud {
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// LeanCloud 全局接口
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class LeanCloud {
|
|
|
|
|
// SDK 版本号,用于 User-Agent 统计
|
2020-03-04 16:41:24 +08:00
|
|
|
|
internal const string SDKVersion = "0.2.0";
|
2020-02-19 18:50:51 +08:00
|
|
|
|
|
|
|
|
|
// 接口版本号,用于接口版本管理
|
|
|
|
|
internal const string APIVersion = "1.1";
|
|
|
|
|
|
|
|
|
|
public static bool UseProduction {
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static LCHttpClient HttpClient {
|
|
|
|
|
get; private set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void Initialize(string appId, string appKey, string server = null) {
|
|
|
|
|
if (string.IsNullOrEmpty(appId)) {
|
|
|
|
|
throw new ArgumentException(nameof(appId));
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(appKey)) {
|
|
|
|
|
throw new ArgumentException(nameof(appKey));
|
|
|
|
|
}
|
2020-02-24 17:50:31 +08:00
|
|
|
|
// 注册 LeanCloud 内部子类化类型
|
2020-02-26 11:16:21 +08:00
|
|
|
|
LCObject.RegisterSubclass<LCUser>(LCUser.CLASS_NAME, () => new LCUser());
|
|
|
|
|
LCObject.RegisterSubclass<LCRole>(LCRole.CLASS_NAME, () => new LCRole());
|
|
|
|
|
LCObject.RegisterSubclass<LCFile>(LCFile.CLASS_NAME, () => new LCFile());
|
2020-02-19 18:50:51 +08:00
|
|
|
|
|
|
|
|
|
HttpClient = new LCHttpClient(appId, appKey, server, SDKVersion, APIVersion);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|