Retrieve attachment urls from an incoming message.

@return array A download for the attachment.
358881
public function getAttachmentUrls()
    {
        return Collection::make($this->event->get('attachments'))->map(function ($item) {
            return new File($item['contentUrl'], $item);
        })->toArray();
    }
1285694
protected function getRequestedUrls()
    {
        $oInput = Factory::service('Input');
        $sUrls  = $oInput->get('urls') ?: $oInput->header('X-Cdn-Urls');
        $aUrls  = !is_array($sUrls) ? explode(',', $sUrls) : $sUrls;
        $aUrls  = array_map('strtolower', $aUrls);

        //  Filter out any which don't follow the format {digit}x{digit}-{scale|crop} || raw
        foreach ($aUrls as &$sDimension) {

            if (!is_string($sDimension)) {
                $sDimension = null;
                continue;
            }

            preg_match_all('/^(\d+?)x(\d+?)-(scale|crop)$/i', $sDimension, $aMatches);

            if (empty($aMatches[0])) {
                $sDimension = null;
            } else {
                $sDimension = [
                    'width'  => !empty($aMatches[1][0]) ? $aMatches[1][0] : null,
                    'height' => !empty($aMatches[2][0]) ? $aMatches[2][0] : null,
                    'type'   => !empty($aMatches[3][0]) ? $aMatches[3][0] : 'crop',
                ];
            }
        }

        return array_filter($aUrls);
    }
72029
private function getFiles()
    {
        $file = $this->event->get('document');

        $response = $this->http->get($this->buildApiUrl('getFile'), [
            'file_id' => $file['file_id'],
        ]);

        $responseData = json_decode($response->getContent());

        if ($response->getStatusCode() !== 200) {
            throw new TelegramAttachmentException('Error retrieving file url: '.$responseData->description);
        }

        $url = $this->buildFileApiUrl($responseData->result->file_path);

        return [new File($url, $file)];
    }
1032736
public function getLinks()
    {
        $links = array();
        foreach($this->links as $rel => $href) {
            $simple_rel = $rel;
            $base_uris = array("fx:", static::LINK_RELATIONSHIPS_BASE_URI);
            foreach($base_uris as $base_uri) {
                $pos = strpos($simple_rel, $base_uri);
                if ($pos !== FALSE && ($simple_rel.'/' != $base_uri)) {
                    $simple_rel = substr($simple_rel, strlen($base_uri));
                }
            }
            $links[$simple_rel] = $href;
        }
        return $links;
    }
367873
public function getUrls()
    {
        $urls = [];
        if ($this->entity->getUrls()) {
            foreach ($this->entity->getUrls() as $url) {
                $urls[] = $url;
            }
        }

        return $urls;
    }
231169
public function getAudioUrls(array $message)
    {
        return Collection::make($message['message']['attachments'])->where('type',
            'audio')->pluck('payload')->map(function ($item) {
                return new Audio($item['url'], $item);
            })->toArray();
    }
468571
protected function loadMessages()
    {
        $messages = Collection::make($this->event->get('messaging'))->filter(function ($msg) {
            return isset($msg['message']) && isset($msg['message']['attachments']) && isset($msg['message']['attachments']);
        })->transform(function ($msg) {
            $message = new IncomingMessage(Video::PATTERN, $msg['sender']['id'], $msg['recipient']['id'], $msg);
            $message->setVideos($this->getVideoUrls($msg));

            return $message;
        })->toArray();

        if (count($messages) === 0) {
            $messages = [new IncomingMessage('', '', '')];
        }

        $this->messages = $messages;
    }
1129235
public function getMessages(): array
    {
        $templates = [
            new Message($this->message->getBody(), $this->message->getContentType()),
        ];

        // TODO: Loop through parts

        return $templates;
    }
1173006
public function fetchAttachmentsOfLastMessage()
    {
        $email = $this->fetchLastMessage();
        $response = $this->client->get("inboxes/{$this->config['inbox_id']}/messages/{$email->id}/attachments")->getBody();

        return json_decode($response, true);
    }
1217894
protected function getMessages()
    {
        $messages = [];
        foreach ($this->sourcePath as $namespace => $path) {
            $messages = array_merge($this->getMessagesFromSourcePath($path, $namespace), $messages);
        }

        return $messages;
    }
1113647
public function getAttachmentPdf()
    {
        $response = $this->api->get(
            $this->url() . '/attachment.pdf',
            null,
            'application/json'
        );

        return base64_decode($response->data->content);
    }
647545
protected function getLinks()
	{
		$html = '';

		if (is_array($this->window['first'])) {
			$html .= $this->getUrlLinks($this->window['first']);
		}

		if (is_array($this->window['slider'])) {
			$html .= $this->getDots();
			$html .= $this->getUrlLinks($this->window['slider']);
		}

		if (is_array($this->window['last'])) {
			$html .= $this->getDots();
			$html .= $this->getUrlLinks($this->window['last']);
		}

		return $html;
	}
959303
protected function loadMessages()
    {
        $messages = Collection::make($this->event->get('messaging'))->filter(function ($msg) {
            return isset($msg['message']) && isset($msg['message']['attachments']) && isset($msg['message']['attachments']);
        })->transform(function ($msg) {
            $message = new IncomingMessage(Audio::PATTERN, $msg['sender']['id'], $msg['recipient']['id'], $msg);
            $message->setAudio($this->getAudioUrls($msg));

            return $message;
        })->toArray();

        if (count($messages) === 0) {
            $messages = [new IncomingMessage('', '', '')];
        }

        $this->messages = $messages;
    }
1256537
private function buildAttachments(Swift_Mime_Message $message)
    {
        $attachments = [];

        foreach ($message->getChildren() as $part) {
            if ($part instanceof Swift_Attachment) {
                $attachments[] = [
                    'type' => $part->getContentType(),
                    'name' => $part->getFilename(),
                    'data' => base64_encode($part->getBody()),
                ];
            }
        }

        return $attachments;
    }
1351140
public function getSwiftMessage()
    {
        $message = \Swift_Message::newInstance();

        if (true === is_array($this->getRecipient())) {
            $recipient = $this->getRecipient();
        } else {
            $recipient = [
                $this->getRecipient(),
            ];
        };

        $message
            ->setSubject($this->getSubject())
            ->setFrom(
                [
                    $this->getSender(),
                ]
            )
            ->setTo($recipient)
            ->setBody($this->getMessage());

        if (0 < count($this->getAttachments())) {
            foreach ($this->getAttachments() as $attachment) {
                $message->attach($attachment);
            }
        }

        return $message;
    }
991480
public function getDeployedUrls()
    {
        $deploymentHandler = ResourceDeploymentProvider::getProvider();

        $urls = [];

        foreach ($this->resourcesToDeploy as $path) {
            $urls[] = $deploymentHandler->getDeployedResourceUrl($path);
        }

        return $urls;
    }
73722
public function getMessages()
    {
        if (empty($this->messages)) {
            $message = new IncomingMessage(Image::PATTERN, $this->event->get('from')['id'], $this->event->get('conversation')['id'],
                $this->payload);
            $message->setImages($this->getImagesUrls());
            $this->messages = [$message];
        }

        return $this->messages;
    }