|
5 | 5 | use Flat3\Lodata\Model;
|
6 | 6 |
|
7 | 7 | /**
|
8 |
| - * Interface for defining a modular OData service endpoint in Laravel. |
| 8 | + * Interface for defining a custom OData service endpoint. |
9 | 9 | *
|
10 |
| - * Implementers of this interface represent individually addressable OData services. |
11 |
| - * Each mounted under its own URI segment and backed by a schema model. |
12 |
| - * |
13 |
| - * This enables clean separation of business domains and supports multi-endpoint |
14 |
| - * discovery for modular application design. |
15 |
| - * |
16 |
| - * Configuration versus Declaration |
17 |
| - * -------------------------------- |
18 |
| - * The public URI segment used to expose a service is NOT determined by the |
19 |
| - * implementing class itself, but by the service map in `config/lodata.php`: |
20 |
| - * |
21 |
| - * ```php |
22 |
| - * 'endpoints' => [ |
23 |
| - * 'users' => \App\OData\UsersEndpoint::class, |
24 |
| - * 'budgets' => \App\OData\BudgetsEndpoint::class, |
25 |
| - * ] |
26 |
| - * ``` |
27 |
| - * |
28 |
| - * This keeps the routing surface under application control, and avoids |
29 |
| - * conflicts when two modules declare the same internal segment. |
30 |
| - * |
31 |
| - * To implement an endpoint: |
32 |
| - * - Extend `Flat3\Lodata\Endpoint` or implement this interface directly |
33 |
| - * - Register the class in `config/lodata.php` under a unique segment key |
34 |
| - * - Define the `discover()` method to expose entities via OData |
| 10 | + * Implementers can use this interface to expose a specific service under a custom path, |
| 11 | + * define its namespace, route behavior, and optionally provide a statically generated |
| 12 | + * $metadata document. |
35 | 13 | */
|
36 | 14 | interface ServiceEndpointInterface
|
37 | 15 | {
|
38 |
| - /** |
39 |
| - * Returns the ServiceURI segment name for this OData endpoint. |
40 |
| - * |
41 |
| - * This value is used in routing and metadata resolution. It Must be globally unique. |
42 |
| - * |
43 |
| - * @return string The segment (path identifier) of the endpoint |
44 |
| - */ |
45 |
| - public function serviceUri(): string; |
46 | 16 |
|
47 | 17 | /**
|
48 |
| - * Returns the fully qualified URL for this OData endpoint. |
| 18 | + * Returns the relative endpoint identifier within the OData service URI space. |
49 | 19 | *
|
50 |
| - * This includes the application host, port, and the configured segment, |
51 |
| - * https://<server>:<port>/<config('lodata.prefix')>/<service-uri>/, |
52 |
| - * Example: https://example.com/odata/users/ |
| 20 | + * This is the part that appears between the configured Lodata prefix and |
| 21 | + * the `$metadata` segment, e.g.: |
| 22 | + * https://<server>:<port>/<config('lodata.prefix')>/<endpoint>/$metadata |
53 | 23 | *
|
54 |
| - * This URL forms the base of the OData service space, and is used for navigation links |
55 |
| - * and metadata discovery. |
56 |
| - * |
57 |
| - * @return string The full URL of the service endpoint |
| 24 | + * @return string The relative OData endpoint path |
58 | 25 | */
|
59 | 26 | public function endpoint(): string;
|
60 | 27 |
|
61 | 28 | /**
|
62 |
| - * Returns the internal Laravel route path for this OData service endpoint. |
63 |
| - * |
64 |
| - * This is the relative URI path that Laravel uses to match incoming requests, |
65 |
| - * typically composed of the configured Lodata prefix and the service segment. |
| 29 | + * Returns the full request route to this service endpoint. |
66 | 30 | *
|
67 |
| - * Example: "odata/users" |
| 31 | + * This typically resolves to the route path used by Laravel to handle |
| 32 | + * incoming requests for this specific service instance. |
68 | 33 | *
|
69 |
| - * @return string Relative route path for the endpoint |
| 34 | + * @return string The full HTTP route to the endpoint |
70 | 35 | */
|
71 | 36 | public function route(): string;
|
72 | 37 |
|
|
0 commit comments