datana-gmbh/datapool-api

API for Datapool

1.9.2 2021-10-18 11:00 UTC

This package is auto-updated.

Last update: 2021-10-18 11:01:07 UTC


README

Branch PHP Code Coverage
master PHP Code Coverage

Usage

Setup

use Datana\Datapool\Api\DatapoolClient;

$baseUri = 'https://....';
$username = '...';
$password = '...';

$client = new DatapoolClient($baseUri, $username, $password);

// you can now request any endpoint which needs authentication
$client->request('GET', '/api/something', $options);

Akten

In your code you should type-hint to Datana\Datapool\Api\AktenApiInterface

Search by string (string)

use Datana\Datapool\Api\AktenApi;
use Datana\Datapool\Api\DatapoolClient;

$client = new DatapoolClient(/* ... */);

$aktenApi = new AktenApi($client);
$response = $aktenApi->search('MySearchTerm');

Get by Aktenzeichen (string)

use Datana\Datapool\Api\AktenApi;
use Datana\Datapool\Api\DatapoolClient;
use Datana\Datapool\Api\Domain\Value\DatapoolId;

$client = new DatapoolClient(/* ... */);

$aktenApi = new AktenApi($client);
$response = $aktenApi->getByAktenzeichen('9zku4b-4524-4528-Winter');

/*
 * to get the DatapoolId transform the response to array
 * and use the 'id' key.
 */
$akte = $response->toArray();
$datapoolId = DatapoolId::fromInt($akte['id']);

Get by ID (Datana\Datapool\Api\Domain\Value\DatapoolId)

use Datana\Datapool\Api\AktenApi;
use Datana\Datapool\Api\DatapoolClient;
use Datana\Datapool\Api\Domain\Value\DatapoolId;

$client = new DatapoolClient(/* ... */);

$aktenApi = new AktenApi($client);

$id = DatapoolId::fromInt(123);

$aktenApi->getById($id);

Get KT Akten Info (Datana\Datapool\Api\Domain\Value\DatapoolId)

use Datana\Datapool\Api\AktenApi;
use Datana\Datapool\Api\DatapoolClient;
use Datana\Datapool\Api\Domain\Value\DatapoolId;

$client = new DatapoolClient(/* ... */);

$aktenApi = new AktenApi($client);

$id = DatapoolId::fromInt(123);

$aktenApi->getKtAktenInfo($id);
/*
 * Result:
 *   [
 *     'id' => 123,
 *     'url' => 'https://projects.knowledgetools.de/rema/?tab=akten&akte=4528',
 *     'instance' => 'rema',
 *     'group' => 'GARA',
 *   ]
 */

Set value "Nutzer Mandantencockpit" (bool)

use Datana\Datapool\Api\AktenApi;
use Datana\Datapool\Api\DatapoolClient;
use Datana\Datapool\Api\Domain\Value\DatapoolId;

$client = new DatapoolClient(/* ... */);

$aktenApi = new AktenApi($client);

$id = DatapoolId::fromInt(123);

$aktenApi->setValueNutzerMandantencockpit($id, true); // or false

Aktenzeichen

In your code you should type-hint to Datana\Datapool\Api\AktenzeichenApiInterface

Get a new one

use Datana\Datapool\Api\AktenzeichenApi;
use Datana\Datapool\Api\DatapoolClient;

$client = new DatapoolClient(/* ... */);

$aktenzeichenApi = new AktenzeichenApi($client);
$aktenzeichenApi->new(); // returns sth like "6GU5DCB"

AktenEventLog

In your code you should type-hint to Datana\Datapool\Api\AktenEventLogInterface

Create a new log

use Datana\Datapool\Api\AktenEventLog;
use Datana\Datapool\Api\DatapoolClient;

$client = new DatapoolClient(/* ... */);

$aktenEventLog = new AktenEventLog($client);
$aktenEventLog->log(
    '1234/12',                // Aktenzeichen
    'E-Mail versendet',       // Info-Text
    new \DateTimeImmutable(), // Zeitpunkt des Events
    'Mein Service',           // Ersteller des Events
);