Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }