Laravel AT Protocol Client (alpha & unstable)
3
fork

Configure Feed

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

Add typed responses to IdentityRequestClient

+36 -3
+7 -3
src/Client/Requests/Atproto/IdentityRequestClient.php
··· 5 5 use SocialDept\AtpClient\Attributes\PublicEndpoint; 6 6 use SocialDept\AtpClient\Attributes\ScopedEndpoint; 7 7 use SocialDept\AtpClient\Client\Requests\Request; 8 + use SocialDept\AtpClient\Data\Responses\Atproto\Identity\ResolveHandleResponse; 9 + use SocialDept\AtpClient\Data\Responses\EmptyResponse; 8 10 use SocialDept\AtpClient\Enums\Nsid\AtprotoIdentity; 9 11 use SocialDept\AtpClient\Enums\Scope; 10 12 ··· 16 18 * @see https://docs.bsky.app/docs/api/com-atproto-identity-resolve-handle 17 19 */ 18 20 #[PublicEndpoint] 19 - public function resolveHandle(string $handle): string 21 + public function resolveHandle(string $handle): ResolveHandleResponse 20 22 { 21 23 $response = $this->atp->client->get( 22 24 endpoint: AtprotoIdentity::ResolveHandle, 23 25 params: compact('handle') 24 26 ); 25 27 26 - return $response->json()['did']; 28 + return ResolveHandleResponse::fromArray($response->json()); 27 29 } 28 30 29 31 /** ··· 34 36 * @see https://docs.bsky.app/docs/api/com-atproto-identity-update-handle 35 37 */ 36 38 #[ScopedEndpoint(Scope::Atproto, granular: 'identity:handle')] 37 - public function updateHandle(string $handle): void 39 + public function updateHandle(string $handle): EmptyResponse 38 40 { 39 41 $this->atp->client->post( 40 42 endpoint: AtprotoIdentity::UpdateHandle, 41 43 body: compact('handle') 42 44 ); 45 + 46 + return new EmptyResponse; 43 47 } 44 48 }
+29
src/Data/Responses/Atproto/Identity/ResolveHandleResponse.php
··· 1 + <?php 2 + 3 + namespace SocialDept\AtpClient\Data\Responses\Atproto\Identity; 4 + 5 + use Illuminate\Contracts\Support\Arrayable; 6 + 7 + /** 8 + * @implements Arrayable<string, string> 9 + */ 10 + class ResolveHandleResponse implements Arrayable 11 + { 12 + public function __construct( 13 + public readonly string $did, 14 + ) {} 15 + 16 + public static function fromArray(array $data): self 17 + { 18 + return new self( 19 + did: $data['did'], 20 + ); 21 + } 22 + 23 + public function toArray(): array 24 + { 25 + return [ 26 + 'did' => $this->did, 27 + ]; 28 + } 29 + }