Skip to content

Commit

Permalink
Merge pull request #40 from contentstack/next
Browse files Browse the repository at this point in the history
Feat: GCP Support
  • Loading branch information
nadeem-cs authored May 24, 2024
2 parents 41bc79a + 1881885 commit a46b1b9
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 23 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/sca-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ jobs:
security-sca:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Checkout repository
uses: actions/checkout@master
- name: Setup .NET Core @ Latest
uses: actions/setup-dotnet@v1
with:
dotnet-version: "7.0.x"
- name: Run Dotnet Restore
run: |
dotnet restore
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/dotnet@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --fail-on=all
args: --file=Contentstack.Core/obj/project.assets.json --fail-on=all
10 changes: 8 additions & 2 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ fileignoreconfig:
- filename: Contentstack.Core/Internals/HttpRequestHandler.cs
checksum: 93c1659f3bc7527956f0fd12db46441297fac3a4366d273bcbb3425d2351300e
- filename: Contentstack.Core/Models/Entry.cs
checksum: bc0da69dde3bebecf09aa319aa961f82d7637e200bb8539821fa6116c0129f1b
checksum: 79320b005882981fd7c79fe73832f28284db686927942e46b422ac9e88405023
- filename: Contentstack.Core/ContentstackClient.cs
checksum: 1cb7c9bd62881ae71406449c948b1e85aa865d0c7191013f77f9b9a60df700d9
checksum: 1cb7c9bd62881ae71406449c948b1e85aa865d0c7191013f77f9b9a60df700d9
- filename: Contentstack.Core/Models/AssetLibrary.cs
checksum: 023aed649cf09228d753a4dec2b3a9f126aad474f538ca0e21d03ee07e9f6129
- filename: Contentstack.Core/Models/Asset.cs
checksum: 98b819cb9b1e6a9a9e5394ac23c07bc642a41c0c7512d169afc63afe3baa6fb3
- filename: Contentstack.Core/Models/Query.cs
checksum: 9237bb4d3e862fad7f3c6d9bad47873758a18617dc9c90d28015dcea267fcd9e
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### Version: 2.14.0
#### Date: May-28-2024

##### New Feature:
- GCP_NA region support added
- AddParam method added for Entry, Asset, AssetLibrary and Query

### Version: 2.13.0
#### Date: April-02-2024

Expand Down
2 changes: 1 addition & 1 deletion Contentstack.AspNetCore/Contentstack.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
<PackageReference Include="NuGet.Build.Packaging" Version="0.2.2"><PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="contentstack.csharp" Version="2.12.0" />
<PackageReference Include="contentstack.csharp" Version="2.13.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Contentstack.Core/Configuration/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ internal string HostURL
{
get
{
if (Region == ContentstackRegion.EU || Region == ContentstackRegion.AZURE_EU || Region == ContentstackRegion.AZURE_NA)
if (Region == ContentstackRegion.EU || Region == ContentstackRegion.AZURE_EU || Region == ContentstackRegion.AZURE_NA || Region == ContentstackRegion.GCP_NA)
return "cdn.contentstack.com";
return "cdn.contentstack.io";
}
Expand Down
31 changes: 19 additions & 12 deletions Contentstack.Core/Internals/ContentstackRegion.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
using System;
namespace Contentstack.Core.Internals
{
/// <summary>
/// Contentstack region.
/// <summary>
/// Contentstack region.
/// </summary>
public enum ContentstackRegion
{
/// <summary>
/// To specify US region.
/// <summary>
/// To specify US region.
/// </summary>
US,
/// <summary>
/// To specify EU region.
/// <summary>
/// To specify EU region.
/// </summary>
EU,
/// <summary>
/// To specify EU region.
/// <summary>
/// To specify AZURE_EU region.
/// </summary>
AZURE_EU,

/// <summary>
/// To specify EU region.
/// <summary>
/// To specify AZURE_NA region.
/// </summary>
AZURE_NA
AZURE_NA,

/// <summary>
/// To specify GCP_NA region.
/// </summary>
GCP_NA
}


Expand All @@ -34,7 +39,9 @@ internal enum ContentstackRegionCode

azure_eu,

azure_na
azure_na,

gcp_na

}
}
27 changes: 24 additions & 3 deletions Contentstack.Core/Models/Asset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public void SetHeader(string key, string value)
/// });
/// </code>
/// </example>
public Asset includeFallback()
public Asset IncludeFallback()
{
this.UrlQueries.Add("include_fallback", "true");
return this;
Expand Down Expand Up @@ -216,18 +216,39 @@ public Asset IncludeMetadata()
/// <code>
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
/// Asset asset = stack.Asset(&quot;asset_uid&quot;);
/// asset.includeBranch();
/// asset.IncludeBranch();
/// asset.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
/// //Your callback code.
/// });
/// </code>
/// </example>
public Asset includeBranch()
public Asset IncludeBranch()
{
this.UrlQueries.Add("include_branch", "true");
return this;
}


/// <summary>
/// Add param in URL query.
/// </summary>
/// <returns>Current instance of Asset, this will be useful for a chaining calls.</returns>
/// <example>
/// <code>
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
/// Asset asset = stack.Asset(&quot;asset_uid&quot;);
/// asset.AddParam("include_branch", "true");
/// asset.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
/// //Your callback code.
/// });
/// </code>
/// </example>
public Asset AddParam(string key, string value)
{
this.UrlQueries.Add(key, value);
return this;
}

public void RemoveHeader(string key)
{
if (this._Headers.ContainsKey(key))
Expand Down
20 changes: 20 additions & 0 deletions Contentstack.Core/Models/AssetLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,26 @@ public AssetLibrary IncludeBranch()
return this;
}


/// <summary>
/// Add param in URL query.
/// </summary>
/// <returns>Current instance of Asset, this will be useful for a chaining calls.</returns>
/// <example>
/// <code>
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
/// AssetLibrary assetLibrary = stack.AssetLibrary();
/// assetLibrary.AddParam("include_branch", "true");
/// ContentstackCollection&gt;Asset&lt; contentstackCollection = await assetLibrary.FetchAll();
/// </code>
/// </example>
public AssetLibrary AddParam(string key, string value)
{
UrlQueries.Add(key, value);

return this;
}

/// <summary>
/// Sets the locale.
/// </summary>
Expand Down
27 changes: 26 additions & 1 deletion Contentstack.Core/Models/Entry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,32 @@ public Entry IncludeMetadata()
}



/// <summary>
/// Add param in URL query.
/// </summary>
/// <returns>Current instance of Entry, this will be useful for a chaining calls.</returns>
/// <example>
/// <code>
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
/// Entry entry = stack.ContentType(&quot;contentType_id&quot;).Entry(&quot;entry_uid&quot;);
/// entry.AddParam("include_branch", "true");
/// entry.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
/// //Your callback code.
/// });
/// </code>
/// </example>
public Entry AddParam(string key, string value)
{
try
{
UrlQueries.Add(key, value);
}
catch (Exception e)
{
throw new Exception(StackConstants.ErrorMessage_QueryFilterException, e);
}
return this;
}

/// <summary>
/// Include branch for publish content.
Expand Down
28 changes: 28 additions & 0 deletions Contentstack.Core/Models/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,34 @@ public Query IncludeBranch()
return this;
}


/// <summary>
/// Add param in URL query.
/// </summary>
/// <returns>Current instance of Entry, this will be useful for a chaining calls.</returns>
/// <example>
/// <code>
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
/// Entry entry = stack.ContentType(&quot;contentType_id&quot;).Entry(&quot;entry_uid&quot;);
/// entry.AddParam("include_branch", "true");
/// entry.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
/// //Your callback code.
/// });
/// </code>
/// </example>
public Query AddParam(string key, string value)
{
try
{
UrlQueries.Add(key, value);
}
catch (Exception e)
{
throw new Exception(StackConstants.ErrorMessage_QueryFilterException, e);
}
return this;
}

/// <summary>
/// Include Embedded Objects (Entries and Assets) along with entry/entries details.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>2.13.0</Version>
<Version>2.14.0</Version>
</PropertyGroup>
</Project>

0 comments on commit a46b1b9

Please sign in to comment.