Skip to content

Commit

Permalink
feat: Automated regeneration of Checks client (#12436)
Browse files Browse the repository at this point in the history
Auto-created at 2024-10-30 13:14:22 +0000 using the toys pull request generator.
  • Loading branch information
yoshi-code-bot authored Oct 30, 2024
1 parent b35ca1e commit 6d72b0b
Show file tree
Hide file tree
Showing 11 changed files with 504 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clients/checks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Install this package from [Hex](https://hex.pm) by adding

```elixir
def deps do
[{:google_api_checks, "~> 0.4"}]
[{:google_api_checks, "~> 0.5"}]
end
```

Expand Down
93 changes: 93 additions & 0 deletions clients/checks/lib/google_api/checks/v1alpha/api/aisafety.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# 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.Checks.V1alpha.Api.Aisafety do
@moduledoc """
API calls for all endpoints tagged `Aisafety`.
"""

alias GoogleApi.Checks.V1alpha.Connection
alias GoogleApi.Gax.{Request, Response}

@library_version Mix.Project.config() |> Keyword.get(:version, "")

@doc """
Analyze a piece of content with the provided set of policies.
## Parameters
* `connection` (*type:* `GoogleApi.Checks.V1alpha.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.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentResponse{}}` on success
* `{:error, info}` on failure
"""
@spec checks_aisafety_classify_content(Tesla.Env.client(), keyword(), keyword()) ::
{:ok,
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def checks_aisafety_classify_content(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("/v1alpha/aisafety:classifyContent", %{})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)

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

@discovery_revision "20240904"
@discovery_revision "20241029"

def discovery_revision(), do: @discovery_revision
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# 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.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequest do
@moduledoc """
Request proto for ClassifyContent RPC.
## Attributes
* `classifierVersion` (*type:* `String.t`, *default:* `nil`) - Optional. Version of the classifier to use. If not specified, the latest version will be used.
* `context` (*type:* `GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestContext.t`, *default:* `nil`) - Optional. Context about the input that will be used to help on the classification.
* `input` (*type:* `GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestInputContent.t`, *default:* `nil`) - Required. Content to be classified.
* `policies` (*type:* `list(GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestPolicyConfig.t)`, *default:* `nil`) - Required. List of policies to classify against.
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:classifierVersion => String.t() | nil,
:context =>
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestContext.t()
| nil,
:input =>
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestInputContent.t()
| nil,
:policies =>
list(
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestPolicyConfig.t()
)
| nil
}

field(:classifierVersion)

field(:context,
as: GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestContext
)

field(:input,
as:
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestInputContent
)

field(:policies,
as:
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestPolicyConfig,
type: :list
)
end

defimpl Poison.Decoder,
for: GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequest do
def decode(value, options) do
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequest.decode(
value,
options
)
end
end

defimpl Poison.Encoder,
for: GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequest do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestContext do
@moduledoc """
Context about the input that will be used to help on the classification.
## Attributes
* `prompt` (*type:* `String.t`, *default:* `nil`) - Optional. Prompt that generated the model response.
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:prompt => String.t() | nil
}

field(:prompt)
end

defimpl Poison.Decoder,
for: GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestContext do
def decode(value, options) do
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestContext.decode(
value,
options
)
end
end

defimpl Poison.Encoder,
for: GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestContext do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestInputContent do
@moduledoc """
Content to be classified.
## Attributes
* `textInput` (*type:* `GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaTextInput.t`, *default:* `nil`) - Content in text format.
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:textInput =>
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaTextInput.t() | nil
}

field(:textInput, as: GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaTextInput)
end

defimpl Poison.Decoder,
for:
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestInputContent do
def decode(value, options) do
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestInputContent.decode(
value,
options
)
end
end

defimpl Poison.Encoder,
for:
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestInputContent do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestPolicyConfig do
@moduledoc """
List of policies to classify against.
## Attributes
* `policyType` (*type:* `String.t`, *default:* `nil`) - Required. Type of the policy.
* `threshold` (*type:* `number()`, *default:* `nil`) - Optional. Score threshold to use when deciding if the content is violative or non-violative. If not specified, the default 0.5 threshold for the policy will be used.
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:policyType => String.t() | nil,
:threshold => number() | nil
}

field(:policyType)
field(:threshold)
end

defimpl Poison.Decoder,
for:
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestPolicyConfig do
def decode(value, options) do
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestPolicyConfig.decode(
value,
options
)
end
end

defimpl Poison.Encoder,
for:
GoogleApi.Checks.V1alpha.Model.GoogleChecksAisafetyV1alphaClassifyContentRequestPolicyConfig do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
Loading

0 comments on commit 6d72b0b

Please sign in to comment.