This repository has been archived by the owner. It is now read-only.
sdkgen 0.4.6
sdkgen
THIS REPOSITORY IS DEPRECATED. See https://github.com/sdkgen/sdkgen.
The sdkgen is a tool that aims on solving client-server communication and data layout sharing between server, web, android and ios using a description language also called sdkgen.
How to use it
- Install Crystal following instructions from: https://crystal-lang.org/docs/installation/;
- Download this repository;
- Run sdkgen in order to get the desired
sdk
. For more details about the command, check the next section:crystal run main.cr -- api.sdkgen -o api.ts -t typescript_nodeserver
Options
crystal run main.cr -- <SDKGEN FILE> -o <OUTPUT FILE> -t <TARGET>
<SDKGEN FILE>
: .sdkgen file containing the API contract, check the next section to see more details about the syntax;<OUTPUT FILE>
: filename for the generated file;<TARGET>
: the target platform for where you are generating the sdk. Options avaiable are:java_android
kt_android
swift_ios
typescript_nodeclient
typescript_nodeserver
typescript_servertest
typescript_web
Syntax
The .sdkgen file is responsible for declaring the API contract and for that purpose it implements the following syntax:
type Message {
date: date
author: User
mentions: User[]
text: string?
}
// Sends a message, returns nothing
function sendMessage(target: string, message: Message): void
The primitive types available are:
bool
: Eithertrue
orfalse
int
: an integer from -2147483648 to 2147483647uint
: a positive integer, from 0 to 4294967295float
: a floating-point number, equivalent to adouble
orfloat64
from other languagesstring
: 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.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.bytes
: Arbitrary binary data.void
: Special type that means the lack of value. Can only be used as the return type of afunction
operation (more on that later)
You can check the complete description on language.md.
Repository
sdkgen
Owner
Statistic
- 45
- 9
- 19
- 0
- 0
- over 4 years ago
- February 7, 2018
License
MIT License
Links
Synced at
Sat, 21 Dec 2024 13:04:16 GMT
Languages