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
Type | Name |
---|---|
ServiceStack.IReturn | requestDto |
System.String | httpMethod |
System.String | formatFallbackToPredefinedRoute |
ToRelativeUri(Object, String, String)
View Source
Declaration
public static string ToRelativeUri(this object requestDto, string httpMethod, string formatFallbackToPredefinedRoute = null)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | requestDto |
System.String | httpMethod |
System.String | formatFallbackToPredefinedRoute |
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
Type | Name |
---|---|
ServiceStack.IReturn | requestDto |
System.String | httpMethod |
System.String | formatFallbackToPredefinedRoute |
ToGetUrl(Object)
View Source
Declaration
public static string ToGetUrl(this object requestDto)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | requestDto |
ToPostUrl(Object)
View Source
Declaration
public static string ToPostUrl(this object requestDto)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | requestDto |
ToPutUrl(Object)
View Source
Declaration
public static string ToPutUrl(this object requestDto)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | requestDto |
ToDeleteUrl(Object)
View Source
Declaration
public static string ToDeleteUrl(this object requestDto)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | requestDto |
ToOneWayUrlOnly(Object, String)
View Source
Declaration
public static string ToOneWayUrlOnly(this object requestDto, string format = "json")
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | requestDto |
System.String | format |
ToOneWayUrl(Object, String)
View Source
Declaration
public static string ToOneWayUrl(this object requestDto, string format = "json")
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | requestDto |
System.String | format |
ToReplyUrlOnly(Object, String)
View Source
Declaration
public static string ToReplyUrlOnly(this object requestDto, string format = "json")
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | requestDto |
System.String | format |
ToReplyUrl(Object, String)
View Source
Declaration
public static string ToReplyUrl(this object requestDto, string format = "json")
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | requestDto |
System.String | format |
GetMetadataPropertyType(Type)
View Source
Declaration
public static string GetMetadataPropertyType(this Type type)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Type | type |
GetOperationName(Type)
View Source
Declaration
public static string GetOperationName(this Type type)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Type | type |
GetFullyQualifiedName(Type)
View Source
Declaration
public static string GetFullyQualifiedName(this Type type)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Type | type |
ExpandTypeName(Type)
View Source
Declaration
public static string ExpandTypeName(this Type type)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Type | type |
ExpandGenericTypeName(Type)
View Source
Declaration
public static string ExpandGenericTypeName(Type type)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Type | type |
ToApiUrl(Type)
View Source
Declaration
public static string ToApiUrl(this Type requestType)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Type | requestType |
ToUrl(Object, String, String)
View Source
Declaration
public static string ToUrl(this object requestDto, string httpMethod = "GET", string formatFallbackToPredefinedRoute = null)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | requestDto |
System.String | httpMethod |
System.String | formatFallbackToPredefinedRoute |
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
Type | Name |
---|---|
System.Object | requestDto |
System.String | httpMethod |
System.Func<System.Type,System.String> | fallback |
AsHttps(String)
View Source
Declaration
public static string AsHttps(this string absoluteUrl)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | absoluteUrl |
GetQueryPropertyTypes(Type)
View Source
Declaration
public static Dictionary<string, Type> GetQueryPropertyTypes(this Type requestType)
Returns
System.Collections.Generic.Dictionary<System.String,System.Type>
Parameters
Type | Name |
---|---|
System.Type | requestType |
AppendQueryParam(StringBuilder, String, Object)
View Source
Declaration
public static void AppendQueryParam(this StringBuilder sb, string key, object value)
Parameters
Type | Name |
---|---|
System.Text.StringBuilder | sb |
System.String | key |
System.Object | value |