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

upgrade: Changes resulting from upgrade to Vonk 3.0.0-beta1 #15

Merged
merged 1 commit into from
Sep 4, 2019
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
2 changes: 1 addition & 1 deletion Vonk.Plugin.ExampleOperation.Tests/VonkTestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class VonkTestResponse : IVonkResponse
public Dictionary<VonkResultHeader, string> Headers { get; set; } = new Dictionary<VonkResultHeader, string>();

public int HttpResult { get; set; }
public OperationOutcome Outcome { get; set; } = new OperationOutcome();
public VonkOutcome Outcome { get; set; } = new VonkOutcome();
public IResource Payload { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Vonk.Core" Version="2.1.0" />
<PackageReference Include="Vonk.Fhir.R3" Version="2.1.0" />
<PackageReference Include="Vonk.Core" Version="3.0.0-beta1" />
<PackageReference Include="Vonk.Fhir.R3" Version="3.0.0-beta1" />
</ItemGroup>

</Project>
15 changes: 8 additions & 7 deletions Vonk.Plugin.ExampleOperation/VonkPluginConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Vonk.Core.Common;
using Vonk.Core.Context;
using Vonk.Core.Metadata;
using Vonk.Core.Pluggability;
using Vonk.Core.Support;

Expand All @@ -18,22 +19,22 @@ Make sure to register services that you depend upon as well.
public static IServiceCollection ConfigureServices(IServiceCollection services)
{
services.TryAddScoped<VonkPluginService>(); // Add the service implementation
services.AddIfNotExists<IConformanceContributor, VonkPluginConformanceContributor>(ServiceLifetime.Transient); // Add operation to Vonk's CapabilityStatement
services.AddIfNotExists<ICapabilityStatementContributor, VonkPluginConformanceContributor>(ServiceLifetime.Transient); // Add operation to Vonk's CapabilityStatement
return services;
}

// Add middleware to the pipeline being built with the builder
public static IApplicationBuilder Configure(IApplicationBuilder builder)
{
// Register Pre-Handler
builder.OnCustomInteraction(VonkInteraction.all_custom, "test").PreHandleAsyncWith<VonkPluginService>((svc, context) => svc.PrepareTest(context));
builder.OnCustomInteraction(VonkInteraction.all_custom, "test").AndInformationModel(VonkConstants.Model.FhirR3).PreHandleAsyncWith<VonkPluginService>((svc, context) => svc.PrepareTest(context));

// Register Post-Handler, needs to be registered before the custom operation itself
builder.OnCustomInteraction(VonkInteraction.all_custom, "test").PostHandleAsyncWith<VonkPluginService>((svc, context) => svc.PostHandlerTest(context));
builder.OnCustomInteraction(VonkInteraction.all_custom, "test").AndInformationModel(VonkConstants.Model.FhirR3).PostHandleAsyncWith<VonkPluginService>((svc, context) => svc.PostHandlerTest(context));

// Register interactions (Don't add a "$" sign to the name of the custom operation, it will be added by default)
builder.OnCustomInteraction(VonkInteraction.instance_custom, "test").AndMethod("GET").HandleAsyncWith<VonkPluginService>((svc, context) => svc.Test(context));
builder.OnCustomInteraction(VonkInteraction.type_custom, "test").AndMethod("POST").HandleAsyncWith<VonkPluginService>((svc, context) => svc.Test(context));
builder.OnCustomInteraction(VonkInteraction.instance_custom, "test").AndInformationModel(VonkConstants.Model.FhirR3).AndMethod("GET").HandleAsyncWith<VonkPluginService>((svc, context) => svc.Test(context));
builder.OnCustomInteraction(VonkInteraction.type_custom, "test").AndInformationModel(VonkConstants.Model.FhirR3).AndMethod("POST").HandleAsyncWith<VonkPluginService>((svc, context) => svc.Test(context));
return builder;
}
}
Expand Down
13 changes: 8 additions & 5 deletions Vonk.Plugin.ExampleOperation/VonkPluginConformanceContributor.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using System;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Options;
using Vonk.Core.Common;
using Vonk.Core.Context;
using Vonk.Core.Pluggability;
using Vonk.Core.Metadata;
using Vonk.Core.Model.Capability;
using Vonk.Core.Pluggability.ContextAware;
using Vonk.Core.Support;

namespace Vonk.Plugin.ExampleOperation
{
internal class VonkPluginConformanceContributor : IConformanceContributor
[ContextAware(InformationModels = new[] { VonkConstants.Model.FhirR3 })]
internal class VonkPluginConformanceContributor : ICapabilityStatementContributor
{
private const string _operationName = "test";
private readonly SupportedInteractionOptions _supportedInteractionOptions;
Expand All @@ -19,7 +22,7 @@ public VonkPluginConformanceContributor(IOptions<SupportedInteractionOptions> op

// Make the $test operation appear in the CapabilityStatement, if it is declared as supported in the SupportedOperationsOptions
// See http://docs.simplifier.net/vonk/configuration/appsettings.html - Enable or disable interactions
public void Conformance(IConformanceBuilder builder)
public void ContributeToCapabilityStatement(ICapabilityStatementBuilder builder)
{
Check.NotNull(builder, nameof(builder));
if (_supportedInteractionOptions.SupportsCustomOperation(_operationName))
Expand Down