1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
#![deny(missing_docs)]
//! Convenient rust bindings and types for the Paystakc HTTP API aiming to support the entire API surface.
//! Not the case? Please open an issue. I update the definitions on a weekly basis.
//!
//! # Documentation
//! See the [Rust API docs](https://docs.rs/paystack-rs) or the [examples](/examples).
//!
//! ## Installation
//!
//! `paystack-rs` uses the `reqwest` http client under the hood and the `tokio` runtime for async operations
//!
//! ```toml
//! [dependencies]
//! paystack-rs = "0.1"
//! ```
//!
//! ## Usage
//!
//! Initalizing an instance of the Paystack client and creating a transaction.
//!
//! ```rust
//! use std::env;
//! use dotenv::dotenv;
//! use paystack::{PaystackClient, TransactionBuilder, PaystackError, Currency};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), PaystackError>{
//! dotenv().ok();
//! let api_key = env::var("PAYSTACK_API_KEY").unwrap();
//! let client = PaystackClient::new(api_key);
//!
//! let body = TransactionBuilder::new()
//! .email("email@example.com")
//! .amount("200000")
//! .currency(Currency::NGN)
//! .build()
//! .unwrap();
//!
//! let transaction = client
//! .initialize_transaction(body)
//! .await
//! .expect("Unable to create transaction");
//!
//! Ok(())
//! }
//!
//! ```
//!
//! ## Contributing
//!
//! See [CONTRIBUTING.md](/CONTRIBUTING.md) for information on contributing to paystack-rs.
//!
// ## License
//!
//! Licensed under MIT license ([LICENSE-MIT](/LICENSE-MIT)).
mod client;
mod error;
mod resources;
mod response;
// public re-exports
pub use client::*;
pub use error::*;
pub use resources::*;
pub use response::*;
/// Custom result type for the Paystack API
pub type PaystackResult<T> = std::result::Result<T, error::PaystackError>;