Exemple #1
0
        public async Task <SearchResult <T> > SearchAsync <T>(CancellationToken cancellationToken, IEnumerable <ISearchFilter> searchFilters = null, string orderByProperty = null, OrderByDirection?orderByDirection = null, int?skip = null, int?limit = null, int?includeLevels = null) where T : IContentfulItem, new()
        {
            var endpointUrl = RestEndpointResolver.GetEndpointUrl <T>(_space);
            var requestUrl  = GetRequestUrl(endpointUrl, null, searchFilters, orderByProperty, orderByDirection, skip, limit);
            var result      = await MakeGetRequestAsync(requestUrl, cancellationToken);

            return(await GetItemAsync <SearchResult <T> >(result));
        }
Exemple #2
0
        public async Task <T> GetAsync <T>(CancellationToken cancellationToken, string id) where T : IContentfulItem, new()
        {
            var endpointUrl = RestEndpointResolver.GetEndpointUrl <T>(_space);
            var requestUrl  = GetRequestUrl(endpointUrl, id);
            var result      = await MakeGetRequestAsync(requestUrl, cancellationToken);

            return(await GetItemAsync <T>(result));
        }