Versions in this module Expand all Collapse all v1 v1.0.0 Nov 24, 2023 Changes in this version + const DefaultBaseURL + const DefaultScope + const DefaultTimeout + const MAXPageSIZE + func CallAPI(url, method string, header map[string]string, body io.Reader) (json.RawMessage, error) + func GetLastUpdatedTS(db *gorm.DB, api APIConfig, dataModel interface{}) int64 + func InitOAuth2ClientCredentials(cf OAuth2Config) + func SyncToCSV(fileName string, api APIConfig) (int64, error) + func SyncToDB(db *gorm.DB, api APIConfig, dataModel interface{}) (int64, error) + func SyncToFile(mode string, fileName string, api APIConfig) (int64, error) + func SyncToModel(api APIConfig, dataModel interface{}) error + func UnmarshalRows(src []interface{}, dst interface{}) error + type APIConfig struct + APIPath string + BatchSize int + PageSize int + UpdatedAtField string + func (api *APIConfig) AddParam(key, value string) + func (api *APIConfig) DelParam(key string) + func (api *APIConfig) ParamEncode() string + func (api *APIConfig) SetDefault() + func (api *APIConfig) SetParam(key, value string) + type APIResult struct + Data json.RawMessage + ErrCode int64 + ErrMsg string + RequestId string + type DataResult struct + PageNum int + PageSize int + Rows []interface{} + TotalNum int + type OAuth2Client struct + BaseUrl string + Client *http.Client + Debug bool + RetryCount int + func GetOpenAPIClient() *OAuth2Client + func (c *OAuth2Client) GetAllRows(apiPath string, pageSize int) ([]interface{}, error) + func (c *OAuth2Client) GetRows(apiPath string, pageNum, pageSize int) (DataResult, error) + func (c *OAuth2Client) HttpGet(url string) (json.RawMessage, error) + func (c *OAuth2Client) HttpRequest(url, method string, header map[string]string, body io.Reader) (json.RawMessage, error) + type OAuth2Config struct + BaseUrl string + ClientId string + ClientSecret string + Debug bool + Scopes []string + Timeout int64