Class SitecoreLayoutClientBuilderExtensions
Extension methods to support configuration of layout service services.
Inheritance
Namespace: Sitecore.LayoutService.Client.Extensions
Assembly: Sitecore.LayoutService.Client.dll
Syntax
public static class SitecoreLayoutClientBuilderExtensions : ObjectMethods
AddGraphQlHandler(ISitecoreLayoutClientBuilder, String, String, String, Uri)
Registers a graphQl handler to handle requests.
Declaration
public static ILayoutRequestHandlerBuilder<GraphQlLayoutServiceHandler> AddGraphQlHandler(this ISitecoreLayoutClientBuilder builder, string name, string siteName, string apiKey, Uri uri)Parameters
| Type | Name | Description |
|---|---|---|
| ISitecoreLayoutClientBuilder | builder |
The ISitecoreLayoutClientBuilder being configured. |
| System.String | name |
The name used to identify the handler. |
| System.String | siteName |
The siteName used to identify the handler. |
| System.String | apiKey |
The apiKey to access graphQl endpoint. |
| System.Uri | uri |
GraphQl endpoint uri. |
Returns
| Type | Description |
|---|---|
| ILayoutRequestHandlerBuilder<GraphQlLayoutServiceHandler> |
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained. |
AddHandler<THandler>(ISitecoreLayoutClientBuilder, String, Func<IServiceProvider, THandler>)
Registers a handler of type THandler to handle requests.
Declaration
public static ILayoutRequestHandlerBuilder<THandler> AddHandler<THandler>(this ISitecoreLayoutClientBuilder builder, string name, Func<IServiceProvider, THandler> factory = null)
where THandler : ILayoutRequestHandlerParameters
| Type | Name | Description |
|---|---|---|
| ISitecoreLayoutClientBuilder | builder |
The ISitecoreLayoutClientBuilder being configured. |
| System.String | name |
The name used to identify the handler. |
| System.Func<System.IServiceProvider, THandler> | factory |
Optional factory to control the instantiation of the client. |
Returns
| Type | Description |
|---|---|
| ILayoutRequestHandlerBuilder<THandler> |
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| THandler |
The type of service to be registered for this |
AddSystemTextJson(ISitecoreLayoutClientBuilder)
Configures System.Text.Json specific features such as input and output formatters.
Declaration
public static ISitecoreLayoutClientBuilder AddSystemTextJson(this ISitecoreLayoutClientBuilder builder)Parameters
| Type | Name | Description |
|---|---|---|
| ISitecoreLayoutClientBuilder | builder |
The ISitecoreLayoutClientBuilder being configured. |
Returns
| Type | Description |
|---|---|
| ISitecoreLayoutClientBuilder |
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained. |
WithDefaultRequestOptions(ISitecoreLayoutClientBuilder, Action<SitecoreLayoutRequest>)
Registers the default layout service request options for all handlers.
Declaration
public static ISitecoreLayoutClientBuilder WithDefaultRequestOptions(this ISitecoreLayoutClientBuilder builder, Action<SitecoreLayoutRequest> configureRequest)Parameters
| Type | Name | Description |
|---|---|---|
| ISitecoreLayoutClientBuilder | builder |
The ISitecoreLayoutClientBuilder being configured. |
| System.Action<SitecoreLayoutRequest> | configureRequest |
The SitecoreLayoutRequest request options configuration. |
Returns
| Type | Description |
|---|---|
| ISitecoreLayoutClientBuilder |
The configured ISitecoreLayoutClientBuilder. |