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
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
public static void AddHeader(this SitecoreLayoutRequest layoutRequest, string key, string[] value)
Parameters
TypeNameDescription
SitecoreLayoutRequestlayoutRequestLayout request instance.
System.StringkeyHeader key.
System.String

[]
valueheader value.

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

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

Declaration
public static void AddHeaders(this SitecoreLayoutRequest layoutRequest, IDictionary<string, string[]> headers)
Parameters
TypeNameDescription
SitecoreLayoutRequestlayoutRequestLayout request instance.
System.Collections.Generic.IDictionary

<

System.String

,

System.String

[]>
headersHeaders collection.

ApiKey(SitecoreLayoutRequest)

Gets the API key of the request.

Declaration
public static string ApiKey(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
Returns
TypeDescription
System.StringThe 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
public static SitecoreLayoutRequest ApiKey(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
System.StringvalueThe value to set.
Returns
TypeDescription
SitecoreLayoutRequestThe 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
public static string AuthenticationHeader(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
Returns
TypeDescription
System.StringThe request.

AuthenticationHeader(SitecoreLayoutRequest, String)

Gets the authentication header of the request.

Declaration
public static SitecoreLayoutRequest AuthenticationHeader(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
System.StringvalueThe value to set.
Returns
TypeDescription
SitecoreLayoutRequestThe authentication header string value, otherwise null.

Language(SitecoreLayoutRequest)

Gets the language of the request.

Declaration
public static string Language(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
Returns
TypeDescription
System.StringThe 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
public static SitecoreLayoutRequest Language(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
System.StringvalueThe value to set.
Returns
TypeDescription
SitecoreLayoutRequestThe request.

Mode(SitecoreLayoutRequest)

Gets the mode of the request.

Declaration
public static string Mode(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
Returns
TypeDescription
System.StringThe 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
public static SitecoreLayoutRequest Mode(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
System.StringvalueThe value to set.
Returns
TypeDescription
SitecoreLayoutRequestThe request.

Path(SitecoreLayoutRequest)

Gets the path of the request.

Declaration
public static string Path(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
Returns
TypeDescription
System.StringThe 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
public static SitecoreLayoutRequest Path(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
System.StringvalueThe value to set.
Returns
TypeDescription
SitecoreLayoutRequestThe 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
public static string PreviewDate(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
Returns
TypeDescription
System.StringThe request.

PreviewDate(SitecoreLayoutRequest, String)

Gets the preview date of the request.

Declaration
public static SitecoreLayoutRequest PreviewDate(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
System.StringvalueThe value to set.
Returns
TypeDescription
SitecoreLayoutRequestThe preview date string value, otherwise null.

SiteName(SitecoreLayoutRequest)

Gets the site name of the request.

Declaration
public static string SiteName(this SitecoreLayoutRequest request)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
Returns
TypeDescription
System.StringThe 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
public static SitecoreLayoutRequest SiteName(this SitecoreLayoutRequest request, string value)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe SitecoreLayoutRequest.
System.StringvalueThe value to set.
Returns
TypeDescription
SitecoreLayoutRequestThe request.

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

Tries to get headers collection from layout request.

Declaration
public static bool TryGetHeadersCollection(this SitecoreLayoutRequest layoutRequest, out Dictionary<string, string[]> headers)
Parameters
TypeNameDescription
SitecoreLayoutRequestlayoutRequestLayout request instance.
System.Collections.Generic.Dictionary

<

System.String

,

System.String

[]>
headersHeaders.
Returns
TypeDescription
System.Booleanfalse 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
public static SitecoreLayoutRequest UpdateRequest(this SitecoreLayoutRequest request, Dictionary<string, object> requestDefaults)
Parameters
TypeNameDescription
SitecoreLayoutRequestrequestThe original request object.
System.Collections.Generic.Dictionary

<

System.String

,

System.Object

>
requestDefaultsThe default request object.
Returns
TypeDescription
SitecoreLayoutRequestThe updated request object.
If you have suggestions for improving this article, let us know!