-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoursesInstanceDetail.go
79 lines (65 loc) · 2.72 KB
/
coursesInstanceDetail.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package axcelerate
import (
"fmt"
"time"
jsontime "github.com/liamylian/jsontime/v2/v2"
)
// InstanceDetail details of an activity instance.
type InstanceDetail struct {
ComplexDates []ComplexDate `json:"COMPLEXDATES"`
Cost int64 `json:"COST"`
CustomfieldWeekends interface{} `json:"CUSTOMFIELD_WEEKENDS"`
DateDescriptor string `json:"DATEDESCRIPTOR"`
EnrolmentOpen bool `json:"ENROLMENTOPEN"`
FinishDate time.Time `json:"FINISHDATE"`
CourseID int `json:"ID"`
InstanceID int `json:"INSTANCEID"`
Items []interface{} `json:"ITEMS"`
LinkedClassID int `json:"LINKEDCLASSID"`
LinkedeLearning []struct {
Code string `json:"CODE"`
Enddate interface{} `json:"ENDDATE"`
Instanceid int64 `json:"INSTANCEID"`
Name string `json:"NAME"`
Startdate interface{} `json:"STARTDATE"`
} `json:"LINKEDELEARNING"`
Location string `json:"LOCATION"`
MaxParticipants int `json:"MAXPARTICIPANTS"`
MinParticipants int `json:"MINPARTICIPANTS"`
Name string `json:"NAME"`
Notices interface{} `json:"NOTICES"`
OwnerContactID int `json:"OWNERCONTACTID"`
Participants int `json:"PARTICIPANTS"`
ParticipantVacancy int `json:"PARTICIPANTVACANCY"`
Public bool `json:"PUBLIC"`
StartDate time.Time `json:"STARTDATE"`
TrainerContactID int `json:"TRAINERCONTACTID"`
VenueContactID int `json:"VENUECONTACTID"`
Status string `json:"STATUS"`
SyncDateDescriptor bool `json:"SYNCDATEDESCRIPTOR"`
LastUpdatedUTC time.Time `json:"LASTUPDATEDUTC"`
Address string `json:"ADDRESS"`
}
/*
GetCoursesInstanceDetail Returns details of an activity instance.
instanceID
The instanceID of the activity you want details from.
activityType
The type of the activity. w = workshop, p = accredited program, el = e-learning.
*/
func (s *CoursesService) GetCoursesInstanceDetail(instanceID int, activityType string) (InstanceDetail, *Response, error) {
var json = jsontime.ConfigWithCustomTimeFormat
jsontime.SetDefaultTimeFormat("2006-01-02 15:04", time.Local)
// jsontime.AddTimeFormatAlias("axcelerate_datetime", "2006-01-02 15:04")
time.LoadLocation("Asia/Shanghai")
var obj InstanceDetail
parms := map[string]string{}
parms["instanceID"] = fmt.Sprintf("%d", instanceID)
parms["type"] = activityType
resp, err := do(s.client, "GET", Params{parms: parms, u: "/course/instance/detail"}, obj)
if err != nil {
return obj, resp, err
}
err = json.Unmarshal([]byte(resp.Body), &obj)
return obj, resp, err
}