| Crates.io | libtelegraph_rs |
| lib.rs | libtelegraph_rs |
| version | 0.1.1 |
| created_at | 2025-08-12 06:51:27.656889+00 |
| updated_at | 2025-08-12 06:51:27.656889+00 |
| description | A Rust wrapper for the Telegraph API |
| homepage | |
| repository | https://github.com/Junaid433/telegraph_rs |
| max_upload_size | |
| id | 1791517 |
| size | 67,130 |
A Rust wrapper for the Telegraph API. This library provides a simple and easy-to-use interface for interacting with Telegraph.
reqwest.Add the following to your Cargo.toml file:
[dependencies]
libtelegraph_rs = "0.1.0"
To get started, create a new TelegraphClient:
use telegraph_rs::TelegraphClient;
let client = TelegraphClient::new();
create_accountCreates a new Telegraph account.
Parameters:
short_name (required): Account name, displayed on the user's profile page.author_name (optional): Default author name used when creating new articles.author_url (optional): Default author URL used when creating new articles.Example:
use telegraph_rs::TelegraphClient;
let client = TelegraphClient::new();
let account = client.create_account(
"my-short-name",
Some("My Author Name"),
Some("https://example.com"),
);
match account {
Ok(acc) => println!("Account created: {:?}", acc),
Err(err) => eprintln!("Error creating account: {}", err),
}
edit_account_infoUpdates the information of an existing Telegraph account.
Parameters:
access_token (required): Access token of the account to edit.short_name (optional): New account name.author_name (optional): New default author name.author_url (optional): New default author URL.get_account_infoGets information about a Telegraph account.
Parameters:
access_token (required): Access token of the account.fields (optional): A list of fields to return. Available fields: short_name, author_name, author_url, auth_url, page_count.revoke_access_tokenRevokes the access token of a Telegraph account, logging out the user.
Parameters:
access_token (required): Access token to revoke.create_pageCreates a new Telegraph page.
Parameters:
access_token (required): Access token of the account.title (required): Page title.author_name (optional): Author name, displayed on the page.author_url (optional): URL to be opened when the author name is clicked.content (required): Content of the page, as a JSON-serialized array of Node objects.return_content (optional): If true, the created page will be returned in the response.edit_pageEdits an existing Telegraph page.
Parameters:
access_token (required): Access token of the account.path (required): Path to the page to edit.title (required): New page title.author_name (optional): New author name.author_url (optional): New author URL.content (required): New content of the page.return_content (optional): If true, the edited page will be returned in the response.get_pageGets a Telegraph page.
Parameters:
path (required): Path to the page.return_content (optional): If true, the page content will be returned in the response.get_page_listGets a list of pages belonging to a Telegraph account.
Parameters:
access_token (required): Access token of the account.offset (optional): Sequential number of the first page to be returned.limit (optional): Number of pages to be returned.get_viewsGets the number of views for a Telegraph page.
Parameters:
path (required): Path to the page.year (optional): Year to get views for.month (optional): Month to get views for.day (optional): Day to get views for.hour (optional): Hour to get views for.Contributions are welcome! Please feel free to submit a pull request or open an issue.