From 1166e021e8e65aa2517ea51db6d44622bc616017 Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar 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 { - /// - /// Contentstack region. + /// + /// Contentstack region. /// public enum ContentstackRegion { - /// - /// To specify US region. + /// + /// To specify US region. /// US, - /// - /// To specify EU region. + /// + /// To specify EU region. /// EU, - /// - /// To specify EU region. + /// + /// To specify AZURE_EU region. /// AZURE_EU, - /// - /// To specify EU region. + /// + /// To specify AZURE_NA region. /// - AZURE_NA + AZURE_NA, + + /// + /// To specify GCP_NA region. + /// + GCP_NA } @@ -34,7 +39,9 @@ internal enum ContentstackRegionCode azure_eu, - azure_na + azure_na, + + gcp_na } } From d4d427bd9b6a6654aa8827708e8d521d8c22a31d Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar 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 @@ - 2.13.0 + 2.14.0 From 514d453b6ad70cba8a411ba84dfbcc291f8b7934 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Wed, 22 May 2024 12:32:44 +0530 Subject: [PATCH 3/7] Update sca-scan.yml From 07eb68de87cce7fc891b06b096b4d139a321acd9 Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar 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) /// }); /// /// - public Asset includeFallback() + public Asset IncludeFallback() { this.UrlQueries.Add("include_fallback", "true"); return this; @@ -216,18 +216,39 @@ public Asset IncludeMetadata() /// /// 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. /// }); /// /// - public Asset includeBranch() + public Asset IncludeBranch() { this.UrlQueries.Add("include_branch", "true"); return this; } + + /// + /// Add param in URL query. + /// + /// Current instance of Asset, this will be useful for a chaining calls. + /// + /// + /// 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. + /// }); + /// + /// + 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; } + + /// + /// Add param in URL query. + /// + /// Current instance of Asset, this will be useful for a chaining calls. + /// + /// + /// 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. + /// }); + /// + /// + public AssetLibrary AddParam(string key, string value) + { + UrlQueries.Add(key, value); + + return this; + } + /// /// Sets the locale. /// 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() } - + /// + /// Add param in URL query. + /// + /// Current instance of Entry, this will be useful for a chaining calls. + /// + /// + /// 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. + /// }); + /// + /// + public Entry AddParam(string key, string value) + { + try + { + UrlQueries.Add(key, value); + } + catch (Exception e) + { + throw new Exception(StackConstants.ErrorMessage_QueryFilterException, e); + } + return this; + } /// /// 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; } + + /// + /// Add param in URL query. + /// + /// Current instance of Entry, this will be useful for a chaining calls. + /// + /// + /// 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. + /// }); + /// + /// + public Query AddParam(string key, string value) + { + try + { + UrlQueries.Add(key, value); + } + catch (Exception e) + { + throw new Exception(StackConstants.ErrorMessage_QueryFilterException, e); + } + return this; + } + /// /// Include Embedded Objects (Entries and Assets) along with entry/entries details. /// From 078d947efc2d33f6620ca3f6b084d617542634f7 Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar 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 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + 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() /// /// /// 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(); /// /// public AssetLibrary AddParam(string key, string value) From 9aeb64f37485e185892121d06652701e7930c39f Mon Sep 17 00:00:00 2001 From: Nadeem Patwekar 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 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + From 1881885ce9b79277704c6d1c6d9e6a37ed52b1ca Mon Sep 17 00:00:00 2001 From: Aravind Kumar 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