diff --git a/.github/workflows/nuget-publish.yml b/.github/workflows/nuget-publish.yml index abc539c..466d715 100644 --- a/.github/workflows/nuget-publish.yml +++ b/.github/workflows/nuget-publish.yml @@ -22,7 +22,7 @@ jobs: - name: Push generated package to GitHub registry run: | cd out - dotnet nuget push "contentstack.management.csharp.*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate --no-symbols true --source https://api.nuget.org/v3/index.json + dotnet nuget push "contentstack.management.csharp.*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate --no-symbols --source https://api.nuget.org/v3/index.json publish-git: runs-on: windows-latest @@ -42,4 +42,4 @@ jobs: - name: Push generated package to GitHub registry run: | cd out - dotnet nuget push "contentstack.management.csharp.*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate --no-symbols true --source https://api.nuget.org/v3/index.json + dotnet nuget push "contentstack.management.csharp.*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate --no-symbols --source https://api.nuget.org/v3/index.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 59ace53..ecab8a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,14 @@ # Changelog -## [v0.1.9](https://github.com/contentstack/contentstack-management-dotnet/tree/v0.1.9) +## [v0.1.10](https://github.com/contentstack/contentstack-management-dotnet/tree/v0.1.10) - Feat - Add support for apiVersion in bulk publish unpublish methods +## [v0.1.9](https://github.com/contentstack/contentstack-management-dotnet/tree/v0.1.9) + - Fix + - Media header now added only to Assets API methods and removed from all others for both Sync and Async calls. + + ## [v0.1.8](https://github.com/contentstack/contentstack-management-dotnet/tree/v0.1.8) - Fix - Strong named assemblies diff --git a/Contentstack.Management.Core.Unit.Tests/Mokes/MockHttpHandler.cs b/Contentstack.Management.Core.Unit.Tests/Mokes/MockHttpHandler.cs index 3eda59f..e51b2df 100644 --- a/Contentstack.Management.Core.Unit.Tests/Mokes/MockHttpHandler.cs +++ b/Contentstack.Management.Core.Unit.Tests/Mokes/MockHttpHandler.cs @@ -14,9 +14,9 @@ public override Task InvokeAsync(IExecutionContext executionContext, bool return base.InvokeAsync(executionContext, addAcceptMediaHeader); } - public override void InvokeSync(IExecutionContext executionContext, string apiVersion = null) + public override void InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false, string apiVersion = null) { - base.InvokeSync(executionContext); + base.InvokeSync(executionContext, addAcceptMediaHeader, apiVersion); } } @@ -43,7 +43,7 @@ public async Task InvokeAsync(IExecutionContext executionContext, bool add return await Task.FromResult((T)executionContext.ResponseContext.httpResponse); } - public void InvokeSync(IExecutionContext executionContext, string apiVersion = null) + public void InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false, string apiVersion = null) { executionContext.ResponseContext.httpResponse = _response; if (executionContext.RequestContext.service != null) diff --git a/Contentstack.Management.Core/ContentstackClient.cs b/Contentstack.Management.Core/ContentstackClient.cs index 9af4734..ee5aab3 100644 --- a/Contentstack.Management.Core/ContentstackClient.cs +++ b/Contentstack.Management.Core/ContentstackClient.cs @@ -179,7 +179,7 @@ protected void BuildPipeline() }, LogManager); } - internal ContentstackResponse InvokeSync(TRequest request, string apiVersion = null) where TRequest : IContentstackService + internal ContentstackResponse InvokeSync(TRequest request, bool addAcceptMediaHeader = false, string apiVersion = null) where TRequest : IContentstackService { ThrowIfDisposed(); @@ -191,7 +191,7 @@ internal ContentstackResponse InvokeSync(TRequest request, string apiV }, new ResponseContext()); - return (ContentstackResponse)ContentstackPipeline.InvokeSync(context, apiVersion).httpResponse; + return (ContentstackResponse)ContentstackPipeline.InvokeSync(context, addAcceptMediaHeader, apiVersion).httpResponse; } internal Task InvokeAsync(TRequest request, bool addAcceptMediaHeader = false, string apiVersion = null) diff --git a/Contentstack.Management.Core/Runtime/Pipeline/ContentstackRuntimePipeline.cs b/Contentstack.Management.Core/Runtime/Pipeline/ContentstackRuntimePipeline.cs index c2e270f..17337b1 100644 --- a/Contentstack.Management.Core/Runtime/Pipeline/ContentstackRuntimePipeline.cs +++ b/Contentstack.Management.Core/Runtime/Pipeline/ContentstackRuntimePipeline.cs @@ -90,11 +90,11 @@ public System.Threading.Tasks.Task InvokeAsync(IExecutionContext execution return _handler.InvokeAsync(executionContext, addAcceptMediaHeader, apiVersion); } - public IResponseContext InvokeSync(IExecutionContext executionContext, string apiVersion = null) + public IResponseContext InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false, string apiVersion = null) { ThrowIfDisposed(); - _handler.InvokeSync(executionContext, apiVersion); + _handler.InvokeSync(executionContext, addAcceptMediaHeader, apiVersion); return executionContext.ResponseContext; } diff --git a/Contentstack.Management.Core/Runtime/Pipeline/HttpHandler/HttpHandler.cs b/Contentstack.Management.Core/Runtime/Pipeline/HttpHandler/HttpHandler.cs index 2db5949..82544e7 100644 --- a/Contentstack.Management.Core/Runtime/Pipeline/HttpHandler/HttpHandler.cs +++ b/Contentstack.Management.Core/Runtime/Pipeline/HttpHandler/HttpHandler.cs @@ -57,14 +57,14 @@ public async System.Threading.Tasks.Task InvokeAsync(IExecutionContext exe } } - public void InvokeSync(IExecutionContext executionContext, string apiVersion = null) + public void InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false, string apiVersion = null) { IHttpRequest httpRequest = null; try { var requestContext = executionContext.RequestContext; - httpRequest = requestContext.service.CreateHttpRequest(_httpClient, requestContext.config, apiVersion: apiVersion); + httpRequest = requestContext.service.CreateHttpRequest(_httpClient, requestContext.config, addAcceptMediaHeader, apiVersion: apiVersion); if (requestContext.service.HasRequestBody() && requestContext.service.Content != null) { diff --git a/Contentstack.Management.Core/Runtime/Pipeline/IPipelineHandler.cs b/Contentstack.Management.Core/Runtime/Pipeline/IPipelineHandler.cs index 15466d7..7c6460e 100644 --- a/Contentstack.Management.Core/Runtime/Pipeline/IPipelineHandler.cs +++ b/Contentstack.Management.Core/Runtime/Pipeline/IPipelineHandler.cs @@ -25,7 +25,7 @@ public interface IPipelineHandler /// /// - void InvokeSync(IExecutionContext executionContext, string apiVersion = null); + void InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false, string apiVersion = null); /// /// diff --git a/Contentstack.Management.Core/Runtime/Pipeline/PipelineHandler.cs b/Contentstack.Management.Core/Runtime/Pipeline/PipelineHandler.cs index 9c40272..0feb573 100644 --- a/Contentstack.Management.Core/Runtime/Pipeline/PipelineHandler.cs +++ b/Contentstack.Management.Core/Runtime/Pipeline/PipelineHandler.cs @@ -20,11 +20,11 @@ public virtual Task InvokeAsync(IExecutionContext executionContext, bool a throw new InvalidOperationException("Cannot invoke InnerHandler. InnerHandler is not set."); } - public virtual void InvokeSync(IExecutionContext executionContext, string apiVersion = null) + public virtual void InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false, string apiVersion = null) { if (this.InnerHandler != null) { - InnerHandler.InvokeSync(executionContext, apiVersion); + InnerHandler.InvokeSync(executionContext, addAcceptMediaHeader, apiVersion); return; } throw new InvalidOperationException("Cannot invoke InnerHandler. InnerHandler is not set."); diff --git a/Contentstack.Management.Core/Runtime/Pipeline/RetryHandler/RetryHandler.cs b/Contentstack.Management.Core/Runtime/Pipeline/RetryHandler/RetryHandler.cs index c585bf2..4ce9fcd 100644 --- a/Contentstack.Management.Core/Runtime/Pipeline/RetryHandler/RetryHandler.cs +++ b/Contentstack.Management.Core/Runtime/Pipeline/RetryHandler/RetryHandler.cs @@ -46,7 +46,7 @@ public override async Task InvokeAsync(IExecutionContext executionContext, throw new ContentstackException("No response was return nor exception was thrown"); } - public override void InvokeSync(IExecutionContext executionContext, string apiVersion = null) + public override void InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false, string apiVersion = null) { var requestContext = executionContext.RequestContext; bool shouldRetry = false; @@ -54,7 +54,7 @@ public override void InvokeSync(IExecutionContext executionContext, string apiVe { try { - base.InvokeSync(executionContext, apiVersion); + base.InvokeSync(executionContext, addAcceptMediaHeader, apiVersion); return; } catch (Exception exception)