Skip to content

Commit

Permalink
Merge pull request #19 from databox/release/0.3.15-sdk.5/1720599181313
Browse files Browse the repository at this point in the history
[SDK release] Generated SDK code based on data-link 0.3.15-sdk.5 API changes
  • Loading branch information
slavkor authored Jul 10, 2024
2 parents 077a435 + ca5063d commit 98b802b
Show file tree
Hide file tree
Showing 32 changed files with 6,004 additions and 165 deletions.
143 changes: 84 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,95 +1,120 @@
# Databox bindings for PHP
# Databox

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


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

## Requirements
### Requirements

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

## Autoloading
### Composer

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

```bash
$ curl -s http://getcomposer.org/installer | php
```

Clone the repo and install dependencies using:
```bash
$ git clone https://github.com/databox/databox-php.git && cd databox-php
$ php composer.phar install
```

Use autoloader from Composer by:
```json
{
"require": {
"databox/databox": "@stable"
"repositories": [
{
"type": "vcs",
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
}
],
"require": {
"GIT_USER_ID/GIT_REPO_ID": "*@dev"
}
}
```

`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.
Then run `composer install`

### Manual Installation

## Basic example
Download the files and include `autoload.php`:

```php
<?php
require __DIR__ . '/vendor/autoload.php';
require_once('/path/to/Databox/vendor/autoload.php');
```

use Databox\Client;
## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

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

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

$c->insertAll([
['sales', 203],
['sales', 103, '2015-01-01 17:00:00'],
]);
// Configure HTTP basic authorization: basicAuth
$config = Databox\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');

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

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

// Or push with units
$c->insertAll([
['transaction', 12134, null, null, 'USD'],
['transaction', 3245, null, null, 'EUR']
]);
try {
$apiInstance->dataDelete();
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->dataDelete: ', $e->getMessage(), PHP_EOL;
}

```

## Documentation
## API Endpoints

All URIs are relative to *https://push.databox.com*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**dataDelete**](docs/Api/DefaultApi.md#datadelete) | **DELETE** /data |
*DefaultApi* | [**dataMetricKeyDelete**](docs/Api/DefaultApi.md#datametrickeydelete) | **DELETE** /data/{metricKey} |
*DefaultApi* | [**dataPost**](docs/Api/DefaultApi.md#datapost) | **POST** /data |
*DefaultApi* | [**metrickeysGet**](docs/Api/DefaultApi.md#metrickeysget) | **GET** /metrickeys |
*DefaultApi* | [**metrickeysPost**](docs/Api/DefaultApi.md#metrickeyspost) | **POST** /metrickeys |
*DefaultApi* | [**pingGet**](docs/Api/DefaultApi.md#pingget) | **GET** /ping |

## Models

- [ApiResponse](docs/Model/ApiResponse.md)
- [PushData](docs/Model/PushData.md)
- [PushDataAttribute](docs/Model/PushDataAttribute.md)
- [State](docs/Model/State.md)

## Authorization

See the `doc` directory for more detailed documentation.
Authentication schemes defined for the API:
### basicAuth

- **Type**: HTTP basic authentication

## Tests

To run the tests, use:

```bash
composer install
vendor/bin/phpunit
```

## License
## Author

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

## Contributing

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

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

- [Jakob Murko](http://github.com/sraka1)
- [Uroš Majerič](http://github.com/umajeric)
- [Oto Brglez](https://github.com/otobrglez)
- [Vlada Petrovic](https://github.com/vladapetrovic)
- API version: `0.3.15-sdk.5`
- Package version: `2.1`
- Generator version: `7.6.0`
- Build package: `org.openapitools.codegen.languages.PhpClientCodegen`
15 changes: 15 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore

composer.phar
/vendor/

# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock

# php-cs-fixer cache
.php_cs.cache
.php-cs-fixer.cache

# PHPUnit cache
.phpunit.result.cache
23 changes: 23 additions & 0 deletions src/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
28 changes: 28 additions & 0 deletions src/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.gitignore
.openapi-generator-ignore
.php-cs-fixer.dist.php
.travis.yml
README.md
composer.json
docs/Api/DefaultApi.md
docs/Model/ApiResponse.md
docs/Model/PushData.md
docs/Model/PushDataAttribute.md
docs/Model/State.md
git_push.sh
lib/Api/DefaultApi.php
lib/ApiException.php
lib/Configuration.php
lib/HeaderSelector.php
lib/Model/ApiResponse.php
lib/Model/ModelInterface.php
lib/Model/PushData.php
lib/Model/PushDataAttribute.php
lib/Model/State.php
lib/ObjectSerializer.php
phpunit.xml.dist
test/Api/DefaultApiTest.php
test/Model/ApiResponseTest.php
test/Model/PushDataAttributeTest.php
test/Model/PushDataTest.php
test/Model/StateTest.php
1 change: 1 addition & 0 deletions src/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.6.0
29 changes: 29 additions & 0 deletions src/.php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* @generated
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/HEAD/doc/config.rst
*/
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('vendor')
->exclude('test')
->exclude('tests')
;

$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR12' => true,
'phpdoc_order' => true,
'array_syntax' => [ 'syntax' => 'short' ],
'strict_comparison' => true,
'strict_param' => true,
'no_trailing_whitespace' => false,
'no_trailing_whitespace_in_comment' => false,
'braces' => false,
'single_blank_line_at_eof' => false,
'blank_line_after_namespace' => false,
'no_leading_import_slash' => false,
])
->setFinder($finder)
;
8 changes: 8 additions & 0 deletions src/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: php
# Bionic environment has preinstalled PHP from 7.1 to 7.4
# https://docs.travis-ci.com/user/reference/bionic/#php-support
dist: bionic
php:
- 7.4
before_install: "composer install"
script: "vendor/bin/phpunit"
106 changes: 0 additions & 106 deletions src/Databox/Client.php

This file was deleted.

Loading

0 comments on commit 98b802b

Please sign in to comment.