A Jamf Classic communication framework written in Swift

Overview

JamfKit

JamfKit

Swift iOS macOS tvOS

Travis branch Codecov Codacy grade Carthage compatible CocoaPods

JamfKit is an iOS / macOS / tvOS framework to communicate with the JSS API offered by any Jamf host.

Summary

Features

  • Includes JSON encoding / decoding support for most of the JSS objects
  • Includes Objective-C support
  • Includes Swift 5+ support
  • Includes ready-for-consumption CRUD URLRequest for JSS endpoints
  • Includes demonstration playgrounds for class handling or request generation

Installation

Carthage

To integrate JamfKit into your project, add the following line in your Cartfile:

github "Ethenyl/JamfKit"

Then run the following command:

$ carthage update

Cocoapods

To integrate JamfKit into your project, add the following line in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'JAMFKit'
end

Then run the following command:

$ pod install

Architecture

Protocols

Protocol Description
Endpoint Represents any JSS object that is matched by a JSS endpoint.
Identifiable Represents any JSS object that can be identified (either by ID or by name).
Requestable Represents an object that can be used to perform requests with any JSS endpoint.
Subset Represents any JSS object that contains a general object that can identify it.

Requestable conformance

The class that conform to Requestable exposes the following elements:

  • An failable initializer that takes a JSON payload and return the instantiated object
  • A function to return the JSON payload that represents the instance of the object

Classes

Class Desscription
BaseObject Represents the common denominator between most of the JSS objects which must contains at least an identifier and a name properties.
Building Represents a physical building.
Computer Represents a computer managed by Jamf, contains the general / location / purchasing information about the hardware.
ComputerCommand Represents a logical command that can be executed on any hardware element manageg by Jamf.
ComputerConfigurationProfile Represents a logical configuration profile that can be applied to any computer managed by Jamf.
ComputerGroup Represents a group of computers managed by Jamf, contains grouping information.
Department Represents a physical department.
DirectoryBinding Represents a logical binding between a computer and an active directory user.
MobileDeviceConfigurationProfile Represents a logical configuration profile that can be applied to any mobile device managed by Jamf.
MobileDevice Represents a mobile device managed by Jamf, contains the general information about the device.
MobileDeviceGroup Represents a group of mobile devices managed by Jamf, contains grouping information.
NetbootServer Represents a physical netboot server, contains information about the server and it's configuration.
NetworkSegment Represents a physical network segment, contains information about the segment and it's configuration.
Package Represents a logical application package, contains information about the application requirements and capabilities.
Partition Represents a logical partition for an hard drive installed inside an hardware element managed by Jamf.
Policy Reprents as logical policy that can be applied to any hardware element managed by Jamf.
PreciseDate Represents a logical date within JSS api, contains 3 properties, the date itself, an epoch variant of the date and an UTC version of the date.
Printer Represents a physical printer, contains information about the printer and it's configuration.
Script Represents a logical script that can be executed on one (or more) machine managed by Jamf.
Site Represents a physical location (building, office, etc.).
SMTPServer Represents the physical SMTP server configuration.
User Represents a Jamf user and contains the identification properties that are required to contact the actual user and identify the hardware devices assigned to him / her.

Usage

Getting started

Playgrounds

To get a quick look on how you can use JamfKit in your Jamf related features, you can check the Playgrounds included within the workspace.

Also check the unit tests, they should cover most of your needs.

Models

Most of the classes can be initialized with the bare minimul values, all the properties are then available for modification.

Requests

By adhering to the different CRUD protocols (Creatable, Readable, Updatable & Deletable), most of the JSS objects listed above are capable of supplying varying URLRequest that should fit any needs.

You'll find below the basic functions to get URLRequest:

Function Type HTTP Method Example Output
createRequest() instance POST building.createRequest() http://jss.host/jss/objects/1
readAllRequest() static GET Building.readAllRequest() http://jamf.com/jss/objects
readRequest(identifier:) static GET Building.readRequest(identifier: "12345") http://jamf.com/jss/objects/1
readRequest() instance GET building.readRequest() http://jamf.com/jss/objects/1
updateRequest() instance PUT building.updateRequest() http://jamf.com/jss/objects/1
deleteRequest(identifier:) static DELETE Building.deleteRequest(identifier: "12345") http://jamf.com/jss/objects/1
deleteRequest() instance DELETE building.deleteRequest() http://jamf.com/jss/objects/1

Some objects will offer variants of those requests, like MobileDevice with readRequestWithName() or deleteRequestWithSerialNumber() (with both static and instance variants).

Contributing

So, you want to help improve JamfKit? That's great! Any useful contribution is welcome!

Check CONTRIBUTING for more details on how you can contribute to JamfKit.

Code of conduct

Any contributions (issues, pull requests, comments, etc.) to JamfKit are more than welcome.

But before making any contribution, please make sure that you follow the CODE OF CONDUCT.

Otherwise, there's a great chance that your contribution will be removed / blocked / hidden.

FAQ

None for the moment.

Credits

JamfKit is owned and maintained by Ethenyl.

You can join the list by contributing to the repository.

License

JamfKit is released under the MIT license. See LICENSE for more details.

Comments
  • tvOS Compatibility

    tvOS Compatibility

    Missing functionnality

    Hi 👋 ,

    Looking to please request tvos compatibility to pull in data from our Jamf instance to Apple TV Dashboard.

    Platform syntax in podfile: platform :tvos, '10.0'

    pod install returns:

    [!] The platform of the target `Dashboard` (tvOS 10.0) is not compatible with `JAMFKit (0.3.0)`, which does not support `tvos`

    Thank you! :)

    Miscellaneous

    Information | Value | ------------------------------|------------------------------| Language | Swift Platform | tvOS Platform version | 10.0 JamfKit version | latest as of March 3rd 2018 Package manager | CocoaPods Package manager version | 1.3.1 XCode version | 9.2

    Feature 
    opened by jeffreyjbrown 2
  • Allow users to perform request(s) against the configured Jamf host

    Allow users to perform request(s) against the configured Jamf host

    New feature

    Short description

    Users of JamfKit can make the request toward the Jamf host on their own accord and simply pass the extracted JSON with the objects supplied by JamfKit to obtain instances of these.

    But, to ease the development process, JamfKit can also supply the output of the request needed for each single object.

    Missing functionnality

    Users should be able to configure the current Jamf host parameters which are going to be used to preconfigure the URLRequest used by JamfKit.

    Once the host configuration is fully completed (host, port, username, password) a singleton will allow users to retrieve the following for each type of object:

    • the fully configured (verb, url, headers, parameters, body) URLRequest for performing a request with the framework of their choice (they'll take care of parsing the result)
    • the output of the same request, everything related to JSON deserialization is taken care of, the result could be a single object, some objects or simply an error

    Implementation

    First off, JamfKit needs to supply a way of configuring the host, this can be done through a Singleton.

    Once configuration is done, the same manager can supply different types of request based on each JSS objects (some endpoints are read-only, others are CRUD ready) for the users to consume with the framework of their choice (AFNetworking, Moya, Alamofire, NSURLSession, etc.).

    The library could also perform NSURLSession requests for the user and simply return the instances of the objects that are expected from the request or an error if something went wrong.

    Feature 
    opened by Ethenyl 2
  • Improve Building model

    Improve Building model

    Short description

    The Building model is out of sync with the Jamf Pro API object.

    Missing functionnality

    Some fields are missing and must be implemented in order to comply with the API.

    Feature 
    opened by Ethenyl 1
  • Implement ConfigurationProfiles (MobileDevice / OSX)

    Implement ConfigurationProfiles (MobileDevice / OSX)

    Missing functionality

    The two following configuration profiles are missing from the models:

    • MobileDeviceConfigurationProfile
    • OSXConfigurationProfile

    Miscellaneous

    Mobile device

    {
        "general": {
            "id": 0,
            "name": "Corporate Wireless",
            "description": "string",
            "site": {
                "id": 0,
                "name": "None"
            },
            "category": {
                "id": 0,
                "name": "string",
                "priority": 0
            },
            "uuid": "55900BDC-347C-58B1-D249-F32244B11D30",
            "deployment_method": "Install Automatically",
            "redeploy_on_update": "Newly Assigned",
            "redeploy_Dayss_before_certificate_expires": 0,
            "payloads": "string"
        }
    }
    

    OSX

    {
        "general": {
            "id": 12345,
            "name": "Corporate Wireless",
            "description": "string",
            "site": {
                "id": 0,
                "name": "None"
            },
            "category": {
                "id": 0,
                "name": "string",
                "priority": 0
            },
            "distribution_method": "Install Automatically",
            "user_removable": true,
            "level": "computer",
            "uuid": "88F8C1DB-D92A-4D10-95FB-CE7EDE82B93E",
            "redeploy_on_update": "Newly Assigned",
            "payloads": "string"
        }
    }
    
    Feature 
    opened by Ethenyl 1
  • Add basic support for generating requests

    Add basic support for generating requests

    Summary

    Implement the functions that will return URLRequests for all requestable objects.

    Implements #70 and #71.

    Miscellaneous

    Supports Objective-C meaning that each single object will implement the public version of each function but under the hood, the generic functions will be used. 😭

    Supports CREATE, READ, UPDATE & DELETE methods.

    Feature 
    opened by Ethenyl 1
  • Rework models to follow Protocol Oriented Programming paradigm

    Rework models to follow Protocol Oriented Programming paradigm

    Short description

    To improve maintainability & cleanliness, the models needs to be reworked in a Protocol Oriented Programming way.

    Implementation

    Most of the classes inherits from BaseObject class or Identifiable protocol which is kind of messy. All the classes should adopt protocols instead of inheriting other classes.

    Task 
    opened by Ethenyl 1
  • Provide URLRequest for JSS endpoints

    Provide URLRequest for JSS endpoints

    New feature

    Short description

    Once the SessionManager is fully configured, it should be possible to retrieve URLRequests for all the models supported by JamfKit.

    Missing functionnality

    The SessionManager should be able to produce URLRequest that can be used by any user against the network communication framework of their choice.

    Those requests should be available for the 4 methods currently supported by JSS:

    • PUT
    • GET
    • POST
    • DELETE

    Implementation

    TBD

    Feature 
    opened by Ethenyl 1
  • Add Jamf host configuration

    Add Jamf host configuration

    Summary

    Implements #64 by adding the basic element needed for configuring the URLRequest that will be returned / used later on by the framework.

    Miscellaneous

    Added SessionManager. Added base request creation. Added base errors.

    Feature 
    opened by Ethenyl 1
  • Allow users to configure the Jamf host to perform request(s) against

    Allow users to configure the Jamf host to perform request(s) against

    New feature

    Short description

    Required by #63.

    Implementation

    Supply the users with a simple mean of configuring the Jamf host to target for JamfKit.

    This will be used later to output URLRequest or to perform them directly.

    Feature 
    opened by Ethenyl 1
  • Add Objective-C interoperability

    Add Objective-C interoperability

    Implements #33.

    Splitted ComputerCommandGeneral from ComputerCommand. Added @objc on public properties. Refactored description properties to rely on class type instead of manual type.

    Feature 
    opened by Ethenyl 1
  • Rework PreciseDate JSON serialisation

    Rework PreciseDate JSON serialisation

    Context

    The PreciseDate class has been constructed to mimic the same behaviour as JSS payload when it comes to dates.

    By acception a base key name, it allows the reconstruction of the 3 original keys for any date, like that:

    {
        "example_date": "XXX",
        "example_date_epoch": 0,
        "example_date_utc": "XXX+0500"
    }
    

    If those keys were embedded in a single key it would have been much more simple to reconstruct the json before sending it to JSS.

    An updated payload:

    {
        "example_date": {
            "date": "XXX",
            "epoch": 0,
            "utc": "XXX+0500"
        }
    }
    

    Which in turn would improve the injection of each date in any JSON payload.

    How it's currently done:

    if let exampleDate = exampleDate {
        json.merge(exampleDate.toJSON()) { (_, new) in new }
    }
    

    Currently, this solution is problematic since the test coverage can't make it inside the block.

    Issue

    Find a better way of generating / injecting any date's JSON into another JSON payload.

    Feature 
    opened by Ethenyl 0
  • Implement Swift 4's Codable protocol for JSON handling

    Implement Swift 4's Codable protocol for JSON handling

    Already gave it a try, pretty frustrating since there's a lot of unconventional JSS objects that are complex to translate into Codable objects.

    Still worth a try, maybe some hybrid solution could be nice but it might be confusing to some.

    Feature 
    opened by Ethenyl 0
Releases(0.3.3)
  • 0.3.3(Jun 10, 2019)

  • 0.3.2(Oct 29, 2018)

  • 0.3.1(Apr 29, 2018)

  • 0.3.0(Mar 13, 2018)

    What's new

    Added

    • Added the possibility of configuring the Jamf host to target for generated URLRequest [#64]
    • Added the possibility to generate URLRequest [#70]
    • Implemented Computer configuration profile and Mobile device configuration profile models [#73]

    Modified

    • Reworked objects with protocol composition [#71]
    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Mar 13, 2018)

    What's new

    Added

    • Implemented Building model [#2]
    • Implemented Computer model [#3]
    • Implemented Department model [#4]
    • Implemented Mobile device model [#5]
    • Implemented Policy model [#6]
    • Implemented Printer model [#7]
    • Implemented Mobile device group model [#24]
    • Implemented Netboot server model [#25]
    • Implemented Network segment model [#26]
    • Implemented Package model [#27]
    • Implemented SMTP server model [#28]
    • Implemented computer command model [#29]
    • Implemented Computer configuration model [#30]
    • Implemented Computer group model [#31]
    • Implemented Objective-C compatibility [#33]
    • Implemented Directory binding model [#45]
    • Implemented Script model [#46]
    • Implemented Partition model [#47]

    Modified

    • Renamed solution to JamfKit (was JAMFKit previously) [#37]
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Mar 13, 2018)

    What's new

    Added

    • Implemented Account model [#1]
    • Implemented Site model [#8]
    • Implemented User model [#9]
    • Implemented Base object [#10]
    • Implemented Hardware model [#19]
    • Added CocoaPods compatibility [#16]
    Source code(tar.gz)
    Source code(zip)
Owner
Damien R.
Senior Software Engineer @Ogury.
Damien R.
Pokeapi wrapper, written in Swift

PokemonKit What is this? PokemonKit is a swift wrapper for Pokeapi. PokemonKit use Alamofire and PromiseKit for async web requests handling. Usage imp

Continuous Learning 105 Nov 16, 2022
An Elegant Spotify Web API Library Written in Swift for iOS and macOS

Written in Swift 4.2 Spartan is a lightweight, elegant, and easy to use Spotify Web API wrapper library for iOS and macOS written in Swift 3. Under th

Dalton Hinterscher 107 Nov 8, 2022
An Elegant Financial Markets Library Written in Swift

Notice As of May 20th, 2017, it appears that Yahoo is dropping support for a few features that BigBoard supports or there is an outage on their end ca

Dalton Hinterscher 66 Dec 7, 2022
Instagram API client written in Swift

SwiftInstagram is a wrapper for the Instagram API written in Swift. It allows you to authenticate users and request data from Instagram effortlessly.

Ander Goig 579 Dec 31, 2022
Questrade API written in Swift.

QuestradeAPI Getting Started The QuestAPI is made up of two main concepts: ResponseProviders API ResponseProviders The job of the provider is to retur

Eli Slade 2 Mar 15, 2022
👤 Framework to Generate Random Users - An Unofficial Swift SDK for randomuser.me

RandomUserSwift is an easy to use Swift framework that provides the ability to generate random users and their accompanying data for your Swift applic

Wilson Ding 95 Sep 9, 2022
Swift 3 framework for accessing data in Event Registry (http://eventregistry.org/)

PPEventRegistryAPI Swift 3 framework for accessing data in Event Registry (http://eventregistry.org/) Supported API calls Log In Get Event By Identifi

Pavel Pantus 8 Nov 1, 2016
iOS/macOS Cross-platform Ark-Ecosystem Framework in Swift | Powered by Ѧrk.io |

a macOS & iOS Swift Framework for Ark.io. What is ARKKit? ARKKit is wrapper for interacting with the Ark Ecosystem. It is written purely in Swift 4.0,

Simon 19 Jun 28, 2022
A Swift Framework build for the Ark Ecosystem

Introduction Overview SwiftyArk is a simple, lightweight framework for the Ark Ecosystem. SwiftyArk provides a simple wrapper for accessing Ark accoun

Andrew Walz 8 May 12, 2019
A Slack API Client for the Perfect Server-Side Swift Framework

PerfectSlackAPIClient is an API Client to access the Slack API from your Perfect Server Side Swift application. It is build on top of PerfectAPIClient

Cap.雪ノ下八幡 2 Dec 1, 2019
A Dropbox v2 client library written in Objective-C

TJDropbox TJDropbox is a Dropbox v2 client library written in Objective-C. When Dropbox originally announced their v2 API they included only a Swift c

Tim Johnsen 61 Dec 21, 2022
ObjectiveFlickr, a Flickr API framework for Objective-C

ObjectiveFlickr ObjectiveFlickr is a Flickr API framework designed for Mac and iPhone apps. OAuth Support ObjectiveFlickr now supports Flickr's new OA

Lukhnos Liu 714 Jan 9, 2023
Wanikani-swift - Unofficial Swift client for the WaniKani API

WaniKani A Swift library and client for the WaniKani REST API. It currently supp

Aaron Sky 5 Oct 28, 2022
AWS Full Stack Swift with Apple CarPlay

This application demonstrates a full-stack Apple CarPlay app that uses Swift for both the UI and the backend services in AWS. The app accesses Lambda functions written in Swift and deployed from Docker images. The app accesses Amazon Location Service and a 3rd party weather api to display information in the vicinity of the user.

AWS Samples 100 Jan 6, 2023
A Swift wrapper for Foursquare API. iOS and OSX.

Das Quadrat Das Quadrat is Foursquare API wrapper written in Swift. Features Supports iOS and OSX. Covers all API endpoints. Authorization process imp

Constantine Fry 171 Jun 18, 2022
Unofficial GitHub API client in Swift

Github.swift ❤️ Support my apps ❤️ Push Hero - pure Swift native macOS application to test push notifications PastePal - Pasteboard, note and shortcut

Khoa 184 Nov 25, 2022
A swift SDK for Medium's OAuth2 API

Medium SDK - Swift A library to allow access to Medium API for any Swift iOS application. Features Medium.com authorization & token handling Login sta

null 11 Jan 22, 2022
Build Slack apps, in Swift

SlackKit: Slack Apps in Swift Description SlackKit makes it easy to build Slack apps in Swift. It's intended to expose all of the functionality of Sla

Peter Zignego 1k Dec 20, 2022
Swift client for Unsplash

Unsplash API client written in Swift. Unsplash offers 2 APIs: Source API (unlimited requests) Official API JSON API (5000 requests / hour) JSON API is

Modo 188 Nov 12, 2022