Swiftpack.co -  gotranseo/oneroster as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
A Swift library for interacting with the OneRoster API
.package(url: "https://github.com/gotranseo/oneroster.git", from: "1.0.6")


A Vapor package for interacting with a OneRoster v1.1 JSON IMS API.

What is OneRoster?

OneRoster is a standard developed by IMS Global that specifies how technology providers can communicate with technology repositories of student data. It can be used to auto-populate products when a school subscribes, roster students, and pull grade/demographic information. We built this library to make it easier to interact with.


OneRoster is available through SPM. To install it, simply add the following to your Package.swift file:

.package(url: "https://github.com/gotranseo/oneroster.git", from: "0.0.1") Don't forget to also add it to dependencies array.


Start by registering the object to your services:

services.register { container -> OneRosterClient 
    return OneRosterClient(client: try container.make())

Then, inside of a controller:

let client = try req.make(OneRosterClient.self)

Due to the way OneRoster has their API spec we are forced to have two different request method, requestMultiple and requestSingle. If you are fetching an array of entities, like getAllSchools, do this:

let data = try client.requestMultiple(baseUrl: "ims-url-here",
                                      clientId: "my-client-id",
                                      clientSecret: "my-client-secret",
                                      endpoint: .getAllSchools,
                                      limit: 100,
                                      offset: 0,
                                      decoding: OneRoster.SchoolsResponse.self)

By default, the function will go through and recursively query all objects. You can disable this by setting the bypassRecursion flag:

let data = try client.requestMultiple(baseUrl: "ims-url-here",
                                      clientId: "my-client-id",
                                      clientSecret: "my-client-secret",
                                      endpoint: .getAllSchools,
                                      limit: 100,
                                      offset: 0,
                                      decoding: OneRoster.SchoolsResponse.self,
                                      bypassRecursion: true)

If you just want a single model, do the following:

let school = try client.requestSingle(baseUrl: "ims-url-here",
                                      clientId: "my-client-id",
                                      clientSecret: "my-client-secret",
                                      endpoint: .getSchool(id: "1"))

The library handles all of the OAuth 1.0 grossness for you so that you can focus on building cool Ed-Tech stuff. Enjoy!


Copyright Slate Solutions, Inc.


Stars: 1
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

End early
2 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API