Search in sources :

Example 6 with ProjectDetails

use of com.ibm.watson.discovery.v2.model.ProjectDetails in project java-sdk by watson-developer-cloud.

the class Discovery method getProject.

/**
 * Get project.
 *
 * <p>Get details on the specified project.
 *
 * @param getProjectOptions the {@link GetProjectOptions} containing the options for the call
 * @return a {@link ServiceCall} with a result of type {@link ProjectDetails}
 */
public ServiceCall<ProjectDetails> getProject(GetProjectOptions getProjectOptions) {
    com.ibm.cloud.sdk.core.util.Validator.notNull(getProjectOptions, "getProjectOptions cannot be null");
    Map<String, String> pathParamsMap = new HashMap<String, String>();
    pathParamsMap.put("project_id", getProjectOptions.projectId());
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/projects/{project_id}", pathParamsMap));
    Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getProject");
    for (Entry<String, String> header : sdkHeaders.entrySet()) {
        builder.header(header.getKey(), header.getValue());
    }
    builder.header("Accept", "application/json");
    builder.query("version", String.valueOf(this.version));
    ResponseConverter<ProjectDetails> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<ProjectDetails>() {
    }.getType());
    return createServiceCall(builder.build(), responseConverter);
}
Also used : ProjectDetails(com.ibm.watson.discovery.v2.model.ProjectDetails) RequestBuilder(com.ibm.cloud.sdk.core.http.RequestBuilder) HashMap(java.util.HashMap)

Aggregations

ProjectDetails (com.ibm.watson.discovery.v2.model.ProjectDetails)6 RequestBuilder (com.ibm.cloud.sdk.core.http.RequestBuilder)3 MockResponse (okhttp3.mockwebserver.MockResponse)3 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)3 Test (org.testng.annotations.Test)3 JsonObject (com.google.gson.JsonObject)2 HashMap (java.util.HashMap)2 CreateProjectOptions (com.ibm.watson.discovery.v2.model.CreateProjectOptions)1 DefaultQueryParams (com.ibm.watson.discovery.v2.model.DefaultQueryParams)1 DefaultQueryParamsPassages (com.ibm.watson.discovery.v2.model.DefaultQueryParamsPassages)1 DefaultQueryParamsSuggestedRefinements (com.ibm.watson.discovery.v2.model.DefaultQueryParamsSuggestedRefinements)1 DefaultQueryParamsTableResults (com.ibm.watson.discovery.v2.model.DefaultQueryParamsTableResults)1 GetProjectOptions (com.ibm.watson.discovery.v2.model.GetProjectOptions)1 UpdateProjectOptions (com.ibm.watson.discovery.v2.model.UpdateProjectOptions)1