Skip to main content
Module

x/jamf_school/mod.ts>Client

A simple, secure, correct, and modern Jamf School API wrapper. (Unofficial)
Latest
interface Client
Re-export
import { type Client } from "https://deno.land/x/jamf_school@0.5.0/mod.ts";

A high-level abstraction over the Jamf School API that allows you to reason about it as returning objects with methods, instead of raw data.

As the implementations of these objects are not public, instance checks must be done using the type property on each object.

Lower-level actions can be done using an API object. This data can be upgraded to an object using one of the "create" methods on your Client.

Properties

readonly
type: "Client"

Discriminator for type checks.

Methods

createDevice(data: APIData["getDevices"][number]): Device

Create a device object with data from the API.

If you don't already have the data, you may want getDeviceById, getDeviceBySerialNumber, or getDevices.

createDeviceGroup(data: APIData["getDeviceGroup"]): DeviceGroup

Create a device group object with data from the API.

If you don't already have the data, you may want getDeviceGroupById or getDeviceGroups.

createUser(data: APIData["getUser"]): User

Create a user object with data from the API.

If you don't already have the data, you may want getUserById or getUsers.

createApp(data: APIData["getApps"][number]): App

Create an app object with data from the API.

If you don't already have the data, you may want getApps.

createLocation(data: APIData["getLocation"]): Location

Create a site object with data from the API.

If you don't already have the data, you may want getLocations.

createUserGroup(data: APIData["getUserGroup"]): UserGroup

Create a user group object with data from the API.

If you don't already have the data, you may want getUserGroupById or getUserGroups.

createProfile(data: APIData["getProfile"]): Profile

Create a profile object with data from the API.

If you don't already have the data, you may want getProfileById or getProfiles.

getUserById(id: number): Promise<User | null>

(Read) Get a single user by their ID.

getUserByName(name: string): Promise<User | null>

(Read) Get a single user by name.

getUserByUsername(username: string): Promise<User | null>

(Read) Get a single user by username.

getUsers(): Promise<User[]>

(Read) Get all users.

getUserGroupById(id: number): Promise<UserGroup | null>

(Read) Get a single user group by its ID.

getUserGroupByName(name: string): Promise<UserGroup | null>

(Read) Get a single user group by its name.

getUserGroups(): Promise<UserGroup[]>

(Read) Get all user groups.

getDeviceById(udid: string): Promise<Device | null>

(Read) Get a single device by its UDID.

getDeviceBySerialNumber(serialNumber: string): Promise<Device | null>

(Read) Get a single device by its serial number.

getDevices(): Promise<Device[]>

(Read) Get all devices.

getDevicesInGroups(deviceGroups: { id: number; }[]): Promise<Device[]>

(Read) Get all devices in the given groups, without duplicates.

If a device is in more than one of the groups, it is only included once.

const groups = await Promise.all([
  client.getDeviceGroupById(2),
  client.getDeviceGroupById(3),
  client.getDeviceGroupById(4),
]);

const devices = await client.getDevicesInGroups(groups);

If you already know the IDs of the groups to use, you can skip requesting the device group objects by using object literals.

const devices = await client.getDevicesInGroups([
  { id: 2 },
  { id: 3 },
  { id: 4 },
])
getDeviceGroupById(id: number): Promise<DeviceGroup | null>

(Read) Get a single device group by its ID.

getDeviceGroupByName(name: string): Promise<DeviceGroup | null>

(Read) Get a single device group by its name.

getDeviceGroups(): Promise<DeviceGroup[]>

(Read) Get all device groups.

getApps(): Promise<App[]>

(Read) Get all the apps registered to this Jamf School instance.

getAppById(id: number): Promise<App | null>

(Read) Get a single app by its Jamf School ID.

getAppByBundleId(bundleId: string): Promise<App | null>

(Read) Get a single app by its bundle identifier

If no apps with the given bundle ID exist, it returns null. If more than one exists, an error is thrown.

For example, "com.agilebits.onepassword-ios"

getAppByName(name: string): Promise<App | null>

(Read) Get a single app by its name.

If no apps with the name exist, it returns null. If more than one app exists, an error is thrown.

getLocations(): Promise<Location[]>

(Read) Get all locations.

getLocationById(id: number): Promise<Location | null>

(Read) Get a location by its ID.

getLocationByName(name: string): Promise<Location | null>

(Read) Get a location by its name.

getProfiles(): Promise<Profile[]>

(Read) Get all profiles.

getProfileById(id: number): Promise<Profile | null>

(Read) Get a profile by its ID.

getProfileByName(name: string): Promise<Profile | null>

(Read) Get a profile by its name.