/// <summary>Snippet for DeleteGlossary</summary> public void DeleteGlossary_RequestObject() { // Snippet: DeleteGlossary(DeleteGlossaryRequest,CallSettings) // Create client TranslationServiceClient translationServiceClient = TranslationServiceClient.Create(); // Initialize request argument(s) DeleteGlossaryRequest request = new DeleteGlossaryRequest { GlossaryName = new GlossaryName("[PROJECT]", "[LOCATION]", "[GLOSSARY]"), }; // Make the request Operation <DeleteGlossaryResponse, DeleteGlossaryMetadata> response = translationServiceClient.DeleteGlossary(request); // Poll until the returned long-running operation is complete Operation <DeleteGlossaryResponse, DeleteGlossaryMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result DeleteGlossaryResponse result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <DeleteGlossaryResponse, DeleteGlossaryMetadata> retrievedResponse = translationServiceClient.PollOnceDeleteGlossary(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result DeleteGlossaryResponse retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary> /// Deletes a Glossary. /// </summary> /// <param name="projectId">Your Google Cloud Project ID.</param> /// <param name="glossaryId">Glossary ID.</param> public static void DeleteGlossarySample(string projectId = "[Google Cloud Project ID]", string glossaryId = "[YOUR_GLOSSARY_ID]") { TranslationServiceClient translationServiceClient = TranslationServiceClient.Create(); DeleteGlossaryRequest request = new DeleteGlossaryRequest { GlossaryName = new GlossaryName(projectId, "us-central1", glossaryId), }; // Poll until the returned long-running operation is complete DeleteGlossaryResponse response = translationServiceClient.DeleteGlossary(request).PollUntilCompleted().Result; Console.WriteLine("Deleted Glossary."); }
public bool DeleteGlossary(string glossaryId) { try { var request = new DeleteGlossaryRequest { GlossaryName = new GlossaryName(projectId, locaionId, glossaryId), }; DeleteGlossaryResponse response = client.DeleteGlossary(request).PollUntilCompleted().Result; return(true); } catch (Exception e) { Console.WriteLine(e); return(false); } }