コード例 #1
0
 /// <summary>
 /// Follows a user.
 /// </summary>
 /// <param name="UserID">The ID of the user to follow.</param>
 /// <param name="restrict">The publicity at which to follow. Can be: 'all', 'public' or 'private'.</param>
 public async Task FollowAsync(string UserID, Publicity restrict = Publicity.Public)
 {
     Dictionary <string, string> parameters = new Dictionary <string, string>()
     {
         { "user_id", UserID },
         { "restrict", restrict.JsonValue() }
     };
     FormUrlEncodedContent encodedParams = new FormUrlEncodedContent(parameters);
     await RequestClient.RequestAsync(PixivUrls.FollowProfile, encodedParams).ConfigureAwait(false);
 }
コード例 #2
0
ファイル: Novel.cs プロジェクト: An-Owlbear/PixivCSharp
 /// <summary>
 /// Bookmarks a novel.
 /// </summary>
 /// <param name="id">The novel to bookmark.</param>
 /// <param name="restrict">The publicity at which to bookmark the novel.</param>
 public async Task AddBookmarkNovelAsync(string id, Publicity restrict = Publicity.Public)
 {
     Dictionary <string, string> parameters = new Dictionary <string, string>()
     {
         { "novel_id", id },
         { "restrict", restrict.JsonValue() }
     };
     FormUrlEncodedContent encodedParams = new FormUrlEncodedContent(parameters);
     await RequestClient.RequestAsync(PixivUrls.NovelBookmarkAdd, encodedParams).ConfigureAwait(false);
 }
コード例 #3
0
        /// <summary>
        /// Gets a list of novels bookmarked by the given user.
        /// </summary>
        /// <param name="UserID">The ID of the user to view novel bookmarks of.</param>
        /// <param name="restrict">The publicity of bookmarks to view. Can be: 'all', 'public' or 'private'.</param>
        /// <returns><seealso cref="NovelSearchResult"/></returns>
        public async Task <NovelSearchResult> BookmarkedNovelsAsync(string UserID, Publicity restrict = Publicity.Public)
        {
            Stream response;
            Dictionary <string, string> parameters = new Dictionary <string, string>()
            {
                { "user_id", UserID },
                { "restrict", restrict.JsonValue() }
            };
            FormUrlEncodedContent encodedParams = new FormUrlEncodedContent(parameters);

            response = await RequestClient.RequestAsync(PixivUrls.BookmarkedNovels, encodedParams).ConfigureAwait(false);

            return(Json.DeserializeJson <NovelSearchResult>(response));
        }
コード例 #4
0
ファイル: Browsing.cs プロジェクト: An-Owlbear/PixivCSharp
        /// <summary>
        /// Gets a list of new novels from followed accounts.
        /// </summary>
        /// <param name="restrict">Specifies of what restrict to search for.</param>
        /// <returns><seealso cref="NovelSearchResult"/> for new novels from followed accounts.</returns>
        public async Task <NovelSearchResult> NewFollowNovelsAsync(Publicity restrict = Publicity.Public)
        {
            Stream response;
            Dictionary <string, string> parameters = new Dictionary <string, string>()
            {
                { "restrict", restrict.JsonValue() }
            };

            // Encodeds parameters and sends request
            FormUrlEncodedContent encodedParams = new FormUrlEncodedContent(parameters);

            response = await RequestClient.RequestAsync(PixivUrls.NewFollowNovels, encodedParams).ConfigureAwait(false);

            // Converts response into object and returns it
            return(Json.DeserializeJson <NovelSearchResult>(response));
        }
コード例 #5
0
        /// <summary>
        /// Gets a list of the users followed by the given user.
        /// </summary>
        /// <param name="UserID">The ID of the user to view following accounts from.</param>
        /// <param name="restrict">The publicity of follows to view. Can be: 'all', 'public' or 'private'.</param>
        /// <param name="filter">The filter to use. Can be 'none', 'for_android' or 'for_ios'.</param>
        /// <returns><seealso cref="UserSearchResult"/></returns>
        public async Task <UserSearchResult> FollowingAsync(string UserID, Publicity restrict = Publicity.Public, FilterType filter = FilterType.None)
        {
            Stream response;
            Dictionary <string, string> parameters = new Dictionary <string, string>()
            {
                { "user_id", UserID },
                { "restrict", restrict.JsonValue() }
            };

            // Adds filter if required
            if ((filter.JsonValue() ?? Filter.JsonValue()) != null)
            {
                parameters.Add("filter", filter.JsonValue() ?? Filter.JsonValue());
            }

            FormUrlEncodedContent encodedParams = new FormUrlEncodedContent(parameters);

            response = await RequestClient.RequestAsync(PixivUrls.ViewFollowing, encodedParams).ConfigureAwait(false);

            return(Json.DeserializeJson <UserSearchResult>(response));
        }