org.opencb.cellbase.client.rest.MetaClient Maven / Gradle / Ivy
/*
* Copyright 2015-2020 OpenCB
*
* 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.opencb.cellbase.client.rest;
import org.opencb.cellbase.client.config.ClientConfiguration;
import org.opencb.cellbase.core.models.DataRelease;
import org.opencb.cellbase.core.result.CellBaseDataResponse;
import org.opencb.cellbase.core.config.SpeciesProperties;
import org.opencb.commons.datastore.core.ObjectMap;
import org.opencb.commons.datastore.core.Query;
import org.opencb.commons.datastore.core.QueryOptions;
import javax.ws.rs.client.WebTarget;
import java.io.IOException;
import java.net.URI;
import java.util.List;
/**
* Created by fjlopez on 06/07/17.
*/
public class MetaClient extends ParentRestClient {
MetaClient(String species, String assembly, String dataRelease, String apiKey, ClientConfiguration clientConfiguration) {
super(species, assembly, dataRelease, apiKey, clientConfiguration);
this.clazz = ObjectMap.class;
this.category = META;
this.subcategory = null;
}
public CellBaseDataResponse about() throws IOException {
return execute("about", new Query(), new QueryOptions(), ObjectMap.class);
}
public CellBaseDataResponse species() throws IOException {
return species(species);
}
public CellBaseDataResponse species(String species) throws IOException {
return execute("species", new Query(), new QueryOptions(QueryOptions.LIMIT, 1000), SpeciesProperties.class);
}
public CellBaseDataResponse dataReleases() throws IOException {
return execute(species, "dataReleases", new QueryOptions(QueryOptions.LIMIT, 1000), DataRelease.class);
}
public CellBaseDataResponse versions() throws IOException {
return versions(species);
}
public CellBaseDataResponse versions(String species) throws IOException {
return execute(species, "versions", new QueryOptions(QueryOptions.LIMIT, 1000), ObjectMap.class);
}
@Override
protected WebTarget getBaseUrl(List hosts, String version) {
return client
.target(URI.create(hosts.get(0)))
.path(WEBSERVICES)
.path(REST)
.path(version)
.path(category);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy