public static CollectionHeader ConvertToCollectionHeader(this _CollectionResult collection) { return(new CollectionHeader { StatusCode = (int)HttpStatusCode.OK, TotalItems = collection.TotalItems, PublishedDate = collection.PublishedDate.GetSafeDateTime(), TermsOfUse = collection.TermsOfUse, Items = ConvertItems(collection.Items), ErrorMessage = collection.ErrorMessage }); }
public async Task <CollectionHeader> GetUserCollection(string user, CollectionQueryOption option, RetrySettings retrySettings) { string uri = $"{Endpoints.GET_COLLECTION}/{user}"; string queryString = option.ConvertToQueryString(); if (!string.IsNullOrEmpty(queryString)) { uri = $"{uri}?{queryString}"; } HttpResponseMessage resp = await xmlRestClient.GetWithRetryAsync(uri, retrySettings); if (resp.StatusCode != HttpStatusCode.OK) { return(new CollectionHeader { StatusCode = (int)resp.StatusCode }); } _CollectionResult result = await resp.Content.DeserializeXml <_CollectionResult>(); return(result.ConvertToCollectionHeader()); }