Files
2025-01-17 00:08:57 +03:00

33 lines
559 B
Go

package schedule
import (
"fmt"
"os"
"github.com/go-resty/resty/v2"
)
var (
baseUrl string = os.Getenv("SCHEDULE_BASE_URL")
)
func GetWeek(groupId, startDate string) (*Week, error) {
client := resty.New()
client.SetBaseURL(baseUrl)
res := Week{}
_, err := client.R().
SetResult(&res).
Get(fmt.Sprintf("/api/v1/ruz/scheduler/%s?date=%s", groupId, startDate))
return &res, err
}
func GetScheduleUrl(facultyId, groupId, date string) string {
return fmt.Sprintf("%s/faculty/%s/groups/%s?date=%s",
baseUrl,
facultyId,
groupId,
date)
}