Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/biacode/jcronofy
Java implementation of Cronofy API
https://github.com/biacode/jcronofy
construct-client cronofy cronofy-api java java-api java-library json
Last synced: 21 days ago
JSON representation
Java implementation of Cronofy API
- Host: GitHub
- URL: https://github.com/biacode/jcronofy
- Owner: Biacode
- License: apache-2.0
- Created: 2016-10-06T17:46:11.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-03-26T10:16:11.000Z (over 3 years ago)
- Last Synced: 2023-08-07T10:24:46.814Z (about 1 year ago)
- Topics: construct-client, cronofy, cronofy-api, java, java-api, java-library, json
- Language: Java
- Size: 228 KB
- Stars: 7
- Watchers: 5
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### CI Status
[![Build Status](https://travis-ci.org/Biacode/jcronofy.svg?branch=master)](https://travis-ci.org/Biacode/jcronofy)
[![SonarCube](https://getstreaming.files.wordpress.com/2012/10/sonar.png)](https://sonarqube.com/dashboard/index/com.sfl.cronofy:cronofy)
# jcronofy
Java implementation of Cronofy API
# How to use### Installation
Maven
```xmlorg.biacode.jcronofy
jcronofy
1.2.0```
Gradle
```groovy
compile 'org.biacode.jcronofy:jcronofy:1.2.0'
```
Snapshot repository
```xml
snapshots-repo
https://oss.sonatype.org/content/repositories/snapshots
false
true
```
### Getting started
First of all, you need any implementation of ```javax.ws.rs.client.Client```
For example you can use jersey clientAdd the following dependency to your maven pom.xml file
```xmlorg.glassfish.jersey.core
jersey-client
${jersey.client.version}```
Then you need pass client implementation to CronofyClient as constructor param.# Example to construct client implementation in spring framework.
In application context XML add the following XML definition
```java
```
# If you simply need to test cronofy API.
Then construct jersey client as follows
```java
package my.application;import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import org.biacode.jcronofy.api.client.CronofyClient;
import org.biacode.jcronofy.api.client.impl.CronofyClientImpl;
import org.biacode.jcronofy.api.model.common.CronofyResponse;
import org.biacode.jcronofy.api.model.request.ListCalendarsRequest;
import org.biacode.jcronofy.api.model.response.ListCalendarsResponse;import javax.ws.rs.client.ClientBuilder;
public class MainApplication {
public static void main(final String[] args) {
// Construct cronofy java client
final CronofyClient cronofyClient = new CronofyClientImpl(ClientBuilder.newBuilder().register(JacksonJsonProvider.class).build());
// List calendars
final CronofyResponse calendarsResult = cronofyClient.listCalendars(new ListCalendarsRequest("your access token here"));
System.out.println(calendarsResult.getResponse().toString());
// Read events
final CronofyResponse eventsResult = cronofyClient.readEvents(new ReadEventsRequest("your access token here", "Etc/UTC"));
// If an error occur
if (eventsResult.hasError()) {
System.out.println(eventsResult.getError());
} else {
System.out.println(eventsResult.getResponse());
}
}
}
```You can find test access token in [Cronofy Calendar Sendbox](https://app.cronofy.com/oauth/sandbox)