pub struct BrazeClient { /* private fields */ }Expand description
Cheap-to-clone Braze API client. Internally Arc-shares the API key,
the rate limiter, and reqwest::Client’s connection pool, so cloning
for a parallel batch is essentially free.
Implementations§
Source§impl BrazeClient
impl BrazeClient
Sourcepub async fn list_catalogs(&self) -> Result<Vec<Catalog>, BrazeApiError>
pub async fn list_catalogs(&self) -> Result<Vec<Catalog>, BrazeApiError>
GET /catalogs — list every catalog schema in the workspace.
v0.1.0 sends a single request and returns the first page. Pagination handling is not yet implemented; workspaces with many catalogs may see truncated results.
Sourcepub async fn get_catalog(&self, name: &str) -> Result<Catalog, BrazeApiError>
pub async fn get_catalog(&self, name: &str) -> Result<Catalog, BrazeApiError>
GET /catalogs/{name} — fetch a single catalog schema.
404 from Braze and an empty catalogs array in the response are
both mapped to BrazeApiError::NotFound so callers can branch
on “this catalog doesn’t exist” without string matching on the
HTTP body.
Sourcepub async fn add_catalog_field(
&self,
catalog_name: &str,
field: &CatalogField,
) -> Result<(), BrazeApiError>
pub async fn add_catalog_field( &self, catalog_name: &str, field: &CatalogField, ) -> Result<(), BrazeApiError>
POST /catalogs/{name}/fields — add one field to a catalog schema.
ASSUMED wire format {"fields": [{"name": "...", "type": "..."}]}
per IMPLEMENTATION.md §8.3 + Braze public docs. v0.1.0 sends one
POST per added field.
Sourcepub async fn delete_catalog_field(
&self,
catalog_name: &str,
field_name: &str,
) -> Result<(), BrazeApiError>
pub async fn delete_catalog_field( &self, catalog_name: &str, field_name: &str, ) -> Result<(), BrazeApiError>
DELETE /catalogs/{name}/fields/{field} — remove a field. Destructive.
404 from Braze stays as Http { status: 404, .. } rather than
being mapped to NotFound. The use case is different from
get_catalog: a 404 here means “the field you wanted to delete is
already gone”, which is a state-drift signal the user should see
rather than silently no-op. A future --ignore-missing flag in
apply can opt into idempotent behavior.
Source§impl BrazeClient
impl BrazeClient
pub fn from_resolved(resolved: &ResolvedConfig) -> Self
pub fn new(base_url: Url, api_key: SecretString, rpm: u32) -> Self
Trait Implementations§
Source§impl Clone for BrazeClient
impl Clone for BrazeClient
Source§fn clone(&self) -> BrazeClient
fn clone(&self) -> BrazeClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more