-
Notifications
You must be signed in to change notification settings - Fork 0
/
college.go
67 lines (58 loc) · 2.74 KB
/
college.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
package gopddikti
import (
"net/http"
"time"
)
const (
getCollegeDetailPath = "/v2/detail_pt"
)
type CollegeGeneralInfo struct {
NPSN string `json:"npsn"`
Status string `json:"stat_sp"`
Name string `json:"nm_lemb"`
EstablishmentDate string `json:"tgl_berdiri"`
EstablishmentCertificateNumber string `json:"sk_pendirian_sp"`
EstablishmentCertificateNumberDate time.Time `json:"tgl_sk_pendirian_sp"`
Address string `json:"jln"`
City string `json:"nama_wil"`
PostalCode string `json:"kode_pos"`
TelephoneNumber string `json:"no_tel"`
FaxNumber string `json:"no_fax"`
Email string `json:"email"`
Website string `json:"website"`
Latitude float64 `json:"lintang"`
Longitude float64 `json:"bujur"`
DetailID string `json:"id_sp"`
SurfaceArea int `json:"luas_tanah"`
TotalLaboratory int `json:"laboratorium"`
TotalClassroom int `json:"ruang_kelas"`
TotalLibrary int `json:"perpustakaan"`
IsInternetProvided bool `json:"internet"`
IsElectricityProvided bool `json:"listrik"`
RectorName string `json:"nama_rektor"`
AccreditationList []AccreditationDetail `json:"akreditasi_list"`
}
type AccreditationDetail struct {
Accreditation string `json:"akreditasi"`
AccreditationDate time.Time `json:"tgl_akreditasi"`
AccreditationExpiryDate time.Time `json:"tgl_berlaku"`
}
// GetCollegeGeneralInfoByDetailID is used to get the university or college information in detail.
// It receives detailID as parameter.
func (c *Client) GetCollegeGeneralInfoByDetailID(detailID string) (res CollegeGeneralInfo, err error) {
return c.getCollegeGeneralInfo(detailID)
}
func (c *Client) getCollegeGeneralInfo(detailID string) (res CollegeGeneralInfo, err error) {
if err = checkParamString(detailID); err != nil {
return
}
req, err := c.createRequest(http.MethodGet, getCollegeDetailPath+"/"+detailID)
if err != nil {
return
}
err = c.doRequest(req, &res)
if err != nil {
return
}
return
}