Class Query
A class that defines a query that is used to query for Entry instance.
Inheritance
Inherited Members
Namespace: Contentstack.Core.Models
Assembly: Contentstack.Core.dll
Syntax
public class Query
Properties
| Improve this Doc View SourceContentTypeId
Content type uid.
Declaration
public string ContentTypeId { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
var result = queryResult.Result.ContentTypeId;
});
Methods
| Improve this Doc View SourceAddQuery(String, String)
Add a custom query against specified key.
Declaration
public Query AddQuery(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | field uid. |
System.String | value | field value. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.AddQuery("query_param_key", "query_param_value");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
And(List<Query>)
Combines all the queries together using AND operator
Declaration
public Query And(List<Query> queryObjects)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<Query> | queryObjects | list of Query instances on which AND query executes. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
ContentType contentTypeObj = stack.ContentType("contentType_id");
Query csQuery = contentTypeObj.Query();
Query query1 = contentTypeObj.Query();
query1.Where("username","content");
Query query2 = contentTypeObj.Query();
query2.Where("email_address","content@email.com");
List<Query> queryList = new List<Query>();
queryList.Add(query1);
queryList.Add(query2);
csQuery.And(queryList);
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
Ascending(String)
Sort the results in ascending order with the given key.
Declaration
public Query Ascending(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to order by. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.Ascending("name");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
ContainedIn(String, Object[])
Add a constraint to the query that requires a particular key's entry to be contained in the provided array.
Declaration
public Query ContainedIn(string key, object[] values)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | the key to be constrained. |
System.Object[] | values | The possible values for the key's object. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.ContainedIn("severity", new Object[]{"Show Stopper", "Critical"});
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
Count()
Retrieve only count of entries in result.
Declaration
public async Task<JObject> Count()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Newtonsoft.Json.Linq.JObject> | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.Count();
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
Descending(String)
Sort the results in descending order with the given key.
Declaration
public Query Descending(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to order by. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.Descending("name");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
Except(String[])
Specifies list of field uids that would be excluded from the response.
Declaration
public Query Except(string[] fieldUids)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | fieldUids | field uid which get excluded from the response. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.Except(new String[]{"name", "description"});
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
Exists(String)
Add a constraint that requires, a specified key exists in response.
Declaration
public Query Exists(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to be constrained. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.Exists("severity");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
Find<T>()
Execute a Query and Caches its result (Optional)
Declaration
public async Task<ContentstackCollection<T>> Find<T>()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ContentstackCollection<T>> | Current instance of Query, this will be useful for a chaining calls. |
Type Parameters
Name | Description |
---|---|
T |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
FindOne<T>()
Execute a Query and Caches its result (Optional)
Declaration
public async Task<ContentstackCollection<T>> FindOne<T>()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ContentstackCollection<T>> | Current instance of Query, this will be useful for a chaining calls. |
Type Parameters
Name | Description |
---|---|
T |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.FindOne<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
GreaterThan(String, Object)
Add a constraint to the query that requires a particular key entry to be greater than the provided value.
Declaration
public Query GreaterThan(string key, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | the key to be constrained. |
System.Object | value | The value that provides an lower bound. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.GreaterThan("due_date", "2013-06-25T00:00:00+05:30");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
GreaterThanOrEqualTo(String, Object)
Add a constraint to the query that requires a particular key entry to be greater than or equal to the provided value.
Declaration
public Query GreaterThanOrEqualTo(string key, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | the key to be constrained. |
System.Object | value | The value that provides an lower bound or equal |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.GreaterThanOrEqualTo("due_date", "2013-06-25T00:00:00+05:30");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
IncludeBranch()
Include branch for publish content.
Declaration
public Query IncludeBranch()
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.IncludeBranch();
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
IncludeCount()
Retrieve count and data of objects in result.
Declaration
public Query IncludeCount()
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.IncludeCount();
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
includeEmbeddedItems()
Include Embedded Objects (Entries and Assets) along with entry/entries details.
Declaration
public Query includeEmbeddedItems()
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.includeEmbeddedItems();
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
IncludeExceptReference(String[], String)
Specifies an array of except keys that would be excluded in the response.
Declaration
public Query IncludeExceptReference(string[] keys, string referenceKey)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | keys | Array of the except reference keys to be excluded in response. |
System.String | referenceKey | Key who has reference to some other class object. |
Returns
Type | Description |
---|---|
Query | Current instance of Entry, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.IncludeExceptReference(new String[]{"name", "description"},"referenceUid");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
IncludeFallback()
Include fallback locale publish content, if specified locale content is not publish.
Declaration
public Query IncludeFallback()
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.IncludeFallback();
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
IncludeOnlyReference(String[], String)
Specifies an array of only keys that would be included in the response.
Declaration
public Query IncludeOnlyReference(string[] keys, string referenceKey)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | keys | Array of the only reference keys to be included in response. |
System.String | referenceKey | Key who has reference to some other class object. |
Returns
Type | Description |
---|---|
Query | Current instance of Entry, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.IncludeOnlyReference(new String[]{"name", "description"}, "referenceUid");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
IncludeOwner()
This method also includes owner information for all the entries returned in the response.
Declaration
public Query IncludeOwner()
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.IncludeOwner();
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
IncludeReference(String)
Add a constraint that requires a particular reference key details.
Declaration
public Query IncludeReference(string filed_uid)
Parameters
Type | Name | Description |
---|---|---|
System.String | filed_uid | The key to be constrained. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.IncludeReference("for_bug");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
IncludeReference(String[])
Add a constraint that requires a particular reference key details.
Declaration
public Query IncludeReference(string[] filed_uids)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | filed_uids | array keys that to be constrained. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.IncludeReference(new String[]{"for_bug", "assignee"});
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
IncludeReferenceContentTypeUID()
This method also includes the content type UIDs of the referenced entries returned in the response.
Declaration
public Query IncludeReferenceContentTypeUID()
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.IncludeReferenceContentTypeUID();
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
IncludeSchema()
Include schemas of all returned objects along with objects themselves.
Declaration
public Query IncludeSchema()
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.IncludeSchema();
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
LessThan(String, Object)
Add a constraint to the query that requires a particular key entry to be less than the provided value.
Declaration
public Query LessThan(string key, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | the key to be constrained. |
System.Object | value | the value that provides an upper bound. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.LessThan("due_date", "2013-06-25T00:00:00+05:30");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
LessThanOrEqualTo(String, Object)
Add a constraint to the query that requires a particular key entry to be less than or equal to the provided value.
Declaration
public Query LessThanOrEqualTo(string key, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | the key to be constrained. |
System.Object | value | the value that provides an upper bound or equal. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.LessThanOrEqualTo("due_date", "2013-06-25T00:00:00+05:30");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
Limit(Int32)
A limit on the number of objects to return.
Declaration
public Query Limit(int number)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | number | No of objects to limit. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.Limit(2);
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
NotContainedIn(String, Object[])
Add a constraint to the query that requires a particular key entry's value not be contained in the provided array.
Declaration
public Query NotContainedIn(string key, object[] values)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | the key to be constrained. |
System.Object[] | values | The list of values the key object should not be. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.NotContainedIn("severity", new Object[]{"Show Stopper", "Critical"});
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
NotEqualTo(String, Object)
Add a constraint to the query that requires a particular key's entry to be not equal to the provided value.
Declaration
public Query NotEqualTo(string key, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | the key to be constrained. |
System.Object | value | The object that must not be equaled. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.NotEqualTo("due_date", "2013-06-25T00:00:00+05:30");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
NotExists(String)
Add a constraint that requires, a specified key does not exists in response.
Declaration
public Query NotExists(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to be constrained. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.NotExists("severity");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
Only(String[])
Specifies an array of 'only' keys in BASE object that would be 'included' in the response.
Declaration
public Query Only(string[] fieldUid)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | fieldUid | Array of the 'only' keys to be included in response. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.Only(new String[]{"name", "description"});
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
Or(List<Query>)
Add a constraint to fetch all entries which satisfy any queries.
Declaration
public Query Or(List<Query> queryObjects)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<Query> | queryObjects | list of Query instances on which OR query executes. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
ContentType contentTypeObj = stack.ContentType("contentType_id");
Query csQuery = contentTypeObj.Query();
Query query1 = contentTypeObj.Query();
query1.Where("username","content");
Query query2 = contentTypeObj.Query();
query2.Where("email_address","content@email.com");
List<Query> queryList = new List<Query>();
queryList.Add(query1);
queryList.Add(query2);
csQuery.Or(queryList);
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
ReferenceIn(String, Query)
Declaration
public Query ReferenceIn(string key, Query query)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | |
Query | query |
Returns
Type | Description |
---|---|
Query |
ReferenceNotIn(String, Query)
Declaration
public Query ReferenceNotIn(string key, Query query)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | |
Query | query |
Returns
Type | Description |
---|---|
Query |
Regex(String, String)
Add a regular expression constraint for finding string values that match the provided regular expression.
Declaration
public Query Regex(string key, string regex)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to be constrained. |
System.String | regex | The regular expression pattern to match. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.Regex("name", "^browser");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
Regex(String, String, String)
Add a regular expression constraint for finding string values that match the provided regular expression.
Declaration
public Query Regex(string key, string regex, string modifiers)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to be constrained. |
System.String | regex | The regular expression pattern to match. |
System.String | modifiers | Any of the following supported Regular expression modifiers. <li>use<b> i </b> for case-insensitive matching.</li> <li>use<b> m </b> for making dot match newlines.</li> <li>use<b> x </b> for ignoring whitespace in regex</li> |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.Regex("name", "^browser", "i");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
RemoveHeader(String)
Remove header key
Declaration
public void RemoveHeader(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | header name. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.RemoveHeader("custom_key");
|
Improve this Doc
View Source
RemoveQuery(String)
Remove provided query key from custom query if exist.
Declaration
public Query RemoveQuery(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Query name to remove. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.RemoveQuery("Query_Key");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
SetCachePolicy(CachePolicy)
To set cache policy using query instance.
Declaration
public Query SetCachePolicy(CachePolicy cachePolicy)
Parameters
Type | Name | Description |
---|---|---|
CachePolicy | cachePolicy | CachePolicy instance |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.SetCachePolicy(CachePolicy.CacheElseNetwork);
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
SetHeader(String, String)
To set headers for Contentstack.io Contentstack rest calls.
Declaration
public void SetHeader(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | header name. |
System.String | value | header value against given header name. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.SetHeader("custom_key", "custom_value");
|
Improve this Doc
View Source
SetLanguage(Language)
Set Language instance
Declaration
[Obsolete("This method has been deprecated. Use SetLocale instead.", true)]
public Query SetLanguage(Language language)
Parameters
Type | Name | Description |
---|---|---|
Contentstack.Core.Internals.Language | language | Language value |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.SetLanguage(Language.ENGLISH_UNITED_STATES);
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
SetLocale(String)
Sets the locale.
Declaration
public Query SetLocale(string Locale)
Parameters
Type | Name | Description |
---|---|---|
System.String | Locale | Locale. |
Returns
Type | Description |
---|---|
Query | The locale. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.SetLocale("en-us");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
Skip(Int32)
The number of objects to skip before returning any.
Declaration
public Query Skip(int number)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | number | No of objects to skip from returned objects. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.Skip(2);
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
Where(String, Object)
Add a constraint to fetch all entries that contains given value against specified key.
Declaration
public Query Where(string key, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | field uid. |
System.Object | value | field value which get included from the response. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.Where("uid", "entry_uid");
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});
|
Improve this Doc
View Source
WhereTags(String[])
Include tags with which to search entries.
Declaration
public Query WhereTags(string[] tags)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | tags | Comma separated array of tags with which to search entries. |
Returns
Type | Description |
---|---|
Query | Current instance of Query, this will be useful for a chaining calls. |
Examples
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.ContentType("contentType_id").Query();
csQuery.WhereTags(new String[]{"tag1", "tag2"});
csQuery.Find<Product>().ContinueWith((queryResult) => {
//Your callback code.
});