metricq / aiocouch

🛋 An asynchronous client library for CouchDB 2.x and 3.x
https://aiocouch.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
29 stars 10 forks source link

feat: return `HTTPResponse` from certain methods #53

Closed bmario closed 1 year ago

bmario commented 1 year ago

These methods are Document.save(), Document.delete(), and Document.copy().

Breaking change: Document.copy() does not return a Document anymore. You can use the ETag and fetch the document yourself. Rationale: For efficiency, retrieving the copied document automatically is a bad idea anyways, so returning the response instead does not seem to be an issue. If you need the document, use the ETag, which is a part of the response object, to retrieve it.

Closes #49

codecov[bot] commented 1 year ago

Codecov Report

Merging #53 (fe87e8b) into master (5a42ab9) will increase coverage by 0.04%. Report is 9 commits behind head on master. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #53      +/-   ##
==========================================
+ Coverage   97.15%   97.19%   +0.04%     
==========================================
  Files          13       13              
  Lines         950      964      +14     
==========================================
+ Hits          923      937      +14     
  Misses         27       27              
Files Changed Coverage Δ
aiocouch/__init__.py 100.00% <100.00%> (ø)
aiocouch/document.py 91.01% <100.00%> (+0.20%) :arrow_up:
aiocouch/remote.py 96.89% <100.00%> (+0.08%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

adrienverge commented 1 year ago

Thanks a lot @bmario for tackling this. We briefly tested this pull request on Document.save() and we could access the HTTP code (201 vs. 202) from Python code, as asked in https://github.com/metricq/aiocouch/issues/49. Thanks again!