Skip to content

Commit 5aef08e

Browse files
authored
Merge pull request #40 from contentstack/next
Feat: GCP Support
2 parents 8936c69 + 5d656ec commit 5aef08e

File tree

11 files changed

+145
-23
lines changed

11 files changed

+145
-23
lines changed

.github/workflows/sca-scan.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@ jobs:
66
security-sca:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@master
9+
- name: Checkout repository
10+
uses: actions/checkout@master
11+
- name: Setup .NET Core @ Latest
12+
uses: actions/setup-dotnet@v1
13+
with:
14+
dotnet-version: "7.0.x"
15+
- name: Run Dotnet Restore
16+
run: |
17+
dotnet restore
1018
- name: Run Snyk to check for vulnerabilities
1119
uses: snyk/actions/dotnet@master
1220
env:
1321
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
1422
with:
15-
args: --fail-on=all
23+
args: --file=Contentstack.Core/obj/project.assets.json --fail-on=all

.talismanrc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ fileignoreconfig:
22
- filename: Contentstack.Core/Internals/HttpRequestHandler.cs
33
checksum: 93c1659f3bc7527956f0fd12db46441297fac3a4366d273bcbb3425d2351300e
44
- filename: Contentstack.Core/Models/Entry.cs
5-
checksum: bc0da69dde3bebecf09aa319aa961f82d7637e200bb8539821fa6116c0129f1b
5+
checksum: 79320b005882981fd7c79fe73832f28284db686927942e46b422ac9e88405023
66
- filename: Contentstack.Core/ContentstackClient.cs
7-
checksum: 1cb7c9bd62881ae71406449c948b1e85aa865d0c7191013f77f9b9a60df700d9
7+
checksum: 1cb7c9bd62881ae71406449c948b1e85aa865d0c7191013f77f9b9a60df700d9
8+
- filename: Contentstack.Core/Models/AssetLibrary.cs
9+
checksum: 023aed649cf09228d753a4dec2b3a9f126aad474f538ca0e21d03ee07e9f6129
10+
- filename: Contentstack.Core/Models/Asset.cs
11+
checksum: 98b819cb9b1e6a9a9e5394ac23c07bc642a41c0c7512d169afc63afe3baa6fb3
12+
- filename: Contentstack.Core/Models/Query.cs
13+
checksum: 9237bb4d3e862fad7f3c6d9bad47873758a18617dc9c90d28015dcea267fcd9e

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
### Version: 2.14.0
2+
#### Date: May-28-2024
3+
4+
##### New Feature:
5+
- GCP_NA region support added
6+
- AddParam method added for Entry, Asset, AssetLibrary and Query
7+
18
### Version: 2.13.0
29
#### Date: April-02-2024
310

Contentstack.AspNetCore/Contentstack.AspNetCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
<PackageReference Include="NuGet.Build.Packaging" Version="0.2.2"><PrivateAssets>all</PrivateAssets>
3232
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3333
</PackageReference>
34-
<PackageReference Include="contentstack.csharp" Version="2.12.0" />
34+
<PackageReference Include="contentstack.csharp" Version="2.13.0" />
3535
</ItemGroup>
3636
</Project>

Contentstack.Core/Configuration/Config.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ internal string HostURL
117117
{
118118
get
119119
{
120-
if (Region == ContentstackRegion.EU || Region == ContentstackRegion.AZURE_EU || Region == ContentstackRegion.AZURE_NA)
120+
if (Region == ContentstackRegion.EU || Region == ContentstackRegion.AZURE_EU || Region == ContentstackRegion.AZURE_NA || Region == ContentstackRegion.GCP_NA)
121121
return "cdn.contentstack.com";
122122
return "cdn.contentstack.io";
123123
}
Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
11
using System;
22
namespace Contentstack.Core.Internals
33
{
4-
/// <summary>
5-
/// Contentstack region.
4+
/// <summary>
5+
/// Contentstack region.
66
/// </summary>
77
public enum ContentstackRegion
88
{
9-
/// <summary>
10-
/// To specify US region.
9+
/// <summary>
10+
/// To specify US region.
1111
/// </summary>
1212
US,
13-
/// <summary>
14-
/// To specify EU region.
13+
/// <summary>
14+
/// To specify EU region.
1515
/// </summary>
1616
EU,
17-
/// <summary>
18-
/// To specify EU region.
17+
/// <summary>
18+
/// To specify AZURE_EU region.
1919
/// </summary>
2020
AZURE_EU,
2121

22-
/// <summary>
23-
/// To specify EU region.
22+
/// <summary>
23+
/// To specify AZURE_NA region.
2424
/// </summary>
25-
AZURE_NA
25+
AZURE_NA,
26+
27+
/// <summary>
28+
/// To specify GCP_NA region.
29+
/// </summary>
30+
GCP_NA
2631
}
2732

2833

@@ -34,7 +39,9 @@ internal enum ContentstackRegionCode
3439

3540
azure_eu,
3641

37-
azure_na
42+
azure_na,
43+
44+
gcp_na
3845

3946
}
4047
}

Contentstack.Core/Models/Asset.cs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public void SetHeader(string key, string value)
172172
/// });
173173
/// </code>
174174
/// </example>
175-
public Asset includeFallback()
175+
public Asset IncludeFallback()
176176
{
177177
this.UrlQueries.Add("include_fallback", "true");
178178
return this;
@@ -216,18 +216,39 @@ public Asset IncludeMetadata()
216216
/// <code>
217217
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
218218
/// Asset asset = stack.Asset(&quot;asset_uid&quot;);
219-
/// asset.includeBranch();
219+
/// asset.IncludeBranch();
220220
/// asset.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
221221
/// //Your callback code.
222222
/// });
223223
/// </code>
224224
/// </example>
225-
public Asset includeBranch()
225+
public Asset IncludeBranch()
226226
{
227227
this.UrlQueries.Add("include_branch", "true");
228228
return this;
229229
}
230230

231+
232+
/// <summary>
233+
/// Add param in URL query.
234+
/// </summary>
235+
/// <returns>Current instance of Asset, this will be useful for a chaining calls.</returns>
236+
/// <example>
237+
/// <code>
238+
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
239+
/// Asset asset = stack.Asset(&quot;asset_uid&quot;);
240+
/// asset.AddParam("include_branch", "true");
241+
/// asset.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
242+
/// //Your callback code.
243+
/// });
244+
/// </code>
245+
/// </example>
246+
public Asset AddParam(string key, string value)
247+
{
248+
this.UrlQueries.Add(key, value);
249+
return this;
250+
}
251+
231252
public void RemoveHeader(string key)
232253
{
233254
if (this._Headers.ContainsKey(key))

Contentstack.Core/Models/AssetLibrary.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,26 @@ public AssetLibrary IncludeBranch()
142142
return this;
143143
}
144144

145+
146+
/// <summary>
147+
/// Add param in URL query.
148+
/// </summary>
149+
/// <returns>Current instance of Asset, this will be useful for a chaining calls.</returns>
150+
/// <example>
151+
/// <code>
152+
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
153+
/// AssetLibrary assetLibrary = stack.AssetLibrary();
154+
/// assetLibrary.AddParam("include_branch", "true");
155+
/// ContentstackCollection&gt;Asset&lt; contentstackCollection = await assetLibrary.FetchAll();
156+
/// </code>
157+
/// </example>
158+
public AssetLibrary AddParam(string key, string value)
159+
{
160+
UrlQueries.Add(key, value);
161+
162+
return this;
163+
}
164+
145165
/// <summary>
146166
/// Sets the locale.
147167
/// </summary>

Contentstack.Core/Models/Entry.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,32 @@ public Entry IncludeMetadata()
10831083
}
10841084

10851085

1086-
1086+
/// <summary>
1087+
/// Add param in URL query.
1088+
/// </summary>
1089+
/// <returns>Current instance of Entry, this will be useful for a chaining calls.</returns>
1090+
/// <example>
1091+
/// <code>
1092+
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
1093+
/// Entry entry = stack.ContentType(&quot;contentType_id&quot;).Entry(&quot;entry_uid&quot;);
1094+
/// entry.AddParam("include_branch", "true");
1095+
/// entry.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
1096+
/// //Your callback code.
1097+
/// });
1098+
/// </code>
1099+
/// </example>
1100+
public Entry AddParam(string key, string value)
1101+
{
1102+
try
1103+
{
1104+
UrlQueries.Add(key, value);
1105+
}
1106+
catch (Exception e)
1107+
{
1108+
throw new Exception(StackConstants.ErrorMessage_QueryFilterException, e);
1109+
}
1110+
return this;
1111+
}
10871112

10881113
/// <summary>
10891114
/// Include branch for publish content.

Contentstack.Core/Models/Query.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,34 @@ public Query IncludeBranch()
14021402
return this;
14031403
}
14041404

1405+
1406+
/// <summary>
1407+
/// Add param in URL query.
1408+
/// </summary>
1409+
/// <returns>Current instance of Entry, this will be useful for a chaining calls.</returns>
1410+
/// <example>
1411+
/// <code>
1412+
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
1413+
/// Entry entry = stack.ContentType(&quot;contentType_id&quot;).Entry(&quot;entry_uid&quot;);
1414+
/// entry.AddParam("include_branch", "true");
1415+
/// entry.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
1416+
/// //Your callback code.
1417+
/// });
1418+
/// </code>
1419+
/// </example>
1420+
public Query AddParam(string key, string value)
1421+
{
1422+
try
1423+
{
1424+
UrlQueries.Add(key, value);
1425+
}
1426+
catch (Exception e)
1427+
{
1428+
throw new Exception(StackConstants.ErrorMessage_QueryFilterException, e);
1429+
}
1430+
return this;
1431+
}
1432+
14051433
/// <summary>
14061434
/// Include Embedded Objects (Entries and Assets) along with entry/entries details.
14071435
/// </summary>

0 commit comments

Comments
 (0)