use server infos from config file
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 8s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 8s
This commit is contained in:
@@ -199,6 +199,19 @@ func DeleteData(target config.Server, path, id string) {
|
||||
}
|
||||
}
|
||||
|
||||
func PushData(target config.Server, path string, data any, result any) (response *resty.Response, err error) {
|
||||
url := fmt.Sprintf("%s/%s/%s", target.Url, config.Config.ApiVersion, path)
|
||||
client := resty.New()
|
||||
token := GetToken(client, target)
|
||||
response, err = client.R().
|
||||
SetBody(data).
|
||||
SetAuthToken(token).
|
||||
SetHeader("Accept", "application/json").
|
||||
SetResult(result).
|
||||
Post(url)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func UpdateData(target config.Server, path string, v any) {
|
||||
client := resty.New()
|
||||
client.SetLoggerWarnLevel(true)
|
||||
|
||||
Reference in New Issue
Block a user