dansup/pixelfed-php

Pixelfed PHP SDK

v1.0.0 2020-02-11 04:09 UTC

This package is auto-updated.

Last update: 2024-09-23 14:28:47 UTC


README

PHP 库用于 Pixelfed

安装

使用Composer安装

composer require dansup/pixelfed-php

身份验证

您需要一个 Pixelfed 实例的令牌。转到 Pixelfed 实例上的 /settings/applications 并生成一个新的 Personal Access Tokens。使用该令牌进行身份验证。

示例

Nodeinfo

php -f examples/nodeinfo.php

方法

user()

返回当前用户。

GET /api/v1/accounts/verify_credentials

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->user();

accountById($id)

通过用户 ID 获取账户。

GET /api/v1/accounts/{$id}

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountById($id);

accountFollowersById($id)

通过用户 ID 获取账户关注者。

GET /api/v1/accounts/{$id}/followers

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountFollowersById($id);

accountFollowingById($id)

通过用户 ID 获取账户关注列表。

GET /api/v1/accounts/{$id}/following

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountFollowingById($id);

accountStatusesById($id)

通过用户 ID 获取账户状态。

GET /api/v1/accounts/{$id}/statuses

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountStatusesById($id);

accountSearch($id)

通过搜索查询获取账户。

GET /api/v1/accounts/search?q={$id}

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountSearch($id);

accountBlocks()

获取当前用户账户的屏蔽列表。

GET /api/v1/blocks

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountBlocks();

accountLikes()

获取当前用户的点赞。

GET /api/v1/favourites

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountLikes();

accountFollowRequests()

获取当前用户的关注请求。

GET /api/v1/follow_requests

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountFollowRequests();

instance()

获取 Pixelfed 实例数据。

GET /api/v1/instance

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->instance();

accountMutes()

获取当前用户的静音列表。

GET /api/v1/mutes

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountMutes();

accountNotifications()

获取当前用户的通知。

GET /api/v1/notifications

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountNotifications();

homeTimeline()

获取主页时间线。

GET /api/v1/timelines/home

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->homeTimeline();

publicTimeline()

获取公共时间线。

GET /api/v1/timelines/public

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->publicTimeline();

statusById($id)

通过 ID 获取状态。

GET /api/v1/statuses/{$id}

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusById($id);

statusRebloggedById($id)

通过状态 ID 获取重新发布/分享。

GET /api/v1/statuses/{$id}/reblogged_by

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusRebloggedById($id);

statusLikedById($id)

通过状态 ID 获取点赞。

GET /api/v1/statuses/{$id}/favourited_by

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusLikedById($id);

followAccountById($id)

通过 ID 关注账户。

POST /api/v1/accounts/{$id}/follow

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->followAccountById($id);

unfollowAccountById($id)

通过 ID 取消关注账户。

POST /api/v1/accounts/{$id}/unfollow

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->unfollowAccountById($id);

accountBlockById($id)

通过 ID 屏蔽账户。

POST /api/v1/accounts/{$id}/block

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountBlockById($id);

accountUnblockById($id)

通过 ID 解除屏蔽。

POST /api/v1/accounts/{$id}/unblock

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountUnblockById($id);

statusFavouriteById($id)

通过 ID 点赞状态。

POST /api/v1/statuses/{$id}/favourite

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusFavouriteById($id);

statusUnfavouriteById($id)

通过 ID 取消点赞状态。

POST /api/v1/statuses/{$id}/unfavourite

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusUnfavouriteById($id);

mediaUpload($file)

上传媒体。

POST /api/v1/media

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->mediaUpload($file);

accountMuteById($id)

通过 ID 静音账户。

POST /api/v1/accounts/{$id}/mute

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountMuteById($id);

accountUnmuteById($id)

通过 ID 解除静音。

POST /api/v1/accounts/{$id}/unmute

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountUnmuteById($id);

statusCreate($mediaIds = [], $caption = null, $sensitive = false, $scope = 'public', $inReplyToId = null)

创建新状态,需要 $mediaIds 来自 mediaUpload()

POST /api/v1/statuses

AUTHENTICATION REQUIRED

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusCreate($mediaIds, $caption = null, $sensitive = false, $scope = 'public', $inReplyToId = null);

nodeinfo()

获取实例 nodeinfo。

GET /api/nodeinfo/2.0.json

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$api = new PixelfedApi($domain);
$data = $api->nodeinfo();

变更日志

有关最近更改的更多信息,请参阅 CHANGELOG

贡献

请参阅CONTRIBUTING获取详细信息。

致谢