-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclass-client.php
226 lines (179 loc) · 4.36 KB
/
class-client.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<?php
/**
* Client class
*
* @package Cointokio\CoinGecko
*/
namespace Cointokio\CoinGecko;
/**
* The Client class exists for easier access to all individual request endpoint class methods.
*
* Example:
*
* $coingecko_client = new \Cointokio\CoinGecko\Client();
* $response = $coingecko_client->coins()->get_list();
*/
class Client {
/**
* Initialize Client class.
*/
public function __construct() {
if ( ! class_exists( '\Cointokio\CoinGecko\Request' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-request.php';
}
}
/**
* Get an instance of the AssetPlatforms class.
*
* @return AssetPlatforms
*/
public function asset_platforms() {
if ( ! class_exists( '\Cointokio\CoinGecko\AssetPlatforms' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-assetplatforms.php';
}
return new AssetPlatforms();
}
/**
* Get an instance of the Categories class.
*
* @return Coins
*/
public function categories() {
if ( ! class_exists( '\Cointokio\CoinGecko\Categories' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-categories.php';
}
return new Categories();
}
/**
* Get an instance of the Coins class.
*
* @return Coins
*/
public function coins() {
if ( ! class_exists( '\Cointokio\CoinGecko\Coins' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-coins.php';
}
return new Coins();
}
/**
* Get an instance of the Contract class.
*
* @return Contract
*/
public function contract() {
if ( ! class_exists( '\Cointokio\CoinGecko\Contract' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-contract.php';
}
return new Contract();
}
/**
* Get an instance of the Derivatives class.
*
* @return Derivatives
*/
public function derivatives() {
if ( ! class_exists( '\Cointokio\CoinGecko\Derivatives' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-derivatives.php';
}
return new Derivatives();
}
/**
* Get an instance of the Exchanges class.
*
* @return Exchanges
*/
public function exchanges() {
if ( ! class_exists( '\Cointokio\CoinGecko\Exchanges' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-exchanges.php';
}
return new Exchanges();
}
/**
* Get an instance of the ExchangeRates class.
*
* @return ExchangeRates
*/
public function exchange_rates() {
if ( ! class_exists( '\Cointokio\CoinGecko\ExchangeRates' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-exchangerates.php';
}
return new ExchangeRates();
}
/**
* Get an instance of the Finance class.
*
* @return Finance
*/
public function finance() {
if ( ! class_exists( '\Cointokio\CoinGecko\Finance' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-finance.php';
}
return new Finance();
}
/**
* Get an instance of the Globals class.
*
* @return Globals
*/
public function globals() {
if ( ! class_exists( '\Cointokio\CoinGecko\Globals' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-globals.php';
}
return new Globals();
}
/**
* Get an instance of the Indexes class.
*
* @return Indexes
*/
public function indexes() {
if ( ! class_exists( '\Cointokio\CoinGecko\Indexes' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-indexes.php';
}
return new Indexes();
}
/**
* Check API server status.
*
* @return array|\WP_Error
*/
public function ping() {
if ( ! class_exists( '\Cointokio\CoinGecko\Ping' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-ping.php';
}
return ( new Ping() )->get_ping();
}
/**
* Get an instance of the Simple class.
*
* @return Simple
*/
public function simple() {
if ( ! class_exists( '\Cointokio\CoinGecko\Simple' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-simple.php';
}
return new Simple();
}
/**
* Get an instance of the StatusUpdates class.
*
* @return StatusUpdates
*/
public function status_updates() {
if ( ! class_exists( '\Cointokio\CoinGecko\StatusUpdates' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-statusupdates.php';
}
return new StatusUpdates();
}
/**
* Get an instance of the Trending class.
*
* @return Trending
*/
public function trending() {
if ( ! class_exists( '\Cointokio\CoinGecko\Trending' ) ) {
require_once dirname( __FILE__ ) . '/classes/class-trending.php';
}
return new Trending();
}
}