voucherify-rust-sdk
Setup
Add crate to your Cargo.toml
[]
= "1.0.0"
Import voucherify-rs crate
extern crate voucherify_rs;
Create voucherify api object
let voucherify = new;
API Endpoint
Optionally, you can specify API Endpoint if you want to use Voucherify running in a specific region.
let voucherify: &mut Voucherify = &mut new;
voucherify.set_endpoint;
Vouchers API
Provided methods:
- Create Voucher
- Get Voucher
- Update Voucher
- Delete Voucher
- List Vouchers
- Enable Voucher
- Disable Voucher
Create Voucher
let new_voucher = new
.voucher_type
.discount
.build;
let created_voucher = voucherify.voucher_create.send.unwrap;
Get Voucher
let single_voucher: Voucher = voucherify.voucher_get.send.unwrap;
Update Voucher
let updated_metadata = new
.number
.string
.boolean
.build;
let updated_voucher = voucherify.voucher_update
.category
.active
.metadata
// .gift_amount(1234)
.send.unwrap;
Delete Voucher
let was_voucher_deleted: bool = voucherify.voucher_delete.send.unwrap;
List Vouchers
let voucher_list: = voucherify.voucher_list.limit.page.send.unwrap;
Enable Voucher
let was_voucher_enabled: bool = voucherify.voucher_enable.send.unwrap;
Disable Voucher
let was_voucher_disabled: bool = voucherify.voucher_disable.send.unwrap;
License
Licensed under MIT license (LICENSE or http://opensource.org/licenses/MIT)
Changelog
- 2019-06-19 -
1.0.0
- Added support for custom API endpoint, that allows to connect to projects created in specific Voucherify region. Additionally, updated the model here and there (more Option-al variables + added simple VouchersList).