Skip to content

Commit

Permalink
feat: Added client library support for ModerateText in the Natural La…
Browse files Browse the repository at this point in the history
…nguage API (V1)

PiperOrigin-RevId: 534992604

Source-Link: googleapis/googleapis@2400fac

Source-Link: googleapis/googleapis-gen@32caa58
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuTGFuZ3VhZ2UuVjEvLk93bEJvdC55YW1sIiwiaCI6IjMyY2FhNTgwMTMxYjA1Yjg4MGZhM2I4MDJjYTBjMjExNzk4ODE3MzMifQ==
  • Loading branch information
gcf-owl-bot[bot] authored and amanda-tarafa committed May 25, 2023
1 parent 03b43b5 commit 0af8e03
Show file tree
Hide file tree
Showing 10 changed files with 1,151 additions and 59 deletions.
@@ -0,0 +1,44 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START language_v1_generated_LanguageService_ModerateText_async_flattened]
using Google.Cloud.Language.V1;
using System.Threading.Tasks;

public sealed partial class GeneratedLanguageServiceClientSnippets
{
/// <summary>Snippet for ModerateTextAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task ModerateTextAsync()
{
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
// Make the request
ModerateTextResponse response = await languageServiceClient.ModerateTextAsync(document);
}
}
// [END language_v1_generated_LanguageService_ModerateText_async_flattened]
}
@@ -0,0 +1,47 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START language_v1_generated_LanguageService_ModerateText_async]
using Google.Cloud.Language.V1;
using System.Threading.Tasks;

public sealed partial class GeneratedLanguageServiceClientSnippets
{
/// <summary>Snippet for ModerateTextAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task ModerateTextRequestObjectAsync()
{
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
ModerateTextRequest request = new ModerateTextRequest
{
Document = new Document(),
};
// Make the request
ModerateTextResponse response = await languageServiceClient.ModerateTextAsync(request);
}
}
// [END language_v1_generated_LanguageService_ModerateText_async]
}
@@ -0,0 +1,46 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START language_v1_generated_LanguageService_ModerateText_sync]
using Google.Cloud.Language.V1;

public sealed partial class GeneratedLanguageServiceClientSnippets
{
/// <summary>Snippet for ModerateText</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void ModerateTextRequestObject()
{
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
ModerateTextRequest request = new ModerateTextRequest
{
Document = new Document(),
};
// Make the request
ModerateTextResponse response = languageServiceClient.ModerateText(request);
}
}
// [END language_v1_generated_LanguageService_ModerateText_sync]
}
@@ -0,0 +1,43 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START language_v1_generated_LanguageService_ModerateText_sync_flattened]
using Google.Cloud.Language.V1;

public sealed partial class GeneratedLanguageServiceClientSnippets
{
/// <summary>Snippet for ModerateText</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void ModerateText()
{
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
Document document = new Document();
// Make the request
ModerateTextResponse response = languageServiceClient.ModerateText(document);
}
}
// [END language_v1_generated_LanguageService_ModerateText_sync_flattened]
}
Expand Up @@ -1382,6 +1382,198 @@
}
]
},
{
"regionTag": "language_v1_generated_LanguageService_ModerateText_sync",
"title": "ModerateTextRequestObject",
"description": "Snippet for ModerateText",
"file": "LanguageServiceClient.ModerateTextRequestObjectSnippet.g.cs",
"language": "C_SHARP",
"clientMethod": {
"shortName": "ModerateText",
"fullName": "Google.Cloud.Language.V1.LanguageServiceClient.ModerateText",
"parameters": [
{
"type": "Google.Cloud.Language.V1.ModerateTextRequest",
"name": "request"
},
{
"type": "Google.Api.Gax.Grpc.CallSettings",
"name": "callSettings"
}
],
"resultType": "Google.Cloud.Language.V1.ModerateTextResponse",
"client": {
"shortName": "LanguageServiceClient",
"fullName": "Google.Cloud.Language.V1.LanguageServiceClient"
},
"method": {
"shortName": "ModerateText",
"fullName": "google.cloud.language.v1.LanguageService.ModerateText",
"service": {
"shortName": "LanguageService",
"fullName": "google.cloud.language.v1.LanguageService"
}
}
},
"canonical": true,
"origin": "API_DEFINITION",
"segments": [
{
"start": 20,
"end": 44,
"type": "FULL"
},
{
"start": 34,
"end": 42,
"type": "SHORT"
}
]
},
{
"regionTag": "language_v1_generated_LanguageService_ModerateText_async",
"title": "ModerateTextRequestObjectAsync",
"description": "Snippet for ModerateTextAsync",
"file": "LanguageServiceClient.ModerateTextRequestObjectAsyncSnippet.g.cs",
"language": "C_SHARP",
"clientMethod": {
"shortName": "ModerateTextAsync",
"fullName": "Google.Cloud.Language.V1.LanguageServiceClient.ModerateTextAsync",
"async": true,
"parameters": [
{
"type": "Google.Cloud.Language.V1.ModerateTextRequest",
"name": "request"
},
{
"type": "Google.Api.Gax.Grpc.CallSettings",
"name": "callSettings"
}
],
"resultType": "System.Threading.Tasks.Task<Google.Cloud.Language.V1.ModerateTextResponse>",
"client": {
"shortName": "LanguageServiceClient",
"fullName": "Google.Cloud.Language.V1.LanguageServiceClient"
},
"method": {
"shortName": "ModerateText",
"fullName": "google.cloud.language.v1.LanguageService.ModerateText",
"service": {
"shortName": "LanguageService",
"fullName": "google.cloud.language.v1.LanguageService"
}
}
},
"canonical": true,
"origin": "API_DEFINITION",
"segments": [
{
"start": 20,
"end": 45,
"type": "FULL"
},
{
"start": 35,
"end": 43,
"type": "SHORT"
}
]
},
{
"regionTag": "language_v1_generated_LanguageService_ModerateText_sync_flattened",
"title": "ModerateText",
"description": "Snippet for ModerateText",
"file": "LanguageServiceClient.ModerateTextSnippet.g.cs",
"language": "C_SHARP",
"clientMethod": {
"shortName": "ModerateText",
"fullName": "Google.Cloud.Language.V1.LanguageServiceClient.ModerateText",
"parameters": [
{
"type": "Google.Cloud.Language.V1.Document",
"name": "document"
},
{
"type": "Google.Api.Gax.Grpc.CallSettings",
"name": "callSettings"
}
],
"resultType": "Google.Cloud.Language.V1.ModerateTextResponse",
"client": {
"shortName": "LanguageServiceClient",
"fullName": "Google.Cloud.Language.V1.LanguageServiceClient"
},
"method": {
"shortName": "ModerateText",
"fullName": "google.cloud.language.v1.LanguageService.ModerateText",
"service": {
"shortName": "LanguageService",
"fullName": "google.cloud.language.v1.LanguageService"
}
}
},
"origin": "API_DEFINITION",
"segments": [
{
"start": 20,
"end": 41,
"type": "FULL"
},
{
"start": 34,
"end": 39,
"type": "SHORT"
}
]
},
{
"regionTag": "language_v1_generated_LanguageService_ModerateText_async_flattened",
"title": "ModerateTextAsync",
"description": "Snippet for ModerateTextAsync",
"file": "LanguageServiceClient.ModerateTextAsyncSnippet.g.cs",
"language": "C_SHARP",
"clientMethod": {
"shortName": "ModerateTextAsync",
"fullName": "Google.Cloud.Language.V1.LanguageServiceClient.ModerateTextAsync",
"async": true,
"parameters": [
{
"type": "Google.Cloud.Language.V1.Document",
"name": "document"
},
{
"type": "Google.Api.Gax.Grpc.CallSettings",
"name": "callSettings"
}
],
"resultType": "System.Threading.Tasks.Task<Google.Cloud.Language.V1.ModerateTextResponse>",
"client": {
"shortName": "LanguageServiceClient",
"fullName": "Google.Cloud.Language.V1.LanguageServiceClient"
},
"method": {
"shortName": "ModerateText",
"fullName": "google.cloud.language.v1.LanguageService.ModerateText",
"service": {
"shortName": "LanguageService",
"fullName": "google.cloud.language.v1.LanguageService"
}
}
},
"origin": "API_DEFINITION",
"segments": [
{
"start": 20,
"end": 42,
"type": "FULL"
},
{
"start": 35,
"end": 40,
"type": "SHORT"
}
]
},
{
"regionTag": "language_v1_generated_LanguageService_AnnotateText_sync",
"title": "AnnotateTextRequestObject",
Expand Down

0 comments on commit 0af8e03

Please sign in to comment.