wechat_mp_logistics/
lib.rs1mod account;
6mod delivery;
7mod models;
8mod order;
9mod path;
10mod printer;
11mod quota;
12
13pub use account::{
14 bind_account, get_all_account, BindAccountRequest, BoundAccount, GetAllAccountResponse,
15};
16pub use delivery::{get_all_delivery, DeliveryCompany, GetAllDeliveryResponse};
17pub use models::*;
18pub use order::{
19 add_order, batch_get_order, cancel_order, get_order, test_update_order, AddOrderRequest,
20 AddOrderResponse, BatchGetOrderRequest, BatchGetOrderResponse, BatchOrderItem,
21 CancelOrderRequest, CancelOrderResponse, GetOrderRequest, GetOrderResponse,
22 TestUpdateOrderRequest,
23};
24pub use path::{get_path, GetPathRequest, GetPathResponse, PathItem};
25pub use printer::{
26 get_all_printer, update_printer, GetAllPrinterResponse, UpdatePrinterRequest,
27};
28pub use quota::{get_quota, GetQuotaRequest, GetQuotaResponse};
29
30use wechat_mp_core::MpClient;
31
32#[derive(Clone)]
34pub struct LogisticsApi {
35 client: MpClient,
36}
37
38impl LogisticsApi {
39 pub fn new(client: MpClient) -> Self {
41 Self { client }
42 }
43
44 pub fn client(&self) -> &MpClient {
45 &self.client
46 }
47
48 pub async fn bind_account(&self, req: &BindAccountRequest) -> wechat_mp_core::Result<()> {
49 bind_account(&self.client, req).await
50 }
51
52 pub async fn get_all_account(&self) -> wechat_mp_core::Result<GetAllAccountResponse> {
53 get_all_account(&self.client).await
54 }
55
56 pub async fn get_all_delivery(&self) -> wechat_mp_core::Result<GetAllDeliveryResponse> {
57 get_all_delivery(&self.client).await
58 }
59
60 pub async fn add_order(&self, req: &AddOrderRequest) -> wechat_mp_core::Result<AddOrderResponse> {
61 add_order(&self.client, req).await
62 }
63
64 pub async fn cancel_order(
65 &self,
66 req: &CancelOrderRequest,
67 ) -> wechat_mp_core::Result<CancelOrderResponse> {
68 cancel_order(&self.client, req).await
69 }
70
71 pub async fn get_order(&self, req: &GetOrderRequest) -> wechat_mp_core::Result<GetOrderResponse> {
72 get_order(&self.client, req).await
73 }
74
75 pub async fn batch_get_order(
76 &self,
77 req: &BatchGetOrderRequest,
78 ) -> wechat_mp_core::Result<BatchGetOrderResponse> {
79 batch_get_order(&self.client, req).await
80 }
81
82 pub async fn get_path(&self, req: &GetPathRequest) -> wechat_mp_core::Result<GetPathResponse> {
83 get_path(&self.client, req).await
84 }
85
86 pub async fn get_quota(&self, req: &GetQuotaRequest) -> wechat_mp_core::Result<GetQuotaResponse> {
87 get_quota(&self.client, req).await
88 }
89
90 pub async fn update_printer(&self, req: &UpdatePrinterRequest) -> wechat_mp_core::Result<()> {
91 update_printer(&self.client, req).await
92 }
93
94 pub async fn get_all_printer(&self) -> wechat_mp_core::Result<GetAllPrinterResponse> {
95 get_all_printer(&self.client).await
96 }
97
98 pub async fn test_update_order(
99 &self,
100 req: &TestUpdateOrderRequest,
101 ) -> wechat_mp_core::Result<()> {
102 test_update_order(&self.client, req).await
103 }
104}