Struct leanpub::Client [−][src]
pub struct Client { /* fields omitted */ }
The Leanpub API client.
Methods
impl Client
[src]
impl Client
pub fn new(api_key: Option<&str>) -> Self
[src]
pub fn new(api_key: Option<&str>) -> Self
Creates a new client for a specific slug. The API key is optional but required when interacting with API endpoints that requires an authenticated user.
pub fn get_summary(&self, slug: &str) -> Result<Summary, Error>
[src]
pub fn get_summary(&self, slug: &str) -> Result<Summary, Error>
Gets the books summary information.
Note
This does not require authentication. If you do provide an API key, and you are an author of the book, then we will also give you the total copies sold and revenue for the book, as well as the URLs for downloading the current preview and published version of your book in epub, pdf and mobi formats.
pub fn download_preview(
&self,
slug: &str,
file_path: &Path,
format: PreviewFormat
) -> Result<(), Error>
[src]
pub fn download_preview(
&self,
slug: &str,
file_path: &Path,
format: PreviewFormat
) -> Result<(), Error>
Downloads the latest preview in the specified format.