Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
fix: device uses config profile, unit tests, fetch computer groups
Browse files Browse the repository at this point in the history
  • Loading branch information
Bharatkk-metron committed Jun 19, 2024
1 parent b3c6f80 commit 53ecae1
Show file tree
Hide file tree
Showing 9 changed files with 1,317 additions and 1,361 deletions.
15 changes: 15 additions & 0 deletions src/jamf/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Computer,
ComputerDetail,
ComputerDetailResponse,
ComputerGroup,
ComputerResponse,
Configuration,
Group,
Expand Down Expand Up @@ -54,6 +55,7 @@ export interface IJamfClient {
fetchMobileDevices(): Promise<MobileDevice[]>;
fetchMobileDeviceById(id: number): Promise<MobileDeviceDetail>;
fetchComputers(): Promise<Computer[]>;
fetchComputerGroups(): Promise<ComputerGroup[]>;
fetchComputerById(id: number): Promise<ComputerDetail>;
fetchComputerApplicationByName(name: string): Promise<ApplicationDetail>;
fetchOSXConfigurationProfiles(): Promise<Configuration[]>;
Expand Down Expand Up @@ -301,6 +303,19 @@ export class JamfClient implements IJamfClient {
return result.computers;
}

/**
* Requires "Read - Computers" permission
*/
public async fetchComputerGroups(): Promise<ComputerGroup[]> {
const result = await this.makeRequest<any>(
this.getResourceUrl('/computergroups'),
Method.GET,
{},
);

return result.computer_groups;
}

/**
* Requires "Read - Computers" permission
*/
Expand Down
6 changes: 6 additions & 0 deletions src/jamf/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ export interface Computer {
report_date_epoch: number;
}

export interface ComputerGroup {
id: number;
name: string;
is_smart: boolean;
}

export interface ComputerDetail {
general: {
id: number;
Expand Down
Loading

0 comments on commit 53ecae1

Please sign in to comment.