Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions specification/cognitiveservices/ContentSafety/client.tsp
Original file line number Diff line number Diff line change
@@ -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;
}
4 changes: 4 additions & 0 deletions specification/cognitiveservices/ContentSafety/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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.")
Expand Down
29 changes: 27 additions & 2 deletions specification/cognitiveservices/ContentSafety/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ interface TextOperations {
{
@body
@doc("The text analysis request.")
@projectedName("csharp", "options")
@projectedName("python", "options")
@projectedName("java", "options")
body: AnalyzeTextOptions;
},
AnalyzeTextResult
Expand All @@ -35,6 +38,9 @@ interface ImageOperations {
{
@doc("The image analysis request.")
@body
@projectedName("csharp", "options")
@projectedName("python", "options")
@projectedName("java", "options")
body: AnalyzeImageOptions;
},
AnalyzeImageResult
Expand All @@ -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.")
Expand All @@ -67,15 +78,29 @@ 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
>;

@summary("Remove BlocklistItems From Text Blocklist")
@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
>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@
{
"name": "body",
"in": "body",
"description": "Options for adding or updating blocklist items.",
"required": true,
"schema": {
"$ref": "#/definitions/AddOrUpdateTextBlocklistItemsOptions"
Expand Down Expand Up @@ -369,6 +370,7 @@
{
"name": "body",
"in": "body",
"description": "Options for removing blocklist items.",
"required": true,
"schema": {
"$ref": "#/definitions/RemoveTextBlocklistItemsOptions"
Expand Down