Skip to main content

ProgramClient

Struct ProgramClient 

Source
pub struct ProgramClient {
    pub http_client: HttpClient,
}

Fields§

§http_client: HttpClient

Implementations§

Source§

impl ProgramClient

Source

pub fn new(config: ClientConfig) -> Result<Self, ApiError>

Source

pub async fn get_lp_list( &self, request: &GetLpListQueryRequest, options: Option<RequestOptions>, ) -> Result<GetLpListResponse, ApiError>

Returns list of loyalty programs

§Arguments
  • limit - Number of documents per page
  • offset - Index of the first document in the page
  • sort_field - Sort documents by field
  • sort - Sort order
  • options - Additional request options such as headers, timeout, etc.
§Returns

JSON response from the API

§Examples
use brevo_rust::prelude::*;

#[tokio::main]
async fn main() {
    let config = ClientConfig {
        api_key: Some("<value>".to_string()),
        ..Default::default()
    };
    let client = BrevoClient::new(config).expect("Failed to build client");
    client
        .program
        .get_lp_list(
            &GetLpListQueryRequest {
                ..Default::default()
            },
            None,
        )
        .await;
}
Source

pub async fn create_new_lp( &self, request: &CreateNewLpRequest, options: Option<RequestOptions>, ) -> Result<LoyaltyProgram, ApiError>

Creates loyalty program

§Arguments
  • options - Additional request options such as headers, timeout, etc.
§Returns

JSON response from the API

§Examples
use brevo_rust::prelude::*;

#[tokio::main]
async fn main() {
    let config = ClientConfig {
        api_key: Some("<value>".to_string()),
        ..Default::default()
    };
    let client = BrevoClient::new(config).expect("Failed to build client");
    client
        .program
        .create_new_lp(
            &CreateNewLpRequest {
                name: "name".to_string(),
                description: None,
                document_id: None,
                meta: None,
            },
            None,
        )
        .await;
}
Source

pub async fn get_loyalty_program_info( &self, pid: &str, options: Option<RequestOptions>, ) -> Result<LoyaltyProgram, ApiError>

Returns loyalty program

§Arguments
  • pid - Loyalty Program ID. A unique identifier for the loyalty program.
  • options - Additional request options such as headers, timeout, etc.
§Returns

JSON response from the API

§Examples
use brevo_rust::prelude::*;

#[tokio::main]
async fn main() {
    let config = ClientConfig {
        api_key: Some("<value>".to_string()),
        ..Default::default()
    };
    let client = BrevoClient::new(config).expect("Failed to build client");
    client
        .program
        .get_loyalty_program_info(&"pid".to_string(), None)
        .await;
}
Source

pub async fn update_loyalty_program( &self, pid: &str, request: &UpdateLoyaltyProgramRequest, options: Option<RequestOptions>, ) -> Result<LoyaltyProgram, ApiError>

Updates loyalty program

§Arguments
  • pid - Loyalty Program ID. A unique identifier for the loyalty program.
  • options - Additional request options such as headers, timeout, etc.
§Returns

JSON response from the API

§Examples
use brevo_rust::prelude::*;

#[tokio::main]
async fn main() {
    let config = ClientConfig {
        api_key: Some("<value>".to_string()),
        ..Default::default()
    };
    let client = BrevoClient::new(config).expect("Failed to build client");
    client
        .program
        .update_loyalty_program(
            &"pid".to_string(),
            &UpdateLoyaltyProgramRequest {
                name: "name".to_string(),
                description: None,
                meta: None,
            },
            None,
        )
        .await;
}
Source

pub async fn delete_loyalty_program( &self, pid: &str, options: Option<RequestOptions>, ) -> Result<(), ApiError>

Deletes Loyalty Program

§Arguments
  • pid - Loyalty Program ID. A unique identifier for the loyalty program.
  • options - Additional request options such as headers, timeout, etc.
§Returns

Empty response

§Examples
use brevo_rust::prelude::*;

#[tokio::main]
async fn main() {
    let config = ClientConfig {
        api_key: Some("<value>".to_string()),
        ..Default::default()
    };
    let client = BrevoClient::new(config).expect("Failed to build client");
    client
        .program
        .delete_loyalty_program(&"pid".to_string(), None)
        .await;
}
Source

pub async fn partially_update_loyalty_program( &self, pid: &str, request: &PartiallyUpdateLoyaltyProgramRequest, options: Option<RequestOptions>, ) -> Result<LoyaltyProgram, ApiError>

Partially updates loyalty program

§Arguments
  • pid - Loyalty Program ID. A unique identifier for the loyalty program.
  • options - Additional request options such as headers, timeout, etc.
§Returns

JSON response from the API

§Examples
use brevo_rust::prelude::*;

#[tokio::main]
async fn main() {
    let config = ClientConfig {
        api_key: Some("<value>".to_string()),
        ..Default::default()
    };
    let client = BrevoClient::new(config).expect("Failed to build client");
    client
        .program
        .partially_update_loyalty_program(
            &"pid".to_string(),
            &PartiallyUpdateLoyaltyProgramRequest {
                ..Default::default()
            },
            None,
        )
        .await;
}
Source

pub async fn get_parameter_subscription_info( &self, pid: &str, request: &GetParameterSubscriptionInfoQueryRequest, options: Option<RequestOptions>, ) -> Result<GetParameterSubscriptionInfoResponse, ApiError>

Get Information of balances, tiers, rewards and subscription members for a subscription

§Arguments
  • pid - Loyalty Program ID. A unique identifier for the loyalty program.
  • contact_id - The contact ID to filter by.
  • params - A list of filter parameters for querying the subscription info.
  • loyalty_subscription_id - The loyalty subscription ID to filter by.
  • include_internal - Include balances tied to internal definitions.
  • options - Additional request options such as headers, timeout, etc.
§Returns

JSON response from the API

§Examples
use brevo_rust::prelude::*;

#[tokio::main]
async fn main() {
    let config = ClientConfig {
        api_key: Some("<value>".to_string()),
        ..Default::default()
    };
    let client = BrevoClient::new(config).expect("Failed to build client");
    client
        .program
        .get_parameter_subscription_info(
            &"pid".to_string(),
            &GetParameterSubscriptionInfoQueryRequest {
                ..Default::default()
            },
            None,
        )
        .await;
}
Source

pub async fn delete_contact_subscription( &self, pid: &str, cid: i64, options: Option<RequestOptions>, ) -> Result<(), ApiError>

Delete subscription for a contact

§Arguments
  • pid - Loyalty Program ID. A unique identifier for the loyalty program.
  • cid - Contact ID.
  • options - Additional request options such as headers, timeout, etc.
§Returns

Empty response

§Examples
use brevo_rust::prelude::*;

#[tokio::main]
async fn main() {
    let config = ClientConfig {
        api_key: Some("<value>".to_string()),
        ..Default::default()
    };
    let client = BrevoClient::new(config).expect("Failed to build client");
    client
        .program
        .delete_contact_subscription(&"pid".to_string(), 1, None)
        .await;
}
Source

pub async fn publish_loyalty_program( &self, pid: &str, options: Option<RequestOptions>, ) -> Result<(), ApiError>

Publishes loyalty program

§Arguments
  • pid - Loyalty Program ID. A unique identifier for the loyalty program.
  • options - Additional request options such as headers, timeout, etc.
§Returns

Empty response

§Examples
use brevo_rust::prelude::*;

#[tokio::main]
async fn main() {
    let config = ClientConfig {
        api_key: Some("<value>".to_string()),
        ..Default::default()
    };
    let client = BrevoClient::new(config).expect("Failed to build client");
    client
        .program
        .publish_loyalty_program(&"pid".to_string(), None)
        .await;
}
Source

pub async fn subscribe_member_to_a_subscription( &self, pid: &str, request: &SubscribeMemberToASubscriptionRequest, options: Option<RequestOptions>, ) -> Result<SubscribeMemberToASubscriptionResponse, ApiError>

Add member to a subscription

§Arguments
  • pid - Loyalty Program ID. A unique identifier for the loyalty program.
  • options - Additional request options such as headers, timeout, etc.
§Returns

JSON response from the API

§Examples
use brevo_rust::prelude::*;

#[tokio::main]
async fn main() {
    let config = ClientConfig {
        api_key: Some("<value>".to_string()),
        ..Default::default()
    };
    let client = BrevoClient::new(config).expect("Failed to build client");
    client
        .program
        .subscribe_member_to_a_subscription(
            &"pid".to_string(),
            &SubscribeMemberToASubscriptionRequest {
                member_contact_ids: vec![1],
                contact_id: None,
                loyalty_subscription_id: None,
            },
            None,
        )
        .await;
}
Source

pub async fn delete_contact_members( &self, pid: &str, request: &DeleteContactMembersQueryRequest, options: Option<RequestOptions>, ) -> Result<(), ApiError>

Deletes member from a subscription

§Arguments
  • pid - Loyalty Program ID. A unique identifier for the loyalty program.
  • member_contact_ids - Comma-separated list of member contact IDs to delete from the subscription.
  • options - Additional request options such as headers, timeout, etc.
§Returns

Empty response

§Examples
use brevo_rust::prelude::*;

#[tokio::main]
async fn main() {
    let config = ClientConfig {
        api_key: Some("<value>".to_string()),
        ..Default::default()
    };
    let client = BrevoClient::new(config).expect("Failed to build client");
    client
        .program
        .delete_contact_members(
            &"pid".to_string(),
            &DeleteContactMembersQueryRequest {
                member_contact_ids: "memberContactIds".to_string(),
            },
            None,
        )
        .await;
}
Source

pub async fn subscribe_to_loyalty_program( &self, pid: &str, request: &SubscribeToLoyaltyProgramRequest, options: Option<RequestOptions>, ) -> Result<SubscribeToLoyaltyProgramResponse, ApiError>

Subscribes to a loyalty program

§Arguments
  • pid - Loyalty Program ID. A unique identifier for the loyalty program.
  • options - Additional request options such as headers, timeout, etc.
§Returns

JSON response from the API

§Examples
use brevo_rust::prelude::*;

#[tokio::main]
async fn main() {
    let config = ClientConfig {
        api_key: Some("<value>".to_string()),
        ..Default::default()
    };
    let client = BrevoClient::new(config).expect("Failed to build client");
    client
        .program
        .subscribe_to_loyalty_program(
            &"pid".to_string(),
            &SubscribeToLoyaltyProgramRequest {
                contact_id: 1000000,
                loyalty_subscription_id: None,
                creation_date: None,
                meta: None,
            },
            None,
        )
        .await;
}

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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