This Library aims to provide a fully working Glimesh Client, all objects and interfaces used by the API are auto-generated by the API specification.
composer require adamhebby/glimeshclient
<?php
use GlimeshClient\Adapters\Authentication\OAuthFileAdapter;
use GlimeshClient\Client;
use GlimeshClient\Objects\Enums\ChannelStatus;
use GraphQL\Query;
use GuzzleHttp\Client as GuzzleHttpClient;
use Symfony\Component\Dotenv\Dotenv;
require_once __DIR__ . '/../vendor/autoload.php';
// Dotenv is not required!
$dotenv = (new Dotenv())->load(__DIR__ . '/../.env');
$logger = new \Monolog\Logger("log");
$logger->pushHandler(new \Monolog\Handler\ErrorLogHandler());
$guzzle = new GuzzleHttpClient(['http_errors' => true, 'allow_redirects' => true]);
$client = new Client(
$guzzle,
new OAuthFileAdapter(
$_ENV['CLIENT_ID'],
$_ENV['CLIENT_SECRET'],
'/tmp/auth.json'
),
$logger
);
$object = $client->makeRequest(
(new Query('channels'))->setSelectionSet([
'id',
(new Query('stream'))->setSelectionSet([
'thumbnail',
]),
])->setArguments(['status' => 'ENUM:' . ChannelStatus::LIVE])
);
var_dump($object);