更新框架
This commit is contained in:
1 parent
ef50fa0620
commit
84b28f9672
72 files changed
+2222
-282
No files matched your search
@@ -0,0 +1,29 @@
|
||||
using Store.Management.Api.Authentication;
|
||||
using Store.Management.Api.Transport;
|
||||
using Store.Management.Api.Users;
|
||||
|
||||
namespace Store.Management.Api;
|
||||
|
||||
/// <summary>一个服务地址与一个用户会话对应一个实例;在应用容器中注册为单例。</summary>
|
||||
public sealed class StoreApiClient : IDisposable
|
||||
{
|
||||
public TokenSession Session { get; } = new();
|
||||
public ApiTransport Transport { get; }
|
||||
public IAuthApi Auth { get; }
|
||||
public IUserApi Users { get; }
|
||||
|
||||
/// <param name="httpClient">可选的外部 HTTP 客户端,由调用方管理其生命周期。</param>
|
||||
public StoreApiClient(ApiClientOptions options, HttpClient? httpClient = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(options);
|
||||
Transport = new ApiTransport(options, Session, httpClient);
|
||||
Auth = new AuthApi(Transport, Session);
|
||||
Users = new UserApi(Transport);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Session.Clear();
|
||||
Transport.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user