Sphyrnidae Common Library
2.0.1
Shared Utilities/Library
|
There is already a UriBuilder, so didn't want to reuse that name. This is a much nicer interface though for truly building out a URI More...
Public Member Functions | |
UrlBuilder () | |
Empty Constructor: You must specify all aspects of the URL More... | |
UrlBuilder (string uri) | |
Constructor: Allows you to modify the URL safely More... | |
UrlBuilder | AsHttp () |
Sets the url scheme to "http" More... | |
UrlBuilder | AsHttps () |
Sets the url scheme to "https" More... | |
UrlBuilder | WithScheme (string scheme) |
Sets the url scheme to whatever you pass in More... | |
UrlBuilder | WithHost (string host) |
Updates the "host" part of the url (eg. the main part) More... | |
UrlBuilder | WithPort (int port) |
Updates the "port" part of the url (eg. 80) More... | |
UrlBuilder | ClearPathSegments () |
If you wish to remove all path segments to build new ones (existing segments can be retrieved via public property) More... | |
UrlBuilder | RemoveFirstSegment () |
Removes the first path segment More... | |
UrlBuilder | RemoveLastSegment () |
Removes the last path segment More... | |
UrlBuilder | AddPathSegment (string segment) |
Adds a segment to the URL More... | |
UrlBuilder | AddPathSegmentToBeginning (string segment) |
Adds a segment to the beginning of the segment part of the URL More... | |
UrlBuilder | ClearQueryString () |
Removes all items from the query string More... | |
UrlBuilder | RemoveFromQueryString (string key) |
Removes an item from the query string. If key not found, this does nothing More... | |
UrlBuilder | AddQueryString (string key, string value) |
Adds a key and value combination to the query string (parameters are raw text, the actual URL will have these properly escaped) More... | |
UrlBuilder | WithFragment (string fragment) |
Sets the fragment for the url More... | |
string | Build () |
Must be called last More... | |
Properties | |
List< string > | Segments = new List<string>() [get] |
There is already a UriBuilder, so didn't want to reuse that name. This is a much nicer interface though for truly building out a URI
Sphyrnidae.Common.Paths.UrlBuilder.UrlBuilder | ( | ) |
Empty Constructor: You must specify all aspects of the URL
Sphyrnidae.Common.Paths.UrlBuilder.UrlBuilder | ( | string | uri | ) |
Constructor: Allows you to modify the URL safely
uri | The initial URL |
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.AddPathSegment | ( | string | segment | ) |
Adds a segment to the URL
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
segment | The segment to add |
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.AddPathSegmentToBeginning | ( | string | segment | ) |
Adds a segment to the beginning of the segment part of the URL
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
segment | The segment to add |
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.AddQueryString | ( | string | key, |
string | value | ||
) |
Adds a key and value combination to the query string (parameters are raw text, the actual URL will have these properly escaped)
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
key | The key (eg. key=value) |
value | The value (eg. key=value) |
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.AsHttp | ( | ) |
Sets the url scheme to "http"
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.AsHttps | ( | ) |
Sets the url scheme to "https"
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
string Sphyrnidae.Common.Paths.UrlBuilder.Build | ( | ) |
Must be called last
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.ClearPathSegments | ( | ) |
If you wish to remove all path segments to build new ones (existing segments can be retrieved via public property)
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.ClearQueryString | ( | ) |
Removes all items from the query string
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.RemoveFirstSegment | ( | ) |
Removes the first path segment
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.RemoveFromQueryString | ( | string | key | ) |
Removes an item from the query string. If key not found, this does nothing
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
key | The key (eg. key=value) |
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.RemoveLastSegment | ( | ) |
Removes the last path segment
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.WithFragment | ( | string | fragment | ) |
Sets the fragment for the url
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
fragment | The fragment to use |
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.WithHost | ( | string | host | ) |
Updates the "host" part of the url (eg. the main part)
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
host | The "host" part of the URL |
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.WithPort | ( | int | port | ) |
Updates the "port" part of the url (eg. 80)
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
port | The port for the host in the url |
UrlBuilder Sphyrnidae.Common.Paths.UrlBuilder.WithScheme | ( | string | scheme | ) |
Sets the url scheme to whatever you pass in
<scheme>://<host>:<port>/<path segment 1>/<path segment 2>?<query key 1>=<query value 1>&<query key 2>=<query value 2>#<fragment>
scheme | The url scheme |
|
get |