Merge pull request #14715 from mtgto/xmlrpc-custom

[xmlrpc] Add CustomType.
This commit is contained in:
anubmat
2017-02-23 10:55:44 -08:00
committed by GitHub
2 changed files with 17 additions and 0 deletions
+7
View File
@@ -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;
+10
View File
@@ -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);
});
});