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


C# ListRequestProcessor.ProcessActionResult方法代码示例

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


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

示例1: CreateList

        /// <summary>
        /// Creates a new list
        /// </summary>
        /// <param name="listName">name of list</param>
        /// <param name="mode">public or private</param>
        /// <param name="description">list description</param>
        /// <param name="callback">Async Callback used in Silverlight queries</param>
        /// <returns>List info for new list</returns>
        public static List CreateList(this TwitterContext ctx, string listName, string mode, string description, Action<TwitterAsyncResponse<List>> callback)
        {
            if (string.IsNullOrEmpty(listName))
            {
                throw new ArgumentException("listName is required.", "listName");
            }

            var createUrl = ctx.BaseUrl + "lists/create.json";

            var reqProc = new ListRequestProcessor<List>();

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostToTwitter(
                    createUrl,
                    new Dictionary<string, string>
                    {
                        { "name", listName },
                        { "mode", mode },
                        { "description", description }
                    },
                    response => reqProc.ProcessActionResult(response, ListAction.Create));

            List results = reqProc.ProcessActionResult(resultsJson, ListAction.Create);
            return results;
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:35,代码来源:ListExtensions.cs

示例2: UpdateListAsync

        /// <summary>
        /// Modifies an existing list.
        /// </summary>
        /// <param name="listID">ID of list</param>
        /// <param name="slug">name of list</param>
        /// <param name="ownerID">ID of user who owns the list.</param>
        /// <param name="ownerScreenName">Screen name of user who owns the list.</param>
        /// <param name="mode">public or private</param>
        /// <param name="description">list description</param>
        /// <returns>List info for modified list</returns>
        public async Task<List> UpdateListAsync(ulong listID, string slug, string name, ulong ownerID, string ownerScreenName, string mode, string description, CancellationToken cancelToken = default(CancellationToken))
        {
            if (listID == 0 && string.IsNullOrWhiteSpace(slug))
                throw new ArgumentException("Either listID or slug is required.", ListIDOrSlugParam);

            if (!string.IsNullOrWhiteSpace(slug) && ownerID == 0 && string.IsNullOrWhiteSpace(ownerScreenName))
                throw new ArgumentException("If you specify a Slug, you must also specify either OwnerID or OwnerScreenName.", OwnerIDOrOwnerScreenNameParam);

            var updateListUrl = BaseUrl + "lists/update.json";

            var reqProc = new ListRequestProcessor<List>();

            RawResult =
                await TwitterExecutor.PostToTwitterAsync<List>(
                    updateListUrl,
                    new Dictionary<string, string>
                    {
                        { "list_id", listID.ToString() },
                        { "slug", slug },
                        { "owner_id", ownerID.ToString() },
                        { "owner_screen_name", ownerScreenName },
                        { "mode", mode },
                        { "description", description },
                        { "name", name }
                    },
                    cancelToken)
                    .ConfigureAwait(false);

            return reqProc.ProcessActionResult(RawResult, ListAction.Update);
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:40,代码来源:TwitterContextListCommands.cs

示例3: CreateListAsync

        /// <summary>
        /// Creates a new list.
        /// </summary>
        /// <param name="listName">name of list</param>
        /// <param name="mode">public or private</param>
        /// <param name="description">list description</param>
        /// <returns>List info for new list</returns>
        public async Task<List> CreateListAsync(string listName, string mode, string description, CancellationToken cancelToken = default(CancellationToken))
        {
            if (string.IsNullOrWhiteSpace(listName))
                throw new ArgumentException("listName is required.", "listName");

            var createUrl = BaseUrl + "lists/create.json";

            var reqProc = new ListRequestProcessor<List>();

            RawResult =
                await TwitterExecutor.PostToTwitterAsync<List>(
                    createUrl,
                    new Dictionary<string, string>
                    {
                        { "name", listName },
                        { "mode", mode },
                        { "description", description }
                    },
                    cancelToken)
                    .ConfigureAwait(false);

            return reqProc.ProcessActionResult(RawResult, ListAction.Create);
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:30,代码来源:TwitterContextListCommands.cs

示例4: DeleteMemberRangeFromListAsync

        /// <summary>
        /// Deletes membership for a comma-separated list of users.
        /// </summary>
        /// <param name="listID">ID of list.</param>
        /// <param name="slug">Name of list to remove from.</param>
        /// <param name="userIds">List of user IDs of users to remove from list membership.</param>
        /// <param name="screenNames">List of screen names of users to remove from list membership.</param>
        /// <param name="ownerID">ID of users who owns the list.</param>
        /// <param name="ownerScreenName">Screen name of user who owns the list.</param>
        /// <returns>List info for list subscription removed from</returns>
        async Task<List> DeleteMemberRangeFromListAsync(ulong listID, string slug, List<ulong> userIDs, List<string> screenNames, ulong ownerID, string ownerScreenName, CancellationToken cancelToken = default(CancellationToken))
        {
            if (listID == 0 && string.IsNullOrWhiteSpace(slug))
                throw new ArgumentException("Either listID or slug is required.", ListIDOrSlugParam);

            if (listID == 0 && !string.IsNullOrWhiteSpace(slug) && 
                ownerID == 0 && string.IsNullOrWhiteSpace(ownerScreenName))
                throw new ArgumentException("If using slug, you must also provide either ownerID or ownerScreenName.", OwnerIDOrOwnerScreenNameParam);

            if ((userIDs != null && userIDs.Count > 100) || 
                (screenNames != null && screenNames.Count > 100))
                throw new ArgumentException("You can only remove 100 members at a Time.", "userIDs");

            var destroyAllUrl = BaseUrl + "lists/members/destroy_all.json";

            var reqProc = new ListRequestProcessor<List>();

            var parameters = new Dictionary<string, string>();

            if (listID != 0)
                parameters.Add("list_id", listID.ToString());
            if (!string.IsNullOrWhiteSpace(slug))
                parameters.Add("slug", slug);
            if (userIDs != null && userIDs.Any())
                parameters.Add("user_id", string.Join(",", userIDs.Select(id => id.ToString(CultureInfo.InvariantCulture)).ToArray()));
            if (screenNames != null && screenNames.Any())
                parameters.Add("screen_name", string.Join(",", screenNames));
            if (ownerID != 0)
                parameters.Add("owner_id", ownerID.ToString());
            if (!string.IsNullOrWhiteSpace(ownerScreenName))
                parameters.Add("owner_screen_name", ownerScreenName);

            RawResult =
                await TwitterExecutor.PostToTwitterAsync<List>(destroyAllUrl, parameters, cancelToken).ConfigureAwait(false);

            return reqProc.ProcessActionResult(RawResult, ListAction.DestroyAll);
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:47,代码来源:TwitterContextListCommands.cs

示例5: UnsubscribeFromListAsync

        /// <summary>
        /// Removes a user as a list subscriber.
        /// </summary>
        /// <param name="listID">ID of list.</param>
        /// <param name="slug">Name of list to remove from.</param>
        /// <param name="ownerID">ID of user who owns the list.</param>
        /// <param name="ownerScreenName">Screen name of user who owns the list.</param>
        /// <returns>List info for list subscription removed from</returns>
        public async Task<List> UnsubscribeFromListAsync(ulong listID, string slug, ulong ownerID, string ownerScreenName, CancellationToken cancelToken = default(CancellationToken))
        {
            if (listID == 0 && string.IsNullOrWhiteSpace(slug))
                throw new ArgumentException("Either listID or slug is required.", ListIDOrSlugParam);

            if (!string.IsNullOrWhiteSpace(slug) && ownerID == 0 && string.IsNullOrWhiteSpace(ownerScreenName))
                throw new ArgumentException("If using slug, you must also provide either ownerID or ownerScreenName.", OwnerIDOrOwnerScreenNameParam);

            var unsubscribeUrl = BaseUrl + "lists/subscribers/destroy.json";

            var reqProc = new ListRequestProcessor<List>();

            var parameters = new Dictionary<string, string>();

            if (listID != 0)
                parameters.Add("list_id", listID.ToString());
            if (!string.IsNullOrWhiteSpace(slug))
                parameters.Add("slug", slug);
            if (ownerID != 0)
                parameters.Add("owner_id", ownerID.ToString());
            if (!string.IsNullOrWhiteSpace(ownerScreenName))
                parameters.Add("owner_screen_name", ownerScreenName);

            RawResult =
                await TwitterExecutor.PostToTwitterAsync<List>(unsubscribeUrl, parameters, cancelToken).ConfigureAwait(false);

            return reqProc.ProcessActionResult(RawResult, ListAction.Unsubscribe);
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:36,代码来源:TwitterContextListCommands.cs

示例6: UpdateList

        /// <summary>
        /// Modifies an existing list
        /// </summary>
        /// <param name="listID">ID of list</param>
        /// <param name="slug">name of list</param>
        /// <param name="ownerID">ID of user who owns the list.</param>
        /// <param name="ownerScreenName">Screen name of user who owns the list.</param>
        /// <param name="mode">public or private</param>
        /// <param name="description">list description</param>
        /// <param name="callback">Async Callback used in Silverlight queries</param>
        /// <returns>List info for modified list</returns>
        public static List UpdateList(this TwitterContext ctx, string listID, string slug, string name, string ownerID, string ownerScreenName, string mode, string description, Action<TwitterAsyncResponse<List>> callback)
        {
            if (string.IsNullOrEmpty(listID) && string.IsNullOrEmpty(slug))
            {
                throw new ArgumentException("Either listID or slug is required.", ListIDOrSlugParam);
            }

            if (!string.IsNullOrEmpty(slug) && string.IsNullOrEmpty(ownerID) && string.IsNullOrEmpty(ownerScreenName))
            {
                throw new ArgumentException("If you specify a Slug, you must also specify either OwnerID or OwnerScreenName.", OwnerIDOrOwnerScreenNameParam);
            }

            var updateListUrl = ctx.BaseUrl + "lists/update.json";

            var reqProc = new ListRequestProcessor<List>();

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostToTwitter(
                    updateListUrl,
                    new Dictionary<string, string>
                    {
                        { "list_id", listID },
                        { "slug", slug },
                        { "owner_id", ownerID },
                        { "owner_screen_name", ownerScreenName },
                        { "mode", mode },
                        { "description", description },
                        { "name", name }
                    },
                    response => reqProc.ProcessActionResult(response, ListAction.Update));

            List results = reqProc.ProcessActionResult(resultsJson, ListAction.Update);
            return results;
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:47,代码来源:ListExtensions.cs

示例7: DestroyAllFromList

        /// <summary>
        /// Deletes membership for a comma-separated list of users
        /// </summary>
        /// <param name="listID">ID of list.</param>
        /// <param name="slug">Name of list to remove from.</param>
        /// <param name="userIds">Comma-separated list of user IDs of users to remove from list membership.</param>
        /// <param name="screenNames">Comma-separated list of screen names of users to remove from list membership.</param>
        /// <param name="ownerID">ID of users who owns the list.</param>
        /// <param name="ownerScreenName">Screen name of user who owns the list.</param>
        /// <param name="callback">Async Callback used in Silverlight queries</param>
        /// <returns>List info for list subscription removed from</returns>
        public static List DestroyAllFromList(this TwitterContext ctx, string listID, string slug, string userIds, string screenNames, string ownerID, string ownerScreenName, Action<TwitterAsyncResponse<List>> callback)
        {
            if (string.IsNullOrEmpty(listID) && string.IsNullOrEmpty(slug))
            {
                throw new ArgumentException("Either listID or slug is required.", ListIDOrSlugParam);
            }

            if (string.IsNullOrEmpty(listID) && !string.IsNullOrEmpty(slug) && 
                string.IsNullOrEmpty(ownerID) && string.IsNullOrEmpty(ownerScreenName))
            {
                throw new ArgumentException("If using slug, you must also provide either ownerID or ownerScreenName.", OwnerIDOrOwnerScreenNameParam);
            }

            var destroyAllUrl = ctx.BaseUrl + "lists/members/destroy_all.json";

            var reqProc = new ListRequestProcessor<List>();

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostToTwitter(
                    destroyAllUrl,
                    new Dictionary<string, string>
                    {
                        { "list_id", listID },
                        { "slug", slug },
                        { "user_id", userIds == null ? null : userIds.Replace(" ", "") },
                        { "screen_name", screenNames == null ? null : screenNames.Replace(" ", "") },
                        { "owner_id", ownerID },
                        { "owner_screen_name", ownerScreenName },
                    },
                    response => reqProc.ProcessActionResult(response, ListAction.DestroyAll));

            List results = reqProc.ProcessActionResult(resultsJson, ListAction.DestroyAll);
            return results;
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:47,代码来源:ListExtensions.cs

示例8: SubscribeToList

        /// <summary>
        /// Adds a user as a list subscriber
        /// </summary>
        /// <param name="listID">ID of list.</param>
        /// <param name="slug">Name of list to add to.</param>
        /// <param name="ownerID">ID of user who owns the list.</param>
        /// <param name="ownerScreenName">Screen name of user who owns the list.</param>
        /// <param name="callback">Async Callback used in Silverlight queries</param>
        /// <returns>List info for list subscribed to</returns>
        public static List SubscribeToList(this TwitterContext ctx, string listID, string slug, string ownerID, string ownerScreenName, Action<TwitterAsyncResponse<List>> callback)
        {
            if (string.IsNullOrEmpty(listID) && string.IsNullOrEmpty(slug))
            {
                throw new ArgumentException("Either listID or slug is required.", ListIDOrSlugParam);
            }

            if (!string.IsNullOrEmpty(slug) && string.IsNullOrEmpty(ownerID) && string.IsNullOrEmpty(ownerScreenName))
            {
                throw new ArgumentException("If using slug, you must also provide either ownerID or ownerScreenName.", OwnerIDOrOwnerScreenNameParam);
            }

            var subscribeUrl = ctx.BaseUrl + "lists/subscribers/create.json";

            var reqProc = new ListRequestProcessor<List>();

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostToTwitter(
                    subscribeUrl,
                    new Dictionary<string, string>
                    {
                        { "list_id", listID },
                        { "slug", slug },
                        { "owner_id", ownerID },
                        { "owner_screen_name", ownerScreenName },
                    },
                    response => reqProc.ProcessActionResult(response, ListAction.Subscribe));

            List results = reqProc.ProcessActionResult(resultsJson, ListAction.Subscribe);
            return results;
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:42,代码来源:ListExtensions.cs

示例9: AddMemberRangeToList

        /// <summary>
        /// Adds a list of users to a list.
        /// </summary>
        /// <param name="listID">ID of List.</param>
        /// <param name="slug">List name.</param>
        /// <param name="ownerID">ID of user who owns the list.</param>
        /// <param name="ownerScreenName">Screen name of user who owns the list.</param>
        /// <param name="userIDs">List of user IDs to be list members. (max 100)</param>
        /// <param name="screenNames">List of user screen names to be list members. (max 100)</param>
        /// <param name="callback">Async Callback used in Silverlight queries</param>
        /// <returns>List info for list members added to.</returns>
        static List AddMemberRangeToList(this TwitterContext ctx, string listID, string slug, string ownerID, string ownerScreenName, IEnumerable<ulong> userIDs, List<string> screenNames, Action<TwitterAsyncResponse<List>> callback)
        {
            if (string.IsNullOrEmpty(listID) && string.IsNullOrEmpty(slug))
            {
                throw new ArgumentException("Either listID or slug is required.", ListIDOrSlugParam);
            }

            if (!string.IsNullOrEmpty(slug) && string.IsNullOrEmpty(ownerID) && string.IsNullOrEmpty(ownerScreenName))
            {
                throw new ArgumentException("If using slug, you must also provide either ownerID or ownerScreenName.", OwnerIDOrOwnerScreenNameParam);
            }

            var addMemberRangeUrl = ctx.BaseUrl + "lists/members/create_all.json";

            var reqProc = new ListRequestProcessor<List>();

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostToTwitter(
                    addMemberRangeUrl,
                    new Dictionary<string, string>
                    {
                        { "list_id", listID },
                        { "slug", slug },
                        { "owner_id", ownerID },
                        { "owner_screen_name", ownerScreenName },
                        { "user_id", userIDs == null ? null : string.Join(",", userIDs.Select(id => id.ToString(CultureInfo.InvariantCulture)).ToArray()) },                        
                        { "screen_name", screenNames == null ? null : string.Join(",", screenNames.ToArray()) }
                    },
                    response => reqProc.ProcessActionResult(response, ListAction.AddMember));

            List results = reqProc.ProcessActionResult(resultsJson, ListAction.AddMember);
            return results;
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:46,代码来源:ListExtensions.cs


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