1mod cv;
6mod img;
7mod input;
8mod models;
9mod ocr;
10
11pub use img::*;
12pub use input::ImageSource;
13pub use models::*;
14pub use ocr::*;
15
16use wechat_mp_core::MpClient;
17
18#[derive(Clone)]
20pub struct OcrApi {
21 client: MpClient,
22}
23
24impl OcrApi {
25 pub fn new(client: MpClient) -> Self {
26 Self { client }
27 }
28
29 pub fn client(&self) -> &MpClient {
30 &self.client
31 }
32
33 pub async fn printed_text(
35 &self,
36 img: ImageSource,
37 ) -> wechat_mp_core::Result<CommOcrResponse> {
38 printed_text(&self.client, img).await
39 }
40
41 pub async fn id_card(&self, img: ImageSource) -> wechat_mp_core::Result<IdCardOcrResponse> {
43 id_card(&self.client, img).await
44 }
45
46 pub async fn bank_card(
48 &self,
49 img: ImageSource,
50 ) -> wechat_mp_core::Result<BankCardOcrResponse> {
51 bank_card(&self.client, img).await
52 }
53
54 pub async fn driving(&self, img: ImageSource) -> wechat_mp_core::Result<DrivingOcrResponse> {
56 driving(&self.client, img).await
57 }
58
59 pub async fn driving_license(
61 &self,
62 img: ImageSource,
63 ) -> wechat_mp_core::Result<DrivingLicenseOcrResponse> {
64 driving_license(&self.client, img).await
65 }
66
67 pub async fn biz_license(
69 &self,
70 img: ImageSource,
71 ) -> wechat_mp_core::Result<BizLicenseOcrResponse> {
72 biz_license(&self.client, img).await
73 }
74
75 pub async fn ai_crop(
77 &self,
78 img: ImageSource,
79 ratios: Option<&str>,
80 ) -> wechat_mp_core::Result<AiCropResponse> {
81 ai_crop(&self.client, img, ratios).await
82 }
83
84 pub async fn scan_qrcode(&self, img: ImageSource) -> wechat_mp_core::Result<QrCodeResponse> {
86 scan_qrcode(&self.client, img).await
87 }
88}