Skip to main content

Module external

Module external 

Source
Expand description

gRPC client for PCS External API.

§Usage

use pcs_external::external::{connect, auth_request};
use pcs_external::external::proto::{
    external_channel_service_client::ExternalChannelServiceClient,
    ExtCreateChannelReq, ExtChannelType, ExtStorageMode,
};

let channel = connect("http://localhost:3203").await?;
let mut client = ExternalChannelServiceClient::new(channel);

let req = auth_request("pk_live_abc123", ExtCreateChannelReq {
    name: "test.ctx".into(),
    r#type: ExtChannelType::Group.into(),
    storage_mode: ExtStorageMode::Buffered.into(),
    ..Default::default()
})?;
let _resp = client.create_channel(req).await;

Modules§

proto
Generated gRPC types from chat.external proto definition.

Structs§

ExternalChannel
A gRPC channel that prepends an optional path prefix to all requests.

Functions§

auth_request
Wrap a request body with Bearer API key authentication metadata.
connect
Connect to the PCS External API with automatic TLS and path prefix support.