Class: Telnyx::Resources::Messaging10dlc::PartnerCampaigns

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/messaging_10dlc/partner_campaigns.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ PartnerCampaigns

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

Parameters:



145
146
147
# File 'lib/telnyx/resources/messaging_10dlc/partner_campaigns.rb', line 145

def initialize(client:)
  @client = client
end

Instance Method Details

#list(page: nil, records_per_page: nil, sort: nil, request_options: {}) ⇒ Telnyx::Internal::PerPagePaginationV2<Telnyx::Models::Messaging10dlc::TelnyxDownstreamCampaign>

Some parameter documentations has been truncated, see Models::Messaging10dlc::PartnerCampaignListParams for more details.

Retrieve all partner campaigns you have shared to Telnyx in a paginated fashion.

This endpoint is currently limited to only returning shared campaigns that Telnyx has accepted. In other words, shared but pending campaigns are currently omitted from the response from this endpoint.

Parameters:

  • page (Integer)

    The 1-indexed page number to get. The default value is ‘1`.

  • records_per_page (Integer)

    The amount of records per page, limited to between 1 and 500 inclusive. The defa

  • sort (Symbol, Telnyx::Models::Messaging10dlc::PartnerCampaignListParams::Sort)

    Specifies the sort order for results. If not given, results are sorted by create

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

Returns:

See Also:



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/telnyx/resources/messaging_10dlc/partner_campaigns.rb', line 75

def list(params = {})
  parsed, options = Telnyx::Messaging10dlc::PartnerCampaignListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "10dlc/partner_campaigns",
    query: query.transform_keys(records_per_page: "recordsPerPage"),
    page: Telnyx::Internal::PerPagePaginationV2,
    model: Telnyx::Messaging10dlc::TelnyxDownstreamCampaign,
    options: options
  )
end

#list_shared_by_me(page: nil, records_per_page: nil, request_options: {}) ⇒ Telnyx::Internal::PerPagePaginationV2<Telnyx::Models::Messaging10dlc::PartnerCampaignListSharedByMeResponse>

Some parameter documentations has been truncated, see Models::Messaging10dlc::PartnerCampaignListSharedByMeParams for more details.

Get all partner campaigns you have shared to Telnyx in a paginated fashion

This endpoint is currently limited to only returning shared campaigns that Telnyx has accepted. In other words, shared but pending campaigns are currently omitted from the response from this endpoint.

Parameters:

  • page (Integer)

    The 1-indexed page number to get. The default value is ‘1`.

  • records_per_page (Integer)

    The amount of records per page, limited to between 1 and 500 inclusive. The defa

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

Returns:

See Also:



109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/telnyx/resources/messaging_10dlc/partner_campaigns.rb', line 109

def list_shared_by_me(params = {})
  parsed, options = Telnyx::Messaging10dlc::PartnerCampaignListSharedByMeParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "10dlc/partnerCampaign/sharedByMe",
    query: query.transform_keys(records_per_page: "recordsPerPage"),
    page: Telnyx::Internal::PerPagePaginationV2,
    model: Telnyx::Models::Messaging10dlc::PartnerCampaignListSharedByMeResponse,
    options: options
  )
end

#retrieve(campaign_id, request_options: {}) ⇒ Telnyx::Models::Messaging10dlc::TelnyxDownstreamCampaign

Retrieve campaign details by ‘campaignId`.

Parameters:

Returns:

See Also:



17
18
19
20
21
22
23
24
# File 'lib/telnyx/resources/messaging_10dlc/partner_campaigns.rb', line 17

def retrieve(campaign_id, params = {})
  @client.request(
    method: :get,
    path: ["10dlc/partner_campaigns/%1$s", campaign_id],
    model: Telnyx::Messaging10dlc::TelnyxDownstreamCampaign,
    options: params[:request_options]
  )
end

#retrieve_sharing_status(campaign_id, request_options: {}) ⇒ Hash{Symbol=>Telnyx::Models::Messaging10dlc::CampaignSharingStatus}

Get Sharing Status

Parameters:

  • campaign_id (String)

    ID of the campaign in question

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

Returns:

See Also:



133
134
135
136
137
138
139
140
# File 'lib/telnyx/resources/messaging_10dlc/partner_campaigns.rb', line 133

def retrieve_sharing_status(campaign_id, params = {})
  @client.request(
    method: :get,
    path: ["10dlc/partnerCampaign/%1$s/sharing", campaign_id],
    model: Telnyx::Internal::Type::HashOf[Telnyx::Messaging10dlc::CampaignSharingStatus],
    options: params[:request_options]
  )
end

#update(campaign_id, webhook_failover_url: nil, webhook_url: nil, request_options: {}) ⇒ Telnyx::Models::Messaging10dlc::TelnyxDownstreamCampaign

Update campaign details by ‘campaignId`. **Please note:** Only webhook urls are editable.

Parameters:

  • campaign_id (String)
  • webhook_failover_url (String)

    Webhook failover to which campaign status updates are sent.

  • webhook_url (String)

    Webhook to which campaign status updates are sent.

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

Returns:

See Also:



42
43
44
45
46
47
48
49
50
51
# File 'lib/telnyx/resources/messaging_10dlc/partner_campaigns.rb', line 42

def update(campaign_id, params = {})
  parsed, options = Telnyx::Messaging10dlc::PartnerCampaignUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["10dlc/partner_campaigns/%1$s", campaign_id],
    body: parsed,
    model: Telnyx::Messaging10dlc::TelnyxDownstreamCampaign,
    options: options
  )
end