本文整理汇总了C#中System.Net.Http.HttpClient.TrackConsignmentsAsync方法的典型用法代码示例。如果您正苦于以下问题:C# HttpClient.TrackConsignmentsAsync方法的具体用法?C# HttpClient.TrackConsignmentsAsync怎么用?C# HttpClient.TrackConsignmentsAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Http.HttpClient
的用法示例。
在下文中一共展示了HttpClient.TrackConsignmentsAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TrackByCustomerReferences
private static async void TrackByCustomerReferences()
{
var credentials = new TrackCredentials
{
UserName = TntTestUserName,
Password = TntTestPassword
};
var httpClient = new HttpClient();
var references = new List<string>
{
"test1", "test2"
};
var request = new CustomerReferenceCompleteTrackRequest(credentials, references)
{
OriginCountry = "UA",
MarketType = MarketType.International,
Locale = "RU"
};
Console.WriteLine("Customer references tracking. Request string:\n\n{0}\n\n", request);
var result = await httpClient.TrackConsignmentsAsync(TntTrackingUriString, request);
var statusCode = result.StatusCode;
var exception = result.Exception;
var consignments = result.Consignments;
}
示例2: TrackByConsignmentNumbers
private static async void TrackByConsignmentNumbers()
{
var credentials = new TrackCredentials
{
UserName = TntTestUserName,
Password = TntTestPassword
};
var httpClient = new HttpClient();
var consignmentNumbers = new List<string>
{
"123456785"
};
var request = new ConsignmentNumberCompleteTrackRequest(credentials, consignmentNumbers)
{
OriginCountry = "UA",
MarketType = MarketType.International,
Locale = "RU"
};
request.ExtraDetails.Add(ExtraDetail.OriginAddress);
request.ExtraDetails.Add(ExtraDetail.DestinationAddress);
request.ExtraDetails.Add(ExtraDetail.Shipment);
request.ExtraDetails.Add(ExtraDetail.Package);
request.ExtraDetails.Add(ExtraDetail.PodImage);
Console.WriteLine("Consignment numbers tracking. Request string:\n\n{0}\n\n", request);
var result = await httpClient.TrackConsignmentsAsync(TntTrackingUriString, request);
var statusCode = result.StatusCode;
var exception = result.Exception;
var consignments = result.Consignments;
}
示例3: TrackByAccount
private static async void TrackByAccount()
{
var credentials = new TrackCredentials
{
UserName = TntTestUserName,
Password = TntTestPassword,
Account = new Account
{
Number = "1",
CountryCode = "UA"
}
};
var httpClient = new HttpClient();
var request = new AccountCompleteTrackRequest(credentials: credentials, dateFrom: DateTime.Today.AddDays(-14), numberOfDays: 3)
{
OriginCountry = "UA",
MarketType = MarketType.Domestic
};
Console.WriteLine("Account tracking. Request string:\n\n{0}\n\n", request);
var result = await httpClient.TrackConsignmentsAsync(TntTrackingUriString, request);
var statusCode = result.StatusCode;
var exception = result.Exception;
var consignments = result.Consignments;
}