11import { Promise } from 'es6-promise' ;
22import 'isomorphic-fetch' ;
3- import { Options , URLComponents , GraphRequestCallback } from "./common" ;
3+ import { Options , URLComponents , GraphRequestCallback , FetchOptions } from "./common" ;
44export declare class GraphRequest {
55 config : Options ;
66 urlComponents : URLComponents ;
7+ _options : FetchOptions ;
78 _headers : {
8- [ key : string ] : string | number ;
9+ [ key : string ] : string ;
910 } ;
1011 _responseType : string ;
1112 constructor ( config : Options , path : string ) ;
1213 header ( headerKey : string , headerValue : string ) : this;
1314 headers ( headers : {
1415 [ key : string ] : string | number ;
1516 } ) : this;
17+ option ( key : string , value : any ) : this;
18+ options ( options : {
19+ [ key : string ] : any ;
20+ } ) : this;
1621 parsePath ( rawPath : string ) : void ;
1722 private urlJoin ;
1823 buildFullUrl ( ) : string ;
@@ -28,21 +33,57 @@ export declare class GraphRequest {
2833 responseType ( responseType : string ) : GraphRequest ;
2934 private addCsvQueryParamater ;
3035 delete ( callback ?: GraphRequestCallback ) : Promise < any > ;
36+ /**
37+ * Alias for delete call
38+ */
39+ del ( callback ?: GraphRequestCallback ) : Promise < any > ;
3140 patch ( content : any , callback ?: GraphRequestCallback ) : Promise < any > ;
3241 post ( content : any , callback ?: GraphRequestCallback ) : Promise < any > ;
33- put ( content : any , callback ?: GraphRequestCallback ) : Promise < any > ;
42+ /**
43+ * Alias for Post call
44+ */
3445 create ( content : any , callback ?: GraphRequestCallback ) : Promise < any > ;
46+ put ( content : any , callback ?: GraphRequestCallback ) : Promise < any > ;
47+ /**
48+ * Alias for update call
49+ */
3550 update ( content : any , callback ?: GraphRequestCallback ) : Promise < any > ;
36- del ( callback ?: GraphRequestCallback ) : Promise < any > ;
3751 get ( callback ?: GraphRequestCallback ) : Promise < any > ;
52+ getStream ( callback : GraphRequestCallback ) : Promise < any > ;
53+ putStream ( stream : any , callback : GraphRequestCallback ) : Promise < any > ;
54+ /**
55+ * @private
56+ * Sends request and routes response to the callback or resolves to promise
57+ * @param {RequestInfo } request - The Request object or url string value
58+ * @param {FetchOptions } options - The options for the fetch api request
59+ * @param {GraphRequestCallback } callback - The callback that needs to be called on response
60+ * @return The promise in case if the callback param is empty
61+ */
62+ private sendRequestAndRouteResponse ;
63+ /**
64+ * @private
65+ * Gets the Promise that will resolve or reject with fetch api request
66+ * @param {RequestInfo } request - The Request object or url string value
67+ * @param {FetchOptions } options - The options for the fetch api request
68+ * @return The Promise that resolves with Response
69+ */
3870 private routeResponseToPromise ;
39- private handleFetch ;
71+ /**
72+ * @private
73+ * Makes request to the service by getting auth token from the auth provider
74+ * @param {RequestInfo } request - The Request object or url string value
75+ * @param {FetchOptions } options - The options for the fetch api request
76+ * @param {GraphRequestCallback } callback - The callback function
77+ */
4078 private routeResponseToCallback ;
41- private sendRequestAndRouteResponse ;
42- getStream ( callback : GraphRequestCallback ) : void ;
43- putStream ( stream : any , callback : GraphRequestCallback ) : void ;
44- private getDefaultRequestHeaders ;
45- private configureRequest ;
79+ /**
80+ * @private
81+ * Customizes the fetch options with the Auth token, SDKVersion header and customization applied via init, .header, .headers, .option, .options etc
82+ * @param {FetchOptions } options - The options for the fetch api request
83+ * @param {string } accessToken - The access token value
84+ * @return The fetch options with customization
85+ */
86+ private configureRequestOptions ;
4687 query ( queryDictionaryOrString : string | {
4788 [ key : string ] : string | number ;
4889 } ) : GraphRequest ;
0 commit comments