Заметки о встроенных командах
Пакеты добавляют такие же примечания к своим командам, методам и элементам, рядом с их примерами. Файлы пакетов показывают их под каждой записью:
- `->push(items...): list` A new list with items added to the end.
- pitfall: Returns a new list and leaves the old one alone: write items = $items->push($x).
- e.g. `[1, 2]->push(3, 4)`
- `@api(url: string, options?: map): response` Makes an HTTP request and returns the response.
- `options.timeout: duration` Maximum wait for an outbound HTTP(S) request. Example `30s`.
- prefer: @api($url, as: Type) (the same as ->check()->convert(from: json, as: Type)) to fail fast and check the data's shape.
- pitfall: A 4xx or 5xx status doesn't throw: chain ->check() (throws Network) or test .is_ok.Пакет, написанный на C#, добавляет их с помощью p.AgentNotes(("list->push", new AgentNotes(pitfall: "..."))), с ключом вида p.Examples ("@api", "list->push" или "<input>" для элемента). Делайте каждую заметку короткой, в одну строку, так как агенты читают их все.