From cbfaf727e18c47c393f48858a7a1ad58911c3700 Mon Sep 17 00:00:00 2001 From: etuxxyl Date: Tue, 8 Mar 2016 12:23:09 +0800 Subject: [PATCH 1/2] add soap moudle definition --- soap/soap-tests.ts | 19 +++++++++++++++++++ soap/soap.d.ts | 17 +++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 soap/soap-tests.ts create mode 100644 soap/soap.d.ts diff --git a/soap/soap-tests.ts b/soap/soap-tests.ts new file mode 100644 index 000000000..d876282b5 --- /dev/null +++ b/soap/soap-tests.ts @@ -0,0 +1,19 @@ +/// + +import * as soap from 'soap'; + +const url = 'http://example.com/wsdl?wsdl'; +const wsdlOptions = {name: 'value'}; + +soap.createClient(url, wsdlOptions, function(err: any, client: soap.Client) { + let securityOptions = { 'hasTimeStamp': false }; + client.setSecurity(new soap.WSSecurity('user', 'password', securityOptions)); + client.addSoapHeader({}); + client['create']({name: 'value'}, function(err, result) { + // result is an object + }); + client['create']({name: 'value'}, function(err, result) { + // result is an object + }, {}); +}); + diff --git a/soap/soap.d.ts b/soap/soap.d.ts new file mode 100644 index 000000000..c2b82d583 --- /dev/null +++ b/soap/soap.d.ts @@ -0,0 +1,17 @@ +// Type definitions for soap +// Project: https://www.npmjs.com/package/soap +// Definitions by: Nicole Wang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'soap' { + class WSSecurity { + constructor(username: string, password: string, options: any); + } + interface Client { + setSecurity(s: WSSecurity): void; + [method: string]: (args: any, fn: (err: any, result: any) => void, options?: any) => void; + addSoapHeader(headJSON: any): void; + } + function createClient(wsdlPath: string, options: any, fn: (err: any, client: Client) => void): void; + +} \ No newline at end of file From 3d51b999a3094d0b877f51f6dab0497e87fc41c7 Mon Sep 17 00:00:00 2001 From: etuxxyl Date: Tue, 8 Mar 2016 13:13:09 +0800 Subject: [PATCH 2/2] beautify soap definition files --- soap/soap-tests.ts | 6 +++--- soap/soap.d.ts | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/soap/soap-tests.ts b/soap/soap-tests.ts index d876282b5..e92257595 100644 --- a/soap/soap-tests.ts +++ b/soap/soap-tests.ts @@ -3,16 +3,16 @@ import * as soap from 'soap'; const url = 'http://example.com/wsdl?wsdl'; -const wsdlOptions = {name: 'value'}; +const wsdlOptions = { name: 'value' }; soap.createClient(url, wsdlOptions, function(err: any, client: soap.Client) { let securityOptions = { 'hasTimeStamp': false }; client.setSecurity(new soap.WSSecurity('user', 'password', securityOptions)); client.addSoapHeader({}); - client['create']({name: 'value'}, function(err, result) { + client['create']({ name: 'value' }, function(err, result) { // result is an object }); - client['create']({name: 'value'}, function(err, result) { + client['create']({ name: 'value' }, function(err, result) { // result is an object }, {}); }); diff --git a/soap/soap.d.ts b/soap/soap.d.ts index c2b82d583..2685953cc 100644 --- a/soap/soap.d.ts +++ b/soap/soap.d.ts @@ -4,14 +4,14 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'soap' { - class WSSecurity { - constructor(username: string, password: string, options: any); - } - interface Client { - setSecurity(s: WSSecurity): void; - [method: string]: (args: any, fn: (err: any, result: any) => void, options?: any) => void; - addSoapHeader(headJSON: any): void; - } - function createClient(wsdlPath: string, options: any, fn: (err: any, client: Client) => void): void; + class WSSecurity { + constructor(username: string, password: string, options: any); + } + interface Client { + setSecurity(s: WSSecurity): void; + [method: string]: (args: any, fn: (err: any, result: any) => void, options?: any) => void; + addSoapHeader(headJSON: any): void; + } + function createClient(wsdlPath: string, options: any, fn: (err: any, client: Client) => void): void; } \ No newline at end of file