notra 0.1.1

Unofficial Rust SDK for the Notra API
Documentation
mod brand_identities;
mod integrations;
mod posts;

pub use brand_identities::*;
pub use integrations::*;
pub use posts::*;

use crate::client::Notra;

pub struct Content<'a> {
    pub(crate) client: &'a Notra,
}

impl<'a> Content<'a> {
    pub(crate) fn new(client: &'a Notra) -> Self {
        Self { client }
    }

    // Posts

    pub fn list_posts(&self) -> ListPostsBuilder<'a> {
        ListPostsBuilder::new(self.client)
    }

    pub fn get_post(&self, post_id: impl Into<String>) -> GetPostBuilder<'a> {
        GetPostBuilder::new(self.client, post_id)
    }

    pub fn create_post_generation(
        &self,
        content_type: crate::models::ContentType,
    ) -> CreatePostGenerationBuilder<'a> {
        CreatePostGenerationBuilder::new(self.client, content_type)
    }

    pub fn get_post_generation(&self, job_id: impl Into<String>) -> GetPostGenerationBuilder<'a> {
        GetPostGenerationBuilder::new(self.client, job_id)
    }

    pub fn update_post(&self, post_id: impl Into<String>) -> UpdatePostBuilder<'a> {
        UpdatePostBuilder::new(self.client, post_id)
    }

    pub fn delete_post(&self, post_id: impl Into<String>) -> DeletePostBuilder<'a> {
        DeletePostBuilder::new(self.client, post_id)
    }

    // Brand Identities

    pub fn list_brand_identities(&self) -> ListBrandIdentitiesBuilder<'a> {
        ListBrandIdentitiesBuilder::new(self.client)
    }

    pub fn create_brand_identity(
        &self,
        website_url: impl Into<String>,
    ) -> CreateBrandIdentityBuilder<'a> {
        CreateBrandIdentityBuilder::new(self.client, website_url)
    }

    pub fn get_brand_identity_generation(
        &self,
        job_id: impl Into<String>,
    ) -> GetBrandIdentityGenerationBuilder<'a> {
        GetBrandIdentityGenerationBuilder::new(self.client, job_id)
    }

    pub fn get_brand_identity(
        &self,
        brand_identity_id: impl Into<String>,
    ) -> GetBrandIdentityBuilder<'a> {
        GetBrandIdentityBuilder::new(self.client, brand_identity_id)
    }

    pub fn update_brand_identity(
        &self,
        brand_identity_id: impl Into<String>,
    ) -> UpdateBrandIdentityBuilder<'a> {
        UpdateBrandIdentityBuilder::new(self.client, brand_identity_id)
    }

    pub fn delete_brand_identity(
        &self,
        brand_identity_id: impl Into<String>,
    ) -> DeleteBrandIdentityBuilder<'a> {
        DeleteBrandIdentityBuilder::new(self.client, brand_identity_id)
    }

    // Integrations

    pub fn list_integrations(&self) -> ListIntegrationsBuilder<'a> {
        ListIntegrationsBuilder::new(self.client)
    }

    pub fn create_github_integration(
        &self,
        owner: impl Into<String>,
        repo: impl Into<String>,
    ) -> CreateGithubIntegrationBuilder<'a> {
        CreateGithubIntegrationBuilder::new(self.client, owner, repo)
    }

    pub fn delete_integration(
        &self,
        integration_id: impl Into<String>,
    ) -> DeleteIntegrationBuilder<'a> {
        DeleteIntegrationBuilder::new(self.client, integration_id)
    }
}