Skip to content
This repository was archived by the owner on Nov 24, 2020. It is now read-only.

Commit f80ffc4

Browse files
committed
doc: improve documentation on how to use, command description and syntax
1 parent eb1065f commit f80ffc4

File tree

1 file changed

+46
-7
lines changed

1 file changed

+46
-7
lines changed

README.md

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,51 @@ The sdkgen is a tool that aims on solving client-server communication and data l
88

99
## How to use it
1010

11+
1) Install Crystal following instructions from: https://crystal-lang.org/docs/installation/;
12+
2) Download this repository;
13+
3) Run sdkgen in order to get the desired `sdk`. For more details about the command, check the next section:
1114
`crystal run main.cr -- api.sdkgen -o api.ts -t typescript_nodeserver`
1215

13-
14-
## TODO
15-
16-
- [ ] Improve README
17-
- [ ] Create and host documentation page
18-
- [ ] Make it database neutral
19-
- [x] Move associated tooling related to package publishing to travis
16+
## Options
17+
18+
`crystal run main.cr -- <SDKGEN FILE> -o <OUTPUT FILE> -t <TARGET>`
19+
20+
- `<SDKGEN FILE>`: .sdkgen file containing the API contract, check the next section to see more details about the syntax;
21+
- `<OUTPUT FILE>`: filename for the generated file;
22+
- `<TARGET>`: the target platform for where you are generating the sdk. Options avaiable are:
23+
- `java_android`
24+
- `kt_android`
25+
- `swift_ios`
26+
- `typescript_nodeclient`
27+
- `typescript_nodeserver`
28+
- `typescript_servertest`
29+
- `typescript_web`
30+
31+
## Syntax
32+
33+
The .sdkgen file is responsible for declaring the API contract and for that purpose it implements the following syntax:
34+
35+
```
36+
type Message {
37+
date: date
38+
author: User
39+
mentions: User[]
40+
text: string?
41+
}
42+
43+
// Sends a message, returns nothing
44+
function sendMessage(target: string, message: Message): void
45+
```
46+
47+
The primitive types available are:
48+
49+
- `bool`: Either `true` or `false`
50+
- `int`: an integer from -2147483648 to 2147483647
51+
- `uint`: a positive integer, from 0 to 4294967295
52+
- `float`: a floating-point number, equivalent to a `double` or `float64` from other languages
53+
- `string`: an UTF-8 encoded sequence of characters. This is not meant to store binary data, only printable/readable characters. There is a soft limit of 65535 chars in a string.
54+
- `date`: A point in time with millisecond precision. Timezone information is not preserved and will be converted to the local timezone of the receiver always.
55+
- `bytes`: Arbitrary binary data.
56+
- `void`: Special type that means the lack of value. Can only be used as the return type of a `function` operation (more on that later)
57+
58+
You can check the complete description on [language.md](../blob/master/language.md).

0 commit comments

Comments
 (0)