2015-07-18 02:49:29 -05:00
|
|
|
<?php
|
2022-12-29 12:41:57 -06:00
|
|
|
|
2016-05-20 05:27:31 -05:00
|
|
|
/**
|
|
|
|
* AttachmentHelperInterface.php
|
2020-01-28 01:46:01 -06:00
|
|
|
* Copyright (c) 2019 james@firefly-iii.org
|
2016-05-20 05:27:31 -05:00
|
|
|
*
|
2019-10-01 23:37:26 -05:00
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
2016-10-04 23:52:15 -05:00
|
|
|
*
|
2019-10-01 23:37:26 -05:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
2017-10-21 01:40:00 -05:00
|
|
|
*
|
2019-10-01 23:37:26 -05:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2017-10-21 01:40:00 -05:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-10-01 23:37:26 -05:00
|
|
|
* GNU Affero General Public License for more details.
|
2017-10-21 01:40:00 -05:00
|
|
|
*
|
2019-10-01 23:37:26 -05:00
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2016-05-20 05:27:31 -05:00
|
|
|
*/
|
2017-03-24 09:15:12 -05:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2015-07-18 02:49:29 -05:00
|
|
|
namespace FireflyIII\Helpers\Attachments;
|
|
|
|
|
2015-07-18 14:32:31 -05:00
|
|
|
use FireflyIII\Models\Attachment;
|
2017-04-28 11:04:57 -05:00
|
|
|
use Illuminate\Support\Collection;
|
2015-07-18 02:49:29 -05:00
|
|
|
use Illuminate\Support\MessageBag;
|
|
|
|
|
|
|
|
/**
|
2017-11-15 05:25:49 -06:00
|
|
|
* Interface AttachmentHelperInterface.
|
2015-07-18 02:49:29 -05:00
|
|
|
*/
|
|
|
|
interface AttachmentHelperInterface
|
|
|
|
{
|
|
|
|
/**
|
2018-07-07 14:17:46 -05:00
|
|
|
* Get content of an attachment.
|
|
|
|
*
|
2023-06-21 05:34:58 -05:00
|
|
|
* @param Attachment $attachment
|
2015-07-18 02:49:29 -05:00
|
|
|
*
|
2016-02-18 00:21:48 -06:00
|
|
|
* @return string
|
2015-07-18 02:49:29 -05:00
|
|
|
*/
|
2018-06-06 14:23:00 -05:00
|
|
|
public function getAttachmentContent(Attachment $attachment): string;
|
2015-07-18 02:49:29 -05:00
|
|
|
|
2018-05-06 09:19:29 -05:00
|
|
|
/**
|
2018-07-07 14:17:46 -05:00
|
|
|
* Get the location of an attachment.
|
|
|
|
*
|
2023-06-21 05:34:58 -05:00
|
|
|
* @param Attachment $attachment
|
2018-05-06 09:19:29 -05:00
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2018-06-06 14:23:00 -05:00
|
|
|
public function getAttachmentLocation(Attachment $attachment): string;
|
2018-05-06 09:19:29 -05:00
|
|
|
|
2017-04-28 11:04:57 -05:00
|
|
|
/**
|
2018-07-07 14:17:46 -05:00
|
|
|
* Get all attachments.
|
|
|
|
*
|
2017-04-28 11:04:57 -05:00
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getAttachments(): Collection;
|
|
|
|
|
2015-07-18 02:49:29 -05:00
|
|
|
/**
|
2018-07-07 14:17:46 -05:00
|
|
|
* Get all errors.
|
|
|
|
*
|
2015-07-18 02:49:29 -05:00
|
|
|
* @return MessageBag
|
|
|
|
*/
|
2016-02-18 00:21:48 -06:00
|
|
|
public function getErrors(): MessageBag;
|
2015-07-18 02:49:29 -05:00
|
|
|
|
|
|
|
/**
|
2018-07-07 14:17:46 -05:00
|
|
|
* Get all messages/
|
|
|
|
*
|
2015-07-18 02:49:29 -05:00
|
|
|
* @return MessageBag
|
|
|
|
*/
|
2016-02-18 00:21:48 -06:00
|
|
|
public function getMessages(): MessageBag;
|
2015-07-18 02:49:29 -05:00
|
|
|
|
2018-06-23 23:51:22 -05:00
|
|
|
/**
|
|
|
|
* Uploads a file as a string.
|
|
|
|
*
|
2023-06-21 05:34:58 -05:00
|
|
|
* @param Attachment $attachment
|
|
|
|
* @param string $content
|
2018-06-23 23:51:22 -05:00
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function saveAttachmentFromApi(Attachment $attachment, string $content): bool;
|
|
|
|
|
2015-07-18 14:32:31 -05:00
|
|
|
/**
|
2018-07-07 14:17:46 -05:00
|
|
|
* Save attachments that got uploaded.
|
|
|
|
*
|
2023-06-21 05:34:58 -05:00
|
|
|
* @param object $model
|
|
|
|
* @param null|array $files
|
2017-02-24 22:57:01 -06:00
|
|
|
*
|
2016-01-19 06:59:54 -06:00
|
|
|
* @return bool
|
2015-07-18 14:32:31 -05:00
|
|
|
*/
|
2018-09-22 23:57:37 -05:00
|
|
|
public function saveAttachmentsForModel(object $model, ?array $files): bool;
|
2015-07-19 02:38:44 -05:00
|
|
|
}
|