Laravel AT Protocol Client (alpha & unstable)
1<?php
2
3namespace SocialDept\AtpClient\Attributes;
4
5use Attribute;
6
7/**
8 * Documents that a method is a public endpoint that does not require authentication.
9 *
10 * This attribute currently serves as documentation to indicate which AT Protocol
11 * endpoints can be called without an authenticated session. It helps developers
12 * understand which endpoints work with `Atp::public()` against public API endpoints
13 * like `https://public.api.bsky.app`.
14 *
15 * While this attribute does not currently perform runtime enforcement, scope
16 * validation will be implemented in a future release. Correctly attributing
17 * endpoints now ensures forward compatibility when enforcement is enabled.
18 *
19 * Public endpoints typically include operations like:
20 * - Reading public profiles and posts
21 * - Searching actors and content
22 * - Resolving handles to DIDs
23 * - Accessing repository data (sync endpoints)
24 * - Describing servers and feed generators
25 *
26 * @example Basic usage
27 * ```php
28 * #[PublicEndpoint]
29 * public function getProfile(string $actor): ProfileViewDetailed
30 * ```
31 *
32 * @see \SocialDept\AtpClient\Attributes\ScopedEndpoint For endpoints that require authentication
33 */
34#[Attribute(Attribute::TARGET_METHOD)]
35class PublicEndpoint
36{
37 /**
38 * @param string $description Human-readable description of the endpoint
39 */
40 public function __construct(
41 public readonly string $description = '',
42 ) {}
43}