Decorators#
- check_token(func: Callable) Any[source]#
Decorator that ensures the validity of an
AccessTokenbefore executing a function.The
check_tokendecorator performs several key tasks before the decorated function is executed:It validates the configuration of the token manager’s client.
It checks if the current access token is valid. If the token is invalid, it attempts to refresh the token.
This decorator is intended for use with asynchronous methods that require a valid and sufficiently long-lived access token to interact with the Jamf API.
- Parameters:
func (
Callable) – The asynchronous function to be decorated.- Returns:
The result of the decorated function.
- Return type:
- Raises:
TokenError – If the AccessToken fails validation (is invalid), if refresh fails or returns
None.