--- /dev/null
- public static function rawContent(array $parameters = [])
+<?php
+/**
+ * @copyright Copyright (C) 2010-2021, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * 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/>.
+ *
+ */
+
+namespace Friendica\Module\Api\Twitter\Followers;
+
+use Friendica\Core\System;
+use Friendica\Model\Contact;
+use Friendica\Module\Api\Twitter\ContactEndpoint;
+
+/**
+ * @see https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids
+ */
+class FollowersIds extends ContactEndpoint
+{
++ public function rawContent()
+ {
+ // Expected value for user_id parameter: public/user contact id
+ $contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);
+ $screen_name = filter_input(INPUT_GET, 'screen_name');
+ $cursor = filter_input(INPUT_GET, 'cursor' , FILTER_VALIDATE_INT);
+ $stringify_ids = filter_input(INPUT_GET, 'stringify_ids', FILTER_VALIDATE_BOOLEAN);
+ $count = filter_input(INPUT_GET, 'count' , FILTER_VALIDATE_INT, ['options' => [
+ 'default' => self::DEFAULT_COUNT,
+ 'min_range' => 1,
+ 'max_range' => self::MAX_COUNT,
+ ]]);
+ // Friendica-specific
+ $since_id = filter_input(INPUT_GET, 'since_id' , FILTER_VALIDATE_INT);
+ $max_id = filter_input(INPUT_GET, 'max_id' , FILTER_VALIDATE_INT, ['options' => [
+ 'default' => 1,
+ ]]);
+
+ // @todo Use Model\Contact\Relation::listFollowers($cid, $condition, $count);
+
+ System::jsonExit(self::ids(
+ [Contact::FOLLOWER, Contact::FRIEND],
+ self::getUid($contact_id, $screen_name),
+ $cursor ?? $since_id ?? - $max_id,
+ $count,
+ $stringify_ids
+ ));
+ }
+}
--- /dev/null
- public static function rawContent(array $parameters = [])
+<?php
+/**
+ * @copyright Copyright (C) 2010-2021, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * 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/>.
+ *
+ */
+
+namespace Friendica\Module\Api\Twitter\Followers;
+
+use Friendica\Core\System;
+use Friendica\Model\Contact;
+use Friendica\Module\Api\Twitter\ContactEndpoint;
+
+/**
+ * @see https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-list
+ */
+class FollowersList extends ContactEndpoint
+{
++ public function rawContent()
+ {
+ // Expected value for user_id parameter: public/user contact id
+ $contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);
+ $screen_name = filter_input(INPUT_GET, 'screen_name');
+ $cursor = filter_input(INPUT_GET, 'cursor' , FILTER_VALIDATE_INT);
+ $count = filter_input(INPUT_GET, 'count' , FILTER_VALIDATE_INT, ['options' => [
+ 'default' => self::DEFAULT_COUNT,
+ 'min_range' => 1,
+ 'max_range' => self::MAX_COUNT,
+ ]]);
+ $skip_status = filter_input(INPUT_GET, 'skip_status' , FILTER_VALIDATE_BOOLEAN);
+ $include_user_entities = filter_input(INPUT_GET, 'include_user_entities', FILTER_VALIDATE_BOOLEAN);
+
+ // Friendica-specific
+ $since_id = filter_input(INPUT_GET, 'since_id' , FILTER_VALIDATE_INT);
+ $max_id = filter_input(INPUT_GET, 'max_id' , FILTER_VALIDATE_INT, ['options' => [
+ 'default' => 1,
+ ]]);
+
+ // @todo Use Model\Contact\Relation::listFollowers($cid, $condition, $count);
+
+ System::jsonExit(self::list(
+ [Contact::FOLLOWER, Contact::FRIEND],
+ self::getUid($contact_id, $screen_name),
+ $cursor ?? $since_id ?? - $max_id,
+ $count,
+ $skip_status,
+ $include_user_entities
+ ));
+ }
+}
--- /dev/null
- public static function rawContent(array $parameters = [])
+<?php
+/**
+ * @copyright Copyright (C) 2010-2021, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * 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/>.
+ *
+ */
+
+namespace Friendica\Module\Api\Twitter\Friends;
+
+use Friendica\Core\System;
+use Friendica\Model\Contact;
+use Friendica\Module\Api\Twitter\ContactEndpoint;
+
+/**
+ * @see https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-ids
+ */
+class Ids extends ContactEndpoint
+{
++ public function rawContent()
+ {
+ // Expected value for user_id parameter: public/user contact id
+ $contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);
+ $screen_name = filter_input(INPUT_GET, 'screen_name');
+ $cursor = filter_input(INPUT_GET, 'cursor' , FILTER_VALIDATE_INT);
+ $stringify_ids = filter_input(INPUT_GET, 'stringify_ids', FILTER_VALIDATE_BOOLEAN);
+ $count = filter_input(INPUT_GET, 'count' , FILTER_VALIDATE_INT, ['options' => [
+ 'default' => self::DEFAULT_COUNT,
+ 'min_range' => 1,
+ 'max_range' => self::MAX_COUNT,
+ ]]);
+ // Friendica-specific
+ $since_id = filter_input(INPUT_GET, 'since_id' , FILTER_VALIDATE_INT);
+ $max_id = filter_input(INPUT_GET, 'max_id' , FILTER_VALIDATE_INT, ['options' => [
+ 'default' => 1,
+ ]]);
+
+ // @todo Use Model\Contact\Relation::listFollows($cid, $condition, $count);
+
+ System::jsonExit(self::ids(
+ [Contact::SHARING, Contact::FRIEND],
+ self::getUid($contact_id, $screen_name),
+ $cursor ?? $since_id ?? - $max_id,
+ $count,
+ $stringify_ids
+ ));
+ }
+}
--- /dev/null
- public static function rawContent(array $parameters = [])
+<?php
+/**
+ * @copyright Copyright (C) 2010-2021, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * 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/>.
+ *
+ */
+
+namespace Friendica\Module\Api\Twitter\Friends;
+
+use Friendica\Core\System;
+use Friendica\Model\Contact;
+use Friendica\Module\Api\Twitter\ContactEndpoint;
+
+/**
+ * @see https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-list
+ */
+class Lists extends ContactEndpoint
+{
++ public function rawContent()
+ {
+ // Expected value for user_id parameter: public/user contact id
+ $contact_id = filter_input(INPUT_GET, 'user_id' , FILTER_VALIDATE_INT);
+ $screen_name = filter_input(INPUT_GET, 'screen_name');
+ $cursor = filter_input(INPUT_GET, 'cursor' , FILTER_VALIDATE_INT);
+ $count = filter_input(INPUT_GET, 'count' , FILTER_VALIDATE_INT, ['options' => [
+ 'default' => self::DEFAULT_COUNT,
+ 'min_range' => 1,
+ 'max_range' => self::MAX_COUNT,
+ ]]);
+ $skip_status = filter_input(INPUT_GET, 'skip_status' , FILTER_VALIDATE_BOOLEAN);
+ $include_user_entities = filter_input(INPUT_GET, 'include_user_entities', FILTER_VALIDATE_BOOLEAN);
+
+ // Friendica-specific
+ $since_id = filter_input(INPUT_GET, 'since_id' , FILTER_VALIDATE_INT);
+ $max_id = filter_input(INPUT_GET, 'max_id' , FILTER_VALIDATE_INT, ['options' => [
+ 'default' => 1,
+ ]]);
+
+ // @todo Use Model\Contact\Relation::listFollows($cid, $condition, $count);
+
+ System::jsonExit(self::list(
+ [Contact::SHARING, Contact::FRIEND],
+ self::getUid($contact_id, $screen_name),
+ $cursor ?? $since_id ?? - $max_id,
+ $count,
+ $skip_status,
+ $include_user_entities
+ ));
+ }
+}