notra
Unofficial Rust SDK for the Notra API.
Installation
Add to your Cargo.toml:
[]
= "0.1"
= { = "1", = ["full"] }
Quick Start
use Notra;
use ;
async
Usage
Client Configuration
use Duration;
use Notra;
let notra = builder
.bearer_auth
.server_url // optional, this is the default
.timeout // optional, defaults to 30s
.build?;
Posts
use *;
// List posts with filters
let posts = notra.content
.list_posts
.status
.content_type
.sort
.limit
.page
.send
.await?;
// Get a single post
let post = notra.content
.get_post
.send
.await?;
// Update a post
let updated = notra.content
.update_post
.title
.markdown
.status
.slug
.send
.await?;
// Delete a post
notra.content
.delete_post
.send
.await?;
Post Generation
Generate posts from your connected GitHub repositories and Linear integrations:
use *;
// Start a generation job
let job = notra.content
.create_post_generation
.lookback_window
.brand_identity_id
.github_integration_ids
.repositories
.data_points
.send
.await?;
println!;
// Poll for completion
let status = notra.content
.get_post_generation
.send
.await?;
println!;
Brand Identities
use *;
// List brand identities
let identities = notra.content
.list_brand_identities
.send
.await?;
// Generate a brand identity from a website
let job = notra.content
.create_brand_identity
.name
.send
.await?;
// Check generation progress
let status = notra.content
.get_brand_identity_generation
.send
.await?;
// Get a brand identity
let identity = notra.content
.get_brand_identity
.send
.await?;
// Update a brand identity
let updated = notra.content
.update_brand_identity
.name
.tone_profile
.language
.audience
.is_default
.send
.await?;
// Delete a brand identity
notra.content
.delete_brand_identity
.send
.await?;
Integrations
// List all integrations
let integrations = notra.content
.list_integrations
.send
.await?;
for gh in &integrations.github
// Connect a GitHub repository
let gh = notra.content
.create_github_integration
.branch
.send
.await?;
// Disconnect an integration
notra.content
.delete_integration
.send
.await?;
Error Handling
All methods return Result<T, NotraError>. The error type covers HTTP errors, API errors, and client misconfiguration:
use NotraError;
match notra.content.get_post.send.await
API Reference
All operations are accessible through notra.content():
| Method | HTTP | Description |
|---|---|---|
list_posts() |
GET /v1/posts |
List posts with optional filters |
get_post(id) |
GET /v1/posts/{id} |
Get a single post |
update_post(id) |
PATCH /v1/posts/{id} |
Update a post |
delete_post(id) |
DELETE /v1/posts/{id} |
Delete a post |
create_post_generation(type) |
POST /v1/posts/generate |
Start AI post generation |
get_post_generation(job_id) |
GET /v1/posts/generate/{id} |
Check generation status |
list_brand_identities() |
GET /v1/brand-identities |
List brand identities |
get_brand_identity(id) |
GET /v1/brand-identities/{id} |
Get a brand identity |
create_brand_identity(url) |
POST /v1/brand-identities/generate |
Generate brand identity from website |
get_brand_identity_generation(job_id) |
GET /v1/brand-identities/generate/{id} |
Check generation status |
update_brand_identity(id) |
PATCH /v1/brand-identities/{id} |
Update a brand identity |
delete_brand_identity(id) |
DELETE /v1/brand-identities/{id} |
Delete a brand identity |
list_integrations() |
GET /v1/integrations |
List connected integrations |
create_github_integration(owner, repo) |
POST /v1/integrations/github |
Connect a GitHub repo |
delete_integration(id) |
DELETE /v1/integrations/{id} |
Disconnect an integration |
Disclaimer
This is an unofficial, community-maintained SDK and is not affiliated with or endorsed by Notra. Use at your own discretion.
License
MIT