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

Add Packages to Pro API, and a few Typing Enhancements #54

Merged
merged 14 commits into from
Nov 11, 2024

Conversation

macserv
Copy link

@macserv macserv commented Nov 4, 2024

Pro Package API

  • Add Pro API Package model.
  • Add ProApi.get_packages_v1() with overloads.
  • Add allowed sort & filter fields for Package request.
  • Update documentation for Package model.
  • Add integration tests for Package model.

Typing Enhancements

  • Add files parameter to pro_api_request() (create policies with icons!)
  • Add overloads for get_computer_inventory_v1().
  • Resolve type-checking issues when package is installed as editable.
  • Resolve several other miscellaneous type-checking issues.

@brysontyrrell brysontyrrell self-requested a review November 5, 2024 00:43
@brysontyrrell brysontyrrell added the enhancement New feature or request label Nov 5, 2024
@brysontyrrell
Copy link
Collaborator

Can you discuss the inclusion of overloads? I'm not seeing the value they're bringing to the two interfaces you've implemented them with.

@macserv
Copy link
Author

macserv commented Nov 5, 2024

Sure! It allows the type checker to infer what will be returned by the method, based on whether or not pagination is being used. This doesn't do much within the API itself, but it improves the ergonomics of code that consumes the SDK.

@brysontyrrell
Copy link
Collaborator

Sure! It allows the type checker to infer what will be returned by the method, based on whether or not pagination is being used. This doesn't do much within the API itself, but it improves the ergonomics of code that consumes the SDK.

Not two minutes after I sent that did it click that it made the return type deterministic.

...I am not against this. I'd want to get it added to the remaining Pro API methods though and included in the dev docs as a part of the style guide.

@brysontyrrell
Copy link
Collaborator

This is an overall very solid PR with good enhancements. 🎉

…nventory_v2``.

Update ``get_packages_v1()`` documentation to correct entity name.
Update ``get_mdm_commands_v2()`` documentation to correct entity name.
Insert section heading comments for consistency in ``pro_api/__init__.py``
@macserv
Copy link
Author

macserv commented Nov 5, 2024

I'd want to get [overloads] added to the remaining Pro API methods…

Overloads added to other Pro API methods.

@macserv
Copy link
Author

macserv commented Nov 5, 2024

I'd want to get [overloads] … included in the dev docs as a part of the style guide.

Updated contributors/index.rst to specify that @overload interfaces should be provided for methods with dynamic return types. Also added recommendation to use Optional[] for types where value can be None.

@macserv macserv requested a review from brysontyrrell November 6, 2024 23:38
@brysontyrrell brysontyrrell merged commit aebf442 into macadmins:main Nov 11, 2024
1 of 2 checks passed
@macserv macserv deleted the feature/add-pro-packages branch November 11, 2024 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants