Class: Zavudev::Models::TemplateCreateParams::Button

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/zavudev/models/template_create_params.rb,
sig/zavudev/models/template_create_params.rbs

Defined Under Namespace

Modules: OtpType, Type

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(type:, example: nil, otp_type: nil, package_name: nil, phone_number: nil, signature_hash: nil, text: nil, url: nil) ⇒ Object

Some parameter documentations has been truncated, see Zavudev::Models::TemplateCreateParams::Button for more details.

Parameters:

  • type (Symbol, Zavudev::Models::TemplateCreateParams::Button::Type)

    request_contact_info renders a fixed Share Contact Info button that asks t

  • example (String) (defaults to: nil)

    Sample value Meta uses to review templates with a dynamic URL button. Substitute

  • otp_type (Symbol, Zavudev::Models::TemplateCreateParams::Button::OtpType) (defaults to: nil)

    Required when type is 'otp'. COPY_CODE shows copy button, ONE_TAP enables Androi

  • package_name (String) (defaults to: nil)

    Android package name. Required for ONE_TAP buttons.

  • phone_number (String) (defaults to: nil)
  • signature_hash (String) (defaults to: nil)

    Android app signature hash. Required for ONE_TAP buttons.

  • text (String) (defaults to: nil)

    Button label. Required for every type except request_contact_info, whose label

  • url (String) (defaults to: nil)

    Button destination. Use {{1}} exactly once for a dynamic URL (e.g. `https://ex



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/zavudev/models/template_create_params.rb', line 124

class Button < Zavudev::Internal::Type::BaseModel
  # @!attribute type
  #   `request_contact_info` renders a fixed **Share Contact Info** button that asks
  #   the recipient to share their phone number — useful when a contact adopted a
  #   WhatsApp username and you only know their BSUID. It takes no other fields.
  #
  #   @return [Symbol, Zavudev::Models::TemplateCreateParams::Button::Type]
  required :type, enum: -> { Zavudev::TemplateCreateParams::Button::Type }

  # @!attribute example
  #   Sample value Meta uses to review templates with a dynamic URL button.
  #   Substituted into `{{1}}` of the URL when the template is submitted to Meta. Only
  #   meaningful when `url` contains `{{1}}`; ignored for static URLs.
  #
  #   @return [String, nil]
  optional :example, String

  # @!attribute otp_type
  #   Required when type is 'otp'. COPY_CODE shows copy button, ONE_TAP enables
  #   Android autofill.
  #
  #   @return [Symbol, Zavudev::Models::TemplateCreateParams::Button::OtpType, nil]
  optional :otp_type, enum: -> { Zavudev::TemplateCreateParams::Button::OtpType }, api_name: :otpType

  # @!attribute package_name
  #   Android package name. Required for ONE_TAP buttons.
  #
  #   @return [String, nil]
  optional :package_name, String, api_name: :packageName

  # @!attribute phone_number
  #
  #   @return [String, nil]
  optional :phone_number, String, api_name: :phoneNumber

  # @!attribute signature_hash
  #   Android app signature hash. Required for ONE_TAP buttons.
  #
  #   @return [String, nil]
  optional :signature_hash, String, api_name: :signatureHash

  # @!attribute text
  #   Button label. Required for every type except `request_contact_info`, whose label
  #   is fixed by WhatsApp.
  #
  #   @return [String, nil]
  optional :text, String

  # @!attribute url
  #   Button destination. Use `{{1}}` exactly once for a dynamic URL (e.g.
  #   `https://example.com/orders/{{1}}`); WhatsApp only accepts the strict `{{1}}`
  #   form. Static URLs must not contain any `{{...}}` placeholder.
  #
  #   @return [String, nil]
  optional :url, String

  # @!method initialize(type:, example: nil, otp_type: nil, package_name: nil, phone_number: nil, signature_hash: nil, text: nil, url: nil)
  #   Some parameter documentations has been truncated, see
  #   {Zavudev::Models::TemplateCreateParams::Button} for more details.
  #
  #   @param type [Symbol, Zavudev::Models::TemplateCreateParams::Button::Type] `request_contact_info` renders a fixed **Share Contact Info** button that asks t
  #
  #   @param example [String] Sample value Meta uses to review templates with a dynamic URL button. Substitute
  #
  #   @param otp_type [Symbol, Zavudev::Models::TemplateCreateParams::Button::OtpType] Required when type is 'otp'. COPY_CODE shows copy button, ONE_TAP enables Androi
  #
  #   @param package_name [String] Android package name. Required for ONE_TAP buttons.
  #
  #   @param phone_number [String]
  #
  #   @param signature_hash [String] Android app signature hash. Required for ONE_TAP buttons.
  #
  #   @param text [String] Button label. Required for every type except `request_contact_info`, whose label
  #
  #   @param url [String] Button destination. Use `{{1}}` exactly once for a dynamic URL (e.g. `https://ex

  # `request_contact_info` renders a fixed **Share Contact Info** button that asks
  # the recipient to share their phone number — useful when a contact adopted a
  # WhatsApp username and you only know their BSUID. It takes no other fields.
  #
  # @see Zavudev::Models::TemplateCreateParams::Button#type
  module Type
    extend Zavudev::Internal::Type::Enum

    QUICK_REPLY = :quick_reply
    URL = :url
    PHONE = :phone
    OTP = :otp
    REQUEST_CONTACT_INFO = :request_contact_info

    # @!method self.values
    #   @return [Array<Symbol>]
  end

  # Required when type is 'otp'. COPY_CODE shows copy button, ONE_TAP enables
  # Android autofill.
  #
  # @see Zavudev::Models::TemplateCreateParams::Button#otp_type
  module OtpType
    extend Zavudev::Internal::Type::Enum

    COPY_CODE = :COPY_CODE
    ONE_TAP = :ONE_TAP

    # @!method self.values
    #   @return [Array<Symbol>]
  end
end

Instance Attribute Details

#exampleString?

Sample value Meta uses to review templates with a dynamic URL button. Substituted into {{1}} of the URL when the template is submitted to Meta. Only meaningful when url contains {{1}}; ignored for static URLs.

Parameters:

  • (String)

Returns:

  • (String, nil)


139
# File 'lib/zavudev/models/template_create_params.rb', line 139

optional :example, String

#otp_typeSymbol, ...

Required when type is 'otp'. COPY_CODE shows copy button, ONE_TAP enables Android autofill.



146
# File 'lib/zavudev/models/template_create_params.rb', line 146

optional :otp_type, enum: -> { Zavudev::TemplateCreateParams::Button::OtpType }, api_name: :otpType

#package_nameString?

Android package name. Required for ONE_TAP buttons.

Parameters:

  • (String)

Returns:

  • (String, nil)


152
# File 'lib/zavudev/models/template_create_params.rb', line 152

optional :package_name, String, api_name: :packageName

#phone_numberString?

Parameters:

  • (String)

Returns:

  • (String, nil)


157
# File 'lib/zavudev/models/template_create_params.rb', line 157

optional :phone_number, String, api_name: :phoneNumber

#signature_hashString?

Android app signature hash. Required for ONE_TAP buttons.

Parameters:

  • (String)

Returns:

  • (String, nil)


163
# File 'lib/zavudev/models/template_create_params.rb', line 163

optional :signature_hash, String, api_name: :signatureHash

#textString?

Button label. Required for every type except request_contact_info, whose label is fixed by WhatsApp.

Parameters:

  • (String)

Returns:

  • (String, nil)


170
# File 'lib/zavudev/models/template_create_params.rb', line 170

optional :text, String

#typeSymbol, Zavudev::Models::TemplateCreateParams::Button::Type

request_contact_info renders a fixed Share Contact Info button that asks the recipient to share their phone number — useful when a contact adopted a WhatsApp username and you only know their BSUID. It takes no other fields.

Parameters:

  • value (Zavudev::Models::TemplateCreateParams::Button::type_)

Returns:



131
# File 'lib/zavudev/models/template_create_params.rb', line 131

required :type, enum: -> { Zavudev::TemplateCreateParams::Button::Type }

#urlString?

Button destination. Use {{1}} exactly once for a dynamic URL (e.g. https://example.com/orders/{{1}}); WhatsApp only accepts the strict {{1}} form. Static URLs must not contain any {{...}} placeholder.

Parameters:

  • (String)

Returns:

  • (String, nil)


178
# File 'lib/zavudev/models/template_create_params.rb', line 178

optional :url, String

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/zavudev/models/template_create_params.rb', line 214

Instance Method Details

#to_hash{

Returns:

  • ({)


174
# File 'sig/zavudev/models/template_create_params.rbs', line 174

def to_hash: -> {