Mini client for rust.

Related tags

Database labrador
Overview

Labrador   Docs Build Status Latest Version labrador: rustc 1.13+

Labrador - Mini client for rust

This create offers:

  • A convenient mainstream third-party service client
  • Convenient and quick use of corresponding services in rust

Features:

  • taobao - Taobao customer related services
  • alipay - Alipay related services
  • pdd - Pinduoduo related services
  • jd - Jingdong related services
  • wechat - Wechat related services

Supported Platform

Platform is supported
Wechat:mp(微信公众号),cp(企业微信),miniapp(微信小程序),pay(微信支付)
Alipay(支付宝)
Taobao(淘宝客)
JD(京东联盟)
PDD(拼多多-多多客)

You may be looking for:

Labrador in action

Click to show Cargo.toml. Run this code in the playground.
[dependencies]

# The core APIs
labrador = { version = "0.1.0", features = ["wechat", "alipay"] }

API Documentation

Example

With Wechat(微信开放平台、包含微信支付)

use labrador::{WechatPayClient, SimpleStorage, TradeType, WechatPayRequestV3, Amount, Payer};
use chrono::{Local, SecondsFormat};

#[tokio::main]
async fn main() {
    let c =  WechatPayClient::new("appid", "secret", SimpleStorage::new());
    let mut client =c.wxpay();
    let date = Local::now().to_rfc3339_opts(SecondsFormat::Secs, false);
    let result = client.unified_order_v3(TradeType::Jsapi, WechatPayRequestV3 {
        appid: "appid".to_string().into(),
        mch_id: "mchid".to_string(),
        description: "测试商品支付".to_string(),
        out_trade_no: "1602920235sdfsdfas32234234".to_string(),
        time_expire: date,
        attach: None,
        notify_url: "https:xxx.cn/trade/notify".to_string(),
        amount: Amount {
            total: 1,
            currency: String::from("CNY").into(),
            payer_total: None,
            payer_currency: None
        },
        payer: Payer {
            openid: "oUVZc6S_uGx3bsNPUA-davo4Dt7Us".to_string()
        }.into(),
        detail: None,
        scene_info: None,
        settle_info: None
    });
    match result.await {
        Ok(res) => {}
        Err(err) => {}
    }
}

With Alipay(支付宝)

use labrador::{AlipayTradeWapPayRequest, AlipayClient};

#[tokio::main]
async fn main() {
    let param = AlipayTradeWapPayRequest::default();
    let client = AlipayClient::new("appKey", false);
    match client.wap_pay("POST".into(), param).await {
        Ok(res) => {}
        Err(err) => {}
    }
    match result.await {
        Ok(res) => {}
        Err(err) => {}
    }
}

With Taobao(淘宝客相关)

use labrador::{TbItemDetailRequest, TaobaoClient};

#[tokio::main]
async fn main() {
    let client =  TaobaoClient::<SimpleStorage>::new("appkey", "secret");
    let req = TbItemDetailRequest {
        num_iids: Some("597649283190".to_string()),
        platform: None,
        ip: None
    };
    let result = client.get_item_detail(req);
    match result.await {
        Ok(res) => {
        }
        Err(err) => {
        }
    }
}

With JD(京东,目前暂时只支持联盟相关)

use labrador::{JDClient, JdOrderRawQueryParam};
use chrono::{Local, SecondsFormat};

#[tokio::main]
async fn main() {
    let client =  JDClient::<SimpleStorage>::new("appkey", "secert");
    let param = JdOrderRawQueryParam {
        page_index: 1.into(),
        page_size: 10.into(),
        bill_type: 1,
        start_time: "2022-08-02 21:23:00".to_string(),
        end_time: "2022-08-02 21:43:00".to_string(),
        child_union_id: None,
        key: None,
        fields: None
    };
    let result = client.query_raw_order(param);
    match result.await {
        Ok(res) => {
        }
        Err(err) => {
        }
    }
}

With Custom Request

You can implement this trait and then use the custom request

  • AlipayRequest - For Alipay(支付宝)
  • JDRequest - For jingdong(京东)
  • TaobaoRequest - For taobao(淘宝)

Feature

We will gradually improve the corresponding API

Developing

To setup the development envrionment run cargo run.

Contributers

Getting help

Labrador is a personal project. At the beginning, I just like Labrador dog because of my hobbies. I hope this project will grow more and more lovely. Many practical database functions will be added in the future. I hope you can actively help this project grow and put forward suggestions. I believe the future will be better and better.


License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Labrador by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
You might also like...
Official Rust client for Central Dogma

centraldogma-rs Official Rust Client for Central Dogma. Full documentation is available at https://docs.rs/centraldogma Getting started Installing Add

A minecraft-like multi version client implemented in Rust.
A minecraft-like multi version client implemented in Rust.

Leafish Multi-version Minecraft-compatible client written in Rust, forked from Stevenarella. Chat Chat takes place on Matrix and Discord. The channels

Skytable rust client support library for the bb8 connection pool

bb8-skytable Skytable rust client support library for the bb8 connection pool. Heavily based on bb8-redis Basic usage example use bb8_skytable::{

Rust client for apache iotdb.

Apache IoTDB Apache IoTDB (Database for Internet of Things) is an IoT native database with high performance for data management and analysis, deployab

A firebase HTTP v1 client implementation in Rust using google-authz

firebase-client A firebase HTTP v1 client implementation in Rust using the google_authz library. Example There are two ways to send notifications, one

Rust client for KairosDB

Rust Client for KairosDB   Description A simple rust language client for the time series database KairosDB. Documentation Full documentation for rust-

CouchDB client library for the Rust programming language

CouchDB This project is reborn! As of its v0.6.0 release, the couchdb crate has new life as a toolkit instead of providing a full-blown client. In a n

rinflux is Rust based influx client implementation that have been inspired from influx other language implementation, developed with 💖
rinflux is Rust based influx client implementation that have been inspired from influx other language implementation, developed with 💖

Unofficial InfluxDB Driver for Rust This library is a work in progress. This means a feature you might need is not implemented yet or could be handled

High-level async Cassandra client written in 100% Rust.
High-level async Cassandra client written in 100% Rust.

CDRS tokio CDRS is production-ready Apache Cassandra driver written in pure Rust. Focuses on providing high level of configurability to suit most use

Comments
  • build on windows is fail....

    build on windows is fail....

    Caused by: process didn't exit successfully: D:\xampp\htdocs\actix-web-dome\target\debug\build\openssl-sys-cd470af4e12e18b6\build-script-main (exit code: 101) --- stdout cargo:rustc-cfg=const_fn cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR unset cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR OPENSSL_NO_VENDOR unset running "perl" "./Configure" "--prefix=D:\xampp\htdocs\actix-web-dome\target\debug\build\openssl-sys-016ef75a4a04324c\out\openssl-build\install" "--openssldir=SYS$MANAGER:[OPENSSL]" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-engine" "no-asm" "VC-WIN64A"

    --- stderr thread 'main' panicked at 'called Result::unwrap() on an Err value: Error { kind: NotFound, message: "program not found" }', D:.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-src-111.22.0+1.1.1q\src\lib.rs:488:39 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace warning: build failed, waiting for other jobs to finish...

    opened by shanliu 5
Releases(0.2.0)
Owner
潘安
一位不知名的coder。
潘安
Plugin for macro-, mini-quad (quads) to save data in simple local storage using Web Storage API in WASM and local file on a native platforms.

quad-storage This is the crate to save data in persistent local storage in miniquad/macroquad environment. In WASM the data persists even if tab or br

ilya sheprut 7 May 2, 2022
Cassandra DB native client written in Rust language. Find 1.x versions on https://github.com/AlexPikalov/cdrs/tree/v.1.x Looking for an async version? - Check WIP https://github.com/AlexPikalov/cdrs-async

CDRS CDRS is looking for maintainers CDRS is Apache Cassandra driver written in pure Rust. ?? Looking for an async version? async-std https://github.c

Alex Pikalov 336 Aug 17, 2022
CouchDB client-side library for the Rust programming language

Chill Chill is a client-side CouchDB library for the Rust programming language, available on crates.io. It targets Rust Stable. Chill's three chief de

null 35 Jun 26, 2022
A Rust client for the ElasticSearch REST API

rs-es Introduction An ElasticSearch client for Rust via the REST API. Targetting ElasticSearch 2.0 and higher. Other clients For later versions of Ela

Ben Ashford 216 Jul 31, 2022
An Elasticsearch REST API client for Rust

elastic elastic is an efficient, modular API client for Elasticsearch written in Rust. The API is targeting the Elastic Stack 7.x. elastic provides st

null 250 Aug 1, 2022
An etcd client library for Rust.

etcd An etcd client library for Rust. etcd on crates.io Documentation for the latest crates.io release Running the tests Install Docker and Docker Com

Jimmy Cuadra 135 Aug 31, 2022
Mysql client library implemented in rust.

mysql This crate offers: MySql database driver in pure rust; connection pool. Features: macOS, Windows and Linux support; TLS support via nativetls cr

Anatoly I 524 Sep 20, 2022
Telegram bot API client for Rust

Frankenstein Telegram bot API client for Rust. It's a complete wrapper for Telegram bot API and it's up to date with version 5.2 of the API. Frankenst

Ayrat Badykov 120 Sep 22, 2022
Streaming STOMP client for Rust

tokio-stomp An async STOMP client (and maybe eventually, server) for Rust, using the Tokio stack. It aims to be fast and fully-featured with a simple

null 7 Jun 15, 2022
Official Skytable client driver for Rust

Skytable client Introduction This library is the official client for the free and open-source NoSQL database Skytable. First, go ahead and install Sky

Skytable 27 Sep 20, 2022