Class: Telnyx::Resources::PhoneNumbers::CsvDownloads

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/phone_numbers/csv_downloads.rb,
sig/telnyx/resources/phone_numbers/csv_downloads.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ CsvDownloads

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 CsvDownloads.

Parameters:



86
87
88
# File 'lib/telnyx/resources/phone_numbers/csv_downloads.rb', line 86

def initialize(client:)
  @client = client
end

Instance Method Details

#create(csv_format: nil, filter: nil, request_options: {}) ⇒ Telnyx::Models::PhoneNumbers::CsvDownloadCreateResponse

Some parameter documentations has been truncated, see Models::PhoneNumbers::CsvDownloadCreateParams for more details.

Starts generation of a CSV export for phone numbers matching the supplied filters. The csv_format parameter selects the output format, and the response contains the resulting download record.

Parameters:

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/telnyx/resources/phone_numbers/csv_downloads.rb', line 25

def create(params = {})
  parsed, options = Telnyx::PhoneNumbers::CsvDownloadCreateParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :post,
    path: "phone_numbers/csv_downloads",
    query: query,
    model: Telnyx::Models::PhoneNumbers::CsvDownloadCreateResponse,
    options: options
  )
end

#list(page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::PhoneNumbers::CsvDownload>

Returns CSV export jobs created for account phone numbers, including each export's current status and pagination metadata.

Parameters:

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

Returns:

See Also:



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/telnyx/resources/phone_numbers/csv_downloads.rb', line 70

def list(params = {})
  parsed, options = Telnyx::PhoneNumbers::CsvDownloadListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "phone_numbers/csv_downloads",
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::PhoneNumbers::CsvDownload,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Telnyx::Models::PhoneNumbers::CsvDownloadRetrieveResponse

Returns the current status and download details for the CSV export identified by id.

Parameters:

  • id (String)

    Identifies the CSV download.

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

Returns:

See Also:



49
50
51
52
53
54
55
56
# File 'lib/telnyx/resources/phone_numbers/csv_downloads.rb', line 49

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["phone_numbers/csv_downloads/%1$s", id],
    model: Telnyx::Models::PhoneNumbers::CsvDownloadRetrieveResponse,
    options: params[:request_options]
  )
end