sdk-java


License

License

MIT
Categories

Categories

Java Languages Net
GroupId

GroupId

net.koofr
ArtifactId

ArtifactId

sdk-java
Last Version

Last Version

0.1
Release Date

Release Date

Type

Type

jar
Description

Description

sdk-java
sdk-java
Project URL

Project URL

https://github.com/koofr/java-koofr
Project Organization

Project Organization

net.koofr
Source Code Management

Source Code Management

https://github.com/koofr/java-koofr.git

Download sdk-java

How to add to project

<!-- https://jarcasting.com/artifacts/net.koofr/sdk-java/ -->
<dependency>
    <groupId>net.koofr</groupId>
    <artifactId>sdk-java</artifactId>
    <version>0.1</version>
</dependency>
// https://jarcasting.com/artifacts/net.koofr/sdk-java/
implementation 'net.koofr:sdk-java:0.1'
// https://jarcasting.com/artifacts/net.koofr/sdk-java/
implementation ("net.koofr:sdk-java:0.1")
'net.koofr:sdk-java:jar:0.1'
<dependency org="net.koofr" name="sdk-java" rev="0.1">
  <artifact name="sdk-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.koofr', module='sdk-java', version='0.1')
)
libraryDependencies += "net.koofr" % "sdk-java" % "0.1"
[net.koofr/sdk-java "0.1"]

Dependencies

compile (3)

Group / Artifact Type Version
org.apache.httpcomponents : httpclient jar 4.2.1
org.restlet.jse » org.restlet.ext.jackson jar 2.1.2
org.restlet.jse » org.restlet.ext.httpclient jar 2.1.2

Project Modules

There are no modules declared in this project.

Koofr Java SDK

This is a Java SDK for easy interaction with Koofr service. See the examples folder for a quick start.

A Quick Start

import net.koofr.api.auth.Authenticator;
import net.koofr.api.auth.basic.HttpBasicAuthenticator;
import net.koofr.api.http.Client;
import net.koofr.api.rest.v2.Api;

public class Main {

  public static void main(String args[]) {

    Client c = new BasicClient();
    Authenticator a = new HttpBasicAuthenticator("username", "password");
    Api api = new Api("https://app.koofr.net/api/v2", a, c);

    Self self = api.self().get();
    
  }

}

Obviously, you need an HTTP Client and an Authenticator to use the Api.

The SDK provides an abstraction for both. You probably won't need to implement your own authenticator since the ones supplied in net.kofr.api.auth subpackages cover all possible authentication options you have with Koofr: OAuth2, HTTP Basic and our own authentication token scheme.

You might want to implement your own HTTP client on the other hand: we provide a simple one based on the HttpURLConnection class from the Java runtime, but you might want to use an Apache HttpComponents based one or whatever the preferred option on your platform is. You're welcome, you just need to implement the Client, Request and Response interfaces.

Examples

There are two examples demonstrating use of a Koofr client. Run them via SBT.

sbt
project info
run app.koofr.net [email protected] mypassword

or

sbt
project cmdline
run app.koofr.net [email protected] mypassword

Hostname is passed in without protocol and without any slashes.

You can also use OAuth2-based authentication in the examples, by replacing the username and password with token URL, client ID, client secret and grant code. However, you need to get the grant code before running the examples: perhaps with curl or with OAuth Playground

Building

To build jars use

sbt package

Maven

Prebuilt jars are available for maven at JCenter, group ID net.koofr, artefact ID java-koofr

net.koofr

Koofr

Because my data matters.

Versions

Version
0.1