Laravel AT Protocol Client (alpha & unstable)
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add listReposByCollection to SyncRequestClient

+61
+24
src/Client/Requests/Atproto/SyncRequestClient.php
··· 7 7 use SocialDept\AtpClient\Client\Requests\Request; 8 8 use SocialDept\AtpClient\Data\Responses\Atproto\Sync\GetRepoStatusResponse; 9 9 use SocialDept\AtpClient\Data\Responses\Atproto\Sync\ListBlobsResponse; 10 + use SocialDept\AtpClient\Data\Responses\Atproto\Sync\ListReposByCollectionResponse; 10 11 use SocialDept\AtpClient\Data\Responses\Atproto\Sync\ListReposResponse; 11 12 use SocialDept\AtpClient\Enums\Nsid\AtprotoSync; 12 13 use SocialDept\AtpClient\Enums\Scope; ··· 63 64 ); 64 65 65 66 return ListReposResponse::fromArray($response->json()); 67 + } 68 + 69 + /** 70 + * Enumerates all the DIDs with records in a specific collection 71 + * 72 + * @requires atproto (rpc:com.atproto.sync.listReposByCollection) 73 + * 74 + * @see https://docs.bsky.app/docs/api/com-atproto-sync-list-repos-by-collection 75 + */ 76 + #[RequiresScope(Scope::Atproto, granular: 'rpc:com.atproto.sync.listReposByCollection')] 77 + public function listReposByCollection( 78 + string|BackedEnum $collection, 79 + int $limit = 500, 80 + ?string $cursor = null 81 + ): ListReposByCollectionResponse { 82 + $collection = $collection instanceof BackedEnum ? $collection->value : $collection; 83 + 84 + $response = $this->atp->client->get( 85 + endpoint: AtprotoSync::ListReposByCollection, 86 + params: compact('collection', 'limit', 'cursor') 87 + ); 88 + 89 + return ListReposByCollectionResponse::fromArray($response->json()); 66 90 } 67 91 68 92 /**
+36
src/Data/Responses/Atproto/Sync/ListReposByCollectionResponse.php
··· 1 + <?php 2 + 3 + namespace SocialDept\AtpClient\Data\Responses\Atproto\Sync; 4 + 5 + use Illuminate\Contracts\Support\Arrayable; 6 + use Illuminate\Support\Collection; 7 + 8 + /** 9 + * @implements Arrayable<string, mixed> 10 + */ 11 + class ListReposByCollectionResponse implements Arrayable 12 + { 13 + /** 14 + * @param Collection<int, array{did: string, rev: string}> $repos 15 + */ 16 + public function __construct( 17 + public readonly Collection $repos, 18 + public readonly ?string $cursor = null, 19 + ) {} 20 + 21 + public static function fromArray(array $data): self 22 + { 23 + return new self( 24 + repos: collect($data['repos'] ?? []), 25 + cursor: $data['cursor'] ?? null, 26 + ); 27 + } 28 + 29 + public function toArray(): array 30 + { 31 + return [ 32 + 'repos' => $this->repos->all(), 33 + 'cursor' => $this->cursor, 34 + ]; 35 + } 36 + }
+1
src/Enums/Nsid/AtprotoSync.php
··· 10 10 case GetBlob = 'com.atproto.sync.getBlob'; 11 11 case GetRepo = 'com.atproto.sync.getRepo'; 12 12 case ListRepos = 'com.atproto.sync.listRepos'; 13 + case ListReposByCollection = 'com.atproto.sync.listReposByCollection'; 13 14 case GetLatestCommit = 'com.atproto.sync.getLatestCommit'; 14 15 case GetRecord = 'com.atproto.sync.getRecord'; 15 16 case ListBlobs = 'com.atproto.sync.listBlobs';