public async Task <HttpResponseMessage> UpsertAsync(string databaseId, string collectionId, dynamic document, string partitionKey) { CosmosDbResourceType resourceType = CosmosDbResourceType.docs; string resourceId = $"{CosmosDbResourceType.dbs}/{databaseId}/{CosmosDbResourceType.colls}/{collectionId}"; string resourceLink = $"{resourceId}/{resourceType}"; string authToken = this.AuthTokenCreator.GenerateAuthToken(HttpMethod.Post, resourceType, resourceId, this.CosmosDbKey, this.UtcDate); return(await ProcessUpsertAsync(authToken, resourceLink, document, partitionKey)); }
public async Task <HttpResponseMessage> ListDocumentsAsync(string databaseId, string collectionId) { CosmosDbResourceType resourceType = CosmosDbResourceType.docs; string resourceId = $"{CosmosDbResourceType.dbs}/{databaseId}/{CosmosDbResourceType.colls}/{collectionId}"; string resourceLink = $"{resourceId}/{resourceType}"; string authToken = this.AuthTokenCreator.GenerateAuthToken(HttpMethod.Get, resourceType, resourceId, this.CosmosDbKey, this.UtcDate); return(await ProcessAsync(authToken, resourceLink)); }
public async Task <HttpResponseMessage> GetDocumentAsync(string databaseId, string collectionId, string documentId, string partitionKey) { CosmosDbResourceType resourceType = CosmosDbResourceType.docs; string resourceId = $"{CosmosDbResourceType.dbs}/{databaseId}/{CosmosDbResourceType.colls}/{collectionId}/{CosmosDbResourceType.docs}/{documentId}"; string resourceLink = resourceId; string authToken = this.AuthTokenCreator.GenerateAuthToken(HttpMethod.Get, resourceType, resourceId, this.CosmosDbKey, this.UtcDate); return(await ProcessPointReadAsync(authToken, resourceLink, partitionKey)); }
public async Task <HttpResponseMessage> GetDatabaseAsync(string databaseId) { CosmosDbResourceType resourceType = CosmosDbResourceType.dbs; string resourceId = $"{resourceType}/{databaseId}"; string resourceLink = resourceId; string authToken = this.AuthTokenCreator.GenerateAuthToken(HttpMethod.Get, resourceType, resourceId, this.CosmosDbKey, this.UtcDate); return(await ProcessAsync(authToken, resourceLink)); }