1. Stylelabs.M.Sdk.WebClient.Http

Class TemplateExtensions

Contains extension method for handling url templates.

Inheritance

object

TemplateExtensions

Namespace: StylelabsStylelabs.MSdkWebClientHttp

Assembly: Stylelabs.M.Sdk.WebClient.dll

Syntax

public static class TemplateExtensions

Methods

Parses the link's template and applies the specified values to it.

Declaration

public static string Bind(this Link link, IDictionary<string, string> values)

Parameters

TypeNameDescription
LinklinkThe link to parse.
IDictionary<, >stringstringvaluesThe values of the templatized parameters.

Returns

TypeDescription
stringThe link's template with it's parameters replaced by the specified values.

Parses the link's template and applies the specified values to it.

Declaration

public static string Bind(this Link link, object values = null)

Parameters

TypeNameDescription
LinklinkThe link to parse.
objectvaluesThe values of the templatized parameters.

Returns

TypeDescription
stringThe link's template with it's parameters replaced by the specified values.

Extracts the value of the specified variable from the link based on a given template.

Declaration

public static string GetVariableValue(this Link link, Link template, string variable)

Parameters

TypeNameDescription
LinklinkThe link to extract the variable from.
LinktemplateThe template that defines the variables.
stringvariableThe name of the variable to extract.

Returns

TypeDescription
stringThe value of the variable or null if the variable could not be found.

Extracts the value of the specified variable from the uri based on a given template.

Declaration

public static string GetVariableValue(this Uri uri, Link template, string variable)

Parameters

TypeNameDescription
UriuriThe uri to extract the variable from.
LinktemplateThe template that defines the variables.
stringvariableThe name of the variable to extract.

Returns

TypeDescription
stringThe value of the variable or null if the variable could not be found.
If you have suggestions for improving this article, let us know!