/// <summary> /// Delete multiple documents based on the passed document selectors. /// A document selector is either the document ID or the document Key. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="collectionName"></param> /// <param name="selectors"></param> /// <param name="query"></param> /// <returns></returns> public virtual async Task <DeleteDocumentsResponse <T> > DeleteDocumentsAsync <T>(string collectionName, IEnumerable <string> selectors, DeleteDocumentsOptions query = null, CancellationToken cancellationToken = default) { return(await DeleteRequestAsync($"{ApiRootPath}/{WebUtility.UrlEncode(collectionName)}", response => new DeleteDocumentsResponse <T>(response), query, selectors, cancellationToken)); }
/// <summary> /// Delete a document based on its document ID. /// </summary> /// <param name="documentId"></param> /// <param name="query"></param> /// <returns></returns> public virtual async Task <DeleteDocumentResponse <T> > DeleteDocumentAsync <T>(string documentId, DeleteDocumentsOptions query = null, CancellationToken cancellationToken = default) { ValidateDocumentId(documentId); return(await DeleteRequestAsync($"{ApiRootPath}/{documentId}", response => new DeleteDocumentResponse <T>(response), query, cancellationToken)); }
/// <summary> /// Delete multiple documents based on the passed document selectors. /// A document selector is either the document ID or the document Key. /// </summary> /// <remarks> /// This method overload is provided as a convenience when the client does not care about the type of <see cref="DeleteDocumentResponse{T}.Old"/> /// in the returned <see cref="DeleteDocumentsResponse{object}"/>. These will be <see cref="null"/> when /// <see cref="DeleteDocumentsOptions.ReturnOld"/> is either <see cref="false"/> or not set, so this overload is useful in the default case /// when deleting documents. /// </remarks> /// <param name="collectionName"></param> /// <param name="selectors"></param> /// <param name="query"></param> /// <returns></returns> public virtual async Task <DeleteDocumentsResponse <object> > DeleteDocumentsAsync(string collectionName, IEnumerable <string> selectors, DeleteDocumentsOptions query = null, CancellationToken cancellationToken = default) { return(await DeleteDocumentsAsync <object>(collectionName, selectors, query, cancellationToken)); }
/// <summary> /// Delete a document. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="collectionName"></param> /// <param name="documentKey"></param> /// <param name="query"></param> /// <returns></returns> public virtual async Task <DeleteDocumentResponse <T> > DeleteDocumentAsync <T>(string collectionName, string documentKey, DeleteDocumentsOptions query = null, CancellationToken cancellationToken = default) { return(await DeleteDocumentAsync <T>( $"{WebUtility.UrlEncode(collectionName)}/{WebUtility.UrlEncode(documentKey)}", query, cancellationToken)); }
/// <summary> /// Delete a document based on its document ID. /// </summary> /// <remarks> /// This method overload is provided as a convenience when the client does not care about the type of <see cref="DeleteDocumentResponse{T}.Old"/> /// in the returned <see cref="DeleteDocumentResponse{object}"/>. Its value will be <see cref="null"/> when /// <see cref="DeleteDocumentsOptions.ReturnOld"/> is either <see cref="false"/> or not set, so this overload is useful in the default case /// when deleting documents. /// </remarks> /// <param name="documentId"></param> /// <param name="query"></param> /// <returns></returns> public virtual async Task <DeleteDocumentResponse <object> > DeleteDocumentAsync(string documentId, DeleteDocumentsOptions query = null, CancellationToken cancellationToken = default) { return(await DeleteDocumentAsync <object>(documentId, query, cancellationToken)); }