Skip to content

bird/nimhq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nimhq

nimhq is a HQ Trivia API wrapper written in nim.

Usage

Install the package with nimble

nimble install nimhq

To use nimhq, you must import both nimhq and json

import nimhq, json

When compiling, you must define a conditional symbol of SSL, to enable SSL support. For example:

nim c -d:SSL -r file.nim

Example Usage

Creating a new hqClient to interface with the API

let client = hqClient(loginToken="ac4321NGx06pCFVHZEfSmD4k5caYE3NbR8utLrvduGJPYGTpkoctVdMGukC5VMFF")

Displaying the schedule

echo client.schedule()

Changing a username

discard(client.changeUsername("ExampleUsername123"))

A note on Nim Limitations

This wrapper was originally inteded to use types, which, for example, would have changed echo client["accessToken"] to echo client.accessToken. While that would be much more preferred, Nim does not currently support types than can vary, as parts of the HQ Trivia API change the type of data they return. As such, using JsonNode's was the best possible solution, despite being the less desirable one. If Nim adds support for this in the future, usage of types may be revisited.

License

MIT

About

HQ Trivia API wrapper for Nim

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages