Laravel AT Protocol Client (alpha & unstable)
at dev 1.8 kB view raw
1<?php 2 3namespace SocialDept\AtpClient\Client\Requests\Chat; 4 5use SocialDept\AtpClient\Attributes\ScopedEndpoint; 6use SocialDept\AtpClient\Client\Requests\Request; 7use SocialDept\AtpClient\Data\Responses\EmptyResponse; 8use SocialDept\AtpClient\Enums\Nsid\ChatActor; 9use SocialDept\AtpClient\Enums\Scope; 10use SocialDept\AtpClient\Http\Response; 11 12class ActorRequestClient extends Request 13{ 14 /** 15 * Get actor metadata 16 * 17 * @requires transition:chat.bsky (rpc:chat.bsky.actor.getActorMetadata) 18 * 19 * @see https://docs.bsky.app/docs/api/chat-bsky-actor-export-account-data 20 */ 21 #[ScopedEndpoint(Scope::TransitionChat, granular: 'rpc:chat.bsky.actor.getActorMetadata')] 22 public function getActorMetadata(): Response 23 { 24 return $this->atp->client->get( 25 endpoint: ChatActor::GetActorMetadata 26 ); 27 } 28 29 /** 30 * Export account data (returns JSONL stream) 31 * 32 * @requires transition:chat.bsky (rpc:chat.bsky.actor.exportAccountData) 33 * 34 * @see https://docs.bsky.app/docs/api/chat-bsky-actor-export-account-data 35 */ 36 #[ScopedEndpoint(Scope::TransitionChat, granular: 'rpc:chat.bsky.actor.exportAccountData')] 37 public function exportAccountData(): Response 38 { 39 return $this->atp->client->get( 40 endpoint: ChatActor::ExportAccountData 41 ); 42 } 43 44 /** 45 * Delete account 46 * 47 * @requires transition:chat.bsky (rpc:chat.bsky.actor.deleteAccount) 48 * 49 * @see https://docs.bsky.app/docs/api/chat-bsky-actor-delete-account 50 */ 51 #[ScopedEndpoint(Scope::TransitionChat, granular: 'rpc:chat.bsky.actor.deleteAccount')] 52 public function deleteAccount(): EmptyResponse 53 { 54 $this->atp->client->post( 55 endpoint: ChatActor::DeleteAccount 56 ); 57 58 return new EmptyResponse; 59 } 60}