Laravel AT Protocol Client (alpha & unstable)
at dev 1.6 kB view raw
1<?php 2 3namespace SocialDept\AtpClient; 4 5use SocialDept\AtpClient\Client\AtprotoClient; 6use SocialDept\AtpClient\Client\BskyClient; 7use SocialDept\AtpClient\Client\ChatClient; 8use SocialDept\AtpClient\Client\Client; 9use SocialDept\AtpClient\Client\OzoneClient; 10use SocialDept\AtpClient\Concerns\HasExtensions; 11use SocialDept\AtpClient\Session\SessionManager; 12 13class AtpClient 14{ 15 use HasExtensions; 16 17 /** 18 * Raw API communication/networking class 19 */ 20 public Client $client; 21 22 /** 23 * Collection of Bluesky (app.bsky.*) related functions 24 */ 25 public BskyClient $bsky; 26 27 /** 28 * Collection of AT Protocol (com.atproto.*) related functions 29 */ 30 public AtprotoClient $atproto; 31 32 /** 33 * Collection of Chat (chat.bsky.*) related functions 34 */ 35 public ChatClient $chat; 36 37 /** 38 * Collection of Ozone (tools.ozone.*) related functions 39 */ 40 public OzoneClient $ozone; 41 42 public function __construct( 43 ?SessionManager $sessions = null, 44 ?string $did = null, 45 ?string $serviceUrl = null, 46 ) { 47 // Load the network client (supports both public and authenticated modes) 48 $this->client = new Client($this, $sessions, $did, $serviceUrl); 49 50 // Load all function collections 51 $this->bsky = new BskyClient($this); 52 $this->atproto = new AtprotoClient($this); 53 $this->chat = new ChatClient($this); 54 $this->ozone = new OzoneClient($this); 55 } 56 57 /** 58 * Check if client is in public mode (no authentication). 59 */ 60 public function isPublicMode(): bool 61 { 62 return $this->client->isPublicMode(); 63 } 64}