diff --git a/.talismanrc b/.talismanrc
index 944a831..0b42628 100644
--- a/.talismanrc
+++ b/.talismanrc
@@ -10,4 +10,4 @@ fileignoreconfig:
- filename: Contentstack.Core/Models/Asset.cs
checksum: 98b819cb9b1e6a9a9e5394ac23c07bc642a41c0c7512d169afc63afe3baa6fb3
- filename: Contentstack.Core/Models/Query.cs
- checksum: 9237bb4d3e862fad7f3c6d9bad47873758a18617dc9c90d28015dcea267fcd9e
\ No newline at end of file
+ checksum: ceea632e4ea870f35ad3bd313e9f8b4e5ec21aa86f006fca2e0a32945999ba67
\ No newline at end of file
diff --git a/Contentstack.Core/Models/Entry.cs b/Contentstack.Core/Models/Entry.cs
index 5460b29..20bed0c 100644
--- a/Contentstack.Core/Models/Entry.cs
+++ b/Contentstack.Core/Models/Entry.cs
@@ -378,6 +378,56 @@ public void RemoveHeader(string key)
}
+
+
+ ///
+ /// To set variants header using Entry instance.
+ ///
+ /// Entry instance
+ /// Current instance of Entry, this will be useful for a chaining calls.
+ ///
+ ///
+ /// ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
+ /// Entry csEntry = stack.ContentType("contentType_id").Entry("entry_uid");
+ ///
+ /// csEntry.Variant("variant_entry_1");
+ /// csEntry.Fetch<Product>().ContinueWith((entryResult) => {
+ /// //Your callback code.
+ /// //var result = entryResult.Result.GetMetadata();
+ /// });
+ ///
+ ///
+ public Entry Variant(string variant_header)
+ {
+ this.SetHeader("x-cs-variant-uid", variant_header);
+ return this;
+ }
+
+
+
+ ///
+ /// To set multiple variants headers using Entry instance.
+ ///
+ /// Entry instance
+ /// Current instance of Entry, this will be useful for a chaining calls.
+ ///
+ ///
+ /// ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
+ /// Entry csEntry = stack.ContentType("contentType_id").Query();
+ ///
+ /// csEntry.Variant(new List { "variant_entry_1", "variant_entry_2", "variant_entry_3" });
+ /// csEntry.Fetch<Product>().ContinueWith((entryResult) => {
+ /// //Your callback code.
+ /// //var result = entryResult.Result.GetMetadata();
+ /// });
+ ///
+ ///
+ public Entry Variant(List variant_headers)
+ {
+ this.SetHeader("x-cs-variant-uid", string.Join(",", variant_headers));
+ return this;
+ }
+
///
/// Get metadata of entry.
///
diff --git a/Contentstack.Core/Models/Query.cs b/Contentstack.Core/Models/Query.cs
index 202c529..5bad6bf 100644
--- a/Contentstack.Core/Models/Query.cs
+++ b/Contentstack.Core/Models/Query.cs
@@ -1242,8 +1242,8 @@ public Query Only(String[] fieldUid)
}
return this;
- }
-
+ }
+
///
/// Specifies an array of only keys that would be included in the response.
///
@@ -1266,14 +1266,14 @@ public Query IncludeOnlyReference(string[] keys, string referenceKey)
if (keys != null && keys.Length > 0)
{
var referenceKeys = new string[] { referenceKey };
- if (UrlQueries.ContainsKey("include[]") == false)
- {
+ if (UrlQueries.ContainsKey("include[]") == false)
+ {
UrlQueries.Add("include[]", referenceKeys);
-
- }
- if (UrlQueries.ContainsKey($"only[{ referenceKey}][]") == false)
- {
- UrlQueries.Add($"only[{referenceKey}][]", keys);
+
+ }
+ if (UrlQueries.ContainsKey($"only[{ referenceKey}][]") == false)
+ {
+ UrlQueries.Add($"only[{referenceKey}][]", keys);
}
}
return this;
@@ -1333,14 +1333,14 @@ public Query IncludeExceptReference(string[] keys, string referenceKey)
if (keys != null && keys.Length > 0)
{
var referenceKeys = new string[] { referenceKey };
- if (UrlQueries.ContainsKey("include[]") == false)
- {
+ if (UrlQueries.ContainsKey("include[]") == false)
+ {
UrlQueries.Add("include[]", referenceKeys);
-
- }
- if (UrlQueries.ContainsKey($"except[{ referenceKey}][]") == false)
- {
- UrlQueries.Add($"except[{referenceKey}][]", keys);
+
+ }
+ if (UrlQueries.ContainsKey($"except[{ referenceKey}][]") == false)
+ {
+ UrlQueries.Add($"except[{referenceKey}][]", keys);
}
}
return this;
@@ -1686,6 +1686,54 @@ public Query SetCachePolicy(CachePolicy cachePolicy)
return this;
}
+
+
+ ///
+ /// To set variants header using query instance.
+ ///
+ /// Query instance
+ /// Current instance of Query, this will be useful for a chaining calls.
+ ///
+ ///
+ /// ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
+ /// Query csQuery = stack.ContentType("contentType_id").Query();
+ ///
+ /// csQuery.Variant("variant_entry_1");
+ /// csQuery.Find<Product>().ContinueWith((queryResult) => {
+ /// //Your callback code.
+ /// });
+ ///
+ ///
+ public Query Variant(string variant_header)
+ {
+ this.SetHeader("x-cs-variant-uid", variant_header);
+ return this;
+ }
+
+
+
+ ///
+ /// To set multiple variants headers using query instance.
+ ///
+ /// Query instance
+ /// Current instance of Query, this will be useful for a chaining calls.
+ ///
+ ///
+ /// ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
+ /// Query csQuery = stack.ContentType("contentType_id").Query();
+ ///
+ /// csQuery.Variant(new List { "variant_entry_1", "variant_entry_2", "variant_entry_3" });
+ /// csQuery.Find<Product>().ContinueWith((queryResult) => {
+ /// //Your callback code.
+ /// });
+ ///
+ ///
+ public Query Variant(List variant_headers)
+ {
+ this.SetHeader("x-cs-variant-uid", string.Join(",", variant_headers));
+ return this;
+ }
+
///
/// Execute a Query and Caches its result (Optional)
///