Skip to content

maleyva1/nerdtalk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nerdtalk

nerdtalk is an XML-RPC implementation in pure Nim.

nerdtalk is still very much in development so use this library at your own discretion.

Example Usage

Here is an example nerdtalk using the xmlRpcSpec macro:

import nerdtalk

xmlRpcSpec:
    name: "download_list"
    name: "d.name"
    params:
        hash: string

when isMainModule:
    echo download_list()
    echo d_name("ABDCEFGH1234567890")

For deserialization (unmarshalling):

import nerdtalk

# ...

socket.read(buffer, 1023)
var response = :!buffer

Documentation

Documentation can be generated with:

nimble docs

Implementation

In order to increase ease of use, nerdtalk maps Nim's type system to XML-RPC "types".

An int maps to <iN> where N is the bit width of the integer on the host platform

A float maps to <double>

A string, char, and cstring maps to <string>

A DateTime object maps to <datetime.iso8601>

A bool maps to <boolean>

An object maps to <struct>

An object marked with {.xrarray.} maps to <array>

Sequences and arrays map to <array>

Any type T can map to <base64> iff T implements $

F.A.Q.

  • Why {.xarray.}?

    XML-RPC allows different types within <array>. The {.xarray.} allows users to do so with custom object types since sequences and arrays require all elements to be of the same type.

TODO

  • Add support for deserialization between XmlRpcType and user-types a la std/json
  • Add more tests for deserialization and exception handling

About

XMP-RPC implementation in Nim

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages