@@ -8,7 +8,7 @@ export module WebApiClient {
88 let ClientUrl : string ;
99 let Token : string ;
1010
11- export type Promise < U > = bluebird < U > ;
11+ export let Promise : typeof bluebird ;
1212
1313 interface Header {
1414 key : string ;
@@ -26,37 +26,39 @@ export module WebApiClient {
2626 }
2727
2828 interface BaseParameters {
29- async : boolean ;
30- headers : Array < Header >
29+ async ? : boolean ;
30+ headers ? : Array < Header >
3131 }
3232
3333 interface CreateParameters extends BaseParameters {
34- entityName : string ;
34+ entityName ?: string ;
35+ overriddenSetName ?: string ;
3536 entity : object ;
3637 }
3738
3839 interface RetrieveParameters extends BaseParameters {
39- entityName : string ;
40- entityId : string ;
41- alternateKey : Array < Key > ;
42- queryParams : string ;
43- fetchXml : string ;
44- returnAllPages : boolean ;
40+ entityName ?: string ;
41+ overriddenSetName ?: string ;
42+ entityId ?: string ;
43+ alternateKey ?: Array < Key > ;
44+ queryParams ?: string ;
45+ fetchXml ?: string ;
46+ returnAllPages ?: boolean ;
4547 }
4648
4749 interface UpdateParameters extends BaseParameters {
48- entityName : string ;
49- entityId : string ;
50+ entityName ?: string ;
51+ overriddenSetName ?: string ;
52+ entityId ?: string ;
5053 entity : object ;
51- alternateKey : Array < Key > ;
54+ alternateKey ? : Array < Key > ;
5255 }
5356
5457 interface DeleteParameters extends BaseParameters {
55- entityName : string ;
56- entityId : string ;
57- entity : object ;
58- alternateKey : Array < Key > ;
59- queryParams : string ;
58+ entityName ?: string ;
59+ overriddenSetName ?: string ;
60+ entityId ?: string ;
61+ alternateKey ?: Array < Key > ;
6062 }
6163
6264 interface AssociationParameters extends BaseParameters {
@@ -67,134 +69,134 @@ export module WebApiClient {
6769
6870 interface BatchRequestParameters {
6971 method : string ;
70- url : string ;
71- payload : string ;
72- headers : Array < Header > ;
73- contentId : string ;
72+ url ? : string ;
73+ payload ? : string ;
74+ headers ? : Array < Header > ;
75+ contentId ? : string ;
7476 }
7577
7678 class BatchRequest implements BatchRequestParameters {
7779 method : string ;
78- url : string ;
79- payload : string ;
80- headers : Array < Header > ;
81- contentId : string ;
80+ url ? : string ;
81+ payload ? : string ;
82+ headers ? : Array < Header > ;
83+ contentId ? : string ;
8284
8385 constructor ( params : BatchRequestParameters ) ;
8486 }
8587
8688 interface ResponseParameters {
87- rawData : string ;
88- contentId : string ;
89- payload : object ;
90- status : string ;
89+ rawData ? : string ;
90+ contentId ? : string ;
91+ payload ? : object ;
92+ status ? : string ;
9193
9294 // Basically an object = associative array, access headers by name and get the value
93- headers : object ;
95+ headers ?: any ;
9496 }
9597
9698 class Response implements ResponseParameters {
97- rawData : string ;
98- contentId : string ;
99- payload : object ;
100- status : string ;
101- headers : object ;
99+ rawData ? : string ;
100+ contentId ? : string ;
101+ payload ? : object ;
102+ status ? : string ;
103+ headers ?: any ;
102104
103105 constructor ( parameters : ResponseParameters ) ;
104106 }
105107
106108 class ChangeSetResponse {
107- name : string ;
108- responses : Array < Response > ;
109+ name ? : string ;
110+ responses ? : Array < Response > ;
109111 }
110112
111113 interface BatchResponseParameters {
112- name : string ;
113- changeSetResponses : Array < ChangeSetResponse > ;
114- batchResponses : Array < Response > ;
115- isFaulted : boolean ;
116- errors : Array < string > ;
117- xhr : XMLHttpRequest ;
114+ name ? : string ;
115+ changeSetResponses ? : Array < ChangeSetResponse > ;
116+ batchResponses ? : Array < Response > ;
117+ isFaulted ? : boolean ;
118+ errors ? : Array < string > ;
119+ xhr ? : XMLHttpRequest ;
118120 }
119121
120122 class BatchResponse implements BatchResponseParameters {
121- name : string ;
122- changeSetResponses : Array < ChangeSetResponse > ;
123- batchResponses : Array < Response > ;
124- isFaulted : boolean ;
125- errors : Array < string > ;
126- xhr : XMLHttpRequest ;
123+ name ? : string ;
124+ changeSetResponses ? : Array < ChangeSetResponse > ;
125+ batchResponses ? : Array < Response > ;
126+ isFaulted ? : boolean ;
127+ errors ? : Array < string > ;
128+ xhr ? : XMLHttpRequest ;
127129
128130 constructor ( parameters : BatchResponseParameters ) ;
129131 }
130132
131133 interface ChangeSetParameters {
132- name : string ;
133- requests : Array < BatchRequest > ;
134+ name ? : string ;
135+ requests ? : Array < BatchRequest > ;
134136 }
135137
136138 class ChangeSet implements ChangeSetParameters {
137- name : string ;
138- requests : Array < BatchRequest > ;
139+ name ? : string ;
140+ requests ? : Array < BatchRequest > ;
139141
140142 constructor ( parameters : ChangeSetParameters ) ;
141143 }
142144
143145 interface BatchParameters extends BaseParameters {
144- name : string ;
145- changeSets : Array < ChangeSet > ;
146- requests : Array < BatchRequest > ;
147- isOverLengthGet : boolean ;
146+ name ? : string ;
147+ changeSets ? : Array < ChangeSet > ;
148+ requests ? : Array < BatchRequest > ;
149+ isOverLengthGet ? : boolean ;
148150 }
149151
150152 class Batch implements BatchParameters {
151- name : string ;
152- changeSets : Array < ChangeSet > ;
153- requests : Array < BatchRequest > ;
154- headers : Array < Header > ;
155- async : boolean ;
156- isOverLengthGet : boolean ;
153+ name ? : string ;
154+ changeSets ? : Array < ChangeSet > ;
155+ requests ? : Array < BatchRequest > ;
156+ headers ? : Array < Header > ;
157+ async ? : boolean ;
158+ isOverLengthGet ? : boolean ;
157159
158160 constructor ( parameters : BatchParameters ) ;
159161 }
160162
161- function Create ( parameters : CreateParameters ) : Promise < string > | Promise < object > | string | object ;
163+ function Create ( parameters : CreateParameters ) : Promise < string > | Promise < any > | string | any ;
162164
163- function Retrieve ( parameters : RetrieveParameters ) : Promise < object > | object ;
165+ function Retrieve ( parameters : RetrieveParameters ) : Promise < any > | any ;
164166
165- function Update ( parameters : UpdateParameters ) : Promise < string > | Promise < object > | string | object ;
167+ function Update ( parameters : UpdateParameters ) : Promise < string > | Promise < any > | string | any ;
166168
167169 function Delete ( parameters : DeleteParameters ) : Promise < string > | string ;
168170
169171 function Associate ( parameters : AssociationParameters ) : Promise < string > | string ;
170172
171173 function Disassociate ( parameters : AssociationParameters ) : Promise < string > | string ;
172174
173- function Execute ( request : object ) : Promise < object > | object ;
175+ function Execute ( request : object ) : Promise < any > | any ;
174176
175177 function SendBatch ( batch : Batch ) : Promise < BatchResponse > | BatchResponse ;
176178
177179 namespace Requests {
178180 interface RequestParameters extends BaseParameters {
179- method : string ;
180- name : string ;
181- bound : boolean ;
182- entityName : boolean ;
183- entityId : string ;
184- payload : object ;
185- urlParams : object ;
181+ method ? : string ;
182+ name ? : string ;
183+ bound ? : boolean ;
184+ entityName ? : boolean ;
185+ entityId ? : string ;
186+ payload ? : object ;
187+ urlParams ? : object ;
186188 }
187189
188190 class Request implements RequestParameters {
189- method : string ;
190- name : string ;
191- bound : boolean ;
192- entityName : boolean ;
193- entityId : string ;
194- payload : object ;
195- headers : Array < Header > ;
196- urlParams : object ;
197- async : boolean ;
191+ method ? : string ;
192+ name ? : string ;
193+ bound ? : boolean ;
194+ entityName ? : boolean ;
195+ entityId ? : string ;
196+ payload ? : object ;
197+ headers ? : Array < Header > ;
198+ urlParams ? : object ;
199+ async ? : boolean ;
198200
199201 with ( param : RequestParameters ) : this;
200202 }
0 commit comments