Class SitecoreLayoutRequestExtensions

Version: 21.x

Extension methods for SitecoreLayoutRequest.

Inheritance
System.Object
SitecoreLayoutRequestExtensions
Namespace: Sitecore.LayoutService.Client.Request
Assembly: Sitecore.LayoutService.Client.Abstractions.dll
Syntax
RequestResponse
public static class SitecoreLayoutRequestExtensions : Object

Methods

AddHeader(SitecoreLayoutRequest, String, String[])

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

Declaration
RequestResponse
public static void AddHeader(this SitecoreLayoutRequest layoutRequest, string key, string[] value)
Parameters
TypeNameDescription
SitecoreLayoutRequestlayoutRequest

Layout request instance.

System.Stringkey

Header key.

System.String[]value

header value.

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

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

Declaration
RequestResponse
public static void AddHeaders(this SitecoreLayoutRequest layoutRequest, IDictionary<string, string[]> headers)
Parameters
TypeNameDescription
SitecoreLayoutRequestlayoutRequest

Layout request instance.

System.Collections.Generic.IDictionary<System.String, System.String[]>headers

Headers collection.

ApiKey(SitecoreLayoutRequest)

Gets the API key of the request.

Declaration
RequestResponse
public static string ApiKey(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

Returns
TypeDescription
System.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.

Declaration
RequestResponse
public static SitecoreLayoutRequest ApiKey(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

System.Stringvalue

The value to set.

Returns
TypeDescription
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.

Declaration
RequestResponse
public static string AuthenticationHeader(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

Returns
TypeDescription
System.String

The request.

AuthenticationHeader(SitecoreLayoutRequest, String)

Gets the authentication header of the request.

Declaration
RequestResponse
public static SitecoreLayoutRequest AuthenticationHeader(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

System.Stringvalue

The value to set.

Returns
TypeDescription
SitecoreLayoutRequest

The authentication header string value, otherwise null.

Language(SitecoreLayoutRequest)

Gets the language of the request.

Declaration
RequestResponse
public static string Language(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

Returns
TypeDescription
System.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.

Declaration
RequestResponse
public static SitecoreLayoutRequest Language(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

System.Stringvalue

The value to set.

Returns
TypeDescription
SitecoreLayoutRequest

The request.

Mode(SitecoreLayoutRequest)

Gets the mode of the request.

Declaration
RequestResponse
public static string Mode(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

Returns
TypeDescription
System.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.

Declaration
RequestResponse
public static SitecoreLayoutRequest Mode(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

System.Stringvalue

The value to set.

Returns
TypeDescription
SitecoreLayoutRequest

The request.

Path(SitecoreLayoutRequest)

Gets the path of the request.

Declaration
RequestResponse
public static string Path(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

Returns
TypeDescription
System.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.

Declaration
RequestResponse
public static SitecoreLayoutRequest Path(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

System.Stringvalue

The value to set.

Returns
TypeDescription
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.

Declaration
RequestResponse
public static string PreviewDate(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

Returns
TypeDescription
System.String

The request.

PreviewDate(SitecoreLayoutRequest, String)

Gets the preview date of the request.

Declaration
RequestResponse
public static SitecoreLayoutRequest PreviewDate(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

System.Stringvalue

The value to set.

Returns
TypeDescription
SitecoreLayoutRequest

The preview date string value, otherwise null.

SiteName(SitecoreLayoutRequest)

Gets the site name of the request.

Declaration
RequestResponse
public static string SiteName(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

Returns
TypeDescription
System.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.

Declaration
RequestResponse
public static SitecoreLayoutRequest SiteName(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The SitecoreLayoutRequest.

System.Stringvalue

The value to set.

Returns
TypeDescription
SitecoreLayoutRequest

The request.

TryGetHeadersCollection(SitecoreLayoutRequest, out Dictionary<String, String[]>)

Tries to get headers collection from layout request.

Declaration
RequestResponse
public static bool TryGetHeadersCollection(this SitecoreLayoutRequest layoutRequest, out Dictionary<string, string[]> headers)
Parameters
TypeNameDescription
SitecoreLayoutRequestlayoutRequest

Layout request instance.

System.Collections.Generic.Dictionary<System.String, System.String[]>headers

Headers.

Returns
TypeDescription
System.Boolean

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.

Declaration
RequestResponse
public static SitecoreLayoutRequest UpdateRequest(this SitecoreLayoutRequest request, Dictionary<string, object> requestDefaults)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequest

The original request object.

System.Collections.Generic.Dictionary<System.String, System.Object>requestDefaults

The default request object.

Returns
TypeDescription
SitecoreLayoutRequest

The updated request object.

Do you have some feedback for us?

If you have suggestions for improving this article,