Пример #1
0
        public async Task <RestItemData> GetDataAsync(IEnumerable <string> fieldNames)
        {
            using (HttpClient client = HttpClientCreator.Create())
            {
                var fullUri = UriUtilities.AppendQueryString(Path, GetFieldNamesQueryString(fieldNames));
                HttpResponseMessage response = await client.GetAsync(fullUri);

                return(await Serializer.DeserializeAsync <RestItemData>(response));
            }
        }
        public async Task <Acknowledgment> DeleteAllAsync(IRestCollectionQuery query)
        {
            using (HttpClient client = HttpClientCreator.Create())
            {
                var    queryStringBuilder = new CollectionQueryStringBuilder(new CollectionQueryStringConfiguration());
                string fullUrl            = UriUtilities.AppendQueryString(Path, queryStringBuilder.BuildString(query));

                HttpResponseMessage response = await client.DeleteAsync(fullUrl);

                Acknowledgment acknowledgment = await EnsureSuccessAsync(response);

                return(acknowledgment);
            }
        }
        public async Task <RestCollectionData> QueryDataAsync(IRestCollectionQuery query)
        {
            using (HttpClient client = HttpClientCreator.Create())
            {
                var    queryStringBuilder = new CollectionQueryStringBuilder(new CollectionQueryStringConfiguration());
                string fullUrl            = UriUtilities.AppendQueryString(Path, queryStringBuilder.BuildString(query));

                HttpResponseMessage response = await client.GetAsync(fullUrl);

                var queriedData = await Serializer.DeserializeAsync <IEnumerable <RestItemData> >(response);

                return(new RestCollectionData(queriedData, null)); // TODO: fill page details
            }
        }