コード例 #1
0
        /// <summary>
        /// List the photos with the most views, comments or favorites.
        /// </summary>
        /// <param name="date">Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. If no date is provided, all time view counts will be returned.</param>
        /// <param name="sort">The order in which to sort returned photos. Defaults to views. The possible values are views, comments and favorites. </param>
        /// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
        /// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100.</param>
        /// <returns>A list of <see cref="PopularPhoto"/> instances.</returns>
        public PopularPhotoCollection StatsGetPopularPhotos(DateTime date, PopularitySort sort, int page, int perPage)
        {
            CheckRequiresAuthentication();

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

            parameters.Add("method", "flickr.stats.getPopularPhotos");
            if (date != DateTime.MinValue)
            {
                parameters.Add("date", UtilityMethods.DateToUnixTimestamp(date));
            }
            if (sort != PopularitySort.None)
            {
                parameters.Add("sort", UtilityMethods.SortOrderToString(sort));
            }
            if (page > 0)
            {
                parameters.Add("page", page.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (perPage > 0)
            {
                parameters.Add("per_page", perPage.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }

            return(GetResponseCache <PopularPhotoCollection>(parameters));
        }
コード例 #2
0
        /// <summary>
        /// List the photos with the most views, comments or favorites.
        /// </summary>
        /// <param name="date">Stats will be returned for this date.
        /// A day according to Flickr Stats starts at midnight GMT for all users,
        /// and timestamps will automatically be rounded down to the start of the day.
        /// If no date is provided, all time view counts will be returned.</param>
        /// <param name="sort">The order in which to sort returned photos.
        /// Defaults to views. The possible values are views, comments and favorites. </param>
        /// <param name="page">The page of results to return.
        /// If this argument is omitted, it defaults to 1.</param>
        /// <param name="perPage">Number of photos to return per page.
        /// If this argument is omitted, it defaults to 25. The maximum allowed value is 100.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void StatsGetPopularPhotosAsync(DateTime date, PopularitySort sort, int page, int perPage,
                                               Action <TwentyThreeResult <PopularPhotoCollection> > callback)
        {
            CheckRequiresAuthentication();

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

            parameters.Add("method", "flickr.stats.getPopularPhotos");
            if (date != DateTime.MinValue)
            {
                parameters.Add("date", UtilityMethods.DateToUnixTimestamp(date));
            }
            if (sort != PopularitySort.None)
            {
                parameters.Add("sort", UtilityMethods.SortOrderToString(sort));
            }
            if (page > 0)
            {
                parameters.Add("page", page.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (perPage > 0)
            {
                parameters.Add("per_page", perPage.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }

            GetResponseAsync <PopularPhotoCollection>(parameters, callback);
        }
コード例 #3
0
ファイル: SearchClient.cs プロジェクト: Xwilarg/NHentaiSharp
        private static string GetSortInfo(PopularitySort sortOption)
        {
            switch (sortOption)
            {
            case PopularitySort.Today: return("&sort=popular-today");

            case PopularitySort.Week: return("&sort=popular-week");

            case PopularitySort.AllTime: return("&sort=popular");

            default: return("");
            }
        }
コード例 #4
0
ファイル: UtilityMethods.cs プロジェクト: vnisor/FlickrNet
        /// <summary>
        /// Converts a <see cref="PopularitySort"/> enum to a string.
        /// </summary>
        /// <param name="sortOrder">The value to convert.</param>
        /// <returns></returns>
        public static string SortOrderToString(PopularitySort sortOrder)
        {
            switch (sortOrder)
            {
            case PopularitySort.Comments:
                return("comments");

            case PopularitySort.Favorites:
                return("favorites");

            case PopularitySort.Views:
                return("views");

            default:
                return(String.Empty);
            }
        }
コード例 #5
0
 /// <summary>
 /// List the photos with the most views, comments or favorites.
 /// </summary>
 /// <param name="sort">The order in which to sort returned photos.
 /// Defaults to views. The possible values are views, comments and favorites. </param>
 /// <param name="page">The page of results to return.
 /// If this argument is omitted, it defaults to 1.</param>
 /// <param name="perPage">Number of photos to return per page.
 /// If this argument is omitted, it defaults to 25. The maximum allowed value is 100.</param>
 /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
 public void StatsGetPopularPhotosAsync(PopularitySort sort, int page, int perPage, Action <TwentyThreeResult <PopularPhotoCollection> > callback)
 {
     StatsGetPopularPhotosAsync(DateTime.MinValue, sort, page, perPage, callback);
 }
コード例 #6
0
 public PopularPhotoCollection StatsGetPopularPhotos(PopularitySort sort, int page, int perPage)
 {
     return StatsGetPopularPhotos(null, sort, page, perPage);
 }
コード例 #7
0
 public PopularPhotoCollection StatsGetPopularPhotos(DateTime date, PopularitySort sort, int page, int perPage);
        /// <summary>
        /// List the photos with the most views, comments or favorites.
        /// </summary>
        /// <param name="date">Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. If no date is provided, all time view counts will be returned.</param>
        /// <param name="sort">The order in which to sort returned photos. Defaults to views. The possible values are views, comments and favorites. </param>
        /// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
        /// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void StatsGetPopularPhotosAsync(DateTime date, PopularitySort sort, int page, int perPage, Action<FlickrResult<PopularPhotoCollection>> callback)
        {
            CheckRequiresAuthentication();

            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.stats.getPopularPhotos");
            if (date != DateTime.MinValue) parameters.Add("date", UtilityMethods.DateToUnixTimestamp(date));
            if (sort != PopularitySort.None) parameters.Add("sort", UtilityMethods.SortOrderToString(sort));
            if (page > 0) parameters.Add("page", page.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (perPage > 0) parameters.Add("per_page", perPage.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));

            GetResponseAsync<PopularPhotoCollection>(parameters, callback);
        }
コード例 #9
0
ファイル: Flickr_Stats.cs プロジェクト: simm0n/Synchronizr
 /// <summary>
 /// List the photos with the most views, comments or favorites.
 /// </summary>
 /// <param name="sort">The order in which to sort returned photos. Defaults to views. The possible values are views, comments and favorites. </param>
 /// <returns>A list of <see cref="PopularPhoto"/> instances.</returns>
 public PopularPhotoCollection StatsGetPopularPhotos(PopularitySort sort)
 {
     return StatsGetPopularPhotos(DateTime.MinValue, sort, 0, 0);
 }
コード例 #10
0
ファイル: SearchClient.cs プロジェクト: Xwilarg/NHentaiSharp
        public static async Task <Search.SearchResult> SearchWithTagsAsync(string[] tags, int page, PopularitySort sortOption = PopularitySort.None)
        {
            string allTags = Uri.EscapeDataString(string.Join(" ", tags));

            if (string.IsNullOrEmpty(allTags))
            {
                throw new Exception.EmptySearchException();
            }
            using (HttpClient hc = new HttpClient())
                return(new Search.SearchResult(JsonConvert.DeserializeObject(await(await hc.GetAsync("https://nhentai.net/api/galleries/search?query=" + allTags + "&page=" + page + GetSortInfo(sortOption))).Content.ReadAsStringAsync())));
        }
コード例 #11
0
ファイル: SearchClient.cs プロジェクト: Xwilarg/NHentaiSharp
 /// <summary>
 /// Search with a specific tag id
 /// </summary>
 public static async Task <Search.SearchResult> SearchByTagIdAsync(int id, int page = 1, PopularitySort sortOption = PopularitySort.None)
 {
     using (HttpClient hc = new HttpClient())
         return(new Search.SearchResult(JsonConvert.DeserializeObject(await(await hc.GetAsync("https://nhentai.net/api/galleries/tagged?tag_id=" + id + "&page=" + page + GetSortInfo(sortOption))).Content.ReadAsStringAsync())));
 }
コード例 #12
0
ファイル: Flickr_StatsAsync.cs プロジェクト: liquidboy/X
 /// <summary>
 /// List the photos with the most views, comments or favorites.
 /// </summary>
 /// <param name="sort">The order in which to sort returned photos. Defaults to views. The possible values are views, comments and favorites. </param>
 /// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
 /// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100.</param>
 /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
 public async Task<FlickrResult<PopularPhotoCollection>> StatsGetPopularPhotosAsync(PopularitySort sort, int page, int perPage)
 {
     return await StatsGetPopularPhotosAsync(DateTime.MinValue, sort, page, perPage);
 }
コード例 #13
0
 /// <summary>
 /// List the photos with the most views, comments or favorites.
 /// </summary>
 /// <param name="sort">The order in which to sort returned photos.
 /// Defaults to views. The possible values are views, comments and favorites. </param>
 /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
 public void StatsGetPopularPhotosAsync(PopularitySort sort, Action <FlickrResult <PopularPhotoCollection> > callback)
 {
     StatsGetPopularPhotosAsync(DateTime.MinValue, sort, 0, 0, callback);
 }
コード例 #14
0
ファイル: Flickr_StatsAsync.cs プロジェクト: steamypassion/X
 /// <summary>
 /// List the photos with the most views, comments or favorites.
 /// </summary>
 /// <param name="sort">The order in which to sort returned photos. Defaults to views. The possible values are views, comments and favorites. </param>
 /// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
 /// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100.</param>
 /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
 public async Task <FlickrResult <PopularPhotoCollection> > StatsGetPopularPhotosAsync(PopularitySort sort, int page, int perPage)
 {
     return(await StatsGetPopularPhotosAsync(DateTime.MinValue, sort, page, perPage));
 }
コード例 #15
0
 /// <summary>
 /// List the photos with the most views, comments or favorites.
 /// </summary>
 /// <param name="sort">The order in which to sort returned photos. Defaults to views. The possible values are views, comments and favorites. </param>
 /// <returns>A list of <see cref="PopularPhoto"/> instances.</returns>
 public PopularPhotoCollection StatsGetPopularPhotos(PopularitySort sort)
 {
     return(StatsGetPopularPhotos(DateTime.MinValue, sort, 0, 0));
 }
コード例 #16
0
ファイル: Flickr_Stats.cs プロジェクト: simm0n/Synchronizr
 /// <summary>
 /// List the photos with the most views, comments or favorites.
 /// </summary>
 /// <param name="sort">The order in which to sort returned photos. Defaults to views. The possible values are views, comments and favorites. </param>
 /// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
 /// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100.</param>
 /// <returns>A list of <see cref="PopularPhoto"/> instances.</returns>
 public PopularPhotoCollection StatsGetPopularPhotos(PopularitySort sort, int page, int perPage)
 {
     return StatsGetPopularPhotos(DateTime.MinValue, sort, page, perPage);
 }
コード例 #17
0
 /// <summary>
 /// List the photos with the most views, comments or favorites.
 /// </summary>
 /// <param name="sort">The order in which to sort returned photos. Defaults to views. The possible values are views, comments and favorites. </param>
 /// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
 /// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100.</param>
 /// <returns>A list of <see cref="PopularPhoto"/> instances.</returns>
 public PopularPhotoCollection StatsGetPopularPhotos(PopularitySort sort, int page, int perPage)
 {
     return(StatsGetPopularPhotos(DateTime.MinValue, sort, page, perPage));
 }
コード例 #18
0
 public PopularPhotoCollection StatsGetPopularPhotos(DateTime? date, PopularitySort sort, int page, int perPage)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.stats.getPopularPhotos");
     if (date != null) dictionary.Add("date", date.Value.ToUnixTimestamp());
     if (sort != PopularitySort.None) dictionary.Add("sort", sort.ToString().ToLower());
     if (page != 0) dictionary.Add("page", page.ToString(CultureInfo.InvariantCulture));
     if (perPage != 0) dictionary.Add("per_page", perPage.ToString(CultureInfo.InvariantCulture));
     return GetResponse<PopularPhotoCollection>(dictionary);
 }
 /// <summary>
 /// List the photos with the most views, comments or favorites.
 /// </summary>
 /// <param name="sort">The order in which to sort returned photos. Defaults to views. The possible values are views, comments and favorites. </param>
 /// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
 /// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100.</param>
 /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
 public void StatsGetPopularPhotosAsync(PopularitySort sort, int page, int perPage, Action<FlickrResult<PopularPhotoCollection>> callback)
 {
     StatsGetPopularPhotosAsync(DateTime.MinValue, sort, page, perPage, callback);
 }
コード例 #20
0
 public PopularPhotoCollection StatsGetPopularPhotos(PopularitySort sort)
 {
     return StatsGetPopularPhotos(null, sort, 0, 0);
 }
コード例 #21
0
ファイル: UtilityMethods.cs プロジェクト: simm0n/Synchronizr
 /// <summary>
 /// Converts a <see cref="PopularitySort"/> enum to a string.
 /// </summary>
 /// <param name="sortOrder">The value to convert.</param>
 /// <returns></returns>
 public static string SortOrderToString(PopularitySort sortOrder)
 {
     switch (sortOrder)
     {
         case PopularitySort.Comments:
             return "comments";
         case PopularitySort.Favorites:
             return "favorites";
         case PopularitySort.Views:
             return "views";
         default:
             return String.Empty;
     }
 }
コード例 #22
0
 public PopularPhotoCollection StatsGetPopularPhotos(PopularitySort sort);