Skip to content

Commit

Permalink
feat: Automated regeneration of Language client (#10999)
Browse files Browse the repository at this point in the history
Auto-created at 2024-03-12 02:54:08 +0000 using the toys pull request generator.
  • Loading branch information
yoshi-code-bot authored Mar 12, 2024
1 parent 612a04d commit fe40743
Show file tree
Hide file tree
Showing 132 changed files with 6,931 additions and 29 deletions.
59 changes: 59 additions & 0 deletions clients/language/lib/google_api/language/v1/api/documents.ex
Original file line number Diff line number Diff line change
Expand Up @@ -380,4 +380,63 @@ defmodule GoogleApi.Language.V1.Api.Documents do
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Language.V1.Model.ClassifyTextResponse{}])
end

@doc """
Moderates a document for harmful and sensitive categories.
## Parameters
* `connection` (*type:* `GoogleApi.Language.V1.Connection.t`) - Connection to server
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.Language.V1.Model.ModerateTextRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Language.V1.Model.ModerateTextResponse{}}` on success
* `{:error, info}` on failure
"""
@spec language_documents_moderate_text(Tesla.Env.client(), keyword(), keyword()) ::
{:ok, GoogleApi.Language.V1.Model.ModerateTextResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def language_documents_moderate_text(connection, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}

request =
Request.new()
|> Request.method(:post)
|> Request.url("/v1/documents:moderateText", %{})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)

connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Language.V1.Model.ModerateTextResponse{}])
end
end
2 changes: 1 addition & 1 deletion clients/language/lib/google_api/language/v1/metadata.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule GoogleApi.Language.V1 do
API client metadata for GoogleApi.Language.V1.
"""

@discovery_revision "20221015"
@discovery_revision "20240310"

def discovery_revision(), do: @discovery_revision
end
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ defmodule GoogleApi.Language.V1.Model.AnnotateTextRequest do
* `document` (*type:* `GoogleApi.Language.V1.Model.Document.t`, *default:* `nil`) - Required. Input document.
* `encodingType` (*type:* `String.t`, *default:* `nil`) - The encoding type used by the API to calculate offsets.
* `features` (*type:* `GoogleApi.Language.V1.Model.Features.t`, *default:* `nil`) - Required. The enabled features.
* `features` (*type:* `GoogleApi.Language.V1.Model.AnnotateTextRequestFeatures.t`, *default:* `nil`) - Required. The enabled features.
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:document => GoogleApi.Language.V1.Model.Document.t() | nil,
:encodingType => String.t() | nil,
:features => GoogleApi.Language.V1.Model.Features.t() | nil
:features => GoogleApi.Language.V1.Model.AnnotateTextRequestFeatures.t() | nil
}

field(:document, as: GoogleApi.Language.V1.Model.Document)
field(:encodingType)
field(:features, as: GoogleApi.Language.V1.Model.Features)
field(:features, as: GoogleApi.Language.V1.Model.AnnotateTextRequestFeatures)
end

defimpl Poison.Decoder, for: GoogleApi.Language.V1.Model.AnnotateTextRequest do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@
# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Language.V1.Model.Features do
defmodule GoogleApi.Language.V1.Model.AnnotateTextRequestFeatures do
@moduledoc """
All available features for sentiment, syntax, and semantic analysis. Setting each one to true will enable that specific analysis for the input.
## Attributes
* `classificationModelOptions` (*type:* `GoogleApi.Language.V1.Model.ClassificationModelOptions.t`, *default:* `nil`) - The model options to use for classification. Defaults to v1 options if not specified. Only used if `classify_text` is set to true.
* `classificationModelOptions` (*type:* `GoogleApi.Language.V1.Model.ClassificationModelOptions.t`, *default:* `nil`) - Optional. The model options to use for classification. Defaults to v1 options if not specified. Only used if `classify_text` is set to true.
* `classifyText` (*type:* `boolean()`, *default:* `nil`) - Classify the full document into categories.
* `extractDocumentSentiment` (*type:* `boolean()`, *default:* `nil`) - Extract document-level sentiment.
* `extractEntities` (*type:* `boolean()`, *default:* `nil`) - Extract entities.
* `extractEntitySentiment` (*type:* `boolean()`, *default:* `nil`) - Extract entities and their associated sentiment.
* `extractSyntax` (*type:* `boolean()`, *default:* `nil`) - Extract syntax information.
* `moderateText` (*type:* `boolean()`, *default:* `nil`) - Moderate the document for harmful and sensitive categories.
"""

use GoogleApi.Gax.ModelBase
Expand All @@ -38,7 +39,8 @@ defmodule GoogleApi.Language.V1.Model.Features do
:extractDocumentSentiment => boolean() | nil,
:extractEntities => boolean() | nil,
:extractEntitySentiment => boolean() | nil,
:extractSyntax => boolean() | nil
:extractSyntax => boolean() | nil,
:moderateText => boolean() | nil
}

field(:classificationModelOptions, as: GoogleApi.Language.V1.Model.ClassificationModelOptions)
Expand All @@ -47,15 +49,16 @@ defmodule GoogleApi.Language.V1.Model.Features do
field(:extractEntities)
field(:extractEntitySentiment)
field(:extractSyntax)
field(:moderateText)
end

defimpl Poison.Decoder, for: GoogleApi.Language.V1.Model.Features do
defimpl Poison.Decoder, for: GoogleApi.Language.V1.Model.AnnotateTextRequestFeatures do
def decode(value, options) do
GoogleApi.Language.V1.Model.Features.decode(value, options)
GoogleApi.Language.V1.Model.AnnotateTextRequestFeatures.decode(value, options)
end
end

defimpl Poison.Encoder, for: GoogleApi.Language.V1.Model.Features do
defimpl Poison.Encoder, for: GoogleApi.Language.V1.Model.AnnotateTextRequestFeatures do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ defmodule GoogleApi.Language.V1.Model.AnnotateTextResponse do
* `documentSentiment` (*type:* `GoogleApi.Language.V1.Model.Sentiment.t`, *default:* `nil`) - The overall sentiment for the document. Populated if the user enables AnnotateTextRequest.Features.extract_document_sentiment.
* `entities` (*type:* `list(GoogleApi.Language.V1.Model.Entity.t)`, *default:* `nil`) - Entities, along with their semantic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_entities.
* `language` (*type:* `String.t`, *default:* `nil`) - The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for more details.
* `moderationCategories` (*type:* `list(GoogleApi.Language.V1.Model.ClassificationCategory.t)`, *default:* `nil`) - Harmful and sensitive categories identified in the input document.
* `sentences` (*type:* `list(GoogleApi.Language.V1.Model.Sentence.t)`, *default:* `nil`) - Sentences in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax.
* `tokens` (*type:* `list(GoogleApi.Language.V1.Model.Token.t)`, *default:* `nil`) - Tokens, along with their syntactic information, in the input document. Populated if the user enables AnnotateTextRequest.Features.extract_syntax.
"""
Expand All @@ -36,6 +37,8 @@ defmodule GoogleApi.Language.V1.Model.AnnotateTextResponse do
:documentSentiment => GoogleApi.Language.V1.Model.Sentiment.t() | nil,
:entities => list(GoogleApi.Language.V1.Model.Entity.t()) | nil,
:language => String.t() | nil,
:moderationCategories =>
list(GoogleApi.Language.V1.Model.ClassificationCategory.t()) | nil,
:sentences => list(GoogleApi.Language.V1.Model.Sentence.t()) | nil,
:tokens => list(GoogleApi.Language.V1.Model.Token.t()) | nil
}
Expand All @@ -44,6 +47,9 @@ defmodule GoogleApi.Language.V1.Model.AnnotateTextResponse do
field(:documentSentiment, as: GoogleApi.Language.V1.Model.Sentiment)
field(:entities, as: GoogleApi.Language.V1.Model.Entity, type: :list)
field(:language)

field(:moderationCategories, as: GoogleApi.Language.V1.Model.ClassificationCategory, type: :list)

field(:sentences, as: GoogleApi.Language.V1.Model.Sentence, type: :list)
field(:tokens, as: GoogleApi.Language.V1.Model.Token, type: :list)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defmodule GoogleApi.Language.V1.Model.ClassificationCategory do
## Attributes
* `confidence` (*type:* `number()`, *default:* `nil`) - The classifier's confidence of the category. Number represents how certain the classifier is that this category represents the given text.
* `name` (*type:* `String.t`, *default:* `nil`) - The name of the category representing the document, from the [predefined taxonomy](https://cloud.google.com/natural-language/docs/categories).
* `name` (*type:* `String.t`, *default:* `nil`) - The name of the category representing the document.
"""

use GoogleApi.Gax.ModelBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ defmodule GoogleApi.Language.V1.Model.ClassificationModelOptions do
## Attributes
* `v1Model` (*type:* `GoogleApi.Language.V1.Model.V1Model.t`, *default:* `nil`) - Setting this field will use the V1 model and V1 content categories version. The V1 model is a legacy model; support for this will be discontinued in the future.
* `v2Model` (*type:* `GoogleApi.Language.V1.Model.V2Model.t`, *default:* `nil`) - Setting this field will use the V2 model with the appropriate content categories version. The V2 model is a better performing model.
* `v1Model` (*type:* `GoogleApi.Language.V1.Model.ClassificationModelOptionsV1Model.t`, *default:* `nil`) - Setting this field will use the V1 model and V1 content categories version. The V1 model is a legacy model; support for this will be discontinued in the future.
* `v2Model` (*type:* `GoogleApi.Language.V1.Model.ClassificationModelOptionsV2Model.t`, *default:* `nil`) - Setting this field will use the V2 model with the appropriate content categories version. The V2 model is a better performing model.
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:v1Model => GoogleApi.Language.V1.Model.V1Model.t() | nil,
:v2Model => GoogleApi.Language.V1.Model.V2Model.t() | nil
:v1Model => GoogleApi.Language.V1.Model.ClassificationModelOptionsV1Model.t() | nil,
:v2Model => GoogleApi.Language.V1.Model.ClassificationModelOptionsV2Model.t() | nil
}

field(:v1Model, as: GoogleApi.Language.V1.Model.V1Model)
field(:v2Model, as: GoogleApi.Language.V1.Model.V2Model)
field(:v1Model, as: GoogleApi.Language.V1.Model.ClassificationModelOptionsV1Model)
field(:v2Model, as: GoogleApi.Language.V1.Model.ClassificationModelOptionsV2Model)
end

defimpl Poison.Decoder, for: GoogleApi.Language.V1.Model.ClassificationModelOptions do
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2019 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
#
# http://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.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Language.V1.Model.ClassificationModelOptionsV1Model do
@moduledoc """
Options for the V1 model.
## Attributes
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{}
end

defimpl Poison.Decoder, for: GoogleApi.Language.V1.Model.ClassificationModelOptionsV1Model do
def decode(value, options) do
GoogleApi.Language.V1.Model.ClassificationModelOptionsV1Model.decode(value, options)
end
end

defimpl Poison.Encoder, for: GoogleApi.Language.V1.Model.ClassificationModelOptionsV1Model do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Language.V1.Model.V2Model do
defmodule GoogleApi.Language.V1.Model.ClassificationModelOptionsV2Model do
@moduledoc """
Options for the V2 model.
Expand All @@ -33,13 +33,13 @@ defmodule GoogleApi.Language.V1.Model.V2Model do
field(:contentCategoriesVersion)
end

defimpl Poison.Decoder, for: GoogleApi.Language.V1.Model.V2Model do
defimpl Poison.Decoder, for: GoogleApi.Language.V1.Model.ClassificationModelOptionsV2Model do
def decode(value, options) do
GoogleApi.Language.V1.Model.V2Model.decode(value, options)
GoogleApi.Language.V1.Model.ClassificationModelOptionsV2Model.decode(value, options)
end
end

defimpl Poison.Encoder, for: GoogleApi.Language.V1.Model.V2Model do
defimpl Poison.Encoder, for: GoogleApi.Language.V1.Model.ClassificationModelOptionsV2Model do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule GoogleApi.Language.V1.Model.ClassifyTextRequest do
## Attributes
* `classificationModelOptions` (*type:* `GoogleApi.Language.V1.Model.ClassificationModelOptions.t`, *default:* `nil`) - Model options to use for classification. Defaults to v1 options if not specified.
* `classificationModelOptions` (*type:* `GoogleApi.Language.V1.Model.ClassificationModelOptions.t`, *default:* `nil`) - Optional. Model options to use for classification. Defaults to v1 options if not specified.
* `document` (*type:* `GoogleApi.Language.V1.Model.Document.t`, *default:* `nil`) - Required. Input document.
"""

Expand Down
Loading

0 comments on commit fe40743

Please sign in to comment.