using System;
using TradeManageNew.APIClients.FedexApi.Services;
namespace TradeManageNew.APIClients.FedexApi
{
public class FedexAPIClient
{
public FedexAPIClient(FedexCredential credential)
{
if (credential is null)
{
throw new Exception("凭证信息不能为空,请检查");
}
if (string.IsNullOrEmpty(credential.ClientId))
{
throw new Exception("ClientId不能为空,请检查");
}
if (string.IsNullOrEmpty(credential.ClientSecret))
{
throw new Exception("ClientSecret不能为空,请检查");
}
Credential = credential;
Ship = new ShipService(credential);
RatesAndTransitTimes = new RatesAndTransitTimesService(credential);
}
public readonly FedexCredential Credential;
#region Ship
///
/// 官方API文档 https://developer.fedex.com.cn/api/en-us/catalog/ship/v1/docs.html
///
public ShipService Ship { get; }
#endregion
#region RatesAndTransitTimes
///
/// 官方API文档 https://developer.fedex.com.cn/api/en-us/catalog/rate/v1/docs.html
///
public RatesAndTransitTimesService RatesAndTransitTimes { get; }
#endregion
}
}