func (a Veracross) getSchedule() (*[]schedule, error) {
	var sched []schedule
	client, err := axiom.NewClient(a.Username, a.Password, a.Client)
	if err != nil {
		return &sched, err
	}
	req, err := http.NewRequest("POST", "https://axiom.veracross.com/"+a.Client+"/query/"+a.Query+"/result_data.json", nil)
	req.Header.Set("x-csrf-token", client.Token)
	resp, err := client.Do(req)
	if err != nil {
		return &sched, err
	}
	defer resp.Body.Close()
	err = json.NewDecoder(resp.Body).Decode(&sched)
	if err != nil {
		return &sched, err
	}
	return &sched, err
}
示例#2
0
func init() {
	flag.Parse()

	if *fVersion {
		fmt.Printf("axiom-query - version %s\n", Version)
		os.Exit(0)
	}

	if _, err := toml.DecodeFile(*fConfig, &conf); err != nil {
		log.Fatal(err)
	}

	c, err := axiom.NewClient(conf.VeracrossUsername, conf.VeracrossPassword,
		conf.VeracrossSchool,
	)
	if err != nil {
		log.Fatal(err)
	}
	client = c
}