当前位置: 首页>>代码示例>>C#>>正文


C# HttpClient.TrackConsignmentsAsync方法代码示例

本文整理汇总了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;
        }
开发者ID:alexander-yushchenko,项目名称:ExpressConnect,代码行数:30,代码来源:Program.cs

示例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;
        }
开发者ID:alexander-yushchenko,项目名称:ExpressConnect,代码行数:36,代码来源:Program.cs

示例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;
        }
开发者ID:alexander-yushchenko,项目名称:ExpressConnect,代码行数:29,代码来源:Program.cs


注:本文中的System.Net.Http.HttpClient.TrackConsignmentsAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。