Skip to content

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.

599 B
Raw Blame
<?php

declare(strict_types=1);

namespace App\Support\Analytics;

use App\Support\Social\NetworkLimitReset;
use Carbon\CarbonImmutable;
use Illuminate\Http\Client\Response;

class RetryAfter
{
    /**
     * When the network said its limit lifts: Retry-After or the reset headers
     * each network sends (Bluesky's RateLimit-Reset, X's x-rate-limit-reset, ...).
     */
    public static function from(Response $response): ?CarbonImmutable
    {
        $resetAt = NetworkLimitReset::from($response);

        return $resetAt === null ? null : CarbonImmutable::instance($resetAt)->utc();
    }
}