-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathicu_ea_api.php
More file actions
85 lines (73 loc) · 2.25 KB
/
icu_ea_api.php
File metadata and controls
85 lines (73 loc) · 2.25 KB
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
80
81
82
83
84
85
<?php
class ICUEActivitiesAPI {
var $end_point = "https://eactivities.union.ic.ac.uk/API";
function __construct($csp_code, $api_key, $year) {
$this->csp_code = $csp_code;
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"X-API-Key: $api_key\r\n"
)
);
$this->context = stream_context_create($opts);
$this->year = $year;
}
function __get($path) {
return file_get_contents("$this->end_point/$path", false, $this->context);
}
function list_csp() {
return $this->__get("CSP");
}
function csp_details() {
return $this->__get("CSP/$this->csp_code");
}
function list_all_products() {
return $this->__get("CSP/$this->csp_code/Products");
}
function product_details($id) {
return $this->__get("CSP/$this->csp_code/Products/$id");
}
function product_sales($id) {
return $this->__get("CSP/$this->csp_code/Products/$id/Sales");
}
function profile_entry() {
return $this->__get("CSP/$this->csp_code/ProfileEntry");
}
function list_purchase_orders() {
return $this->__get("CSP/$this->csp_code/PurchaseOrders");
}
function purchase_order_details($id) {
return $this->__get("CSP/$this->csp_code/PurchaseOrders/$id");
}
function list_committee() {
return $this->__get("CSP/$this->csp_code/Reports/Committee?year=$this->year");
}
function list_members() {
return $this->__get("CSP/$this->csp_code/Reports/Members?year=$this->year");
}
function list_online_sales() {
return $this->__get("CSP/$this->csp_code/Reports/OnlineSales?year=$this->year");
}
function list_products() {
return $this->__get("CSP/$this->csp_code/Reports/Products?year=$this->year");
}
function list_transaction_lines() {
return $this->__get("CSP/$this->csp_code/Reports/TransactionLines?year=$this->year");
}
function list_signups() {
return $this->__get("CSP/$this->csp_code/Signups");
}
function signup_details($id) {
return $this->__get("CSP/$this->csp_code/Signups/$id");
}
function list_whatson() {
return $this->__get("CSP/$this->csp_code/WhatsOn");
}
function whatson_details($id) {
return $this->__get("CSP/$this->csp_code/WhatsOn/$id");
}
function list_years() {
return $this->__get("CSP/$this->csp_code/Years");
}
}
?>