aboutsummaryrefslogtreecommitdiffstats
path: root/timetask
AgeCommit message (Collapse)Author
2017-03-12time_entry.go: Properly unmarshal Time fieldTeddy Wing
Fix 7a8db5312bbb43c986fbae7aa14960e22080b03b to ensure that the `Time` field actually gets unmarshalled into `TimeEntry` structs.
2017-03-12Make fields named structsTeddy Wing
We'll be needing to refer to these fields as named types, so create types for them and reference them in the config object.
2017-03-12time_entry.go: Add missing `Time` fieldTeddy Wing
Include billable hours field.
2017-03-12Parse timesheet filesTeddy Wing
Expect a timesheet file as the last argument to the program. Parse the contents into `TimeEntry` objects. `TimeEntry`ies will then be able to be POSTed to Time Task to submit times. The time entries input file is a YAML document in this format: - client: A client project: A project module: A module task: A task work_type: type date: 2017-03-06 time: 7 billable: true description: It contains an array where each element is a time entry. Had a lot of trouble parsing the date into a `time.Time`. Finally realised that my first and biggest problem was somehow I was importing `yaml.v1` instead of `yaml.v2`, and thus my `UnmarshalYAML` function was never getting called. Wanted a way to get the time as a string and parse it myself into a time. At first tried using an `UnmarshalText` function: type Time time.Time func (t *Time) UnmarshalText(text []byte) error { parsed, err := time.Parse("2006-01-02", string(text)) if err == nil { *t = Time(parsed) } return err } But in order to do that I had to make a type alias to `time.Time`. Doing so was not ideal, because then I'd have to convert my `Time` into a `time.Time` any time I wanted to use it for real. Ended up going with a suggestion from here: https://mlafeldt.github.io/blog/decoding-yaml-in-go/ Creating an auxiliary struct in `UnmarshalYAML` to unmarshal the date into a string and then parse it myself as a date. I don't really like it because it's a lot of ceremony just to parse one type myself, but can't come up with a better solution right now so there you have it.
2017-03-11TestLogin: Replace af83-specific textTeddy Wing
2017-03-11TestLogin: Do actual test checksTeddy Wing
Verify errors and check the response body to ensure successful login.
2017-03-11Get login workingTeddy Wing
Fill in the `Login` function to actually log in to Time Task. Pass credentials in via test command flags. Referenced https://gist.github.com/varver/f327ef9087ebf76aa4c4 for the cookie setup.
2017-03-11Initial commit. Test HTTP request.Teddy Wing
Make a sample GET request using `net/http`.