This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wp-postmark-status-api.php
105 lines (91 loc) · 2.16 KB
/
wp-postmark-status-api.php
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/**
* WP Postmark API (http://developer.postmarkapp.com/)
*
* @package WP-API-Libraries\WP-Postmark-Base\WP-Postmark-Status-API
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
/* Check if class exists. */
if ( ! class_exists( 'PostMarkStatusAPI' ) ) {
/**
* PostMarkStatusAPI class.
*/
class PostMarkStatusAPI extends PostMarkBase {
/**
* __construct function.
*
* @access public
* @param bool $debug (default: false) Debug.
* @return void
*/
public function __construct( $debug = false ) {
$this->args['headers'] = array(
'Accept' => 'application/json',
'Content-Type' => 'application/json',
);
$this->debug = $debug;
}
/**
* Status URL
* Docs: https://status.postmarkapp.com/api/
*
* (default value: 'https://status.postmarkapp.com/api/')
*
* @var string
* @access protected
*/
protected $route_uri = 'https://status.postmarkapp.com/api/1.0';
/**
* Get current system status. Status can be UP MAINTENANCE DELAY DEGRADED DOWN.
*/
public function get_status() {
return $this->build_request()->fetch( '/status/' );
}
/**
* Get last recorded incident.
*/
public function get_last_incident() {
return $this->build_request()->fetch( '/last_incident/' );
}
/**
* Get list of all current and past incidents.
*/
public function list_incidents() {
return $this->build_request()->fetch( '/list_incidents/' );
}
/**
* Get Incident.
*
* @access public
* @param mixed $incident_id Incident ID.
*/
public function get_incident( $incident_id ) {
return $this->build_request()->fetch( '/incidents/' . $incident_id );
}
/**
* Get Services Status.
*
* @access public
*/
public function get_services_status() {
return $this->build_request()->fetch( '/services/' );
}
/**
* Get Services Availability.
*
* @access public
*/
public function get_services_availability() {
return $this->build_request()->fetch( '/status/availability' );
}
/**
* Get Delivery Stats.
*
* @access public
*/
public function get_delivery_stats() {
return $this->build_request()->fetch( '/delivery/' );
}
}
}