federator/php/federator/connector/connector.php
Sascha Nitsch 4cc9cfdc8c converted from date field to timestamp
fixed reloading logic on paging
2025-06-11 03:21:19 +02:00

97 lines
2.7 KiB
PHP

<?php
/**
* SPDX-FileCopyrightText: 2024 Sascha Nitsch (grumpydeveloper) https://contentnation.net/@grumpydevelop
* SPDX-License-Identifier: GPL-3.0-or-later
*
* @author Sascha Nitsch (grumpydeveloper)
**/
namespace Federator\Connector;
/**
* base class for remote authentication
*/
interface Connector
{
/**
* get followers of given user
*
* @param string $id user id
* @return \Federator\Data\FedUser[]|false
*/
public function getRemoteFollowersOfUser($id);
/**
* get following of given user
*
* @param string $id user id
* @return \Federator\Data\FedUser[]|false
*/
public function getRemoteFollowingForUser($id);
/**
* get posts by given user
*
* @param string $id user id
* @param int $min min value
* @param int $max max value
* @param int $limit maximum number of results
* @return \Federator\Data\ActivityPub\Common\Activity[]|false
*/
public function getRemotePostsByUser($id, $min, $max, $limit);
/**
* get remote user by given name
*
* @param string $_name user/profile name
* @return \Federator\Data\User | false
*/
public function getRemoteUserByName(string $_name);
/**
* get remote user by given session
*
* @param string $_session session id
* @param string $_user user/profile name
* @return \Federator\Data\User | false
*/
public function getRemoteUserBySession(string $_session, string $_user);
/**
* get statistics from remote system
*
* @return \Federator\Data\Stats|false
*/
public function getRemoteStats();
/**
* Convert jsonData to Activity format
*
* @param array<string, mixed> $jsonData the json data from our platfrom
* @param string $articleId the original id of the article (if applicable)
* (used to identify the article in the remote system)
* @return \Federator\Data\ActivityPub\Common\Activity|false
*/
public function jsonToActivity(array $jsonData, &$articleId);
/**
* send target-friendly json from ActivityPub activity
*
* @param \Federator\Data\FedUser $sender the user of the sender
* @param \Federator\Data\ActivityPub\Common\Activity $activity the activity
* @return boolean did we successfully send the activity?
*/
public function sendActivity($sender, $activity);
/**
* check if the headers include a valid signature
*
* @param string[] $headers the headers
* @throws \Federator\Exceptions\PermissionDenied
* @return string|\Federator\Exceptions\PermissionDenied
*/
public function checkSignature($headers);
}