28 lines
510 B
Go
28 lines
510 B
Go
package showapi
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"git.rosy.net.cn/baseapi/platformapi"
|
|
)
|
|
|
|
type API struct {
|
|
appID int
|
|
appSecret string
|
|
client *http.Client
|
|
config *platformapi.APIConfig
|
|
}
|
|
|
|
func New(appID int, appSecret string, config ...*platformapi.APIConfig) *API {
|
|
curConfig := platformapi.DefAPIConfig
|
|
if len(config) > 0 {
|
|
curConfig = *config[0]
|
|
}
|
|
return &API{
|
|
appID: appID,
|
|
appSecret: appSecret,
|
|
client: &http.Client{Timeout: curConfig.ClientTimeout},
|
|
config: &curConfig,
|
|
}
|
|
}
|