Commit 509a30ce authored by Matija Obreza's avatar Matija Obreza
Browse files

Merged 3 APIs to QueryAPI

parent 45bd94f1
......@@ -46,7 +46,7 @@ defaultClient.setBasePath("https://glis.planttreaty.org/glisapi/v1")
```java
ApiClient client =new ApiClient();
client.setBasePath("https://glis.planttreaty.org/glisapi/v1");
PgrfaApi api = new PgrfaApi(client);
QueryApi api = new QueryApi(client);
```
## Getting Started
......@@ -57,7 +57,7 @@ Please follow the [installation](#installation) instruction and execute the foll
import org.genesys.glis.v1.invoker.*;
import org.genesys.glis.v1.invoker.auth.*;
import org.genesys.glis.v1.model.*;
import org.genesys.glis.v1.api.PgrfaApi;
import org.genesys.glis.v1.api.QueryApi;
import java.io.File;
import java.util.*;
......@@ -72,7 +72,7 @@ public class PgrfaApiExample {
easySmta.setUsername("YOUR USERNAME");
easySmta.setPassword("YOUR PASSWORD");
PgrfaApi apiInstance = new PgrfaApi();
QueryApi apiInstance = new QueryApi();
Integer page = 1; // Integer | Request a particular page
Integer perPage = 10; // Integer | The number of items returned in a single page
String doi = "doi_example"; // String | Digital Object Identifier (DOI) associated to the PGRFA
......@@ -116,22 +116,29 @@ public class PgrfaApiExample {
Calls to GLIS API require HTTP basic authentication with credentials from Easy-SMTA.
All URIs are relative to _<https://glistest.planttreaty.org/glisapi/v1>_
All URIs are relative to _<https://glistest.planttreaty.org>_
Class | Method | HTTP request | Description
---------- | ---------------------------------------------------------- | --------------- | -----------------------------------
_PgrfaApi_ | [**search**](docs/PgrfaApi.md#search) | **GET** /pgrfas | Find passport data on PGRFA in GLIS
_RelsApi_ | [**listRelationships**](docs/RelsApi.md#listRelationships) | **GET** /rels | Get PGRFA relationships
_TermsApi_ | [**listTerms**](docs/TermsApi.md#listTerms) | **GET** /terms | GLIS vocabularies
Class | Method | HTTP request | Description
------------ | ----------------------------------------------------------- | --------------------------------- | ---------------------------------------------------------------
_ManagerApi_ | [**registerPGRFA**](docs/ManagerApi.md#registerPGRFA) | **POST** /glis/xml/manager | Register PGRFA in GLIS and (potentially) obtain GLIS-minted DOI
_ManagerApi_ | [**updatePGRFA**](docs/ManagerApi.md#updatePGRFA) | **POST** /glis/xml/manager/update | Update PGRFA in GLIS
_QueryApi_ | [**listRelationships**](docs/QueryApi.md#listRelationships) | **GET** /glisapi/v1/rels | Get PGRFA relationships
_QueryApi_ | [**listTerms**](docs/QueryApi.md#listTerms) | **GET** /glisapi/v1/terms | GLIS vocabularies
_QueryApi_ | [**search**](docs/QueryApi.md#search) | **GET** /glisapi/v1/pgrfas | Find passport data on PGRFA in GLIS
## Documentation for Models
- [Actor](docs/Actor.md)
- [ApiError](docs/ApiError.md)
- [BasePGRFA](docs/BasePGRFA.md)
- [GLISUpdate](docs/GLISUpdate.md)
- [Location](docs/Location.md)
- [Names](docs/Names.md)
- [OtherIdentifier](docs/OtherIdentifier.md)
- [PGRFA](docs/PGRFA.md)
- [RateLimitError](docs/RateLimitError.md)
- [Registration](docs/Registration.md)
- [RegistrationResponse](docs/RegistrationResponse.md)
- [Relationship](docs/Relationship.md)
- [Species](docs/Species.md)
- [Target](docs/Target.md)
......
# PgrfaApi
# QueryApi
All URIs are relative to *https://glistest.planttreaty.org/glisapi/v1*
All URIs are relative to *https://glistest.planttreaty.org*
Method | HTTP request | Description
------------- | ------------- | -------------
[**search**](PgrfaApi.md#search) | **GET** /pgrfas | Find passport data on PGRFA in GLIS
[**listRelationships**](QueryApi.md#listRelationships) | **GET** /glisapi/v1/rels | Get PGRFA relationships
[**listTerms**](QueryApi.md#listTerms) | **GET** /glisapi/v1/terms | GLIS vocabularies
[**search**](QueryApi.md#search) | **GET** /glisapi/v1/pgrfas | Find passport data on PGRFA in GLIS
<a name="listRelationships"></a>
# **listRelationships**
> List&lt;Relationship&gt; listRelationships(doi, role, oper)
Get PGRFA relationships
Multiple status values can be provided with comma separated strings
### Example
```java
// Import classes:
//import org.genesys.glis.v1.invoker.ApiClient;
//import org.genesys.glis.v1.invoker.ApiException;
//import org.genesys.glis.v1.invoker.Configuration;
//import org.genesys.glis.v1.invoker.auth.*;
//import org.genesys.glis.v1.api.QueryApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: easySmta
HttpBasicAuth easySmta = (HttpBasicAuth) defaultClient.getAuthentication("easySmta");
easySmta.setUsername("YOUR USERNAME");
easySmta.setPassword("YOUR PASSWORD");
QueryApi apiInstance = new QueryApi();
String doi = "doi_example"; // String | Digital Object Identifier (DOI) associated to the PGRFA for which relations are requested. Mandatory
String role = "role_example"; // String | Role of doi in the relationships. Optional, defaults to 'any'. Role in the relationship * any - Any role, default. * subject - DOI provided is the subject in the relationship. * object - DOI provided is the object in the relationship.
String oper = "oper_example"; // String | Relational operator code to filter the relations. Optional; if specified, only the relations with the given operator will be returned. Relational code * acfr - Acquired from. The PGRFA was received from a Provider. The related DOI identifies the Provider's sample * crfr - Created from. The PGRFA was obtained through crossing parent PGRFAs. The related DOIs identify the parent samples * defr - Derived from. The PGRFA was obtained from another sample. The related DOI identifies such original sample
try {
List<Relationship> result = apiInstance.listRelationships(doi, role, oper);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling QueryApi#listRelationships");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**doi** | **String**| Digital Object Identifier (DOI) associated to the PGRFA for which relations are requested. Mandatory |
**role** | **String**| Role of doi in the relationships. Optional, defaults to &#39;any&#39;. Role in the relationship * any - Any role, default. * subject - DOI provided is the subject in the relationship. * object - DOI provided is the object in the relationship. | [optional]
**oper** | **String**| Relational operator code to filter the relations. Optional; if specified, only the relations with the given operator will be returned. Relational code * acfr - Acquired from. The PGRFA was received from a Provider. The related DOI identifies the Provider&#39;s sample * crfr - Created from. The PGRFA was obtained through crossing parent PGRFAs. The related DOIs identify the parent samples * defr - Derived from. The PGRFA was obtained from another sample. The related DOI identifies such original sample | [optional]
### Return type
[**List&lt;Relationship&gt;**](Relationship.md)
### Authorization
[easySmta](../README.md#easySmta)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
<a name="listTerms"></a>
# **listTerms**
> List&lt;Term&gt; listTerms(acceptLanguage)
GLIS vocabularies
To describe the kind of information that will be found in the targets, GLIS adopts a simple controlled vocabulary.
### Example
```java
// Import classes:
//import org.genesys.glis.v1.invoker.ApiClient;
//import org.genesys.glis.v1.invoker.ApiException;
//import org.genesys.glis.v1.invoker.Configuration;
//import org.genesys.glis.v1.invoker.auth.*;
//import org.genesys.glis.v1.api.QueryApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: easySmta
HttpBasicAuth easySmta = (HttpBasicAuth) defaultClient.getAuthentication("easySmta");
easySmta.setUsername("YOUR USERNAME");
easySmta.setPassword("YOUR PASSWORD");
QueryApi apiInstance = new QueryApi();
List<String> acceptLanguage = Arrays.asList("en"); // List<String> | Tags to filter by
try {
List<Term> result = apiInstance.listTerms(acceptLanguage);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling QueryApi#listTerms");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**acceptLanguage** | [**List&lt;String&gt;**](String.md)| Tags to filter by | [optional] [default to en] [enum: en, fr, es, ar, ru, zh]
### Return type
[**List&lt;Term&gt;**](Term.md)
### Authorization
[easySmta](../README.md#easySmta)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
<a name="search"></a>
# **search**
> List&lt;PGRFA&gt; search(page, perPage, doi, identifier, genus, species, name, holdwiews, holdpid, holdname, holdcountry, methodcode, provwiews, provpid, provname, provcountry, provenance, collwiews, collpid, collname, collcountry, bredwiews, bredpid, bredname, bredcountry, biostatus, mlsstatus, targetkw)
......@@ -22,7 +136,7 @@ Find passport data on PGRFA in GLIS
//import org.genesys.glis.v1.invoker.ApiException;
//import org.genesys.glis.v1.invoker.Configuration;
//import org.genesys.glis.v1.invoker.auth.*;
//import org.genesys.glis.v1.api.PgrfaApi;
//import org.genesys.glis.v1.api.QueryApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
......@@ -31,7 +145,7 @@ HttpBasicAuth easySmta = (HttpBasicAuth) defaultClient.getAuthentication("easySm
easySmta.setUsername("YOUR USERNAME");
easySmta.setPassword("YOUR PASSWORD");
PgrfaApi apiInstance = new PgrfaApi();
QueryApi apiInstance = new QueryApi();
Integer page = 1; // Integer | Request a particular page
Integer perPage = 10; // Integer | The number of items returned in a single page
String doi = "doi_example"; // String | Digital Object Identifier (DOI) associated to the PGRFA
......@@ -64,7 +178,7 @@ try {
List<PGRFA> result = apiInstance.search(page, perPage, doi, identifier, genus, species, name, holdwiews, holdpid, holdname, holdcountry, methodcode, provwiews, provpid, provname, provcountry, provenance, collwiews, collpid, collname, collcountry, bredwiews, bredpid, bredname, bredcountry, biostatus, mlsstatus, targetkw);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PgrfaApi#search");
System.err.println("Exception when calling QueryApi#search");
e.printStackTrace();
}
```
......
# RelsApi
All URIs are relative to *https://glistest.planttreaty.org/glisapi/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**listRelationships**](RelsApi.md#listRelationships) | **GET** /rels | Get PGRFA relationships
<a name="listRelationships"></a>
# **listRelationships**
> List&lt;Relationship&gt; listRelationships(doi, role, oper)
Get PGRFA relationships
Multiple status values can be provided with comma separated strings
### Example
```java
// Import classes:
//import org.genesys.glis.v1.invoker.ApiClient;
//import org.genesys.glis.v1.invoker.ApiException;
//import org.genesys.glis.v1.invoker.Configuration;
//import org.genesys.glis.v1.invoker.auth.*;
//import org.genesys.glis.v1.api.RelsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: easySmta
HttpBasicAuth easySmta = (HttpBasicAuth) defaultClient.getAuthentication("easySmta");
easySmta.setUsername("YOUR USERNAME");
easySmta.setPassword("YOUR PASSWORD");
RelsApi apiInstance = new RelsApi();
String doi = "doi_example"; // String | Digital Object Identifier (DOI) associated to the PGRFA for which relations are requested. Mandatory
String role = "role_example"; // String | Role of doi in the relationships. Optional, defaults to 'any'. Role in the relationship * any - Any role, default. * subject - DOI provided is the subject in the relationship. * object - DOI provided is the object in the relationship.
String oper = "oper_example"; // String | Relational operator code to filter the relations. Optional; if specified, only the relations with the given operator will be returned. Relational code * acfr - Acquired from. The PGRFA was received from a Provider. The related DOI identifies the Provider's sample * crfr - Created from. The PGRFA was obtained through crossing parent PGRFAs. The related DOIs identify the parent samples * defr - Derived from. The PGRFA was obtained from another sample. The related DOI identifies such original sample
try {
List<Relationship> result = apiInstance.listRelationships(doi, role, oper);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling RelsApi#listRelationships");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**doi** | **String**| Digital Object Identifier (DOI) associated to the PGRFA for which relations are requested. Mandatory |
**role** | **String**| Role of doi in the relationships. Optional, defaults to &#39;any&#39;. Role in the relationship * any - Any role, default. * subject - DOI provided is the subject in the relationship. * object - DOI provided is the object in the relationship. | [optional]
**oper** | **String**| Relational operator code to filter the relations. Optional; if specified, only the relations with the given operator will be returned. Relational code * acfr - Acquired from. The PGRFA was received from a Provider. The related DOI identifies the Provider&#39;s sample * crfr - Created from. The PGRFA was obtained through crossing parent PGRFAs. The related DOIs identify the parent samples * defr - Derived from. The PGRFA was obtained from another sample. The related DOI identifies such original sample | [optional]
### Return type
[**List&lt;Relationship&gt;**](Relationship.md)
### Authorization
[easySmta](../README.md#easySmta)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
# TermsApi
All URIs are relative to *https://glistest.planttreaty.org/glisapi/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**listTerms**](TermsApi.md#listTerms) | **GET** /terms | GLIS vocabularies
<a name="listTerms"></a>
# **listTerms**
> List&lt;Term&gt; listTerms(acceptLanguage)
GLIS vocabularies
To describe the kind of information that will be found in the targets, GLIS adopts a simple controlled vocabulary.
### Example
```java
// Import classes:
//import org.genesys.glis.v1.invoker.ApiClient;
//import org.genesys.glis.v1.invoker.ApiException;
//import org.genesys.glis.v1.invoker.Configuration;
//import org.genesys.glis.v1.invoker.auth.*;
//import org.genesys.glis.v1.api.TermsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: easySmta
HttpBasicAuth easySmta = (HttpBasicAuth) defaultClient.getAuthentication("easySmta");
easySmta.setUsername("YOUR USERNAME");
easySmta.setPassword("YOUR PASSWORD");
TermsApi apiInstance = new TermsApi();
List<String> acceptLanguage = Arrays.asList("en"); // List<String> | Tags to filter by
try {
List<Term> result = apiInstance.listTerms(acceptLanguage);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TermsApi#listTerms");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**acceptLanguage** | [**List&lt;String&gt;**](String.md)| Tags to filter by | [optional] [default to en] [enum: en, fr, es, ar, ru, zh]
### Return type
[**List&lt;Term&gt;**](Term.md)
### Authorization
[easySmta](../README.md#easySmta)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
......@@ -29,7 +29,6 @@ info:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
host: glistest.planttreaty.org
basePath: /glisapi/v1
schemes:
- https
security:
......@@ -50,23 +49,16 @@ parameters:
required: false
default: 10
tags:
- name: pgrfa
description: Everything about PGRFA
externalDocs:
description: Find out more
url: 'https://glis.planttreaty.org'
- name: rels
description: Relationships between PGRFA material
- name: terms
description: Controlled vocabularies
- name: query
description: GLIS Query API about PGRFA
externalDocs:
description: Find out more
url: 'https://glis.planttreaty.org'
paths:
/pgrfas:
/glisapi/v1/pgrfas:
get:
tags:
- pgrfa
- query
summary: Find passport data on PGRFA in GLIS
description: ''
operationId: search
......@@ -340,10 +332,10 @@ paths:
schema:
$ref: '#/definitions/RateLimitError'
/rels:
/glisapi/v1/rels:
get:
tags:
- rels
- query
summary: Get PGRFA relationships
description: >-
Multiple status values can be provided with comma separated strings
......@@ -414,10 +406,10 @@ paths:
'400':
description: Invalid status value
/terms:
/glisapi/v1/terms:
get:
tags:
- terms
- query
summary: GLIS vocabularies
description: >-
To describe the kind of information that will be found in the targets, GLIS adopts a simple controlled vocabulary.
......
......@@ -21,9 +21,13 @@ import org.genesys.glis.v1.invoker.Configuration;
import org.genesys.glis.v1.invoker.auth.HttpBasicAuth;
import org.junit.BeforeClass;
public class BaseApiTest {
public abstract class BaseApiTest {
public static final String THE_DOI = "10.0155/1";
protected static String GLIS_USERNAME = System.getenv("GLIS_USERNAME");
protected static String GLIS_PASSWORD = System.getenv("GLIS_PASSWORD");
@BeforeClass
public static void config() {
ApiClient defaultClient = Configuration.getDefaultApiClient();
......@@ -32,8 +36,8 @@ public class BaseApiTest {
}
// Configure HTTP basic authorization: glis_auth
HttpBasicAuth easySmtaAuth = (HttpBasicAuth) defaultClient.getAuthentication("easySmta");
easySmtaAuth.setUsername(System.getenv("GLIS_USERNAME"));
easySmtaAuth.setUsername(GLIS_USERNAME);
System.out.println("Using GLIS username " + easySmtaAuth.getUsername());
easySmtaAuth.setPassword(System.getenv("GLIS_PASSWORD"));
easySmtaAuth.setPassword(GLIS_PASSWORD);
}
}
/*
* Copyright 2017 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.genesys.glis.v1.api;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.util.List;
import org.genesys.glis.v1.invoker.ApiException;
import org.genesys.glis.v1.model.PGRFA;
import org.junit.Test;
/**
* API tests for PgrfasApi
*/
public class PgrfaApiTest extends BaseApiTest {
private final PgrfaApi api = new PgrfaApi();
/**
* Find passport data on PGRFA in GLIS
*
*
*
* @throws ApiException if the Api call fails
*/
@Test
public void findPgrfaTest() throws ApiException {
List<PGRFA> response = api.search(null, null, THE_DOI, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null);
assertThat(response.size(), greaterThan(0));
}
}
......@@ -23,15 +23,48 @@ import java.util.Arrays;
import java.util.List;
import org.genesys.glis.v1.invoker.ApiException;
import org.genesys.glis.v1.model.PGRFA;
import org.genesys.glis.v1.model.Relationship;
import org.genesys.glis.v1.model.Term;
import org.junit.Test;
/**
* API tests for TermsApi
* API tests for PgrfasApi
*/
public class TermsApiTest extends BaseApiTest {
public class QueryApiTest extends BaseApiTest {
private final TermsApi api = new TermsApi();
private final QueryApi api = new QueryApi();
/**
* Find passport data on PGRFA in GLIS
*
*
*
* @throws ApiException if the Api call fails
*/
@Test
public void findPgrfaTest() throws ApiException {
List<PGRFA> response = api.search(null, null, THE_DOI, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null);
assertThat(response.size(), greaterThan(0));
}
/**
* Get PGRFA relationships
*
* Multiple status values can be provided with comma separated strings
*
* @throws ApiException if the Api call fails
*/
@Test
public void relsTest() throws ApiException {
String role = null;
String oper = null;
List<Relationship> response = api.listRelationships(THE_DOI, role, oper);
assertThat(response.size(), greaterThan(0));
}
/**
* GLIS vocabularies
......
/*
* Copyright 2017 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.genesys.glis.v1.api;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.util.List;
import org.genesys.glis.v1.invoker.ApiException;
import org.genesys.glis.v1.model.Relationship;
import org.junit.Test;
/**
* API tests for RelsApi
*/
public class RelsApiTest extends BaseApiTest {
private final RelsApi api = new RelsApi();
/**
* Get PGRFA relationships
*
* Multiple status values can be provided with comma separated strings
*
* @throws ApiException if the Api call fails
*/
@Test
public void relsTest() throws ApiException {
String role = null;
String oper = null;
List<Relationship> response = api.listRelationships(THE_DOI, role, oper);
assertThat(response.size(), greaterThan(0));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment