Table of Contents

Class SitecoreLayoutRequestExtensions

Namespace
Sitecore.AspNetCore.SDK.LayoutService.Client.Request
Assembly
Sitecore.AspNetCore.SDK.LayoutService.Client.dll

Extension methods for SitecoreLayoutRequest.

public static class SitecoreLayoutRequestExtensions
Inheritance
SitecoreLayoutRequestExtensions
Inherited Members

Methods

AddHeader(SitecoreLayoutRequest, string, string[])

Adds the header with key and value to the headers collection stored in layout request.

public static void AddHeader(this SitecoreLayoutRequest request, string key, string[] value)

Parameters

request SitecoreLayoutRequest

Layout request instance.

key string

Header key.

value string[]

header value.

AddHeaders(SitecoreLayoutRequest, IDictionary<string, string[]>)

Adds headers collection to the headers collection stored in layout request.

public static void AddHeaders(this SitecoreLayoutRequest request, IDictionary<string, string[]> headers)

Parameters

request SitecoreLayoutRequest

Layout request instance.

headers IDictionary<string, string[]>

Headers collection.

ApiKey(SitecoreLayoutRequest)

Gets the API key of the request.

public static string? ApiKey(this SitecoreLayoutRequest request)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

Returns

string

The API key string value, otherwise null.

ApiKey(SitecoreLayoutRequest, string?)

Sets the API key of the request. If a null value is provided, the API key is removed from the request.

public static SitecoreLayoutRequest ApiKey(this SitecoreLayoutRequest request, string? value)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

value string

The value to set.

Returns

SitecoreLayoutRequest

The request.

AuthenticationHeader(SitecoreLayoutRequest)

Sets the authentication header of the request. If a null value is provided, the authentication header is removed from the request.

public static string? AuthenticationHeader(this SitecoreLayoutRequest request)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

Returns

string

The request.

AuthenticationHeader(SitecoreLayoutRequest, string?)

Gets the authentication header of the request.

public static SitecoreLayoutRequest AuthenticationHeader(this SitecoreLayoutRequest request, string? value)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

value string

The value to set.

Returns

SitecoreLayoutRequest

The authentication header string value, otherwise null.

ContextId(SitecoreLayoutRequest)

Gets the context id key of the request.

public static string? ContextId(this SitecoreLayoutRequest request)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

Returns

string

The API key string value, otherwise null.

ContextId(SitecoreLayoutRequest, string?)

Sets the context id key of the request. If a null value is provided, the API key is removed from the request.

public static SitecoreLayoutRequest ContextId(this SitecoreLayoutRequest request, string? value)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

value string

The value to set.

Returns

SitecoreLayoutRequest

The request.

Language(SitecoreLayoutRequest)

Gets the language of the request.

public static string? Language(this SitecoreLayoutRequest request)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

Returns

string

The language string value, otherwise null.

Language(SitecoreLayoutRequest, string?)

Sets the language of the request. If a null value is provided, the language is removed from the request.

public static SitecoreLayoutRequest Language(this SitecoreLayoutRequest request, string? value)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

value string

The value to set.

Returns

SitecoreLayoutRequest

The request.

Mode(SitecoreLayoutRequest)

Gets the mode of the request.

public static string? Mode(this SitecoreLayoutRequest request)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

Returns

string

The mode string value, otherwise null.

Mode(SitecoreLayoutRequest, string?)

Sets the mode of the request. If a null value is provided, the mode is removed from the request.

public static SitecoreLayoutRequest Mode(this SitecoreLayoutRequest request, string? value)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

value string

The value to set.

Returns

SitecoreLayoutRequest

The request.

Path(SitecoreLayoutRequest)

Gets the path of the request.

public static string? Path(this SitecoreLayoutRequest request)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

Returns

string

The path string value, otherwise null.

Path(SitecoreLayoutRequest, string?)

Sets the path of the request. If a null value is provided, the path is removed from the request.

public static SitecoreLayoutRequest Path(this SitecoreLayoutRequest request, string? value)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

value string

The value to set.

Returns

SitecoreLayoutRequest

The request.

PreviewDate(SitecoreLayoutRequest)

Sets the preview date of the request. If a null value is provided, the preview date is removed from the request.

public static string? PreviewDate(this SitecoreLayoutRequest request)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

Returns

string

The request.

PreviewDate(SitecoreLayoutRequest, string?)

Gets the preview date of the request.

public static SitecoreLayoutRequest PreviewDate(this SitecoreLayoutRequest request, string? value)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

value string

The value to set.

Returns

SitecoreLayoutRequest

The preview date string value, otherwise null.

SiteName(SitecoreLayoutRequest)

Gets the site name of the request.

public static string? SiteName(this SitecoreLayoutRequest request)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

Returns

string

The site name string value, otherwise null.

SiteName(SitecoreLayoutRequest, string?)

Sets the site name of the request. If a null value is provided, the site name is removed from the request.

public static SitecoreLayoutRequest SiteName(this SitecoreLayoutRequest request, string? value)

Parameters

request SitecoreLayoutRequest

The SitecoreLayoutRequest.

value string

The value to set.

Returns

SitecoreLayoutRequest

The request.

TryGetHeadersCollection(SitecoreLayoutRequest, out Dictionary<string, string[]>?)

Tries to get headers collection from layout request.

public static bool TryGetHeadersCollection(this SitecoreLayoutRequest request, out Dictionary<string, string[]>? headers)

Parameters

request SitecoreLayoutRequest

Layout request instance.

headers Dictionary<string, string[]>

Headers.

Returns

bool

false if there is no headers collection otherwise true.

UpdateRequest(SitecoreLayoutRequest, Dictionary<string, object?>?)

Update missing values in the original request with values in the default request.

public static SitecoreLayoutRequest UpdateRequest(this SitecoreLayoutRequest request, Dictionary<string, object?>? requestDefaults)

Parameters

request SitecoreLayoutRequest

The original request object.

requestDefaults Dictionary<string, object>

The default request object.

Returns

SitecoreLayoutRequest

The updated request object.