Skip to main content

Crate pcs_external

Crate pcs_external 

Source
Expand description

PCS External API client for Ppoppo Chat System.

Provides a domain-typed gRPC client for the PCS External Developer Platform (chat.external package).

§Hot path (v0.2.0+)

Most consumers want pcs_port::GrpcPcsAdapter — a port abstraction that hides tonic/prost types behind two domain-typed methods (send_alert, get_send_status) plus an explicit escape hatch (pcs_port::RawPcsChannel) for the long tail of admin / template / polling RPCs.

use pcs_external::pcs_port::{
    GrpcPcsAdapter, PcsExternalPort, RecipientList, Ppnum, TemplateId,
};

let pcs = GrpcPcsAdapter::from_env().await?;
let recipients = RecipientList::from_ppnums(vec![
    Ppnum::try_new("12345678901").map_err(|e| pcs_external::Error::External(e.to_string()))?,
])
.map_err(|e| pcs_external::Error::External(e.to_string()))?;
let _ = pcs
    .send_alert(&TemplateId::new("tmpl_attendance_v1"), &recipients, None)
    .await;

§Tests

Behind test-support, [pcs_port::MemoryPcsExternal] is an in-process fake of pcs_port::PcsExternalPort suitable for consumer-side integration tests without a live PCS endpoint.

§Legacy surface

connect, auth_request, ExternalChannel remain available for v0.1.0 consumers and for the pcs_port::RawPcsChannel escape hatch. The free connect / auth_request entry points are marked #[deprecated] and slated for removal in v0.3.0.

Re-exports§

pub use error::Error;
pub use external::ExternalChannel;
pub use external::auth_request;
pub use external::connect;Deprecated
pub use prost_types;
pub use tonic;

Modules§

error
external
gRPC client for PCS External API.
pcs_port
PCS External network-boundary port.