diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a530464 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/.swagger-codegen-ignore b/.swagger-codegen-ignore new file mode 100644 index 0000000..c5fa491 --- /dev/null +++ b/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.swagger-codegen/VERSION b/.swagger-codegen/VERSION new file mode 100644 index 0000000..e661578 --- /dev/null +++ b/.swagger-codegen/VERSION @@ -0,0 +1 @@ +3.0.57 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..70cb81a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +# +# Generated by: https://github.com/swagger-api/swagger-codegen.git +# +language: java +jdk: + - oraclejdk8 + - oraclejdk7 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + - mvn test + # uncomment below to test using gradle + # - gradle test + # uncomment below to test using sbt + # - sbt test diff --git a/README.md b/README.md new file mode 100644 index 0000000..6c012d0 --- /dev/null +++ b/README.md @@ -0,0 +1,307 @@ +# 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](https://github.com/swagger-api/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: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + io.swagger + swagger-java-client + 1.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "io.swagger:swagger-java-client:1.0.0" +``` + +### Others + +At first generate the JAR by executing: + +```shell +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](#installation) instruction and execute the following Java code: + +```java +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 alias = Arrays.asList("alias_example"); // List | The alias(ses) on which to query DrsObjects (regex compatible) + try { + List 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**](docs/DataRepositoryServiceApi.md#deleteObjectGa4ghDrsV1ObjectsObjectIdDelete) | **DELETE** /ga4gh/drs/v1/objects/{object_id} | Delete a DrsObject +*DataRepositoryServiceApi* | [**getObjectAliasGa4ghDrsV1ObjectsGet**](docs/DataRepositoryServiceApi.md#getObjectAliasGa4ghDrsV1ObjectsGet) | **GET** /ga4gh/drs/v1/objects | Query DrsObjects on alias +*DataRepositoryServiceApi* | [**getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet**](docs/DataRepositoryServiceApi.md#getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet) | **GET** /ga4gh/drs/v1/objects/{object_id}/access/{access_id} | Get a URL for fetching bytes +*DataRepositoryServiceApi* | [**getObjectGa4ghDrsV1ObjectsObjectIdGet**](docs/DataRepositoryServiceApi.md#getObjectGa4ghDrsV1ObjectsObjectIdGet) | **GET** /ga4gh/drs/v1/objects/{object_id} | Retrieve a DrsObject +*DataRepositoryServiceApi* | [**postObjectGa4ghDrsV1ObjectsPost**](docs/DataRepositoryServiceApi.md#postObjectGa4ghDrsV1ObjectsPost) | **POST** /ga4gh/drs/v1/objects | Create a new DrsObject +*DataRepositoryServiceApi* | [**putObjectGa4ghDrsV1ObjectsObjectIdPut**](docs/DataRepositoryServiceApi.md#putObjectGa4ghDrsV1ObjectsObjectIdPut) | **PUT** /ga4gh/drs/v1/objects/{object_id} | Update a DrsObject +*HealthApi* | [**getHealthHealthGet**](docs/HealthApi.md#getHealthHealthGet) | **GET** /health | Check if the API is running correctly +*LoginApi* | [**loginTokenPost**](docs/LoginApi.md#loginTokenPost) | **POST** /token | Login + +## Documentation for Models + + - [AccessMethods](docs/AccessMethods.md) + - [AccessURL](docs/AccessURL.md) + - [AllOfDrsObjectAccessMethods](docs/AllOfDrsObjectAccessMethods.md) + - [AllOfDrsObjectChecksums](docs/AllOfDrsObjectChecksums.md) + - [AllOfDrsObjectContents](docs/AllOfDrsObjectContents.md) + - [BasicResponse](docs/BasicResponse.md) + - [BodyLoginTokenPost](docs/BodyLoginTokenPost.md) + - [Checksums](docs/Checksums.md) + - [ContentsExpanded](docs/ContentsExpanded.md) + - [DrsObject](docs/DrsObject.md) + - [Error](docs/Error.md) + - [HTTPValidationError](docs/HTTPValidationError.md) + - [Token](docs/Token.md) + - [ValidationError](docs/ValidationError.md) + +## 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 diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..060e912 --- /dev/null +++ b/build.gradle @@ -0,0 +1,107 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = 'io.swagger' +version = '1.0.0' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' + } +} + +repositories { + mavenCentral() +} + + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided 'javax.annotation:jsr250-api:1.0' + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven-publish' + + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 + + publishing { + publications { + maven(MavenPublication) { + artifactId = 'swagger-java-client' + from components.java + } + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +dependencies { + implementation 'io.swagger.core.v3:swagger-annotations:2.0.0' + implementation 'com.squareup.okhttp:okhttp:2.7.5' + implementation 'com.squareup.okhttp:logging-interceptor:2.7.5' + implementation 'com.google.code.gson:gson:2.8.1' + implementation 'io.gsonfire:gson-fire:1.8.3' + implementation 'org.threeten:threetenbp:1.3.5' + testImplementation 'junit:junit:4.12' +} diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..0a65ca7 --- /dev/null +++ b/build.sbt @@ -0,0 +1,21 @@ +lazy val root = (project in file(".")). + settings( + organization := "io.swagger", + name := "swagger-java-client", + version := "1.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger.core.v3" % "swagger-annotations" % "2.0.0", + "com.squareup.okhttp" % "okhttp" % "2.7.5", + "com.squareup.okhttp" % "logging-interceptor" % "2.7.5", + "com.google.code.gson" % "gson" % "2.8.1", + "io.gsonfire" % "gson-fire" % "1.8.3" % "compile", + "org.threeten" % "threetenbp" % "1.3.5" % "compile", + "junit" % "junit" % "4.12" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/docs/AccessMethods.md b/docs/AccessMethods.md new file mode 100644 index 0000000..9e86a3d --- /dev/null +++ b/docs/AccessMethods.md @@ -0,0 +1,9 @@ +# AccessMethods + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | Enum: ```\"s3\"``` ```\"gs\"``` ```\"ftp\"``` ```\"gsiftp\"``` ```\"globus\"``` ```\"htsget\"``` ```\"https\"``` ```\"file\"``` Type of the access method. | +**accessUrl** | [**AccessURL**](AccessURL.md) | | [optional] +**accessId** | **String** | An arbitrary string to be passed to the ```/access``` method to get an ```AccessURL```. This string must be unique within the scope of a single object. Note that at least one of ```access_url``` and ```access_id``` must be provided. | [optional] +**region** | **String** | Name of the region in the cloud service provider that the object belongs to. | [optional] diff --git a/docs/AccessURL.md b/docs/AccessURL.md new file mode 100644 index 0000000..b9ee1ba --- /dev/null +++ b/docs/AccessURL.md @@ -0,0 +1,7 @@ +# AccessURL + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **String** | A fully resolvable URL that can be used to fetch the actual object bytes. | +**headers** | **List<String>** | An optional list of headers to include in the HTTP request to ```url```. These headers can be used to provide auth tokens required to fetch the object bytes. | [optional] diff --git a/docs/AllOfDrsObjectAccessMethods.md b/docs/AllOfDrsObjectAccessMethods.md new file mode 100644 index 0000000..bf98991 --- /dev/null +++ b/docs/AllOfDrsObjectAccessMethods.md @@ -0,0 +1,5 @@ +# AllOfDrsObjectAccessMethods + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- diff --git a/docs/AllOfDrsObjectChecksums.md b/docs/AllOfDrsObjectChecksums.md new file mode 100644 index 0000000..1599c77 --- /dev/null +++ b/docs/AllOfDrsObjectChecksums.md @@ -0,0 +1,5 @@ +# AllOfDrsObjectChecksums + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- diff --git a/docs/AllOfDrsObjectContents.md b/docs/AllOfDrsObjectContents.md new file mode 100644 index 0000000..c7d1eb6 --- /dev/null +++ b/docs/AllOfDrsObjectContents.md @@ -0,0 +1,5 @@ +# AllOfDrsObjectContents + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- diff --git a/docs/BasicResponse.md b/docs/BasicResponse.md new file mode 100644 index 0000000..fec8616 --- /dev/null +++ b/docs/BasicResponse.md @@ -0,0 +1,6 @@ +# BasicResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**objectId** | **String** | The ID of the created Data Object | diff --git a/docs/BodyLoginTokenPost.md b/docs/BodyLoginTokenPost.md new file mode 100644 index 0000000..d8919d3 --- /dev/null +++ b/docs/BodyLoginTokenPost.md @@ -0,0 +1,11 @@ +# BodyLoginTokenPost + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**grantType** | **String** | | [optional] +**username** | **String** | | +**password** | **String** | | +**scope** | **String** | | [optional] +**clientId** | **String** | | [optional] +**clientSecret** | **String** | | [optional] diff --git a/docs/Checksums.md b/docs/Checksums.md new file mode 100644 index 0000000..5fd375f --- /dev/null +++ b/docs/Checksums.md @@ -0,0 +1,7 @@ +# Checksums + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**checksum** | **String** | The hex-string encoded checksum for the data | +**type** | **String** | The digest method used to create the checksum. The value (e.g. ```sha-256```) SHOULD be listed as ```Hash Name String``` in the https://www.iana.org/assignments/named-information/named-information.xhtml#hash-alg[IANA Named Information Hash Algorithm Registry]. Other values MAY be used, as long as implementors are aware of the issues discussed in https://tools.ietf.org/html/rfc6920#section-9.4[RFC6920]. GA4GH may provide more explicit guidance for use of non-IANA-registered algorithms in the future. Until then, if implementors do choose such an algorithm (e.g. because it's implemented by their storage provider), they SHOULD use an existing standard ```type``` value such as ```md5```, ```etag```, ```crc32c```, ```trunc512```, or ```sha1```. | diff --git a/docs/ContentsExpanded.md b/docs/ContentsExpanded.md new file mode 100644 index 0000000..bcb7d55 --- /dev/null +++ b/docs/ContentsExpanded.md @@ -0,0 +1,9 @@ +# ContentsExpanded + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | A name declared by the bundle author that must be used when materialising this object, overriding any name directly associated with the object itself. The name must be unique with the containing bundle. This string is made up of uppercase and lowercase letters, decimal digits, hypen, period, and underscore [A-Za-z0-9.-_]. See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282[portable filenames]. | +**id** | **String** | A DRS identifier of a ```DrsObject``` (either a single blob or a nested bundle). If this ```ContentsObject``` is an object within a nested bundle, then the id is optional. Otherwise, the id is required. | [optional] +**drsUri** | **List<String>** | A list of full DRS identifier URI paths that may be used to obtain the object. These URIs may be external to this DRS instance. | [optional] +**contents** | **List<String>** | If this ContentsObject describes a nested bundle and the caller specified \"?expand=true\" on the request, then this contents array must be present and describe the objects within the nested bundle. | [optional] diff --git a/docs/DataRepositoryServiceApi.md b/docs/DataRepositoryServiceApi.md new file mode 100644 index 0000000..c33c027 --- /dev/null +++ b/docs/DataRepositoryServiceApi.md @@ -0,0 +1,349 @@ +# DataRepositoryServiceApi + +All URIs are relative to */* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteObjectGa4ghDrsV1ObjectsObjectIdDelete**](DataRepositoryServiceApi.md#deleteObjectGa4ghDrsV1ObjectsObjectIdDelete) | **DELETE** /ga4gh/drs/v1/objects/{object_id} | Delete a DrsObject +[**getObjectAliasGa4ghDrsV1ObjectsGet**](DataRepositoryServiceApi.md#getObjectAliasGa4ghDrsV1ObjectsGet) | **GET** /ga4gh/drs/v1/objects | Query DrsObjects on alias +[**getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet**](DataRepositoryServiceApi.md#getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet) | **GET** /ga4gh/drs/v1/objects/{object_id}/access/{access_id} | Get a URL for fetching bytes +[**getObjectGa4ghDrsV1ObjectsObjectIdGet**](DataRepositoryServiceApi.md#getObjectGa4ghDrsV1ObjectsObjectIdGet) | **GET** /ga4gh/drs/v1/objects/{object_id} | Retrieve a DrsObject +[**postObjectGa4ghDrsV1ObjectsPost**](DataRepositoryServiceApi.md#postObjectGa4ghDrsV1ObjectsPost) | **POST** /ga4gh/drs/v1/objects | Create a new DrsObject +[**putObjectGa4ghDrsV1ObjectsObjectIdPut**](DataRepositoryServiceApi.md#putObjectGa4ghDrsV1ObjectsObjectIdPut) | **PUT** /ga4gh/drs/v1/objects/{object_id} | Update a DrsObject + + +# **deleteObjectGa4ghDrsV1ObjectsObjectIdDelete** +> BasicResponse deleteObjectGa4ghDrsV1ObjectsObjectIdDelete(objectId) + +Delete a DrsObject + +Delete a ```DrsObject``` index entry + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.DataRepositoryServiceApi; + +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(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **objectId** | **String**| | + +### Return type + +[**BasicResponse**](BasicResponse.md) + +### Authorization + +[OAuth2PasswordBearer](../README.md#OAuth2PasswordBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +# **getObjectAliasGa4ghDrsV1ObjectsGet** +> List<DrsObject> getObjectAliasGa4ghDrsV1ObjectsGet(alias) + +Query DrsObjects on alias + +Returns all objects that correspond to the list of aliases passed through the request. The query is regex compatible. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.DataRepositoryServiceApi; + +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 alias = Arrays.asList("alias_example"); // List | The alias(ses) on which to query DrsObjects (regex compatible) +try { + List result = apiInstance.getObjectAliasGa4ghDrsV1ObjectsGet(alias); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling DataRepositoryServiceApi#getObjectAliasGa4ghDrsV1ObjectsGet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **alias** | [**List<String>**](String.md)| The alias(ses) on which to query DrsObjects (regex compatible) | + +### Return type + +[**List<DrsObject>**](DrsObject.md) + +### Authorization + +[OAuth2PasswordBearer](../README.md#OAuth2PasswordBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +# **getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet** +> AccessURL getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet(objectId, accessId) + +Get a URL for fetching bytes + +Returns a URL that can be used to fetch the bytes of a `DrsObject`. This method only needs to be called when using an `AccessMethod` that contains an `access_id` (e.g., for servers that use signed URLs for fetching object bytes). + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.DataRepositoryServiceApi; + +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(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **objectId** | **String**| ```DrsObject``` identifier | + **accessId** | **String**| An `access_id` from the `access_methods` list of a `DrsObject` | + +### Return type + +[**AccessURL**](AccessURL.md) + +### Authorization + +[OAuth2PasswordBearer](../README.md#OAuth2PasswordBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +# **getObjectGa4ghDrsV1ObjectsObjectIdGet** +> DrsObject getObjectGa4ghDrsV1ObjectsObjectIdGet(objectId, expand) + +Retrieve a DrsObject + +Returns object metadata, and a list of access methods that can be used to fetch object bytes. + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.DataRepositoryServiceApi; + +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(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **objectId** | **String**| ```DrsObject``` identifier | + **expand** | **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. | + +### Return type + +[**DrsObject**](DrsObject.md) + +### Authorization + +[OAuth2PasswordBearer](../README.md#OAuth2PasswordBearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +# **postObjectGa4ghDrsV1ObjectsPost** +> BasicResponse postObjectGa4ghDrsV1ObjectsPost(body) + +Create a new DrsObject + +POST a requested ID to create an object that corresponds to this ID + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.DataRepositoryServiceApi; + +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(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**DrsObject**](DrsObject.md)| | + +### Return type + +[**BasicResponse**](BasicResponse.md) + +### Authorization + +[OAuth2PasswordBearer](../README.md#OAuth2PasswordBearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +# **putObjectGa4ghDrsV1ObjectsObjectIdPut** +> BasicResponse putObjectGa4ghDrsV1ObjectsObjectIdPut(body, objectId) + +Update a DrsObject + +Update the ```DrsObject``` + +### Example +```java +// Import classes: +//import io.swagger.client.ApiClient; +//import io.swagger.client.ApiException; +//import io.swagger.client.Configuration; +//import io.swagger.client.auth.*; +//import io.swagger.client.api.DataRepositoryServiceApi; + +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(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**DrsObject**](DrsObject.md)| | + **objectId** | **String**| | + +### Return type + +[**BasicResponse**](BasicResponse.md) + +### Authorization + +[OAuth2PasswordBearer](../README.md#OAuth2PasswordBearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/docs/DrsObject.md b/docs/DrsObject.md new file mode 100644 index 0000000..fb46bbf --- /dev/null +++ b/docs/DrsObject.md @@ -0,0 +1,18 @@ +# DrsObject + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | An identifier unique to this ```DrsObject``` | +**name** | **String** | A string that can be used to name a ```DrsObject```. This string is made up of uppercase and lowercase letters, decimal digits, hypen, period, and underscore [A-Za-z0-9.-_]. See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282[portable filenames]. | [optional] +**selfUri** | **String** | A drs:// hostname-based URI, as defined in the DRS documentation, that tells clients how to access this object. The intent of this field is to make DRS objects self-contained, and therefore easier for clients to store and pass around. For example, if you arrive at this DRS JSON by resolving a compact identifier-based DRS URI, the ```self_uri``` presents you with a hostname and properly encoded DRS ID for use in subsequent ```access``` endpoint calls. | +**size** | **Integer** | For blobs, the blob size in bytes. For bundles, the cumulative size, in bytes, of items in the contents field. | +**createdTime** | **String** | Timestamp of content creation in RFC3339. (This is the creation time of the underlying content, not of the JSON object.) | +**updatedTime** | **String** | Timestamp of content update in RFC3339, identical to ```created_time``` in systems that do not support updates. (This is the update time of the underlying content, not of the JSON object.) | [optional] +**version** | **String** | A string representing a version. (Some systems may use checksum, a RFC3339 timestamp, or an incrementing version number.) | [optional] +**mimeType** | **String** | A string providing the mime-type of the ```DrsObject```. | [optional] +**checksums** | **AllOfDrsObjectChecksums** | The checksum of the ```DrsObject```. At least one checksum must be provided. For blobs, the checksum is computed over the bytes in the blob. For bundles, the checksum is computed over a sorted concatenation of the checksums of its top-level contained objects (not recursive, names not included). The list of checksums is sorted alphabetically (hex-code) before concatenation and a further checksum is performed on the concatenated checksum value. For example, if a bundle contains blobs with the following checksums: md5(blob1) = 72794b6d md5(blob2) = 5e089d29 Then the checksum of the bundle is: md5( concat( sort( md5(blob1), md5(blob2) ) ) ) = md5( concat( sort( 72794b6d, 5e089d29 ) ) ) = md5( concat( 5e089d29, 72794b6d ) ) = md5( 5e089d2972794b6d ) = f7a29a04 | +**accessMethods** | **AllOfDrsObjectAccessMethods** | The list of access methods that can be used to fetch the ```DrsObject```. Required for single blobs; optional for bundles. | [optional] +**contents** | **AllOfDrsObjectContents** | If not set, this ```DrsObject``` is a single blob. If set, this ```DrsObject``` is a bundle containing the listed ```ContentsObject``` s (some of which may be further nested). | [optional] +**description** | **String** | A human readable description of the ```DrsObject```. | [optional] +**aliases** | **List<String>** | A list of strings that can be used to find other metadata about this ```DrsObject``` from external metadata sources. These aliases can be used to represent secondary accession numbers or external GUIDs. | [optional] diff --git a/docs/Error.md b/docs/Error.md new file mode 100644 index 0000000..fe1b76b --- /dev/null +++ b/docs/Error.md @@ -0,0 +1,7 @@ +# Error + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**msg** | **String** | A detailed error message. | [optional] +**statusCode** | **Integer** | The integer representing the HTTP status code (e.g. 200, 404). | diff --git a/docs/HTTPValidationError.md b/docs/HTTPValidationError.md new file mode 100644 index 0000000..8532a3a --- /dev/null +++ b/docs/HTTPValidationError.md @@ -0,0 +1,6 @@ +# HTTPValidationError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**detail** | [**List<ValidationError>**](ValidationError.md) | | [optional] diff --git a/docs/HealthApi.md b/docs/HealthApi.md new file mode 100644 index 0000000..d98bf1a --- /dev/null +++ b/docs/HealthApi.md @@ -0,0 +1,49 @@ +# HealthApi + +All URIs are relative to */* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**getHealthHealthGet**](HealthApi.md#getHealthHealthGet) | **GET** /health | Check if the API is running correctly + + +# **getHealthHealthGet** +> Object getHealthHealthGet() + +Check if the API is running correctly + +Health check for the API + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.HealthApi; + + +HealthApi apiInstance = new HealthApi(); +try { + Object result = apiInstance.getHealthHealthGet(); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling HealthApi#getHealthHealthGet"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + diff --git a/docs/LoginApi.md b/docs/LoginApi.md new file mode 100644 index 0000000..05690d8 --- /dev/null +++ b/docs/LoginApi.md @@ -0,0 +1,61 @@ +# LoginApi + +All URIs are relative to */* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**loginTokenPost**](LoginApi.md#loginTokenPost) | **POST** /token | Login + + +# **loginTokenPost** +> Token loginTokenPost(grantType, username, password, scope, clientId, clientSecret) + +Login + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.LoginApi; + + +LoginApi apiInstance = new LoginApi(); +String grantType = "grantType_example"; // String | +String username = "username_example"; // String | +String password = "password_example"; // String | +String scope = "scope_example"; // String | +String clientId = "clientId_example"; // String | +String clientSecret = "clientSecret_example"; // String | +try { + Token result = apiInstance.loginTokenPost(grantType, username, password, scope, clientId, clientSecret); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling LoginApi#loginTokenPost"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **grantType** | **String**| | + **username** | **String**| | + **password** | **String**| | + **scope** | **String**| | + **clientId** | **String**| | + **clientSecret** | **String**| | + +### Return type + +[**Token**](Token.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/json + diff --git a/docs/Token.md b/docs/Token.md new file mode 100644 index 0000000..f9b4aba --- /dev/null +++ b/docs/Token.md @@ -0,0 +1,8 @@ +# Token + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**accessToken** | **String** | | +**tokenType** | **String** | | +**expiresIn** | **Integer** | | diff --git a/docs/ValidationError.md b/docs/ValidationError.md new file mode 100644 index 0000000..963d3a4 --- /dev/null +++ b/docs/ValidationError.md @@ -0,0 +1,8 @@ +# ValidationError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**loc** | **List<String>** | | +**msg** | **String** | | +**type** | **String** | | diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..ed37461 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..05644f0 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +# Uncomment to build for Android +#target = android \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..d64cd49 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..1af9e09 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..9d82f78 --- /dev/null +++ b/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..5f19212 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..eafae2d --- /dev/null +++ b/pom.xml @@ -0,0 +1,223 @@ + + 4.0.0 + io.swagger + swagger-java-client + jar + swagger-java-client + 1.0.0 + https://github.com/swagger-api/swagger-codegen + Swagger Java + + scm:git:git@github.com:swagger-api/swagger-codegen.git + scm:git:git@github.com:swagger-api/swagger-codegen.git + https://github.com/swagger-api/swagger-codegen + + + 2.2.0 + + + + + Unlicense + https://raw.githubusercontent.com/ga4gh/data-repository-service-schemas/master/LICENSE + repo + + + + + + Swagger + apiteam@swagger.io + Swagger + http://swagger.io + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + pertest + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + + jar + test-jar + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.10 + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + io.swagger.core.v3 + swagger-annotations + ${swagger-core-version} + + + com.squareup.okhttp + okhttp + ${okhttp-version} + + + com.squareup.okhttp + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.threeten + threetenbp + ${threetenbp-version} + + + + junit + junit + ${junit-version} + test + + + + 1.7 + ${java.version} + ${java.version} + 2.0.0 + 2.7.5 + 2.8.1 + 1.8.3 + 1.3.5 + 1.0.0 + 4.13.1 + UTF-8 + + diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..55640f7 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "swagger-java-client" \ No newline at end of file diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml new file mode 100644 index 0000000..465dcb5 --- /dev/null +++ b/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/src/main/java/io/swagger/client/ApiCallback.java b/src/main/java/io/swagger/client/ApiCallback.java new file mode 100644 index 0000000..7107132 --- /dev/null +++ b/src/main/java/io/swagger/client/ApiCallback.java @@ -0,0 +1,61 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API downlond processing. + * + * @param bytesRead bytes Read + * @param contentLength content lenngth of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/src/main/java/io/swagger/client/ApiClient.java b/src/main/java/io/swagger/client/ApiClient.java new file mode 100644 index 0000000..6fd5a71 --- /dev/null +++ b/src/main/java/io/swagger/client/ApiClient.java @@ -0,0 +1,1206 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client; + +import com.squareup.okhttp.*; +import com.squareup.okhttp.internal.http.HttpMethod; +import com.squareup.okhttp.logging.HttpLoggingInterceptor; +import com.squareup.okhttp.logging.HttpLoggingInterceptor.Level; +import okio.BufferedSink; +import okio.Okio; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.format.DateTimeFormatter; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.lang.reflect.Type; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import io.swagger.client.auth.Authentication; +import io.swagger.client.auth.HttpBasicAuth; +import io.swagger.client.auth.ApiKeyAuth; +import io.swagger.client.auth.OAuth; + +public class ApiClient { + + private String basePath = "/"; + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private String tempFolderPath = null; + + private Map authentications; + + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; + + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; + + private OkHttpClient httpClient; + private JSON json; + + private HttpLoggingInterceptor loggingInterceptor; + + /* + * Constructor for ApiClient + */ + public ApiClient() { + httpClient = new OkHttpClient(); + + + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("Swagger-Codegen/1.0.0/java"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap(); + authentications.put("OAuth2PasswordBearer", new ApiKeyAuth("header", "Authorization")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Get base path + * + * @return Baes path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g / + * @return An instance of OkHttpClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client + * + * @param httpClient An instance of OkHttpClient + * @return Api Client + */ + public ApiClient setHttpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + public DateFormat getDateFormat() { + return dateFormat; + } + + public ApiClient setDateFormat(DateFormat dateFormat) { + this.json.setDateFormat(dateFormat); + return this; + } + + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + this.json.setSqlDateFormat(dateFormat); + return this; + } + + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + this.json.setOffsetDateTimeFormat(dateFormat); + return this; + } + + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + this.json.setLocalDateFormat(dateFormat); + return this; + } + + public ApiClient setLenientOnJson(boolean lenientOnJson) { + this.json.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient.interceptors().add(loggingInterceptor); + } else { + httpClient.interceptors().remove(loggingInterceptor); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default tempopary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.getConnectTimeout(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.getReadTimeout(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient.setReadTimeout(readTimeout, TimeUnit.MILLISECONDS); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.getWriteTimeout(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient.setWriteTimeout(writeTimeout, TimeUnit.MILLISECONDS); + return this; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection)param) { + if (b.length() > 0) { + b.append(","); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) return params; + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * or matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + String respBody; + try { + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; + } catch (IOException e) { + throw new ApiException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + if (isJsonMime(contentType)) { + return json.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + respBody); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create(MediaType.parse(contentType), (byte[]) obj); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create(MediaType.parse(contentType), (File) obj); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(MediaType.parse(contentType), content); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @throws IOException If fail to prepare file for download + * @return Prepared file for the download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // File.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @throws ApiException If fail to execute the call + * @return ApiResponse<T> + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @see #execute(Call, Type) + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Request request, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @throws ApiException If the response has a unsuccessful status code or + * fail to deserialize the response body + * @return Type + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param progressRequestListener Progress request listener + * @return The HTTP call + * @throws ApiException If fail to serialize the request body object + */ + public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, progressRequestListener); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param progressRequestListener Progress request listener + * @return The HTTP request + * @throws ApiException If fail to serialize the request body object + */ + public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams); + + final String url = buildUrl(path, queryParams, collectionQueryParams); + final Request.Builder reqBuilder = new Request.Builder().url(url); + processHeaderParams(headerParams, reqBuilder); + + String contentType = (String) headerParams.get("Content-Type"); + // ensuring a default content type + if (contentType == null) { + contentType = "application/json"; + } + + RequestBody reqBody; + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentType)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentType)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create(MediaType.parse(contentType), ""); + } + } else { + reqBody = serialize(body, contentType); + } + + Request request = null; + + if(progressRequestListener != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + url.append(basePath).append(path); + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the ofrm of Map + * @param reqBuilder Reqeust.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + */ + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + FormEncodingBuilder formBuilder = new FormEncodingBuilder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); + } else { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); + mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue()))); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + TrustManager[] trustManagers = null; + HostnameVerifier hostnameVerifier = null; + if (!verifyingSsl) { + TrustManager trustAll = new X509TrustManager() { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {} + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {} + @Override + public X509Certificate[] getAcceptedIssuers() { return null; } + }; + SSLContext sslContext = SSLContext.getInstance("TLS"); + trustManagers = new TrustManager[]{ trustAll }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { return true; } + }; + } else if (sslCaCert != null) { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + Integer.toString(index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + trustManagerFactory.init(caKeyStore); + trustManagers = trustManagerFactory.getTrustManagers(); + } + + if (keyManagers != null || trustManagers != null) { + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient.setSslSocketFactory(sslContext.getSocketFactory()); + } else { + httpClient.setSslSocketFactory(null); + } + httpClient.setHostnameVerifier(hostnameVerifier); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } +} diff --git a/src/main/java/io/swagger/client/ApiException.java b/src/main/java/io/swagger/client/ApiException.java new file mode 100644 index 0000000..8b47f0b --- /dev/null +++ b/src/main/java/io/swagger/client/ApiException.java @@ -0,0 +1,90 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client; + +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") +public class ApiException extends Exception { + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/src/main/java/io/swagger/client/ApiResponse.java b/src/main/java/io/swagger/client/ApiResponse.java new file mode 100644 index 0000000..9b259bb --- /dev/null +++ b/src/main/java/io/swagger/client/ApiResponse.java @@ -0,0 +1,58 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/src/main/java/io/swagger/client/Configuration.java b/src/main/java/io/swagger/client/Configuration.java new file mode 100644 index 0000000..c3109dd --- /dev/null +++ b/src/main/java/io/swagger/client/Configuration.java @@ -0,0 +1,38 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client; + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") +public class Configuration { + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/src/main/java/io/swagger/client/GzipRequestInterceptor.java b/src/main/java/io/swagger/client/GzipRequestInterceptor.java new file mode 100644 index 0000000..f781916 --- /dev/null +++ b/src/main/java/io/swagger/client/GzipRequestInterceptor.java @@ -0,0 +1,80 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client; + +import com.squareup.okhttp.*; +import okio.Buffer; +import okio.BufferedSink; +import okio.GzipSink; +import okio.Okio; + +import java.io.IOException; + +/** + * Encodes request bodies using gzip. + * + * Taken from https://github.com/square/okhttp/issues/350 + */ +class GzipRequestInterceptor implements Interceptor { + @Override public Response intercept(Chain chain) throws IOException { + Request originalRequest = chain.request(); + if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { + return chain.proceed(originalRequest); + } + + Request compressedRequest = originalRequest.newBuilder() + .header("Content-Encoding", "gzip") + .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) + .build(); + return chain.proceed(compressedRequest); + } + + private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return new RequestBody() { + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() { + return buffer.size(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + sink.write(buffer.snapshot()); + } + }; + } + + private RequestBody gzip(final RequestBody body) { + return new RequestBody() { + @Override public MediaType contentType() { + return body.contentType(); + } + + @Override public long contentLength() { + return -1; // We don't know the compressed length in advance! + } + + @Override public void writeTo(BufferedSink sink) throws IOException { + BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); + body.writeTo(gzipSink); + gzipSink.close(); + } + }; + } +} \ No newline at end of file diff --git a/src/main/java/io/swagger/client/JSON.java b/src/main/java/io/swagger/client/JSON.java new file mode 100644 index 0000000..cdfe823 --- /dev/null +++ b/src/main/java/io/swagger/client/JSON.java @@ -0,0 +1,363 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.PostProcessor; +import io.gsonfire.TypeSelector; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.format.DateTimeFormatter; + +import io.swagger.client.model.*; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.util.Date; +import java.util.Map; +import java.util.HashMap; + +public class JSON { + private Gson gson; + private boolean isLenientOnJson = false; + private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder() + ; + return fireBuilder.createGsonBuilder(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if(null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map> classByDiscriminatorValue, String discriminatorValue) { + Class clazz = classByDiscriminatorValue.get(discriminatorValue.toUpperCase()); + if(null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + public JSON() { + gson = createGson() + .registerTypeAdapter(Date.class, dateTypeAdapter) + .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) + .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) + .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) + .create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + * @return JSON + */ + public JSON setGson(Gson gson) { + this.gson = gson; + return this; + } + + public JSON setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + return this; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + if (returnType.equals(String.class)) + return (T) body; + else throw (e); + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + return this; + } + + /** + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() { + } + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() { + } + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public JSON setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + return this; + } + +} diff --git a/src/main/java/io/swagger/client/Pair.java b/src/main/java/io/swagger/client/Pair.java new file mode 100644 index 0000000..92ac1bf --- /dev/null +++ b/src/main/java/io/swagger/client/Pair.java @@ -0,0 +1,51 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client; + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) return; + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) return; + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) return false; + if (arg.trim().isEmpty()) return false; + + return true; + } +} diff --git a/src/main/java/io/swagger/client/ProgressRequestBody.java b/src/main/java/io/swagger/client/ProgressRequestBody.java new file mode 100644 index 0000000..4ed3d26 --- /dev/null +++ b/src/main/java/io/swagger/client/ProgressRequestBody.java @@ -0,0 +1,76 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client; + +import com.squareup.okhttp.MediaType; +import com.squareup.okhttp.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + public interface ProgressRequestListener { + void onRequestProgress(long bytesWritten, long contentLength, boolean done); + } + + private final RequestBody requestBody; + + private final ProgressRequestListener progressListener; + + public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) { + this.requestBody = requestBody; + this.progressListener = progressListener; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/src/main/java/io/swagger/client/ProgressResponseBody.java b/src/main/java/io/swagger/client/ProgressResponseBody.java new file mode 100644 index 0000000..98f8c19 --- /dev/null +++ b/src/main/java/io/swagger/client/ProgressResponseBody.java @@ -0,0 +1,75 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client; + +import com.squareup.okhttp.MediaType; +import com.squareup.okhttp.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + public interface ProgressListener { + void update(long bytesRead, long contentLength, boolean done); + } + + private final ResponseBody responseBody; + private final ProgressListener progressListener; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) { + this.responseBody = responseBody; + this.progressListener = progressListener; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() throws IOException { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + progressListener.update(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} + + diff --git a/src/main/java/io/swagger/client/StringUtil.java b/src/main/java/io/swagger/client/StringUtil.java new file mode 100644 index 0000000..b5e12cd --- /dev/null +++ b/src/main/java/io/swagger/client/StringUtil.java @@ -0,0 +1,54 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client; + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) return true; + if (value != null && value.equalsIgnoreCase(str)) return true; + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) return ""; + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} diff --git a/src/main/java/io/swagger/client/api/DataRepositoryServiceApi.java b/src/main/java/io/swagger/client/api/DataRepositoryServiceApi.java new file mode 100644 index 0000000..cee38c1 --- /dev/null +++ b/src/main/java/io/swagger/client/api/DataRepositoryServiceApi.java @@ -0,0 +1,836 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.api; + +import io.swagger.client.ApiCallback; +import io.swagger.client.ApiClient; +import io.swagger.client.ApiException; +import io.swagger.client.ApiResponse; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; +import io.swagger.client.ProgressRequestBody; +import io.swagger.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.swagger.client.model.AccessURL; +import io.swagger.client.model.BasicResponse; +import io.swagger.client.model.DrsObject; +import io.swagger.client.model.Error; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DataRepositoryServiceApi { + private ApiClient apiClient; + + public DataRepositoryServiceApi() { + this(Configuration.getDefaultApiClient()); + } + + public DataRepositoryServiceApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Build call for deleteObjectGa4ghDrsV1ObjectsObjectIdDelete + * @param objectId (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call deleteObjectGa4ghDrsV1ObjectsObjectIdDeleteCall(String objectId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/ga4gh/drs/v1/objects/{object_id}" + .replaceAll("\\{" + "object_id" + "\\}", apiClient.escapeString(objectId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "OAuth2PasswordBearer" }; + return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call deleteObjectGa4ghDrsV1ObjectsObjectIdDeleteValidateBeforeCall(String objectId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'objectId' is set + if (objectId == null) { + throw new ApiException("Missing the required parameter 'objectId' when calling deleteObjectGa4ghDrsV1ObjectsObjectIdDelete(Async)"); + } + + com.squareup.okhttp.Call call = deleteObjectGa4ghDrsV1ObjectsObjectIdDeleteCall(objectId, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * Delete a DrsObject + * Delete a ```DrsObject``` index entry + * @param objectId (required) + * @return BasicResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public BasicResponse deleteObjectGa4ghDrsV1ObjectsObjectIdDelete(String objectId) throws ApiException { + ApiResponse resp = deleteObjectGa4ghDrsV1ObjectsObjectIdDeleteWithHttpInfo(objectId); + return resp.getData(); + } + + /** + * Delete a DrsObject + * Delete a ```DrsObject``` index entry + * @param objectId (required) + * @return ApiResponse<BasicResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse deleteObjectGa4ghDrsV1ObjectsObjectIdDeleteWithHttpInfo(String objectId) throws ApiException { + com.squareup.okhttp.Call call = deleteObjectGa4ghDrsV1ObjectsObjectIdDeleteValidateBeforeCall(objectId, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Delete a DrsObject (asynchronously) + * Delete a ```DrsObject``` index entry + * @param objectId (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call deleteObjectGa4ghDrsV1ObjectsObjectIdDeleteAsync(String objectId, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = deleteObjectGa4ghDrsV1ObjectsObjectIdDeleteValidateBeforeCall(objectId, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for getObjectAliasGa4ghDrsV1ObjectsGet + * @param alias The alias(ses) on which to query DrsObjects (regex compatible) (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call getObjectAliasGa4ghDrsV1ObjectsGetCall(List alias, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/ga4gh/drs/v1/objects"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (alias != null) + localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("multi", "alias", alias)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "OAuth2PasswordBearer" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call getObjectAliasGa4ghDrsV1ObjectsGetValidateBeforeCall(List alias, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'alias' is set + if (alias == null) { + throw new ApiException("Missing the required parameter 'alias' when calling getObjectAliasGa4ghDrsV1ObjectsGet(Async)"); + } + + com.squareup.okhttp.Call call = getObjectAliasGa4ghDrsV1ObjectsGetCall(alias, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * Query DrsObjects on alias + * Returns all objects that correspond to the list of aliases passed through the request. The query is regex compatible. + * @param alias The alias(ses) on which to query DrsObjects (regex compatible) (required) + * @return List<DrsObject> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public List getObjectAliasGa4ghDrsV1ObjectsGet(List alias) throws ApiException { + ApiResponse> resp = getObjectAliasGa4ghDrsV1ObjectsGetWithHttpInfo(alias); + return resp.getData(); + } + + /** + * Query DrsObjects on alias + * Returns all objects that correspond to the list of aliases passed through the request. The query is regex compatible. + * @param alias The alias(ses) on which to query DrsObjects (regex compatible) (required) + * @return ApiResponse<List<DrsObject>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse> getObjectAliasGa4ghDrsV1ObjectsGetWithHttpInfo(List alias) throws ApiException { + com.squareup.okhttp.Call call = getObjectAliasGa4ghDrsV1ObjectsGetValidateBeforeCall(alias, null, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Query DrsObjects on alias (asynchronously) + * Returns all objects that correspond to the list of aliases passed through the request. The query is regex compatible. + * @param alias The alias(ses) on which to query DrsObjects (regex compatible) (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call getObjectAliasGa4ghDrsV1ObjectsGetAsync(List alias, final ApiCallback> callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = getObjectAliasGa4ghDrsV1ObjectsGetValidateBeforeCall(alias, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken>(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet + * @param objectId ```DrsObject``` identifier (required) + * @param accessId An `access_id` from the `access_methods` list of a `DrsObject` (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGetCall(String objectId, String accessId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/ga4gh/drs/v1/objects/{object_id}/access/{access_id}" + .replaceAll("\\{" + "object_id" + "\\}", apiClient.escapeString(objectId.toString())) + .replaceAll("\\{" + "access_id" + "\\}", apiClient.escapeString(accessId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "OAuth2PasswordBearer" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGetValidateBeforeCall(String objectId, String accessId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'objectId' is set + if (objectId == null) { + throw new ApiException("Missing the required parameter 'objectId' when calling getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet(Async)"); + } + // verify the required parameter 'accessId' is set + if (accessId == null) { + throw new ApiException("Missing the required parameter 'accessId' when calling getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet(Async)"); + } + + com.squareup.okhttp.Call call = getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGetCall(objectId, accessId, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * Get a URL for fetching bytes + * Returns a URL that can be used to fetch the bytes of a `DrsObject`. This method only needs to be called when using an `AccessMethod` that contains an `access_id` (e.g., for servers that use signed URLs for fetching object bytes). + * @param objectId ```DrsObject``` identifier (required) + * @param accessId An `access_id` from the `access_methods` list of a `DrsObject` (required) + * @return AccessURL + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public AccessURL getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet(String objectId, String accessId) throws ApiException { + ApiResponse resp = getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGetWithHttpInfo(objectId, accessId); + return resp.getData(); + } + + /** + * Get a URL for fetching bytes + * Returns a URL that can be used to fetch the bytes of a `DrsObject`. This method only needs to be called when using an `AccessMethod` that contains an `access_id` (e.g., for servers that use signed URLs for fetching object bytes). + * @param objectId ```DrsObject``` identifier (required) + * @param accessId An `access_id` from the `access_methods` list of a `DrsObject` (required) + * @return ApiResponse<AccessURL> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGetWithHttpInfo(String objectId, String accessId) throws ApiException { + com.squareup.okhttp.Call call = getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGetValidateBeforeCall(objectId, accessId, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Get a URL for fetching bytes (asynchronously) + * Returns a URL that can be used to fetch the bytes of a `DrsObject`. This method only needs to be called when using an `AccessMethod` that contains an `access_id` (e.g., for servers that use signed URLs for fetching object bytes). + * @param objectId ```DrsObject``` identifier (required) + * @param accessId An `access_id` from the `access_methods` list of a `DrsObject` (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGetAsync(String objectId, String accessId, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGetValidateBeforeCall(objectId, accessId, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for getObjectGa4ghDrsV1ObjectsObjectIdGet + * @param objectId ```DrsObject``` identifier (required) + * @param expand 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. (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call getObjectGa4ghDrsV1ObjectsObjectIdGetCall(String objectId, Boolean expand, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/ga4gh/drs/v1/objects/{object_id}" + .replaceAll("\\{" + "object_id" + "\\}", apiClient.escapeString(objectId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (expand != null) + localVarQueryParams.addAll(apiClient.parameterToPair("expand", expand)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "OAuth2PasswordBearer" }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call getObjectGa4ghDrsV1ObjectsObjectIdGetValidateBeforeCall(String objectId, Boolean expand, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'objectId' is set + if (objectId == null) { + throw new ApiException("Missing the required parameter 'objectId' when calling getObjectGa4ghDrsV1ObjectsObjectIdGet(Async)"); + } + // verify the required parameter 'expand' is set + if (expand == null) { + throw new ApiException("Missing the required parameter 'expand' when calling getObjectGa4ghDrsV1ObjectsObjectIdGet(Async)"); + } + + com.squareup.okhttp.Call call = getObjectGa4ghDrsV1ObjectsObjectIdGetCall(objectId, expand, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * Retrieve a DrsObject + * Returns object metadata, and a list of access methods that can be used to fetch object bytes. + * @param objectId ```DrsObject``` identifier (required) + * @param expand 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. (required) + * @return DrsObject + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public DrsObject getObjectGa4ghDrsV1ObjectsObjectIdGet(String objectId, Boolean expand) throws ApiException { + ApiResponse resp = getObjectGa4ghDrsV1ObjectsObjectIdGetWithHttpInfo(objectId, expand); + return resp.getData(); + } + + /** + * Retrieve a DrsObject + * Returns object metadata, and a list of access methods that can be used to fetch object bytes. + * @param objectId ```DrsObject``` identifier (required) + * @param expand 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. (required) + * @return ApiResponse<DrsObject> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getObjectGa4ghDrsV1ObjectsObjectIdGetWithHttpInfo(String objectId, Boolean expand) throws ApiException { + com.squareup.okhttp.Call call = getObjectGa4ghDrsV1ObjectsObjectIdGetValidateBeforeCall(objectId, expand, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Retrieve a DrsObject (asynchronously) + * Returns object metadata, and a list of access methods that can be used to fetch object bytes. + * @param objectId ```DrsObject``` identifier (required) + * @param expand 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. (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call getObjectGa4ghDrsV1ObjectsObjectIdGetAsync(String objectId, Boolean expand, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = getObjectGa4ghDrsV1ObjectsObjectIdGetValidateBeforeCall(objectId, expand, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for postObjectGa4ghDrsV1ObjectsPost + * @param body (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call postObjectGa4ghDrsV1ObjectsPostCall(DrsObject body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/ga4gh/drs/v1/objects"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "OAuth2PasswordBearer" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call postObjectGa4ghDrsV1ObjectsPostValidateBeforeCall(DrsObject body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling postObjectGa4ghDrsV1ObjectsPost(Async)"); + } + + com.squareup.okhttp.Call call = postObjectGa4ghDrsV1ObjectsPostCall(body, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * Create a new DrsObject + * POST a requested ID to create an object that corresponds to this ID + * @param body (required) + * @return BasicResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public BasicResponse postObjectGa4ghDrsV1ObjectsPost(DrsObject body) throws ApiException { + ApiResponse resp = postObjectGa4ghDrsV1ObjectsPostWithHttpInfo(body); + return resp.getData(); + } + + /** + * Create a new DrsObject + * POST a requested ID to create an object that corresponds to this ID + * @param body (required) + * @return ApiResponse<BasicResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse postObjectGa4ghDrsV1ObjectsPostWithHttpInfo(DrsObject body) throws ApiException { + com.squareup.okhttp.Call call = postObjectGa4ghDrsV1ObjectsPostValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Create a new DrsObject (asynchronously) + * POST a requested ID to create an object that corresponds to this ID + * @param body (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call postObjectGa4ghDrsV1ObjectsPostAsync(DrsObject body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = postObjectGa4ghDrsV1ObjectsPostValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for putObjectGa4ghDrsV1ObjectsObjectIdPut + * @param body (required) + * @param objectId (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call putObjectGa4ghDrsV1ObjectsObjectIdPutCall(DrsObject body, String objectId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/ga4gh/drs/v1/objects/{object_id}" + .replaceAll("\\{" + "object_id" + "\\}", apiClient.escapeString(objectId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "OAuth2PasswordBearer" }; + return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call putObjectGa4ghDrsV1ObjectsObjectIdPutValidateBeforeCall(DrsObject body, String objectId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling putObjectGa4ghDrsV1ObjectsObjectIdPut(Async)"); + } + // verify the required parameter 'objectId' is set + if (objectId == null) { + throw new ApiException("Missing the required parameter 'objectId' when calling putObjectGa4ghDrsV1ObjectsObjectIdPut(Async)"); + } + + com.squareup.okhttp.Call call = putObjectGa4ghDrsV1ObjectsObjectIdPutCall(body, objectId, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * Update a DrsObject + * Update the ```DrsObject``` + * @param body (required) + * @param objectId (required) + * @return BasicResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public BasicResponse putObjectGa4ghDrsV1ObjectsObjectIdPut(DrsObject body, String objectId) throws ApiException { + ApiResponse resp = putObjectGa4ghDrsV1ObjectsObjectIdPutWithHttpInfo(body, objectId); + return resp.getData(); + } + + /** + * Update a DrsObject + * Update the ```DrsObject``` + * @param body (required) + * @param objectId (required) + * @return ApiResponse<BasicResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse putObjectGa4ghDrsV1ObjectsObjectIdPutWithHttpInfo(DrsObject body, String objectId) throws ApiException { + com.squareup.okhttp.Call call = putObjectGa4ghDrsV1ObjectsObjectIdPutValidateBeforeCall(body, objectId, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Update a DrsObject (asynchronously) + * Update the ```DrsObject``` + * @param body (required) + * @param objectId (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call putObjectGa4ghDrsV1ObjectsObjectIdPutAsync(DrsObject body, String objectId, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = putObjectGa4ghDrsV1ObjectsObjectIdPutValidateBeforeCall(body, objectId, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } +} diff --git a/src/main/java/io/swagger/client/api/HealthApi.java b/src/main/java/io/swagger/client/api/HealthApi.java new file mode 100644 index 0000000..68fbb36 --- /dev/null +++ b/src/main/java/io/swagger/client/api/HealthApi.java @@ -0,0 +1,171 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.api; + +import io.swagger.client.ApiCallback; +import io.swagger.client.ApiClient; +import io.swagger.client.ApiException; +import io.swagger.client.ApiResponse; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; +import io.swagger.client.ProgressRequestBody; +import io.swagger.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class HealthApi { + private ApiClient apiClient; + + public HealthApi() { + this(Configuration.getDefaultApiClient()); + } + + public HealthApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Build call for getHealthHealthGet + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call getHealthHealthGetCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/health"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call getHealthHealthGetValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + com.squareup.okhttp.Call call = getHealthHealthGetCall(progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * Check if the API is running correctly + * Health check for the API + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Object getHealthHealthGet() throws ApiException { + ApiResponse resp = getHealthHealthGetWithHttpInfo(); + return resp.getData(); + } + + /** + * Check if the API is running correctly + * Health check for the API + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse getHealthHealthGetWithHttpInfo() throws ApiException { + com.squareup.okhttp.Call call = getHealthHealthGetValidateBeforeCall(null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Check if the API is running correctly (asynchronously) + * Health check for the API + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call getHealthHealthGetAsync(final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = getHealthHealthGetValidateBeforeCall(progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } +} diff --git a/src/main/java/io/swagger/client/api/LoginApi.java b/src/main/java/io/swagger/client/api/LoginApi.java new file mode 100644 index 0000000..24f325e --- /dev/null +++ b/src/main/java/io/swagger/client/api/LoginApi.java @@ -0,0 +1,233 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.api; + +import io.swagger.client.ApiCallback; +import io.swagger.client.ApiClient; +import io.swagger.client.ApiException; +import io.swagger.client.ApiResponse; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; +import io.swagger.client.ProgressRequestBody; +import io.swagger.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.swagger.client.model.HTTPValidationError; +import io.swagger.client.model.Token; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class LoginApi { + private ApiClient apiClient; + + public LoginApi() { + this(Configuration.getDefaultApiClient()); + } + + public LoginApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Build call for loginTokenPost + * @param grantType (required) + * @param username (required) + * @param password (required) + * @param scope (required) + * @param clientId (required) + * @param clientSecret (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call loginTokenPostCall(String grantType, String username, String password, String scope, String clientId, String clientSecret, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/token"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + if (grantType != null) + localVarFormParams.put("grant_type", grantType); + if (username != null) + localVarFormParams.put("username", username); + if (password != null) + localVarFormParams.put("password", password); + if (scope != null) + localVarFormParams.put("scope", scope); + if (clientId != null) + localVarFormParams.put("client_id", clientId); + if (clientSecret != null) + localVarFormParams.put("client_secret", clientSecret); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call loginTokenPostValidateBeforeCall(String grantType, String username, String password, String scope, String clientId, String clientSecret, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'grantType' is set + if (grantType == null) { + throw new ApiException("Missing the required parameter 'grantType' when calling loginTokenPost(Async)"); + } + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling loginTokenPost(Async)"); + } + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException("Missing the required parameter 'password' when calling loginTokenPost(Async)"); + } + // verify the required parameter 'scope' is set + if (scope == null) { + throw new ApiException("Missing the required parameter 'scope' when calling loginTokenPost(Async)"); + } + // verify the required parameter 'clientId' is set + if (clientId == null) { + throw new ApiException("Missing the required parameter 'clientId' when calling loginTokenPost(Async)"); + } + // verify the required parameter 'clientSecret' is set + if (clientSecret == null) { + throw new ApiException("Missing the required parameter 'clientSecret' when calling loginTokenPost(Async)"); + } + + com.squareup.okhttp.Call call = loginTokenPostCall(grantType, username, password, scope, clientId, clientSecret, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * Login + * + * @param grantType (required) + * @param username (required) + * @param password (required) + * @param scope (required) + * @param clientId (required) + * @param clientSecret (required) + * @return Token + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Token loginTokenPost(String grantType, String username, String password, String scope, String clientId, String clientSecret) throws ApiException { + ApiResponse resp = loginTokenPostWithHttpInfo(grantType, username, password, scope, clientId, clientSecret); + return resp.getData(); + } + + /** + * Login + * + * @param grantType (required) + * @param username (required) + * @param password (required) + * @param scope (required) + * @param clientId (required) + * @param clientSecret (required) + * @return ApiResponse<Token> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse loginTokenPostWithHttpInfo(String grantType, String username, String password, String scope, String clientId, String clientSecret) throws ApiException { + com.squareup.okhttp.Call call = loginTokenPostValidateBeforeCall(grantType, username, password, scope, clientId, clientSecret, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * Login (asynchronously) + * + * @param grantType (required) + * @param username (required) + * @param password (required) + * @param scope (required) + * @param clientId (required) + * @param clientSecret (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call loginTokenPostAsync(String grantType, String username, String password, String scope, String clientId, String clientSecret, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = loginTokenPostValidateBeforeCall(grantType, username, password, scope, clientId, clientSecret, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } +} diff --git a/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/src/main/java/io/swagger/client/auth/ApiKeyAuth.java new file mode 100644 index 0000000..83b0abc --- /dev/null +++ b/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -0,0 +1,74 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.auth; + +import io.swagger.client.Pair; + +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams) { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } + } +} diff --git a/src/main/java/io/swagger/client/auth/Authentication.java b/src/main/java/io/swagger/client/auth/Authentication.java new file mode 100644 index 0000000..f87a2f1 --- /dev/null +++ b/src/main/java/io/swagger/client/auth/Authentication.java @@ -0,0 +1,28 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.auth; + +import io.swagger.client.Pair; + +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + */ + void applyToParams(List queryParams, Map headerParams); +} diff --git a/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/src/main/java/io/swagger/client/auth/HttpBasicAuth.java new file mode 100644 index 0000000..80ae3b9 --- /dev/null +++ b/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -0,0 +1,53 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.auth; + +import io.swagger.client.Pair; + +import com.squareup.okhttp.Credentials; + +import java.util.Map; +import java.util.List; + +import java.io.UnsupportedEncodingException; + +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams) { + if (username == null && password == null) { + return; + } + headerParams.put("Authorization", Credentials.basic( + username == null ? "" : username, + password == null ? "" : password)); + } +} diff --git a/src/main/java/io/swagger/client/auth/OAuth.java b/src/main/java/io/swagger/client/auth/OAuth.java new file mode 100644 index 0000000..3a235e3 --- /dev/null +++ b/src/main/java/io/swagger/client/auth/OAuth.java @@ -0,0 +1,38 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.auth; + +import io.swagger.client.Pair; + +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams) { + if (accessToken != null) { + headerParams.put("Authorization", "Bearer " + accessToken); + } + } +} diff --git a/src/main/java/io/swagger/client/auth/OAuthFlow.java b/src/main/java/io/swagger/client/auth/OAuthFlow.java new file mode 100644 index 0000000..570c5f6 --- /dev/null +++ b/src/main/java/io/swagger/client/auth/OAuthFlow.java @@ -0,0 +1,17 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.auth; + +public enum OAuthFlow { + accessCode, implicit, password, application +} diff --git a/src/main/java/io/swagger/client/model/AccessMethods.java b/src/main/java/io/swagger/client/model/AccessMethods.java new file mode 100644 index 0000000..4706e29 --- /dev/null +++ b/src/main/java/io/swagger/client/model/AccessMethods.java @@ -0,0 +1,162 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.client.model.AccessURL; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +/** + * AccessMethods + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class AccessMethods { + @SerializedName("type") + private String type = null; + + @SerializedName("access_url") + private AccessURL accessUrl = null; + + @SerializedName("access_id") + private String accessId = null; + + @SerializedName("region") + private String region = null; + + public AccessMethods type(String type) { + this.type = type; + return this; + } + + /** + * Enum: ```\"s3\"``` ```\"gs\"``` ```\"ftp\"``` ```\"gsiftp\"``` ```\"globus\"``` ```\"htsget\"``` ```\"https\"``` ```\"file\"``` Type of the access method. + * @return type + **/ + @Schema(required = true, description = "Enum: ```\"s3\"``` ```\"gs\"``` ```\"ftp\"``` ```\"gsiftp\"``` ```\"globus\"``` ```\"htsget\"``` ```\"https\"``` ```\"file\"``` Type of the access method.") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public AccessMethods accessUrl(AccessURL accessUrl) { + this.accessUrl = accessUrl; + return this; + } + + /** + * Get accessUrl + * @return accessUrl + **/ + @Schema(description = "") + public AccessURL getAccessUrl() { + return accessUrl; + } + + public void setAccessUrl(AccessURL accessUrl) { + this.accessUrl = accessUrl; + } + + public AccessMethods accessId(String accessId) { + this.accessId = accessId; + return this; + } + + /** + * An arbitrary string to be passed to the ```/access``` method to get an ```AccessURL```. This string must be unique within the scope of a single object. Note that at least one of ```access_url``` and ```access_id``` must be provided. + * @return accessId + **/ + @Schema(description = "An arbitrary string to be passed to the ```/access``` method to get an ```AccessURL```. This string must be unique within the scope of a single object. Note that at least one of ```access_url``` and ```access_id``` must be provided.") + public String getAccessId() { + return accessId; + } + + public void setAccessId(String accessId) { + this.accessId = accessId; + } + + public AccessMethods region(String region) { + this.region = region; + return this; + } + + /** + * Name of the region in the cloud service provider that the object belongs to. + * @return region + **/ + @Schema(description = "Name of the region in the cloud service provider that the object belongs to.") + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccessMethods accessMethods = (AccessMethods) o; + return Objects.equals(this.type, accessMethods.type) && + Objects.equals(this.accessUrl, accessMethods.accessUrl) && + Objects.equals(this.accessId, accessMethods.accessId) && + Objects.equals(this.region, accessMethods.region); + } + + @Override + public int hashCode() { + return Objects.hash(type, accessUrl, accessId, region); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccessMethods {\n"); + + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" accessUrl: ").append(toIndentedString(accessUrl)).append("\n"); + sb.append(" accessId: ").append(toIndentedString(accessId)).append("\n"); + sb.append(" region: ").append(toIndentedString(region)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/io/swagger/client/model/AccessURL.java b/src/main/java/io/swagger/client/model/AccessURL.java new file mode 100644 index 0000000..f8ce108 --- /dev/null +++ b/src/main/java/io/swagger/client/model/AccessURL.java @@ -0,0 +1,125 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +/** + * AccessURL + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class AccessURL { + @SerializedName("url") + private String url = null; + + @SerializedName("headers") + private List headers = null; + + public AccessURL url(String url) { + this.url = url; + return this; + } + + /** + * A fully resolvable URL that can be used to fetch the actual object bytes. + * @return url + **/ + @Schema(required = true, description = "A fully resolvable URL that can be used to fetch the actual object bytes.") + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public AccessURL headers(List headers) { + this.headers = headers; + return this; + } + + public AccessURL addHeadersItem(String headersItem) { + if (this.headers == null) { + this.headers = new ArrayList(); + } + this.headers.add(headersItem); + return this; + } + + /** + * An optional list of headers to include in the HTTP request to ```url```. These headers can be used to provide auth tokens required to fetch the object bytes. + * @return headers + **/ + @Schema(description = "An optional list of headers to include in the HTTP request to ```url```. These headers can be used to provide auth tokens required to fetch the object bytes.") + public List getHeaders() { + return headers; + } + + public void setHeaders(List headers) { + this.headers = headers; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccessURL accessURL = (AccessURL) o; + return Objects.equals(this.url, accessURL.url) && + Objects.equals(this.headers, accessURL.headers); + } + + @Override + public int hashCode() { + return Objects.hash(url, headers); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccessURL {\n"); + + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/io/swagger/client/model/AllOfDrsObjectAccessMethods.java b/src/main/java/io/swagger/client/model/AllOfDrsObjectAccessMethods.java new file mode 100644 index 0000000..16a16e5 --- /dev/null +++ b/src/main/java/io/swagger/client/model/AllOfDrsObjectAccessMethods.java @@ -0,0 +1,65 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.client.model.AccessMethods; +import io.swagger.client.model.AccessURL; +import io.swagger.v3.oas.annotations.media.Schema; +/** + * The list of access methods that can be used to fetch the ```DrsObject```. Required for single blobs; optional for bundles. + */ +@Schema(description = "The list of access methods that can be used to fetch the ```DrsObject```. Required for single blobs; optional for bundles.") +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class AllOfDrsObjectAccessMethods extends AccessMethods { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfDrsObjectAccessMethods {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/io/swagger/client/model/AllOfDrsObjectChecksums.java b/src/main/java/io/swagger/client/model/AllOfDrsObjectChecksums.java new file mode 100644 index 0000000..4c06ddc --- /dev/null +++ b/src/main/java/io/swagger/client/model/AllOfDrsObjectChecksums.java @@ -0,0 +1,64 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.client.model.Checksums; +import io.swagger.v3.oas.annotations.media.Schema; +/** + * The checksum of the ```DrsObject```. At least one checksum must be provided. For blobs, the checksum is computed over the bytes in the blob. For bundles, the checksum is computed over a sorted concatenation of the checksums of its top-level contained objects (not recursive, names not included). The list of checksums is sorted alphabetically (hex-code) before concatenation and a further checksum is performed on the concatenated checksum value. For example, if a bundle contains blobs with the following checksums: md5(blob1) = 72794b6d md5(blob2) = 5e089d29 Then the checksum of the bundle is: md5( concat( sort( md5(blob1), md5(blob2) ) ) ) = md5( concat( sort( 72794b6d, 5e089d29 ) ) ) = md5( concat( 5e089d29, 72794b6d ) ) = md5( 5e089d2972794b6d ) = f7a29a04 + */ +@Schema(description = "The checksum of the ```DrsObject```. At least one checksum must be provided. For blobs, the checksum is computed over the bytes in the blob. For bundles, the checksum is computed over a sorted concatenation of the checksums of its top-level contained objects (not recursive, names not included). The list of checksums is sorted alphabetically (hex-code) before concatenation and a further checksum is performed on the concatenated checksum value. For example, if a bundle contains blobs with the following checksums: md5(blob1) = 72794b6d md5(blob2) = 5e089d29 Then the checksum of the bundle is: md5( concat( sort( md5(blob1), md5(blob2) ) ) ) = md5( concat( sort( 72794b6d, 5e089d29 ) ) ) = md5( concat( 5e089d29, 72794b6d ) ) = md5( 5e089d2972794b6d ) = f7a29a04") +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class AllOfDrsObjectChecksums extends Checksums { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfDrsObjectChecksums {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/io/swagger/client/model/AllOfDrsObjectContents.java b/src/main/java/io/swagger/client/model/AllOfDrsObjectContents.java new file mode 100644 index 0000000..8757338 --- /dev/null +++ b/src/main/java/io/swagger/client/model/AllOfDrsObjectContents.java @@ -0,0 +1,65 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.client.model.ContentsExpanded; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.List; +/** + * If not set, this ```DrsObject``` is a single blob. If set, this ```DrsObject``` is a bundle containing the listed ```ContentsObject``` s (some of which may be further nested). + */ +@Schema(description = "If not set, this ```DrsObject``` is a single blob. If set, this ```DrsObject``` is a bundle containing the listed ```ContentsObject``` s (some of which may be further nested).") +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class AllOfDrsObjectContents extends ContentsExpanded { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfDrsObjectContents {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/io/swagger/client/model/BasicResponse.java b/src/main/java/io/swagger/client/model/BasicResponse.java new file mode 100644 index 0000000..5a9fa0f --- /dev/null +++ b/src/main/java/io/swagger/client/model/BasicResponse.java @@ -0,0 +1,92 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +/** + * BasicResponse + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class BasicResponse { + @SerializedName("object_id") + private String objectId = null; + + public BasicResponse objectId(String objectId) { + this.objectId = objectId; + return this; + } + + /** + * The ID of the created Data Object + * @return objectId + **/ + @Schema(example = "string", required = true, description = "The ID of the created Data Object") + public String getObjectId() { + return objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BasicResponse basicResponse = (BasicResponse) o; + return Objects.equals(this.objectId, basicResponse.objectId); + } + + @Override + public int hashCode() { + return Objects.hash(objectId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BasicResponse {\n"); + + sb.append(" objectId: ").append(toIndentedString(objectId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/io/swagger/client/model/BodyLoginTokenPost.java b/src/main/java/io/swagger/client/model/BodyLoginTokenPost.java new file mode 100644 index 0000000..83b2aa9 --- /dev/null +++ b/src/main/java/io/swagger/client/model/BodyLoginTokenPost.java @@ -0,0 +1,207 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +/** + * BodyLoginTokenPost + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class BodyLoginTokenPost { + @SerializedName("grant_type") + private String grantType = null; + + @SerializedName("username") + private String username = null; + + @SerializedName("password") + private String password = null; + + @SerializedName("scope") + private String scope = ""; + + @SerializedName("client_id") + private String clientId = null; + + @SerializedName("client_secret") + private String clientSecret = null; + + public BodyLoginTokenPost grantType(String grantType) { + this.grantType = grantType; + return this; + } + + /** + * Get grantType + * @return grantType + **/ + @Schema(description = "") + public String getGrantType() { + return grantType; + } + + public void setGrantType(String grantType) { + this.grantType = grantType; + } + + public BodyLoginTokenPost username(String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @Schema(required = true, description = "") + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public BodyLoginTokenPost password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @Schema(required = true, description = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public BodyLoginTokenPost scope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get scope + * @return scope + **/ + @Schema(description = "") + public String getScope() { + return scope; + } + + public void setScope(String scope) { + this.scope = scope; + } + + public BodyLoginTokenPost clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get clientId + * @return clientId + **/ + @Schema(description = "") + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public BodyLoginTokenPost clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get clientSecret + * @return clientSecret + **/ + @Schema(description = "") + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BodyLoginTokenPost bodyLoginTokenPost = (BodyLoginTokenPost) o; + return Objects.equals(this.grantType, bodyLoginTokenPost.grantType) && + Objects.equals(this.username, bodyLoginTokenPost.username) && + Objects.equals(this.password, bodyLoginTokenPost.password) && + Objects.equals(this.scope, bodyLoginTokenPost.scope) && + Objects.equals(this.clientId, bodyLoginTokenPost.clientId) && + Objects.equals(this.clientSecret, bodyLoginTokenPost.clientSecret); + } + + @Override + public int hashCode() { + return Objects.hash(grantType, username, password, scope, clientId, clientSecret); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BodyLoginTokenPost {\n"); + + sb.append(" grantType: ").append(toIndentedString(grantType)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n"); + sb.append(" clientSecret: ").append(toIndentedString(clientSecret)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/io/swagger/client/model/Checksums.java b/src/main/java/io/swagger/client/model/Checksums.java new file mode 100644 index 0000000..2c14a89 --- /dev/null +++ b/src/main/java/io/swagger/client/model/Checksums.java @@ -0,0 +1,115 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +/** + * Checksums + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class Checksums { + @SerializedName("checksum") + private String checksum = null; + + @SerializedName("type") + private String type = null; + + public Checksums checksum(String checksum) { + this.checksum = checksum; + return this; + } + + /** + * The hex-string encoded checksum for the data + * @return checksum + **/ + @Schema(required = true, description = "The hex-string encoded checksum for the data") + public String getChecksum() { + return checksum; + } + + public void setChecksum(String checksum) { + this.checksum = checksum; + } + + public Checksums type(String type) { + this.type = type; + return this; + } + + /** + * The digest method used to create the checksum. The value (e.g. ```sha-256```) SHOULD be listed as ```Hash Name String``` in the https://www.iana.org/assignments/named-information/named-information.xhtml#hash-alg[IANA Named Information Hash Algorithm Registry]. Other values MAY be used, as long as implementors are aware of the issues discussed in https://tools.ietf.org/html/rfc6920#section-9.4[RFC6920]. GA4GH may provide more explicit guidance for use of non-IANA-registered algorithms in the future. Until then, if implementors do choose such an algorithm (e.g. because it's implemented by their storage provider), they SHOULD use an existing standard ```type``` value such as ```md5```, ```etag```, ```crc32c```, ```trunc512```, or ```sha1```. + * @return type + **/ + @Schema(required = true, description = "The digest method used to create the checksum. The value (e.g. ```sha-256```) SHOULD be listed as ```Hash Name String``` in the https://www.iana.org/assignments/named-information/named-information.xhtml#hash-alg[IANA Named Information Hash Algorithm Registry]. Other values MAY be used, as long as implementors are aware of the issues discussed in https://tools.ietf.org/html/rfc6920#section-9.4[RFC6920]. GA4GH may provide more explicit guidance for use of non-IANA-registered algorithms in the future. Until then, if implementors do choose such an algorithm (e.g. because it's implemented by their storage provider), they SHOULD use an existing standard ```type``` value such as ```md5```, ```etag```, ```crc32c```, ```trunc512```, or ```sha1```.") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Checksums checksums = (Checksums) o; + return Objects.equals(this.checksum, checksums.checksum) && + Objects.equals(this.type, checksums.type); + } + + @Override + public int hashCode() { + return Objects.hash(checksum, type); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Checksums {\n"); + + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/io/swagger/client/model/ContentsExpanded.java b/src/main/java/io/swagger/client/model/ContentsExpanded.java new file mode 100644 index 0000000..0fcfbda --- /dev/null +++ b/src/main/java/io/swagger/client/model/ContentsExpanded.java @@ -0,0 +1,179 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +/** + * ContentsExpanded + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class ContentsExpanded { + @SerializedName("name") + private String name = null; + + @SerializedName("id") + private String id = null; + + @SerializedName("drs_uri") + private List drsUri = null; + + @SerializedName("contents") + private List contents = null; + + public ContentsExpanded name(String name) { + this.name = name; + return this; + } + + /** + * A name declared by the bundle author that must be used when materialising this object, overriding any name directly associated with the object itself. The name must be unique with the containing bundle. This string is made up of uppercase and lowercase letters, decimal digits, hypen, period, and underscore [A-Za-z0-9.-_]. See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282[portable filenames]. + * @return name + **/ + @Schema(required = true, description = "A name declared by the bundle author that must be used when materialising this object, overriding any name directly associated with the object itself. The name must be unique with the containing bundle. This string is made up of uppercase and lowercase letters, decimal digits, hypen, period, and underscore [A-Za-z0-9.-_]. See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282[portable filenames].") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ContentsExpanded id(String id) { + this.id = id; + return this; + } + + /** + * A DRS identifier of a ```DrsObject``` (either a single blob or a nested bundle). If this ```ContentsObject``` is an object within a nested bundle, then the id is optional. Otherwise, the id is required. + * @return id + **/ + @Schema(description = "A DRS identifier of a ```DrsObject``` (either a single blob or a nested bundle). If this ```ContentsObject``` is an object within a nested bundle, then the id is optional. Otherwise, the id is required.") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ContentsExpanded drsUri(List drsUri) { + this.drsUri = drsUri; + return this; + } + + public ContentsExpanded addDrsUriItem(String drsUriItem) { + if (this.drsUri == null) { + this.drsUri = new ArrayList(); + } + this.drsUri.add(drsUriItem); + return this; + } + + /** + * A list of full DRS identifier URI paths that may be used to obtain the object. These URIs may be external to this DRS instance. + * @return drsUri + **/ + @Schema(description = "A list of full DRS identifier URI paths that may be used to obtain the object. These URIs may be external to this DRS instance.") + public List getDrsUri() { + return drsUri; + } + + public void setDrsUri(List drsUri) { + this.drsUri = drsUri; + } + + public ContentsExpanded contents(List contents) { + this.contents = contents; + return this; + } + + public ContentsExpanded addContentsItem(String contentsItem) { + if (this.contents == null) { + this.contents = new ArrayList(); + } + this.contents.add(contentsItem); + return this; + } + + /** + * If this ContentsObject describes a nested bundle and the caller specified \"?expand=true\" on the request, then this contents array must be present and describe the objects within the nested bundle. + * @return contents + **/ + @Schema(description = "If this ContentsObject describes a nested bundle and the caller specified \"?expand=true\" on the request, then this contents array must be present and describe the objects within the nested bundle.") + public List getContents() { + return contents; + } + + public void setContents(List contents) { + this.contents = contents; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ContentsExpanded contentsExpanded = (ContentsExpanded) o; + return Objects.equals(this.name, contentsExpanded.name) && + Objects.equals(this.id, contentsExpanded.id) && + Objects.equals(this.drsUri, contentsExpanded.drsUri) && + Objects.equals(this.contents, contentsExpanded.contents); + } + + @Override + public int hashCode() { + return Objects.hash(name, id, drsUri, contents); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ContentsExpanded {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" drsUri: ").append(toIndentedString(drsUri)).append("\n"); + sb.append(" contents: ").append(toIndentedString(contents)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/io/swagger/client/model/DrsObject.java b/src/main/java/io/swagger/client/model/DrsObject.java new file mode 100644 index 0000000..0069d17 --- /dev/null +++ b/src/main/java/io/swagger/client/model/DrsObject.java @@ -0,0 +1,378 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +/** + * DrsObject + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class DrsObject { + @SerializedName("id") + private String id = null; + + @SerializedName("name") + private String name = null; + + @SerializedName("self_uri") + private String selfUri = null; + + @SerializedName("size") + private Integer size = null; + + @SerializedName("created_time") + private String createdTime = null; + + @SerializedName("updated_time") + private String updatedTime = null; + + @SerializedName("version") + private String version = null; + + @SerializedName("mime_type") + private String mimeType = null; + + @SerializedName("checksums") + private AllOfDrsObjectChecksums checksums = null; + + @SerializedName("access_methods") + private AllOfDrsObjectAccessMethods accessMethods = null; + + @SerializedName("contents") + private AllOfDrsObjectContents contents = null; + + @SerializedName("description") + private String description = null; + + @SerializedName("aliases") + private List aliases = null; + + public DrsObject id(String id) { + this.id = id; + return this; + } + + /** + * An identifier unique to this ```DrsObject``` + * @return id + **/ + @Schema(required = true, description = "An identifier unique to this ```DrsObject```") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public DrsObject name(String name) { + this.name = name; + return this; + } + + /** + * A string that can be used to name a ```DrsObject```. This string is made up of uppercase and lowercase letters, decimal digits, hypen, period, and underscore [A-Za-z0-9.-_]. See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282[portable filenames]. + * @return name + **/ + @Schema(description = "A string that can be used to name a ```DrsObject```. This string is made up of uppercase and lowercase letters, decimal digits, hypen, period, and underscore [A-Za-z0-9.-_]. See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282[portable filenames].") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public DrsObject selfUri(String selfUri) { + this.selfUri = selfUri; + return this; + } + + /** + * A drs:// hostname-based URI, as defined in the DRS documentation, that tells clients how to access this object. The intent of this field is to make DRS objects self-contained, and therefore easier for clients to store and pass around. For example, if you arrive at this DRS JSON by resolving a compact identifier-based DRS URI, the ```self_uri``` presents you with a hostname and properly encoded DRS ID for use in subsequent ```access``` endpoint calls. + * @return selfUri + **/ + @Schema(required = true, description = "A drs:// hostname-based URI, as defined in the DRS documentation, that tells clients how to access this object. The intent of this field is to make DRS objects self-contained, and therefore easier for clients to store and pass around. For example, if you arrive at this DRS JSON by resolving a compact identifier-based DRS URI, the ```self_uri``` presents you with a hostname and properly encoded DRS ID for use in subsequent ```access``` endpoint calls.") + public String getSelfUri() { + return selfUri; + } + + public void setSelfUri(String selfUri) { + this.selfUri = selfUri; + } + + public DrsObject size(Integer size) { + this.size = size; + return this; + } + + /** + * For blobs, the blob size in bytes. For bundles, the cumulative size, in bytes, of items in the contents field. + * @return size + **/ + @Schema(required = true, description = "For blobs, the blob size in bytes. For bundles, the cumulative size, in bytes, of items in the contents field.") + public Integer getSize() { + return size; + } + + public void setSize(Integer size) { + this.size = size; + } + + public DrsObject createdTime(String createdTime) { + this.createdTime = createdTime; + return this; + } + + /** + * Timestamp of content creation in RFC3339. (This is the creation time of the underlying content, not of the JSON object.) + * @return createdTime + **/ + @Schema(required = true, description = "Timestamp of content creation in RFC3339. (This is the creation time of the underlying content, not of the JSON object.)") + public String getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(String createdTime) { + this.createdTime = createdTime; + } + + public DrsObject updatedTime(String updatedTime) { + this.updatedTime = updatedTime; + return this; + } + + /** + * Timestamp of content update in RFC3339, identical to ```created_time``` in systems that do not support updates. (This is the update time of the underlying content, not of the JSON object.) + * @return updatedTime + **/ + @Schema(description = "Timestamp of content update in RFC3339, identical to ```created_time``` in systems that do not support updates. (This is the update time of the underlying content, not of the JSON object.)") + public String getUpdatedTime() { + return updatedTime; + } + + public void setUpdatedTime(String updatedTime) { + this.updatedTime = updatedTime; + } + + public DrsObject version(String version) { + this.version = version; + return this; + } + + /** + * A string representing a version. (Some systems may use checksum, a RFC3339 timestamp, or an incrementing version number.) + * @return version + **/ + @Schema(description = "A string representing a version. (Some systems may use checksum, a RFC3339 timestamp, or an incrementing version number.)") + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public DrsObject mimeType(String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * A string providing the mime-type of the ```DrsObject```. + * @return mimeType + **/ + @Schema(description = "A string providing the mime-type of the ```DrsObject```.") + public String getMimeType() { + return mimeType; + } + + public void setMimeType(String mimeType) { + this.mimeType = mimeType; + } + + public DrsObject checksums(AllOfDrsObjectChecksums checksums) { + this.checksums = checksums; + return this; + } + + /** + * The checksum of the ```DrsObject```. At least one checksum must be provided. For blobs, the checksum is computed over the bytes in the blob. For bundles, the checksum is computed over a sorted concatenation of the checksums of its top-level contained objects (not recursive, names not included). The list of checksums is sorted alphabetically (hex-code) before concatenation and a further checksum is performed on the concatenated checksum value. For example, if a bundle contains blobs with the following checksums: md5(blob1) = 72794b6d md5(blob2) = 5e089d29 Then the checksum of the bundle is: md5( concat( sort( md5(blob1), md5(blob2) ) ) ) = md5( concat( sort( 72794b6d, 5e089d29 ) ) ) = md5( concat( 5e089d29, 72794b6d ) ) = md5( 5e089d2972794b6d ) = f7a29a04 + * @return checksums + **/ + @Schema(required = true, description = "The checksum of the ```DrsObject```. At least one checksum must be provided. For blobs, the checksum is computed over the bytes in the blob. For bundles, the checksum is computed over a sorted concatenation of the checksums of its top-level contained objects (not recursive, names not included). The list of checksums is sorted alphabetically (hex-code) before concatenation and a further checksum is performed on the concatenated checksum value. For example, if a bundle contains blobs with the following checksums: md5(blob1) = 72794b6d md5(blob2) = 5e089d29 Then the checksum of the bundle is: md5( concat( sort( md5(blob1), md5(blob2) ) ) ) = md5( concat( sort( 72794b6d, 5e089d29 ) ) ) = md5( concat( 5e089d29, 72794b6d ) ) = md5( 5e089d2972794b6d ) = f7a29a04") + public AllOfDrsObjectChecksums getChecksums() { + return checksums; + } + + public void setChecksums(AllOfDrsObjectChecksums checksums) { + this.checksums = checksums; + } + + public DrsObject accessMethods(AllOfDrsObjectAccessMethods accessMethods) { + this.accessMethods = accessMethods; + return this; + } + + /** + * The list of access methods that can be used to fetch the ```DrsObject```. Required for single blobs; optional for bundles. + * @return accessMethods + **/ + @Schema(description = "The list of access methods that can be used to fetch the ```DrsObject```. Required for single blobs; optional for bundles.") + public AllOfDrsObjectAccessMethods getAccessMethods() { + return accessMethods; + } + + public void setAccessMethods(AllOfDrsObjectAccessMethods accessMethods) { + this.accessMethods = accessMethods; + } + + public DrsObject contents(AllOfDrsObjectContents contents) { + this.contents = contents; + return this; + } + + /** + * If not set, this ```DrsObject``` is a single blob. If set, this ```DrsObject``` is a bundle containing the listed ```ContentsObject``` s (some of which may be further nested). + * @return contents + **/ + @Schema(description = "If not set, this ```DrsObject``` is a single blob. If set, this ```DrsObject``` is a bundle containing the listed ```ContentsObject``` s (some of which may be further nested).") + public AllOfDrsObjectContents getContents() { + return contents; + } + + public void setContents(AllOfDrsObjectContents contents) { + this.contents = contents; + } + + public DrsObject description(String description) { + this.description = description; + return this; + } + + /** + * A human readable description of the ```DrsObject```. + * @return description + **/ + @Schema(description = "A human readable description of the ```DrsObject```.") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public DrsObject aliases(List aliases) { + this.aliases = aliases; + return this; + } + + public DrsObject addAliasesItem(String aliasesItem) { + if (this.aliases == null) { + this.aliases = new ArrayList(); + } + this.aliases.add(aliasesItem); + return this; + } + + /** + * A list of strings that can be used to find other metadata about this ```DrsObject``` from external metadata sources. These aliases can be used to represent secondary accession numbers or external GUIDs. + * @return aliases + **/ + @Schema(description = "A list of strings that can be used to find other metadata about this ```DrsObject``` from external metadata sources. These aliases can be used to represent secondary accession numbers or external GUIDs.") + public List getAliases() { + return aliases; + } + + public void setAliases(List aliases) { + this.aliases = aliases; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DrsObject drsObject = (DrsObject) o; + return Objects.equals(this.id, drsObject.id) && + Objects.equals(this.name, drsObject.name) && + Objects.equals(this.selfUri, drsObject.selfUri) && + Objects.equals(this.size, drsObject.size) && + Objects.equals(this.createdTime, drsObject.createdTime) && + Objects.equals(this.updatedTime, drsObject.updatedTime) && + Objects.equals(this.version, drsObject.version) && + Objects.equals(this.mimeType, drsObject.mimeType) && + Objects.equals(this.checksums, drsObject.checksums) && + Objects.equals(this.accessMethods, drsObject.accessMethods) && + Objects.equals(this.contents, drsObject.contents) && + Objects.equals(this.description, drsObject.description) && + Objects.equals(this.aliases, drsObject.aliases); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, selfUri, size, createdTime, updatedTime, version, mimeType, checksums, accessMethods, contents, description, aliases); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DrsObject {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" selfUri: ").append(toIndentedString(selfUri)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" createdTime: ").append(toIndentedString(createdTime)).append("\n"); + sb.append(" updatedTime: ").append(toIndentedString(updatedTime)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append(" checksums: ").append(toIndentedString(checksums)).append("\n"); + sb.append(" accessMethods: ").append(toIndentedString(accessMethods)).append("\n"); + sb.append(" contents: ").append(toIndentedString(contents)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" aliases: ").append(toIndentedString(aliases)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/io/swagger/client/model/Error.java b/src/main/java/io/swagger/client/model/Error.java new file mode 100644 index 0000000..9f753a0 --- /dev/null +++ b/src/main/java/io/swagger/client/model/Error.java @@ -0,0 +1,115 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +/** + * Error + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class Error { + @SerializedName("msg") + private String msg = null; + + @SerializedName("status_code") + private Integer statusCode = null; + + public Error msg(String msg) { + this.msg = msg; + return this; + } + + /** + * A detailed error message. + * @return msg + **/ + @Schema(description = "A detailed error message.") + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public Error statusCode(Integer statusCode) { + this.statusCode = statusCode; + return this; + } + + /** + * The integer representing the HTTP status code (e.g. 200, 404). + * @return statusCode + **/ + @Schema(required = true, description = "The integer representing the HTTP status code (e.g. 200, 404).") + public Integer getStatusCode() { + return statusCode; + } + + public void setStatusCode(Integer statusCode) { + this.statusCode = statusCode; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error error = (Error) o; + return Objects.equals(this.msg, error.msg) && + Objects.equals(this.statusCode, error.statusCode); + } + + @Override + public int hashCode() { + return Objects.hash(msg, statusCode); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" statusCode: ").append(toIndentedString(statusCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/io/swagger/client/model/HTTPValidationError.java b/src/main/java/io/swagger/client/model/HTTPValidationError.java new file mode 100644 index 0000000..3c227a1 --- /dev/null +++ b/src/main/java/io/swagger/client/model/HTTPValidationError.java @@ -0,0 +1,103 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.client.model.ValidationError; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +/** + * HTTPValidationError + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class HTTPValidationError { + @SerializedName("detail") + private List detail = null; + + public HTTPValidationError detail(List detail) { + this.detail = detail; + return this; + } + + public HTTPValidationError addDetailItem(ValidationError detailItem) { + if (this.detail == null) { + this.detail = new ArrayList(); + } + this.detail.add(detailItem); + return this; + } + + /** + * Get detail + * @return detail + **/ + @Schema(description = "") + public List getDetail() { + return detail; + } + + public void setDetail(List detail) { + this.detail = detail; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HTTPValidationError htTPValidationError = (HTTPValidationError) o; + return Objects.equals(this.detail, htTPValidationError.detail); + } + + @Override + public int hashCode() { + return Objects.hash(detail); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HTTPValidationError {\n"); + + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/io/swagger/client/model/Token.java b/src/main/java/io/swagger/client/model/Token.java new file mode 100644 index 0000000..a9199f4 --- /dev/null +++ b/src/main/java/io/swagger/client/model/Token.java @@ -0,0 +1,138 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +/** + * Token + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class Token { + @SerializedName("access_token") + private String accessToken = null; + + @SerializedName("token_type") + private String tokenType = null; + + @SerializedName("expires_in") + private Integer expiresIn = null; + + public Token accessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Get accessToken + * @return accessToken + **/ + @Schema(required = true, description = "") + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public Token tokenType(String tokenType) { + this.tokenType = tokenType; + return this; + } + + /** + * Get tokenType + * @return tokenType + **/ + @Schema(required = true, description = "") + public String getTokenType() { + return tokenType; + } + + public void setTokenType(String tokenType) { + this.tokenType = tokenType; + } + + public Token expiresIn(Integer expiresIn) { + this.expiresIn = expiresIn; + return this; + } + + /** + * Get expiresIn + * @return expiresIn + **/ + @Schema(required = true, description = "") + public Integer getExpiresIn() { + return expiresIn; + } + + public void setExpiresIn(Integer expiresIn) { + this.expiresIn = expiresIn; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Token token = (Token) o; + return Objects.equals(this.accessToken, token.accessToken) && + Objects.equals(this.tokenType, token.tokenType) && + Objects.equals(this.expiresIn, token.expiresIn); + } + + @Override + public int hashCode() { + return Objects.hash(accessToken, tokenType, expiresIn); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Token {\n"); + + sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); + sb.append(" tokenType: ").append(toIndentedString(tokenType)).append("\n"); + sb.append(" expiresIn: ").append(toIndentedString(expiresIn)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/main/java/io/swagger/client/model/ValidationError.java b/src/main/java/io/swagger/client/model/ValidationError.java new file mode 100644 index 0000000..412532b --- /dev/null +++ b/src/main/java/io/swagger/client/model/ValidationError.java @@ -0,0 +1,145 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +/** + * ValidationError + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-06-25T15:49:43.145836023+02:00[Europe/Brussels]") + +public class ValidationError { + @SerializedName("loc") + private List loc = new ArrayList(); + + @SerializedName("msg") + private String msg = null; + + @SerializedName("type") + private String type = null; + + public ValidationError loc(List loc) { + this.loc = loc; + return this; + } + + public ValidationError addLocItem(String locItem) { + this.loc.add(locItem); + return this; + } + + /** + * Get loc + * @return loc + **/ + @Schema(required = true, description = "") + public List getLoc() { + return loc; + } + + public void setLoc(List loc) { + this.loc = loc; + } + + public ValidationError msg(String msg) { + this.msg = msg; + return this; + } + + /** + * Get msg + * @return msg + **/ + @Schema(required = true, description = "") + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public ValidationError type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @Schema(required = true, description = "") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ValidationError validationError = (ValidationError) o; + return Objects.equals(this.loc, validationError.loc) && + Objects.equals(this.msg, validationError.msg) && + Objects.equals(this.type, validationError.type); + } + + @Override + public int hashCode() { + return Objects.hash(loc, msg, type); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ValidationError {\n"); + + sb.append(" loc: ").append(toIndentedString(loc)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/src/test/java/io/swagger/client/api/DataRepositoryServiceApiTest.java b/src/test/java/io/swagger/client/api/DataRepositoryServiceApiTest.java new file mode 100644 index 0000000..3c19c48 --- /dev/null +++ b/src/test/java/io/swagger/client/api/DataRepositoryServiceApiTest.java @@ -0,0 +1,130 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.api; + +import io.swagger.client.model.AccessURL; +import io.swagger.client.model.BasicResponse; +import io.swagger.client.model.DrsObject; +import io.swagger.client.model.Error; +import org.junit.Test; +import org.junit.Ignore; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * API tests for DataRepositoryServiceApi + */ +@Ignore +public class DataRepositoryServiceApiTest { + + private final DataRepositoryServiceApi api = new DataRepositoryServiceApi(); + + /** + * Delete a DrsObject + * + * Delete a ```DrsObject``` index entry + * + * @throws Exception + * if the Api call fails + */ + @Test + public void deleteObjectGa4ghDrsV1ObjectsObjectIdDeleteTest() throws Exception { + String objectId = null; + BasicResponse response = api.deleteObjectGa4ghDrsV1ObjectsObjectIdDelete(objectId); + + // TODO: test validations + } + /** + * Query DrsObjects on alias + * + * Returns all objects that correspond to the list of aliases passed through the request. The query is regex compatible. + * + * @throws Exception + * if the Api call fails + */ + @Test + public void getObjectAliasGa4ghDrsV1ObjectsGetTest() throws Exception { + List alias = null; + List response = api.getObjectAliasGa4ghDrsV1ObjectsGet(alias); + + // TODO: test validations + } + /** + * Get a URL for fetching bytes + * + * Returns a URL that can be used to fetch the bytes of a `DrsObject`. This method only needs to be called when using an `AccessMethod` that contains an `access_id` (e.g., for servers that use signed URLs for fetching object bytes). + * + * @throws Exception + * if the Api call fails + */ + @Test + public void getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGetTest() throws Exception { + String objectId = null; + String accessId = null; + AccessURL response = api.getObjectGa4ghDrsV1ObjectsObjectIdAccessAccessIdGet(objectId, accessId); + + // TODO: test validations + } + /** + * Retrieve a DrsObject + * + * Returns object metadata, and a list of access methods that can be used to fetch object bytes. + * + * @throws Exception + * if the Api call fails + */ + @Test + public void getObjectGa4ghDrsV1ObjectsObjectIdGetTest() throws Exception { + String objectId = null; + Boolean expand = null; + DrsObject response = api.getObjectGa4ghDrsV1ObjectsObjectIdGet(objectId, expand); + + // TODO: test validations + } + /** + * Create a new DrsObject + * + * POST a requested ID to create an object that corresponds to this ID + * + * @throws Exception + * if the Api call fails + */ + @Test + public void postObjectGa4ghDrsV1ObjectsPostTest() throws Exception { + DrsObject body = null; + BasicResponse response = api.postObjectGa4ghDrsV1ObjectsPost(body); + + // TODO: test validations + } + /** + * Update a DrsObject + * + * Update the ```DrsObject``` + * + * @throws Exception + * if the Api call fails + */ + @Test + public void putObjectGa4ghDrsV1ObjectsObjectIdPutTest() throws Exception { + DrsObject body = null; + String objectId = null; + BasicResponse response = api.putObjectGa4ghDrsV1ObjectsObjectIdPut(body, objectId); + + // TODO: test validations + } +} diff --git a/src/test/java/io/swagger/client/api/HealthApiTest.java b/src/test/java/io/swagger/client/api/HealthApiTest.java new file mode 100644 index 0000000..e32a833 --- /dev/null +++ b/src/test/java/io/swagger/client/api/HealthApiTest.java @@ -0,0 +1,47 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.api; + +import org.junit.Test; +import org.junit.Ignore; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * API tests for HealthApi + */ +@Ignore +public class HealthApiTest { + + private final HealthApi api = new HealthApi(); + + /** + * Check if the API is running correctly + * + * Health check for the API + * + * @throws Exception + * if the Api call fails + */ + @Test + public void getHealthHealthGetTest() throws Exception { + Object response = api.getHealthHealthGet(); + + // TODO: test validations + } +} diff --git a/src/test/java/io/swagger/client/api/LoginApiTest.java b/src/test/java/io/swagger/client/api/LoginApiTest.java new file mode 100644 index 0000000..31a9bd3 --- /dev/null +++ b/src/test/java/io/swagger/client/api/LoginApiTest.java @@ -0,0 +1,55 @@ +/* + * Data Repository Service + * 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 + * + * OpenAPI spec version: 1.2.0 + * Contact: ict@cmgg.be + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.swagger.client.api; + +import io.swagger.client.model.HTTPValidationError; +import io.swagger.client.model.Token; +import org.junit.Test; +import org.junit.Ignore; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * API tests for LoginApi + */ +@Ignore +public class LoginApiTest { + + private final LoginApi api = new LoginApi(); + + /** + * Login + * + * + * + * @throws Exception + * if the Api call fails + */ + @Test + public void loginTokenPostTest() throws Exception { + String grantType = null; + String username = null; + String password = null; + String scope = null; + String clientId = null; + String clientSecret = null; + Token response = api.loginTokenPost(grantType, username, password, scope, clientId, clientSecret); + + // TODO: test validations + } +}