macadmins / jamf-pro-sdk-python

A client library for the Jamf Pro APIs and webhooks.
https://macadmins.github.io/jamf-pro-sdk-python/
MIT License
51 stars 10 forks source link

[Feedback] delete and update methods should return something on success #27

Closed Honestpuck closed 11 months ago

Honestpuck commented 1 year ago

Current

At the moment the delete and update methods for each endpoint are returning None regardless of success. They should return something

Proposed

I propose that api_request method return a Bool and the methods in question return the <object>_id on success for those two methods in each endpoint

    def delete_computer_by_id(self, computer: ComputerId) -> int:
        """Delete a single computer record using the ID.

        :param computer: A computer ID or supported Classic API model.
        :type computer: Union[int, ClassicComputer, ClassicComputersItem]

        """
        computer_id = ClassicApi._parse_id(computer)
       if self.api_request(method="delete", resource_path=f"computers/id/{computer_id}"):
           return computer_id
       else:
           return -1

System Information

0.4a1 Release

brysontyrrell commented 11 months ago

I'm not inclined to go this route. All API methods return objects, or none. If there were an issue with the deletion (a non-2XX status) an exception would be raised and that's how you would know there was a problem.