diff options
author | Teddy Wing | 2017-06-04 00:26:03 +0200 |
---|---|---|
committer | Teddy Wing | 2017-06-04 00:26:03 +0200 |
commit | 34fb8b7b98076b65b05efc2bbaff013fbbbf5116 (patch) | |
tree | eae64bb174ff4b708f2ba701168acac373079020 /timetask/module.go | |
parent | f8821fa88888491bf49d8cd626f7a011665c6066 (diff) | |
parent | 6a62cc9aef3684ef0bd72e6ab79157a699b01c72 (diff) | |
download | timetasker-34fb8b7b98076b65b05efc2bbaff013fbbbf5116.tar.bz2 |
Merge branch 'command-to-get-module-ids-of-project' into timetasker-daily
Diffstat (limited to 'timetask/module.go')
-rw-r--r-- | timetask/module.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/timetask/module.go b/timetask/module.go new file mode 100644 index 0000000..4dde57a --- /dev/null +++ b/timetask/module.go @@ -0,0 +1,24 @@ +package timetask + +import ( + "encoding/xml" +) + +type Module struct { + ID int `xml:"moduleid"` + Name string `xml:"modulename"` +} + +type moduleXML struct { + Modules []Module `xml:"response>item"` +} + +func ModuleParseXML(xml_str string) ([]Module, error) { + modules := moduleXML{} + err := xml.Unmarshal([]byte(xml_str), &modules) + if err != nil { + return nil, err + } + + return modules.Modules, nil +} |