-
Notifications
You must be signed in to change notification settings - Fork 820
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented GetDatabaseNames and GetDatabaseNamesAsync for non-Silver…
…light clients too
- Loading branch information
1 parent
beae05a
commit 44bf9d6
Showing
6 changed files
with
130 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Net; | ||
using Raven.Client.Connection.Async; | ||
using Raven.Client.Document; | ||
|
||
namespace Raven.Client.Connection | ||
{ | ||
public static class RavenUrlExtensions | ||
{ | ||
public static string Indexes(this string url, string index) | ||
{ | ||
return url + "/indexes/" + index; | ||
} | ||
|
||
public static string IndexDefinition(this string url, string index) | ||
{ | ||
return url + "/indexes/" + index + "?definition=yes"; | ||
} | ||
|
||
public static string IndexNames(this string url, int start, int pageSize) | ||
{ | ||
return url + "/indexes/?namesOnly=true&start=" + start + "&pageSize=" + pageSize; | ||
} | ||
|
||
public static string Stats(this string url) | ||
{ | ||
return url + "/stats"; | ||
} | ||
|
||
//public static string Static(this string url, string key) | ||
//{ | ||
// return url + "/static/" + HttpUtility.HtmlEncode(key); | ||
//} | ||
|
||
public static string Databases(this string url) | ||
{ | ||
return url + "/databases/"; | ||
} | ||
|
||
public static string SilverlightEnsuresStartup(this string url) | ||
{ | ||
return url + "/silverlight/ensureStartup"; | ||
} | ||
|
||
public static string Terms(this string url, string index, string field, string fromValue, int pageSize) | ||
{ | ||
return url + "/terms/" + index + "?field=" + field + "&fromValue=" + fromValue + "&pageSize=" + pageSize; | ||
} | ||
|
||
//public static string Docs(this string url, string key) | ||
//{ | ||
// return url + "/docs/" + HttpUtility.HtmlEncode(key); | ||
//} | ||
|
||
public static string Docs(this string url, int start, int pageSize) | ||
{ | ||
return url + "/docs/?start=" + start + "&pageSize=" + pageSize; | ||
} | ||
|
||
//public static string DocsStartingWith(this string url, string prefix, int start, int pageSize) | ||
//{ | ||
// return Docs(url, start, pageSize) + "&startsWith=" + HttpUtility.HtmlEncode(prefix); | ||
//} | ||
|
||
public static string Queries(this string url) | ||
{ | ||
return url + "/queries/"; | ||
} | ||
|
||
public static string NoCache(this string url) | ||
{ | ||
return (url.Contains("?")) | ||
? url + "&noCache=" + Guid.NewGuid().GetHashCode() | ||
: url + "?noCache=" + Guid.NewGuid().GetHashCode(); | ||
} | ||
|
||
public static Uri ToUri(this string url) | ||
{ | ||
return new Uri(url); | ||
} | ||
|
||
public static HttpJsonRequest ToJsonRequest(this string url, AsyncServerClient requestor, ICredentials credentials, Document.DocumentConvention convention) | ||
{ | ||
return requestor.jsonRequestFactory.CreateHttpJsonRequest(requestor, url, "GET", credentials, convention); | ||
} | ||
|
||
public static HttpJsonRequest ToJsonRequest(this string url, AsyncServerClient requestor, ICredentials credentials, DocumentConvention convention, IDictionary<string, string> operationsHeaders, string method) | ||
{ | ||
var httpJsonRequest = requestor.jsonRequestFactory.CreateHttpJsonRequest(requestor, url, method, credentials, convention); | ||
httpJsonRequest.AddOperationHeaders(operationsHeaders); | ||
return httpJsonRequest; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters