Class SitecoreLayoutClientBuilderExtensions
- Namespace
- Sitecore.AspNetCore.SDK.LayoutService.Client.Extensions
- Assembly
- Sitecore.AspNetCore.SDK.LayoutService.Client.dll
Extension methods to support configuration of layout service services.
public static class SitecoreLayoutClientBuilderExtensions
- Inheritance
-
SitecoreLayoutClientBuilderExtensions
- Inherited Members
Methods
AddGraphQLHandler(ISitecoreLayoutClientBuilder, string, string, string)
Registers a graphQl handler to handle requests, it uses already configured GraphQL client.
public static ILayoutRequestHandlerBuilder<GraphQLLayoutServiceHandler> AddGraphQLHandler(this ISitecoreLayoutClientBuilder builder, string name, string siteName, string defaultLanguage = "en")
Parameters
builderISitecoreLayoutClientBuilderThe ISitecoreLayoutClientBuilder being configured.
namestringThe name used to identify the handler.
siteNamestringThe siteName used to identify the handler.
defaultLanguagestringDefault language for GraphQL requests.
Returns
- ILayoutRequestHandlerBuilder<GraphQLLayoutServiceHandler>
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained.
AddGraphQLHandler(ISitecoreLayoutClientBuilder, string, string, string, Uri, string)
Registers a graphQl handler to handle requests.
public static ILayoutRequestHandlerBuilder<GraphQLLayoutServiceHandler> AddGraphQLHandler(this ISitecoreLayoutClientBuilder builder, string name, string siteName, string apiKey, Uri uri, string defaultLanguage = "en")
Parameters
builderISitecoreLayoutClientBuilderThe ISitecoreLayoutClientBuilder being configured.
namestringThe name used to identify the handler.
siteNamestringThe siteName used to identify the handler.
apiKeystringThe apiKey to access graphQL endpoint.
uriUriGraphQL endpoint uri.
defaultLanguagestringDefault language for GraphQL requests.
Returns
- ILayoutRequestHandlerBuilder<GraphQLLayoutServiceHandler>
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained.
AddGraphQLWithContextHandler(ISitecoreLayoutClientBuilder, string, string, Uri?, string?, string)
Registers a graphQl handler to handle requests.
public static ILayoutRequestHandlerBuilder<GraphQLLayoutServiceHandler> AddGraphQLWithContextHandler(this ISitecoreLayoutClientBuilder builder, string name, string contextId, Uri? uri = null, string? siteName = null, string defaultLanguage = "en")
Parameters
builderISitecoreLayoutClientBuilderThe ISitecoreLayoutClientBuilder being configured.
namestringThe name used to identify the handler.
contextIdstringThe context identifier to access graphQl endpoint.
uriUriGraphQL endpoint uri.
siteNamestringThe siteName used to identify the handler.
defaultLanguagestringDefault language for GraphQL requests.
Returns
- 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.
public static ILayoutRequestHandlerBuilder<THandler> AddHandler<THandler>(this ISitecoreLayoutClientBuilder builder, string name, Func<IServiceProvider, THandler>? factory = null) where THandler : ILayoutRequestHandler
Parameters
builderISitecoreLayoutClientBuilderThe ISitecoreLayoutClientBuilder being configured.
namestringThe name used to identify the handler.
factoryFunc<IServiceProvider, THandler>Optional factory to control the instantiation of the client.
Returns
- ILayoutRequestHandlerBuilder<THandler>
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained.
Type Parameters
THandlerThe type of service to be registered for this
name.
AddHttpHandler(ISitecoreLayoutClientBuilder, string, Action<IServiceProvider, HttpClient>)
Registers an HTTP request handler for the Sitecore layout service client.
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> AddHttpHandler(this ISitecoreLayoutClientBuilder builder, string handlerName, Action<IServiceProvider, HttpClient> configure)
Parameters
builderISitecoreLayoutClientBuilderThe ISitecoreLayoutClientBuilder to configure.
handlerNamestringThe name of the request handler being registered.
configureAction<IServiceProvider, HttpClient>An action to configure the HttpClient.
Returns
- ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler>
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained.
AddHttpHandler(ISitecoreLayoutClientBuilder, string, Action<HttpClient>)
Registers an HTTP request handler for the Sitecore layout service client.
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> AddHttpHandler(this ISitecoreLayoutClientBuilder builder, string handlerName, Action<HttpClient> configure)
Parameters
builderISitecoreLayoutClientBuilderThe ISitecoreLayoutClientBuilder to configure.
handlerNamestringThe name of the request handler being registered.
configureAction<HttpClient>An action to configure the HttpClient.
Returns
- ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler>
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained.
AddHttpHandler(ISitecoreLayoutClientBuilder, string, Func<IServiceProvider, HttpClient>)
Registers an HTTP request handler for the Sitecore layout service client.
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> AddHttpHandler(this ISitecoreLayoutClientBuilder builder, string handlerName, Func<IServiceProvider, HttpClient> resolveClient)
Parameters
builderISitecoreLayoutClientBuilderThe ISitecoreLayoutClientBuilder to configure.
handlerNamestringThe name of the request handler being registered.
resolveClientFunc<IServiceProvider, HttpClient>A function to resolve the HttpClient to be used. Be aware, that the underlying HttpMessageHandler associated to the HttpClient will be reused across multiple sessions. To prevent data, leaking among sessions, make sure Cookies are not cached. See for reference https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-3.1#cookies .
Returns
- ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler>
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained.
AddHttpHandler(ISitecoreLayoutClientBuilder, string, Func<IServiceProvider, HttpClient>, string[])
Registers an HTTP request handler for the Sitecore layout service client.
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> AddHttpHandler(this ISitecoreLayoutClientBuilder builder, string handlerName, Func<IServiceProvider, HttpClient> resolveClient, string[] nonValidatedHeaders)
Parameters
builderISitecoreLayoutClientBuilderThe ISitecoreLayoutClientBuilder to configure.
handlerNamestringThe name of the request handler being registered.
resolveClientFunc<IServiceProvider, HttpClient>A function to resolve the HttpClient to be used. Be aware, that the underlying HttpMessageHandler associated to the HttpClient will be reused across multiple sessions. To prevent data, leaking among sessions, make sure Cookies are not cached. See for reference https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-3.1#cookies .
nonValidatedHeadersstring[]The list of headers which should not be validated.
Returns
- ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler>
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained.
AddHttpHandler(ISitecoreLayoutClientBuilder, string, string)
Registers an HTTP request handler for the Sitecore layout service client.
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> AddHttpHandler(this ISitecoreLayoutClientBuilder builder, string handlerName, string uri)
Parameters
builderISitecoreLayoutClientBuilderThe ISitecoreLayoutClientBuilder to configure.
handlerNamestringThe name of the request handler being registered.
uristringThe Uri used for the BaseAddress.
Returns
- ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler>
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained.
AddHttpHandler(ISitecoreLayoutClientBuilder, string, Uri)
Registers an HTTP request handler for the Sitecore layout service client.
public static ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler> AddHttpHandler(this ISitecoreLayoutClientBuilder builder, string handlerName, Uri uri)
Parameters
builderISitecoreLayoutClientBuilderThe ISitecoreLayoutClientBuilder to configure.
handlerNamestringThe name of the request handler being registered.
uriUriThe Uri used for the BaseAddress.
Returns
- ILayoutRequestHandlerBuilder<HttpLayoutRequestHandler>
The ILayoutRequestHandlerBuilder<THandler> so that additional calls can be chained.
WithDefaultRequestOptions(ISitecoreLayoutClientBuilder, Action<SitecoreLayoutRequest>)
Registers the default layout service request options for all handlers.
public static ISitecoreLayoutClientBuilder WithDefaultRequestOptions(this ISitecoreLayoutClientBuilder builder, Action<SitecoreLayoutRequest> configureRequest)
Parameters
builderISitecoreLayoutClientBuilderThe ISitecoreLayoutClientBuilder being configured.
configureRequestAction<SitecoreLayoutRequest>The SitecoreLayoutRequest request options configuration.
Returns
- ISitecoreLayoutClientBuilder
The configured ISitecoreLayoutClientBuilder.