2using System.Collections.Generic;
8 public static partial class ExtensionMethods
17 public static O
Get<O>(
this O obj, IEnumerable<Parameter> requestParameters =
null,
int? timeout =
null) where O :
IAPIResource
19 return typeof(O) == obj.GetType() ?
20 Get_AsType<O>(obj, requestParameters, timeout) :
21 (O)obj.Get(obj.GetType(), requestParameters, timeout);
30 public static O
Post<O>(
this O obj, IEnumerable<Parameter> requestParameters =
null,
int? timeout =
null) where O :
IAPIResource
32 return typeof(O) == obj.GetType() ?
33 Post_AsType<O>(obj, requestParameters, timeout) :
34 (O)obj.Post(obj.GetType(), requestParameters, timeout);
43 public static O
Put<O>(
this O obj, IEnumerable<Parameter> requestParameters =
null,
int? timeout =
null) where O :
IAPIResource
45 return typeof(O) == obj.GetType() ?
46 Put_AsType<O>(obj, requestParameters, timeout) :
47 (O)obj.Put(obj.GetType(), requestParameters, timeout);
56 public static O
Save<O>(
this O obj, IEnumerable<Parameter> requestParameters =
null,
int? timeout =
null) where O :
IAPIResource
58 return String.IsNullOrWhiteSpace(obj.id) ?
59 obj.Post(requestParameters, timeout) :
60 obj.Put(requestParameters, timeout);
static O Get< O >(this O obj, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
Perform a GET on the current resource to return the equivalent resource stored on the server....
static O Save< O >(this O obj, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
Calls either the POST object if the current resource is new, or PUT if the current resource already h...
static O Put< O >(this O obj, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
Perform a PUT on the current resource, with the expectation that the server will respond with the upd...
static O Post< O >(this O obj, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
Perform a POST on the current resource, with the expectation that the server will respond with the ob...
Interface for Base class used by all resources.