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


C# IRestRequest.AddParameter方法代码示例

本文整理汇总了C#中IRestRequest.AddParameter方法的典型用法代码示例。如果您正苦于以下问题:C# IRestRequest.AddParameter方法的具体用法?C# IRestRequest.AddParameter怎么用?C# IRestRequest.AddParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRestRequest的用法示例。


在下文中一共展示了IRestRequest.AddParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HttpRequest

        private CustomResponse HttpRequest(IRestRequest request, string url, Dictionary<string, string> parameters = null)
        {
            try
            {
                IRestClient client = new RestClient();
                IRestResponse response = new RestResponse();

                client.BaseUrl = new Uri(url);
                if (parameters != null)
                {
                    foreach (var item in parameters)
                    {
                        request.AddParameter(item.Key, item.Value);
                    }
                }
                response = client.Execute(request);
                var myResponse = new CustomResponse();
                myResponse.StatusCode = response.StatusCode;
                myResponse.Content = response.Content;
                return myResponse;
            }
            catch(Exception ex)
            {
                throw ex;
            }
            
        }
开发者ID:sudeshgutta,项目名称:SingleFuncRest,代码行数:27,代码来源:RestServices.cs

示例2: AddFilter

        public override void AddFilter(IRestRequest request)
        {
            base.AddFilter(request);

            if (MinimumId != null)
            {
                request.AddParameter("min_id", MinimumId, ParameterType.GetOrPost);
            }
            if (MaximumId != null)
            {
                request.AddParameter("max_id", MaximumId, ParameterType.GetOrPost);
            }
            if (Name != null)
            {
                request.AddParameter("name", Name, ParameterType.GetOrPost);
            }
            if (ParentId != null)
            {
                request.AddParameter("parent_id", ParentId, ParameterType.GetOrPost);
            }
            if (IsVisible != null)
            {
                request.AddParameter("is_visible", IsVisible, ParameterType.GetOrPost);
            }
        }
开发者ID:NeilJRyder,项目名称:BigCommerce4Net,代码行数:25,代码来源:FilterCategories.cs

示例3: AddFilter

        public override void AddFilter(IRestRequest request) {
            base.AddFilter(request);

            if (StateName != null) {
                request.AddParameter("state", StateName, ParameterType.GetOrPost);
            }
            if (StateAbbreviation != null) {
                request.AddParameter("state_abbreviation", StateAbbreviation, ParameterType.GetOrPost);
            }
        }
开发者ID:NeilJRyder,项目名称:BigCommerce4Net,代码行数:10,代码来源:FilterStates.cs

示例4: AddFilter

        public override void AddFilter(IRestRequest request) {
            base.AddFilter(request);

            if (CountryName != null) {
                request.AddParameter("country", CountryName, ParameterType.GetOrPost);
            }
            if (CountryIso2 != null) {
                request.AddParameter("country_iso2", CountryIso2, ParameterType.GetOrPost);
            }
            if (CountryIso3 != null) {
                request.AddParameter("country_iso3", CountryIso3, ParameterType.GetOrPost);
            }
        }
开发者ID:NeilJRyder,项目名称:BigCommerce4Net,代码行数:13,代码来源:FilterCountries.cs

示例5: Populate

        public void Populate(IRestRequest request)
        {
            if (!string.IsNullOrEmpty(_bankAccount.Description))
                request.AddParameter("description", _bankAccount.Description);

            request.AddParameter("routing_number", _bankAccount.RoutingNumber);
            request.AddParameter("account_number", _bankAccount.AccountNumber);
            request.AddParameter("account_type", _bankAccount.AccountType == AccountType.Company ? "company" : "individual");
            request.AddParameter("signatory", _bankAccount.Signatory);

            if(_bankAccount.MetaData != null)
                new MetaDataPopulator(_bankAccount.MetaData).Populate(request);
        }
开发者ID:CRodriguez25,项目名称:lob-dotnet,代码行数:13,代码来源:BankAccountDefinitionPopulator.cs

示例6: AddFilter

        public virtual void AddFilter(IRestRequest request)
        {
            if (this.IfModifiedSince != null)
                request.AddHeader("If-Modified-Since", String.Format(RFC2822_DATE_FORMAT, this.IfModifiedSince));

            if (this.Limit != null)
            {
                request.AddParameter("limit", Limit, ParameterType.GetOrPost);
            }
            if (this.Page != null)
            {
                request.AddParameter("page", Page, ParameterType.GetOrPost);
            }
        }
开发者ID:CallumVass,项目名称:BigCommerce4Net,代码行数:14,代码来源:Filter.cs

示例7: AddFilter

        public override void AddFilter(IRestRequest request)
        {
            base.AddFilter(request);

            if (this.Name != null)
            {
                request.AddParameter("name", this.Name, ParameterType.GetOrPost);
            }

            if (this.IsDefault != null)
            {
                request.AddParameter("is_default", this.IsDefault, ParameterType.GetOrPost);
            }
        }
开发者ID:CallumVass,项目名称:BigCommerce4Net,代码行数:14,代码来源:FilterCustomerGroups.cs

示例8: AddFilter

        public override void AddFilter(IRestRequest request) {
            base.AddFilter(request);

            if (this.Name != null) {
                request.AddParameter("name", this.Name, ParameterType.GetOrPost);
            }

            if (this.DisplayName != null) {
                request.AddParameter("display_name", this.DisplayName, ParameterType.GetOrPost);
            }

            if (this.OptionType != null) {
                request.AddParameter("type", this.OptionType, ParameterType.GetOrPost);
            }
        }
开发者ID:NeilJRyder,项目名称:BigCommerce4Net,代码行数:15,代码来源:FilterOptions.cs

示例9: Populate

        public void Populate(IRestRequest request)
        {
            var addressPopulator = new AddressPopulator(_address);
            addressPopulator.Populate(request);
            if (_addressInfo.Description != null) request.AddParameter("description", _addressInfo.Description);
            if (_addressInfo.MetaData != null)
            {
                var populator = new MetaDataPopulator(_addressInfo.MetaData);
                populator.Populate(request);
            }

            if (_addressInfo.Name != null) request.AddParameter("name", _addressInfo.Name);
            if (_addressInfo.Phone != null) request.AddParameter("phone", _addressInfo.Phone);
            if (_addressInfo.Email != null) request.AddParameter("email", _addressInfo.Email);
            if (_addressInfo.Company != null) request.AddParameter("company", _addressInfo.Company);
        }
开发者ID:CRodriguez25,项目名称:lob-dotnet,代码行数:16,代码来源:CreateAddressPopulator.cs

示例10: Authenticate

 public void Authenticate(IRestClient client, IRestRequest request)
 {
     if(!request.Parameters.Any(p => p.Name.Equals("Authorization", StringComparison.OrdinalIgnoreCase)))
     {
         request.AddParameter("Authorization", "SuTToken " + _token, ParameterType.HttpHeader);
     }
 }
开发者ID:vitxd,项目名称:PMAPI-examples,代码行数:7,代码来源:TokenAuthenticator.cs

示例11: Authenticate

        public void Authenticate(IRestClient client, IRestRequest request)
        {
            if (request.Parameters.Exists(p => p.Name.Equals("Cookie", StringComparison.InvariantCultureIgnoreCase)))
                return;

            request.AddParameter("cookie", _authHeader, ParameterType.HttpHeader);
        }
开发者ID:gooodhub,项目名称:Jira.NET,代码行数:7,代码来源:CookieBasedAuthenticator.cs

示例12: PopulateRoutes

 private void PopulateRoutes(IRestRequest request)
 {
     foreach (var route in _definition.Routes)
     {
         request.AddParameter("routes", route.ToString());
     }
 }
开发者ID:CRodriguez25,项目名称:lob-dotnet,代码行数:7,代码来源:AreaMailingDefinitionPopulator.cs

示例13: Authenticate

 /// <summary>
 /// Modifies the request to ensure that the authentication requirements are met.
 /// </summary>
 /// <param name="client">Client executing this request</param>
 /// <param name="request">Request to authenticate</param>
 public void Authenticate(IRestClient client, IRestRequest request)
 {
     // only add the Authorization parameter if it hasn't been added by a previous Execute
     if (request.Parameters.Any(p => p.Name != null && p.Name.Equals("Authorization", StringComparison.OrdinalIgnoreCase)))
         return;
     request.AddParameter("Authorization", this._authHeader, ParameterType.HttpHeader);
 }
开发者ID:ATLCTO,项目名称:CustomerIOSharp,代码行数:12,代码来源:FixedHttpBasicAuthenticator.cs

示例14: Authenticate

 /// <summary>
 /// Modifies the request to ensure that the authentication requirements are met.
 /// </summary>
 /// <param name="client">Client executing this request</param>
 /// <param name="request">Request to authenticate</param>
 public void Authenticate(IRestClient client, IRestRequest request)
 {
     if (HasDigestHeader)
     {
         var digestHeader = GetDigestHeader(client, request);
         request.AddParameter("Authorization", digestHeader, ParameterType.HttpHeader);
     }
 }
开发者ID:changsunfung,项目名称:RestSharp.Portable,代码行数:13,代码来源:HttpDigestAuthenticator.cs

示例15: Authenticate

 public override void Authenticate(IRestClient client, IRestRequest request)
 {
     // only add the Authorization parameter if it hasn't been added.
     if (!request.Parameters.Any(p => p.Name.Equals("Authorization", StringComparison.OrdinalIgnoreCase)))
     {
         request.AddParameter("Authorization", _authorizationValue, ParameterType.HttpHeader);
     }
 }
开发者ID:Tron5000,项目名称:HealthGraphNet,代码行数:8,代码来源:OAuth2RequestHeaderAuthenticator.cs


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