Skip to content

Commit 0be36d7

Browse files
authored
Merge pull request #11 from dant89/feature/support-ixapi-v2
Feature/support ixapi v2
2 parents f6431bb + 9d52375 commit 0be36d7

68 files changed

Lines changed: 2325 additions & 1813 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
[![Latest Stable Version][packagist-image]][packagist-url]
44
[![Github Issues][github-issues-image]][github-issues-url]
55

6-
An unofficial lightweight PHP API client for the [IX-API](https://ix-api.net).
6+
A lightweight PHP API client for the [IX-API](https://ix-api.net).
77

88
## Installation
99

1010
To install, run `composer require dant89/ixapi-client` in the root of your project or add `dant89/ix-api-client` to your composer.json.
11+
12+
View the tagged versions to choose between `v1` and `v2` implementations of this client.
1113
```json
1214
"require": {
1315
"dant89/ix-api-client": "^LATEST_VERSION_TAG"
@@ -25,31 +27,43 @@ use Dant89\IXAPIClient\Client;
2527
$client = new Client(IXAPI_URL);
2628

2729
// Get a bearer token from key / secret
28-
$response = $client->getHttpClient('auth')
30+
$response = $client->getHttpClient(HttpClientType::AUTH)
2931
->postAuthToken(IXAPI_KEY, IXAPI_SECRET);
3032

3133
// Check for valid response status
3234
if ($response->getStatus() === 200) {
33-
$data = $response->getContent();
34-
$client->setBearerToken($data['access_token']);
35+
$client->setBearerToken($response->getContent()['access_token']);
3536
}
3637
```
3738

38-
With the bearer token set, you can return data from all endpoints that require authentication, such as the products endpoints:
39+
With the bearer token set, you can return data from all endpoints that require authentication.
40+
41+
**Get Product Offerings:**
3942
```php
4043
// Query for products
41-
$response = $client->getHttpClient('products')
42-
->getProducts();
44+
$response = $client->getHttpClient(HttpClientType::PRODUCT_OFFERINGS)
45+
->getProductOfferingss();
46+
47+
// Check for valid response and set the array of products
48+
if ($response->getStatus() === 200) {
49+
$productOfferings = $response->getContent();
50+
}
51+
````
52+
**Get Connections Statistical Timeseries Data:**
53+
```php
54+
// Query for connections timeseries data
55+
$response = $client->getHttpClient(HttpClientType::CONNECTIONS)
56+
->getStatisticTimeseries('connection-123-uuid', '30d');
4357

4458
// Check for valid response and set the array of products
4559
if ($response->getStatus() === 200) {
46-
$products = $response->getContent();
60+
$timeseries = $response->getContent();
4761
}
4862
````
4963

5064
## Authentication
5165

52-
You will need to speak directly to an exchange to be provided with an API key / secret combination and the URL of their IX-API implementation.
66+
You will need to contact an exchange to create an API key / secret combination and find out the URL of their IX-API implementation.
5367

5468
## Questions
5569

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
}
2323
},
2424
"require": {
25-
"php": "^7.1",
25+
"php": "^8.1",
2626
"ext-json": "*",
2727
"symfony/http-client": "^4.3"
2828
},
2929
"require-dev": {
3030
"phpmd/phpmd": "^2.7",
31-
"phpunit/phpunit": "^7.5",
31+
"phpunit/phpunit": "^9.0",
3232
"squizlabs/php_codesniffer": "^3.4"
3333
},
3434
"config": {

0 commit comments

Comments
 (0)