From db8e3a9a1453bd8173b5de1c771290114ffe451a Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar <nadeem.patwekar@contentstack.com> Date: Thu, 2 May 2024 16:01:04 +0530 Subject: [PATCH 1/7] feat: GCP support --- Contentstack.Core/Configuration/Config.cs | 2 +- .../Internals/ContentstackRegion.cs | 31 ++++++++++++------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Contentstack.Core/Configuration/Config.cs b/Contentstack.Core/Configuration/Config.cs index 4bdd342..ea4e353 100644 --- a/Contentstack.Core/Configuration/Config.cs +++ b/Contentstack.Core/Configuration/Config.cs @@ -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"; } diff --git a/Contentstack.Core/Internals/ContentstackRegion.cs b/Contentstack.Core/Internals/ContentstackRegion.cs index fa0bec1..1ad09cd 100644 --- a/Contentstack.Core/Internals/ContentstackRegion.cs +++ b/Contentstack.Core/Internals/ContentstackRegion.cs @@ -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 } @@ -34,7 +39,9 @@ internal enum ContentstackRegionCode azure_eu, - azure_na + azure_na, + + gcp_na } } From af214f1699ee008fda4b1f5686ef2a2bc4298161 Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar <nadeem.patwekar@contentstack.com> Date: Fri, 3 May 2024 11:16:56 +0530 Subject: [PATCH 2/7] Update version and changelog file --- CHANGELOG.md | 6 ++++++ Directory.Build.props | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 030599c..80cb9d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### Version: 2.14.0 +#### Date: May-07-2024 + +##### New Feature: +- GCP_NA region support added + ### Version: 2.13.0 #### Date: April-02-2024 diff --git a/Directory.Build.props b/Directory.Build.props index 49efd35..3221139 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ <Project> <PropertyGroup> - <Version>2.13.0</Version> + <Version>2.14.0</Version> </PropertyGroup> </Project> From 765598e1d14e1e99162aab5e37a6c5fa3da274c6 Mon Sep 17 00:00:00 2001 From: Aravind Kumar <aravind.kumar@contentstack.com> Date: Wed, 22 May 2024 12:32:44 +0530 Subject: [PATCH 3/7] Update sca-scan.yml From aea32884eea5ede31dc8a8d7924035ccf515c2e4 Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar <nadeem.patwekar@contentstack.com> Date: Thu, 23 May 2024 11:45:22 +0530 Subject: [PATCH 4/7] feat: :sparkles: AddParam support added --- .talismanrc | 10 +++++++-- CHANGELOG.md | 3 ++- Contentstack.Core/Models/Asset.cs | 27 ++++++++++++++++++++--- Contentstack.Core/Models/AssetLibrary.cs | 22 +++++++++++++++++++ Contentstack.Core/Models/Entry.cs | 27 ++++++++++++++++++++++- Contentstack.Core/Models/Query.cs | 28 ++++++++++++++++++++++++ 6 files changed, 110 insertions(+), 7 deletions(-) diff --git a/.talismanrc b/.talismanrc index 420960a..944a831 100644 --- a/.talismanrc +++ b/.talismanrc @@ -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 \ No newline at end of file + 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 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 80cb9d6..63e3f73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ ### Version: 2.14.0 -#### Date: May-07-2024 +#### 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 diff --git a/Contentstack.Core/Models/Asset.cs b/Contentstack.Core/Models/Asset.cs index afffc2b..f902863 100644 --- a/Contentstack.Core/Models/Asset.cs +++ b/Contentstack.Core/Models/Asset.cs @@ -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; @@ -216,18 +216,39 @@ public Asset IncludeMetadata() /// <code> /// ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment"); /// Asset asset = stack.Asset("asset_uid"); - /// asset.includeBranch(); + /// asset.IncludeBranch(); /// asset.Fetch<Product>().ContinueWith((assetResult) => { /// //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("api_key", "delivery_token", "environment"); + /// Asset asset = stack.Asset("asset_uid"); + /// asset.AddParam("include_branch", "true"); + /// asset.Fetch<Product>().ContinueWith((assetResult) => { + /// //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)) diff --git a/Contentstack.Core/Models/AssetLibrary.cs b/Contentstack.Core/Models/AssetLibrary.cs index 97a9f30..2e4e625 100644 --- a/Contentstack.Core/Models/AssetLibrary.cs +++ b/Contentstack.Core/Models/AssetLibrary.cs @@ -142,6 +142,28 @@ 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("api_key", "delivery_token", "environment"); + /// Asset asset = stack.Asset("asset_uid"); + /// asset.AddParam("include_branch", "true"); + /// asset.Fetch<Product>().ContinueWith((assetResult) => { + /// //Your callback code. + /// }); + /// </code> + /// </example> + public AssetLibrary AddParam(string key, string value) + { + UrlQueries.Add(key, value); + + return this; + } + /// <summary> /// Sets the locale. /// </summary> diff --git a/Contentstack.Core/Models/Entry.cs b/Contentstack.Core/Models/Entry.cs index 6f9c6e8..5460b29 100644 --- a/Contentstack.Core/Models/Entry.cs +++ b/Contentstack.Core/Models/Entry.cs @@ -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("api_key", "delivery_token", "environment"); + /// Entry entry = stack.ContentType("contentType_id").Entry("entry_uid"); + /// entry.AddParam("include_branch", "true"); + /// entry.Fetch<Product>().ContinueWith((assetResult) => { + /// //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. diff --git a/Contentstack.Core/Models/Query.cs b/Contentstack.Core/Models/Query.cs index b568694..202c529 100644 --- a/Contentstack.Core/Models/Query.cs +++ b/Contentstack.Core/Models/Query.cs @@ -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("api_key", "delivery_token", "environment"); + /// Entry entry = stack.ContentType("contentType_id").Entry("entry_uid"); + /// entry.AddParam("include_branch", "true"); + /// entry.Fetch<Product>().ContinueWith((assetResult) => { + /// //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> From 69c70febfe1951db4417f8116bd9ee6a60f36a80 Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar <nadeem.patwekar@contentstack.com> Date: Fri, 24 May 2024 11:39:14 +0530 Subject: [PATCH 5/7] chore: version update --- Contentstack.AspNetCore/Contentstack.AspNetCore.csproj | 2 +- Contentstack.Core/Models/AssetLibrary.cs | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj b/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj index 4329436..13ca34c 100644 --- a/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj +++ b/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj @@ -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="$(Version)" /> </ItemGroup> </Project> diff --git a/Contentstack.Core/Models/AssetLibrary.cs b/Contentstack.Core/Models/AssetLibrary.cs index 2e4e625..8bfe118 100644 --- a/Contentstack.Core/Models/AssetLibrary.cs +++ b/Contentstack.Core/Models/AssetLibrary.cs @@ -150,11 +150,9 @@ public AssetLibrary IncludeBranch() /// <example> /// <code> /// ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment"); - /// Asset asset = stack.Asset("asset_uid"); - /// asset.AddParam("include_branch", "true"); - /// asset.Fetch<Product>().ContinueWith((assetResult) => { - /// //Your callback code. - /// }); + /// AssetLibrary assetLibrary = stack.AssetLibrary(); + /// assetLibrary.AddParam("include_branch", "true"); + /// ContentstackCollection>Asset< contentstackCollection = await assetLibrary.FetchAll(); /// </code> /// </example> public AssetLibrary AddParam(string key, string value) From 39ce089faa8d88d7f6bc50eac161bca4087e00ae Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar <nadeem.patwekar@contentstack.com> Date: Fri, 24 May 2024 13:13:14 +0530 Subject: [PATCH 6/7] fix: change in csharp packege version as it checks for latest available --- Contentstack.AspNetCore/Contentstack.AspNetCore.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj b/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj index 13ca34c..41f678c 100644 --- a/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj +++ b/Contentstack.AspNetCore/Contentstack.AspNetCore.csproj @@ -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="$(Version)" /> + <PackageReference Include="contentstack.csharp" Version="2.13.0" /> </ItemGroup> </Project> From 5d656ecb7e3ff2811acb8d8f34a8a4723a276167 Mon Sep 17 00:00:00 2001 From: Aravind Kumar <aravind.kumar@contentstack.com> Date: Fri, 24 May 2024 17:13:03 +0530 Subject: [PATCH 7/7] Update sca-scan.yml --- .github/workflows/sca-scan.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sca-scan.yml b/.github/workflows/sca-scan.yml index 4fa4560..decebb1 100644 --- a/.github/workflows/sca-scan.yml +++ b/.github/workflows/sca-scan.yml @@ -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