예제 #1
0
        public async Task ListCollectionsTest()
        {
            var client         = new UnsplasharpClient(Credentials.ApplicationId);
            var listCollection = await client.ListCollections();

            var listCollectionPaged = await client.ListCollections(2);

            Assert.IsNotNull(listCollection);
            Assert.IsNotNull(listCollectionPaged);

            Assert.IsTrue(listCollection.Count > 0);
            Assert.IsTrue(listCollectionPaged.Count > 0);
        }
예제 #2
0
        public async Task GetCollectionTest()
        {
            var client         = new UnsplasharpClient(Credentials.ApplicationId);
            var listCollection = await client.ListCollections();

            var collection = await client.GetCollection(listCollection[0].Id);

            Assert.IsNotNull(collection);
        }
예제 #3
0
        public async Task ListRelatedCollectionsTest()
        {
            var client         = new UnsplasharpClient(Credentials.ApplicationId);
            var listCollection = await client.ListCollections();

            var collectionsRelated = await client.ListRelatedCollections(listCollection[0].Id);

            Assert.IsNotNull(collectionsRelated);
            Assert.IsTrue(collectionsRelated.Count > 0);
        }
예제 #4
0
        public async Task GetCollectionPhotosTest()
        {
            var client         = new UnsplasharpClient(Credentials.ApplicationId);
            var listCollection = await client.ListCollections();

            var collection = await client.GetCollection(listCollection[0].Id);

            var listPhotos = await client.GetCollectionPhotos(collection.Id);

            Assert.IsNotNull(listPhotos);
            Assert.IsTrue(listPhotos.Count > 0);
        }
예제 #5
0
        public async Task <List <CollectionModel> > GetSearchData()
        {
            List <CollectionModel> collectionList =
                new List <CollectionModel>();

            var client      = new UnsplasharpClient(App.ServiceId);
            var collections = await client.ListCollections(1, 25);

            foreach (var collection in collections)
            {
                var newCollection = new CollectionModel
                {
                    CollectionId = collection.Id,
                    Title        = collection.Title,
                    Url          = collection.CoverPhoto.Urls.Small,
                    Description  = collection.Description,
                    Likes        = collection.CoverPhoto.Likes
                };

                collectionList.Add(newCollection);
            }

            return(collectionList);
        }
예제 #6
0
        public async Task <IEnumerable <Models.Collection> > ListCollections(int page, int pageSize)
        {
            var listCollectionsPaged = await _client.ListCollections(page, pageSize);

            return(_mapper.Map <IEnumerable <Unsplasharp.Models.Collection>, IEnumerable <Models.Collection> >(listCollectionsPaged));
        }