Class: Telnyx::Resources::Whatsapp::PhoneNumbers::Profile::Photo

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/whatsapp/phone_numbers/profile/photo.rb

Overview

Manage Whatsapp phone numbers

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Photo

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Photo.

Parameters:



78
79
80
# File 'lib/telnyx/resources/whatsapp/phone_numbers/profile/photo.rb', line 78

def initialize(client:)
  @client = client
end

Instance Method Details

#delete(phone_number, request_options: {}) ⇒ nil

Delete Whatsapp profile photo

Parameters:

  • phone_number (String)

    Phone number (E.164 format)

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



41
42
43
44
45
46
47
48
# File 'lib/telnyx/resources/whatsapp/phone_numbers/profile/photo.rb', line 41

def delete(phone_number, params = {})
  @client.request(
    method: :delete,
    path: ["v2/whatsapp/phone_numbers/%1$s/profile/photo", phone_number],
    model: NilClass,
    options: params[:request_options]
  )
end

#retrieve(phone_number, request_options: {}) ⇒ Telnyx::Models::Whatsapp::PhoneNumbers::Profile::PhotoRetrieveResponse

Get Whatsapp profile photo

Parameters:

  • phone_number (String)

    Phone number (E.164 format)

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



21
22
23
24
25
26
27
28
# File 'lib/telnyx/resources/whatsapp/phone_numbers/profile/photo.rb', line 21

def retrieve(phone_number, params = {})
  @client.request(
    method: :get,
    path: ["v2/whatsapp/phone_numbers/%1$s/profile/photo", phone_number],
    model: Telnyx::Models::Whatsapp::PhoneNumbers::Profile::PhotoRetrieveResponse,
    options: params[:request_options]
  )
end

#upload(phone_number, file:, request_options: {}) ⇒ Telnyx::Models::Whatsapp::PhoneNumbers::Profile::PhotoUploadResponse

Upload Whatsapp profile photo

Parameters:

  • phone_number (String)

    Phone number (E.164 format)

  • file (Pathname, StringIO, IO, String, Telnyx::FilePart)

    Image file (JPEG recommended, max 10 MB)

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/telnyx/resources/whatsapp/phone_numbers/profile/photo.rb', line 63

def upload(phone_number, params)
  parsed, options = Telnyx::Whatsapp::PhoneNumbers::Profile::PhotoUploadParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v2/whatsapp/phone_numbers/%1$s/profile/photo", phone_number],
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: Telnyx::Models::Whatsapp::PhoneNumbers::Profile::PhotoUploadResponse,
    options: options
  )
end