Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

An API client for Orb.

The API client is designed to be wrapped in an Arc and used from multiple threads simultaneously.

Implementations§

Source§

impl Client

Source

pub fn list_customers( &self, params: &ListParams, ) -> impl Stream<Item = Result<Customer, Error>> + '_

Lists all customers.

The underlying API call is paginated. The returned stream will fetch additional pages as it is consumed.

Source

pub async fn create_customer( &self, customer: &CreateCustomerRequest<'_>, ) -> Result<Customer, Error>

Creates a new customer.

Source

pub async fn get_customer(&self, id: &str) -> Result<Customer, Error>

Gets a customer by ID.

Source

pub async fn get_customer_by_external_id( &self, external_id: &str, ) -> Result<Customer, Error>

Gets a customer by external ID.

Source

pub async fn update_customer( &self, id: &str, customer: &UpdateCustomerRequest<'_>, ) -> Result<Customer, Error>

Updates a customer by ID.

Source

pub async fn update_customer_by_external_id( &self, external_id: &str, customer: &UpdateCustomerRequest<'_>, ) -> Result<Customer, Error>

Updates a customer by external ID.

Source

pub async fn delete_customer(&self, id: &str) -> Result<(), Error>

Deletes a customer by ID.

Source

pub fn get_customer_credit_balance( &self, id: &str, params: &ListParams, ) -> impl Stream<Item = Result<CustomerCreditBlock, Error>> + '_

Fetch all unexpired, non-zero credit blocks for a customer.

The underlying API call is paginated. The returned stream will fetch additional pages as it is consumed.

Source

pub fn get_customer_credit_balance_by_external_id( &self, external_id: &str, params: &ListParams, ) -> impl Stream<Item = Result<CustomerCreditBlock, Error>> + '_

Fetch all unexpired, non-zero credit blocks for a customer by external ID.

The underlying API call is paginated. The returned stream will fetch additional pages as it is consumed.

Source

pub async fn create_ledger_entry( &self, id: &str, entry: &LedgerEntryRequest<'_>, ) -> Result<LedgerEntry, Error>

Create a new ledger entry for the specified customer’s balance.

Source

pub async fn get_customer_costs( &self, id: &str, params: &CustomerCostParams<'_>, ) -> Result<Vec<CustomerCostBucket>, Error>

Fetch a day-by-day snapshot of a customer’s costs.

Source

pub async fn get_customer_costs_by_external_id( &self, external_id: &str, params: &CustomerCostParams<'_>, ) -> Result<Vec<CustomerCostBucket>, Error>

Fetch a day-by-day snapshot of a customer’s costs by their external ID.

Source§

impl Client

Source

pub fn search_events( &self, params: &EventSearchParams<'_>, ) -> impl Stream<Item = Result<Event, Error>> + '_

Searches events.

Source

pub async fn ingest_events( &self, mode: IngestionMode, events: &[IngestEventRequest<'_>], ) -> Result<IngestEventResponse, Error>

Ingests events.

Source

pub async fn amend_event( &self, id: &str, event: &AmendEventRequest<'_>, ) -> Result<(), Error>

Amends an event by ID.

Source

pub async fn deprecate_event(&self, id: &str) -> Result<(), Error>

Deprecates an event by ID.

Source§

impl Client

Source

pub fn list_invoices( &self, params: &InvoiceListParams<'_>, ) -> impl Stream<Item = Result<Invoice, Error>> + '_

Lists invoices as configured by params.

The underlying API call is paginated. The returned stream will fetch additional pages as it is consumed.

Source

pub async fn get_invoice(&self, id: &str) -> Result<Invoice, Error>

Gets an invoice by ID.

Source§

impl Client

Source

pub fn list_plans( &self, params: &ListParams, ) -> impl Stream<Item = Result<Plan, Error>> + '_

Lists all plans.

The underlying API call is paginated. The returned stream will fetch additional pages as it is consumed.

Source

pub async fn get_plan(&self, id: &str) -> Result<Plan, Error>

Gets a plan by ID.

Source

pub async fn get_plan_by_external_id( &self, external_id: &str, ) -> Result<Plan, Error>

Gets a plan by external ID.

Source§

impl Client

Source

pub fn list_subscriptions( &self, params: &SubscriptionListParams<'_>, ) -> impl Stream<Item = Result<Subscription, Error>> + '_

Lists subscriptions as configured by params.

The underlying API call is paginated. The returned stream will fetch additional pages as it is consumed.

Source

pub async fn create_subscription( &self, subscription: &CreateSubscriptionRequest<'_>, ) -> Result<Subscription, Error>

Creates a new subscription.

Source

pub async fn get_subscription(&self, id: &str) -> Result<Subscription, Error>

Gets a subscription by ID.

Source§

impl Client

Source

pub fn new(config: ClientConfig) -> Client

Creates a new Client from its required configuration parameters.

Source

pub fn builder() -> ClientBuilder

Creates a builder for a Client that allows for customization of optional parameters.

Trait Implementations§

Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

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