SwaggerClient-php
Slamby API, (*1)
This PHP package is automatically generated by the modified Swagger Codegen project:, (*2)
- API version: 1.5.0
- Package version: 1.5.1
- Build date: 2017-02-07T12:59:29.743+01:00
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
Requirements
PHP 5.4.0 and later, (*3)
Installation & Usage
Composer
To install the bindings via Composer, add the following to composer.json:, (*4)
{
"repositories": [
{
"type": "git",
"url": "https://github.com/slamby/slamby-sdk-php.git"
}
],
"require": {
"slamby/slamby-sdk-php": "*@dev"
}
}
Then run composer install, (*5)
Manual Installation
Download the files and include autoload.php:, (*6)
require_once('/path/to/SwaggerClient-php/autoload.php');
Tests
To run the unit tests:, (*7)
composer install
./vendor/bin/phpunit lib/Tests
Getting Started
require 'autoload.php';
use \Swagger\Client\Configuration;
use \Swagger\Client\ApiClient;
use \Swagger\Client\ApiException;
use \Swagger\Client\ObjectSerializer;
use \Swagger\Client\Api;
use \Swagger\Client\Model;
$config = new Configuration();
$config->setHost("http://<api_host>/");
$config->setSSLVerification(false);
$config->addDefaultHeader("Authorization", "Slamby <api_secret>");
$client = new ApiClient($config);
Getting DataSet list, (*8)
$dataSetManager = new Api\DataSetApi($client);
$dataSets = $dataSetManager->getDataSets();
Selecting a DataSet for work, (*9)
$config->addDefaultHeader("X-DataSet", "<my_dataset>");
Get Tag list, (*10)
$tagManager = new Api\TagApi($client);
$tags = $tagManager->getTags();
Creating a new Tag, (*11)
$tag = new Model\Tag();
$tag["id"] = "123";
$tag["name"] = "New tag";
try {
$tagManager->createTag($tag);
} catch (ApiException $e) {
print($e->getResponseObject());
}
Get a Document, (*12)
$documentManager = new Api\DocumentApi($client);
$document = $documentManager->getDocument("123456");
Update a Document, (*13)
try {
$document->language = "hu";
$documentManager->updateDocument("123456", $document);
} catch (ApiException $e) {
print($e->getResponseObject());
}
Documentation for API Endpoints
All URIs are relative to https://localhost/, (*14)
Documentation For Models
Documentation For Authorization
All endpoints do not require authorization., (*15)
Author