aboutsummaryrefslogtreecommitdiffstats
path: root/timetask
diff options
context:
space:
mode:
Diffstat (limited to 'timetask')
-rw-r--r--timetask/http.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/timetask/http.go b/timetask/http.go
index 8c41b4f..3ff6f4f 100644
--- a/timetask/http.go
+++ b/timetask/http.go
@@ -1,6 +1,7 @@
package timetask
import (
+ "io/ioutil"
"net/http"
"net/http/cookiejar"
"net/url"
@@ -126,3 +127,38 @@ func buildSubmissionParams(time_entry TimeEntry) url.Values {
return v
}
+
+func RequestModules(
+ client http.Client,
+ time_entry TimeEntry,
+) (string, error) {
+ params := url.Values{
+ "module": {"projects"},
+ "action": {"listmodulesxref"},
+ "f_ID": {strconv.Itoa(time_entry.Project)},
+ "f_active": {"t"},
+ "f_clientID": {strconv.Itoa(time_entry.Client)},
+ "f_personID": {strconv.Itoa(time_entry.PersonID)},
+ "f_milestoneID": {""},
+ }
+ modules_url, err := url.Parse(baseURL)
+ if err != nil {
+ return "", err
+ }
+
+ modules_url.RawQuery = params.Encode()
+
+ resp, err := client.Get(modules_url.String())
+ if err != nil {
+ return "", err
+ }
+
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return "", err
+ }
+ response_body := string(body)
+
+ return response_body, nil
+}