pub struct PcsExternalClient<S: PcsExternalScopeSet> { /* private fields */ }Expand description
Phantom-typed gRPC client for the PCS External Developer Platform.
The type parameter S: PcsExternalScopeSet constrains which methods
are callable at compile time. Construct via crate::PcsExternalClientBuilder.
§Capability gating
| Method | Required capability |
|---|---|
send_alert | S: SendAlertCapable |
get_send_status | S: GetSendStatusCapable |
Calling a method your scope set doesn’t satisfy is a compile-time
E0277 — see crate::scopes for the compile_fail doctest.
Implementations§
Source§impl<S: SendAlertCapable> PcsExternalClient<S>
impl<S: SendAlertCapable> PcsExternalClient<S>
Sourcepub async fn send_alert(
&self,
template: &TemplateId,
recipients: &RecipientList,
poll: Option<&PollConfig>,
) -> Result<SendOutcome, Error>
pub async fn send_alert( &self, template: &TemplateId, recipients: &RecipientList, poll: Option<&PollConfig>, ) -> Result<SendOutcome, Error>
Send a batch of templated messages to recipients.
Translates to ExternalMessageService::CreateSendRequest.
§Errors
Error::TokenRefresh— JWT acquisition failed before the call.Error::Rejected— PCS rejected the request (bad template, quota, etc.).Error::ServerError— PCS 5xx, retry-eligible.Error::Transport— network-level failure.
Source§impl<S: GetSendStatusCapable> PcsExternalClient<S>
impl<S: GetSendStatusCapable> PcsExternalClient<S>
Sourcepub async fn get_send_status(
&self,
id: &SendRequestId,
) -> Result<SendStatus, Error>
pub async fn get_send_status( &self, id: &SendRequestId, ) -> Result<SendStatus, Error>
Poll aggregate delivery status for a previously-issued send request.
Translates to ExternalMessageService::GetSendRequestStatus.
§Errors
Same shape as PcsExternalClient::send_alert.
Sourcepub async fn stream_send_request_events(
&self,
send_request_id: Option<&SendRequestId>,
after_event_id: Option<&str>,
) -> Result<DeliveryStream, Error>
pub async fn stream_send_request_events( &self, send_request_id: Option<&SendRequestId>, after_event_id: Option<&str>, ) -> Result<DeliveryStream, Error>
Open a server-streaming delivery event channel.
Streams per-recipient lifecycle events for all send requests issued by
this app. Pass after_event_id to resume from a cursor after a
reconnect so no events are replayed.
§Errors
Returns crate::Error::TokenRefresh if the JWT cannot be acquired,
crate::Error::Rejected / crate::Error::Transport if the
initial RPC handshake fails. Stream-level errors surface through
DeliveryStream::message.
Trait Implementations§
Source§impl<S: PcsExternalScopeSet> Clone for PcsExternalClient<S>
impl<S: PcsExternalScopeSet> Clone for PcsExternalClient<S>
Auto Trait Implementations§
impl<S> Freeze for PcsExternalClient<S>
impl<S> !RefUnwindSafe for PcsExternalClient<S>
impl<S> Send for PcsExternalClient<S>
impl<S> Sync for PcsExternalClient<S>
impl<S> Unpin for PcsExternalClient<S>where
S: Unpin,
impl<S> UnsafeUnpin for PcsExternalClient<S>
impl<S> !UnwindSafe for PcsExternalClient<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request