Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
<?php
declare(strict_types=1);
namespace App\Dto;
use RuntimeException;
final readonly class CanvaTokens
{
public function __construct(
public string $accessToken,
public string $refreshToken,
public int $expiresIn,
) {}
/**
* @param array<string, mixed> $response
*/
public static function fromResponse(array $response): self
{
$accessToken = (string) data_get($response, 'access_token');
$refreshToken = (string) data_get($response, 'refresh_token');
if ($accessToken === '' || $refreshToken === '') {
throw new RuntimeException('Canva returned no tokens.');
}
return new self($accessToken, $refreshToken, (int) data_get($response, 'expires_in', 0));
}
/**
* Never print the tokens.
*
* @return array<string, mixed>
*/
public function __debugInfo(): array
{
return ['expiresIn' => $this->expiresIn];
}
}