Class DefaultLayoutClient

Version: 21.x

Supports making requests to the Sitecore layout service.

Inheritance

System.Object

DefaultLayoutClient

Implements

ISitecoreLayoutClient

ILayoutRequestHandler

Namespace: Sitecore.LayoutService.Client

Assembly: Sitecore.LayoutService.Client.dll
Syntax
public class DefaultLayoutClient : Object, ISitecoreLayoutClient, ILayoutRequestHandler

Constructors

DefaultLayoutClient(IServiceProvider, IOptions, IOptionsSnapshot, ILogger)

Initializes a new instance of the DefaultLayoutClient class.

Declaration
public DefaultLayoutClient(IServiceProvider services, IOptions<SitecoreLayoutClientOptions> layoutClientOptions, IOptionsSnapshot<SitecoreLayoutRequestOptions> layoutRequestOptions, ILogger<DefaultLayoutClient> logger)
Parameters
TypeNameDescription
System.IServiceProviderservicesThe services used for handler resolution.
Microsoft.Extensions.Options.IOptions

<

SitecoreLayoutClientOptions

>
layoutClientOptionsThe SitecoreLayoutClientOptions for this instance.
Microsoft.Extensions.Options.IOptionsSnapshot

<

SitecoreLayoutRequestOptions

>
layoutRequestOptionsAn Microsoft.Extensions.Options.IOptionsSnapshot<> to access specific options for the default client request.
Microsoft.Extensions.Logging.ILogger

<

DefaultLayoutClient

>
loggerThe Microsoft.Extensions.Logging.ILogger to use for logging.

Methods

Request(SitecoreLayoutRequest)

Invokes a request to the Sitecore layout service using the default handler name.

Declaration
public Task<SitecoreLayoutResponse> Request(SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe request details.
Returns
TypeDescription
System.Threading.Tasks.Task

<

SitecoreLayoutResponse

>
The response of the request.

Request(SitecoreLayoutRequest, String)

Handles a request to the Sitecore layout service using the specified handler.

Declaration
public Task<SitecoreLayoutResponse> Request(SitecoreLayoutRequest request, string handlerName)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe request details.
System.StringhandlerNameThe name of the request handler to use to handle the request.
Returns
TypeDescription
System.Threading.Tasks.Task

<

SitecoreLayoutResponse

>
The response of the request.

Implements

ISitecoreLayoutClient

ILayoutRequestHandler

If you have suggestions for improving this article, let us know!