Class DefaultLayoutClient

Version: 21.x

Supports making requests to the Sitecore layout service.

Inheritance
System.Object
DefaultLayoutClient
Namespace: Sitecore.LayoutService.Client
Assembly: Sitecore.LayoutService.Client.dll
Syntax
RequestResponse
public class DefaultLayoutClient : Object, ISitecoreLayoutClient, ILayoutRequestHandler

Constructors

DefaultLayoutClient(IServiceProvider, IOptions<SitecoreLayoutClientOptions>, IOptionsSnapshot<SitecoreLayoutRequestOptions>, ILogger<DefaultLayoutClient>)

Initializes a new instance of the DefaultLayoutClient class.

Declaration
RequestResponse
public DefaultLayoutClient(IServiceProvider services, IOptions<SitecoreLayoutClientOptions> layoutClientOptions, IOptionsSnapshot<SitecoreLayoutRequestOptions> layoutRequestOptions, ILogger<DefaultLayoutClient> logger)
Parameters
TypeNameDescription
System.IServiceProviderservices

The services used for handler resolution.

Microsoft.Extensions.Options.IOptions<SitecoreLayoutClientOptions>layoutClientOptions

The SitecoreLayoutClientOptions for this instance.

Microsoft.Extensions.Options.IOptionsSnapshot<SitecoreLayoutRequestOptions>layoutRequestOptions

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

Microsoft.Extensions.Logging.ILogger<DefaultLayoutClient>logger

The 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
RequestResponse
public Task<SitecoreLayoutResponse> Request(SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The 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
RequestResponse
public Task<SitecoreLayoutResponse> Request(SitecoreLayoutRequest request, string handlerName)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The request details.

System.StringhandlerName

The name of the request handler to use to handle the request.

Returns
TypeDescription
System.Threading.Tasks.Task<SitecoreLayoutResponse>

The response of the request.

Implements

Do you have some feedback for us?

If you have suggestions for improving this article,