Skip to content

Latest commit

 

History

History
148 lines (104 loc) · 4.53 KB

README.md

File metadata and controls

148 lines (104 loc) · 4.53 KB

Dyspatch Java Client

Introduction

The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted.

API Client Libraries Dyspatch provides API Clients for popular languages and web frameworks.

Automatically generated by the Swagger Codegen

Requirements

Building the API client library requires:

  1. Java 1.7+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>io.dyspatch</groupId>
  <artifactId>dyspatch-java</artifactId>
  <version>2.0.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "io.dyspatch:dyspatch-java:2.0.0"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/dyspatch-java-2.0.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

import io.dyspatch.client.*;
import io.dyspatch.client.auth.*;
import io.dyspatch.client.model.*;
import io.dyspatch.client.api.LocalizationsApi;

import java.io.File;
import java.util.*;

public class LocalizationsApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure API key authorization: Bearer
        ApiKeyAuth Bearer = (ApiKeyAuth) defaultClient.getAuthentication("Bearer");
        Bearer.setApiKey("YOUR API KEY");
        Bearer.setApiKeyPrefix("Bearer");

        LocalizationsApi apiInstance = new LocalizationsApi();
        String localizationId = "localizationId_example"; // String | A localization ID
        String targetLanguage = "targetLanguage_example"; // String | The type of templating language to compile as. Required only for visual templates.
        try {
            LocalizationRead result = apiInstance.localizationsLocalizationIdGet(localizationId, targetLanguage);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling LocalizationsApi#localizationsLocalizationIdGet");
            e.printStackTrace();
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.dyspatch.io/

Class Method HTTP request Description
LocalizationsApi localizationsLocalizationIdGet GET /localizations/{localizationId} Get Localization Object by ID
TemplatesApi templatesGet GET /templates List Templates
TemplatesApi templatesTemplateIdGet GET /templates/{templateId} Get Template by ID

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

Bearer

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

[email protected]