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


C# RestRequest.AddParameterIfHasValue方法代码示例

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


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

示例1: PutParams

        internal void PutParams(RestRequest request)
        {
            Require.Argument("Name", Name);

            request.AddParameter("Name", Name);
            request.AddParameterIfHasValue("Note", Note);
        }
开发者ID:EzTexting,项目名称:csharp-code-samples,代码行数:7,代码来源:Group.cs

示例2: GetContacts

        /// <summary>
        /// Get a list of contacts stored in your Ez Texting contact list.
        /// </summary>
        /// <param name="query">(Optional) Search contacts by first name / last name / phone number</param>
        /// <param name="source">(Optional) Source of contacts. Available values: 'Unknown', 'Manually Added', 'Upload', 'Web Widget', 'API', 'Keyword'</param>
        /// <param name="optout">(Optional) Opted out / opted in contacts. Available values: true, false.</param>
        /// <param name="group">(Optional) Name of the group the contacts belong to</param>
        /// <param name="sortBy">(Optional) Property to sort by. Available values: PhoneNumber, FirstName, LastName, CreatedAt</param>
        /// <param name="sortDir">(Optional) Direction of sorting. Available values: asc, desc</param>
        /// <param name="itemsPerPage">(Optional) Number of results to retrieve. By default, 10 most recently added contacts are retrieved.</param>
        /// <param name="page">(Optional) Page of results to retrieve</param>
        /// <returns></returns>
        public List<Contact> GetContacts(string query, string source, string optout, string group, string sortBy, string sortDir, string itemsPerPage, string page)
        {
            var request = new RestRequest();
            request.Resource = "contacts";

            request.AddParameterIfHasValue("query", query);
            request.AddParameterIfHasValue("source", source);
            request.AddParameterIfHasValue("optout", optout);
            request.AddParameterIfHasValue("group", group);
            request.AddParameterIfHasValue("sortBy", sortBy);
            request.AddParameterIfHasValue("sortDir", sortDir);
            request.AddParameterIfHasValue("itemsPerPage", itemsPerPage);
            request.AddParameterIfHasValue("page", page);

            return Execute<ContactsWrapper>(request).Entries;
        }
开发者ID:EzTexting,项目名称:csharp-code-samples,代码行数:28,代码来源:Contacts.cs

示例3: PutParams

        internal void PutParams(RestRequest request)
        {
            Require.Argument("PhoneNumber", PhoneNumber);

            request.AddParameter("PhoneNumber", PhoneNumber);
            request.AddParameterIfHasValue("FirstName", FirstName);
            request.AddParameterIfHasValue("LastName", LastName);
            request.AddParameterIfHasValue("Email", Email);
            request.AddParameterIfHasValue("Note", Note);
            if (Groups != null)
            {
                for (int i = 0; i < Groups.Count; i++)
                {
                    request.AddParameter("Groups[" + i + "]", Groups[i]);
                }
            }
        }
开发者ID:EzTexting,项目名称:csharp-code-samples,代码行数:17,代码来源:Contact.cs


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