From aab0310042fddcad3d086ae647883b666f93781d Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Fri, 6 Jan 2023 17:11:32 +0800 Subject: [PATCH] refactor: parameterize the executor functions' request types too --- client.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client.go b/client.go index 7e156b8..d10253f 100644 --- a/client.go +++ b/client.go @@ -103,10 +103,10 @@ func (c *WorkwxApp) composeQyapiURLWithToken(path string, req any, withAccessTok return url, nil } -func executeQyapiGet[U tryIntoErr]( +func executeQyapiGet[T urlValuer, U tryIntoErr]( c *WorkwxApp, path string, - req urlValuer, + req T, respObj U, withAccessToken bool, ) error { @@ -135,10 +135,10 @@ func executeQyapiGet[U tryIntoErr]( return nil } -func executeQyapiJSONPost[U tryIntoErr]( +func executeQyapiJSONPost[T bodyer, U tryIntoErr]( c *WorkwxApp, path string, - req bodyer, + req T, respObj U, withAccessToken bool, ) error { @@ -172,10 +172,10 @@ func executeQyapiJSONPost[U tryIntoErr]( return nil } -func executeQyapiMediaUpload[U tryIntoErr]( +func executeQyapiMediaUpload[T mediaUploader, U tryIntoErr]( c *WorkwxApp, path string, - req mediaUploader, + req T, respObj U, withAccessToken bool, ) error {