+153
src/Client/Requests/Bsky/GraphRequestClient.php
+153
src/Client/Requests/Bsky/GraphRequestClient.php
···
1
+
<?php
2
+
3
+
namespace SocialDept\AtpClient\Client\Requests\Bsky;
4
+
5
+
use SocialDept\AtpClient\Client\Requests\Request;
6
+
use SocialDept\AtpClient\Data\Responses\Bsky\Graph\GetFollowersResponse;
7
+
use SocialDept\AtpClient\Data\Responses\Bsky\Graph\GetFollowsResponse;
8
+
use SocialDept\AtpClient\Data\Responses\Bsky\Graph\GetKnownFollowersResponse;
9
+
use SocialDept\AtpClient\Data\Responses\Bsky\Graph\GetListResponse;
10
+
use SocialDept\AtpClient\Data\Responses\Bsky\Graph\GetListsResponse;
11
+
use SocialDept\AtpClient\Data\Responses\Bsky\Graph\GetRelationshipsResponse;
12
+
use SocialDept\AtpClient\Data\Responses\Bsky\Graph\GetStarterPacksResponse;
13
+
use SocialDept\AtpClient\Data\Responses\Bsky\Graph\GetSuggestedFollowsByActorResponse;
14
+
use SocialDept\AtpClient\Enums\Nsid\BskyGraph;
15
+
use SocialDept\AtpSchema\Generated\App\Bsky\Graph\Defs\StarterPackView;
16
+
17
+
class GraphRequestClient extends Request
18
+
{
19
+
/**
20
+
* Get followers of an actor
21
+
*
22
+
* @see https://docs.bsky.app/docs/api/app-bsky-graph-get-followers
23
+
*/
24
+
public function getFollowers(string $actor, int $limit = 50, ?string $cursor = null): GetFollowersResponse
25
+
{
26
+
$response = $this->atp->client->get(
27
+
endpoint: BskyGraph::GetFollowers,
28
+
params: compact('actor', 'limit', 'cursor')
29
+
);
30
+
31
+
return GetFollowersResponse::fromArray($response->json());
32
+
}
33
+
34
+
/**
35
+
* Get accounts that an actor follows
36
+
*
37
+
* @see https://docs.bsky.app/docs/api/app-bsky-graph-get-follows
38
+
*/
39
+
public function getFollows(string $actor, int $limit = 50, ?string $cursor = null): GetFollowsResponse
40
+
{
41
+
$response = $this->atp->client->get(
42
+
endpoint: BskyGraph::GetFollows,
43
+
params: compact('actor', 'limit', 'cursor')
44
+
);
45
+
46
+
return GetFollowsResponse::fromArray($response->json());
47
+
}
48
+
49
+
/**
50
+
* Get followers of an actor that you also follow
51
+
*
52
+
* @see https://docs.bsky.app/docs/api/app-bsky-graph-get-known-followers
53
+
*/
54
+
public function getKnownFollowers(string $actor, int $limit = 50, ?string $cursor = null): GetKnownFollowersResponse
55
+
{
56
+
$response = $this->atp->client->get(
57
+
endpoint: BskyGraph::GetKnownFollowers,
58
+
params: compact('actor', 'limit', 'cursor')
59
+
);
60
+
61
+
return GetKnownFollowersResponse::fromArray($response->json());
62
+
}
63
+
64
+
/**
65
+
* Get a list by URI
66
+
*
67
+
* @see https://docs.bsky.app/docs/api/app-bsky-graph-get-list
68
+
*/
69
+
public function getList(string $list, int $limit = 50, ?string $cursor = null): GetListResponse
70
+
{
71
+
$response = $this->atp->client->get(
72
+
endpoint: BskyGraph::GetList,
73
+
params: compact('list', 'limit', 'cursor')
74
+
);
75
+
76
+
return GetListResponse::fromArray($response->json());
77
+
}
78
+
79
+
/**
80
+
* Get lists created by an actor
81
+
*
82
+
* @see https://docs.bsky.app/docs/api/app-bsky-graph-get-lists
83
+
*/
84
+
public function getLists(string $actor, int $limit = 50, ?string $cursor = null): GetListsResponse
85
+
{
86
+
$response = $this->atp->client->get(
87
+
endpoint: BskyGraph::GetLists,
88
+
params: compact('actor', 'limit', 'cursor')
89
+
);
90
+
91
+
return GetListsResponse::fromArray($response->json());
92
+
}
93
+
94
+
/**
95
+
* Get relationships between actors
96
+
*
97
+
* @see https://docs.bsky.app/docs/api/app-bsky-graph-get-relationships
98
+
*/
99
+
public function getRelationships(string $actor, array $others = []): GetRelationshipsResponse
100
+
{
101
+
$response = $this->atp->client->get(
102
+
endpoint: BskyGraph::GetRelationships,
103
+
params: compact('actor', 'others')
104
+
);
105
+
106
+
return GetRelationshipsResponse::fromArray($response->json());
107
+
}
108
+
109
+
/**
110
+
* Get a starter pack by URI
111
+
*
112
+
* @see https://docs.bsky.app/docs/api/app-bsky-graph-get-starter-pack
113
+
*/
114
+
public function getStarterPack(string $starterPack): StarterPackView
115
+
{
116
+
$response = $this->atp->client->get(
117
+
endpoint: BskyGraph::GetStarterPack,
118
+
params: compact('starterPack')
119
+
);
120
+
121
+
return StarterPackView::fromArray($response->json()['starterPack']);
122
+
}
123
+
124
+
/**
125
+
* Get multiple starter packs
126
+
*
127
+
* @see https://docs.bsky.app/docs/api/app-bsky-graph-get-starter-packs
128
+
*/
129
+
public function getStarterPacks(array $uris): GetStarterPacksResponse
130
+
{
131
+
$response = $this->atp->client->get(
132
+
endpoint: BskyGraph::GetStarterPacks,
133
+
params: compact('uris')
134
+
);
135
+
136
+
return GetStarterPacksResponse::fromArray($response->json());
137
+
}
138
+
139
+
/**
140
+
* Get suggested follows based on an actor
141
+
*
142
+
* @see https://docs.bsky.app/docs/api/app-bsky-graph-get-suggested-follows-by-actor
143
+
*/
144
+
public function getSuggestedFollowsByActor(string $actor): GetSuggestedFollowsByActorResponse
145
+
{
146
+
$response = $this->atp->client->get(
147
+
endpoint: BskyGraph::GetSuggestedFollowsByActor,
148
+
params: compact('actor')
149
+
);
150
+
151
+
return GetSuggestedFollowsByActorResponse::fromArray($response->json());
152
+
}
153
+
}
+25
src/Client/Requests/Bsky/LabelerRequestClient.php
+25
src/Client/Requests/Bsky/LabelerRequestClient.php
···
1
+
<?php
2
+
3
+
namespace SocialDept\AtpClient\Client\Requests\Bsky;
4
+
5
+
use SocialDept\AtpClient\Client\Requests\Request;
6
+
use SocialDept\AtpClient\Data\Responses\Bsky\Labeler\GetServicesResponse;
7
+
use SocialDept\AtpClient\Enums\Nsid\BskyLabeler;
8
+
9
+
class LabelerRequestClient extends Request
10
+
{
11
+
/**
12
+
* Get labeler services
13
+
*
14
+
* @see https://docs.bsky.app/docs/api/app-bsky-labeler-get-services
15
+
*/
16
+
public function getServices(array $dids, bool $detailed = false): GetServicesResponse
17
+
{
18
+
$response = $this->atp->client->get(
19
+
endpoint: BskyLabeler::GetServices,
20
+
params: compact('dids', 'detailed')
21
+
);
22
+
23
+
return GetServicesResponse::fromArray($response->json(), $detailed);
24
+
}
25
+
}