pcs-external 0.3.0

Ppoppo Chat System (PCS) External API client -- gRPC client for the External Developer Platform
Documentation
//! PCS External API client — `v0.3.0`.
//!
//! Phantom-typed gRPC client for the PCS External Developer Platform
//! (`chat.external` package). OAuth2 JWT auth is built-in via
//! `ppoppo-sdk-core`'s `TokenCache` + `AuthInterceptor`.
//!
//! ## Quick start
//!
//! ```no_run
//! # async fn example() -> Result<(), pcs_external::Error> {
//! use pcs_external::{PcsExternalClientBuilder, scopes::SendOnly};
//! use pcs_external::types::{Ppnum, RecipientList, TemplateId};
//!
//! // Build a send-only client from environment variables.
//! let client = PcsExternalClientBuilder::from_env()
//!     .ok_or_else(|| pcs_external::Error::Transport("missing env vars".into()))?
//!     .build::<SendOnly>()
//!     .await?;
//!
//! let recipients = RecipientList::from_ppnums(vec![
//!     Ppnum::try_new("12345678901").map_err(|e| pcs_external::Error::Transport(e.to_string()))?,
//! ])
//! .map_err(|e| pcs_external::Error::Transport(e.to_string()))?;
//!
//! let outcome = client.send_alert(&TemplateId::new("tmpl_v1"), &recipients, None).await?;
//! println!("queued: {:?}", outcome.id);
//! # Ok(())
//! # }
//! ```
//!
//! ## Scope sets
//!
//! Construct the client with the scope set that matches your OAuth2 grant.
//! Method availability is enforced at compile time:
//!
//! | Scope set | `send_alert` | `get_send_status` |
//! |---|:---:|:---:|
//! | `ReadOnly` | — | ✓ |
//! | `SendOnly` | ✓ | — |
//! | `ReadAndSend` | ✓ | ✓ |
//! | `FullAccess` | ✓ | ✓ |

#![deny(rust_2018_idioms)]

mod builder;
mod client;
mod error;
mod proto;
pub mod scopes;
#[cfg(feature = "test-support")]
pub mod test_support;
mod transport;
pub mod types;

pub use builder::PcsExternalClientBuilder;
pub use client::PcsExternalClient;
pub use error::Error;
pub use prost_types;
pub use tonic;