{"id":23557726,"url":"https://github.com/dougpenny/swiftypscore","last_synced_at":"2025-04-30T10:22:17.637Z","repository":{"id":63908874,"uuid":"126632521","full_name":"dougpenny/SwiftyPSCore","owner":"dougpenny","description":"Swift interface for the PowerSchool API","archived":false,"fork":false,"pushed_at":"2022-03-22T13:23:56.000Z","size":206,"stargazers_count":6,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-30T17:40:04.205Z","etag":null,"topics":["powerschool","powerschool-api","swift","swift5"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dougpenny.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-24T19:18:10.000Z","updated_at":"2022-04-11T13:56:20.000Z","dependencies_parsed_at":"2022-11-28T20:15:48.930Z","dependency_job_id":null,"html_url":"https://github.com/dougpenny/SwiftyPSCore","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dougpenny%2FSwiftyPSCore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dougpenny%2FSwiftyPSCore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dougpenny%2FSwiftyPSCore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dougpenny%2FSwiftyPSCore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dougpenny","download_url":"https://codeload.github.com/dougpenny/SwiftyPSCore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231370944,"owners_count":18366435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["powerschool","powerschool-api","swift","swift5"],"created_at":"2024-12-26T15:16:35.920Z","updated_at":"2024-12-26T15:16:42.232Z","avatar_url":"https://github.com/dougpenny.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![SwiftyPSCore](Images/swiftypowerschool.png)\n\n[![MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdougpenny%2FSwiftyPSCore%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/dougpenny/SwiftyPSCore)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdougpenny%2FSwiftyPSCore%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/dougpenny/SwiftyPSCore)\n\n\nSwiftyPSCore is a pure Swift PowerSchool API client. The goal is to simplify the process of communicating with the [PowerSchool Student Information System](https://www.powerschool.com/solutions/student-information-system-sis/) API by handling authentication and decoding, allowing you to focus on using the data, not retrieving it.\n\n_SwiftyPSCore is not endorsed, sponsored, or affilitated with PowerSchool in any way. Swift and the Swift logo are trademarks of Apple Inc._\n\n***\n\n## Table of Contents\n* [Installation](#installation)\n  * [Swift Pacakge Manager](#swift-package-manager)\n* [Usage](#usage)\n  * [Examples](#examples)\n* [PowerQueries](#powerqueries)\n* [Contributing](#contributing)\n  * [Endpoint Testing](#endpoint-testing)\n* [License](#license)\n\n---\n\n## Installation\nBefore using _SwiftyPSCore_ in your application, you will first need to create and install a Plugin XML file for your PowerSchool server. Information about creating the plugin file can be found on the [PowerSchool Developer Support](https://support.powerschool.com/developer/#/page/plugin-xml) site. We have created an example plugin ([PSDataAccessPlugin](https://github.com/dougpenny/PSDataAccessPlugin)) that you can use as is, or modify as you see fit. Once you have installed the plugin, you will be provided a client ID and client secret that you will use for authenticating with the PowerSchool server.\n\n### Swift Package Manager\nTo include SwiftyPSCore in a [Swift Package Manager](https://swift.org/package-manager/) package, add it to the `dependencies` attribute defined in your `Package.swift` file. For example:\n```swift\ndependencies: [\n  .package(url: \"https://github.com/dougonecent/SwiftyPSCore.git\", from: \"1.0.0-beta6\")\n]\n```\n\n---\n\n## Usage\nSet environment variables for your base URL, client ID, and client secret. Then, in your code, fetch the environment variables and instantiate a client:\n```swift\nif let baseURL = ProcessInfo.processInfo.environment[\"BASE_URL\"],\n    let clientID = ProcessInfo.processInfo.environment[\"CLIENT_ID\"],\n    let clientSecret = ProcessInfo.processInfo.environment[\"CLIENT_SECRET\"] {\n        let client = SwiftyPSCore(baseURL, clientID: clientID, clientSecret: clientSecret)\n}\n```\n\nNow you can use your client to retrieve many different resources. Below are a few examples:\n\u003ca id=\"examples\"\u003e\u003c/a\u003e\n### Number of sections in a school\n```swift\nif let sections = try await client.sectionsForSchool(schoolID) {\n    // sections: [Section]\n} else {\n    // no sections found\n}\n```\n\n### All students in district\n```swift\nif let students = try await client.studentsInDistrict() {\n    // students: [Student]\n} else {\n    // no students found\n}\n```\n\n## PowerQueries\nPowerQueries are a feature that allows for the creation of custom API endpoints. SwiftyPSCore only includes core endpoints and PowerQueries provided directly by PowerSchool. To add additional core PowerQueries to SwiftyPSCore, you will need to modify the plugin file ([PSDataAccessPlugin](https://github.com/dougpenny/PSDataAccessPlugin)) with the proper \u003c[access-request](https://support.powerschool.com/developer/#/page/access-request)\u003e elements.\n\nIf you are interested in creating your own, custom PowerQueries, see our companion package, SwiftyPSCustomQueries, and the corresponding plugin, SwiftyPSCustomQueriesPlugin.\n\nUsing a PowerQuery endpoint works just like any other endpoint:\n### Enrollments for sections\n```swift\nif let enrollments = try await client.enrollmentsForSections([testSection.sectionDCID]) {\n    // enrollments: [StudentItem]\n} else {\n    // error: Error\n}\n```\n\n## Contributing\nIf you have a feature or idea you would like to see added to SwiftyPSCore, please [create an issue](https://github.com/dougpenny/SwiftyPSCore/issues/new) explaining your idea with as much detail as possible.\n\nIf you come across a bug, please [create an issue](https://github.com/dougpenny/SwiftyPSCore/issues/new) explaining the bug with as much detail as possible.\n\nThe PowerSchool API provides access to a lot of information and, unfortunately, we don't have time to research and implement every endpoint. We've tried to make it as easy as possible for you to extend the library and contribute your changes. The basics for adding a new endpoint are:\n\n1. Fork this repository and clone it to your development machine.\n2. Create a new model based on the JSON response expected through the PowerSchool API. You can find this information on the [PowerSchool Developer Support](https://support.powerschool.com/developer) site.\n3. Add a test to the `ModelTests.swift` file with an example of the JSON response to ensure the model is decoded properly.\n4. Add a new function to the `SwiftyPSCoreEndpoints.swift` file for your endpoint. You can simply copy one that is already there and change the `path` and the model type to match the expected response.\n\nPlease feel free to open a pull request with any additional endpoints you create. We would love to have as many of the endpoints covered as possible.\n\nWe strive to keep the code as clean as possible and follow standard Swift coding conventions, mainly the [Swift API Design Guidelines](https://swift.org/documentation/api-design-guidelines/) and the [raywenderlich.com Swift Style Guide](https://github.com/raywenderlich/swift-style-guide). Please run any code changes through [SwiftLint](https://github.com/realm/SwiftLint) before submitting a pull request.\n\n### Endpoint Testing\nWe provide the files needed to test your endpoints against a sandbox PowerSchool server, but you'll have to do a little setup on your end.\n\n1. Duplicate the file `testing_parameters.sample.json` and name it `testing_parameters.json`. This is a JSON file to hold the values you will be testing against and is decoded when the `EndpointTests` file is run.\n2. Add the `testing_parameters.json` file to your Xcode project, including it in the `SwiftyPSCoreTests` target.\n3. Modify the `TestingParameters.swift` model to included any additional parameters you would like to use in your tests.\n4. Add any new testing functions to the `EndpointTests.swift` file.\n\n\n---\n\n## License\nSwiftyPSCore is released under an MIT license. See [LICENSE](https://opensource.org/licenses/MIT) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdougpenny%2Fswiftypscore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdougpenny%2Fswiftypscore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdougpenny%2Fswiftypscore/lists"}