Here are the examples of the csharp api System.Net.WebUtility.UrlEncode(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
538 Examples
19
View Source File : UriExtensions.cs
License : MIT License
Project Creator : 13xforever
License : MIT License
Project Creator : 13xforever
public static Uri AddQueryParameter(this Uri uri, string name, string value)
{
var queryValue = WebUtility.UrlEncode(name) + "=" + WebUtility.UrlEncode(value);
return AddQueryValue(uri, queryValue);
}
19
View Source File : WexApi.cs
License : MIT License
Project Creator : aabiryukov
License : MIT License
Project Creator : aabiryukov
private static string Query(string method, IEnumerable<WexPair> pairlist, Dictionary<string, string> args = null)
{
var pairliststr = MakePairListString(pairlist);
var sb = new StringBuilder();
sb.Append(WebApi.RootUrl + "/api/3/");
sb.Append(method);
sb.Append("/");
sb.Append(pairliststr);
if (args != null && args.Count > 0)
{
sb.Append("?");
var arr = args.Select(x => string.Format(CultureInfo.InvariantCulture, "{0}={1}", WebUtility.UrlEncode(x.Key), WebUtility.UrlEncode(x.Value))).ToArray();
sb.Append(string.Join("&", arr));
}
var queryStr = sb.ToString();
return WebApi.Query(queryStr);
}
19
View Source File : WexApi.cs
License : MIT License
Project Creator : aabiryukov
License : MIT License
Project Creator : aabiryukov
static string BuildPostData(NameValueDictionary d)
{
var s = new StringBuilder();
foreach (var key in d.Keys)
{
var value = d[key];
s.AppendFormat("{0}={1}", key, WebUtility.UrlEncode(value));
s.Append("&");
}
if (s.Length > 0) s.Remove(s.Length - 1, 1);
return s.ToString();
}
19
View Source File : UserApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<DeleteAccessLevelResponse> DeleteCollectionAccessLevelAsync(
string username,
string dbName,
string collectionName)
{
string uri = _userApiPath + "/" + WebUtility.UrlEncode(username)
+ "/database/" + WebUtility.UrlEncode(dbName) + "/" +
WebUtility.UrlEncode(collectionName);
using (var response = await _client.DeleteAsync(uri).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<DeleteAccessLevelResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : AqlFunctionApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<DeleteAqlFunctionResponse> DeleteAqlFunctionAsync(
string name,
DeleteAqlFunctionQuery query = null)
{
string uri = _apiPath + '/' + WebUtility.UrlEncode(name);
if (query != null)
{
uri += "?" + query.ToQueryString();
}
using (var response = await _transport.DeleteAsync(uri).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<DeleteAqlFunctionResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : CollectionApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<DeleteCollectionResponse> DeleteCollectionAsync(string collectionName)
{
using (var response = await _transport.DeleteAsync(_collectionApiPath + "/" + WebUtility.UrlEncode(collectionName)).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<DeleteCollectionResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : CollectionApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<TruncateCollectionResponse> TruncateCollectionAsync(string collectionName)
{
using (var response = await _transport.PutAsync(
_collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/truncate",
new byte[0]).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<TruncateCollectionResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : CollectionApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<GetCollectionCountResponse> GetCollectionCountAsync(string collectionName)
{
using (var response = await _transport.GetAsync(_collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/count").ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<GetCollectionCountResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
};
}
19
View Source File : CollectionApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public async Task<GetCollectionResponse> GetCollectionAsync(string collectionName)
{
using (var response = await _transport.GetAsync(_collectionApiPath + "/" + WebUtility.UrlEncode(collectionName)).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
var collection = DeserializeJsonFromStream<GetCollectionResponse>(stream);
return collection;
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : CollectionApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<GetCollectionPropertiesResponse> GetCollectionPropertiesAsync(string collectionName)
{
using (var response = await _transport.GetAsync(_collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/properties").ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<GetCollectionPropertiesResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : CollectionApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<RenameCollectionResponse> RenameCollectionAsync(string collectionName, RenameCollectionBody body)
{
var content = GetContent(body, new ApiClientSerializationOptions(true, false));
using (var response = await _transport.PutAsync(_collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/rename", content).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
var collection = DeserializeJsonFromStream<RenameCollectionResponse>(stream);
return collection;
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : CollectionApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<GetCollectionRevisionResponse> GetCollectionRevisionAsync(string collectionName)
{
using (var response = await _transport.GetAsync(_collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/revision").ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<GetCollectionRevisionResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : CollectionApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<GetCollectionFiguresResponse> GetCollectionFiguresAsync(string collectionName)
{
using (var response = await _transport.GetAsync(_collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/figures").ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<GetCollectionFiguresResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
};
}
19
View Source File : CursorApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<DeleteCursorResponse> DeleteCursorAsync(string cursorId)
{
using (var response = await _client.DeleteAsync(_cursorApiPath + "/" + WebUtility.UrlEncode(cursorId)).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<DeleteCursorResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : CursorApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<PutCursorResponse<T>> PutCursorAsync<T>(string cursorId)
{
string uri = _cursorApiPath + "/" + WebUtility.UrlEncode(cursorId);
using (var response = await _client.PutAsync(uri, new byte[0]).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<PutCursorResponse<T>>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : DatabaseApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<DeleteDatabaseResponse> DeleteDatabaseAsync(string databaseName)
{
using (var response = await _client.DeleteAsync(_databaseApiPath + "/" + WebUtility.UrlEncode(databaseName)).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<DeleteDatabaseResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : DocumentApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<PostDoreplacedentResponse<U>> PostDoreplacedentAsync<T, U>(
string collectionName,
T doreplacedent,
PostDoreplacedentsQuery query = null,
ApiClientSerializationOptions serializationOptions = null,
DoreplacedentHeaderProperties headers = null)
{
string uriString = _docApiPath + "/" + WebUtility.UrlEncode(collectionName);
if (query != null)
{
uriString += "?" + query.ToQueryString();
}
var content = GetContent(doreplacedent, serializationOptions);
var headerCollection = GetHeaderCollection(headers);
using (var response = await _client.PostAsync(uriString, content, headerCollection).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<PostDoreplacedentResponse<U>>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : DocumentApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<PostDoreplacedentsResponse<T>> PostDoreplacedentsAsync<T>(
string collectionName,
IList<T> doreplacedents,
PostDoreplacedentsQuery query = null,
ApiClientSerializationOptions serializationOptions = null,
DoreplacedentHeaderProperties headers = null)
{
string uriString = _docApiPath + "/" + WebUtility.UrlEncode(collectionName);
if (query != null)
{
uriString += "?" + query.ToQueryString();
}
var content = GetContent(doreplacedents, serializationOptions);
var headerCollection = GetHeaderCollection(headers);
using (var response = await _client.PostAsync(uriString, content, headerCollection).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
if (query != null && query.Silent.HasValue && query.Silent.Value)
{
return PostDoreplacedentsResponse<T>.Empty();
}
else
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<PostDoreplacedentsResponse<T>>(stream);
}
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : DocumentApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<PutDoreplacedentsResponse<T>> PutDoreplacedentsAsync<T>(
string collectionName,
IList<T> doreplacedents,
PutDoreplacedentsQuery query = null,
ApiClientSerializationOptions serializationOptions = null,
DoreplacedentHeaderProperties headers = null)
{
string uri = _docApiPath + "/" + WebUtility.UrlEncode(collectionName);
if (query != null)
{
uri += "?" + query.ToQueryString();
}
var content = GetContent(doreplacedents, serializationOptions);
var headerCollection = GetHeaderCollection(headers);
using (var response = await _client.PutAsync(uri, content, headerCollection).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
if (query != null && query.Silent.HasValue && query.Silent.Value)
{
return PutDoreplacedentsResponse<T>.Empty();
}
else
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<PutDoreplacedentsResponse<T>>(stream);
}
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : DocumentApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual Task<PutDoreplacedentResponse<T>> PutDoreplacedentAsync<T>(
string collectionName,
string doreplacedentKey,
T doc,
PutDoreplacedentQuery opts = null,
DoreplacedentHeaderProperties headers = null)
{
return PutDoreplacedentAsync<T>(
$"{WebUtility.UrlEncode(collectionName)}/{WebUtility.UrlEncode(doreplacedentKey)}",
doc,
opts,
headers: headers);
}
19
View Source File : DocumentApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<T> GetDoreplacedentAsync<T>(
string collectionName, string doreplacedentKey, DoreplacedentHeaderProperties headers = null)
{
return await GetDoreplacedentAsync<T>(
$"{WebUtility.UrlEncode(collectionName)}/{WebUtility.UrlEncode(doreplacedentKey)}", headers)
.ConfigureAwait(false);
}
19
View Source File : DocumentApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<List<T>> GetDoreplacedentsAsync<T>(
string collectionName,
IList<string> selectors,
DoreplacedentHeaderProperties headers = null)
{
string uri = $"{_docApiPath}/{WebUtility.UrlEncode(collectionName)}?onlyget=true";
var content = GetContent(selectors, new ApiClientSerializationOptions(false, true));
var headerCollection = GetHeaderCollection(headers);
using (var response = await _client.PutAsync(uri, content, headerCollection).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
var doreplacedents = DeserializeJsonFromStream<List<T>>(stream);
return doreplacedents;
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : DocumentApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<DeleteDoreplacedentResponse<object>> DeleteDoreplacedentAsync(
string collectionName,
string doreplacedentKey,
DeleteDoreplacedentQuery query = null,
DoreplacedentHeaderProperties headers = null)
{
return await DeleteDoreplacedentAsync<object>(
$"{WebUtility.UrlEncode(collectionName)}/{WebUtility.UrlEncode(doreplacedentKey)}",
query, headers).ConfigureAwait(false);
}
19
View Source File : DocumentApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<DeleteDoreplacedentResponse<T>> DeleteDoreplacedentAsync<T>(
string collectionName,
string doreplacedentKey,
DeleteDoreplacedentQuery query = null,
DoreplacedentHeaderProperties headers = null)
{
return await DeleteDoreplacedentAsync<T>(
$"{WebUtility.UrlEncode(collectionName)}/{WebUtility.UrlEncode(doreplacedentKey)}",
query, headers).ConfigureAwait(false);
}
19
View Source File : DocumentApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<DeleteDoreplacedentsResponse<T>> DeleteDoreplacedentsAsync<T>(
string collectionName,
IList<string> selectors,
DeleteDoreplacedentsQuery query = null,
DoreplacedentHeaderProperties headers = null)
{
string uri = _docApiPath + "/" + WebUtility.UrlEncode(collectionName);
if (query != null)
{
uri += "?" + query.ToQueryString();
}
var content = GetContent(selectors, new ApiClientSerializationOptions(false, false));
var headerCollection = GetHeaderCollection(headers);
using (var response = await _client.DeleteAsync(uri, content, headerCollection).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
if (query != null && query.Silent.HasValue && query.Silent.Value)
{
return DeleteDoreplacedentsResponse<T>.Empty();
}
else
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<DeleteDoreplacedentsResponse<T>>(stream);
}
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : DocumentApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<PatchDoreplacedentsResponse<U>> PatchDoreplacedentsAsync<T, U>(
string collectionName,
IList<T> patches,
PatchDoreplacedentsQuery query = null,
ApiClientSerializationOptions serializationOptions = null,
DoreplacedentHeaderProperties headers = null)
{
string uri = _docApiPath + "/" + WebUtility.UrlEncode(collectionName);
if (query != null)
{
uri += "?" + query.ToQueryString();
}
var content = GetContent(patches, serializationOptions);
var headerCollection = GetHeaderCollection(headers);
using (var response = await _client.PatchAsync(uri, content, headerCollection).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
if (query != null && query.Silent.HasValue && query.Silent.Value)
{
return PatchDoreplacedentsResponse<U>.Empty();
}
else
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<PatchDoreplacedentsResponse<U>>(stream);
}
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : DocumentApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<PatchDoreplacedentResponse<U>> PatchDoreplacedentAsync<T, U>(
string collectionName,
string doreplacedentKey,
T body,
PatchDoreplacedentQuery query = null,
DoreplacedentHeaderProperties headers = null)
{
string doreplacedentHandle = WebUtility.UrlEncode(collectionName) +
"/" + WebUtility.UrlEncode(doreplacedentKey);
return await PatchDoreplacedentAsync<T, U>(doreplacedentHandle, body, query, headers: headers).ConfigureAwait(false);
}
19
View Source File : DocumentApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<HeadDoreplacedentResponse> HeadDoreplacedentAsync(
string collectionName,
string doreplacedentKey,
DoreplacedentHeaderProperties headers = null)
{
return await HeadDoreplacedentAsync(
$"{WebUtility.UrlEncode(collectionName)}/{WebUtility.UrlEncode(doreplacedentKey)}",
headers).ConfigureAwait(false);
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<DeleteGraphResponse> DeleteGraphAsync(
string graphName,
DeleteGraphQuery query = null)
{
string uriString = _graphApiPath + "/" + WebUtility.UrlEncode(graphName);
if (query != null)
{
uriString += "?" + query.ToQueryString();
}
using (var response = await _transport.DeleteAsync(uriString).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<DeleteGraphResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<GetGraphResponse> GetGraphAsync(string graphName)
{
using (var response = await _transport.GetAsync(_graphApiPath + "/" + WebUtility.UrlEncode(graphName)).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<GetGraphResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<GetVertexCollectionsResponse> GetVertexCollectionsAsync(string graphName)
{
using (var response = await _transport.GetAsync(_graphApiPath + '/' + WebUtility.UrlEncode(graphName) + "/vertex").ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<GetVertexCollectionsResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<GetEdgeCollectionsResponse> GetEdgeCollectionsAsync(string graphName)
{
using (var response = await _transport.GetAsync(_graphApiPath + "/" + WebUtility.UrlEncode(graphName) + "/edge").ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<GetEdgeCollectionsResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<PostEdgeDefinitionResponse> PostEdgeDefinitionAsync(
string graphName,
PostEdgeDefinitionBody body)
{
var content = GetContent(body, new ApiClientSerializationOptions(true, true));
string uri = _graphApiPath + "/" + WebUtility.UrlEncode(graphName) + "/edge";
using (var response = await _transport.PostAsync(uri, content).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<PostEdgeDefinitionResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<PostVertexCollectionResponse> PostVertexCollectionAsync(
string graphName,
PostVertexCollectionBody body)
{
string uri = _graphApiPath + '/' + WebUtility.UrlEncode(graphName) + "/vertex";
var content = GetContent(body, new ApiClientSerializationOptions(true, true));
using (var response = await _transport.PostAsync(uri, content).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<PostVertexCollectionResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<PostVertexResponse<T>> PostVertexAsync<T>(
string graphName,
string collectionName,
T vertex,
PostVertexQuery query = null,
ApiClientSerializationOptions serializationOptions = null)
{
string uri = _graphApiPath + '/' + WebUtility.UrlEncode(graphName) +
"/vertex/" + WebUtility.UrlEncode(collectionName);
if (query != null)
{
uri += "?" + query.ToQueryString();
}
var content = GetContent(vertex, serializationOptions);
using (var response = await _transport.PostAsync(uri, content).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<PostVertexResponse<T>>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<DeleteEdgeDefinitionResponse> DeleteEdgeDefinitionAsync(
string graphName,
string collectionName,
DeleteEdgeDefinitionQuery query = null)
{
string uri = _graphApiPath + "/" + WebUtility.UrlEncode(graphName) +
"/edge/" + WebUtility.UrlEncode(collectionName);
if (query != null)
{
uri += "?" + query.ToQueryString();
}
using (var response = await _transport.DeleteAsync(uri).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<DeleteEdgeDefinitionResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<DeleteVertexCollectionResponse> DeleteVertexCollectionAsync(
string graphName,
string collectionName,
DeleteVertexCollectionQuery query = null)
{
string uri = _graphApiPath + "/" + WebUtility.UrlEncode(graphName) +
"/vertex/" + WebUtility.UrlEncode(collectionName);
if (query != null)
{
uri += "?" + query.ToQueryString();
}
using (var response = await _transport.DeleteAsync(uri).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<DeleteVertexCollectionResponse>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<PostEdgeResponse<T>> PostEdgeAsync<T>(
string graphName,
string collectionName,
T edge,
PostEdgeQuery query = null,
ApiClientSerializationOptions serializationOptions = null)
{
var content = GetContent(edge, serializationOptions);
string uri = _graphApiPath + "/" + WebUtility.UrlEncode(graphName) +
"/edge/" + WebUtility.UrlEncode(collectionName);
if (query != null)
{
uri += "?" + query.ToQueryString();
}
using (var response = await _transport.PostAsync(uri, content).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<PostEdgeResponse<T>>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual Task<GetEdgeResponse<T>> GetEdgeAsync<T>(
string graphName,
string collectionName,
string edgeKey,
GetEdgeQuery query = null)
{
return GetEdgeAsync<T>(
graphName,
WebUtility.UrlEncode(collectionName) + '/' + WebUtility.UrlEncode(edgeKey),
query);
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<GetEdgeResponse<T>> GetEdgeAsync<T>(
string graphName,
string edgeHandle,
GetEdgeQuery query = null)
{
string uri = _graphApiPath + "/" + WebUtility.UrlEncode(graphName) +
"/edge/" + edgeHandle;
if (query != null)
{
uri += "?" + query.ToQueryString();
}
using (var response = await _transport.GetAsync(uri).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<GetEdgeResponse<T>>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual Task<DeleteEdgeResponse<T>> DeleteEdgeAsync<T>(
string graphName,
string collectionName,
string edgeKey,
DeleteEdgeQuery query = null)
{
return DeleteEdgeAsync<T>(
graphName,
WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(edgeKey),
query);
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<DeleteEdgeResponse<T>> DeleteEdgeAsync<T>(
string graphName,
string doreplacedentId,
DeleteEdgeQuery query = null)
{
ValidateDoreplacedentId(doreplacedentId);
string uri = _graphApiPath + "/" + WebUtility.UrlEncode(graphName) +
"/edge/" + doreplacedentId;
if (query != null)
{
uri += "?" + query.ToQueryString();
}
using (var response = await _transport.DeleteAsync(uri).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<DeleteEdgeResponse<T>>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual Task<GetVertexResponse<T>> GetVertexAsync<T>(
string graphName,
string collectionName,
string vertexKey,
GetVertexQuery query = null)
{
return GetVertexAsync<T>(
graphName,
WebUtility.UrlEncode(collectionName) + "/" + vertexKey,
query);
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<GetVertexResponse<T>> GetVertexAsync<T>(
string graphName,
string doreplacedentId,
GetVertexQuery query = null)
{
ValidateDoreplacedentId(doreplacedentId);
string uri = _graphApiPath + '/' + WebUtility.UrlEncode(graphName) +
"/vertex/" + doreplacedentId;
if (query != null)
{
uri += "?" + query.ToQueryString();
}
using (var response = await _transport.GetAsync(uri).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<GetVertexResponse<T>>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual Task<DeleteVertexResponse<T>> DeleteVertexAsync<T>(
string graphName,
string collectionName,
string vertexKey,
DeleteVertexQuery query = null)
{
return DeleteVertexAsync<T>(
graphName,
WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(vertexKey),
query);
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<DeleteVertexResponse<T>> DeleteVertexAsync<T>(
string graphName,
string doreplacedentId,
DeleteVertexQuery query = null)
{
ValidateDoreplacedentId(doreplacedentId);
string uri = _graphApiPath + '/' + WebUtility.UrlEncode(graphName) +
"/vertex/" + doreplacedentId;
if (query != null)
{
uri += "?" + query.ToQueryString();
}
using (var response = await _transport.DeleteAsync(uri).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<DeleteVertexResponse<T>>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual Task<PatchVertexResponse<U>> PatchVertexAsync<T, U>(
string graphName,
string collectionName,
string vertexKey,
T body,
PatchVertexQuery query = null)
{
return PatchVertexAsync<T, U>(
graphName,
WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(vertexKey),
body,
query);
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<PatchVertexResponse<U>> PatchVertexAsync<T, U>(
string graphName,
string doreplacedentId,
T body,
PatchVertexQuery query = null)
{
ValidateDoreplacedentId(doreplacedentId);
string uri = _graphApiPath + '/' + WebUtility.UrlEncode(graphName) +
"/vertex/" + doreplacedentId;
if (query != null)
{
uri += "?" + query.ToQueryString();
}
var content = GetContent(body, new ApiClientSerializationOptions(false, false));
using (var response = await _transport.PatchAsync(uri, content).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<PatchVertexResponse<U>>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual Task<PutEdgeResponse<T>> PutEdgeAsync<T>(
string graphName,
string collectionName,
string edgeKey,
T edge,
PutEdgeQuery query = null)
{
return PutEdgeAsync<T>(
graphName,
WebUtility.UrlEncode(collectionName) + "/" + WebUtility.UrlEncode(edgeKey),
edge,
query);
}
19
View Source File : GraphApiClient.cs
License : Apache License 2.0
Project Creator : Actify-Inc
License : Apache License 2.0
Project Creator : Actify-Inc
public virtual async Task<PutEdgeResponse<T>> PutEdgeAsync<T>(
string graphName,
string doreplacedentId,
T edge,
PutEdgeQuery query = null)
{
ValidateDoreplacedentId(doreplacedentId);
string uri = _graphApiPath + "/" + WebUtility.UrlEncode(graphName) +
"/edge/" + doreplacedentId;
if (query != null)
{
uri += "?" + query.ToQueryString();
}
var content = GetContent(edge, new ApiClientSerializationOptions(false, false));
using (var response = await _transport.PutAsync(uri, content).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
var stream = await response.Content.ReadreplacedtreamAsync().ConfigureAwait(false);
return DeserializeJsonFromStream<PutEdgeResponse<T>>(stream);
}
throw await GetApiErrorException(response).ConfigureAwait(false);
}
}
See More Examples