diff --git a/specification/cognitiveservices/ContentSafety/client.tsp b/specification/cognitiveservices/ContentSafety/client.tsp new file mode 100644 index 000000000000..9cbb8e13d7d5 --- /dev/null +++ b/specification/cognitiveservices/ContentSafety/client.tsp @@ -0,0 +1,32 @@ +import "@azure-tools/typespec-client-generator-core"; +import "./main.tsp"; + +using Azure.ClientGenerator.Core; + +@TypeSpec.Versioning.useDependency(Azure.Core.Versions.v1_0_Preview_2) +@TypeSpec.Versioning.useDependency(ContentSafety.Versions.v2023_10_01) +namespace Customizations; + +@client({ + name: "ContentSafetyClient", + service: ContentSafety, +}) +interface ContentSafetyClient { + analyzeText is ContentSafety.TextOperations.analyzeText; + analyzeImage is ContentSafety.ImageOperations.analyzeImage; +} + +@client({ + name: "BlocklistClient", + service: ContentSafety, +}) +interface BlocklistClient { + addOrUpdateBlocklistItems is ContentSafety.TextBlocklists.addOrUpdateBlocklistItems; + createOrUpdateTextBlocklist is ContentSafety.TextBlocklists.createOrUpdateTextBlocklist; + deleteTextBlocklist is ContentSafety.TextBlocklists.deleteTextBlocklist; + getTextBlocklist is ContentSafety.TextBlocklists.getTextBlocklist; + getTextBlocklistItem is ContentSafety.TextBlocklists.getTextBlocklistItem; + listTextBlocklistItems is ContentSafety.TextBlocklists.listTextBlocklistItems; + listTextBlocklists is ContentSafety.TextBlocklists.listTextBlocklists; + removeBlocklistItems is ContentSafety.TextBlocklists.removeBlocklistItems; +} diff --git a/specification/cognitiveservices/ContentSafety/models.tsp b/specification/cognitiveservices/ContentSafety/models.tsp index a97f8a1b1bd1..43c396f92d2b 100644 --- a/specification/cognitiveservices/ContentSafety/models.tsp +++ b/specification/cognitiveservices/ContentSafety/models.tsp @@ -106,11 +106,13 @@ model AnalyzeImageOptions { @doc("The image can be either base64 encoded bytes or a blob URL. You can choose only one of these options. If both are provided, the request will be refused. The maximum image size is 2048 x 2048 pixels and should not exceed 4 MB, while the minimum image size is 50 x 50 pixels.") @projectedName("csharp", "ContentSafetyImageData") +@projectedName("java", "ContentSafetyImageData") model ImageData { @doc("The Base64 encoding of the image.") content?: bytes; @doc("The blob url of the image.") + @projectedName("csharp", "BlobUri") blobUrl?: url; } @@ -137,6 +139,8 @@ model TextBlocklist { @key("blocklistName") @visibility("read", "create", "query") @maxLength(64) + @projectedName("csharp", "Name") + @projectedName("java", "name") blocklistName: string; @doc("Text blocklist description.") diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index 1e3893cf987f..55490c6e7828 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -20,6 +20,9 @@ interface TextOperations { { @body @doc("The text analysis request.") + @projectedName("csharp", "options") + @projectedName("python", "options") + @projectedName("java", "options") body: AnalyzeTextOptions; }, AnalyzeTextResult @@ -35,6 +38,9 @@ interface ImageOperations { { @doc("The image analysis request.") @body + @projectedName("csharp", "options") + @projectedName("python", "options") + @projectedName("java", "options") body: AnalyzeImageOptions; }, AnalyzeImageResult @@ -46,6 +52,11 @@ interface BlockOps NoConditionalRequests & NoClientRequestId> {} +@@projectedName(Azure.Core.Foundations.ResourceBody.resource, + "client", + "options" +); + interface TextBlocklists { @summary("Get Text Blocklist By blocklistName") @doc("Returns text blocklist details.") @@ -67,7 +78,14 @@ interface TextBlocklists { @doc("Add or update blocklistItems to a text blocklist. You can add or update at most 100 blocklistItems in one request.") addOrUpdateBlocklistItems is BlockOps.ResourceAction< TextBlocklist, - AddOrUpdateTextBlocklistItemsOptions, + { + @doc("Options for adding or updating blocklist items.") + @body + @projectedName("csharp", "options") + @projectedName("python", "options") + @projectedName("java", "options") + body: AddOrUpdateTextBlocklistItemsOptions; + }, AddOrUpdateTextBlocklistItemsResult >; @@ -75,7 +93,14 @@ interface TextBlocklists { @doc("Remove blocklistItems from a text blocklist. You can remove at most 100 BlocklistItems in one request.") removeBlocklistItems is BlockOps.ResourceAction< TextBlocklist, - RemoveTextBlocklistItemsOptions, + { + @doc("Options for removing blocklist items.") + @body + @projectedName("csharp", "options") + @projectedName("python", "options") + @projectedName("java", "options") + body: RemoveTextBlocklistItemsOptions; + }, NoContentResponse >; diff --git a/specification/cognitiveservices/ContentSafety/tspconfig.yaml b/specification/cognitiveservices/ContentSafety/tspconfig.yaml index 726d9d0fc37a..43f100e93aa8 100644 --- a/specification/cognitiveservices/ContentSafety/tspconfig.yaml +++ b/specification/cognitiveservices/ContentSafety/tspconfig.yaml @@ -22,7 +22,7 @@ options: clear-output-folder: true model-namespace: false "@azure-tools/typespec-ts": - package-dir: "azure-ai-content-safety-rest" + package-dir: "ai-content-safety-rest" packageDetails: name: "@azure-rest/ai-content-safety" version: "1.0.0" diff --git a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json index b284873f1ae2..a8ddc04747de 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/stable/2023-10-01/contentsafety.json @@ -315,6 +315,7 @@ { "name": "body", "in": "body", + "description": "Options for adding or updating blocklist items.", "required": true, "schema": { "$ref": "#/definitions/AddOrUpdateTextBlocklistItemsOptions" @@ -369,6 +370,7 @@ { "name": "body", "in": "body", + "description": "Options for removing blocklist items.", "required": true, "schema": { "$ref": "#/definitions/RemoveTextBlocklistItemsOptions"