Skip to content

Commit e92d197

Browse files
authored
Merge pull request #59 from contentstack/development
Fix: Variants test cases
2 parents 1178398 + b60eccb commit e92d197

File tree

6 files changed

+32
-12
lines changed

6 files changed

+32
-12
lines changed

.github/workflows/check-branch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Comment PR
11-
if: github.base_ref == 'master' && github.head_ref != 'next'
11+
if: github.base_ref == 'master' && github.head_ref != 'staging'
1212
uses: thollander/actions-comment-pull-request@v2
1313
with:
1414
message: |

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### Version: 2.15.1
2+
#### Date: Oct-08-2024
3+
4+
##### Fix:
5+
- Removed exclusion of env when adding headers
6+
17
### Version: 2.15.0
28
#### Date: Jul-30-2024
39

Contentstack.Core.Tests/EntryTest.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ await sourceEntry
9898
else
9999
{
100100
Assert.True(result.Uid == sourceEntry.Uid);
101+
Assert.NotNull(result._variant);
102+
Assert.NotNull(result._variant["_uid"]);
101103
}
102104
});
103105
}
@@ -120,6 +122,8 @@ await sourceEntry
120122
else
121123
{
122124
Assert.True(result.Uid == sourceEntry.Uid);
125+
Assert.NotNull(result._variant);
126+
Assert.NotNull(result._variant["_uid"]);
123127
}
124128
});
125129
}

Contentstack.Core/Models/Entry.cs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private string _Url
4848

4949
internal Dictionary<string, object> _metadata = new Dictionary<string, object>();
5050
#endregion
51-
51+
5252
#region Public Properties
5353
/// <summary>
5454
/// Title of an entry
@@ -110,6 +110,22 @@ private string _Url
110110
/// </example>
111111
public Dictionary<string, object> Metadata { get; set; }
112112

113+
/// <summary>
114+
/// Set key/value attributes of an current entry instance.
115+
/// </summary>
116+
/// <example>
117+
/// <code>
118+
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
119+
/// Entry entry = stack.ContentType(&quot;contentType_id&quot;).Entry(&quot;entry_uid&quot;);
120+
/// entry.Fetch&lt;Product&gt;().ContinueWith((entryResult) =&gt; {
121+
/// //Your callback code.
122+
/// //var result = entryResult.Result.Object;
123+
/// });
124+
/// </code>
125+
/// </example>
126+
public Dictionary<string, object> _variant { get; set; }
127+
128+
113129
/// <summary>
114130
/// Set key/value attributes of an current entry instance.
115131
/// </summary>
@@ -1380,12 +1396,8 @@ public async Task<T> Fetch<T>()
13801396
headerAll["authorization"] = this.ContentTypeInstance.StackInstance.LivePreviewConfig.ManagementToken;
13811397
isLivePreview = true;
13821398
}
1383-
else
1384-
{
1385-
mainJson.Add("environment", this.ContentTypeInstance.StackInstance.Config.Environment);
1386-
}
13871399

1388-
1400+
mainJson.Add("environment", this.ContentTypeInstance.StackInstance.Config.Environment);
13891401
foreach (var kvp in UrlQueries)
13901402
{
13911403
mainJson.Add(kvp.Key, kvp.Value);

Contentstack.Core/Models/Query.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,10 +1851,8 @@ private async Task<JObject> Exec()
18511851
headerAll["authorization"] = this.ContentTypeInstance.StackInstance.LivePreviewConfig.ManagementToken;
18521852
isLivePreview = true;
18531853
}
1854-
else
1855-
{
1856-
mainJson.Add("environment", this.ContentTypeInstance.StackInstance.Config.Environment);
1857-
}
1854+
1855+
mainJson.Add("environment", this.ContentTypeInstance.StackInstance.Config.Environment);
18581856
if (QueryValueJson != null && QueryValueJson.Count > 0)
18591857
mainJson.Add("query", QueryValueJson);
18601858

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>2.15.0</Version>
3+
<Version>2.15.1</Version>
44
</PropertyGroup>
55
</Project>

0 commit comments

Comments
 (0)