2015-07-18 09:49:29 +02:00
|
|
|
<?php
|
2016-05-20 12:27:31 +02:00
|
|
|
/**
|
|
|
|
* AttachmentHelperInterface.php
|
2020-01-28 08:46:01 +01:00
|
|
|
* Copyright (c) 2019 james@firefly-iii.org
|
2016-05-20 12:27:31 +02:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
2016-10-05 06:52:15 +02:00
|
|
|
*
|
2019-10-02 06:37:26 +02: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 08:40:00 +02:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2017-10-21 08:40:00 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-10-02 06:37:26 +02:00
|
|
|
* GNU Affero General Public License for more details.
|
2017-10-21 08:40:00 +02:00
|
|
|
*
|
2019-10-02 06:37:26 +02: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 12:27:31 +02:00
|
|
|
*/
|
2017-03-24 15:15:12 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2015-07-18 09:49:29 +02:00
|
|
|
namespace FireflyIII\Helpers\Attachments;
|
|
|
|
|
2015-07-18 21:32:31 +02:00
|
|
|
use FireflyIII\Models\Attachment;
|
2017-04-28 18:04:57 +02:00
|
|
|
use Illuminate\Support\Collection;
|
2015-07-18 09:49:29 +02:00
|
|
|
use Illuminate\Support\MessageBag;
|
|
|
|
|
|
|
|
/**
|
2017-11-15 12:25:49 +01:00
|
|
|
* Interface AttachmentHelperInterface.
|
2015-07-18 09:49:29 +02:00
|
|
|
*/
|
|
|
|
interface AttachmentHelperInterface
|
|
|
|
{
|
|
|
|
/**
|
2018-07-07 21:17:46 +02:00
|
|
|
* Get content of an attachment.
|
|
|
|
*
|
2016-01-19 13:59:54 +01:00
|
|
|
* @param Attachment $attachment
|
2015-07-18 09:49:29 +02:00
|
|
|
*
|
2016-02-18 07:21:48 +01:00
|
|
|
* @return string
|
2015-07-18 09:49:29 +02:00
|
|
|
*/
|
2018-06-06 21:23:00 +02:00
|
|
|
public function getAttachmentContent(Attachment $attachment): string;
|
2015-07-18 09:49:29 +02:00
|
|
|
|
2018-05-06 16:19:29 +02:00
|
|
|
/**
|
2018-07-07 21:17:46 +02:00
|
|
|
* Get the location of an attachment.
|
|
|
|
*
|
2018-05-06 16:19:29 +02:00
|
|
|
* @param Attachment $attachment
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2018-06-06 21:23:00 +02:00
|
|
|
public function getAttachmentLocation(Attachment $attachment): string;
|
2018-05-06 16:19:29 +02:00
|
|
|
|
2017-04-28 18:04:57 +02:00
|
|
|
/**
|
2018-07-07 21:17:46 +02:00
|
|
|
* Get all attachments.
|
|
|
|
*
|
2017-04-28 18:04:57 +02:00
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getAttachments(): Collection;
|
|
|
|
|
2015-07-18 09:49:29 +02:00
|
|
|
/**
|
2018-07-07 21:17:46 +02:00
|
|
|
* Get all errors.
|
|
|
|
*
|
2015-07-18 09:49:29 +02:00
|
|
|
* @return MessageBag
|
|
|
|
*/
|
2016-02-18 07:21:48 +01:00
|
|
|
public function getErrors(): MessageBag;
|
2015-07-18 09:49:29 +02:00
|
|
|
|
|
|
|
/**
|
2018-07-07 21:17:46 +02:00
|
|
|
* Get all messages/
|
|
|
|
*
|
2015-07-18 09:49:29 +02:00
|
|
|
* @return MessageBag
|
|
|
|
*/
|
2016-02-18 07:21:48 +01:00
|
|
|
public function getMessages(): MessageBag;
|
2015-07-18 09:49:29 +02:00
|
|
|
|
2018-06-24 06:51:22 +02:00
|
|
|
/**
|
|
|
|
* Uploads a file as a string.
|
|
|
|
*
|
|
|
|
* @param Attachment $attachment
|
|
|
|
* @param string $content
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function saveAttachmentFromApi(Attachment $attachment, string $content): bool;
|
|
|
|
|
2015-07-18 21:32:31 +02:00
|
|
|
/**
|
2018-07-07 21:17:46 +02:00
|
|
|
* Save attachments that got uploaded.
|
|
|
|
*
|
2018-09-23 06:57:37 +02:00
|
|
|
* @param object $model
|
2017-02-25 17:39:50 +01:00
|
|
|
* @param null|array $files
|
2017-02-25 05:57:01 +01:00
|
|
|
*
|
2016-01-19 13:59:54 +01:00
|
|
|
* @return bool
|
2015-07-18 21:32:31 +02:00
|
|
|
*/
|
2018-09-23 06:57:37 +02:00
|
|
|
public function saveAttachmentsForModel(object $model, ?array $files): bool;
|
2015-07-19 09:38:44 +02:00
|
|
|
}
|