Skip to content

Commit

Permalink
feat: Automated regeneration of BusinessProfilePerformance client
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation committed Mar 12, 2024
1 parent 7ac1a0b commit e86ba37
Show file tree
Hide file tree
Showing 10 changed files with 366 additions and 7 deletions.
4 changes: 2 additions & 2 deletions clients/business_profile_performance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Business Profile Performance API client library.

The Business Profile Performance API allows merchants to fetch performance reports about their business profile on Google.
The Business Profile Performance API allows merchants to fetch performance reports about their business profile on Google. Note - If you have a quota of 0 after enabling the API, please request for GBP API access.

## Installation

Expand All @@ -11,7 +11,7 @@ Install this package from [Hex](https://hex.pm) by adding

```elixir
def deps do
[{:google_api_business_profile_performance, "~> 0.2"}]
[{:google_api_business_profile_performance, "~> 0.3"}]
end
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,97 @@ defmodule GoogleApi.BusinessProfilePerformance.V1.Api.Locations do

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

@doc """
Returns the values for each date from a given time range and optionally the sub entity type, where applicable, that are associated with the specific daily metrics. Example request: `GET https://businessprofileperformance.googleapis.com/v1/locations/12345:fetchMultiDailyMetricsTimeSeries?dailyMetrics=WEBSITE_CLICKS&dailyMetrics=CALL_CLICKS&daily_range.start_date.year=2022&daily_range.start_date.month=1&daily_range.start_date.day=1&daily_range.end_date.year=2022&daily_range.end_date.month=3&daily_range.end_date.day=31`
## Parameters
* `connection` (*type:* `GoogleApi.BusinessProfilePerformance.V1.Connection.t`) - Connection to server
* `location` (*type:* `String.t`) - Required. The location for which the time series should be fetched. Format: locations/{location_id} where location_id is an unobfuscated listing id.
* `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").
* `:dailyMetrics` (*type:* `list(String.t)`) - Required. The metrics to retrieve time series for.
* `:"dailyRange.endDate.day"` (*type:* `integer()`) - Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
* `:"dailyRange.endDate.month"` (*type:* `integer()`) - Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
* `:"dailyRange.endDate.year"` (*type:* `integer()`) - Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
* `:"dailyRange.startDate.day"` (*type:* `integer()`) - Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
* `:"dailyRange.startDate.month"` (*type:* `integer()`) - Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
* `:"dailyRange.startDate.year"` (*type:* `integer()`) - Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.BusinessProfilePerformance.V1.Model.FetchMultiDailyMetricsTimeSeriesResponse{}}` on success
* `{:error, info}` on failure
"""
@spec businessprofileperformance_locations_fetch_multi_daily_metrics_time_series(
Tesla.Env.client(),
String.t(),
keyword(),
keyword()
) ::
{:ok,
GoogleApi.BusinessProfilePerformance.V1.Model.FetchMultiDailyMetricsTimeSeriesResponse.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def businessprofileperformance_locations_fetch_multi_daily_metrics_time_series(
connection,
location,
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,
:dailyMetrics => :query,
:"dailyRange.endDate.day" => :query,
:"dailyRange.endDate.month" => :query,
:"dailyRange.endDate.year" => :query,
:"dailyRange.startDate.day" => :query,
:"dailyRange.startDate.month" => :query,
:"dailyRange.startDate.year" => :query
}

request =
Request.new()
|> Request.method(:get)
|> Request.url("/v1/{+location}:fetchMultiDailyMetricsTimeSeries", %{
"location" => URI.encode(location, &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.BusinessProfilePerformance.V1.Model.FetchMultiDailyMetricsTimeSeriesResponse{}
]
)
end

@doc """
Returns the values for each date from a given time range that are associated with the specific daily metric. Example request: `GET https://businessprofileperformance.googleapis.com/v1/locations/12345:getDailyMetricsTimeSeries?dailyMetric=WEBSITE_CLICKS&daily_range.start_date.year=2022&daily_range.start_date.month=1&daily_range.start_date.day=1&daily_range.end_date.year=2022&daily_range.end_date.month=3&daily_range.end_date.day=31`
Expand All @@ -51,7 +142,7 @@ defmodule GoogleApi.BusinessProfilePerformance.V1.Api.Locations do
* `:"dailyRange.startDate.day"` (*type:* `integer()`) - Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
* `:"dailyRange.startDate.month"` (*type:* `integer()`) - Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
* `:"dailyRange.startDate.year"` (*type:* `integer()`) - Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
* `:"dailySubEntityType.dayOfWeek"` (*type:* `String.t`) - Represents the day of the week. Eg: MONDAY.
* `:"dailySubEntityType.dayOfWeek"` (*type:* `String.t`) - Represents the day of the week. Eg: MONDAY. Currently supported DailyMetrics = NONE.
* `:"dailySubEntityType.timeOfDay.hours"` (*type:* `integer()`) - Hours of day in 24 hour format. Should be from 0 to 23. An API may choose to allow the value "24:00:00" for scenarios like business closing time.
* `:"dailySubEntityType.timeOfDay.minutes"` (*type:* `integer()`) - Minutes of hour of day. Must be from 0 to 59.
* `:"dailySubEntityType.timeOfDay.nanos"` (*type:* `integer()`) - Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule GoogleApi.BusinessProfilePerformance.V1 do
API client metadata for GoogleApi.BusinessProfilePerformance.V1.
"""

@discovery_revision "20220714"
@discovery_revision "20240310"

def discovery_revision(), do: @discovery_revision
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 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.BusinessProfilePerformance.V1.Model.DailyMetricTimeSeries do
@moduledoc """
Represents a single datapoint, where each datapoint is a DailyMetric-DailySubEntityType-TimeSeries tuple.
## Attributes
* `dailyMetric` (*type:* `String.t`, *default:* `nil`) - The DailyMetric that the TimeSeries represents.
* `dailySubEntityType` (*type:* `GoogleApi.BusinessProfilePerformance.V1.Model.DailySubEntityType.t`, *default:* `nil`) - The DailySubEntityType that the TimeSeries represents. Will not be present when breakdown does not exist.
* `timeSeries` (*type:* `GoogleApi.BusinessProfilePerformance.V1.Model.TimeSeries.t`, *default:* `nil`) - List of datapoints where each datapoint is a date-value pair.
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:dailyMetric => String.t() | nil,
:dailySubEntityType =>
GoogleApi.BusinessProfilePerformance.V1.Model.DailySubEntityType.t() | nil,
:timeSeries => GoogleApi.BusinessProfilePerformance.V1.Model.TimeSeries.t() | nil
}

field(:dailyMetric)
field(:dailySubEntityType, as: GoogleApi.BusinessProfilePerformance.V1.Model.DailySubEntityType)
field(:timeSeries, as: GoogleApi.BusinessProfilePerformance.V1.Model.TimeSeries)
end

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

defimpl Poison.Encoder, for: GoogleApi.BusinessProfilePerformance.V1.Model.DailyMetricTimeSeries 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,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.BusinessProfilePerformance.V1.Model.DailySubEntityType do
@moduledoc """
Represents all possible subentity types that are associated with DailyMetrics.
## Attributes
* `dayOfWeek` (*type:* `String.t`, *default:* `nil`) - Represents the day of the week. Eg: MONDAY. Currently supported DailyMetrics = NONE.
* `timeOfDay` (*type:* `GoogleApi.BusinessProfilePerformance.V1.Model.TimeOfDay.t`, *default:* `nil`) - Represents the time of the day in 24 hour format. Eg: 13:34:20 Currently supported DailyMetrics = NONE.
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:dayOfWeek => String.t() | nil,
:timeOfDay => GoogleApi.BusinessProfilePerformance.V1.Model.TimeOfDay.t() | nil
}

field(:dayOfWeek)
field(:timeOfDay, as: GoogleApi.BusinessProfilePerformance.V1.Model.TimeOfDay)
end

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

defimpl Poison.Encoder, for: GoogleApi.BusinessProfilePerformance.V1.Model.DailySubEntityType 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 @@ -22,7 +22,7 @@ defmodule GoogleApi.BusinessProfilePerformance.V1.Model.DatedValue do
## Attributes
* `date` (*type:* `GoogleApi.BusinessProfilePerformance.V1.Model.Date.t`, *default:* `nil`) - The date that the datapoint corresponds to. This represents a month value if the day field is not set.
* `value` (*type:* `String.t`, *default:* `nil`) - The value of the datapoint.
* `value` (*type:* `String.t`, *default:* `nil`) - The value of the datapoint. This will not be present when the value is zero.
"""

use GoogleApi.Gax.ModelBase
Expand Down
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.BusinessProfilePerformance.V1.Model.FetchMultiDailyMetricsTimeSeriesResponse do
@moduledoc """
Represents the response for FetchMultiDailyMetricsTimeSeries.
## Attributes
* `multiDailyMetricTimeSeries` (*type:* `list(GoogleApi.BusinessProfilePerformance.V1.Model.MultiDailyMetricTimeSeries.t)`, *default:* `nil`) - DailyMetrics and their corresponding time series.
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:multiDailyMetricTimeSeries =>
list(GoogleApi.BusinessProfilePerformance.V1.Model.MultiDailyMetricTimeSeries.t())
| nil
}

field(:multiDailyMetricTimeSeries,
as: GoogleApi.BusinessProfilePerformance.V1.Model.MultiDailyMetricTimeSeries,
type: :list
)
end

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

defimpl Poison.Encoder,
for: GoogleApi.BusinessProfilePerformance.V1.Model.FetchMultiDailyMetricsTimeSeriesResponse 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,55 @@
# 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.BusinessProfilePerformance.V1.Model.MultiDailyMetricTimeSeries do
@moduledoc """
Represents a list of tuples of DailyMetric-DailySubEntityType-TimeSeries.
## Attributes
* `dailyMetricTimeSeries` (*type:* `list(GoogleApi.BusinessProfilePerformance.V1.Model.DailyMetricTimeSeries.t)`, *default:* `nil`) - List of DailyMetric-TimeSeries pairs.
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:dailyMetricTimeSeries =>
list(GoogleApi.BusinessProfilePerformance.V1.Model.DailyMetricTimeSeries.t()) | nil
}

field(:dailyMetricTimeSeries,
as: GoogleApi.BusinessProfilePerformance.V1.Model.DailyMetricTimeSeries,
type: :list
)
end

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

defimpl Poison.Encoder,
for: GoogleApi.BusinessProfilePerformance.V1.Model.MultiDailyMetricTimeSeries do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
Loading

0 comments on commit e86ba37

Please sign in to comment.