public function shortenAll (array $urls, callable $callback = null)
    {
        // Create output.
        $urls = array_values($urls);
        $shortened = [];

        // Create request builder.
        $requests = function ($urls) {
            foreach ($urls as $url) {
                yield new Request(
                    'POST',
                    'https://api.weixin.qq.com/cgi-bin/shorturl',
                    [],
                    json_encode([
                        'action'   => 'long2short',
                        'long_url' => $url,
                    ])
                );
            }
        };

        if (! is_callable($callback)) {
            $shortened = array_combine($urls, array_pad([], count($urls), null));
            $callback = function ($error, $short, $long) use (&$shortened) {
                if ($error === null) {
                    $shortened[$long] = $short;
                }
            };
        }

        // Send off requests.
        (new Pool(
            $this->client,
            $requests($urls),
            [
                'fulfilled' => function (ResponseInterface $response, $index) use ($urls, $callback) {
                    $json = json_decode((string)$response->getBody());
                    $long = $urls[$index];
                    $short = isset($json->short_url) ? $json->short_url : null;

                    call_user_func($callback, null, $short, $long);
                },
                'rejected'  => function (RequestException $reason) use (&$failed, $callback) {
                    call_user_func($callback, $reason, null, null);
                },
            ]
        ))->promise()->wait();

        // Return the shortened URLs.
        return $shortened;
    }