Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure-EU, Azure-NA and Include Metadata #29

Merged
merged 5 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Contentstack.AspNetCore/Contentstack.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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.9.0" />
<PackageReference Include="contentstack.csharp" Version="2.10.0" />
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions Contentstack.Core.Tests/Contentstack.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net7.0</TargetFramework>

<IsPackable>false</IsPackable>
<ReleaseVersion>2.10.0</ReleaseVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" />
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
10 changes: 10 additions & 0 deletions Contentstack.Core/Configuration/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ internal string HostURL
{
if (Region == ContentstackRegion.EU)
return "cdn.contentstack.com";
if (Region == ContentstackRegion.AZURE_EU || Region == ContentstackRegion.AZURE_NA) {
if (Region == ContentstackRegion.AZURE_NA) {
return "azure-na-cdn.contentstack.com";
}
if (Region == ContentstackRegion.AZURE_EU)
{
return "azure-eu-cdn.contentstack.com";
}
}

return "cdn.contentstack.io";
}
}
Expand Down
4 changes: 2 additions & 2 deletions Contentstack.Core/Contentstack.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
<AllowUnsafeBlocks></AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" />
<PackageReference Include="Markdig" Version="0.31.0" />
<PackageReference Include="Markdig" Version="0.33.0" />
<PackageReference Include="contentstack.utils" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
Expand Down
18 changes: 16 additions & 2 deletions Contentstack.Core/Internals/ContentstackRegion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,28 @@ public enum ContentstackRegion
/// <summary>
/// To specify EU region.
/// </summary>
EU
EU,
/// <summary>
/// To specify EU region.
/// </summary>
AZURE_EU,

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


internal enum ContentstackRegionCode
{
us,

eu
eu,

azure_eu,

azure_na

}
}
30 changes: 30 additions & 0 deletions Contentstack.Core/Models/Asset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,36 @@ public Asset includeFallback()
return this;
}



/// <summary>
/// This call includes metadata in the response.
/// </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.IncludeMetadata();
/// asset.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
/// //Your callback code.
/// });
/// </code>
/// </example>
public Asset IncludeMetadata()
{
try
{
this.UrlQueries.Add("include_metadata", "true");
}
catch (Exception e)
{
throw new Exception(StackConstants.ErrorMessage_QueryFilterException, e);
}
return this;
}


/// <summary>
/// Include branch for publish content.
/// </summary>
Expand Down
29 changes: 29 additions & 0 deletions Contentstack.Core/Models/AssetLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,35 @@ public void IncludeCount()
UrlQueries.Add("include_count", "true");
}




/// <summary>
/// This call includes metadata in the response.
/// </summary>
/// <returns>Current instance of AssetLibrary, 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.IncludeMetadata();
/// ContentstackCollection&gt;Asset&lt; contentstackCollection = await assetLibrary.FetchAll();
/// </code>
/// </example>
public void IncludeMetadata()
{
try
{
UrlQueries.Add("include_metadata", "true");
}
catch (Exception e)
{
throw new Exception(StackConstants.ErrorMessage_QueryFilterException, e);
}
}



/// <summary>
/// This method includes the relative url of assets.
/// </summary>
Expand Down
31 changes: 31 additions & 0 deletions Contentstack.Core/Models/Entry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,37 @@ public Entry IncludeFallback()
return this;
}


/// <summary>
/// Include metadata includes metadata.
/// </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.IncludeMetadata();
/// entry.Fetch&lt;Product&gt;().ContinueWith((entryResult) =&gt; {
/// //Your Metadata code.
/// });
/// </code>
/// </example>
public Entry IncludeMetadata()
{
try
{
UrlQueries.Add("include_metadata", "true");
}
catch (Exception e)
{
throw new Exception(StackConstants.ErrorMessage_QueryFilterException, e);
}
return this;
}




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



/// <summary>
/// This call includes metadata in the response.
/// </summary>
/// <returns>Current instance of Query, 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;);
/// Query csQuery = stack.ContentType(&quot;contentType_id&quot;).Query();
/// csQuery.IncludeMetadata();
/// csQuery.Find&lt;Product&gt;().ContinueWith((queryResult) =&gt; {
/// //Your metadata code.
/// });
/// </code>
/// </example>
public Query IncludeMetadata()
{
try
{
UrlQueries.Add("include_metadata", "true");
}
catch (Exception e)
{
throw new Exception(StackConstants.ErrorMessage_QueryFilterException, e);
}
return this;
}

/// <summary>
/// This method also includes owner information for all the entries returned in the response.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "3.1.404"
"version": "7.0.400"
}
}