Giter Club home page Giter Club logo

rai-sdk-java's Introduction

General

Workflow Status
Continuous Integration (CI) build
Publish to GitHub packages publish
Generate java documentation javadoc

The RelationalAI Software Development Kit for Java

The RelationalAI (RAI) SDK for Java enables developers to access the RAI REST APIs from Java.

Getting started

Requirements

  • Java 11.0.10+
  • Apache Maven

Dependencies

The SDK has a single runtime dependency (jsoniter), a dependency for running the SDK examples (commons-cli) and several additional dependencies for running the unit and integration tests.

Building the SDK

The SDK build lifecycle is managed using the standard mvn lifecycle commands.

Compile the SDK

mvn compile

Run the tests

mvn test

Note, the test are run against the account configured in your SDK config file.

Compile, package, run tests and install the SDK

mvn install

Note that mvn install is required to build and run the examples.

Compile, package and install without running tests

mvn install -DskipTests

Remove all build output files from the repo

mvn clean

Create a configuration file

In order to run the examples you will need to create an SDK config file. The default location for the file is $HOME/.rai/config and the file should include the following:

Sample configuration using OAuth client credentials:

[default]
host = azure.relationalai.com
port = <api-port>      # optional, default: 443
scheme = <scheme>      # optional, default: https
client_id = <your client_id>
client_secret = <your client secret>
client_credentials_url = <account login URL>  # optional
# default: https://login.relationalai.com/oauth/token

Client credentials can be created using the RAI console at https://console.relationalai.com/login

You can copy config.spec from the root of this repo and modify as needed.

Using the SDK as a maven dependency

In order to use the rai-sdk-java, you need add this dependency to your project's POM:

<dependency>
    <groupId>com.relationalai</groupId>
    <artifactId>rai-sdk</artifactId>
    <version>0.2.2-alpha</version>
</dependency>

You need also to point maven to the SDK GitHub packages repository in the project's POM:

<repositories>
    <repository>
        <id>github</id>
        <name>The RelationalAI SDK for Apache Maven</name>
        <url>https://maven.pkg.github.com/RelationalAI/rai-sdk-java</url>
    </repository>
</repositories>

The registry access is available through GiHub api which is protected. You have to add GitHub credentials to $HOME/.m2/settings.xml:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
        ...
        <servers>
            <server>
                <id>github</id>
                <username>GITHUB_USERNAME</username>
                <password>GITHUB_ACCESS_TOKEN</password>
            </server>
        </servers>
        ...
    </settings>

GITHUB_USERNAME is your GitHub login name.

GITHUB_ACCESS_TOKEN is a generated GitHub personal access token:

GitHub > Settings > Developer Settings > Personal access tokens > Generate new token.

The token needs at least the read:packages scope.

Examples

The SDK contains examples for every API, and various other SDK features. These are located in the examples project under ./rai-sdk-examples.

The examples are packaged into a single JAR file, and can be run individually from the command line using maven.

mvn exec:java -f rai-sdk-examples/pom.xml -Dexec.mainClass=com.relationalai.examples.Runner -Dexec.args="<className> [options]"

Eg, to run the GetDatabase example from the root of the repo.

mvn exec:java -f rai-sdk-examples/pom.xml -Dexec.mainClass=com.relationalai.examples.Runner -Dexec.args="GetDatabase sdk-test"

There is also a bash script in ./rai-sdk-examples that can be used to run individual examples, eg:

cd ./rai-sdk/examples
./run GetDatabase sdk-test

Javadocs

Javadocs for rai-sdk are available here.

Support

You can reach the RAI developer support team at [email protected]

Contributing

We value feedback and contributions from our developer community. Feel free to submit an issue or a PR here.

License

The RelationalAI Software Development Kit for Java is licensed under the Apache License 2.0. See: https://github.com/RelationalAI/rai-sdk-java/blob/master/LICENSE G

rai-sdk-java's People

Contributors

nrhelmi avatar bradlo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.