gtalarico / pyairtable

Python Api Client for Airtable
https://pyairtable.readthedocs.io
MIT License
784 stars 138 forks source link

Model.save() returns SaveResult instead of bool #387

Closed mesozoic closed 1 month ago

mesozoic commented 2 months ago

There is more context about a save operation that might be useful to a caller than just "was a record created?" especially now that #381 has been merged. This branch introduces a new class SaveResult which contains all the context on what happened during the save operation.

For backwards compatibility with the prior behavior of Model.save(), instances of SaveResult behave truthy if the record was created and falsy if the record was not created (though this will emit a deprecation warning). Applications which perform type checking may still require some changes.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (4c87441) to head (cacd0a5). Report is 4 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #387 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 28 28 Lines 2895 2910 +15 ========================================= + Hits 2895 2910 +15 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.