libcast / authot-client
Authot Client
v0.3.0
2017-04-11 15:36 UTC
Requires
- jms/serializer: v1.3.1
- league/container: ^2.2
- league/tactician: ^1.0
- league/tactician-container: ^1.0
- libcast/oauth2-authot: ^0.1.0
- symfony/yaml: ^3.1
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2024-10-30 21:22:12 UTC
README
This package wraps AuhtĂ´t API into a PHP client. Oauth2 implementation is provided.
Installation
To install, use composer:
composer require libcast/authot-client
Usage
<?php
// Http client
$httpClient = new \GuzzleHttp\Client([
'base_uri' => 'https://app.xn--autht-9ta.com/'
]);
// Oauth2 provider
$provider = new \Libcast\OAuth2\Client\Provider\Authot([
'clientId' => '{authot-client-id}',
'clientSecret' => '{authot-client-secret}',
'redirectUri' => 'https://example.com/callback-url',
]);
// Create the client
$client = (new \Libcast\Authot\Oauth2\ClientFactory($httpClient, $provider))
->create('{access_token}');
// Submit a transcription
$transcription = $client->createWithCallback('/path/to/audio/file.mp3', 'fr', 'https://example.com/transcription-callback-url');
// Fetch a transcription by its ID
$transcription = $client->find(42647);
echo $transcription->getId();
echo $transcription->getLang();
echo $transcription->getProgress();
echo $transcription->getStatus();
echo $transcription->getTitle();
echo $transcription->isFinished();
// Get User time left
$userTimeLeft = $client->getUserTimeLeft();
echo $userTimeLeft->getTimeLeftCorrection()->format('H:i:s');
echo $userTimeLeft->getTimeLeftTranscription()->format('H:i:s');
// Export a subtitle
$subtitle = $client->export(42647, 'srt'); // Available formats: txt, xml, sjson, srt, webvtt
file_put_contents('/path/to/output/file.srt', $subtitle);
License
The MIT License (MIT). Please see License File for more information.