GithubHelp home page GithubHelp logo

studioph / domino-java-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ksmpartners/domino-java-client

0.0 0.0 0.0 299 KB

Domino Data Lab API Client to connect to Domino web services using Java HTTP Client.

License: MIT License

Java 39.55% Mustache 60.45%

domino-java-client's Introduction

Domino Data Lab Java Client

Maven License Java CI with Maven

Domino Data Lab Java Client is a library that wrappers the REST API calls for Domino using a Java native HTTP client.

Requirements

To use this library you will need the following:

  • JDK 11+
  • Domino API Key to an active Domino instance

Usage

The library is available on Maven Central for use in Maven/Gradle/Ivy etc.

Apache Maven (javax):

<dependency>
    <groupId>com.ksmpartners</groupId>
    <artifactId>domino-java-client</artifactId>
    <version>${domino.version}</version>
</dependency>

Apache Maven (jakarta):

<dependency>
    <groupId>com.ksmpartners</groupId>
    <artifactId>domino-java-client</artifactId>
    <version>${domino.version}</version>
    <classifier>jakarta</classifier>
</dependency>

Gradle:

implementation group: 'com.ksmpartners', name: 'domino-java-client', version: '${domino.version}'

Example: Using the library is simple, you just need a Domino API Key and URL.

import com.dominodatalab.api.invoker.ApiClient;
import com.dominodatalab.api.invoker.ApiException;
import com.dominodatalab.api.model.DominoCommonUserPerson;
import com.dominodatalab.api.rest.UsersApi;
import com.dominodatalab.client.DominoApiClient;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class DominoTest {

    private static final String API_URL = "https://domino.cloud.com/v4";
    private static final String API_KEY = "74b86eaa8c3e8310748de7714926b0b6a3866d8eb8c493fdf2d8fed7a520b842";

    public static void main(String... args) {
        try {
            // initialize client with key
            final ApiClient client = DominoApiClient.createApiClient();
            client.updateBaseUri(API_URL);
            client.setRequestInterceptor(builder -> builder.setHeader("X-Domino-Api-Key", API_KEY));

            // call the get current user API
            UsersApi api = new UsersApi(client);
            DominoCommonUserPerson user = api.getCurrentUser();

            // print response as JSON
            ObjectMapper mapper = DominoApiClient.createDefaultObjectMapper();
            String result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(user);
            System.out.println(result);
        } catch (ApiException | JsonProcessingException e) {
            e.printStackTrace();
        }
    }
}

Resulting JSON output:

{
  "firstName": "Homer",
  "lastName": "Simpson",
  "fullName": "Homer Simpson",
  "id": "6124ffbfa7db86282dde302a",
  "userName": "hs12345",
  "email": "[email protected]"
}

Build and Test

Build the project with Apache Maven:

$ mvn clean package

Install it to your local Maven repository with:

$ mvn install

Release

  • Run mvn versions:set -DgenerateBackupPoms=false -DnewVersion=5.5.1 to update all modules versions
  • Commit and push the changes to GitHub
  • In GitHub create a new release titled 5.5.1 to tag this release
  • Run mvn clean deploy -Prelease to push to Maven Central

(Replace 5.5.1 in the steps above with the actual SEMVER release number.)

License

Licensed under the MIT license.

SPDX-License-Identifier: MIT

Copyright

Domino and Domino Data Lab are © 2023 Domino Data Lab, Inc. Made in San Francisco.

domino-java-client's People

Contributors

melloware avatar dependabot[bot] avatar kjhoerr avatar mharnish 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.