Skip to content

Commit 98b802b

Browse files
authored
Merge pull request #19 from databox/release/0.3.15-sdk.5/1720599181313
[SDK release] Generated SDK code based on data-link 0.3.15-sdk.5 API changes
2 parents 077a435 + ca5063d commit 98b802b

32 files changed

+6004
-165
lines changed

README.md

Lines changed: 84 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,120 @@
1-
# Databox bindings for PHP
1+
# Databox
22

3-
[![License](http://img.shields.io/:license-mit-blue.svg)](http://databox.mit-license.org)
4-
[![Latest Stable Version](https://poser.pugx.org/databox/databox/v/stable)](https://packagist.org/packages/databox/databox)
3+
Push API resources Open API documentation
54

65

7-
The PHP SDK for interacting with the [Databox](http://databox.com) Push API.
6+
## Installation & Usage
87

9-
## Requirements
8+
### Requirements
109

11-
* PHP >= 5.5.0 with [cURL](http://php.net/manual/en/book.curl.php) extension,
12-
* [Guzzle](https://github.com/guzzle/guzzle) library,
13-
* (optional) [PHPUnit](https://phpunit.de/) to run tests.
10+
PHP 7.4 and later.
11+
Should also work with PHP 8.0.
1412

15-
## Autoloading
13+
### Composer
1614

17-
`databox-php` uses [Composer](http://getcomposer.org).
18-
The first step to use `databox-php` is to download composer:
15+
To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:
1916

20-
```bash
21-
$ curl -s http://getcomposer.org/installer | php
22-
```
23-
24-
Clone the repo and install dependencies using:
25-
```bash
26-
$ git clone https://github.com/databox/databox-php.git && cd databox-php
27-
$ php composer.phar install
28-
```
29-
30-
Use autoloader from Composer by:
3117
```json
3218
{
33-
"require": {
34-
"databox/databox": "@stable"
19+
"repositories": [
20+
{
21+
"type": "vcs",
22+
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
3523
}
24+
],
25+
"require": {
26+
"GIT_USER_ID/GIT_REPO_ID": "*@dev"
27+
}
3628
}
3729
```
3830

39-
`databox-php` follows the PSR-4 convention names for its classes, which means you can easily integrate `databox-php` classes loading in your own autoloader.
31+
Then run `composer install`
32+
33+
### Manual Installation
4034

41-
## Basic example
35+
Download the files and include `autoload.php`:
4236

4337
```php
4438
<?php
45-
require __DIR__ . '/vendor/autoload.php';
39+
require_once('/path/to/Databox/vendor/autoload.php');
40+
```
4641

47-
use Databox\Client;
42+
## Getting Started
43+
44+
Please follow the [installation procedure](#installation--usage) and then run the following:
45+
46+
```php
47+
<?php
48+
require_once(__DIR__ . '/vendor/autoload.php');
4849

49-
$c = new Client('<push_token>');
5050

51-
$ok = $c->push('sales', 203);
52-
if ($ok) {
53-
echo 'Inserted,...';
54-
}
5551

56-
$c->insertAll([
57-
['sales', 203],
58-
['sales', 103, '2015-01-01 17:00:00'],
59-
]);
52+
// Configure HTTP basic authorization: basicAuth
53+
$config = Databox\Configuration::getDefaultConfiguration()
54+
->setUsername('YOUR_USERNAME')
55+
->setPassword('YOUR_PASSWORD');
6056

61-
// Or push some attributes
62-
$ok = $c->push('sales', 203, null, [
63-
'city' => 'Boston'
64-
]);
6557

66-
print_r(
67-
$c->lastPush(3)
58+
$apiInstance = new Databox\Api\DefaultApi(
59+
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
60+
// This is optional, `GuzzleHttp\Client` will be used as default.
61+
new GuzzleHttp\Client(),
62+
$config
6863
);
6964

70-
// Or push with units
71-
$c->insertAll([
72-
['transaction', 12134, null, null, 'USD'],
73-
['transaction', 3245, null, null, 'EUR']
74-
]);
65+
try {
66+
$apiInstance->dataDelete();
67+
} catch (Exception $e) {
68+
echo 'Exception when calling DefaultApi->dataDelete: ', $e->getMessage(), PHP_EOL;
69+
}
7570

7671
```
7772

78-
## Documentation
73+
## API Endpoints
74+
75+
All URIs are relative to *https://push.databox.com*
76+
77+
Class | Method | HTTP request | Description
78+
------------ | ------------- | ------------- | -------------
79+
*DefaultApi* | [**dataDelete**](docs/Api/DefaultApi.md#datadelete) | **DELETE** /data |
80+
*DefaultApi* | [**dataMetricKeyDelete**](docs/Api/DefaultApi.md#datametrickeydelete) | **DELETE** /data/{metricKey} |
81+
*DefaultApi* | [**dataPost**](docs/Api/DefaultApi.md#datapost) | **POST** /data |
82+
*DefaultApi* | [**metrickeysGet**](docs/Api/DefaultApi.md#metrickeysget) | **GET** /metrickeys |
83+
*DefaultApi* | [**metrickeysPost**](docs/Api/DefaultApi.md#metrickeyspost) | **POST** /metrickeys |
84+
*DefaultApi* | [**pingGet**](docs/Api/DefaultApi.md#pingget) | **GET** /ping |
85+
86+
## Models
87+
88+
- [ApiResponse](docs/Model/ApiResponse.md)
89+
- [PushData](docs/Model/PushData.md)
90+
- [PushDataAttribute](docs/Model/PushDataAttribute.md)
91+
- [State](docs/Model/State.md)
92+
93+
## Authorization
7994

80-
See the `doc` directory for more detailed documentation.
95+
Authentication schemes defined for the API:
96+
### basicAuth
97+
98+
- **Type**: HTTP basic authentication
99+
100+
## Tests
101+
102+
To run the tests, use:
103+
104+
```bash
105+
composer install
106+
vendor/bin/phpunit
107+
```
81108

82-
## License
109+
## Author
83110

84-
`databox-php` is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
85111

86-
## Contributing
87112

88-
See the [contribute guide](CONTRIBUTING.md) for more info how to contribute.
113+
## About this package
89114

90-
## Credits & contributors
115+
This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
91116

92-
- [Jakob Murko](http://github.com/sraka1)
93-
- [Uroš Majerič](http://github.com/umajeric)
94-
- [Oto Brglez](https://github.com/otobrglez)
95-
- [Vlada Petrovic](https://github.com/vladapetrovic)
117+
- API version: `0.3.15-sdk.5`
118+
- Package version: `2.1`
119+
- Generator version: `7.6.0`
120+
- Build package: `org.openapitools.codegen.languages.PhpClientCodegen`

src/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore
2+
3+
composer.phar
4+
/vendor/
5+
6+
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
7+
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
8+
# composer.lock
9+
10+
# php-cs-fixer cache
11+
.php_cs.cache
12+
.php-cs-fixer.cache
13+
14+
# PHPUnit cache
15+
.phpunit.result.cache

src/.openapi-generator-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

src/.openapi-generator/FILES

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.gitignore
2+
.openapi-generator-ignore
3+
.php-cs-fixer.dist.php
4+
.travis.yml
5+
README.md
6+
composer.json
7+
docs/Api/DefaultApi.md
8+
docs/Model/ApiResponse.md
9+
docs/Model/PushData.md
10+
docs/Model/PushDataAttribute.md
11+
docs/Model/State.md
12+
git_push.sh
13+
lib/Api/DefaultApi.php
14+
lib/ApiException.php
15+
lib/Configuration.php
16+
lib/HeaderSelector.php
17+
lib/Model/ApiResponse.php
18+
lib/Model/ModelInterface.php
19+
lib/Model/PushData.php
20+
lib/Model/PushDataAttribute.php
21+
lib/Model/State.php
22+
lib/ObjectSerializer.php
23+
phpunit.xml.dist
24+
test/Api/DefaultApiTest.php
25+
test/Model/ApiResponseTest.php
26+
test/Model/PushDataAttributeTest.php
27+
test/Model/PushDataTest.php
28+
test/Model/StateTest.php

src/.openapi-generator/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.6.0

src/.php-cs-fixer.dist.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/**
4+
* @generated
5+
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/HEAD/doc/config.rst
6+
*/
7+
$finder = PhpCsFixer\Finder::create()
8+
->in(__DIR__)
9+
->exclude('vendor')
10+
->exclude('test')
11+
->exclude('tests')
12+
;
13+
14+
$config = new PhpCsFixer\Config();
15+
return $config->setRules([
16+
'@PSR12' => true,
17+
'phpdoc_order' => true,
18+
'array_syntax' => [ 'syntax' => 'short' ],
19+
'strict_comparison' => true,
20+
'strict_param' => true,
21+
'no_trailing_whitespace' => false,
22+
'no_trailing_whitespace_in_comment' => false,
23+
'braces' => false,
24+
'single_blank_line_at_eof' => false,
25+
'blank_line_after_namespace' => false,
26+
'no_leading_import_slash' => false,
27+
])
28+
->setFinder($finder)
29+
;

src/.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: php
2+
# Bionic environment has preinstalled PHP from 7.1 to 7.4
3+
# https://docs.travis-ci.com/user/reference/bionic/#php-support
4+
dist: bionic
5+
php:
6+
- 7.4
7+
before_install: "composer install"
8+
script: "vendor/bin/phpunit"

src/Databox/Client.php

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)