lib/google_api/display_video/v1/model/frequency_cap.ex

# 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.DisplayVideo.V1.Model.FrequencyCap do
  @moduledoc """
  Settings that control the number of times a user may be shown with the same ad during a given time period.

  ## Attributes

  *   `maxImpressions` (*type:* `integer()`, *default:* `nil`) - The maximum number of times a user may be shown with the same ad during this period. Must be greater than 0. Required when unlimited is `false`.
  *   `timeUnit` (*type:* `String.t`, *default:* `nil`) - The time unit in which the frequency cap will be applied. Required when unlimited is `false`.
  *   `timeUnitCount` (*type:* `integer()`, *default:* `nil`) - The number of time_unit the frequency cap will last. Required when unlimited is `false`. The following restrictions apply based on the value of time_unit: * `TIME_UNIT_LIFETIME` - this field is output only and will default to 1 * `TIME_UNIT_MONTHS` - must be between 1 and 2 * `TIME_UNIT_WEEKS` - must be between 1 and 4 * `TIME_UNIT_DAYS` - must be between 1 and 6 * `TIME_UNIT_HOURS` - must be between 1 and 23 * `TIME_UNIT_MINUTES` - must be between 1 and 59
  *   `unlimited` (*type:* `boolean()`, *default:* `nil`) - Whether unlimited frequency capping is applied. When this field is set to `true`, the remaining frequency cap fields are not applicable.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :maxImpressions => integer() | nil,
          :timeUnit => String.t() | nil,
          :timeUnitCount => integer() | nil,
          :unlimited => boolean() | nil
        }

  field(:maxImpressions)
  field(:timeUnit)
  field(:timeUnitCount)
  field(:unlimited)
end

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

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