Skip to content

Latest commit

 

History

History
307 lines (237 loc) · 12.9 KB

README.md

File metadata and controls

307 lines (237 loc) · 12.9 KB

swagger-java-client

Data Repository Service

  • API version: 1.2.0
    • Build date: 2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]

GET request: - Fetch a DrsObject from the database by sending a unique ID through the request - Fetch an access url to the data which the object refers to - Fetch DrsObjects by doing a search on the aliases POST request: - Create a non-existing DrsObject in the database by giving an identifier DELETE request: - Delete a DrsObject from the database by unique identifier PUT request: - Update an existing DrsObject by unique identifier and the changes in the body

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.swagger</groupId>
  <artifactId>swagger-java-client</artifactId>
  <version>1.0.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

implementation "com.github.CenterForMedicalGeneticsGhent:drs_java_sdk:1.0.0"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/swagger-java-client-1.0.0.jar
  • target/lib/*.jar

Getting Started

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

import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DataRepositoryServiceApi;

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

public class DataRepositoryServiceApiExample {

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

        // Configure API key authorization: OAuth2PasswordBearer
        ApiKeyAuth OAuth2PasswordBearer = (ApiKeyAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
        OAuth2PasswordBearer.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //OAuth2PasswordBearer.setApiKeyPrefix("Token");

        DataRepositoryServiceApi apiInstance = new DataRepositoryServiceApi();
        String objectId = "objectId_example"; // String | 
        try {
            BasicResponse result = apiInstance.deleteObjectGa4ghDrsV1ObjectsObjectIdDelete(objectId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DataRepositoryServiceApi#deleteObjectGa4ghDrsV1ObjectsObjectIdDelete");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DataRepositoryServiceApi;

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

public class DataRepositoryServiceApiExample {

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

        // Configure API key authorization: OAuth2PasswordBearer
        ApiKeyAuth OAuth2PasswordBearer = (ApiKeyAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
        OAuth2PasswordBearer.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //OAuth2PasswordBearer.setApiKeyPrefix("Token");

        DataRepositoryServiceApi apiInstance = new DataRepositoryServiceApi();
        List<String> alias = Arrays.asList("alias_example"); // List<String> | The alias(ses) on which to query DrsObjects (regex compatible)
        try {
            List<DrsObject> result = apiInstance.getObjectAliasGa4ghDrsV1ObjectsGet(alias);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DataRepositoryServiceApi#getObjectAliasGa4ghDrsV1ObjectsGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DataRepositoryServiceApi;

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

public class DataRepositoryServiceApiExample {

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

        // Configure API key authorization: OAuth2PasswordBearer
        ApiKeyAuth OAuth2PasswordBearer = (ApiKeyAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
        OAuth2PasswordBearer.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //OAuth2PasswordBearer.setApiKeyPrefix("Token");

        DataRepositoryServiceApi apiInstance = new DataRepositoryServiceApi();
        String objectId = "objectId_example"; // String | ```DrsObject``` identifier
        String accessId = "accessId_example"; // String | An `access_id` from the `access_methods` list of a `DrsObject`
        try {
            AccessURL result = apiInstance.getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet(objectId, accessId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DataRepositoryServiceApi#getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DataRepositoryServiceApi;

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

public class DataRepositoryServiceApiExample {

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

        // Configure API key authorization: OAuth2PasswordBearer
        ApiKeyAuth OAuth2PasswordBearer = (ApiKeyAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
        OAuth2PasswordBearer.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //OAuth2PasswordBearer.setApiKeyPrefix("Token");

        DataRepositoryServiceApi apiInstance = new DataRepositoryServiceApi();
        String objectId = "objectId_example"; // String | ```DrsObject``` identifier
        Boolean expand = true; // Boolean | If false and the object_id refers to a bundle, then the ContentsObject array contains only         those objects directly contained in the bundle. That is, if the bundle contains other bundles,         those other bundles are not recursively included in the result. If true and the object_id refers to a bundle,         then the entire set of objects in the bundle is expanded. That is, if the bundle contains aother bundles,         then those other bundles are recursively expanded and included in the result.         Recursion continues through the entire sub-tree of the bundle.         If the object_id refers to a blob, then the query parameter is ignored.
        try {
            DrsObject result = apiInstance.getObjectGa4ghDrsV1ObjectsObjectIdGet(objectId, expand);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DataRepositoryServiceApi#getObjectGa4ghDrsV1ObjectsObjectIdGet");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DataRepositoryServiceApi;

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

public class DataRepositoryServiceApiExample {

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

        // Configure API key authorization: OAuth2PasswordBearer
        ApiKeyAuth OAuth2PasswordBearer = (ApiKeyAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
        OAuth2PasswordBearer.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //OAuth2PasswordBearer.setApiKeyPrefix("Token");

        DataRepositoryServiceApi apiInstance = new DataRepositoryServiceApi();
        DrsObject body = new DrsObject(); // DrsObject | 
        try {
            BasicResponse result = apiInstance.postObjectGa4ghDrsV1ObjectsPost(body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DataRepositoryServiceApi#postObjectGa4ghDrsV1ObjectsPost");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DataRepositoryServiceApi;

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

public class DataRepositoryServiceApiExample {

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

        // Configure API key authorization: OAuth2PasswordBearer
        ApiKeyAuth OAuth2PasswordBearer = (ApiKeyAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
        OAuth2PasswordBearer.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //OAuth2PasswordBearer.setApiKeyPrefix("Token");

        DataRepositoryServiceApi apiInstance = new DataRepositoryServiceApi();
        DrsObject body = new DrsObject(); // DrsObject | 
        String objectId = "objectId_example"; // String | 
        try {
            BasicResponse result = apiInstance.putObjectGa4ghDrsV1ObjectsObjectIdPut(body, objectId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DataRepositoryServiceApi#putObjectGa4ghDrsV1ObjectsObjectIdPut");
            e.printStackTrace();
        }
    }
}

Documentation for API Endpoints

All URIs are relative to /

Class Method HTTP request Description
DataRepositoryServiceApi deleteObjectGa4ghDrsV1ObjectsObjectIdDelete DELETE /ga4gh/drs/v1/objects/{object_id} Delete a DrsObject
DataRepositoryServiceApi getObjectAliasGa4ghDrsV1ObjectsGet GET /ga4gh/drs/v1/objects Query DrsObjects on alias
DataRepositoryServiceApi getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet GET /ga4gh/drs/v1/objects/{object_id}/access/{access_id} Get a URL for fetching bytes
DataRepositoryServiceApi getObjectGa4ghDrsV1ObjectsObjectIdGet GET /ga4gh/drs/v1/objects/{object_id} Retrieve a DrsObject
DataRepositoryServiceApi postObjectGa4ghDrsV1ObjectsPost POST /ga4gh/drs/v1/objects Create a new DrsObject
DataRepositoryServiceApi putObjectGa4ghDrsV1ObjectsObjectIdPut PUT /ga4gh/drs/v1/objects/{object_id} Update a DrsObject
HealthApi getHealthHealthGet GET /health Check if the API is running correctly
LoginApi loginTokenPost POST /token Login

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

OAuth2PasswordBearer

  • 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

ict@cmgg.be