Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions .github/workflows/nuget-publish.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand All@@ -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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
# Changelog

## [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
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,9 +14,9 @@ public override Task<T> InvokeAsync<T>(IExecutionContext executionContext, bool
return base.InvokeAsync<T>(executionContext, addAcceptMediaHeader);
}

public override void InvokeSync(IExecutionContext executionContext)
public override void InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false)
{
base.InvokeSync(executionContext);
base.InvokeSync(executionContext, addAcceptMediaHeader);
}
}

Expand All@@ -43,7 +43,7 @@ public async Task<T> InvokeAsync<T>(IExecutionContext executionContext, bool add
return await Task.FromResult<T>((T)executionContext.ResponseContext.httpResponse);
}

public void InvokeSync(IExecutionContext executionContext)
public void InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false)
{
executionContext.ResponseContext.httpResponse = _response;
if (executionContext.RequestContext.service != null)
Expand Down
6 changes: 3 additions & 3 deletions Contentstack.Management.Core/ContentstackClient.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,7 +35,7 @@ public class ContentstackClient : IContentstackClient
private HttpClient _httpClient;
private bool _disposed = false;

private string Version => "0.1.8";
private string Version => "0.1.9";
private string xUserAgent => $"contentstack-management-dotnet/{Version}";
#endregion

Expand DownExpand Up@@ -179,7 +179,7 @@ protected void BuildPipeline()
}, LogManager);
}

internal ContentstackResponse InvokeSync<TRequest>(TRequest request) where TRequest : IContentstackService
internal ContentstackResponse InvokeSync<TRequest>(TRequest request, bool addAcceptMediaHeader = false) where TRequest : IContentstackService
{
ThrowIfDisposed();

Expand All@@ -191,7 +191,7 @@ internal ContentstackResponse InvokeSync<TRequest>(TRequest request) where TRequ
},
new ResponseContext());

return (ContentstackResponse)ContentstackPipeline.InvokeSync(context).httpResponse;
return (ContentstackResponse)ContentstackPipeline.InvokeSync(context, addAcceptMediaHeader).httpResponse;
}

internal Task<TResponse> InvokeAsync<TRequest, TResponse>(TRequest request, bool addAcceptMediaHeader = false)
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -90,11 +90,11 @@ public System.Threading.Tasks.Task<T> InvokeAsync<T>(IExecutionContext execution
return _handler.InvokeAsync<T>(executionContext, addAcceptMediaHeader);
}

public IResponseContext InvokeSync(IExecutionContext executionContext)
public IResponseContext InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false)
{
ThrowIfDisposed();

_handler.InvokeSync(executionContext);
_handler.InvokeSync(executionContext, addAcceptMediaHeader);
return executionContext.ResponseContext;
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,14 +57,14 @@ public async System.Threading.Tasks.Task<T> InvokeAsync<T>(IExecutionContext exe
}
}

public void InvokeSync(IExecutionContext executionContext)
public void InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false)
{
IHttpRequest httpRequest = null;
try
{
var requestContext = executionContext.RequestContext;

httpRequest = requestContext.service.CreateHttpRequest(_httpClient, requestContext.config);
httpRequest = requestContext.service.CreateHttpRequest(_httpClient, requestContext.config, addAcceptMediaHeader);

if (requestContext.service.HasRequestBody() && requestContext.service.Content != null)
{
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ public interface IPipelineHandler
/// </summary>
/// <param name="executionContext"></param>

void InvokeSync(IExecutionContext executionContext);
void InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false);

/// <summary>
///
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,11 +20,11 @@ public virtual Task<T> InvokeAsync<T>(IExecutionContext executionContext, bool a
throw new InvalidOperationException("Cannot invoke InnerHandler. InnerHandler is not set.");
}

public virtual void InvokeSync(IExecutionContext executionContext)
public virtual void InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false)
{
if (this.InnerHandler != null)
{
InnerHandler.InvokeSync(executionContext);
InnerHandler.InvokeSync(executionContext, addAcceptMediaHeader);
return;
}
throw new InvalidOperationException("Cannot invoke InnerHandler. InnerHandler is not set.");
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -46,15 +46,15 @@ public override async Task<T> InvokeAsync<T>(IExecutionContext executionContext,
throw new ContentstackException("No response was return nor exception was thrown");
}

public override void InvokeSync(IExecutionContext executionContext)
public override void InvokeSync(IExecutionContext executionContext, bool addAcceptMediaHeader = false)
{
var requestContext = executionContext.RequestContext;
bool shouldRetry = false;
do
{
try
{
base.InvokeSync(executionContext);
base.InvokeSync(executionContext, addAcceptMediaHeader);
return;
}
catch (Exception exception)
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>0.1.8</Version>
<Version>0.1.9</Version>
</PropertyGroup>
</Project>