]> git.r.bdr.sh - rbdr/r.bdr.sh/blame - api.gmi
Update API Notation
[rbdr/r.bdr.sh] / api.gmi
CommitLineData
b0ca5dae
RBR
1--- title: /api.html
2--- description: API Notation
3# API Notation
4
12629849 5API Notation is a language-agnostic notation to share the public API of components in code. It was created to standardize software specification documents in teams that need to review code across several languages.
b0ca5dae 6
12629849 7The notation consists of one or more `definitions`, and `comments`
b0ca5dae 8
b0ca5dae 9```
12629849
RBR
10// Definitions start with object / module / class names, with namespaces
11// separated by periods. Types are marked between angular brackets.
12Definitions.Models.Post
13 // Properties.
14 +static_property <Type>
15 -instance_property <Types<Can<Be<Nested>>>>
16 // Methods. Parameters are listed in parentheses, and comma separated.
17 // Optional values are inside brackets
18 // => defines return values
19 // #> defines thrown exceptions, can be comma separated.
20 ::static_methods(parameter_label <Type>) => ReturnValueType #> BadTimesException,UnknownError
21 #update(text <String>, [options] <GlobalOptions.tOptions>) => Promise<Void>
22 // Listened Events
23 +>static_listener(parameters_expected <Bool>)
24 ->instance_listener()
25 ~>network_events(peer <Networking.Peer>)
26 // Emitted Events
27 <+emitted_statically(payload <StaticEventPayload>)
28 <-emitted_by_instance(reason <String>, code <Int>)
29 <~emitted_through_network(text <String>)
b0ca5dae
RBR
30```
31
12629849 32When defining function types, you may use parameter lists, returns and throws notation as well.
b0ca5dae
RBR
33
34```
12629849
RBR
35HypotheticalModule
36 #transform<T>( Function<T>(payload <T>) => <T>, announce <Bool>) => <Bool>
b0ca5dae 37```