2020-11-29 11:35:49 -06:00
|
|
|
<?php
|
2021-01-29 11:50:35 -06:00
|
|
|
/*
|
|
|
|
* WebhookRepositoryInterface.php
|
|
|
|
* Copyright (c) 2021 james@firefly-iii.org
|
|
|
|
*
|
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2020-12-21 22:35:06 -06:00
|
|
|
declare(strict_types=1);
|
2020-11-29 11:35:49 -06:00
|
|
|
|
|
|
|
namespace FireflyIII\Repositories\Webhook;
|
|
|
|
|
|
|
|
use FireflyIII\Models\Webhook;
|
2021-03-07 05:13:22 -06:00
|
|
|
use FireflyIII\Models\WebhookAttempt;
|
|
|
|
use FireflyIII\Models\WebhookMessage;
|
2020-11-29 11:35:49 -06:00
|
|
|
use FireflyIII\User;
|
2023-02-19 01:43:28 -06:00
|
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
2020-11-29 11:35:49 -06:00
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface WebhookRepositoryInterface
|
|
|
|
*/
|
|
|
|
interface WebhookRepositoryInterface
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Return all webhooks.
|
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function all(): Collection;
|
|
|
|
|
|
|
|
/**
|
2022-12-29 12:42:26 -06:00
|
|
|
* @param Webhook $webhook
|
2020-11-29 11:35:49 -06:00
|
|
|
*/
|
2021-03-11 23:20:01 -06:00
|
|
|
public function destroy(Webhook $webhook): void;
|
2020-11-29 11:35:49 -06:00
|
|
|
|
|
|
|
/**
|
2022-12-29 12:42:26 -06:00
|
|
|
* @param WebhookAttempt $attempt
|
2020-11-29 11:35:49 -06:00
|
|
|
*/
|
2021-03-11 23:20:01 -06:00
|
|
|
public function destroyAttempt(WebhookAttempt $attempt): void;
|
2020-11-29 11:35:49 -06:00
|
|
|
|
2021-03-07 05:13:22 -06:00
|
|
|
/**
|
2022-12-29 12:42:26 -06:00
|
|
|
* @param WebhookMessage $message
|
2021-03-07 05:13:22 -06:00
|
|
|
*/
|
|
|
|
public function destroyMessage(WebhookMessage $message): void;
|
|
|
|
|
|
|
|
/**
|
2022-12-29 12:42:26 -06:00
|
|
|
* @param WebhookMessage $webhookMessage
|
2021-03-11 23:20:01 -06:00
|
|
|
*
|
|
|
|
* @return Collection
|
2021-03-07 05:13:22 -06:00
|
|
|
*/
|
2021-03-11 23:20:01 -06:00
|
|
|
public function getAttempts(WebhookMessage $webhookMessage): Collection;
|
2021-03-07 05:13:22 -06:00
|
|
|
|
|
|
|
/**
|
2022-12-29 12:42:26 -06:00
|
|
|
* @param Webhook $webhook
|
2021-03-07 05:13:22 -06:00
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
2021-03-11 23:20:01 -06:00
|
|
|
public function getMessages(Webhook $webhook): Collection;
|
2021-03-07 05:13:22 -06:00
|
|
|
|
|
|
|
/**
|
2022-12-29 12:42:26 -06:00
|
|
|
* @param Webhook $webhook
|
2021-03-07 05:13:22 -06:00
|
|
|
*
|
|
|
|
* @return Collection
|
|
|
|
*/
|
2021-03-11 23:20:01 -06:00
|
|
|
public function getReadyMessages(Webhook $webhook): Collection;
|
2021-03-07 05:13:22 -06:00
|
|
|
|
|
|
|
/**
|
2023-02-19 01:43:28 -06:00
|
|
|
* @param User|Authenticatable|null $user
|
2021-03-07 05:13:22 -06:00
|
|
|
*/
|
2023-02-19 01:43:28 -06:00
|
|
|
public function setUser(User|Authenticatable|null $user): void;
|
2021-03-11 23:20:01 -06:00
|
|
|
|
|
|
|
/**
|
2022-12-29 12:42:26 -06:00
|
|
|
* @param array $data
|
2021-03-11 23:20:01 -06:00
|
|
|
*
|
|
|
|
* @return Webhook
|
|
|
|
*/
|
|
|
|
public function store(array $data): Webhook;
|
|
|
|
|
|
|
|
/**
|
2022-12-29 12:42:26 -06:00
|
|
|
* @param Webhook $webhook
|
|
|
|
* @param array $data
|
2021-03-11 23:20:01 -06:00
|
|
|
*
|
|
|
|
* @return Webhook
|
|
|
|
*/
|
|
|
|
public function update(Webhook $webhook, array $data): Webhook;
|
2020-12-21 22:35:06 -06:00
|
|
|
}
|