Skip to content

Commit

Permalink
feat: Automated regeneration of AdSense client (#11202)
Browse files Browse the repository at this point in the history
Auto-created at 2024-03-26 13:12:21 +0000 using the toys pull request generator.
  • Loading branch information
yoshi-code-bot authored Mar 26, 2024
1 parent 20c4f1d commit 0e5d9cc
Show file tree
Hide file tree
Showing 7 changed files with 304 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clients/ad_sense/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_ad_sense, "~> 0.15"}]
[{:google_api_ad_sense, "~> 0.16"}]
end
```

Expand Down
124 changes: 124 additions & 0 deletions clients/ad_sense/lib/google_api/ad_sense/v2/api/accounts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1600,6 +1600,130 @@ defmodule GoogleApi.AdSense.V2.Api.Accounts do
|> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V2.Model.ListPaymentsResponse{}])
end

@doc """
Gets information about the selected policy issue.
## Parameters
* `connection` (*type:* `GoogleApi.AdSense.V2.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. Name of the policy issue. Format: accounts/{account}/policyIssues/{policy_issue}
* `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").
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.AdSense.V2.Model.PolicyIssue{}}` on success
* `{:error, info}` on failure
"""
@spec adsense_accounts_policy_issues_get(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.AdSense.V2.Model.PolicyIssue.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def adsense_accounts_policy_issues_get(connection, name, 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
}

request =
Request.new()
|> Request.method(:get)
|> Request.url("/v2/{+name}", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)

connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V2.Model.PolicyIssue{}])
end

@doc """
Lists all the policy issues for the specified account.
## Parameters
* `connection` (*type:* `GoogleApi.AdSense.V2.Connection.t`) - Connection to server
* `parent` (*type:* `String.t`) - Required. The account for which policy issues are being retrieved. Format: accounts/{account}
* `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").
* `:pageSize` (*type:* `integer()`) - The maximum number of policy issues to include in the response, used for paging. If unspecified, at most 10000 policy issues will be returned. The maximum value is 10000; values above 10000 will be coerced to 10000.
* `:pageToken` (*type:* `String.t`) - A page token, received from a previous `ListPolicyIssues` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListPolicyIssues` must match the call that provided the page token.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.AdSense.V2.Model.ListPolicyIssuesResponse{}}` on success
* `{:error, info}` on failure
"""
@spec adsense_accounts_policy_issues_list(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.AdSense.V2.Model.ListPolicyIssuesResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def adsense_accounts_policy_issues_list(connection, parent, 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,
:pageSize => :query,
:pageToken => :query
}

request =
Request.new()
|> Request.method(:get)
|> Request.url("/v2/{+parent}/policyIssues", %{
"parent" => URI.encode(parent, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)

connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V2.Model.ListPolicyIssuesResponse{}])
end

@doc """
Generates an ad hoc report.
Expand Down
2 changes: 1 addition & 1 deletion clients/ad_sense/lib/google_api/ad_sense/v2/metadata.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule GoogleApi.AdSense.V2 do
API client metadata for GoogleApi.AdSense.V2.
"""

@discovery_revision "20240320"
@discovery_revision "20240326"

def discovery_revision(), do: @discovery_revision
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 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.AdSense.V2.Model.ListPolicyIssuesResponse do
@moduledoc """
Response definition for the policy issues list rpc. Policy issues are reported only if the publisher has at least one AFC ad client in READY or GETTING_READY state. If the publisher has no such AFC ad client, the response will be an empty list.
## Attributes
* `nextPageToken` (*type:* `String.t`, *default:* `nil`) - Continuation token used to page through policy issues. To retrieve the next page of the results, set the next request's "page_token" value to this.
* `policyIssues` (*type:* `list(GoogleApi.AdSense.V2.Model.PolicyIssue.t)`, *default:* `nil`) - The policy issues returned in the list response.
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:nextPageToken => String.t() | nil,
:policyIssues => list(GoogleApi.AdSense.V2.Model.PolicyIssue.t()) | nil
}

field(:nextPageToken)
field(:policyIssues, as: GoogleApi.AdSense.V2.Model.PolicyIssue, type: :list)
end

defimpl Poison.Decoder, for: GoogleApi.AdSense.V2.Model.ListPolicyIssuesResponse do
def decode(value, options) do
GoogleApi.AdSense.V2.Model.ListPolicyIssuesResponse.decode(value, options)
end
end

defimpl Poison.Encoder, for: GoogleApi.AdSense.V2.Model.ListPolicyIssuesResponse do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
79 changes: 79 additions & 0 deletions clients/ad_sense/lib/google_api/ad_sense/v2/model/policy_issue.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# 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.AdSense.V2.Model.PolicyIssue do
@moduledoc """
Representation of a policy issue for a single entity (site, site-section, or page). All issues for a single entity are represented by a single PolicyIssue resource, though that PolicyIssue can have multiple causes (or "topics") that can change over time. Policy issues are removed if there are no issues detected recently or if there's a recent successful appeal for the entity.
## Attributes
* `action` (*type:* `String.t`, *default:* `nil`) - Required. The most severe action taken on the entity over the past seven days.
* `adClients` (*type:* `list(String.t)`, *default:* `nil`) - Optional. List of ad clients associated with the policy issue (either as the primary ad client or an associated host/secondary ad client). In the latter case, this will be an ad client that is not owned by the current account.
* `adRequestCount` (*type:* `String.t`, *default:* `nil`) - Required. Total number of ad requests affected by the policy violations over the past seven days.
* `entityType` (*type:* `String.t`, *default:* `nil`) - Required. Type of the entity indicating if the entity is a site, site-section, or page.
* `firstDetectedDate` (*type:* `GoogleApi.AdSense.V2.Model.Date.t`, *default:* `nil`) - Required. The date (in the America/Los_Angeles timezone) when policy violations were first detected on the entity.
* `lastDetectedDate` (*type:* `GoogleApi.AdSense.V2.Model.Date.t`, *default:* `nil`) - Required. The date (in the America/Los_Angeles timezone) when policy violations were last detected on the entity.
* `name` (*type:* `String.t`, *default:* `nil`) - Required. Resource name of the entity with policy issues. Format: accounts/{account}/policyIssues/{policy_issue}
* `policyTopics` (*type:* `list(GoogleApi.AdSense.V2.Model.PolicyTopic.t)`, *default:* `nil`) - Required. Unordered list. The policy topics that this entity was found to violate over the past seven days.
* `site` (*type:* `String.t`, *default:* `nil`) - Required. Hostname/domain of the entity (for example "foo.com" or "www.foo.com"). This _should_ be a bare domain/host name without any protocol. This will be present for all policy issues.
* `siteSection` (*type:* `String.t`, *default:* `nil`) - Optional. Prefix of the site-section having policy issues (For example "foo.com/bar-section"). This will be present if the `entity_type` is `SITE_SECTION` and will be absent for other entity types.
* `uri` (*type:* `String.t`, *default:* `nil`) - Optional. URI of the page having policy violations (for example "foo.com/bar" or "www.foo.com/bar"). This will be present if the `entity_type` is `PAGE` and will be absent for other entity types.
* `warningEscalationDate` (*type:* `GoogleApi.AdSense.V2.Model.Date.t`, *default:* `nil`) - Optional. The date (in the America/Los_Angeles timezone) when the entity will have ad serving demand restricted or ad serving disabled. This is present only for issues with a `WARNED` enforcement action. See https://support.google.com/adsense/answer/11066888.
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:action => String.t() | nil,
:adClients => list(String.t()) | nil,
:adRequestCount => String.t() | nil,
:entityType => String.t() | nil,
:firstDetectedDate => GoogleApi.AdSense.V2.Model.Date.t() | nil,
:lastDetectedDate => GoogleApi.AdSense.V2.Model.Date.t() | nil,
:name => String.t() | nil,
:policyTopics => list(GoogleApi.AdSense.V2.Model.PolicyTopic.t()) | nil,
:site => String.t() | nil,
:siteSection => String.t() | nil,
:uri => String.t() | nil,
:warningEscalationDate => GoogleApi.AdSense.V2.Model.Date.t() | nil
}

field(:action)
field(:adClients, type: :list)
field(:adRequestCount)
field(:entityType)
field(:firstDetectedDate, as: GoogleApi.AdSense.V2.Model.Date)
field(:lastDetectedDate, as: GoogleApi.AdSense.V2.Model.Date)
field(:name)
field(:policyTopics, as: GoogleApi.AdSense.V2.Model.PolicyTopic, type: :list)
field(:site)
field(:siteSection)
field(:uri)
field(:warningEscalationDate, as: GoogleApi.AdSense.V2.Model.Date)
end

defimpl Poison.Decoder, for: GoogleApi.AdSense.V2.Model.PolicyIssue do
def decode(value, options) do
GoogleApi.AdSense.V2.Model.PolicyIssue.decode(value, options)
end
end

defimpl Poison.Encoder, for: GoogleApi.AdSense.V2.Model.PolicyIssue do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
49 changes: 49 additions & 0 deletions clients/ad_sense/lib/google_api/ad_sense/v2/model/policy_topic.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 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.AdSense.V2.Model.PolicyTopic do
@moduledoc """
Information about a particular policy topic. A policy topic represents a single class of policy issue that can impact ad serving for your site. For example, sexual content or having ads that obscure your content. A single policy issue can have multiple policy topics for a single entity.
## Attributes
* `mustFix` (*type:* `boolean()`, *default:* `nil`) - Required. Indicates if this is a policy violation or not. When the value is true, issues that are instances of this topic must be addressed to remain in compliance with the partner's agreements with Google. A false value indicates that it's not mandatory to fix the issues but advertising demand might be restricted.
* `topic` (*type:* `String.t`, *default:* `nil`) - Required. The policy topic. For example, "sexual-content" or "ads-obscuring-content"."
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:mustFix => boolean() | nil,
:topic => String.t() | nil
}

field(:mustFix)
field(:topic)
end

defimpl Poison.Decoder, for: GoogleApi.AdSense.V2.Model.PolicyTopic do
def decode(value, options) do
GoogleApi.AdSense.V2.Model.PolicyTopic.decode(value, options)
end
end

defimpl Poison.Encoder, for: GoogleApi.AdSense.V2.Model.PolicyTopic do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
2 changes: 1 addition & 1 deletion clients/ad_sense/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
defmodule GoogleApi.AdSense.Mixfile do
use Mix.Project

@version "0.15.1"
@version "0.16.0"

def project() do
[
Expand Down

0 comments on commit 0e5d9cc

Please sign in to comment.