// fetchCurrentReportingPeriod collects the current reporting period func (tock *Tock) fetchReportingPeriod() string { var data ReportingPeriodAuditList URL := fmt.Sprintf(tock.TockURL) body := helpers.FetchData(URL) err := json.Unmarshal(body, &data) if err != nil { log.Print(err) } return fetchCurrentReportingPeriod(&data) }
// FetchTockUsers is a function for collecting all the users who have not // filled out thier time sheet for the current period func (tock *Tock) FetchTockUsers() *ReportingPeriodAuditDetails { var data ReportingPeriodAuditDetails timePeriod := tock.fetchReportingPeriod() URL := fmt.Sprintf("%s%s/", tock.TockURL, timePeriod) body := helpers.FetchData(URL) err := json.Unmarshal(body, &data) if err != nil { log.Print(err) } return &data }
// FetchData adds a token to the url before fetching data func (slack *Slack) FetchData(URL string) []byte { return helpers.FetchData(slack.AddToken(URL)) }