Laravel AT Protocol Client (alpha & unstable)

Add Arrayable interface to Bsky Feed response classes

+15 -1
src/Data/Responses/Bsky/Feed/DescribeFeedGeneratorResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 - class DescribeFeedGeneratorResponse 5 + use Illuminate\Contracts\Support\Arrayable; 6 + 7 + /** 8 + * @implements Arrayable<string, mixed> 9 + */ 10 + class DescribeFeedGeneratorResponse implements Arrayable 6 11 { 7 12 /** 8 13 * @param array<array{uri: string}> $feeds ··· 20 25 feeds: $data['feeds'] ?? [], 21 26 links: $data['links'] ?? null, 22 27 ); 28 + } 29 + 30 + public function toArray(): array 31 + { 32 + return [ 33 + 'did' => $this->did, 34 + 'feeds' => $this->feeds, 35 + 'links' => $this->links, 36 + ]; 23 37 } 24 38 }
+13 -1
src/Data/Responses/Bsky/Feed/GetActorFeedsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use Illuminate\Support\Collection; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\GeneratorView; 7 8 8 - class GetActorFeedsResponse 9 + /** 10 + * @implements Arrayable<string, mixed> 11 + */ 12 + class GetActorFeedsResponse implements Arrayable 9 13 { 10 14 /** 11 15 * @param Collection<int, GeneratorView> $feeds ··· 23 27 ), 24 28 cursor: $data['cursor'] ?? null, 25 29 ); 30 + } 31 + 32 + public function toArray(): array 33 + { 34 + return [ 35 + 'feeds' => $this->feeds->map(fn (GeneratorView $f) => $f->toArray())->all(), 36 + 'cursor' => $this->cursor, 37 + ]; 26 38 } 27 39 }
+13 -1
src/Data/Responses/Bsky/Feed/GetActorLikesResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use Illuminate\Support\Collection; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\FeedViewPost; 7 8 8 - class GetActorLikesResponse 9 + /** 10 + * @implements Arrayable<string, mixed> 11 + */ 12 + class GetActorLikesResponse implements Arrayable 9 13 { 10 14 /** 11 15 * @param Collection<int, FeedViewPost> $feed ··· 23 27 ), 24 28 cursor: $data['cursor'] ?? null, 25 29 ); 30 + } 31 + 32 + public function toArray(): array 33 + { 34 + return [ 35 + 'feed' => $this->feed->map(fn (FeedViewPost $p) => $p->toArray())->all(), 36 + 'cursor' => $this->cursor, 37 + ]; 26 38 } 27 39 }
+13 -1
src/Data/Responses/Bsky/Feed/GetAuthorFeedResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use Illuminate\Support\Collection; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\FeedViewPost; 7 8 8 - class GetAuthorFeedResponse 9 + /** 10 + * @implements Arrayable<string, mixed> 11 + */ 12 + class GetAuthorFeedResponse implements Arrayable 9 13 { 10 14 /** 11 15 * @param Collection<int, FeedViewPost> $feed ··· 23 27 ), 24 28 cursor: $data['cursor'] ?? null, 25 29 ); 30 + } 31 + 32 + public function toArray(): array 33 + { 34 + return [ 35 + 'feed' => $this->feed->map(fn (FeedViewPost $p) => $p->toArray())->all(), 36 + 'cursor' => $this->cursor, 37 + ]; 26 38 } 27 39 }
+14 -1
src/Data/Responses/Bsky/Feed/GetFeedGeneratorResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\GeneratorView; 6 7 7 - class GetFeedGeneratorResponse 8 + /** 9 + * @implements Arrayable<string, mixed> 10 + */ 11 + class GetFeedGeneratorResponse implements Arrayable 8 12 { 9 13 public function __construct( 10 14 public readonly GeneratorView $view, ··· 19 23 isOnline: $data['isOnline'], 20 24 isValid: $data['isValid'], 21 25 ); 26 + } 27 + 28 + public function toArray(): array 29 + { 30 + return [ 31 + 'view' => $this->view->toArray(), 32 + 'isOnline' => $this->isOnline, 33 + 'isValid' => $this->isValid, 34 + ]; 22 35 } 23 36 }
+12 -1
src/Data/Responses/Bsky/Feed/GetFeedGeneratorsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use Illuminate\Support\Collection; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\GeneratorView; 7 8 8 - class GetFeedGeneratorsResponse 9 + /** 10 + * @implements Arrayable<string, mixed> 11 + */ 12 + class GetFeedGeneratorsResponse implements Arrayable 9 13 { 10 14 /** 11 15 * @param Collection<int, GeneratorView> $feeds ··· 21 25 fn (array $feed) => GeneratorView::fromArray($feed) 22 26 ), 23 27 ); 28 + } 29 + 30 + public function toArray(): array 31 + { 32 + return [ 33 + 'feeds' => $this->feeds->map(fn (GeneratorView $f) => $f->toArray())->all(), 34 + ]; 24 35 } 25 36 }
+13 -1
src/Data/Responses/Bsky/Feed/GetFeedResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use Illuminate\Support\Collection; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\FeedViewPost; 7 8 8 - class GetFeedResponse 9 + /** 10 + * @implements Arrayable<string, mixed> 11 + */ 12 + class GetFeedResponse implements Arrayable 9 13 { 10 14 /** 11 15 * @param Collection<int, FeedViewPost> $feed ··· 23 27 ), 24 28 cursor: $data['cursor'] ?? null, 25 29 ); 30 + } 31 + 32 + public function toArray(): array 33 + { 34 + return [ 35 + 'feed' => $this->feed->map(fn (FeedViewPost $p) => $p->toArray())->all(), 36 + 'cursor' => $this->cursor, 37 + ]; 26 38 } 27 39 }
+15 -1
src/Data/Responses/Bsky/Feed/GetLikesResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use Illuminate\Support\Collection; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\GetLikes\Like; 7 8 8 - class GetLikesResponse 9 + /** 10 + * @implements Arrayable<string, mixed> 11 + */ 12 + class GetLikesResponse implements Arrayable 9 13 { 10 14 /** 11 15 * @param Collection<int, Like> $likes ··· 27 31 cid: $data['cid'] ?? null, 28 32 cursor: $data['cursor'] ?? null, 29 33 ); 34 + } 35 + 36 + public function toArray(): array 37 + { 38 + return [ 39 + 'uri' => $this->uri, 40 + 'likes' => $this->likes->map(fn (Like $l) => $l->toArray())->all(), 41 + 'cid' => $this->cid, 42 + 'cursor' => $this->cursor, 43 + ]; 30 44 } 31 45 }
+13 -1
src/Data/Responses/Bsky/Feed/GetPostThreadResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\ThreadViewPost; 6 7 7 - class GetPostThreadResponse 8 + /** 9 + * @implements Arrayable<string, mixed> 10 + */ 11 + class GetPostThreadResponse implements Arrayable 8 12 { 9 13 public function __construct( 10 14 public readonly ThreadViewPost $thread, ··· 17 21 thread: ThreadViewPost::fromArray($data['thread']), 18 22 threadgate: $data['threadgate'] ?? null, 19 23 ); 24 + } 25 + 26 + public function toArray(): array 27 + { 28 + return [ 29 + 'thread' => $this->thread->toArray(), 30 + 'threadgate' => $this->threadgate, 31 + ]; 20 32 } 21 33 }
+12 -1
src/Data/Responses/Bsky/Feed/GetPostsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use Illuminate\Support\Collection; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\PostView; 7 8 8 - class GetPostsResponse 9 + /** 10 + * @implements Arrayable<string, mixed> 11 + */ 12 + class GetPostsResponse implements Arrayable 9 13 { 10 14 /** 11 15 * @param Collection<int, PostView> $posts ··· 21 25 fn (array $post) => PostView::fromArray($post) 22 26 ), 23 27 ); 28 + } 29 + 30 + public function toArray(): array 31 + { 32 + return [ 33 + 'posts' => $this->posts->map(fn (PostView $p) => $p->toArray())->all(), 34 + ]; 24 35 } 25 36 }
+15 -1
src/Data/Responses/Bsky/Feed/GetQuotesResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use Illuminate\Support\Collection; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\PostView; 7 8 8 - class GetQuotesResponse 9 + /** 10 + * @implements Arrayable<string, mixed> 11 + */ 12 + class GetQuotesResponse implements Arrayable 9 13 { 10 14 /** 11 15 * @param Collection<int, PostView> $posts ··· 27 31 cid: $data['cid'] ?? null, 28 32 cursor: $data['cursor'] ?? null, 29 33 ); 34 + } 35 + 36 + public function toArray(): array 37 + { 38 + return [ 39 + 'uri' => $this->uri, 40 + 'posts' => $this->posts->map(fn (PostView $p) => $p->toArray())->all(), 41 + 'cid' => $this->cid, 42 + 'cursor' => $this->cursor, 43 + ]; 30 44 } 31 45 }
+15 -1
src/Data/Responses/Bsky/Feed/GetRepostedByResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use Illuminate\Support\Collection; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs\ProfileView; 7 8 8 - class GetRepostedByResponse 9 + /** 10 + * @implements Arrayable<string, mixed> 11 + */ 12 + class GetRepostedByResponse implements Arrayable 9 13 { 10 14 /** 11 15 * @param Collection<int, ProfileView> $repostedBy ··· 27 31 cid: $data['cid'] ?? null, 28 32 cursor: $data['cursor'] ?? null, 29 33 ); 34 + } 35 + 36 + public function toArray(): array 37 + { 38 + return [ 39 + 'uri' => $this->uri, 40 + 'repostedBy' => $this->repostedBy->map(fn (ProfileView $p) => $p->toArray())->all(), 41 + 'cid' => $this->cid, 42 + 'cursor' => $this->cursor, 43 + ]; 30 44 } 31 45 }
+13 -1
src/Data/Responses/Bsky/Feed/GetSuggestedFeedsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use Illuminate\Support\Collection; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\GeneratorView; 7 8 8 - class GetSuggestedFeedsResponse 9 + /** 10 + * @implements Arrayable<string, mixed> 11 + */ 12 + class GetSuggestedFeedsResponse implements Arrayable 9 13 { 10 14 /** 11 15 * @param Collection<int, GeneratorView> $feeds ··· 23 27 ), 24 28 cursor: $data['cursor'] ?? null, 25 29 ); 30 + } 31 + 32 + public function toArray(): array 33 + { 34 + return [ 35 + 'feeds' => $this->feeds->map(fn (GeneratorView $f) => $f->toArray())->all(), 36 + 'cursor' => $this->cursor, 37 + ]; 26 38 } 27 39 }
+13 -1
src/Data/Responses/Bsky/Feed/GetTimelineResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use Illuminate\Support\Collection; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\FeedViewPost; 7 8 8 - class GetTimelineResponse 9 + /** 10 + * @implements Arrayable<string, mixed> 11 + */ 12 + class GetTimelineResponse implements Arrayable 9 13 { 10 14 /** 11 15 * @param Collection<int, FeedViewPost> $feed ··· 23 27 ), 24 28 cursor: $data['cursor'] ?? null, 25 29 ); 30 + } 31 + 32 + public function toArray(): array 33 + { 34 + return [ 35 + 'feed' => $this->feed->map(fn (FeedViewPost $p) => $p->toArray())->all(), 36 + 'cursor' => $this->cursor, 37 + ]; 26 38 } 27 39 }
+14 -1
src/Data/Responses/Bsky/Feed/SearchPostsResponse.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Data\Responses\Bsky\Feed; 4 4 5 + use Illuminate\Contracts\Support\Arrayable; 5 6 use Illuminate\Support\Collection; 6 7 use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Defs\PostView; 7 8 8 - class SearchPostsResponse 9 + /** 10 + * @implements Arrayable<string, mixed> 11 + */ 12 + class SearchPostsResponse implements Arrayable 9 13 { 10 14 /** 11 15 * @param Collection<int, PostView> $posts ··· 25 29 cursor: $data['cursor'] ?? null, 26 30 hitsTotal: $data['hitsTotal'] ?? null, 27 31 ); 32 + } 33 + 34 + public function toArray(): array 35 + { 36 + return [ 37 + 'posts' => $this->posts->map(fn (PostView $p) => $p->toArray())->all(), 38 + 'cursor' => $this->cursor, 39 + 'hitsTotal' => $this->hitsTotal, 40 + ]; 28 41 } 29 42 }