From eef766bf96565010ae839311ad7460937fc4238a Mon Sep 17 00:00:00 2001 From: mtgto Date: Sat, 18 Feb 2017 11:15:44 +0900 Subject: [PATCH] [xmlrpc] Add CustomType. --- xmlrpc/index.d.ts | 7 +++++++ xmlrpc/xmlrpc-tests.ts | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/xmlrpc/index.d.ts b/xmlrpc/index.d.ts index b962be4324..8425d4672c 100644 --- a/xmlrpc/index.d.ts +++ b/xmlrpc/index.d.ts @@ -84,6 +84,13 @@ declare module 'xmlrpc' { decodeIso8601(time: string): Date; encodeIso8601(date: Date): string; } + + export class CustomType { + tagName: string; + raw: string; + constructor(raw: string); + serialize(xml: any): any; // XMLElementOrXMLNode declared by xmlbuilder + } } export = xmlrpc; diff --git a/xmlrpc/xmlrpc-tests.ts b/xmlrpc/xmlrpc-tests.ts index a7e8dcffbe..b9cdff2e3f 100644 --- a/xmlrpc/xmlrpc-tests.ts +++ b/xmlrpc/xmlrpc-tests.ts @@ -23,4 +23,14 @@ const server = xmlrpc.createServer(serverOpts, () => { client.methodCall('hello', ['world'], (err, val) => { console.log(val); }); + + class Value extends xmlrpc.CustomType { + constructor(value: any) { + super(value); + this.tagName = 'Value'; + } + } + client.methodCall('hello', [new Value('custom_string_value')], (err, val) => { + console.log(val); + }); });