@@ -12,7 +12,6 @@ const GRAPH_BASE_URL = "https://graph.microsoft.com/";
1212class GraphRequest {
1313 constructor ( config , path ) {
1414 this . config = config ;
15- this . urlParamSubstitutions = { } ;
1615 this . _headers = { } ;
1716 this . urlComponents = {
1817 host : this . config . baseUrl ,
@@ -29,7 +28,7 @@ class GraphRequest {
2928 message : rawErr . message ,
3029 requestId : null ,
3130 date : null ,
32- body : rawErr . response . text
31+ body : ( rawErr . response !== undefined ) ? rawErr . response . text : null
3332 } ;
3433 try {
3534 let errObj = rawErr . response . body . error ;
@@ -93,13 +92,9 @@ class GraphRequest {
9392 return parts . reduce ( joiner ) ;
9493 }
9594 buildFullUrl ( ) {
96- let pathForSubstitutingParams = this . urlComponents . path ;
97- for ( var param in this . urlParamSubstitutions ) {
98- pathForSubstitutingParams = pathForSubstitutingParams . replace ( new RegExp ( "{" + param + "}" , 'g' ) , this . urlParamSubstitutions [ param ] ) ;
99- }
10095 let url = this . urlJoin ( [ this . urlComponents . host ,
10196 this . urlComponents . version ,
102- pathForSubstitutingParams ] )
97+ this . urlComponents . path ] )
10398 + this . createQueryString ( ) ;
10499 if ( this . config . debugLogging ) {
105100 console . log ( url ) ;
@@ -172,12 +167,6 @@ class GraphRequest {
172167 . post ( url )
173168 . send ( content ) , callback ) ;
174169 }
175- setParam ( params ) {
176- for ( let key in params ) {
177- this . urlParamSubstitutions [ key ] = params [ key ] ;
178- }
179- return this ;
180- }
181170 create ( content , callback ) {
182171 return this . post ( content , callback ) ;
183172 }
@@ -293,9 +282,17 @@ class GraphRequest {
293282 }
294283 } ( ) ;
295284 }
296- query ( queryDictionary ) {
297- for ( let key in queryDictionary ) {
298- this . urlComponents . otherURLQueryParams [ key ] = queryDictionary [ key ] ;
285+ query ( queryDictionaryOrString ) {
286+ if ( typeof queryDictionaryOrString === "string" ) {
287+ let queryStr = queryDictionaryOrString ;
288+ let queryKey = queryStr . split ( "=" ) [ 0 ] ;
289+ let queryValue = queryStr . split ( "=" ) [ 1 ] ;
290+ this . urlComponents . otherURLQueryParams [ queryKey ] = queryValue ;
291+ }
292+ else {
293+ for ( let key in queryDictionaryOrString ) {
294+ this . urlComponents . otherURLQueryParams [ key ] = queryDictionaryOrString [ key ] ;
295+ }
299296 }
300297 return this ;
301298 }
@@ -1894,7 +1891,7 @@ Emitter.prototype.hasListeners = function(event){
18941891} , { } ] , 8 :[ function ( require , module , exports ) {
18951892module . exports = {
18961893 "name" : "msgraph-sdk-javascript" ,
1897- "version" : "0.1.0 " ,
1894+ "version" : "0.1.1 " ,
18981895 "description" : "Microsoft Graph JavaScript SDK" ,
18991896 "main" : "lib/index.js" ,
19001897 "typings" : "lib/index" ,
@@ -1914,6 +1911,10 @@ module.exports={
19141911 } ,
19151912 "dependencies" : {
19161913 "superagent" : "^2.2.0"
1914+ } ,
1915+ "repository" : {
1916+ "type" : "git" ,
1917+ "url" : "https://github.com/microsoftgraph/msgraph-sdk-javascript.git"
19171918 }
19181919}
19191920} , { } ] } , { } , [ 1 ] ) ;
0 commit comments