From eac19b2ff044b5eef96d403790723bca4285bc17 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 29 Nov 2024 05:58:00 +0000 Subject: [PATCH] CodeGen from PR 31543 in Azure/azure-rest-api-specs Merge b9933f6f77779bdd9c747533813f3b4766b4230f into 43ce04961ccb6496e421789c54798ba1e0880f64 --- .../azure-ai-contentsafety/CHANGELOG.md | 107 +++++++++++++++++- ...OrUpdateBlocklistItemsToTextBlocklist.java | 28 +++++ .../contentsafety/generated/AnalyzeImage.java | 26 +++++ .../contentsafety/generated/AnalyzeText.java | 24 ++++ .../CreateOrUpdateTextBlocklist.java | 23 ++++ .../DeleteTextBlocklistByBlocklistName.java | 22 ++++ .../GetAllBlockItemsByBlocklistName.java | 24 ++++ .../generated/GetAllTextBlocklists.java | 24 ++++ ...ItemByBlocklistNameAndBlocklistItemId.java | 24 ++++ .../GetTextBlocklistByBlocklistName.java | 23 ++++ .../RemoveBlockItemsFromTextBlocklist.java | 25 ++++ ...ateBlocklistItemsToTextBlocklistTests.java | 37 ++++++ .../generated/AnalyzeImageTests.java | 35 ++++++ .../generated/AnalyzeTextTests.java | 37 ++++++ .../ContentSafetyClientTestBase.java | 59 ++++++++++ .../CreateOrUpdateTextBlocklistTests.java | 27 +++++ ...leteTextBlocklistByBlocklistNameTests.java | 18 +++ .../GetAllBlockItemsByBlocklistNameTests.java | 32 ++++++ .../generated/GetAllTextBlocklistsTests.java | 30 +++++ ...yBlocklistNameAndBlocklistItemIdTests.java | 30 +++++ .../GetTextBlocklistByBlocklistNameTests.java | 27 +++++ ...emoveBlockItemsFromTextBlocklistTests.java | 21 ++++ .../azure-ai-contentsafety/tsp-location.yaml | 4 +- 23 files changed, 702 insertions(+), 5 deletions(-) create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/AddOrUpdateBlocklistItemsToTextBlocklist.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/AnalyzeImage.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/AnalyzeText.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/CreateOrUpdateTextBlocklist.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/DeleteTextBlocklistByBlocklistName.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetAllBlockItemsByBlocklistName.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetAllTextBlocklists.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetBlockItemByBlocklistNameAndBlocklistItemId.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetTextBlocklistByBlocklistName.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/RemoveBlockItemsFromTextBlocklist.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/AddOrUpdateBlocklistItemsToTextBlocklistTests.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/AnalyzeImageTests.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/AnalyzeTextTests.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/ContentSafetyClientTestBase.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/CreateOrUpdateTextBlocklistTests.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/DeleteTextBlocklistByBlocklistNameTests.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetAllBlockItemsByBlocklistNameTests.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetAllTextBlocklistsTests.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetBlockItemByBlocklistNameAndBlocklistItemIdTests.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetTextBlocklistByBlocklistNameTests.java create mode 100644 sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/RemoveBlockItemsFromTextBlocklistTests.java diff --git a/sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md b/sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md index 041d456cae097..bd581afac9432 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md +++ b/sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md @@ -2,13 +2,114 @@ ## 1.1.0-beta.1 (Unreleased) +### Breaking Changes + +#### `implementation.ContentSafetyClientImpl$ContentSafetyClientService` was modified + +* `analyzeText(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was removed +* `analyzeImage(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was removed +* `analyzeTextSync(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was removed +* `analyzeImageSync(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was removed + +#### `implementation.BlocklistClientImpl$BlocklistClientService` was modified + +* `removeBlocklistItems(java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was removed +* `addOrUpdateBlocklistItemsSync(java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was removed +* `addOrUpdateBlocklistItems(java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was removed +* `removeBlocklistItemsSync(java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was removed + ### Features Added -### Breaking Changes +#### `models.AddOrUpdateTextBlocklistItemsResult` was modified -### Bugs Fixed +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added -### Other Changes +#### `BlocklistAsyncClient` was modified + +* `createOrUpdateTextBlocklist(java.lang.String,models.TextBlocklist)` was added + +#### `models.AnalyzeTextResult` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.TextBlocklistMatch` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AnalyzeImageOptions` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `implementation.ContentSafetyClientImpl$ContentSafetyClientService` was modified + +* `analyzeImage(java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was added +* `analyzeText(java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was added +* `analyzeTextSync(java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was added +* `analyzeImageSync(java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was added + +#### `models.TextBlocklistItem` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.RemoveTextBlocklistItemsOptions` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `implementation.BlocklistClientImpl$BlocklistClientService` was modified + +* `addOrUpdateBlocklistItems(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was added +* `removeBlocklistItems(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was added +* `removeBlocklistItemsSync(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was added +* `addOrUpdateBlocklistItemsSync(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was added + +#### `models.TextBlocklist` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AnalyzeTextOptions` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `implementation.JsonMergePatchHelper$TextBlocklistAccessor` was modified + +* `isJsonMergePatch(models.TextBlocklist)` was added + +#### `models.ImageCategoriesAnalysis` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AnalyzeImageResult` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AddOrUpdateTextBlocklistItemsOptions` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ContentSafetyImageData` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.TextCategoriesAnalysis` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `BlocklistClient` was modified + +* `createOrUpdateTextBlocklist(java.lang.String,models.TextBlocklist)` was added ## 1.0.8 (2024-10-25) diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/AddOrUpdateBlocklistItemsToTextBlocklist.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/AddOrUpdateBlocklistItemsToTextBlocklist.java new file mode 100644 index 0000000000000..c73ceb46a4746 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/AddOrUpdateBlocklistItemsToTextBlocklist.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.BlocklistClient; +import com.azure.ai.contentsafety.BlocklistClientBuilder; +import com.azure.ai.contentsafety.models.AddOrUpdateTextBlocklistItemsOptions; +import com.azure.ai.contentsafety.models.AddOrUpdateTextBlocklistItemsResult; +import com.azure.ai.contentsafety.models.TextBlocklistItem; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.util.Arrays; + +public class AddOrUpdateBlocklistItemsToTextBlocklist { + public static void main(String[] args) { + BlocklistClient blocklistClient + = new BlocklistClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.ai.contentsafety.generated.addorupdateblocklistitems.addorupdateblocklistitemstotextblocklist + AddOrUpdateTextBlocklistItemsResult response + = blocklistClient.addOrUpdateBlocklistItems("TestBlocklist", new AddOrUpdateTextBlocklistItemsOptions( + Arrays.asList(new TextBlocklistItem("hate").setDescription("Hate word")))); + // END:com.azure.ai.contentsafety.generated.addorupdateblocklistitems.addorupdateblocklistitemstotextblocklist + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/AnalyzeImage.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/AnalyzeImage.java new file mode 100644 index 0000000000000..f327bbf9950ac --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/AnalyzeImage.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.ContentSafetyClient; +import com.azure.ai.contentsafety.ContentSafetyClientBuilder; +import com.azure.ai.contentsafety.models.AnalyzeImageOptions; +import com.azure.ai.contentsafety.models.AnalyzeImageResult; +import com.azure.ai.contentsafety.models.ContentSafetyImageData; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class AnalyzeImage { + public static void main(String[] args) { + ContentSafetyClient contentSafetyClient + = new ContentSafetyClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.ai.contentsafety.generated.analyzeimage.analyzeimage + AnalyzeImageResult response = contentSafetyClient + .analyzeImage(new AnalyzeImageOptions(new ContentSafetyImageData().setContent("Y29udGVudDE=".getBytes()))); + // END:com.azure.ai.contentsafety.generated.analyzeimage.analyzeimage + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/AnalyzeText.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/AnalyzeText.java new file mode 100644 index 0000000000000..4ddd4133d603c --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/AnalyzeText.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.ContentSafetyClient; +import com.azure.ai.contentsafety.ContentSafetyClientBuilder; +import com.azure.ai.contentsafety.models.AnalyzeTextOptions; +import com.azure.ai.contentsafety.models.AnalyzeTextResult; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class AnalyzeText { + public static void main(String[] args) { + ContentSafetyClient contentSafetyClient + = new ContentSafetyClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.ai.contentsafety.generated.analyzetext.analyzetext + AnalyzeTextResult response = contentSafetyClient.analyzeText(new AnalyzeTextOptions("This is text example")); + // END:com.azure.ai.contentsafety.generated.analyzetext.analyzetext + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/CreateOrUpdateTextBlocklist.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/CreateOrUpdateTextBlocklist.java new file mode 100644 index 0000000000000..f47f39979bfe6 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/CreateOrUpdateTextBlocklist.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.BlocklistClient; +import com.azure.ai.contentsafety.BlocklistClientBuilder; +import com.azure.ai.contentsafety.models.TextBlocklist; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class CreateOrUpdateTextBlocklist { + public static void main(String[] args) { + BlocklistClient blocklistClient + = new BlocklistClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.ai.contentsafety.generated.createorupdatetextblocklist.createorupdatetextblocklist + TextBlocklist response = blocklistClient.createOrUpdateTextBlocklist("TestBlocklist", null); + // END:com.azure.ai.contentsafety.generated.createorupdatetextblocklist.createorupdatetextblocklist + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/DeleteTextBlocklistByBlocklistName.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/DeleteTextBlocklistByBlocklistName.java new file mode 100644 index 0000000000000..f1c6528fd62bf --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/DeleteTextBlocklistByBlocklistName.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.BlocklistClient; +import com.azure.ai.contentsafety.BlocklistClientBuilder; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class DeleteTextBlocklistByBlocklistName { + public static void main(String[] args) { + BlocklistClient blocklistClient + = new BlocklistClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.ai.contentsafety.generated.deletetextblocklist.deletetextblocklistbyblocklistname + blocklistClient.deleteTextBlocklist("TestBlocklist"); + // END:com.azure.ai.contentsafety.generated.deletetextblocklist.deletetextblocklistbyblocklistname + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetAllBlockItemsByBlocklistName.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetAllBlockItemsByBlocklistName.java new file mode 100644 index 0000000000000..8ee6c66287dc7 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetAllBlockItemsByBlocklistName.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.BlocklistClient; +import com.azure.ai.contentsafety.BlocklistClientBuilder; +import com.azure.ai.contentsafety.models.TextBlocklistItem; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetAllBlockItemsByBlocklistName { + public static void main(String[] args) { + BlocklistClient blocklistClient + = new BlocklistClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.ai.contentsafety.generated.listtextblocklistitems.getallblockitemsbyblocklistname + PagedIterable response = blocklistClient.listTextBlocklistItems("TestBlocklist", null, null); + // END:com.azure.ai.contentsafety.generated.listtextblocklistitems.getallblockitemsbyblocklistname + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetAllTextBlocklists.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetAllTextBlocklists.java new file mode 100644 index 0000000000000..405390c3e7319 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetAllTextBlocklists.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.BlocklistClient; +import com.azure.ai.contentsafety.BlocklistClientBuilder; +import com.azure.ai.contentsafety.models.TextBlocklist; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetAllTextBlocklists { + public static void main(String[] args) { + BlocklistClient blocklistClient + = new BlocklistClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.ai.contentsafety.generated.listtextblocklists.getalltextblocklists + PagedIterable response = blocklistClient.listTextBlocklists(); + // END:com.azure.ai.contentsafety.generated.listtextblocklists.getalltextblocklists + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetBlockItemByBlocklistNameAndBlocklistItemId.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetBlockItemByBlocklistNameAndBlocklistItemId.java new file mode 100644 index 0000000000000..53952af80a769 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetBlockItemByBlocklistNameAndBlocklistItemId.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.BlocklistClient; +import com.azure.ai.contentsafety.BlocklistClientBuilder; +import com.azure.ai.contentsafety.models.TextBlocklistItem; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetBlockItemByBlocklistNameAndBlocklistItemId { + public static void main(String[] args) { + BlocklistClient blocklistClient + = new BlocklistClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.ai.contentsafety.generated.gettextblocklistitem.getblockitembyblocklistnameandblocklistitemid + TextBlocklistItem response + = blocklistClient.getTextBlocklistItem("TestBlocklist", "9511969e-f1e3-4604-9127-05ee16c509ec"); + // END:com.azure.ai.contentsafety.generated.gettextblocklistitem.getblockitembyblocklistnameandblocklistitemid + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetTextBlocklistByBlocklistName.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetTextBlocklistByBlocklistName.java new file mode 100644 index 0000000000000..dffde09f029cf --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/GetTextBlocklistByBlocklistName.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.BlocklistClient; +import com.azure.ai.contentsafety.BlocklistClientBuilder; +import com.azure.ai.contentsafety.models.TextBlocklist; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class GetTextBlocklistByBlocklistName { + public static void main(String[] args) { + BlocklistClient blocklistClient + = new BlocklistClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.ai.contentsafety.generated.gettextblocklist.gettextblocklistbyblocklistname + TextBlocklist response = blocklistClient.getTextBlocklist("TestBlocklist"); + // END:com.azure.ai.contentsafety.generated.gettextblocklist.gettextblocklistbyblocklistname + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/RemoveBlockItemsFromTextBlocklist.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/RemoveBlockItemsFromTextBlocklist.java new file mode 100644 index 0000000000000..a1f3a019d9430 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/generated/RemoveBlockItemsFromTextBlocklist.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.BlocklistClient; +import com.azure.ai.contentsafety.BlocklistClientBuilder; +import com.azure.ai.contentsafety.models.RemoveTextBlocklistItemsOptions; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.util.Arrays; + +public class RemoveBlockItemsFromTextBlocklist { + public static void main(String[] args) { + BlocklistClient blocklistClient + = new BlocklistClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.ai.contentsafety.generated.removeblocklistitems.removeblockitemsfromtextblocklist + blocklistClient.removeBlocklistItems("TestBlocklist", + new RemoveTextBlocklistItemsOptions(Arrays.asList("9511969e-f1e3-4604-9127-05ee16c509ec"))); + // END:com.azure.ai.contentsafety.generated.removeblocklistitems.removeblockitemsfromtextblocklist + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/AddOrUpdateBlocklistItemsToTextBlocklistTests.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/AddOrUpdateBlocklistItemsToTextBlocklistTests.java new file mode 100644 index 0000000000000..fd0c7af81753e --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/AddOrUpdateBlocklistItemsToTextBlocklistTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.models.AddOrUpdateTextBlocklistItemsOptions; +import com.azure.ai.contentsafety.models.AddOrUpdateTextBlocklistItemsResult; +import com.azure.ai.contentsafety.models.TextBlocklistItem; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class AddOrUpdateBlocklistItemsToTextBlocklistTests extends ContentSafetyClientTestBase { + @Test + @Disabled + public void testAddOrUpdateBlocklistItemsToTextBlocklistTests() { + // method invocation + AddOrUpdateTextBlocklistItemsResult response + = blocklistClient.addOrUpdateBlocklistItems("TestBlocklist", new AddOrUpdateTextBlocklistItemsOptions( + Arrays.asList(new TextBlocklistItem("hate").setDescription("Hate word")))); + + // response assertion + Assertions.assertNotNull(response); + // verify property "blocklistItems" + List responseBlocklistItems = response.getBlocklistItems(); + TextBlocklistItem responseBlocklistItemsFirstItem = responseBlocklistItems.iterator().next(); + Assertions.assertNotNull(responseBlocklistItemsFirstItem); + Assertions.assertEquals("9511969e-f1e3-4604-9127-05ee16c509ec", + responseBlocklistItemsFirstItem.getBlocklistItemId()); + Assertions.assertEquals("Hate word", responseBlocklistItemsFirstItem.getDescription()); + Assertions.assertEquals("hate", responseBlocklistItemsFirstItem.getText()); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/AnalyzeImageTests.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/AnalyzeImageTests.java new file mode 100644 index 0000000000000..a446b04920307 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/AnalyzeImageTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.models.AnalyzeImageOptions; +import com.azure.ai.contentsafety.models.AnalyzeImageResult; +import com.azure.ai.contentsafety.models.ContentSafetyImageData; +import com.azure.ai.contentsafety.models.ImageCategoriesAnalysis; +import com.azure.ai.contentsafety.models.ImageCategory; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class AnalyzeImageTests extends ContentSafetyClientTestBase { + @Test + @Disabled + public void testAnalyzeImageTests() { + // method invocation + AnalyzeImageResult response = contentSafetyClient + .analyzeImage(new AnalyzeImageOptions(new ContentSafetyImageData().setContent("Y29udGVudDE=".getBytes()))); + + // response assertion + Assertions.assertNotNull(response); + // verify property "categoriesAnalysis" + List responseCategoriesAnalysis = response.getCategoriesAnalysis(); + ImageCategoriesAnalysis responseCategoriesAnalysisFirstItem = responseCategoriesAnalysis.iterator().next(); + Assertions.assertNotNull(responseCategoriesAnalysisFirstItem); + Assertions.assertEquals(ImageCategory.HATE, responseCategoriesAnalysisFirstItem.getCategory()); + Assertions.assertEquals(0, responseCategoriesAnalysisFirstItem.getSeverity()); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/AnalyzeTextTests.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/AnalyzeTextTests.java new file mode 100644 index 0000000000000..1337f14af98c5 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/AnalyzeTextTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.models.AnalyzeTextOptions; +import com.azure.ai.contentsafety.models.AnalyzeTextResult; +import com.azure.ai.contentsafety.models.TextBlocklistMatch; +import com.azure.ai.contentsafety.models.TextCategoriesAnalysis; +import com.azure.ai.contentsafety.models.TextCategory; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class AnalyzeTextTests extends ContentSafetyClientTestBase { + @Test + @Disabled + public void testAnalyzeTextTests() { + // method invocation + AnalyzeTextResult response = contentSafetyClient.analyzeText(new AnalyzeTextOptions("This is text example")); + + // response assertion + Assertions.assertNotNull(response); + // verify property "blocklistsMatch" + List responseBlocklistsMatch = response.getBlocklistsMatch(); + Assertions.assertEquals(0, responseBlocklistsMatch.size()); + // verify property "categoriesAnalysis" + List responseCategoriesAnalysis = response.getCategoriesAnalysis(); + TextCategoriesAnalysis responseCategoriesAnalysisFirstItem = responseCategoriesAnalysis.iterator().next(); + Assertions.assertNotNull(responseCategoriesAnalysisFirstItem); + Assertions.assertEquals(TextCategory.HATE, responseCategoriesAnalysisFirstItem.getCategory()); + Assertions.assertEquals(0, responseCategoriesAnalysisFirstItem.getSeverity()); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/ContentSafetyClientTestBase.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/ContentSafetyClientTestBase.java new file mode 100644 index 0000000000000..b62c3cf5885c9 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/ContentSafetyClientTestBase.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.ai.contentsafety.BlocklistClient; +import com.azure.ai.contentsafety.BlocklistClientBuilder; +import com.azure.ai.contentsafety.ContentSafetyClient; +import com.azure.ai.contentsafety.ContentSafetyClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.test.utils.MockTokenCredential; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +class ContentSafetyClientTestBase extends TestProxyTestBase { + protected ContentSafetyClient contentSafetyClient; + + protected BlocklistClient blocklistClient; + + @Override + protected void beforeTest() { + ContentSafetyClientBuilder contentSafetyClientbuilder = new ContentSafetyClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + contentSafetyClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + contentSafetyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + contentSafetyClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + contentSafetyClient = contentSafetyClientbuilder.buildClient(); + + BlocklistClientBuilder blocklistClientbuilder + = new BlocklistClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + blocklistClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + blocklistClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + blocklistClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + blocklistClient = blocklistClientbuilder.buildClient(); + + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/CreateOrUpdateTextBlocklistTests.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/CreateOrUpdateTextBlocklistTests.java new file mode 100644 index 0000000000000..ca15af68345b4 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/CreateOrUpdateTextBlocklistTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.models.TextBlocklist; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class CreateOrUpdateTextBlocklistTests extends ContentSafetyClientTestBase { + @Test + @Disabled + public void testCreateOrUpdateTextBlocklistTests() { + // method invocation + TextBlocklist response = blocklistClient.createOrUpdateTextBlocklist("TestBlocklist", null); + + // response assertion + Assertions.assertNotNull(response); + // verify property "name" + Assertions.assertEquals("TestBlocklist", response.getName()); + // verify property "description" + Assertions.assertEquals("Test Blocklist", response.getDescription()); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/DeleteTextBlocklistByBlocklistNameTests.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/DeleteTextBlocklistByBlocklistNameTests.java new file mode 100644 index 0000000000000..715435bc0e759 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/DeleteTextBlocklistByBlocklistNameTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class DeleteTextBlocklistByBlocklistNameTests extends ContentSafetyClientTestBase { + @Test + @Disabled + public void testDeleteTextBlocklistByBlocklistNameTests() { + // method invocation + blocklistClient.deleteTextBlocklist("TestBlocklist"); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetAllBlockItemsByBlocklistNameTests.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetAllBlockItemsByBlocklistNameTests.java new file mode 100644 index 0000000000000..9203586bee922 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetAllBlockItemsByBlocklistNameTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.models.TextBlocklistItem; +import com.azure.core.http.rest.PagedIterable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class GetAllBlockItemsByBlocklistNameTests extends ContentSafetyClientTestBase { + @Test + @Disabled + public void testGetAllBlockItemsByBlocklistNameTests() { + // method invocation + PagedIterable response = blocklistClient.listTextBlocklistItems("TestBlocklist", null, null); + + // response assertion + Assertions.assertEquals(200, response.iterableByPage().iterator().next().getStatusCode()); + TextBlocklistItem firstItem = response.iterator().next(); + Assertions.assertNotNull(firstItem); + // verify property "blocklistItemId" + Assertions.assertEquals("9511969e-f1e3-4604-9127-05ee16c509ec", firstItem.getBlocklistItemId()); + // verify property "description" + Assertions.assertEquals("Hate word", firstItem.getDescription()); + // verify property "text" + Assertions.assertEquals("hate", firstItem.getText()); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetAllTextBlocklistsTests.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetAllTextBlocklistsTests.java new file mode 100644 index 0000000000000..6a4fe707d1291 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetAllTextBlocklistsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.models.TextBlocklist; +import com.azure.core.http.rest.PagedIterable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class GetAllTextBlocklistsTests extends ContentSafetyClientTestBase { + @Test + @Disabled + public void testGetAllTextBlocklistsTests() { + // method invocation + PagedIterable response = blocklistClient.listTextBlocklists(); + + // response assertion + Assertions.assertEquals(200, response.iterableByPage().iterator().next().getStatusCode()); + TextBlocklist firstItem = response.iterator().next(); + Assertions.assertNotNull(firstItem); + // verify property "name" + Assertions.assertEquals("TestBlocklist", firstItem.getName()); + // verify property "description" + Assertions.assertEquals("Test Blocklist", firstItem.getDescription()); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetBlockItemByBlocklistNameAndBlocklistItemIdTests.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetBlockItemByBlocklistNameAndBlocklistItemIdTests.java new file mode 100644 index 0000000000000..9b2dc14963786 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetBlockItemByBlocklistNameAndBlocklistItemIdTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.models.TextBlocklistItem; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class GetBlockItemByBlocklistNameAndBlocklistItemIdTests extends ContentSafetyClientTestBase { + @Test + @Disabled + public void testGetBlockItemByBlocklistNameAndBlocklistItemIdTests() { + // method invocation + TextBlocklistItem response + = blocklistClient.getTextBlocklistItem("TestBlocklist", "9511969e-f1e3-4604-9127-05ee16c509ec"); + + // response assertion + Assertions.assertNotNull(response); + // verify property "blocklistItemId" + Assertions.assertEquals("9511969e-f1e3-4604-9127-05ee16c509ec", response.getBlocklistItemId()); + // verify property "description" + Assertions.assertEquals("Hate word", response.getDescription()); + // verify property "text" + Assertions.assertEquals("hate", response.getText()); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetTextBlocklistByBlocklistNameTests.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetTextBlocklistByBlocklistNameTests.java new file mode 100644 index 0000000000000..e1d67c5d9515f --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/GetTextBlocklistByBlocklistNameTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.models.TextBlocklist; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class GetTextBlocklistByBlocklistNameTests extends ContentSafetyClientTestBase { + @Test + @Disabled + public void testGetTextBlocklistByBlocklistNameTests() { + // method invocation + TextBlocklist response = blocklistClient.getTextBlocklist("TestBlocklist"); + + // response assertion + Assertions.assertNotNull(response); + // verify property "name" + Assertions.assertEquals("TestBlocklist", response.getName()); + // verify property "description" + Assertions.assertEquals("Test Blocklist", response.getDescription()); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/RemoveBlockItemsFromTextBlocklistTests.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/RemoveBlockItemsFromTextBlocklistTests.java new file mode 100644 index 0000000000000..d639989619bb6 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/generated/RemoveBlockItemsFromTextBlocklistTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.contentsafety.generated; + +import com.azure.ai.contentsafety.models.RemoveTextBlocklistItemsOptions; +import java.util.Arrays; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class RemoveBlockItemsFromTextBlocklistTests extends ContentSafetyClientTestBase { + @Test + @Disabled + public void testRemoveBlockItemsFromTextBlocklistTests() { + // method invocation + blocklistClient.removeBlocklistItems("TestBlocklist", + new RemoveTextBlocklistItemsOptions(Arrays.asList("9511969e-f1e3-4604-9127-05ee16c509ec"))); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml b/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml index 384b2c5d714fe..c4f47d0455724 100644 --- a/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml +++ b/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/cognitiveservices/ContentSafety -commit: a5b9c3a88dd231e855833fe4c3a6941b37e3c677 -additionalDirectories: [] +commit: 405438c72094a0a43fbcba18a56aa71110b78db8 repo: Azure/azure-rest-api-specs +additionalDirectories: