Java implementation of the planning center API.
Find a file
Michael Berry 09614576a4 Update deps
2025-10-15 20:39:22 +01:00
src API additions 2021-12-11 23:53:07 +00:00
.gitignore Initial commit 2020-06-25 20:30:10 +01:00
.travis.yml Only care about 8 & 11, not other inbetween non-LTS versions 2021-12-11 23:58:17 +00:00
LICENSE Initial commit 2020-06-25 20:12:34 +01:00
pom.xml Update deps 2025-10-15 20:39:22 +01:00
README.md #1 gradle dependency example addition in README.md 2021-10-08 12:40:18 +05:30

Planning Center API

This is a Java implementation of the planning center API (v2). It's written to be used with Quelea, but has no Quelea-specific dependencies, so can easily be used elsewhere.

Setup

Maven

<dependency>
	<groupId>org.quelea</groupId>
	<artifactId>planning-center</artifactId>
	<version>0.2</version>
</dependency>

Gradle

Compile 'org.quelea:planning-center:0.2'

At present only a subset of the "services" API is implemented, as that's all Quelea needs. We're more than happy to accept PR's for expanding this, however.

Basic "getting started" example:

ClientDetails cd = ClientDetails.builder()
        .clientId("OAUTH_APP_CLIENT_ID")
        .clientSecret("OAUTH_APP_SECRET")
        .build();
AuthToken token = OAuthRedirectFlow.builder()
        .clientDetails(cd)
        .redirect("http://localhost:61937") //Just for a demo example
        .build()
        .listenLocally(Duration.ofSeconds(10), Main::openBrowser)
        .get()
        .withRefreshTokenUpdater(t -> System.out.println("New refresh token: " + t));

PlanningCenterClient client = new PlanningCenterClient(token);

Organization org = client.services().api().get().execute().body().get();

...with the following utility method:

private static void openBrowser(String url) {
    try {
        Desktop.getDesktop().browse(URI.create(url));
    } catch (IOException e) {
        e.printStackTrace();
    }
}