Struct CampaignsApi

Source
pub struct CampaignsApi {
    pub client: Client,
}

Fields§

§client: Client

Implementations§

Source§

impl CampaignsApi

Source

pub async fn get_campaigns( &self, limit: i64, offset: i64, ) -> Result<Response<GetCampaignsResponse>, ClientError>

Retrieve all Campaigns.

This function performs a GET to the /campaigns endpoint.

This endpoint allows you to retrieve a list of all of your campaigns.

Returns campaigns in reverse order they were created (newest first).

Returns an empty array if no campaigns exist.

Parameters:

  • limit: i64 – The number of results you would like to receive at a time.
  • offset: i64 – The index of the first campaign to return, where 0 is the first campaign.
  • on_behalf_of: &str – The license key provided with your New Relic account.
Source

pub async fn post_campaign( &self, body: &CampaignsRequest, ) -> Result<Response<CampaignResponseAllOf>, ClientError>

Create a Campaign.

This function performs a POST to the /campaigns endpoint.

This endpoint allows you to create a campaign.

In order to send or schedule the campaign, you will be required to provide a subject, sender ID, content (we suggest both html and plain text), and at least one list or segment ID. This information is not required when you create a campaign.

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.
Source

pub async fn get_campaigns_campaign( &self, campaign_id: i64, ) -> Result<Response<GetCampaignsCampaignResponse>, ClientError>

Retrieve a single campaign.

This function performs a GET to the /campaigns/{campaign_id} endpoint.

This endpoint allows you to retrieve a specific campaign.

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.
Source

pub async fn delete_campaigns_campaign( &self, campaign_id: i64, ) -> Result<Response<()>, ClientError>

Delete a Campaign.

This function performs a DELETE to the /campaigns/{campaign_id} endpoint.

This endpoint allows you to delete a specific campaign.

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.
Source

pub async fn patch_campaigns_campaign( &self, campaign_id: i64, body: &UpdateACampaignRequest, ) -> Result<Response<CampaignResponseAllOf>, ClientError>

Update a Campaign.

This function performs a PATCH to the /campaigns/{campaign_id} endpoint.

This endpoint allows you to update a specific campaign.

This is especially useful if you only set up the campaign using POST /campaigns, but didn’t set many of the parameters.

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.
Source

pub async fn post_campaigns_campaign_schedules_now( &self, campaign_id: i64, ) -> Result<Response<SendACampaignResponse>, ClientError>

Send a Campaign.

This function performs a POST to the /campaigns/{campaign_id}/schedules/now endpoint.

This endpoint allows you to immediately send an existing campaign.

Normally a POST request would have a body, but since this endpoint is telling us to send a resource that is already created, a request body is not needed.

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.
Source

pub async fn get_campaigns_campaign_schedule( &self, campaign_id: i64, ) -> Result<Response<ScheduleACampaignRequest>, ClientError>

View Scheduled Time of a Campaign.

This function performs a GET to the /campaigns/{campaign_id}/schedules endpoint.

This endpoint allows you to retrieve the date and time that a campaign has been scheduled to be sent.

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.
Source

pub async fn post_campaigns_campaign_schedule( &self, campaign_id: i64, body: &ScheduleACampaignRequest, ) -> Result<Response<ScheduleACampaignResponse>, ClientError>

Schedule a Campaign.

This function performs a POST to the /campaigns/{campaign_id}/schedules endpoint.

This endpoint allows you to schedule a specific date and time for your campaign to be sent.

If you have the flexibility, it’s better to schedule mail for off-peak times. Most emails are scheduled and sent at the top of the hour or half hour. Scheduling email to avoid those times (for example, scheduling at 10:53) can result in lower deferral rates because it won’t be going through our servers at the same times as everyone else’s mail.

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.
Source

pub async fn delete_campaigns_campaign_schedules( &self, campaign_id: i64, ) -> Result<Response<()>, ClientError>

Unschedule a Scheduled Campaign.

This function performs a DELETE to the /campaigns/{campaign_id}/schedules endpoint.

This endpoint allows you to unschedule a campaign that has already been scheduled to be sent.

A successful unschedule will return a 204. If the specified campaign is in the process of being sent, the only option is to cancel (a different method).

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.
Source

pub async fn patch_campaigns_campaign_schedules( &self, campaign_id: i64, body: &ScheduleACampaignRequest, ) -> Result<Response<UpdateAScheduledCampaignResponse>, ClientError>

Update a Scheduled Campaign.

This function performs a PATCH to the /campaigns/{campaign_id}/schedules endpoint.

This endpoint allows to you change the scheduled time and date for a campaign to be sent.

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.
Source

pub async fn post_campaigns_campaign_schedules_test( &self, campaign_id: i64, body: &SendATestCampaignRequest, ) -> Result<Response<SendATestCampaignRequest>, ClientError>

Send a Test Campaign.

This function performs a POST to the /campaigns/{campaign_id}/schedules/test endpoint.

This endpoint allows you to send a test campaign.

To send to multiple addresses, use an array for the JSON “to” value [“one@address”,“two@address”]

Parameters:

  • on_behalf_of: &str – The license key provided with your New Relic account.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,