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

Commit 9d0bf3b

Browse files
authored
Merge pull request #55 from cubos/doc/improve-how-to-use
Improve README
2 parents cd803d0 + 84cce36 commit 9d0bf3b

File tree

7 files changed

+59
-88
lines changed

7 files changed

+59
-88
lines changed

.travis.yml

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,23 @@ sudo: required
22

33
language: node_js
44
node_js:
5-
- '8'
5+
- "8"
66

77
services:
88
- docker
99

1010
script:
11-
- git config --global user.name "${GH_NAME}"
12-
- git config --global user.email "${GH_EMAIL}"
13-
- echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc
14-
- cd website
15-
- yarn install && GIT_USER="${GH_NAME}" yarn run publish-gh-pages
16-
- cd ..
17-
- if [[ "$TRAVIS_TAG" ]] ; then
18-
docker image build . -t cubos/sdkgen -t cubos/sdkgen:$TRAVIS_TAG;
19-
else
20-
docker image build .;
21-
fi
11+
- if [[ "$TRAVIS_TAG" ]] ; then
12+
docker image build . -t cubos/sdkgen -t cubos/sdkgen:$TRAVIS_TAG;
13+
else
14+
docker image build .;
15+
fi
2216

2317
deploy:
24-
provider: script
25-
skip_cleanup: true
26-
script:
27-
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" && docker push cubos/sdkgen:$TRAVIS_TAG
28-
on:
29-
branch: master
30-
tags: true
31-
18+
provider: script
19+
skip_cleanup: true
20+
script:
21+
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" && docker push cubos/sdkgen:$TRAVIS_TAG
22+
on:
23+
branch: master
24+
tags: true

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](language.md).

docs/doc1.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs/doc2.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/doc3.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/exampledoc4.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/exampledoc5.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)