@@ -193,24 +193,24 @@ public void InvalidateCacheObjects(string startsWithUri)
193
193
/// <param name="forceCacheInvalidation"></param>
194
194
/// <returns>An object with response data</returns>
195
195
public T Get < T > ( String uri , bool forceCacheInvalidation = false , string baseUri = ApiUrl ) where T : class
196
- {
197
- T obj = null ;
196
+ {
197
+ T obj = null ;
198
198
199
- //If there's a cache provider, check it.
200
- if ( CacheProvider != null && ! forceCacheInvalidation )
201
- obj = CacheProvider . Get < T > ( uri ) ;
199
+ //If there's a cache provider, check it.
200
+ if ( CacheProvider != null && ! forceCacheInvalidation )
201
+ obj = CacheProvider . Get < T > ( uri ) ;
202
202
203
- if ( obj == null )
204
- {
205
- obj = Request < T > ( uri , baseUri : baseUri ) ;
203
+ if ( obj == null )
204
+ {
205
+ obj = Request < T > ( uri , baseUri : baseUri ) ;
206
206
207
- //If there's a cache provider, save it!
208
- if ( CacheProvider != null )
209
- CacheProvider . Set ( obj , uri ) ;
210
- }
207
+ //If there's a cache provider, save it!
208
+ if ( CacheProvider != null )
209
+ CacheProvider . Set ( obj , uri ) ;
210
+ }
211
211
212
- return obj ;
213
- }
212
+ return obj ;
213
+ }
214
214
215
215
/// <summary>
216
216
/// Makes a 'PUT' request to the server
@@ -276,11 +276,25 @@ public void Delete(string uri, string baseUri = ApiUrl)
276
276
/// <returns></returns>
277
277
public T Request < T > ( string uri , Method method = Method . GET , Dictionary < string , string > data = null , string baseUri = ApiUrl )
278
278
{
279
- var response = ExecuteRequest ( uri , method , data , baseUri ) ;
279
+ var response = ExecuteRequest ( new Uri ( new Uri ( baseUri ) , uri ) , method , data ) ;
280
280
var d = new JsonDeserializer ( ) ;
281
281
return d . Deserialize < T > ( response ) ;
282
282
}
283
283
284
+ /// <summary>
285
+ /// Dummy thing.. for now
286
+ /// </summary>
287
+ /// <param name="uri">URI.</param>
288
+ /// <param name="method">Method.</param>
289
+ /// <param name="data">Data.</param>
290
+ /// <typeparam name="T">The 1st type parameter.</typeparam>
291
+ public T Request2 < T > ( string uri , Method method = Method . GET , Dictionary < string , string > data = null )
292
+ {
293
+ var response = ExecuteRequest ( new Uri ( uri ) , method , data ) ;
294
+ var d = new JsonDeserializer ( ) ;
295
+ return d . Deserialize < T > ( response ) ;
296
+ }
297
+
284
298
/// <summary>
285
299
/// Makes a request to the server but does not expect a response.
286
300
/// </summary>
@@ -289,7 +303,7 @@ public T Request<T>(string uri, Method method = Method.GET, Dictionary<string, s
289
303
/// <param name="data"></param>
290
304
public void Request ( string uri , Method method = Method . GET , Dictionary < string , string > data = null , string baseUri = ApiUrl )
291
305
{
292
- ExecuteRequest ( uri , method , data , baseUri ) ;
306
+ ExecuteRequest ( new Uri ( new Uri ( baseUri ) , uri ) , method , data ) ;
293
307
}
294
308
295
309
/// <summary>
@@ -299,14 +313,13 @@ public void Request(string uri, Method method = Method.GET, Dictionary<string, s
299
313
/// <param name="method"></param>
300
314
/// <param name="data"></param>
301
315
/// <returns></returns>
302
- internal IRestResponse ExecuteRequest ( string uri , Method method , Dictionary < string , string > data , string baseUri )
316
+ internal IRestResponse ExecuteRequest ( Uri uri , Method method , Dictionary < string , string > data )
303
317
{
304
318
if ( uri == null )
305
319
throw new ArgumentNullException ( "uri" ) ;
306
320
307
- var requestUri = new Uri ( new Uri ( baseUri ) , uri ) ;
308
321
var request = new RestRequest ( method ) ;
309
- request . Resource = requestUri . AbsoluteUri ;
322
+ request . Resource = uri . AbsoluteUri ;
310
323
if ( data != null )
311
324
foreach ( var hd in data )
312
325
request . AddParameter ( hd . Key , hd . Value ) ;
0 commit comments