Skip to content

Instantly share code, notes, and snippets.

@websterian
Created August 10, 2018 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save websterian/9d46daa9352fc75bdceef4776efbdd3a to your computer and use it in GitHub Desktop.
Save websterian/9d46daa9352fc75bdceef4776efbdd3a to your computer and use it in GitHub Desktop.
namespace Sitecore.Services.Examples.Composer
{
using System.Threading.Tasks;
using Microsoft.AspNetCore.OData.Builder;
using Sitecore.Commerce.Core;
using Sitecore.Commerce.Core.Commands;
using Sitecore.Framework.Conditions;
using Sitecore.Framework.Pipelines;
[PipelineDisplayName("SamplePluginConfigureServiceApiBlock")]
public class ConfigureServiceApiBlock : PipelineBlock<ODataConventionModelBuilder, ODataConventionModelBuilder, CommercePipelineExecutionContext>
{
public override Task<ODataConventionModelBuilder> Run(ODataConventionModelBuilder modelBuilder, CommercePipelineExecutionContext context)
{
Condition.Requires(modelBuilder).IsNotNull($"{this.Name}: The argument cannot be null.");
var configuration = modelBuilder.Action("CreateComposerTemplatesCommand");
configuration.Parameter<string>("Id");
configuration.ReturnsFromEntitySet<CommerceCommand>("Commands");
return Task.FromResult(modelBuilder);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment