internal ValueServiceModel(KeyValueDocument document) { if (document == null) { return; } this.CollectionId = document.CollectionId; this.Key = document.Key; this.Data = document.Data; this.ETag = document.ETag; this.Timestamp = document.Timestamp; }
public async Task <ValueServiceModel> GetDocumentAsync(string collectionLink, string collectionId, string key) { try { var docId = KeyValueDocument.GenerateId(collectionId, key); var response = await this.client.ReadDocumentAsync($"{collectionLink}/docs/{docId}"); return(new ValueServiceModel(response?.Resource)); } catch (Exception ex) { throw new ResourceNotFoundException($"The document at collection link {collectionLink} requested doesn't exist.", ex); } }