Author: | levshx |
---|---|
Version: | 0.0.2 |
This document describes the usage of the WebAPI builder
This is the second, more detailed version of the Steam Web API implementation.
WebAPI builder is free software; it is licensed under the MIT License.
To begin with, I will say that the compiled library is created based on JSON API data at the link: WebAPI JSON. The compiler parses this data and creates a WebAPI library. The Steam Web API documentation may have errors, as it is developed and modified at their discretion. The compiled library can be changed manually. This is necessary because Steam provides different Web APIs for different users.
At the root of the project is webapibuilder.nim, this is a program that takes the parameter of the Web API key and generates the library code.
To compile the library, run the command in the root of the repository: :
git clone https://github.com/levshx/nim-steam.git cd nim-steam nim c -r webapibuilder <KEY || -keyless>
Where the KEY is your Web API key provided on https://steamcommunity.com/dev/apikey
If you don't want to use the key, you can use the -keyless parameter, but this build will be limited and won't have many features.
The assembly will be placed at the path : /buildedwebapi/builded_webapi.nim
The library provides 2 types of client, synchronous and asynchronous.
To create a client, run:
var client = newSteamWebAPI() var asyncClient = newAsyncSteamWebAPI()
This object stores the objects of the Steam WebAPI interfaces as variables that you can access.
The interfaces themselves have information about the methods of themselves, this is name: string and methods: seq[string] method format in methods[<index>]: METHOD_NAME:VERSION.
Interface names begin with the letter I.
Methods of this interface correspond to each interface, the names of these methods are generated in the following format:
MethodNameV1(*args):string, where V1 corresponds to version 1.
For example:
import builded_webapi.nim let keySteam = "XXXXYYYYZZZZDDDDAAAA1234" var client = newSteamWebAPI(key = keySteam) let result = client.ISteamWebAPIUtil.GetSupportedAPIListV1()`