2using System.Collections.Generic;
4using System.Linq.Expressions;
5using System.Reflection;
6using System.Runtime.Serialization;
17 public static partial class API
215 bool ascending =
true)
222 return Order((ascending ?
"" :
"-") + name);
253 if (fieldNames ==
null || !fieldNames.Any())
271 if (fieldNames ==
null || !fieldNames.Any())
291 if (ids ==
null || !ids.Any())
329 throw new ArgumentException(
"Page number must be 1 or greater.");
330 return Page((pageNumber - 1) * resultsPerPage, resultsPerPage);
332 #endregion Pagination
334 #region Large File Upload
348 .
AddHeader(
"Entity-Length", totalBytes.ToString(
"0"));
360 long offsetBytes,
byte[] chunkData,
int count)
366 if (chunkData.Length > count)
368 byte[] temp =
new byte[count];
369 Array.Copy(chunkData, 0, temp, 0, count);
383 long offsetBytes,
string chunkData)
398 long offsetBytes,
object chunkData,
int content_length)
402 .
AddHeader(
"Content-Length", content_length.ToString(
"0"))
403 .
AddHeader(
"Offset", offsetBytes.ToString(
"0"))
408 Type = ParameterType.RequestBody
411 #endregion Large File Upload
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...
const string PATCHContentType
The contentType to set when submitting a PATCHED chunk data.
static RequestParameters Search(string searchTerms)
Can be added to your GET requests to send a search request to the server. If the endpoint supports se...
static RequestParameters DataEntityLength(long totalBytes)
Creates an HTTP Header RestSharp parameter that specifies the length of an entity to be uploaded in s...
static RequestParameters Fields(IEnumerable< string > fieldNames)
Can be added to your GET requests to return only the specified fields in the response body....
static RequestParameters DataPatchChunk_Object(long offsetBytes, object chunkData, int content_length)
Creates the RestSharp HTTP Header parameter required to PATCH a data endpoint with part of a file.
static RequestParameters Order(string ordering)
Can be added to collection GET requests to specify the way items should be ordered....
static RequestParameters ExpandReferences()
Can be added to your GET requests to recursively resolve resource references in the response....
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...
static RequestParameters Type(Type resourceType)
Can be added to your collection GET requests to filter by a specific sub-type when that resource is p...
static RequestParameters DataPatchChunk(long offsetBytes, string chunkData)
Creates the RestSharp HTTP Header parameter required to PATCH a data endpoint with part of a file.
static RequestParameters Order< T >(Expression< Func< T, object > > propertyExpression, bool ascending=true)
Helper function to create RequestParameters for ordering by the specified property....
static RequestParameters Omit(IEnumerable< string > fieldNames)
Similar to Fields, but rather than supplying a "white-list", allows one to specify a list of fields t...
static RequestParameters Type(string apiTypeName)
Can be added to your collection GET requests to filter by a specific sub-type when that resource is p...
static RequestParameters DataPatchChunk(long offsetBytes, byte[] chunkData, int count)
Creates the RestSharp HTTP Header parameter required to PATCH a data endpoint with part of a file.
static RequestParameters AdvancedSearch(string advancedSearchTerms)
Can be added to your GET requests to send a field filtering request to the server....
static RequestParameters PageNumber(long pageNumber, long resultsPerPage)
A variation of the 'Page' parameters that achieves the same effect, but by specifying a page number r...
API methods / requests made available to the user.
Helper class which makes it easier to build a set of request parameters.
RequestParameters AddParameter(Parameter parameter)
Adds the specified parameter to this list and returns the list.
RequestParameters AddHeader(string name, string value=null)
Adds the specified name/value pair as a HEADER.
RequestParameters AddQueryParameter(string name, string value)
Adds the specified name/value pair as a new request parameter with the type ParameterType....
Utilities that reflect on a type or property expression.
static object GetCustomAttributeFast(this MemberInfo member, Type attributeType)
Gets the specified attribute from the member.
Utility for resolving types given only the types name (Useful for parsing ambiguous JSON objects).
static string GetTypeNameForAPIType(Type type)
Gets the type name from the overriding type alias attribute or class name based using the supplied ty...