1using System.Collections.Generic;
8 public static partial class ExtensionMethods
17 public static T
GetItem<T>(
this APITypes.IResourceCollection<T> collection,
string id,
18 IEnumerable<Parameter> parameters =
null,
int? timeout =
null)
21 API.ValidateResourceId(
id);
23 Method.GET, parameters, timeout);
39 IEnumerable<string> ids, IEnumerable<Parameter> parameters =
null,
int? timeout =
null)
42 List<string> idList = ids as List<string> ?? ids.ToList();
59 long offset,
long limit, IEnumerable<Parameter> parameters =
null,
int? timeout =
null)
73 public static long Count<T>(
this APITypes.IResourceCollection<T> collection,
74 IEnumerable<Parameter> parameters =
null,
int? timeout =
null)
76 => List(collection, 0, 0, parameters, timeout).meta.total_count;
85 public static T
Post<T>(this APITypes.IResourceCollection<T> collection, T item,
86 IEnumerable<Parameter> parameters = null,
int? timeout = null)
90 Method.POST,
API.AddRequestBodyParameters(parameters, item), timeout);
Parameters that can be added to your REST requests to access additional API features.
static RequestParameters Ids(IEnumerable< string > ids)
Can be added to your collection GET requests to return only the set of resources whose id matches one...
static RequestParameters Page(long offset, long limit)
When getting a collection of items, these parameters can be added to restrict the number of results y...
API methods / requests made available to the user.
static int DefaultRequestTimeoutCollections
The default timeout used when requesting a resource collection from the server, in milliseconds.
static object RequestAndParse(Type deserializeType, string resource, Method method, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
Perform a REST request on the server and serializes the response to the desired run-time type.
Implements the reference entity interface, with support for resolving references using lazy loading.
static ICollectionResponse< T > List< T >(this APITypes.IResourceCollection< T > collection, long offset, long limit, IEnumerable< Parameter > parameters=null, int? timeout=null)
Performs a GET request to list the collection at this endpoint.
static object Post(this IAPIResource obj, Type deserializeType, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
Perform a POST on the current resource, returning the server response deserialized to a new object of...
static ICollectionResponse< T > GetItems< T >(this APITypes.IResourceCollection< T > collection, IEnumerable< string > ids, IEnumerable< Parameter > parameters=null, int? timeout=null)
Searches this collection for a list of resource ids and returns a collection response containing all ...
static long Count< T >(this APITypes.IResourceCollection< T > collection, IEnumerable< Parameter > parameters=null, int? timeout=null)
Get the number of items in this collection.
static T GetItem< T >(this APITypes.IResourceCollection< T > collection, string id, IEnumerable< Parameter > parameters=null, int? timeout=null)
Performs a GET request for a specific resource in this collection.
Interface shared by all object types and resources returned by the Analyze Re server.
Covariant interface for the generic collection response type.