diff --git a/src/Client/Public/AtpPublicClient.php b/src/Client/Public/AtpPublicClient.php deleted file mode 100644 index dfd0ddc..0000000 --- a/src/Client/Public/AtpPublicClient.php +++ /dev/null @@ -1,22 +0,0 @@ -client = new PublicClient($serviceUrl); - $this->bsky = new BskyPublicClient($this); - $this->atproto = new AtprotoPublicClient($this); - } -} diff --git a/src/Client/Public/AtprotoPublicClient.php b/src/Client/Public/AtprotoPublicClient.php deleted file mode 100644 index f461840..0000000 --- a/src/Client/Public/AtprotoPublicClient.php +++ /dev/null @@ -1,38 +0,0 @@ -atp = $parent; - $this->identity = new IdentityPublicRequestClient($this); - $this->repo = new RepoPublicRequestClient($this); - } - - protected function getDomainName(): string - { - return 'atproto'; - } - - protected function getRootClientClass(): string - { - return AtpPublicClient::class; - } - - public function root(): AtpPublicClient - { - return $this->atp; - } -} diff --git a/src/Client/Public/BskyPublicClient.php b/src/Client/Public/BskyPublicClient.php deleted file mode 100644 index 8fc381a..0000000 --- a/src/Client/Public/BskyPublicClient.php +++ /dev/null @@ -1,44 +0,0 @@ -atp = $parent; - $this->actor = new ActorPublicRequestClient($this); - $this->feed = new FeedPublicRequestClient($this); - $this->graph = new GraphPublicRequestClient($this); - $this->labeler = new LabelerPublicRequestClient($this); - } - - protected function getDomainName(): string - { - return 'bsky'; - } - - protected function getRootClientClass(): string - { - return AtpPublicClient::class; - } - - public function root(): AtpPublicClient - { - return $this->atp; - } -} diff --git a/src/Client/Public/PublicClient.php b/src/Client/Public/PublicClient.php deleted file mode 100644 index 46bf877..0000000 --- a/src/Client/Public/PublicClient.php +++ /dev/null @@ -1,35 +0,0 @@ -value : $endpoint; - $url = rtrim($this->serviceUrl, '/') . '/xrpc/' . $endpoint; - $params = array_filter($params, fn ($v) => !is_null($v)); - - $response = Http::get($url, $params); - - if ($response->failed() || isset($response->json()['error'])) { - throw AtpResponseException::fromResponse($response, $endpoint); - } - - return new Response($response); - } - - public function serviceUrl(): string - { - return $this->serviceUrl; - } -} diff --git a/src/Client/Public/Requests/Atproto/IdentityPublicRequestClient.php b/src/Client/Public/Requests/Atproto/IdentityPublicRequestClient.php deleted file mode 100644 index e00f76a..0000000 --- a/src/Client/Public/Requests/Atproto/IdentityPublicRequestClient.php +++ /dev/null @@ -1,19 +0,0 @@ -atp->client->get( - endpoint: AtprotoIdentity::ResolveHandle, - params: compact('handle') - ); - - return $response->json()['did']; - } -} diff --git a/src/Client/Public/Requests/Atproto/RepoPublicRequestClient.php b/src/Client/Public/Requests/Atproto/RepoPublicRequestClient.php deleted file mode 100644 index 5f2d011..0000000 --- a/src/Client/Public/Requests/Atproto/RepoPublicRequestClient.php +++ /dev/null @@ -1,69 +0,0 @@ -value : $collection; - $response = $this->atp->client->get( - endpoint: AtprotoRepo::GetRecord, - params: compact('repo', 'collection', 'rkey', 'cid') - ); - - return GetRecordResponse::fromArray($response->json()); - } - - /** - * List records in a collection - * - * @see https://docs.bsky.app/docs/api/com-atproto-repo-list-records - */ - public function listRecords( - string $repo, - string|BackedEnum $collection, - int $limit = 50, - ?string $cursor = null, - bool $reverse = false - ): ListRecordsResponse { - $collection = $collection instanceof BackedEnum ? $collection->value : $collection; - $response = $this->atp->client->get( - endpoint: AtprotoRepo::ListRecords, - params: compact('repo', 'collection', 'limit', 'cursor', 'reverse') - ); - - return ListRecordsResponse::fromArray($response->json()); - } - - /** - * Describe the repository - * - * @see https://docs.bsky.app/docs/api/com-atproto-repo-describe-repo - */ - public function describeRepo(string $repo): DescribeRepoResponse - { - $response = $this->atp->client->get( - endpoint: AtprotoRepo::DescribeRepo, - params: compact('repo') - ); - - return DescribeRepoResponse::fromArray($response->json()); - } -} diff --git a/src/Client/Public/Requests/Bsky/ActorPublicRequestClient.php b/src/Client/Public/Requests/Bsky/ActorPublicRequestClient.php deleted file mode 100644 index 608c0af..0000000 --- a/src/Client/Public/Requests/Bsky/ActorPublicRequestClient.php +++ /dev/null @@ -1,64 +0,0 @@ -atp->client->get( - endpoint: BskyActor::GetProfile, - params: compact('actor') - ); - - return ProfileViewDetailed::fromArray($response->json()); - } - - public function getProfiles(array $actors): GetProfilesResponse - { - $response = $this->atp->client->get( - endpoint: BskyActor::GetProfiles, - params: compact('actors') - ); - - return GetProfilesResponse::fromArray($response->json()); - } - - public function getSuggestions(int $limit = 50, ?string $cursor = null): GetSuggestionsResponse - { - $response = $this->atp->client->get( - endpoint: BskyActor::GetSuggestions, - params: compact('limit', 'cursor') - ); - - return GetSuggestionsResponse::fromArray($response->json()); - } - - public function searchActors(string $q, int $limit = 25, ?string $cursor = null): SearchActorsResponse - { - $response = $this->atp->client->get( - endpoint: BskyActor::SearchActors, - params: compact('q', 'limit', 'cursor') - ); - - return SearchActorsResponse::fromArray($response->json()); - } - - public function searchActorsTypeahead(string $q, int $limit = 10): SearchActorsTypeaheadResponse - { - $response = $this->atp->client->get( - endpoint: BskyActor::SearchActorsTypeahead, - params: compact('q', 'limit') - ); - - return SearchActorsTypeaheadResponse::fromArray($response->json()); - } -} diff --git a/src/Client/Public/Requests/Bsky/FeedPublicRequestClient.php b/src/Client/Public/Requests/Bsky/FeedPublicRequestClient.php deleted file mode 100644 index 84b5964..0000000 --- a/src/Client/Public/Requests/Bsky/FeedPublicRequestClient.php +++ /dev/null @@ -1,162 +0,0 @@ -atp->client->get( - endpoint: BskyFeed::DescribeFeedGenerator - ); - - return DescribeFeedGeneratorResponse::fromArray($response->json()); - } - - public function getAuthorFeed(string $actor, int $limit = 50, ?string $cursor = null, ?string $filter = null): GetAuthorFeedResponse - { - $response = $this->atp->client->get( - endpoint: BskyFeed::GetAuthorFeed, - params: compact('actor', 'limit', 'cursor', 'filter') - ); - - return GetAuthorFeedResponse::fromArray($response->json()); - } - - public function getActorFeeds(string $actor, int $limit = 50, ?string $cursor = null): GetActorFeedsResponse - { - $response = $this->atp->client->get( - endpoint: BskyFeed::GetActorFeeds, - params: compact('actor', 'limit', 'cursor') - ); - - return GetActorFeedsResponse::fromArray($response->json()); - } - - public function getActorLikes(string $actor, int $limit = 50, ?string $cursor = null): GetActorLikesResponse - { - $response = $this->atp->client->get( - endpoint: BskyFeed::GetActorLikes, - params: compact('actor', 'limit', 'cursor') - ); - - return GetActorLikesResponse::fromArray($response->json()); - } - - public function getFeed(string $feed, int $limit = 50, ?string $cursor = null): GetFeedResponse - { - $response = $this->atp->client->get( - endpoint: BskyFeed::GetFeed, - params: compact('feed', 'limit', 'cursor') - ); - - return GetFeedResponse::fromArray($response->json()); - } - - public function getFeedGenerator(string $feed): GetFeedGeneratorResponse - { - $response = $this->atp->client->get( - endpoint: BskyFeed::GetFeedGenerator, - params: compact('feed') - ); - - return GetFeedGeneratorResponse::fromArray($response->json()); - } - - public function getFeedGenerators(array $feeds): GetFeedGeneratorsResponse - { - $response = $this->atp->client->get( - endpoint: BskyFeed::GetFeedGenerators, - params: compact('feeds') - ); - - return GetFeedGeneratorsResponse::fromArray($response->json()); - } - - public function getLikes(string $uri, int $limit = 50, ?string $cursor = null, ?string $cid = null): GetLikesResponse - { - $response = $this->atp->client->get( - endpoint: BskyFeed::GetLikes, - params: compact('uri', 'limit', 'cursor', 'cid') - ); - - return GetLikesResponse::fromArray($response->json()); - } - - public function getPostThread(string $uri, int $depth = 6, int $parentHeight = 80): GetPostThreadResponse - { - $response = $this->atp->client->get( - endpoint: BskyFeed::GetPostThread, - params: compact('uri', 'depth', 'parentHeight') - ); - - return GetPostThreadResponse::fromArray($response->json()); - } - - public function getPosts(array $uris): GetPostsResponse - { - $response = $this->atp->client->get( - endpoint: BskyFeed::GetPosts, - params: compact('uris') - ); - - return GetPostsResponse::fromArray($response->json()); - } - - public function getQuotes(string $uri, int $limit = 50, ?string $cursor = null, ?string $cid = null): GetQuotesResponse - { - $response = $this->atp->client->get( - endpoint: BskyFeed::GetQuotes, - params: compact('uri', 'limit', 'cursor', 'cid') - ); - - return GetQuotesResponse::fromArray($response->json()); - } - - public function getRepostedBy(string $uri, int $limit = 50, ?string $cursor = null, ?string $cid = null): GetRepostedByResponse - { - $response = $this->atp->client->get( - endpoint: BskyFeed::GetRepostedBy, - params: compact('uri', 'limit', 'cursor', 'cid') - ); - - return GetRepostedByResponse::fromArray($response->json()); - } - - public function getSuggestedFeeds(int $limit = 50, ?string $cursor = null): GetSuggestedFeedsResponse - { - $response = $this->atp->client->get( - endpoint: BskyFeed::GetSuggestedFeeds, - params: compact('limit', 'cursor') - ); - - return GetSuggestedFeedsResponse::fromArray($response->json()); - } - - public function searchPosts(string $q, int $limit = 25, ?string $cursor = null, ?string $sort = null): SearchPostsResponse - { - $response = $this->atp->client->get( - endpoint: BskyFeed::SearchPosts, - params: compact('q', 'limit', 'cursor', 'sort') - ); - - return SearchPostsResponse::fromArray($response->json()); - } -} diff --git a/src/Client/Public/Requests/Bsky/GraphPublicRequestClient.php b/src/Client/Public/Requests/Bsky/GraphPublicRequestClient.php deleted file mode 100644 index 8201995..0000000 --- a/src/Client/Public/Requests/Bsky/GraphPublicRequestClient.php +++ /dev/null @@ -1,108 +0,0 @@ -atp->client->get( - endpoint: BskyGraph::GetFollowers, - params: compact('actor', 'limit', 'cursor') - ); - - return GetFollowersResponse::fromArray($response->json()); - } - - public function getFollows(string $actor, int $limit = 50, ?string $cursor = null): GetFollowsResponse - { - $response = $this->atp->client->get( - endpoint: BskyGraph::GetFollows, - params: compact('actor', 'limit', 'cursor') - ); - - return GetFollowsResponse::fromArray($response->json()); - } - - public function getKnownFollowers(string $actor, int $limit = 50, ?string $cursor = null): GetKnownFollowersResponse - { - $response = $this->atp->client->get( - endpoint: BskyGraph::GetKnownFollowers, - params: compact('actor', 'limit', 'cursor') - ); - - return GetKnownFollowersResponse::fromArray($response->json()); - } - - public function getList(string $list, int $limit = 50, ?string $cursor = null): GetListResponse - { - $response = $this->atp->client->get( - endpoint: BskyGraph::GetList, - params: compact('list', 'limit', 'cursor') - ); - - return GetListResponse::fromArray($response->json()); - } - - public function getLists(string $actor, int $limit = 50, ?string $cursor = null): GetListsResponse - { - $response = $this->atp->client->get( - endpoint: BskyGraph::GetLists, - params: compact('actor', 'limit', 'cursor') - ); - - return GetListsResponse::fromArray($response->json()); - } - - public function getRelationships(string $actor, array $others = []): GetRelationshipsResponse - { - $response = $this->atp->client->get( - endpoint: BskyGraph::GetRelationships, - params: compact('actor', 'others') - ); - - return GetRelationshipsResponse::fromArray($response->json()); - } - - public function getStarterPack(string $starterPack): StarterPackView - { - $response = $this->atp->client->get( - endpoint: BskyGraph::GetStarterPack, - params: compact('starterPack') - ); - - return StarterPackView::fromArray($response->json()['starterPack']); - } - - public function getStarterPacks(array $uris): GetStarterPacksResponse - { - $response = $this->atp->client->get( - endpoint: BskyGraph::GetStarterPacks, - params: compact('uris') - ); - - return GetStarterPacksResponse::fromArray($response->json()); - } - - public function getSuggestedFollowsByActor(string $actor): GetSuggestedFollowsByActorResponse - { - $response = $this->atp->client->get( - endpoint: BskyGraph::GetSuggestedFollowsByActor, - params: compact('actor') - ); - - return GetSuggestedFollowsByActorResponse::fromArray($response->json()); - } -} diff --git a/src/Client/Public/Requests/Bsky/LabelerPublicRequestClient.php b/src/Client/Public/Requests/Bsky/LabelerPublicRequestClient.php deleted file mode 100644 index d541d73..0000000 --- a/src/Client/Public/Requests/Bsky/LabelerPublicRequestClient.php +++ /dev/null @@ -1,20 +0,0 @@ -atp->client->get( - endpoint: BskyLabeler::GetServices, - params: compact('dids', 'detailed') - ); - - return GetServicesResponse::fromArray($response->json(), $detailed); - } -} diff --git a/src/Client/Public/Requests/PublicRequest.php b/src/Client/Public/Requests/PublicRequest.php deleted file mode 100644 index 6f30d4f..0000000 --- a/src/Client/Public/Requests/PublicRequest.php +++ /dev/null @@ -1,15 +0,0 @@ -atp = $parent->root(); - } -}