slamby/slamby-sdk-php

1.5.1 2017-02-07 12:10 UTC

This package is not auto-updated.

Last update: 2024-09-28 19:04:11 UTC


README

Slamby API

This PHP package is automatically generated by the modified Swagger Codegen project:

  • 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

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/slamby/slamby-sdk-php.git"
    }
  ],
  "require": {
    "slamby/slamby-sdk-php": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/autoload.php');

Tests

To run the unit tests:

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

$dataSetManager = new Api\DataSetApi($client);
$dataSets = $dataSetManager->getDataSets();

Selecting a DataSet for work

$config->addDefaultHeader("X-DataSet", "<my_dataset>");

Get Tag list

$tagManager = new Api\TagApi($client);
$tags = $tagManager->getTags();

Creating a new Tag

$tag = new Model\Tag();
$tag["id"] = "123";
$tag["name"] = "New tag";

try {
    $tagManager->createTag($tag);
} catch (ApiException $e) {
    print($e->getResponseObject());
}

Get a Document

$documentManager = new Api\DocumentApi($client);
$document = $documentManager->getDocument("123456");

Update a Document

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/

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author