use of com.google.cloud.translate.v3beta1.DeleteGlossaryResponse in project google-cloud-java by GoogleCloudPlatform.
the class TranslateSnippetsBeta method deleteGlossary.
// [END translate_translate_text_with_glossary_beta]
/**
* Deletes a glossary.
*
* @param projectId - Id of the project.
* @param location - location name.
* @param name - Glossary name.
*/
// [START translate_delete_glossary_beta]
static DeleteGlossaryResponse deleteGlossary(String projectId, String location, String name) {
try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
GlossaryName glossaryName = GlossaryName.newBuilder().setProject(projectId).setLocation(location).setGlossary(name).build();
// Call the API
DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(glossaryName.toString()).get(300, TimeUnit.SECONDS);
System.out.format("Deleted: %s\n", response.getName());
return response;
} catch (Exception e) {
throw new RuntimeException("Couldn't create client.", e);
}
}
use of com.google.cloud.translate.v3beta1.DeleteGlossaryResponse in project google-cloud-java by GoogleCloudPlatform.
the class ITTranslateSnippetsBeta method test3_testDeleteGlossary.
@Test
public void test3_testDeleteGlossary() {
DeleteGlossaryResponse response = TranslateSnippetsBeta.deleteGlossary(projectId, "us-central1", "glossary-testing");
assertTrue(response.toString(), response.toString().contains("glossary-testing"));
}
Aggregations