示例#1
0
        InterestingUsersAsync(DisqusAccessToken accessToken, int limit)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("limit", limit)
                                                                     .WithOptionalParameter("access_token", accessToken);

            var response = await RequestProcessor
                           .ExecuteAsync <CursoredDisqusResponse <DisqusInterestingCollection <DisqusUser> > >(DisqusRequestMethod.Get,
                                                                                                               DisqusEndpoints.Users.InterestingUsers, parameters)
                           .ConfigureAwait(false);

            var forums = new List <DisqusInterestingObject <DisqusUser> >();

            foreach (var interestingForumItem in response.Response.Items)
            {
                if (response.Response.Objects.TryGetValue(interestingForumItem.Id, out var forum))
                {
                    forums.Add(new DisqusInterestingObject <DisqusUser>
                    {
                        Reason = interestingForumItem.Reason,
                        Object = forum
                    });
                }
            }

            return(new CursoredDisqusResponse <IEnumerable <DisqusInterestingObject <DisqusUser> > >
            {
                Cursor = response.Cursor,
                Code = response.Code,
                Response = forums
            });
        }
        public async Task <DisqusResponse <IEnumerable <DisqusApplicationUsage> > > ListUsageAsync(
            DisqusAccessToken accessToken, DisqusApplicationListUsageRequest request)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithMultipleParameters(request.Parameters)
                                                                     .WithOptionalParameter("access_token", accessToken);

            var response = await RequestProcessor
                           .ExecuteAsync <DisqusResponse <IEnumerable <string[]> > >(DisqusRequestMethod.Get,
                                                                                     DisqusEndpoints.Applications.ListUsage, parameters)
                           .ConfigureAwait(false);

            var usages = new List <DisqusApplicationUsage>();

            foreach (var item in response.Response)
            {
                var usage = new DisqusApplicationUsage
                {
                    Date  = DateTime.Parse(item[0]),
                    Usage = int.Parse(item[1])
                };

                usages.Add(usage);
            }

            return(new DisqusResponse <IEnumerable <DisqusApplicationUsage> >
            {
                Code = response.Code,
                Response = usages
            });
        }
示例#3
0
        public async Task <DisqusResponse <DisqusCategory> > DetailsAsync(DisqusAccessToken accessToken, int categoryId)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithOptionalParameter("access_token", accessToken)
                                                                     .WithParameter("category", categoryId);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <DisqusCategory> >(DisqusRequestMethod.Get, DisqusEndpoints.Categories.Details, parameters)
                   .ConfigureAwait(false));
        }
示例#4
0
        public async Task <DisqusResponse <DisqusAdmin> > RemoveAdminAsync(DisqusAccessToken accessToken, DisqusOrganizationRemoveAdminRequest request)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("access_token", accessToken)
                                                                     .WithMultipleParameters(request.Parameters);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <DisqusAdmin> >(DisqusRequestMethod.Post, DisqusEndpoints.Organizations.RemoveAdmin, parameters)
                   .ConfigureAwait(false));
        }
        public async Task FollowAsync(DisqusAccessToken accessToken, string username)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("target:username", username)
                                                                     .WithOptionalParameter("access_token", accessToken);

            await RequestProcessor
            .ExecuteAsync <DisqusResponse <List <string> > >(DisqusRequestMethod.Post, DisqusEndpoints.Users.Follow, parameters)
            .ConfigureAwait(false);
        }
        /// <summary>
        /// Removes a trusted domain from a forum
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="domain"></param>
        /// <returns></returns>
        public async Task <DisqusResponse <string> > KillAsync(DisqusAccessToken accessToken, int domain)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("access_token", accessToken)
                                                                     .WithParameter("domain", domain);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <string> >(DisqusRequestMethod.Post, DisqusEndpoints.TrustedDomain.Kill, parameters)
                   .ConfigureAwait(false));
        }
        public async Task <DisqusResponse <DisqusForum> > DisableAdsAsync(DisqusAccessToken accessToken, string forum)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("access_token", accessToken)
                                                                     .WithParameter("forum", forum);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <DisqusForum> >(DisqusRequestMethod.Post, DisqusEndpoints.Forums.DisableAds, parameters)
                   .ConfigureAwait(false));
        }
        public async Task <DisqusResponse <string> > CheckUsernameAsync(DisqusAccessToken accessToken, string username)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("access_token", accessToken)
                                                                     .WithParameter("username", username);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <string> >(DisqusRequestMethod.Post, DisqusEndpoints.Users.CheckUsername, parameters)
                   .ConfigureAwait(false));
        }
        public async Task <DisqusResponse <DisqusPost> > ReportAsync(DisqusAccessToken accessToken, long postId)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("post", postId.ToString())
                                                                     .WithParameter("access_token", accessToken);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <DisqusPost> >(DisqusRequestMethod.Post, DisqusEndpoints.Posts.Report, parameters)
                   .ConfigureAwait(false));
        }
示例#10
0
        public async Task <DisqusResponse <DisqusId> > RemoveModeratorAsync(DisqusAccessToken accessToken, DisqusForumRemoveModeratorRequest request)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithOptionalParameter("access_token", accessToken)
                                                                     .WithMultipleParameters(request.Parameters);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <DisqusId> >(DisqusRequestMethod.Post, DisqusEndpoints.Forums.RemoveModerator, parameters)
                   .ConfigureAwait(false));
        }
        public async Task <DisqusResponse <object> > ExportForumAsync(DisqusAccessToken accessToken, DisqusExportExportForumRequest request)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithMultipleParameters(request.Parameters)
                                                                     .WithParameter("access_token", accessToken);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <object> >(DisqusRequestMethod.Post, DisqusEndpoints.Exports.ExportForum, parameters)
                   .ConfigureAwait(false));
        }
        public async Task <DisqusResponse <string> > UnsubscribeAsync(DisqusAccessToken accessToken, string thread)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("thread", thread)
                                                                     .WithOptionalParameter("access_token", accessToken);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <string> >(DisqusRequestMethod.Post, DisqusEndpoints.Threads.Unsubscribe, parameters)
                   .ConfigureAwait(false));
        }
示例#13
0
        public async Task <DisqusResponse <DisqusPost> > DetailsAsync(DisqusAccessToken accessToken, DisqusPostDetailsRequest request)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithMultipleParameters(request.Parameters)
                                                                     .WithOptionalParameter("access_token", accessToken);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <DisqusPost> >(DisqusRequestMethod.Get, DisqusEndpoints.Posts.Details, parameters)
                   .ConfigureAwait(false));
        }
示例#14
0
        public async Task <DisqusResponse <IEnumerable <string> > > ValidateAsync(DisqusAccessToken accessToken, DisqusForumValidateRequest request)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("access_token", accessToken)
                                                                     .WithMultipleParameters(request.Parameters);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <IEnumerable <string> > >(DisqusRequestMethod.Get, DisqusEndpoints.Forums.Validate, parameters)
                   .ConfigureAwait(false));
        }
示例#15
0
        public async Task <DisqusResponse <IEnumerable <DisqusId> > > ApproveAsync(DisqusAccessToken accessToken, params string[] posts)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("access_token", accessToken)
                                                                     .WithMultipleParameters("post", posts);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <IEnumerable <DisqusId> > >(DisqusRequestMethod.Post, DisqusEndpoints.Posts.Approve, parameters)
                   .ConfigureAwait(false));
        }
        public async Task <DisqusResponse <DisqusThread> > CreateAsync(DisqusAccessToken accessToken, DisqusThreadCreateRequest request)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("access_token", accessToken)
                                                                     .WithMultipleParameters(request.Parameters);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <DisqusThread> >(DisqusRequestMethod.Post, DisqusEndpoints.Threads.Create, parameters)
                   .ConfigureAwait(false));
        }
示例#17
0
        public async Task <DisqusResponse <string> > ReportAsync(DisqusAccessToken accessToken, int userId, DisqusUserReportReason reason)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("access_token", accessToken)
                                                                     .WithParameter("user", userId)
                                                                     .WithParameter("reason", (int)reason);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <string> >(DisqusRequestMethod.Post, DisqusEndpoints.Users.Report, parameters)
                   .ConfigureAwait(false));
        }
        /// <summary>
        /// Adds a trusted domain to a forum
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="forum"></param>
        /// <param name="domainName"></param>
        /// <returns></returns>
        public async Task <DisqusResponse <DisqusTrustedDomain> > CreateAsync(DisqusAccessToken accessToken, string forum, string domainName)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("access_token", accessToken)
                                                                     .WithParameter("forum", forum)
                                                                     .WithParameter("domainName", domainName);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <DisqusTrustedDomain> >(DisqusRequestMethod.Post, DisqusEndpoints.TrustedDomain.Create, parameters)
                   .ConfigureAwait(false));
        }
示例#19
0
        public async Task <DisqusResponse <DisqusImport> > DetailsAsync(DisqusAccessToken accessToken, string forum, string @group)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("forum", forum)
                                                                     .WithParameter("group", group)
                                                                     .WithParameter("access_token", accessToken);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <DisqusImport> >(DisqusRequestMethod.Get, DisqusEndpoints.Imports.Details, parameters)
                   .ConfigureAwait(false));
        }
        public async Task <CursoredDisqusResponse <IEnumerable <DisqusAdmin> > > ListAdminsAsync(
            DisqusAccessToken accessToken, int organization)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("access_token", accessToken)
                                                                     .WithParameter("organization", organization);

            return(await RequestProcessor
                   .ExecuteAsync <CursoredDisqusResponse <IEnumerable <DisqusAdmin> > >(DisqusRequestMethod.Get,
                                                                                        DisqusEndpoints.Organizations.ListAdmins, parameters)
                   .ConfigureAwait(false));
        }
        public async Task <DisqusResponse <IEnumerable <DisqusForumModerator> > > ListModeratorsAsync(
            DisqusAccessToken accessToken, string forum)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithOptionalParameter("access_token", accessToken)
                                                                     .WithParameter("forum", forum);

            return(await RequestProcessor
                   .ExecuteAsync <CursoredDisqusResponse <IEnumerable <DisqusForumModerator> > >(DisqusRequestMethod.Get,
                                                                                                 DisqusEndpoints.Forums.ListModerators, parameters)
                   .ConfigureAwait(false));
        }
示例#22
0
        public async Task <CursoredDisqusResponse <IEnumerable <DisqusForum> > > ListForumsAsync(
            DisqusAccessToken accessToken, DisqusUserListForumsRequest request)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithOptionalParameter("access_token", accessToken)
                                                                     .WithMultipleParameters(request.Parameters);

            return(await RequestProcessor
                   .ExecuteAsync <CursoredDisqusResponse <IEnumerable <DisqusForum> > >(DisqusRequestMethod.Get,
                                                                                        DisqusEndpoints.Users.ListForums, parameters)
                   .ConfigureAwait(false));
        }
        /// <summary>
        ///     Returns a list of forum trusted domains
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="forum"></param>
        /// <returns></returns>
        public async Task <DisqusResponse <IEnumerable <DisqusTrustedDomain> > > ListAsync(DisqusAccessToken accessToken,
                                                                                           string forum)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("access_token", accessToken)
                                                                     .WithParameter("forum", forum);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <IEnumerable <DisqusTrustedDomain> > >(DisqusRequestMethod.Get,
                                                                                        DisqusEndpoints.TrustedDomain.List, parameters)
                   .ConfigureAwait(false));
        }
示例#24
0
        public async Task <DisqusResponse <IEnumerable <DisqusBlacklistEntry> > > RemoveAsync(DisqusAccessToken accessToken,
                                                                                              DisqusBlacklistRemoveRequest request)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithMultipleParameters(request.Parameters)
                                                                     .WithOptionalParameter("access_token", accessToken);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <IEnumerable <DisqusBlacklistEntry> > >(DisqusRequestMethod.Post,
                                                                                         DisqusEndpoints.Blacklists.Remove, parameters)
                   .ConfigureAwait(false));
        }
        public async Task <CursoredDisqusResponse <List <DisqusCategory> > > ListAsync(DisqusAccessToken accessToken,
                                                                                       DisqusCategoryListRequest request)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithOptionalParameter("access_token", accessToken)
                                                                     .WithMultipleParameters(request.Parameters);

            return(await RequestProcessor
                   .ExecuteAsync <CursoredDisqusResponse <List <DisqusCategory> > >(DisqusRequestMethod.Get,
                                                                                    DisqusEndpoints.Categories.List, parameters)
                   .ConfigureAwait(false));
        }
示例#26
0
        public async Task <DisqusResponse <IEnumerable <string> > > RemoveFollowerAsync(DisqusAccessToken accessToken,
                                                                                        int userId)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("access_token", accessToken)
                                                                     .WithParameter("follower", userId);

            return(await RequestProcessor
                   .ExecuteAsync <DisqusResponse <IEnumerable <string> > >(DisqusRequestMethod.Post,
                                                                           DisqusEndpoints.Users.RemoveFollower, parameters)
                   .ConfigureAwait(false));
        }
示例#27
0
        public async Task <CursoredDisqusResponse <IEnumerable <DisqusImport> > > ListAsync(DisqusAccessToken accessToken, string forum, string cursor = null)
        {
            Collection <KeyValuePair <string, string> > parameters = Parameters
                                                                     .WithParameter("forum", forum)
                                                                     .WithOptionalParameter("cursor", cursor)
                                                                     .WithParameter("access_token", accessToken);

            return(await RequestProcessor
                   .ExecuteAsync <CursoredDisqusResponse <IEnumerable <DisqusImport> > >(DisqusRequestMethod.Get, DisqusEndpoints.Imports.List, parameters)
                   .ConfigureAwait(false));
        }