API Client#

class ApiClient(config: ConfigManager, concurrency: int)[source]#

Provides methods for interacting with the Jamf API, specifically fetching patch data, device information, and OS versions.

Note

All methods of the ApiClient class will raise an APIResponseError if the API call is unsuccessful.

Parameters:
  • config (ConfigManager) – Instance of ConfigManager for loading and storing credentials.

  • concurrency (int) – Maximum number of concurrent API requests. See concurrency in Usage docs.

async get_policies() List[str][source]#

Retrieves a list of patch software title IDs from the Jamf API.

Returns:

A list of software title IDs.

Return type:

List [str]

async get_summaries(policy_ids: List[str]) List[PatchTitle][source]#

Retrieves patch summaries asynchronously for the specified policy IDs from the Jamf API.

Parameters:

policy_ids (List [str]) – List of policy IDs to retrieve summaries for.

Returns:

List of PatchTitle objects containing patch summaries.

Return type:

List [PatchTitle]

async get_device_ids() List[int][source]#

Asynchronously fetches the list of mobile device IDs from the Jamf Pro API.

Note

This method is only called if the iOS option is passed to the CLI.

Returns:

A list of mobile device IDs.

Return type:

List [int]

async get_device_os_versions(device_ids: List[int]) List[Dict[str, str]][source]#

Asynchronously fetches the OS version and serial number for each device ID provided.

Note

This method is only called if the iOS option is passed to the CLI.

Parameters:

device_ids (List [int]) – A list of mobile device IDs to retrieve information for.

Returns:

A list of dictionaries containing the serial numbers and OS versions.

Return type:

List [Dict]

async get_app_names(patch_titles: List[PatchTitle]) List[Dict[str, Any]][source]#

Fetches all possible app names for each PatchTitle object provided.

Parameters:

patch_titles (List [PatchTitle]) – List of PatchTitle objects.

Returns:

List of dictionaries containing the PatchTitle title and corresponding appName

Return type:

List [Dict]

async get_sofa_feed() List[Dict[str, str]][source]#

Fetches iOS Data feeds from SOFA and extracts latest OS version information.

To limit the amount of possible SSL verification checks, this method utilizes a subprocess call instead.

Note

This method is only called if the iOS option is passed to the CLI.

Returns:

A list of dictionaries containing base OS versions, latest iOS versions, and release dates.

Return type:

List [Dict]

Raises:

APIResponseError – If return code from SOFA is non-zero.