Laravel AT Protocol Client (alpha & unstable)

Merge branch 'refs/heads/dev'

+8 -9
src/Data/RecordCollection.php
··· 3 3 namespace SocialDept\AtpClient\Data; 4 4 5 5 use Illuminate\Contracts\Support\Arrayable; 6 + use Illuminate\Support\Collection; 6 7 7 8 /** 8 9 * Collection wrapper for paginated AT Protocol records. ··· 13 14 class RecordCollection implements Arrayable 14 15 { 15 16 /** 16 - * @param array<Record<T>> $records 17 + * @param Collection<int, Record<T>> $records 17 18 */ 18 19 public function __construct( 19 - public readonly array $records, 20 + public readonly Collection $records, 20 21 public readonly ?string $cursor = null, 21 22 ) {} 22 23 ··· 29 30 public static function fromArray(array $data, callable $transformer): self 30 31 { 31 32 return new self( 32 - records: array_map( 33 - fn (array $record) => Record::fromArray($record, $transformer), 34 - $data['records'] ?? [] 33 + records: collect($data['records'] ?? [])->map( 34 + fn (array $record) => Record::fromArray($record, $transformer) 35 35 ), 36 36 cursor: $data['cursor'] ?? null, 37 37 ); ··· 43 43 public static function fromArrayRaw(array $data): self 44 44 { 45 45 return new self( 46 - records: array_map( 47 - fn (array $record) => Record::fromArrayRaw($record), 48 - $data['records'] ?? [] 46 + records: collect($data['records'] ?? [])->map( 47 + fn (array $record) => Record::fromArrayRaw($record) 49 48 ), 50 49 cursor: $data['cursor'] ?? null, 51 50 ); ··· 54 53 public function toArray(): array 55 54 { 56 55 return [ 57 - 'records' => array_map(fn (Record $r) => $r->toArray(), $this->records), 56 + 'records' => $this->records->map(fn (Record $r) => $r->toArray())->all(), 58 57 'cursor' => $this->cursor, 59 58 ]; 60 59 }
+5 -3
src/Data/Responses/Atproto/Repo/ListRecordsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Atproto\Repo; 4 4 5 + use Illuminate\Support\Collection; 6 + 5 7 class ListRecordsResponse 6 8 { 7 9 /** 8 - * @param array<array{uri: string, cid: string, value: mixed}> $records 10 + * @param Collection<int, array{uri: string, cid: string, value: mixed}> $records 9 11 */ 10 12 public function __construct( 11 - public readonly array $records, 13 + public readonly Collection $records, 12 14 public readonly ?string $cursor = null, 13 15 ) {} 14 16 15 17 public static function fromArray(array $data): self 16 18 { 17 19 return new self( 18 - records: $data['records'] ?? [], 20 + records: collect($data['records'] ?? []), 19 21 cursor: $data['cursor'] ?? null, 20 22 ); 21 23 }
+5 -3
src/Data/Responses/Atproto/Sync/ListReposResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Atproto\Sync; 4 4 5 + use Illuminate\Support\Collection; 6 + 5 7 class ListReposResponse 6 8 { 7 9 /** 8 - * @param array<array{did: string, head: string, rev: string, active?: bool, status?: string}> $repos 10 + * @param Collection<int, array{did: string, head: string, rev: string, active?: bool, status?: string}> $repos 9 11 */ 10 12 public function __construct( 11 - public readonly array $repos, 13 + public readonly Collection $repos, 12 14 public readonly ?string $cursor = null, 13 15 ) {} 14 16 15 17 public static function fromArray(array $data): self 16 18 { 17 19 return new self( 18 - repos: $data['repos'] ?? [], 20 + repos: collect($data['repos'] ?? []), 19 21 cursor: $data['cursor'] ?? null, 20 22 ); 21 23 }
+5 -5
src/Data/Responses/Bsky/Actor/GetProfilesResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Actor; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileViewDetailed; 6 7 7 8 class GetProfilesResponse 8 9 { 9 10 /** 10 - * @param array<ProfileViewDetailed> $profiles 11 + * @param Collection<int, ProfileViewDetailed> $profiles 11 12 */ 12 13 public function __construct( 13 - public readonly array $profiles, 14 + public readonly Collection $profiles, 14 15 ) {} 15 16 16 17 public static function fromArray(array $data): self 17 18 { 18 19 return new self( 19 - profiles: array_map( 20 - fn (array $profile) => ProfileViewDetailed::fromArray($profile), 21 - $data['profiles'] ?? [] 20 + profiles: collect($data['profiles'] ?? [])->map( 21 + fn (array $profile) => ProfileViewDetailed::fromArray($profile) 22 22 ), 23 23 ); 24 24 }
+5 -5
src/Data/Responses/Bsky/Actor/GetSuggestionsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Actor; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileView; 6 7 7 8 class GetSuggestionsResponse 8 9 { 9 10 /** 10 - * @param array<ProfileView> $actors 11 + * @param Collection<int, ProfileView> $actors 11 12 */ 12 13 public function __construct( 13 - public readonly array $actors, 14 + public readonly Collection $actors, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - actors: array_map( 21 - fn (array $actor) => ProfileView::fromArray($actor), 22 - $data['actors'] ?? [] 21 + actors: collect($data['actors'] ?? [])->map( 22 + fn (array $actor) => ProfileView::fromArray($actor) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Bsky/Actor/SearchActorsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Actor; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileView; 6 7 7 8 class SearchActorsResponse 8 9 { 9 10 /** 10 - * @param array<ProfileView> $actors 11 + * @param Collection<int, ProfileView> $actors 11 12 */ 12 13 public function __construct( 13 - public readonly array $actors, 14 + public readonly Collection $actors, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - actors: array_map( 21 - fn (array $actor) => ProfileView::fromArray($actor), 22 - $data['actors'] ?? [] 21 + actors: collect($data['actors'] ?? [])->map( 22 + fn (array $actor) => ProfileView::fromArray($actor) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Bsky/Actor/SearchActorsTypeaheadResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Actor; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileViewBasic; 6 7 7 8 class SearchActorsTypeaheadResponse 8 9 { 9 10 /** 10 - * @param array<ProfileViewBasic> $actors 11 + * @param Collection<int, ProfileViewBasic> $actors 11 12 */ 12 13 public function __construct( 13 - public readonly array $actors, 14 + public readonly Collection $actors, 14 15 ) {} 15 16 16 17 public static function fromArray(array $data): self 17 18 { 18 19 return new self( 19 - actors: array_map( 20 - fn (array $actor) => ProfileViewBasic::fromArray($actor), 21 - $data['actors'] ?? [] 20 + actors: collect($data['actors'] ?? [])->map( 21 + fn (array $actor) => ProfileViewBasic::fromArray($actor) 22 22 ), 23 23 ); 24 24 }
+5 -5
src/Data/Responses/Bsky/Feed/GetActorFeedsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\GeneratorView; 6 7 7 8 class GetActorFeedsResponse 8 9 { 9 10 /** 10 - * @param array<GeneratorView> $feeds 11 + * @param Collection<int, GeneratorView> $feeds 11 12 */ 12 13 public function __construct( 13 - public readonly array $feeds, 14 + public readonly Collection $feeds, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - feeds: array_map( 21 - fn (array $feed) => GeneratorView::fromArray($feed), 22 - $data['feeds'] ?? [] 21 + feeds: collect($data['feeds'] ?? [])->map( 22 + fn (array $feed) => GeneratorView::fromArray($feed) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Bsky/Feed/GetActorLikesResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\FeedViewPost; 6 7 7 8 class GetActorLikesResponse 8 9 { 9 10 /** 10 - * @param array<FeedViewPost> $feed 11 + * @param Collection<int, FeedViewPost> $feed 11 12 */ 12 13 public function __construct( 13 - public readonly array $feed, 14 + public readonly Collection $feed, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - feed: array_map( 21 - fn (array $post) => FeedViewPost::fromArray($post), 22 - $data['feed'] ?? [] 21 + feed: collect($data['feed'] ?? [])->map( 22 + fn (array $post) => FeedViewPost::fromArray($post) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Bsky/Feed/GetAuthorFeedResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\FeedViewPost; 6 7 7 8 class GetAuthorFeedResponse 8 9 { 9 10 /** 10 - * @param array<FeedViewPost> $feed 11 + * @param Collection<int, FeedViewPost> $feed 11 12 */ 12 13 public function __construct( 13 - public readonly array $feed, 14 + public readonly Collection $feed, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - feed: array_map( 21 - fn (array $post) => FeedViewPost::fromArray($post), 22 - $data['feed'] ?? [] 21 + feed: collect($data['feed'] ?? [])->map( 22 + fn (array $post) => FeedViewPost::fromArray($post) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Bsky/Feed/GetFeedGeneratorsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\GeneratorView; 6 7 7 8 class GetFeedGeneratorsResponse 8 9 { 9 10 /** 10 - * @param array<GeneratorView> $feeds 11 + * @param Collection<int, GeneratorView> $feeds 11 12 */ 12 13 public function __construct( 13 - public readonly array $feeds, 14 + public readonly Collection $feeds, 14 15 ) {} 15 16 16 17 public static function fromArray(array $data): self 17 18 { 18 19 return new self( 19 - feeds: array_map( 20 - fn (array $feed) => GeneratorView::fromArray($feed), 21 - $data['feeds'] ?? [] 20 + feeds: collect($data['feeds'] ?? [])->map( 21 + fn (array $feed) => GeneratorView::fromArray($feed) 22 22 ), 23 23 ); 24 24 }
+5 -5
src/Data/Responses/Bsky/Feed/GetFeedResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\FeedViewPost; 6 7 7 8 class GetFeedResponse 8 9 { 9 10 /** 10 - * @param array<FeedViewPost> $feed 11 + * @param Collection<int, FeedViewPost> $feed 11 12 */ 12 13 public function __construct( 13 - public readonly array $feed, 14 + public readonly Collection $feed, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - feed: array_map( 21 - fn (array $post) => FeedViewPost::fromArray($post), 22 - $data['feed'] ?? [] 21 + feed: collect($data['feed'] ?? [])->map( 22 + fn (array $post) => FeedViewPost::fromArray($post) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Bsky/Feed/GetLikesResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\GetLikes\Like; 6 7 7 8 class GetLikesResponse 8 9 { 9 10 /** 10 - * @param array<Like> $likes 11 + * @param Collection<int, Like> $likes 11 12 */ 12 13 public function __construct( 13 14 public readonly string $uri, 14 - public readonly array $likes, 15 + public readonly Collection $likes, 15 16 public readonly ?string $cid = null, 16 17 public readonly ?string $cursor = null, 17 18 ) {} ··· 20 21 { 21 22 return new self( 22 23 uri: $data['uri'], 23 - likes: array_map( 24 - fn (array $like) => Like::fromArray($like), 25 - $data['likes'] ?? [] 24 + likes: collect($data['likes'] ?? [])->map( 25 + fn (array $like) => Like::fromArray($like) 26 26 ), 27 27 cid: $data['cid'] ?? null, 28 28 cursor: $data['cursor'] ?? null,
+5 -5
src/Data/Responses/Bsky/Feed/GetPostsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\PostView; 6 7 7 8 class GetPostsResponse 8 9 { 9 10 /** 10 - * @param array<PostView> $posts 11 + * @param Collection<int, PostView> $posts 11 12 */ 12 13 public function __construct( 13 - public readonly array $posts, 14 + public readonly Collection $posts, 14 15 ) {} 15 16 16 17 public static function fromArray(array $data): self 17 18 { 18 19 return new self( 19 - posts: array_map( 20 - fn (array $post) => PostView::fromArray($post), 21 - $data['posts'] ?? [] 20 + posts: collect($data['posts'] ?? [])->map( 21 + fn (array $post) => PostView::fromArray($post) 22 22 ), 23 23 ); 24 24 }
+5 -5
src/Data/Responses/Bsky/Feed/GetQuotesResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\PostView; 6 7 7 8 class GetQuotesResponse 8 9 { 9 10 /** 10 - * @param array<PostView> $posts 11 + * @param Collection<int, PostView> $posts 11 12 */ 12 13 public function __construct( 13 14 public readonly string $uri, 14 - public readonly array $posts, 15 + public readonly Collection $posts, 15 16 public readonly ?string $cid = null, 16 17 public readonly ?string $cursor = null, 17 18 ) {} ··· 20 21 { 21 22 return new self( 22 23 uri: $data['uri'], 23 - posts: array_map( 24 - fn (array $post) => PostView::fromArray($post), 25 - $data['posts'] ?? [] 24 + posts: collect($data['posts'] ?? [])->map( 25 + fn (array $post) => PostView::fromArray($post) 26 26 ), 27 27 cid: $data['cid'] ?? null, 28 28 cursor: $data['cursor'] ?? null,
+5 -5
src/Data/Responses/Bsky/Feed/GetRepostedByResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileView; 6 7 7 8 class GetRepostedByResponse 8 9 { 9 10 /** 10 - * @param array<ProfileView> $repostedBy 11 + * @param Collection<int, ProfileView> $repostedBy 11 12 */ 12 13 public function __construct( 13 14 public readonly string $uri, 14 - public readonly array $repostedBy, 15 + public readonly Collection $repostedBy, 15 16 public readonly ?string $cid = null, 16 17 public readonly ?string $cursor = null, 17 18 ) {} ··· 20 21 { 21 22 return new self( 22 23 uri: $data['uri'], 23 - repostedBy: array_map( 24 - fn (array $profile) => ProfileView::fromArray($profile), 25 - $data['repostedBy'] ?? [] 24 + repostedBy: collect($data['repostedBy'] ?? [])->map( 25 + fn (array $profile) => ProfileView::fromArray($profile) 26 26 ), 27 27 cid: $data['cid'] ?? null, 28 28 cursor: $data['cursor'] ?? null,
+5 -5
src/Data/Responses/Bsky/Feed/GetSuggestedFeedsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\GeneratorView; 6 7 7 8 class GetSuggestedFeedsResponse 8 9 { 9 10 /** 10 - * @param array<GeneratorView> $feeds 11 + * @param Collection<int, GeneratorView> $feeds 11 12 */ 12 13 public function __construct( 13 - public readonly array $feeds, 14 + public readonly Collection $feeds, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - feeds: array_map( 21 - fn (array $feed) => GeneratorView::fromArray($feed), 22 - $data['feeds'] ?? [] 21 + feeds: collect($data['feeds'] ?? [])->map( 22 + fn (array $feed) => GeneratorView::fromArray($feed) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Bsky/Feed/GetTimelineResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\FeedViewPost; 6 7 7 8 class GetTimelineResponse 8 9 { 9 10 /** 10 - * @param array<FeedViewPost> $feed 11 + * @param Collection<int, FeedViewPost> $feed 11 12 */ 12 13 public function __construct( 13 - public readonly array $feed, 14 + public readonly Collection $feed, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - feed: array_map( 21 - fn (array $post) => FeedViewPost::fromArray($post), 22 - $data['feed'] ?? [] 21 + feed: collect($data['feed'] ?? [])->map( 22 + fn (array $post) => FeedViewPost::fromArray($post) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Bsky/Feed/SearchPostsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\PostView; 6 7 7 8 class SearchPostsResponse 8 9 { 9 10 /** 10 - * @param array<PostView> $posts 11 + * @param Collection<int, PostView> $posts 11 12 */ 12 13 public function __construct( 13 - public readonly array $posts, 14 + public readonly Collection $posts, 14 15 public readonly ?string $cursor = null, 15 16 public readonly ?int $hitsTotal = null, 16 17 ) {} ··· 18 19 public static function fromArray(array $data): self 19 20 { 20 21 return new self( 21 - posts: array_map( 22 - fn (array $post) => PostView::fromArray($post), 23 - $data['posts'] ?? [] 22 + posts: collect($data['posts'] ?? [])->map( 23 + fn (array $post) => PostView::fromArray($post) 24 24 ), 25 25 cursor: $data['cursor'] ?? null, 26 26 hitsTotal: $data['hitsTotal'] ?? null,
+5 -5
src/Data/Responses/Bsky/Graph/GetFollowersResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Graph; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileView; 6 7 7 8 class GetFollowersResponse 8 9 { 9 10 /** 10 - * @param array<ProfileView> $followers 11 + * @param Collection<int, ProfileView> $followers 11 12 */ 12 13 public function __construct( 13 14 public readonly ProfileView $subject, 14 - public readonly array $followers, 15 + public readonly Collection $followers, 15 16 public readonly ?string $cursor = null, 16 17 ) {} 17 18 ··· 19 20 { 20 21 return new self( 21 22 subject: ProfileView::fromArray($data['subject']), 22 - followers: array_map( 23 - fn (array $profile) => ProfileView::fromArray($profile), 24 - $data['followers'] ?? [] 23 + followers: collect($data['followers'] ?? [])->map( 24 + fn (array $profile) => ProfileView::fromArray($profile) 25 25 ), 26 26 cursor: $data['cursor'] ?? null, 27 27 );
+5 -5
src/Data/Responses/Bsky/Graph/GetFollowsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Graph; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileView; 6 7 7 8 class GetFollowsResponse 8 9 { 9 10 /** 10 - * @param array<ProfileView> $follows 11 + * @param Collection<int, ProfileView> $follows 11 12 */ 12 13 public function __construct( 13 14 public readonly ProfileView $subject, 14 - public readonly array $follows, 15 + public readonly Collection $follows, 15 16 public readonly ?string $cursor = null, 16 17 ) {} 17 18 ··· 19 20 { 20 21 return new self( 21 22 subject: ProfileView::fromArray($data['subject']), 22 - follows: array_map( 23 - fn (array $profile) => ProfileView::fromArray($profile), 24 - $data['follows'] ?? [] 23 + follows: collect($data['follows'] ?? [])->map( 24 + fn (array $profile) => ProfileView::fromArray($profile) 25 25 ), 26 26 cursor: $data['cursor'] ?? null, 27 27 );
+5 -5
src/Data/Responses/Bsky/Graph/GetKnownFollowersResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Graph; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileView; 6 7 7 8 class GetKnownFollowersResponse 8 9 { 9 10 /** 10 - * @param array<ProfileView> $followers 11 + * @param Collection<int, ProfileView> $followers 11 12 */ 12 13 public function __construct( 13 14 public readonly ProfileView $subject, 14 - public readonly array $followers, 15 + public readonly Collection $followers, 15 16 public readonly ?string $cursor = null, 16 17 ) {} 17 18 ··· 19 20 { 20 21 return new self( 21 22 subject: ProfileView::fromArray($data['subject']), 22 - followers: array_map( 23 - fn (array $profile) => ProfileView::fromArray($profile), 24 - $data['followers'] ?? [] 23 + followers: collect($data['followers'] ?? [])->map( 24 + fn (array $profile) => ProfileView::fromArray($profile) 25 25 ), 26 26 cursor: $data['cursor'] ?? null, 27 27 );
+5 -5
src/Data/Responses/Bsky/Graph/GetListResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Graph; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Graph\Defs\ListItemView; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Graph\Defs\ListView; 7 8 8 9 class GetListResponse 9 10 { 10 11 /** 11 - * @param array<ListItemView> $items 12 + * @param Collection<int, ListItemView> $items 12 13 */ 13 14 public function __construct( 14 15 public readonly ListView $list, 15 - public readonly array $items, 16 + public readonly Collection $items, 16 17 public readonly ?string $cursor = null, 17 18 ) {} 18 19 ··· 20 21 { 21 22 return new self( 22 23 list: ListView::fromArray($data['list']), 23 - items: array_map( 24 - fn (array $item) => ListItemView::fromArray($item), 25 - $data['items'] ?? [] 24 + items: collect($data['items'] ?? [])->map( 25 + fn (array $item) => ListItemView::fromArray($item) 26 26 ), 27 27 cursor: $data['cursor'] ?? null, 28 28 );
+5 -5
src/Data/Responses/Bsky/Graph/GetListsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Graph; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Graph\Defs\ListView; 6 7 7 8 class GetListsResponse 8 9 { 9 10 /** 10 - * @param array<ListView> $lists 11 + * @param Collection<int, ListView> $lists 11 12 */ 12 13 public function __construct( 13 - public readonly array $lists, 14 + public readonly Collection $lists, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - lists: array_map( 21 - fn (array $list) => ListView::fromArray($list), 22 - $data['lists'] ?? [] 21 + lists: collect($data['lists'] ?? [])->map( 22 + fn (array $list) => ListView::fromArray($list) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -3
src/Data/Responses/Bsky/Graph/GetRelationshipsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Graph; 4 4 5 + use Illuminate\Support\Collection; 6 + 5 7 class GetRelationshipsResponse 6 8 { 7 9 /** 8 - * @param array<mixed> $relationships Array of Relationship or NotFoundActor objects 10 + * @param Collection<int, mixed> $relationships Collection of Relationship or NotFoundActor objects 9 11 */ 10 12 public function __construct( 11 - public readonly array $relationships, 13 + public readonly Collection $relationships, 12 14 public readonly ?string $actor = null, 13 15 ) {} 14 16 15 17 public static function fromArray(array $data): self 16 18 { 17 19 return new self( 18 - relationships: $data['relationships'] ?? [], 20 + relationships: collect($data['relationships'] ?? []), 19 21 actor: $data['actor'] ?? null, 20 22 ); 21 23 }
+5 -5
src/Data/Responses/Bsky/Graph/GetStarterPacksResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Graph; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Graph\Defs\StarterPackViewBasic; 6 7 7 8 class GetStarterPacksResponse 8 9 { 9 10 /** 10 - * @param array<StarterPackViewBasic> $starterPacks 11 + * @param Collection<int, StarterPackViewBasic> $starterPacks 11 12 */ 12 13 public function __construct( 13 - public readonly array $starterPacks, 14 + public readonly Collection $starterPacks, 14 15 ) {} 15 16 16 17 public static function fromArray(array $data): self 17 18 { 18 19 return new self( 19 - starterPacks: array_map( 20 - fn (array $pack) => StarterPackViewBasic::fromArray($pack), 21 - $data['starterPacks'] ?? [] 20 + starterPacks: collect($data['starterPacks'] ?? [])->map( 21 + fn (array $pack) => StarterPackViewBasic::fromArray($pack) 22 22 ), 23 23 ); 24 24 }
+5 -5
src/Data/Responses/Bsky/Graph/GetSuggestedFollowsByActorResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Graph; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileView; 6 7 7 8 class GetSuggestedFollowsByActorResponse 8 9 { 9 10 /** 10 - * @param array<ProfileView> $suggestions 11 + * @param Collection<int, ProfileView> $suggestions 11 12 */ 12 13 public function __construct( 13 - public readonly array $suggestions, 14 + public readonly Collection $suggestions, 14 15 public readonly ?bool $isFallback = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - suggestions: array_map( 21 - fn (array $profile) => ProfileView::fromArray($profile), 22 - $data['suggestions'] ?? [] 21 + suggestions: collect($data['suggestions'] ?? [])->map( 22 + fn (array $profile) => ProfileView::fromArray($profile) 23 23 ), 24 24 isFallback: $data['isFallback'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Bsky/Labeler/GetServicesResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Labeler; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Labeler\Defs\LabelerView; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Labeler\Defs\LabelerViewDetailed; 7 8 8 9 class GetServicesResponse 9 10 { 10 11 /** 11 - * @param array<LabelerView|LabelerViewDetailed> $views 12 + * @param Collection<int, LabelerView|LabelerViewDetailed> $views 12 13 */ 13 14 public function __construct( 14 - public readonly array $views, 15 + public readonly Collection $views, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data, bool $detailed = false): self 18 19 { 19 20 return new self( 20 - views: array_map( 21 + views: collect($data['views'] ?? [])->map( 21 22 fn (array $view) => $detailed 22 23 ? LabelerViewDetailed::fromArray($view) 23 - : LabelerView::fromArray($view), 24 - $data['views'] ?? [] 24 + : LabelerView::fromArray($view) 25 25 ), 26 26 ); 27 27 }
+5 -3
src/Data/Responses/Chat/Convo/GetLogResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Chat\Convo; 4 4 5 + use Illuminate\Support\Collection; 6 + 5 7 class GetLogResponse 6 8 { 7 9 /** 8 - * @param array<mixed> $logs Array of log event objects (LogBeginConvo, LogCreateMessage, etc.) 10 + * @param Collection<int, mixed> $logs Collection of log event objects (LogBeginConvo, LogCreateMessage, etc.) 9 11 */ 10 12 public function __construct( 11 - public readonly array $logs, 13 + public readonly Collection $logs, 12 14 public readonly ?string $cursor = null, 13 15 ) {} 14 16 15 17 public static function fromArray(array $data): self 16 18 { 17 19 return new self( 18 - logs: $data['logs'] ?? [], 20 + logs: collect($data['logs'] ?? []), 19 21 cursor: $data['cursor'] ?? null, 20 22 ); 21 23 }
+5 -5
src/Data/Responses/Chat/Convo/GetMessagesResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Chat\Convo; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\Chat\Bsky\Convo\Defs\DeletedMessageView; 6 7 use SocialDept\AtpSchema\Generated\Chat\Bsky\Convo\Defs\MessageView; 7 8 8 9 class GetMessagesResponse 9 10 { 10 11 /** 11 - * @param array<MessageView|DeletedMessageView> $messages 12 + * @param Collection<int, MessageView|DeletedMessageView> $messages 12 13 */ 13 14 public function __construct( 14 - public readonly array $messages, 15 + public readonly Collection $messages, 15 16 public readonly ?string $cursor = null, 16 17 ) {} 17 18 18 19 public static function fromArray(array $data): self 19 20 { 20 21 return new self( 21 - messages: array_map( 22 + messages: collect($data['messages'] ?? [])->map( 22 23 function (array $message) { 23 24 if (isset($message['$type']) && $message['$type'] === 'chat.bsky.convo.defs#deletedMessageView') { 24 25 return DeletedMessageView::fromArray($message); 25 26 } 26 27 27 28 return MessageView::fromArray($message); 28 - }, 29 - $data['messages'] ?? [] 29 + } 30 30 ), 31 31 cursor: $data['cursor'] ?? null, 32 32 );
+5 -5
src/Data/Responses/Chat/Convo/ListConvosResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Chat\Convo; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\Chat\Bsky\Convo\Defs\ConvoView; 6 7 7 8 class ListConvosResponse 8 9 { 9 10 /** 10 - * @param array<ConvoView> $convos 11 + * @param Collection<int, ConvoView> $convos 11 12 */ 12 13 public function __construct( 13 - public readonly array $convos, 14 + public readonly Collection $convos, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - convos: array_map( 21 - fn (array $convo) => ConvoView::fromArray($convo), 22 - $data['convos'] ?? [] 21 + convos: collect($data['convos'] ?? [])->map( 22 + fn (array $convo) => ConvoView::fromArray($convo) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Chat/Convo/SendMessageBatchResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Chat\Convo; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\Chat\Bsky\Convo\Defs\MessageView; 6 7 7 8 class SendMessageBatchResponse 8 9 { 9 10 /** 10 - * @param array<MessageView> $items 11 + * @param Collection<int, MessageView> $items 11 12 */ 12 13 public function __construct( 13 - public readonly array $items, 14 + public readonly Collection $items, 14 15 ) {} 15 16 16 17 public static function fromArray(array $data): self 17 18 { 18 19 return new self( 19 - items: array_map( 20 - fn (array $item) => MessageView::fromArray($item), 21 - $data['items'] ?? [] 20 + items: collect($data['items'] ?? [])->map( 21 + fn (array $item) => MessageView::fromArray($item) 22 22 ), 23 23 ); 24 24 }
+5 -5
src/Data/Responses/Ozone/Moderation/QueryEventsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Ozone\Moderation; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\Tools\Ozone\Moderation\Defs\ModEventView; 6 7 7 8 class QueryEventsResponse 8 9 { 9 10 /** 10 - * @param array<ModEventView> $events 11 + * @param Collection<int, ModEventView> $events 11 12 */ 12 13 public function __construct( 13 - public readonly array $events, 14 + public readonly Collection $events, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - events: array_map( 21 - fn (array $event) => ModEventView::fromArray($event), 22 - $data['events'] ?? [] 21 + events: collect($data['events'] ?? [])->map( 22 + fn (array $event) => ModEventView::fromArray($event) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Ozone/Moderation/QueryStatusesResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Ozone\Moderation; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\Tools\Ozone\Moderation\Defs\SubjectStatusView; 6 7 7 8 class QueryStatusesResponse 8 9 { 9 10 /** 10 - * @param array<SubjectStatusView> $subjectStatuses 11 + * @param Collection<int, SubjectStatusView> $subjectStatuses 11 12 */ 12 13 public function __construct( 13 - public readonly array $subjectStatuses, 14 + public readonly Collection $subjectStatuses, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - subjectStatuses: array_map( 21 - fn (array $status) => SubjectStatusView::fromArray($status), 22 - $data['subjectStatuses'] ?? [] 21 + subjectStatuses: collect($data['subjectStatuses'] ?? [])->map( 22 + fn (array $status) => SubjectStatusView::fromArray($status) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -5
src/Data/Responses/Ozone/Moderation/SearchReposResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Ozone\Moderation; 4 4 5 + use Illuminate\Support\Collection; 5 6 use SocialDept\AtpSchema\Generated\Tools\Ozone\Moderation\Defs\RepoView; 6 7 7 8 class SearchReposResponse 8 9 { 9 10 /** 10 - * @param array<RepoView> $repos 11 + * @param Collection<int, RepoView> $repos 11 12 */ 12 13 public function __construct( 13 - public readonly array $repos, 14 + public readonly Collection $repos, 14 15 public readonly ?string $cursor = null, 15 16 ) {} 16 17 17 18 public static function fromArray(array $data): self 18 19 { 19 20 return new self( 20 - repos: array_map( 21 - fn (array $repo) => RepoView::fromArray($repo), 22 - $data['repos'] ?? [] 21 + repos: collect($data['repos'] ?? [])->map( 22 + fn (array $repo) => RepoView::fromArray($repo) 23 23 ), 24 24 cursor: $data['cursor'] ?? null, 25 25 );
+5 -3
src/Data/Responses/Ozone/Team/ListMembersResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Ozone\Team; 4 4 5 + use Illuminate\Support\Collection; 6 + 5 7 class ListMembersResponse 6 8 { 7 9 /** 8 - * @param array<array<string, mixed>> $members Array of team member objects 10 + * @param Collection<int, array<string, mixed>> $members Collection of team member objects 9 11 */ 10 12 public function __construct( 11 - public readonly array $members, 13 + public readonly Collection $members, 12 14 public readonly ?string $cursor = null, 13 15 ) {} 14 16 15 17 public static function fromArray(array $data): self 16 18 { 17 19 return new self( 18 - members: $data['members'] ?? [], 20 + members: collect($data['members'] ?? []), 19 21 cursor: $data['cursor'] ?? null, 20 22 ); 21 23 }