Beispiel #1
0
        public async Task <VimeoDotNet.Models.Paginated <VimeoDotNet.Models.Album> > AlbumleriGetirHizliAsync(int Page, string Query)
        {
            VimeoDotNet.VimeoClient client = new VimeoDotNet.VimeoClient(TokenKey.Token);
            VimeoDotNet.Parameters.GetAlbumsParameters parametreler = new VimeoDotNet.Parameters.GetAlbumsParameters();
            parametreler.Page      = Page;
            parametreler.PerPage   = 50;
            parametreler.Query     = Query;
            parametreler.Sort      = GetAlbumsSortOption.Date;
            parametreler.Direction = GetAlbumsSortDirectionOption.Desc;
            parametreler.Fields    = "name,uri";


            try
            {
                VimeoDotNet.Models.Paginated <VimeoDotNet.Models.Album> albumler = await client.GetAlbumsAsync(VimeoDotNet.Models.UserId.Me, parametreler);

                return(albumler);
            }
            catch (Exception ex)
            {
                if (client.RateLimitRemaining == 0)
                {
                    throw new Exception("Çok fazla istek nedeniyle api erişimi engellendi." + (client.RateLimitReset.AddHours(1) - System.DateTime.Now).TotalMinutes + " dakika sonra tekrar deneyiniz.");
                }
                else
                {
                    throw new Exception(ex.Message);
                }
            }
        }
 public Paginated<Album> GetAlbums(long userId, GetAlbumsParameters parameters = null)
 {
     try
     {
         return GetAlbumsAsync(userId, parameters).RunSynchronouslyWithCurrentCulture();
     }
     catch (AggregateException ex)
     {
         ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
         return null;
     }
 }