Skip to main content

UrlExtensions

Donated by Ivan Korneliuk from his post: http://korneliuk.blogspot.com/2012/08/servicestack-reusing-dtos.html

Modified to only allow using routes matching the supplied HTTP Verb

Assembly: ServiceStack.Client.dll
View Source
Declaration
public static class UrlExtensions

Methods

ToRelativeUri(IReturn, String, String)

View Source
Declaration
public static string ToRelativeUri(this IReturn requestDto, string httpMethod, string formatFallbackToPredefinedRoute = null)
Returns

System.String

Parameters
TypeName
ServiceStack.IReturnrequestDto
System.StringhttpMethod
System.StringformatFallbackToPredefinedRoute

ToRelativeUri(Object, String, String)

View Source
Declaration
public static string ToRelativeUri(this object requestDto, string httpMethod, string formatFallbackToPredefinedRoute = null)
Returns

System.String

Parameters
TypeName
System.ObjectrequestDto
System.StringhttpMethod
System.StringformatFallbackToPredefinedRoute

ToUrl(IReturn, String, String)

Generate a url from a Request DTO. Pretty URL generation require Routes to be defined using [Route] on the Request DTO

View Source
Declaration
public static string ToUrl(this IReturn requestDto, string httpMethod, string formatFallbackToPredefinedRoute = null)
Returns

System.String

Parameters
TypeName
ServiceStack.IReturnrequestDto
System.StringhttpMethod
System.StringformatFallbackToPredefinedRoute

ToGetUrl(Object)

View Source
Declaration
public static string ToGetUrl(this object requestDto)
Returns

System.String

Parameters
TypeName
System.ObjectrequestDto

ToPostUrl(Object)

View Source
Declaration
public static string ToPostUrl(this object requestDto)
Returns

System.String

Parameters
TypeName
System.ObjectrequestDto

ToPutUrl(Object)

View Source
Declaration
public static string ToPutUrl(this object requestDto)
Returns

System.String

Parameters
TypeName
System.ObjectrequestDto

ToDeleteUrl(Object)

View Source
Declaration
public static string ToDeleteUrl(this object requestDto)
Returns

System.String

Parameters
TypeName
System.ObjectrequestDto

ToOneWayUrlOnly(Object, String)

View Source
Declaration
public static string ToOneWayUrlOnly(this object requestDto, string format = "json")
Returns

System.String

Parameters
TypeName
System.ObjectrequestDto
System.Stringformat

ToOneWayUrl(Object, String)

View Source
Declaration
public static string ToOneWayUrl(this object requestDto, string format = "json")
Returns

System.String

Parameters
TypeName
System.ObjectrequestDto
System.Stringformat

ToReplyUrlOnly(Object, String)

View Source
Declaration
public static string ToReplyUrlOnly(this object requestDto, string format = "json")
Returns

System.String

Parameters
TypeName
System.ObjectrequestDto
System.Stringformat

ToReplyUrl(Object, String)

View Source
Declaration
public static string ToReplyUrl(this object requestDto, string format = "json")
Returns

System.String

Parameters
TypeName
System.ObjectrequestDto
System.Stringformat

GetMetadataPropertyType(Type)

View Source
Declaration
public static string GetMetadataPropertyType(this Type type)
Returns

System.String

Parameters
TypeName
System.Typetype

GetOperationName(Type)

View Source
Declaration
public static string GetOperationName(this Type type)
Returns

System.String

Parameters
TypeName
System.Typetype

GetFullyQualifiedName(Type)

View Source
Declaration
public static string GetFullyQualifiedName(this Type type)
Returns

System.String

Parameters
TypeName
System.Typetype

ExpandTypeName(Type)

View Source
Declaration
public static string ExpandTypeName(this Type type)
Returns

System.String

Parameters
TypeName
System.Typetype

ExpandGenericTypeName(Type)

View Source
Declaration
public static string ExpandGenericTypeName(Type type)
Returns

System.String

Parameters
TypeName
System.Typetype

ToApiUrl(Type)

View Source
Declaration
public static string ToApiUrl(this Type requestType)
Returns

System.String

Parameters
TypeName
System.TyperequestType

ToUrl(Object, String, String)

View Source
Declaration
public static string ToUrl(this object requestDto, string httpMethod = "GET", string formatFallbackToPredefinedRoute = null)
Returns

System.String

Parameters
TypeName
System.ObjectrequestDto
System.StringhttpMethod
System.StringformatFallbackToPredefinedRoute

ToUrl(Object, String, Func<Type, String>)

View Source
Declaration
public static string ToUrl(this object requestDto, string httpMethod, Func<Type, string> fallback)
Returns

System.String

Parameters
TypeName
System.ObjectrequestDto
System.StringhttpMethod
System.Func<System.Type,System.String>fallback

AsHttps(String)

View Source
Declaration
public static string AsHttps(this string absoluteUrl)
Returns

System.String

Parameters
TypeName
System.StringabsoluteUrl

GetQueryPropertyTypes(Type)

View Source
Declaration
public static Dictionary<string, Type> GetQueryPropertyTypes(this Type requestType)
Returns

System.Collections.Generic.Dictionary<System.String,System.Type>

Parameters
TypeName
System.TyperequestType

AppendQueryParam(StringBuilder, String, Object)

View Source
Declaration
public static void AppendQueryParam(this StringBuilder sb, string key, object value)
Parameters
TypeName
System.Text.StringBuildersb
System.Stringkey
System.Objectvalue