Documentation ¶
Overview ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { APIKey string `env:"BAIDU_API_KEY"` SecretKey string `env:"BAIDU_SECRET_KEY"` AccessToken string AccessTokenExpire int64 // access token过期时间戳 }
var Baidu *Client
百度客户端,必须先调用Init或InitEnv初始化
func (*Client) GetAccessToken ¶
GetAccessToken 获取access token https://ai.baidu.com/ai-doc/REFERENCE/Ck3dwjhhu
type OCRResult ¶
type OCRResult struct { LogID uint64 `json:"log_id"` WordsResultNum uint32 `json:"words_result_num"` WordsResult []WordsResult `json:"words_result"` ErrorCode int `json:"error_code"` // 错误码 ErrorMsg string `json:"error_msg"` // 错误描述 }
type TokenError ¶
type TokenError struct { Error string `json:"error"` // 错误类型 ErrorDescription string `json:"error_description"` // 错误描述 }
TokenError 获取access token失败响应
type TokenResult ¶
type TokenResult struct { AccessToken string `json:"access_token"` ExpiresIn int64 `json:"expires_in"` // 多少秒后过期 }
TokenResult 获取access token成功响应
type WordsResult ¶
Click to show internal directories.
Click to hide internal directories.