Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR azure-ai-contentsafety] support sample gen config for ts emitter #13259

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
107 changes: 104 additions & 3 deletions sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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<TextBlocklistItem> response = blocklistClient.listTextBlocklistItems("TestBlocklist", null, null);
// END:com.azure.ai.contentsafety.generated.listtextblocklistitems.getallblockitemsbyblocklistname
}
}
Original file line number Diff line number Diff line change
@@ -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<TextBlocklist> response = blocklistClient.listTextBlocklists();
// END:com.azure.ai.contentsafety.generated.listtextblocklists.getalltextblocklists
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading