Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feedback] src/jamf_pro_sdk/clients/pro_api/__init__.py may get unwieldy #30

Open
Honestpuck opened this issue Nov 1, 2023 · 1 comment
Labels
feedback Potential improvements or changes

Comments

@Honestpuck
Copy link
Contributor

Current

The current behaviour is to put all the functions for all the pro endpoints into the __init__.py file. I realise this allows calls like

ifrom jamf_pro_sdk import JamfProClient, BasicAuthProvider

client = JamfProClient(
    server="dummy.jamfcloud.com",
    credentials=BasicAuthProvider("username", "password")
)

all_computers = client.pro_api.get_computer_inventory_v1()

but when the number of endpoints gets high this file will grow to be difficult to deal with.

Proposed

I would propose that in the directory there could be a file computer_v1 which contains (among others) the function get_inventory then the call would be:

from jamf_pro_sdk import JamfProClient, BasicAuthProvider

client = JamfProClient(
    server="dummy.jamfcloud.com",
    credentials=BasicAuthProvider("username", "password")
)

all_computers = client.pro_api.computer_v1.get_inventory()

System Information

SDK version 4.0a

@Honestpuck Honestpuck added the feedback Potential improvements or changes label Nov 1, 2023
@Honestpuck
Copy link
Contributor Author

Honestpuck commented Nov 1, 2023

My second thought would be to make ProApi a derived class and make a base class for each of the endpoints in its own file. Then the calling style would stay the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback Potential improvements or changes
Projects
None yet
Development

No branches or pull requests

1 participant