You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 官方API文档 https://developer.fedex.com.cn/api/en-us/catalog/ship/v1/docs.html
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ShipService Ship { get; }
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region RatesAndTransitTimes
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 官方API文档 https://developer.fedex.com.cn/api/en-us/catalog/rate/v1/docs.html
|
|
|
|
|
/// </summary>
|
|
|
|
|
public RatesAndTransitTimesService RatesAndTransitTimes { get; }
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|