Planning Center Swift is a library to make interaction with Planning Center's developer API easy. It supports Xcode code completion by using generics and protocols to offer strong static typing of the endpoints and responses by Planning Center's API.
- Discoverability Through Code Completion
- Synthesized Support of
Swift.Codable
- iOS is the primary supported platform.
- macOS (untested)
- linux (untested)
- Planning Center Services API V2
- JSON:API Specification 1.0
.package(url: "https://github.com/javb99/PlanningCenterSwift.git", .branch("master"))git clone git@github.com:javb99/PlanningCenterSwift.git
open ./PlanningCenterSwift/Package.swift
This project is only dependent on SwiftJSONAPI. Both packages are maintained side by side.
import PlanningCenterSwiftlet credentials = BasicAuthenticationProvider(id: "<<Service ID>>", password: "<<Service Secret>>")
let network = URLSessionService(authenticationProvider: credentials)Use the Endpoints namespace to access the endpoints.
| Path | Equivalent Key Path | Description |
|---|---|---|
service_types |
Endpoints.serviceTypes |
The first page of ServiceTypes |
service_types/1 |
Endpoints.serviceTypes[id: "1"] |
The ServiceType with id 1 |
network.fetch(Endpoints.serviceTypes) { result in
switch result {
case let .success(_, _, document):
print("Received service type names: \(document.data!.map{$0.name})")
case let .failure(error):
print("Failed: \(error)")
}
}let futurePlans = Endpoints.serviceTypes[id: "1"].plans.filter(.future)
network.fetch(futurePlans) { result in
switch result {
case let .success(_, _, document):
print("Received team members: \(document.data![0].title ?? "No Title")")
case let .failure(error):
print("Failed: \(error)")
}
}- Implement a feature
- Submit a pull request
- Models and Endpoints for the rest of the Services API.
- Add sortable and filterable to applicable endpoints.
- Models and Endpoints for the other Planning Center products.
- POST and PATCH testing and support.
- Planning Center Developer Documentation
- JSON:API 1.0 Specification
- JSON:API Swift (The basis of this framework)
Joseph Van Boxtel, 2019
