diff --git a/arangodb-net-standard.Test/ViewApi/ViewApiClientTest.cs b/arangodb-net-standard.Test/ViewApi/ViewApiClientTest.cs
index 31c74df3..a1f504b4 100644
--- a/arangodb-net-standard.Test/ViewApi/ViewApiClientTest.cs
+++ b/arangodb-net-standard.Test/ViewApi/ViewApiClientTest.cs
@@ -44,10 +44,10 @@ public async Task GetAllViewsAsync_ShouldSucceed()
});
var res = await _viewApi.GetAllViewsAsync();
- Assert.Equal(HttpStatusCode.OK, res.Code);
- Assert.False(res.Error);
- Assert.NotNull(res.Result);
- Assert.NotEmpty(res.Result);
+ Assert.Equal(HttpStatusCode.OK, res.Response.Code);
+ Assert.False(res.Response.Error);
+ Assert.NotNull(res.Response.Result);
+ Assert.NotEmpty(res.Response.Result);
}
[Fact]
diff --git a/arangodb-net-standard/AdminApi/AdminApiClient.cs b/arangodb-net-standard/AdminApi/AdminApiClient.cs
index 02e2e895..b56d9300 100644
--- a/arangodb-net-standard/AdminApi/AdminApiClient.cs
+++ b/arangodb-net-standard/AdminApi/AdminApiClient.cs
@@ -53,19 +53,20 @@ public AdminApiClient(IApiClientTransport client, IApiClientSerialization serial
///
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
/// Query string parameters
+ /// Headers for the request
///
///
/// For further information see
/// https://www.arangodb.com/docs/stable/http/administration-and-monitoring.html#read-global-logs-from-the-server
///
- public virtual async Task GetLogsAsync(GetLogsQuery query = null, CancellationToken token = default)
+ public virtual async Task GetLogsAsync(GetLogsQuery query = null, ApiHeaderProperties headers = null, CancellationToken token = default)
{
string uri = $"{_adminApiPath}/log/entries";
if (query != null)
{
uri += '?' + query.ToQueryString();
}
- using (var response = await _client.GetAsync(uri, null, token).ConfigureAwait(false))
+ using (var response = await _client.GetAsync(uri, headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -80,17 +81,18 @@ public virtual async Task GetLogsAsync(GetLogsQuery query = nul
/// Reloads the routing table.
/// POST /_admin/routing/reload
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/stable/http/administration-and-monitoring.html#reloads-the-routing-information
///
- public virtual async Task PostReloadRoutingInfoAsync(CancellationToken token = default)
+ public virtual async Task PostReloadRoutingInfoAsync(ApiHeaderProperties headers = null, CancellationToken token = default)
{
string uri = $"{_adminApiPath}/routing/reload";
var body = new byte[] { };
- using (var response = await _client.PostAsync(uri, body, null, token).ConfigureAwait(false))
+ using (var response = await _client.PostAsync(uri, body, headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -105,16 +107,17 @@ public virtual async Task PostReloadRoutingInfoAsync(CancellationToken tok
/// The method will fail if the server is not running in cluster mode.
/// GET /_admin/server/id
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/stable/http/administration-and-monitoring.html#return-id-of-a-server-in-a-cluster
///
- public virtual async Task GetServerIdAsync(CancellationToken token = default)
+ public virtual async Task GetServerIdAsync(ApiHeaderProperties headers = null, CancellationToken token = default)
{
string uri = $"{_adminApiPath}/server/id";
- using (var response = await _client.GetAsync(uri, null, token).ConfigureAwait(false))
+ using (var response = await _client.GetAsync(uri, headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -129,16 +132,17 @@ public virtual async Task GetServerIdAsync(CancellationToke
/// Retrieves the role of the server in a cluster.
/// GET /_admin/server/role
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/stable/http/administration-and-monitoring.html#return-the-role-of-a-server-in-a-cluster
///
- public virtual async Task GetServerRoleAsync(CancellationToken token = default)
+ public virtual async Task GetServerRoleAsync(ApiHeaderProperties headers = null, CancellationToken token = default)
{
string uri = $"{_adminApiPath}/server/role";
- using (var response = await _client.GetAsync(uri, null, token).ConfigureAwait(false))
+ using (var response = await _client.GetAsync(uri, headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -153,16 +157,17 @@ public virtual async Task GetServerRoleAsync(Cancellation
/// Retrieves the server database engine type.
/// GET /_api/engine
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/stable/http/miscellaneous-functions.html#return-server-database-engine-type
///
- public virtual async Task GetServerEngineTypeAsync(CancellationToken token = default)
+ public virtual async Task GetServerEngineTypeAsync(ApiHeaderProperties headers = null, CancellationToken token = default)
{
string uri = "_api/engine";
- using (var response = await _client.GetAsync(uri, null, token).ConfigureAwait(false))
+ using (var response = await _client.GetAsync(uri, headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -178,20 +183,21 @@ public virtual async Task GetServerEngineTypeAsync(
/// GET /_api/version
///
/// Query string parameters
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/stable/http/miscellaneous-functions.html#return-server-version
///
- public virtual async Task GetServerVersionAsync(GetServerVersionQuery query = null, CancellationToken token = default)
+ public virtual async Task GetServerVersionAsync(GetServerVersionQuery query = null, ApiHeaderProperties headers = null, CancellationToken token = default)
{
string uri = "_api/version";
if (query != null)
{
uri += '?' + query.ToQueryString();
}
- using (var response = await _client.GetAsync(uri,null,token).ConfigureAwait(false))
+ using (var response = await _client.GetAsync(uri, headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -206,16 +212,17 @@ public virtual async Task GetServerVersionAsync(GetSer
/// Retrieves the server license information.
/// GET /_admin/license
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/3.9/administration-license.html
///
- public virtual async Task GetLicenseAsync(CancellationToken token = default)
+ public virtual async Task GetLicenseAsync(ApiHeaderProperties headers = null, CancellationToken token = default)
{
string uri = $"{_adminApiPath}/license";
- using (var response = await _client.GetAsync(uri, token: token).ConfigureAwait(false))
+ using (var response = await _client.GetAsync(uri, headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -232,13 +239,14 @@ public virtual async Task GetLicenseAsync(CancellationToken
///
/// The new license key
/// Query string parameters
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/3.9/administration-license.html
///
- public virtual async Task PutLicenseAsync(string licenseKey, PutLicenseQuery query = null, CancellationToken token = default)
+ public virtual async Task PutLicenseAsync(string licenseKey, PutLicenseQuery query = null, ApiHeaderProperties headers = null, CancellationToken token = default)
{
string uri = $"{_adminApiPath}/license";
if (query != null)
@@ -246,7 +254,7 @@ public virtual async Task PutLicenseAsync(string licenseKey,
uri += '?' + query.ToQueryString();
}
var content = await GetContentAsync(licenseKey, new ApiClientSerializationOptions(true, true));
- using (var response = await _client.PutAsync(uri, content, token: token).ConfigureAwait(false))
+ using (var response = await _client.PutAsync(uri, content, headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
diff --git a/arangodb-net-standard/AdminApi/IAdminApiClient.cs b/arangodb-net-standard/AdminApi/IAdminApiClient.cs
index 184a31ec..d72616ca 100644
--- a/arangodb-net-standard/AdminApi/IAdminApiClient.cs
+++ b/arangodb-net-standard/AdminApi/IAdminApiClient.cs
@@ -16,87 +16,94 @@ public interface IAdminApiClient
/// Works on ArangoDB 3.8 or later.
///
/// Query string parameters
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/stable/http/administration-and-monitoring.html#read-global-logs-from-the-server
///
- Task GetLogsAsync(GetLogsQuery query = null, CancellationToken token = default);
+ Task GetLogsAsync(GetLogsQuery query = null, ApiHeaderProperties headers = null, CancellationToken token = default);
///
/// Reloads the routing table.
/// POST /_admin/routing/reload
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/stable/http/administration-and-monitoring.html#reloads-the-routing-information
///
- Task PostReloadRoutingInfoAsync(CancellationToken token = default);
+ Task PostReloadRoutingInfoAsync(ApiHeaderProperties headers = null, CancellationToken token = default);
///
/// Retrieves the internal id of the server.
/// The method will fail if the server is not running in cluster mode.
/// GET /_admin/server/id
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/stable/http/administration-and-monitoring.html#return-id-of-a-server-in-a-cluster
///
- Task GetServerIdAsync(CancellationToken token = default);
+ Task GetServerIdAsync(ApiHeaderProperties headers = null, CancellationToken token = default);
///
/// Retrieves the role of the server in a cluster.
/// GET /_admin/server/role
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/stable/http/administration-and-monitoring.html#return-the-role-of-a-server-in-a-cluster
///
- Task GetServerRoleAsync(CancellationToken token = default);
+ Task GetServerRoleAsync(ApiHeaderProperties headers = null, CancellationToken token = default);
///
/// Retrieves the server database engine type.
/// GET /_api/engine
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/stable/http/miscellaneous-functions.html#return-server-database-engine-type
///
- Task GetServerEngineTypeAsync(CancellationToken token = default);
+ Task GetServerEngineTypeAsync(ApiHeaderProperties headers = null, CancellationToken token = default);
///
/// Retrieves the server version.
/// GET /_api/version
///
/// Query string parameters
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/stable/http/miscellaneous-functions.html#return-server-version
///
- Task GetServerVersionAsync(GetServerVersionQuery query = null, CancellationToken token = default);
-
+ Task GetServerVersionAsync(GetServerVersionQuery query = null, ApiHeaderProperties headers = null, CancellationToken token = default);
+
///
/// Retrieves the server license information.
/// GET /_admin/license
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/3.9/administration-license.html
///
- Task GetLicenseAsync(CancellationToken token = default);
+ Task GetLicenseAsync(ApiHeaderProperties headers = null, CancellationToken token = default);
///
/// Sets a new license key.
@@ -104,12 +111,13 @@ public interface IAdminApiClient
///
/// The new license key
/// Query string parameters
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
///
/// For further information see
/// https://www.arangodb.com/docs/3.9/administration-license.html
///
- Task PutLicenseAsync(string licenseKey, PutLicenseQuery query = null, CancellationToken token = default);
+ Task PutLicenseAsync(string licenseKey, PutLicenseQuery query = null, ApiHeaderProperties headers = null, CancellationToken token = default);
}
}
\ No newline at end of file
diff --git a/arangodb-net-standard/AnalyzerApi/AnalyzerApiClient.cs b/arangodb-net-standard/AnalyzerApi/AnalyzerApiClient.cs
index ecb2558a..826f6a95 100644
--- a/arangodb-net-standard/AnalyzerApi/AnalyzerApiClient.cs
+++ b/arangodb-net-standard/AnalyzerApi/AnalyzerApiClient.cs
@@ -52,12 +52,13 @@ public AnalyzerApiClient(IApiClientTransport client, IApiClientSerialization ser
/// Fetch the list of available Analyzer definitions.
/// GET /_api/analyzer
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task GetAllAnalyzersAsync(CancellationToken token = default)
+ public virtual async Task GetAllAnalyzersAsync(ApiHeaderProperties headers = null, CancellationToken token = default)
{
string uri = _analyzerApiPath;
- using (var response = await _client.GetAsync(uri, null, token).ConfigureAwait(false))
+ using (var response = await _client.GetAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -73,9 +74,10 @@ public virtual async Task GetAllAnalyzersAsync(Cancella
/// POST /_api/analyzer
///
/// The properties of the new analyzer.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task PostAnalyzerAsync(Analyzer body, CancellationToken token = default)
+ public virtual async Task PostAnalyzerAsync(Analyzer body, ApiHeaderProperties headers = null, CancellationToken token = default)
{
if (body == null)
{
@@ -83,7 +85,7 @@ public virtual async Task PostAnalyzerAsync(Analyzer body, Cancellatio
}
var uri = _analyzerApiPath;
var content = await GetContentAsync(body, new ApiClientSerializationOptions(true, true)).ConfigureAwait(false);
- using (var response = await _client.PostAsync(uri, content, null, token).ConfigureAwait(false))
+ using (var response = await _client.PostAsync(uri, content, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -99,16 +101,17 @@ public virtual async Task PostAnalyzerAsync(Analyzer body, Cancellatio
/// GET /_api/analyzer/{analyzer-name}
///
/// The name of the analyzer
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task GetAnalyzerAsync(string analyzerName, CancellationToken token = default)
+ public virtual async Task GetAnalyzerAsync(string analyzerName, ApiHeaderProperties headers = null, CancellationToken token = default)
{
if (string.IsNullOrEmpty(analyzerName))
{
throw new ArgumentException("Analyzer name is required", nameof(analyzerName));
}
string uri = _analyzerApiPath + '/' + WebUtility.UrlEncode(analyzerName);
- using (var response = await _client.GetAsync(uri, null, token).ConfigureAwait(false))
+ using (var response = await _client.GetAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -124,16 +127,17 @@ public virtual async Task GetAnalyzerAsync(string analyzerN
/// DELETE /_api/analyzer/{analyzer-name}
///
/// The name of the analyzer
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task DeleteAnalyzerAsync(string analyzerName, CancellationToken token = default)
+ public virtual async Task DeleteAnalyzerAsync(string analyzerName, ApiHeaderProperties headers = null, CancellationToken token = default)
{
if (string.IsNullOrEmpty(analyzerName))
{
throw new ArgumentException("Analyzer name is required", nameof(analyzerName));
}
string uri = _analyzerApiPath + '/' + WebUtility.UrlEncode(analyzerName);
- using (var response = await _client.DeleteAsync(uri,null,token).ConfigureAwait(false))
+ using (var response = await _client.DeleteAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection() ,token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
diff --git a/arangodb-net-standard/AnalyzerApi/IAnalyzerApiClient.cs b/arangodb-net-standard/AnalyzerApi/IAnalyzerApiClient.cs
index c83bebab..d1314fcc 100644
--- a/arangodb-net-standard/AnalyzerApi/IAnalyzerApiClient.cs
+++ b/arangodb-net-standard/AnalyzerApi/IAnalyzerApiClient.cs
@@ -13,35 +13,39 @@ internal interface IAnalyzerApiClient
/// Fetch the list of available Analyzer definitions.
/// GET /_api/analyzer
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task GetAllAnalyzersAsync(CancellationToken token = default);
+ Task GetAllAnalyzersAsync(ApiHeaderProperties headers = null, CancellationToken token = default);
///
/// Creates a new Analyzer based on the provided definition
/// POST /_api/analyzer
///
/// The properties of the new analyzer.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task PostAnalyzerAsync(Analyzer body, CancellationToken token = default);
+ Task PostAnalyzerAsync(Analyzer body, ApiHeaderProperties headers = null, CancellationToken token = default);
///
/// Fetches the definition of the specified analyzer.
/// GET /_api/analyzer/{analyzer-name}
///
/// The name of the analyzer
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task GetAnalyzerAsync(string analyzerName, CancellationToken token = default);
+ Task GetAnalyzerAsync(string analyzerName, ApiHeaderProperties headers = null, CancellationToken token = default);
///
/// Deletes an Analyzer.
/// DELETE /_api/analyzer/{analyzer-name}
///
/// The name of the analyzer
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task DeleteAnalyzerAsync(string analyzerName, CancellationToken token = default);
+ Task DeleteAnalyzerAsync(string analyzerName, ApiHeaderProperties headers = null, CancellationToken token = default);
}
}
\ No newline at end of file
diff --git a/arangodb-net-standard/ApiClientBase.cs b/arangodb-net-standard/ApiClientBase.cs
index dba79340..dba4b0fe 100644
--- a/arangodb-net-standard/ApiClientBase.cs
+++ b/arangodb-net-standard/ApiClientBase.cs
@@ -1,7 +1,10 @@
using ArangoDBNetStandard.Serialization;
using ArangoDBNetStandard.Transport;
+using ArangoDBNetStandard.ViewApi.Models;
using System;
+using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Threading.Tasks;
namespace ArangoDBNetStandard
@@ -31,7 +34,22 @@ protected async Task GetApiErrorExceptionAsync(IApiClientResp
try
{
var error = await _serialization.DeserializeFromStreamAsync(stream).ConfigureAwait(false);
- return new ApiErrorException(error);
+ var ex = new ApiErrorException(error);
+ if (response.Headers != null)
+ {
+ ex.Headers = new Dictionary();
+ foreach (var rh in response.Headers)
+ {
+ var key = rh.Key;
+ var value = string.Empty;
+ if (rh.Value != null)
+ {
+ value = string.Join(",", rh.Value);
+ }
+ ex.Headers.Add(key, value);
+ }
+ }
+ return ex;
}
catch (Exception e)
{
@@ -90,5 +108,25 @@ protected async Task GetContentStringAsync(T item, ApiClientSerializa
}
}
+ protected async Task> GetResponseAsync(IApiClientResponse response)
+ {
+ var apiResponse = new ApiResponse() { Headers = new Dictionary() };
+ var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
+ apiResponse.Response = await DeserializeJsonFromStreamAsync(stream).ConfigureAwait(false);
+ if (response.Headers != null)
+ {
+ foreach (var rh in response.Headers)
+ {
+ var key = rh.Key;
+ var value = string.Empty;
+ if (rh.Value != null)
+ {
+ value = string.Join(",", rh.Value);
+ }
+ apiResponse.Headers.Add(key, value);
+ }
+ }
+ return apiResponse;
+ }
}
-}
+}
\ No newline at end of file
diff --git a/arangodb-net-standard/ApiErrorException.cs b/arangodb-net-standard/ApiErrorException.cs
index fbec5399..3b8ebd9a 100644
--- a/arangodb-net-standard/ApiErrorException.cs
+++ b/arangodb-net-standard/ApiErrorException.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Runtime.Serialization;
namespace ArangoDBNetStandard
@@ -11,6 +12,7 @@ public class ApiErrorException : Exception
/// in the response.
///
public ApiErrorResponse ApiError { get; set; }
+ public Dictionary Headers { get; set; }
public ApiErrorException()
{
diff --git a/arangodb-net-standard/ApiHeaderProperties.cs b/arangodb-net-standard/ApiHeaderProperties.cs
index 8c9a619e..46c0dbb0 100644
--- a/arangodb-net-standard/ApiHeaderProperties.cs
+++ b/arangodb-net-standard/ApiHeaderProperties.cs
@@ -18,6 +18,16 @@ public class ApiHeaderProperties
///
public bool? AllowReadFromFollowers { get; set; }
+ ///
+ /// Set max queue time limit.
+ /// When executing a request, specify a maximal
+ /// queue time in seconds before the request is
+ /// canceled and removed from the queue.
+ /// The value 0 is ignored by the server.
+ /// Introduced in ArangoDB 3.9
+ ///
+ public decimal? MaxQueueTimeLimit { get; set; }
+
///
/// Any other headers you wish to add based on
/// the specifications of the API operation.
@@ -37,6 +47,11 @@ public WebHeaderCollection ToWebHeaderCollection()
collection.Add(CustomHttpHeaders.ReadFromFollowersHeader, AllowReadFromFollowers.Value.ToString());
}
+ if (MaxQueueTimeLimit != null)
+ {
+ collection.Add(CustomHttpHeaders.MaxQueueTimeLimitHeader, MaxQueueTimeLimit.Value.ToString());
+ }
+
if (OtherHeaders != null && OtherHeaders.Count > 0)
{
foreach (string key in OtherHeaders.Keys)
diff --git a/arangodb-net-standard/ApiResponse.cs b/arangodb-net-standard/ApiResponse.cs
new file mode 100644
index 00000000..c60d222b
--- /dev/null
+++ b/arangodb-net-standard/ApiResponse.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ArangoDBNetStandard
+{
+ ///
+ /// Represents a generic response from ArangoDB server.
+ ///
+ ///
+ public class ApiResponse
+ {
+ ///
+ /// Header values returned by the server
+ ///
+ public Dictionary Headers { get; set; }
+
+ ///
+ /// The response object returned by the server
+ ///
+ public T Response { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/arangodb-net-standard/AqlFunctionApi/AqlFunctionApiClient.cs b/arangodb-net-standard/AqlFunctionApi/AqlFunctionApiClient.cs
index 66d8626e..9f9d497a 100644
--- a/arangodb-net-standard/AqlFunctionApi/AqlFunctionApiClient.cs
+++ b/arangodb-net-standard/AqlFunctionApi/AqlFunctionApiClient.cs
@@ -53,15 +53,16 @@ public AqlFunctionApiClient(IApiClientTransport transport, IApiClientSerializati
/// POST /_api/aqlfunction
///
/// The body of the request containing required properties.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PostAqlFunctionAsync(
- PostAqlFunctionBody body,
+ PostAqlFunctionBody body, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
var content = await GetContentAsync(body, new ApiClientSerializationOptions(true, true)).ConfigureAwait(false);
- using (var response = await _transport.PostAsync(_apiPath, content, token: token).ConfigureAwait(false))
+ using (var response = await _transport.PostAsync(_apiPath, content, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -78,11 +79,12 @@ public virtual async Task PostAqlFunctionAsync(
///
/// The name of the function or function group (namespace).
/// The query parameters of the request.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task DeleteAqlFunctionAsync(
string name,
- DeleteAqlFunctionQuery query = null,
+ DeleteAqlFunctionQuery query = null, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
string uri = _apiPath + '/' + WebUtility.UrlEncode(name);
@@ -92,7 +94,7 @@ public virtual async Task DeleteAqlFunctionAsync(
uri += "?" + query.ToQueryString();
}
- using (var response = await _transport.DeleteAsync(uri, token: token).ConfigureAwait(false))
+ using (var response = await _transport.DeleteAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -107,10 +109,11 @@ public virtual async Task DeleteAqlFunctionAsync(
/// Get all registered AQL user functions.
///
/// Query string options for the task.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task GetAqlFunctionsAsync(
- GetAqlFunctionsQuery query = null,
+ GetAqlFunctionsQuery query = null, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
string uri = _apiPath;
@@ -120,7 +123,7 @@ public virtual async Task GetAqlFunctionsAsync(
uri += "?" + query.ToQueryString();
}
- using (var response = await _transport.GetAsync(uri, token: token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -136,10 +139,11 @@ public virtual async Task GetAqlFunctionsAsync(
/// POST /_api/explain
///
/// The body of the request containing required properties.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PostExplainAqlQueryAsync(
- PostExplainAqlQueryBody body,
+ PostExplainAqlQueryBody body, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (body == null)
@@ -150,7 +154,7 @@ public virtual async Task PostExplainAqlQueryAsync(
string uri = "_api/explain";
var content = await GetContentAsync(body, new ApiClientSerializationOptions(true, true)).ConfigureAwait(false);
- using (var response = await _transport.PostAsync(uri, content, token: token).ConfigureAwait(false))
+ using (var response = await _transport.PostAsync(uri, content, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -166,10 +170,11 @@ public virtual async Task PostExplainAqlQueryAsync(
/// POST /_api/query
///
/// The body of the request containing required properties.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PostParseAqlQueryAsync(
- PostParseAqlQueryBody body,
+ PostParseAqlQueryBody body, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (body == null)
@@ -180,7 +185,7 @@ public virtual async Task PostParseAqlQueryAsync(
string uri = "_api/query";
var content = await GetContentAsync(body, new ApiClientSerializationOptions(true, true)).ConfigureAwait(false);
- using (var response = await _transport.PostAsync(uri, content, token: token).ConfigureAwait(false))
+ using (var response = await _transport.PostAsync(uri, content, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -202,6 +207,7 @@ public virtual async Task PostParseAqlQueryAsync(
/// the specified query in all databases, not just the
/// selected one.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// Kills a running query in the currently selected database.
@@ -212,7 +218,7 @@ public virtual async Task PostParseAqlQueryAsync(
///
public virtual async Task DeleteKillRunningAqlQueryAsync(
string queryId,
- DeleteKillRunningAqlQueryQuery query = null,
+ DeleteKillRunningAqlQueryQuery query = null, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (string.IsNullOrWhiteSpace(queryId))
@@ -227,7 +233,7 @@ public virtual async Task DeleteKillRunningAqlQueryAsync(
uri += "?" + query.ToQueryString();
}
- using (var response = await _transport.DeleteAsync(uri, token: token).ConfigureAwait(false))
+ using (var response = await _transport.DeleteAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -249,10 +255,11 @@ public virtual async Task DeleteKillRunningAqlQueryAsync(
/// Using the parameter is only allowed in the system database
/// and with superuser privileges.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task DeleteClearSlowAqlQueriesAsync(
- DeleteClearSlowAqlQueriesQuery query = null,
+ DeleteClearSlowAqlQueriesQuery query = null, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
string uri = "_api/query/slow";
@@ -262,7 +269,7 @@ public virtual async Task DeleteClearSlowAqlQueriesAsync(
uri += "?" + query.ToQueryString();
}
- using (var response = await _transport.DeleteAsync(uri, token: token).ConfigureAwait(false))
+ using (var response = await _transport.DeleteAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -284,6 +291,7 @@ public virtual async Task DeleteClearSlowAqlQueriesAsync(
/// Using the parameter is only allowed in the system database
/// and with superuser privileges.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// Returns an array containing the last AQL queries that are
@@ -295,7 +303,7 @@ public virtual async Task DeleteClearSlowAqlQueriesAsync(
///
///
public virtual async Task> GetSlowAqlQueriesAsync(
- GetSlowAqlQueriesQuery query = null,
+ GetSlowAqlQueriesQuery query = null, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
string uri = "_api/query/slow";
@@ -305,7 +313,7 @@ public virtual async Task> GetSlowAqlQueriesAsync(
uri += "?" + query.ToQueryString();
}
- using (var response = await _transport.GetAsync(uri, token: token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -322,14 +330,15 @@ public virtual async Task> GetSlowAqlQueriesAsync(
/// Clears the query results cache for the current database
/// DELETE /_api/query-cache
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task DeleteClearAqlQueryCacheAsync(
+ public virtual async Task DeleteClearAqlQueryCacheAsync(ApiHeaderProperties headers = null,
CancellationToken token = default)
{
string uri = "_api/query-cache";
- using (var response = await _transport.DeleteAsync(uri, token: token).ConfigureAwait(false))
+ using (var response = await _transport.DeleteAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -344,17 +353,18 @@ public virtual async Task DeleteClearAqlQueryCacheAsync(
/// Gets a list of the stored results in the AQL query results cache.
/// GET /_api/query-cache/entries
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// Returns an array containing the AQL query results currently
/// stored in the query results cache of the selected database.
///
///
- public virtual async Task> GetCachedAqlQueryResultsAsync(
+ public virtual async Task> GetCachedAqlQueryResultsAsync(ApiHeaderProperties headers = null,
CancellationToken token = default)
{
string uri = "_api/query-cache/entries";
- using (var response = await _transport.GetAsync(uri, token: token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -368,16 +378,17 @@ public virtual async Task> GetCachedAqlQueryResultsAs
///
/// Gets the global configuration for the AQL query results cache.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// Returns the global AQL query results cache configuration.
///
///
- public virtual async Task GetQueryCacheGlobalPropertiesAsync(
+ public virtual async Task GetQueryCacheGlobalPropertiesAsync(ApiHeaderProperties headers = null,
CancellationToken token = default)
{
string uri = "_api/query-cache/properties";
- using (var response = await _transport.GetAsync(uri, token: token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -393,6 +404,7 @@ public virtual async Task GetQueryCacheGlobalPropert
/// PUT /_api/query-cache/properties
///
/// The body of the request containing required properties.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// After the properties have been changed, the current set of properties
@@ -401,7 +413,7 @@ public virtual async Task GetQueryCacheGlobalPropert
///
///
public virtual async Task PutAdjustQueryCacheGlobalPropertiesAsync(
- PutAdjustQueryCacheGlobalPropertiesBody body,
+ PutAdjustQueryCacheGlobalPropertiesBody body, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (body == null)
@@ -412,7 +424,7 @@ public virtual async Task PutAdjustQueryCacheGlobalP
string uri = "_api/query-cache/properties";
var content = await GetContentAsync(body, new ApiClientSerializationOptions(true, true)).ConfigureAwait(false);
- using (var response = await _transport.PutAsync(uri, content, token: token).ConfigureAwait(false))
+ using (var response = await _transport.PutAsync(uri, content, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -427,13 +439,14 @@ public virtual async Task PutAdjustQueryCacheGlobalP
/// Gets the current query tracking configuration.
/// GET /_api/query/properties
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task GetQueryTrackingConfigurationAsync(
+ public virtual async Task GetQueryTrackingConfigurationAsync(ApiHeaderProperties headers = null,
CancellationToken token = default)
{
string uri = "_api/query/properties";
- using (var response = await _transport.GetAsync(uri, token: token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -453,10 +466,11 @@ public virtual async Task GetQueryTrackingConfigurat
/// the current set of properties will be returned.
///
/// The body of the request containing required configuration properties.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PutChangeQueryTrackingConfigurationAsync(
- PutChangeQueryTrackingConfigurationBody body,
+ PutChangeQueryTrackingConfigurationBody body, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (body == null)
@@ -467,7 +481,7 @@ public virtual async Task PutChangeQueryTrackingConf
string uri = "_api/query/properties";
var content = await GetContentAsync(body, new ApiClientSerializationOptions(true, true)).ConfigureAwait(false);
- using (var response = await _transport.PutAsync(uri, content, token: token).ConfigureAwait(false))
+ using (var response = await _transport.PutAsync(uri, content, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -482,13 +496,14 @@ public virtual async Task PutChangeQueryTrackingConf
/// Gets a list of currently running AQL queries.
///
/// Query string options for the task.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// Returns the global AQL query results cache configuration.
///
///
public virtual async Task> GetCurrentlyRunningAqlQueriesAsync(
- GetCurrentlyRunningAqlQueriesQuery query = null,
+ GetCurrentlyRunningAqlQueriesQuery query = null, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
string uri = "_api/query/current";
@@ -498,7 +513,7 @@ public virtual async Task> GetCurrentlyRunningAqlQueriesAs
uri += "?" + query.ToQueryString();
}
- using (var response = await _transport.GetAsync(uri, token: token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -513,17 +528,18 @@ public virtual async Task> GetCurrentlyRunningAqlQueriesAs
/// Gets the available optimizer rules for AQL queries
/// GET /_api/query/rules
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// Returns an array of objects that contain the name of each available
/// rule and its respective flags.
///
///
- public virtual async Task> GetQueryRulesAsync(CancellationToken token = default)
+ public virtual async Task> GetQueryRulesAsync(ApiHeaderProperties headers = null, CancellationToken token = default)
{
string uri = "_api/query/rules";
- using (var response = await _transport.GetAsync(uri, token: token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(uri, webHeaderCollection: headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
diff --git a/arangodb-net-standard/AqlFunctionApi/IAqlFunctionApiClient.cs b/arangodb-net-standard/AqlFunctionApi/IAqlFunctionApiClient.cs
index aa55b603..fdd6e5a5 100644
--- a/arangodb-net-standard/AqlFunctionApi/IAqlFunctionApiClient.cs
+++ b/arangodb-net-standard/AqlFunctionApi/IAqlFunctionApiClient.cs
@@ -16,9 +16,10 @@ public interface IAqlFunctionApiClient
/// POST /_api/aqlfunction
///
/// The body of the request containing required properties.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task PostAqlFunctionAsync(PostAqlFunctionBody body,
+ Task PostAqlFunctionAsync(PostAqlFunctionBody body, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -26,22 +27,25 @@ Task PostAqlFunctionAsync(PostAqlFunctionBody body,
/// DELETE /_api/aqlfunction/{name}
///
/// The name of the function or function group (namespace).
+ /// Headers for the request
/// The query parameters of the request.
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task DeleteAqlFunctionAsync(
string name,
- DeleteAqlFunctionQuery query = null,
+ DeleteAqlFunctionQuery query = null,
+ ApiHeaderProperties headers = null,
CancellationToken token = default);
///
/// Get all registered AQL user functions.
///
/// Query string options for the task.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task GetAqlFunctionsAsync(
- GetAqlFunctionsQuery query = null,
+ GetAqlFunctionsQuery query = null, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -49,10 +53,11 @@ Task GetAqlFunctionsAsync(
/// POST /_api/explain
///
/// The body of the request containing required properties.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task PostExplainAqlQueryAsync(
- PostExplainAqlQueryBody body,
+ PostExplainAqlQueryBody body, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -60,10 +65,11 @@ Task PostExplainAqlQueryAsync(
/// POST /_api/query
///
/// The body of the request containing required properties.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task PostParseAqlQueryAsync(
- PostParseAqlQueryBody body,
+ PostParseAqlQueryBody body, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -77,6 +83,7 @@ Task PostParseAqlQueryAsync(
/// the specified query in all databases, not just the
/// selected one.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// Kills a running query in the currently selected database.
@@ -87,7 +94,7 @@ Task PostParseAqlQueryAsync(
///
Task DeleteKillRunningAqlQueryAsync(
string queryId,
- DeleteKillRunningAqlQueryQuery query = null,
+ DeleteKillRunningAqlQueryQuery query = null, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -101,10 +108,11 @@ Task DeleteKillRunningAqlQueryAsync(
/// Using the parameter is only allowed in the system database
/// and with superuser privileges.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task DeleteClearSlowAqlQueriesAsync(
- DeleteClearSlowAqlQueriesQuery query = null,
+ DeleteClearSlowAqlQueriesQuery query = null, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -118,6 +126,7 @@ Task DeleteClearSlowAqlQueriesAsync(
/// Using the parameter is only allowed in the system database
/// and with superuser privileges.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// Returns an array containing the last AQL queries that are
@@ -129,40 +138,43 @@ Task DeleteClearSlowAqlQueriesAsync(
///
///
Task> GetSlowAqlQueriesAsync(
- GetSlowAqlQueriesQuery query = null,
+ GetSlowAqlQueriesQuery query = null, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
/// Clears the query results cache for the current database
/// DELETE /_api/query-cache
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task DeleteClearAqlQueryCacheAsync(
+ Task DeleteClearAqlQueryCacheAsync(ApiHeaderProperties headers = null,
CancellationToken token = default);
///
/// Gets a list of the stored results in the AQL query results cache.
/// GET /_api/query-cache/entries
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// Returns an array containing the AQL query results currently
/// stored in the query results cache of the selected database.
///
///
- Task> GetCachedAqlQueryResultsAsync(
+ Task> GetCachedAqlQueryResultsAsync(ApiHeaderProperties headers = null,
CancellationToken token = default);
///
/// Gets the global configuration for the AQL query results cache.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// Returns the global AQL query results cache configuration.
///
///
- Task GetQueryCacheGlobalPropertiesAsync(
+ Task GetQueryCacheGlobalPropertiesAsync(ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -170,6 +182,7 @@ Task GetQueryCacheGlobalPropertiesAsync(
/// PUT /_api/query-cache/properties
///
/// The body of the request containing required properties.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// After the properties have been changed, the current set of properties
@@ -178,7 +191,7 @@ Task GetQueryCacheGlobalPropertiesAsync(
///
///
Task PutAdjustQueryCacheGlobalPropertiesAsync(
- PutAdjustQueryCacheGlobalPropertiesBody body,
+ PutAdjustQueryCacheGlobalPropertiesBody body, ApiHeaderProperties headers = null,
CancellationToken token = default);
@@ -186,9 +199,10 @@ Task PutAdjustQueryCacheGlobalPropertiesAsync(
/// Gets the current query tracking configuration.
/// GET /_api/query/properties
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task GetQueryTrackingConfigurationAsync(
+ Task GetQueryTrackingConfigurationAsync(ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -196,6 +210,7 @@ Task GetQueryTrackingConfigurationAsync(
/// PUT /_api/query/properties
///
/// The body of the request containing required configuration properties.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// After the configuration properties have been changed,
@@ -203,7 +218,7 @@ Task GetQueryTrackingConfigurationAsync(
///
///
Task PutChangeQueryTrackingConfigurationAsync(
- PutChangeQueryTrackingConfigurationBody body,
+ PutChangeQueryTrackingConfigurationBody body, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -211,26 +226,28 @@ Task PutChangeQueryTrackingConfigurationAsync(
/// GET /_api/query/current
///
/// Query string options for the task.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// Returns the global AQL query results cache configuration.
///
///
Task> GetCurrentlyRunningAqlQueriesAsync(
- GetCurrentlyRunningAqlQueriesQuery query = null,
+ GetCurrentlyRunningAqlQueriesQuery query = null, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
/// Gets the available optimizer rules for AQL queries
/// GET /_api/query/rules
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// Returns an array of objects that contain the name of each available
/// rule and its respective flags.
///
///
- Task> GetQueryRulesAsync(
+ Task> GetQueryRulesAsync(ApiHeaderProperties headers = null,
CancellationToken token = default);
}
}
\ No newline at end of file
diff --git a/arangodb-net-standard/BulkOperationsApi/BulkOperationsApiClient.cs b/arangodb-net-standard/BulkOperationsApi/BulkOperationsApiClient.cs
index b4d9223a..85371672 100644
--- a/arangodb-net-standard/BulkOperationsApi/BulkOperationsApiClient.cs
+++ b/arangodb-net-standard/BulkOperationsApi/BulkOperationsApiClient.cs
@@ -55,11 +55,13 @@ public BulkOperationsApiClient(IApiClientTransport transport, IApiClientSerializ
///
/// Options for the import.
/// The body of the request containing required properties.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PostImportDocumentArraysAsync(
ImportDocumentsQuery query,
ImportDocumentArraysBody body,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (body == null)
@@ -90,7 +92,7 @@ public virtual async Task PostImportDocumentArraysAsync
{
sb.AppendLine(await GetContentStringAsync(valueArr, options).ConfigureAwait(false));
}
- return await PostImportDocumentArraysAsync(query, sb.ToString(),token)
+ return await PostImportDocumentArraysAsync(query, sb.ToString(),headers,token)
.ConfigureAwait(false);
}
@@ -100,11 +102,12 @@ public virtual async Task PostImportDocumentArraysAsync
///
/// Options for the import.
/// The body of the request containing required value arrays.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PostImportDocumentArraysAsync(
ImportDocumentsQuery query,
- string jsonBody,
+ string jsonBody, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (query == null)
@@ -125,7 +128,7 @@ public virtual async Task PostImportDocumentArraysAsync
string uriString = _bulkOperationsApiPath;
uriString += "?" + query.ToQueryString();
var content = Encoding.UTF8.GetBytes(jsonBody);
- using (var response = await _transport.PostAsync(uriString, content,null,token).ConfigureAwait(false))
+ using (var response = await _transport.PostAsync(uriString, content,webHeaderCollection: headers?.ToWebHeaderCollection(),token).ConfigureAwait(false))
{
var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
if (response.IsSuccessStatusCode)
@@ -142,11 +145,12 @@ public virtual async Task PostImportDocumentArraysAsync
///
/// Options for the import.
/// The body of the request containing required objects.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PostImportDocumentObjectsAsync(
ImportDocumentsQuery query,
- ImportDocumentObjectsBody body,
+ ImportDocumentObjectsBody body, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (query == null)
@@ -185,7 +189,7 @@ public virtual async Task PostImportDocumentObjectsAsyn
//body should be one array of JSON objects
sb.Append(await GetContentStringAsync(body.Documents, options).ConfigureAwait(false));
}
- return await PostImportDocumentObjectsAsync(query, sb.ToString(),token)
+ return await PostImportDocumentObjectsAsync(query, sb.ToString(),headers, token)
.ConfigureAwait(false);
}
@@ -197,11 +201,12 @@ public virtual async Task PostImportDocumentObjectsAsyn
///
/// Options for the import.
/// The body of the request containing the required JSON objects.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PostImportDocumentObjectsAsync(
ImportDocumentsQuery query,
- string jsonBody,
+ string jsonBody, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (query == null)
@@ -227,7 +232,7 @@ public virtual async Task PostImportDocumentObjectsAsyn
string uriString = _bulkOperationsApiPath;
uriString += "?" + query.ToQueryString();
var content = Encoding.UTF8.GetBytes(jsonBody);
- using (var response = await _transport.PostAsync(uriString, content,null,token).ConfigureAwait(false))
+ using (var response = await _transport.PostAsync(uriString, content, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
if (response.IsSuccessStatusCode)
diff --git a/arangodb-net-standard/BulkOperationsApi/IBulkOperationsApiClient.cs b/arangodb-net-standard/BulkOperationsApi/IBulkOperationsApiClient.cs
index 99e7a3b6..82b3d60a 100644
--- a/arangodb-net-standard/BulkOperationsApi/IBulkOperationsApiClient.cs
+++ b/arangodb-net-standard/BulkOperationsApi/IBulkOperationsApiClient.cs
@@ -16,11 +16,13 @@ public interface IBulkOperationsApiClient
///
/// Options for the import.
/// The body of the request containing required properties.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task PostImportDocumentArraysAsync(
ImportDocumentsQuery query,
ImportDocumentArraysBody body,
+ ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -31,11 +33,13 @@ Task PostImportDocumentArraysAsync(
///
/// Options for the import.
/// The body of the request containing required value arrays.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task PostImportDocumentArraysAsync(
ImportDocumentsQuery query,
- string jsonBody,
+ string jsonBody,
+ ApiHeaderProperties headers = null,
CancellationToken token = default);
@@ -45,11 +49,13 @@ Task PostImportDocumentArraysAsync(
///
/// Options for the import.
/// The body of the request containing required objects.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task PostImportDocumentObjectsAsync(
ImportDocumentsQuery query,
- ImportDocumentObjectsBody body,
+ ImportDocumentObjectsBody body,
+ ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -60,11 +66,13 @@ Task PostImportDocumentObjectsAsync(
///
/// Options for the import.
/// The body of the request containing the required JSON objects.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task PostImportDocumentObjectsAsync(
ImportDocumentsQuery query,
string jsonBody,
+ ApiHeaderProperties headers = null,
CancellationToken token = default);
}
}
diff --git a/arangodb-net-standard/CollectionApi/CollectionApiClient.cs b/arangodb-net-standard/CollectionApi/CollectionApiClient.cs
index e4b4a6cf..dd8acd26 100644
--- a/arangodb-net-standard/CollectionApi/CollectionApiClient.cs
+++ b/arangodb-net-standard/CollectionApi/CollectionApiClient.cs
@@ -53,11 +53,13 @@ public CollectionApiClient(IApiClientTransport transport, IApiClientSerializatio
///
/// Attributes of the new collection
/// Query string options for the task.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PostCollectionAsync(
PostCollectionBody body,
PostCollectionQuery options = null,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
string uriString = _collectionApiPath;
@@ -66,7 +68,7 @@ public virtual async Task PostCollectionAsync(
uriString += "?" + options.ToQueryString();
}
var content = await GetContentAsync(body, new ApiClientSerializationOptions(true, true)).ConfigureAwait(false);
- using (var response = await _transport.PostAsync(uriString, content, null, token).ConfigureAwait(false))
+ using (var response = await _transport.PostAsync(uriString, content, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
if (response.IsSuccessStatusCode)
@@ -81,14 +83,16 @@ public virtual async Task PostCollectionAsync(
/// Deletes a collection.
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task DeleteCollectionAsync(string collectionName,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
using (var response = await _transport.DeleteAsync(
- _collectionApiPath + "/" + WebUtility.UrlEncode(collectionName),
- null,
+ _collectionApiPath + "/" + WebUtility.UrlEncode(collectionName),
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
@@ -158,9 +162,11 @@ public virtual async Task GetCollectionCountAsync(st
/// GET/_api/collection
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task GetCollectionsAsync(GetCollectionsQuery query = null,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
string uriString = _collectionApiPath;
@@ -168,7 +174,7 @@ public virtual async Task GetCollectionsAsync(GetCollect
{
uriString += "?" + query.ToQueryString();
}
- using (var response = await _transport.GetAsync(uriString, null, token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(uriString, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -184,14 +190,16 @@ public virtual async Task GetCollectionsAsync(GetCollect
/// GET/_api/collection/{collection-name}
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public async Task GetCollectionAsync(string collectionName,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
using (var response = await _transport.GetAsync(
- _collectionApiPath + "/" + WebUtility.UrlEncode(collectionName),
- null,
+ _collectionApiPath + "/" + WebUtility.UrlEncode(collectionName),
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
@@ -209,14 +217,16 @@ public async Task GetCollectionAsync(string collectionNam
/// GET /_api/collection/{collection-name}/properties
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task GetCollectionPropertiesAsync(string collectionName,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
using (var response = await _transport.GetAsync(
_collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/properties",
- null,
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
@@ -234,16 +244,18 @@ public virtual async Task GetCollectionProperti
///
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task RenameCollectionAsync(string collectionName, RenameCollectionBody body,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
var content = await GetContentAsync(body, new ApiClientSerializationOptions(true, false)).ConfigureAwait(false);
using (var response = await _transport.PutAsync(
_collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/rename",
content,
- null,
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
@@ -261,14 +273,16 @@ public virtual async Task RenameCollectionAsync(string
/// GET /_api/collection/{collection-name}/revision
///
/// Name of the collection
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task GetCollectionRevisionAsync(string collectionName,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
using (var response = await _transport.GetAsync(
_collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/revision",
- null,
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
@@ -286,18 +300,20 @@ public virtual async Task GetCollectionRevisionAs
///
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PutCollectionPropertyAsync(
string collectionName,
PutCollectionPropertyBody body,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
var content = await GetContentAsync(body, new ApiClientSerializationOptions(true, true)).ConfigureAwait(false);
using (var response = await _transport.PutAsync(
_collectionApiPath + "/" + collectionName + "/properties",
content,
- null,
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
@@ -314,14 +330,16 @@ public virtual async Task PutCollectionPropertyAs
/// GET/_api/collection/{collection-name}/figures
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task GetCollectionFiguresAsync(string collectionName,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
using (var response = await _transport.GetAsync(
_collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/figures",
- null,
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
@@ -340,11 +358,13 @@ public virtual async Task GetCollectionFiguresAsyn
///
/// Name of the collection.
/// Query options.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task GetChecksumAsync(
string collectionName,
GetChecksumQuery query = null,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (string.IsNullOrWhiteSpace(collectionName))
@@ -356,7 +376,7 @@ public virtual async Task GetChecksumAsync(
{
uriString += "?" + query.ToQueryString();
}
- using (var response = await _transport.GetAsync(uriString, null, token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(uriString, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -376,9 +396,11 @@ public virtual async Task GetChecksumAsync(
/// PUT /_api/collection/{collection-name}/loadIndexesIntoMemory
///
/// Name of the collection.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PutLoadIndexesIntoMemoryAsync(string collectionName,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (string.IsNullOrWhiteSpace(collectionName))
@@ -386,7 +408,7 @@ public virtual async Task PutLoadIndexesIntoMe
throw new ArgumentException($"{nameof(collectionName)} is required", nameof(collectionName));
}
string uriString = _collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/loadIndexesIntoMemory";
- using (var response = await _transport.PutAsync(uriString, new byte[] { }, null, token).ConfigureAwait(false))
+ using (var response = await _transport.PutAsync(uriString, new byte[] { }, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -402,9 +424,11 @@ public virtual async Task PutLoadIndexesIntoMe
/// PUT /_api/collection/{collection-name}/recalculateCount
///
/// Name of the collection.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PutRecalculateCountAsync(string collectionName,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (string.IsNullOrWhiteSpace(collectionName))
@@ -412,7 +436,7 @@ public virtual async Task PutRecalculateCountAsync(
throw new ArgumentException($"{nameof(collectionName)} is required", nameof(collectionName));
}
string uriString = _collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/recalculateCount";
- using (var response = await _transport.PutAsync(uriString, new byte[] { },null,token).ConfigureAwait(false))
+ using (var response = await _transport.PutAsync(uriString, new byte[] { }, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -433,11 +457,13 @@ public virtual async Task PutRecalculateCountAsync(
/// pairs with at least the collection’s shard
/// key attributes set to some values.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PutDocumentShardAsync(
string collectionName,
Dictionary body,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (string.IsNullOrWhiteSpace(collectionName))
@@ -450,7 +476,7 @@ public virtual async Task PutDocumentShardAsync(
}
string uriString = _collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/responsibleShard";
var content = await GetContentAsync(body, new ApiClientSerializationOptions(true, true)).ConfigureAwait(false);
- using (var response = await _transport.PutAsync(uriString, content, null, token).ConfigureAwait(false))
+ using (var response = await _transport.PutAsync(uriString, content, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -467,9 +493,11 @@ public virtual async Task PutDocumentShardAsync(
/// GET /_api/collection/{collection-name}/shards
///
/// Name of the collection.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task GetCollectionShardsAsync(string collectionName,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (string.IsNullOrWhiteSpace(collectionName))
@@ -477,7 +505,7 @@ public virtual async Task GetCollectionShardsAsync(
throw new ArgumentException($"{nameof(collectionName)} is required", nameof(collectionName));
}
string uriString = _collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/shards";
- using (var response = await _transport.GetAsync(uriString, null, token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(uriString, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -497,9 +525,11 @@ public virtual async Task GetCollectionShardsAsync(
/// GET /_api/collection/{collection-name}/shards?details=true
///
/// Name of the collection.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task GetCollectionShardsWithDetailsAsync(string collectionName,
+ ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (string.IsNullOrWhiteSpace(collectionName))
@@ -507,7 +537,7 @@ public virtual async Task GetCollectionShar
throw new ArgumentException($"{nameof(collectionName)} is required", nameof(collectionName));
}
string uriString = _collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/shards?details=true";
- using (var response = await _transport.GetAsync(uriString, null, token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(uriString, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -525,9 +555,10 @@ public virtual async Task GetCollectionShar
/// PUT /_api/collection/{collection-name}/compact
///
/// Name of the collection.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task PutCompactCollectionDataAsync(string collectionName,
+ public virtual async Task PutCompactCollectionDataAsync(string collectionName, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
if (string.IsNullOrWhiteSpace(collectionName))
@@ -535,7 +566,7 @@ public virtual async Task PutCompactCollection
throw new ArgumentException($"{nameof(collectionName)} is required", nameof(collectionName));
}
string uriString = _collectionApiPath + "/" + WebUtility.UrlEncode(collectionName) + "/compact";
- using (var response = await _transport.PutAsync(uriString, new byte[] { },null,token).ConfigureAwait(false))
+ using (var response = await _transport.PutAsync(uriString, new byte[] { }, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
diff --git a/arangodb-net-standard/CollectionApi/ICollectionApiClient.cs b/arangodb-net-standard/CollectionApi/ICollectionApiClient.cs
index 14b010cc..542a696a 100644
--- a/arangodb-net-standard/CollectionApi/ICollectionApiClient.cs
+++ b/arangodb-net-standard/CollectionApi/ICollectionApiClient.cs
@@ -16,20 +16,22 @@ public interface ICollectionApiClient
///
/// Attributes of the new collection
/// Query string options for the task.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task PostCollectionAsync(
PostCollectionBody body,
- PostCollectionQuery options = null,
+ PostCollectionQuery options = null, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
/// Deletes a collection.
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task DeleteCollectionAsync(string collectionName,
+ Task DeleteCollectionAsync(string collectionName, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -61,9 +63,10 @@ Task GetCollectionCountAsync(string collectionName,
/// GET/_api/collection
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task GetCollectionsAsync(GetCollectionsQuery query = null,
+ Task GetCollectionsAsync(GetCollectionsQuery query = null, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -71,9 +74,10 @@ Task GetCollectionsAsync(GetCollectionsQuery query = nul
/// GET/_api/collection/{collection-name}
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task GetCollectionAsync(string collectionName,
+ Task GetCollectionAsync(string collectionName, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -81,9 +85,10 @@ Task GetCollectionAsync(string collectionName,
/// GET /_api/collection/{collection-name}/properties
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task GetCollectionPropertiesAsync(string collectionName,
+ Task GetCollectionPropertiesAsync(string collectionName, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -92,11 +97,12 @@ Task GetCollectionPropertiesAsync(string collec
///
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task RenameCollectionAsync(
string collectionName,
- RenameCollectionBody body,
+ RenameCollectionBody body, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -104,9 +110,10 @@ Task RenameCollectionAsync(
/// GET /_api/collection/{collection-name}/revision
///
/// Name of the collection
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task GetCollectionRevisionAsync(string collectionName,
+ Task GetCollectionRevisionAsync(string collectionName, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -115,11 +122,12 @@ Task GetCollectionRevisionAsync(string collection
///
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task PutCollectionPropertyAsync(
string collectionName,
- PutCollectionPropertyBody body,
+ PutCollectionPropertyBody body, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -127,9 +135,10 @@ Task PutCollectionPropertyAsync(
/// GET/_api/collection/{collection-name}/figures
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task GetCollectionFiguresAsync(string collectionName,
+ Task GetCollectionFiguresAsync(string collectionName, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -138,10 +147,11 @@ Task GetCollectionFiguresAsync(string collectionNa
///
/// Name of the collection.
/// Query options.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task GetChecksumAsync(string collectionName,
- GetChecksumQuery query = null,
+ GetChecksumQuery query = null, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -153,10 +163,11 @@ Task GetChecksumAsync(string collectionName,
/// PUT /_api/collection/{collection-name}/loadIndexesIntoMemory
///
/// Name of the collection.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task PutLoadIndexesIntoMemoryAsync(
- string collectionName,
+ string collectionName, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -164,10 +175,11 @@ Task PutLoadIndexesIntoMemoryAsync(
/// PUT /_api/collection/{collection-name}/recalculateCount
///
/// Name of the collection.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task PutRecalculateCountAsync(
- string collectionName,
+ string collectionName, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -180,11 +192,12 @@ Task PutRecalculateCountAsync(
/// pairs with at least the collection’s shard
/// key attributes set to some values.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task PutDocumentShardAsync(
string collectionName,
- Dictionary body,
+ Dictionary body, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -193,10 +206,11 @@ Task PutDocumentShardAsync(
/// GET /_api/collection/{collection-name}/shards
///
/// Name of the collection.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task GetCollectionShardsAsync(
- string collectionName,
+ string collectionName, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -208,10 +222,11 @@ Task GetCollectionShardsAsync(
/// GET /_api/collection/{collection-name}/shards?details=true
///
/// Name of the collection.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task GetCollectionShardsWithDetailsAsync(
- string collectionName,
+ string collectionName, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -221,10 +236,11 @@ Task GetCollectionShardsWithDetailsAsync(
/// PUT /_api/collection/{collection-name}/compact
///
/// Name of the collection.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task PutCompactCollectionDataAsync(
- string collectionName,
+ string collectionName, ApiHeaderProperties headers = null,
CancellationToken token = default);
}
}
\ No newline at end of file
diff --git a/arangodb-net-standard/CursorApi/CursorApiClient.cs b/arangodb-net-standard/CursorApi/CursorApiClient.cs
index 60191545..658e6d06 100644
--- a/arangodb-net-standard/CursorApi/CursorApiClient.cs
+++ b/arangodb-net-standard/CursorApi/CursorApiClient.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
@@ -69,7 +70,7 @@ protected virtual WebHeaderCollection GetHeaderCollection(CursorHeaderProperties
///
///
///
- /// Optional. The stream transaction Id.
+ /// Optional. The stream transaction Id.
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task> PostCursorAsync(
@@ -143,14 +144,15 @@ public virtual async Task> PostCursorAsync(
/// DELETE /_api/cursor/{cursor-identifier}
///
/// The id of the cursor to delete.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task DeleteCursorAsync(string cursorId,
+ public virtual async Task DeleteCursorAsync(string cursorId, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
using (var response = await _client.DeleteAsync(
_cursorApiPath + "/" + WebUtility.UrlEncode(cursorId),
- null,
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
@@ -168,14 +170,15 @@ public virtual async Task DeleteCursorAsync(string cursorI
///
/// Result type to deserialize to
/// ID of the existing query cursor.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
[Obsolete("Use PostAdvanceCursorAsync.")]
- public virtual async Task> PutCursorAsync(string cursorId,
+ public virtual async Task> PutCursorAsync(string cursorId, ApiHeaderProperties headers = null,
CancellationToken token = default)
{
string uri = _cursorApiPath + "/" + WebUtility.UrlEncode(cursorId);
- using (var response = await _client.PutAsync(uri, new byte[0], null, token).ConfigureAwait(false))
+ using (var response = await _client.PutAsync(uri, new byte[0], webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -189,16 +192,18 @@ public virtual async Task> PutCursorAsync(string cursorI
///
/// Advances an existing query cursor and gets the next set of results.
- /// Replaces
+ /// Replaces
///
/// The name / identifier of the existing cursor.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task> PostAdvanceCursorAsync(string cursorIdentifier, CancellationToken token = default)
+ public virtual async Task> PostAdvanceCursorAsync(string cursorIdentifier, ApiHeaderProperties headers = null, CancellationToken token = default)
{
using (var response = await _client.PostAsync(
requestUri: _cursorApiPath + $"/{WebUtility.UrlEncode(cursorIdentifier)}",
content: new byte[] { },
+ webHeaderCollection:headers?.ToWebHeaderCollection(),
token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
diff --git a/arangodb-net-standard/CursorApi/ICursorApiClient.cs b/arangodb-net-standard/CursorApi/ICursorApiClient.cs
index 135479f0..9fc6aff4 100644
--- a/arangodb-net-standard/CursorApi/ICursorApiClient.cs
+++ b/arangodb-net-standard/CursorApi/ICursorApiClient.cs
@@ -22,7 +22,7 @@ public interface ICursorApiClient
///
///
///
- /// Optional. The stream transaction Id.
+ /// Optional. The stream transaction Id.
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task> PostCursorAsync(
@@ -55,13 +55,14 @@ Task> PostCursorAsync(
///
/// Advances an existing query cursor and gets the next set of results.
- /// Replaces
+ /// Replaces
///
/// The name / identifier of the existing cursor.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
Task> PostAdvanceCursorAsync(
- string cursorIdentifier,
+ string cursorIdentifier, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -69,9 +70,10 @@ Task> PostAdvanceCursorAsync(
/// DELETE /_api/cursor/{cursor-identifier}
///
/// The id of the cursor to delete.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task DeleteCursorAsync(string cursorId,
+ Task DeleteCursorAsync(string cursorId, ApiHeaderProperties headers = null,
CancellationToken token = default);
///
@@ -79,9 +81,10 @@ Task DeleteCursorAsync(string cursorId,
///
/// Result type to deserialize to
/// ID of the existing query cursor.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task> PutCursorAsync(string cursorId,
+ Task> PutCursorAsync(string cursorId, ApiHeaderProperties headers = null,
CancellationToken token = default);
}
}
diff --git a/arangodb-net-standard/CustomHttpHeaders.cs b/arangodb-net-standard/CustomHttpHeaders.cs
index ada9b7f1..e138398c 100644
--- a/arangodb-net-standard/CustomHttpHeaders.cs
+++ b/arangodb-net-standard/CustomHttpHeaders.cs
@@ -18,5 +18,9 @@ public static class CustomHttpHeaders
/// The header string used for Driver Info Header
///
public const string DriverInfoHeader = "x-arango-driver";
+ ///
+ /// The header string used for
+ ///
+ public const string MaxQueueTimeLimitHeader = "x-arango-max-queue-time-seconds";
}
}
diff --git a/arangodb-net-standard/DatabaseApi/DatabaseApiClient.cs b/arangodb-net-standard/DatabaseApi/DatabaseApiClient.cs
index c749c665..97acea11 100644
--- a/arangodb-net-standard/DatabaseApi/DatabaseApiClient.cs
+++ b/arangodb-net-standard/DatabaseApi/DatabaseApiClient.cs
@@ -51,12 +51,13 @@ public DatabaseApiClient(IApiClientTransport client, IApiClientSerialization ser
/// (Only possible from within the _system database)
///
/// The parameters required by this endpoint.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task PostDatabaseAsync(PostDatabaseBody request, CancellationToken token = default)
+ public virtual async Task PostDatabaseAsync(PostDatabaseBody request, ApiHeaderProperties headers = null, CancellationToken token = default)
{
var content = await GetContentAsync(request, new ApiClientSerializationOptions(true, true)).ConfigureAwait(false);
- using (var response = await _client.PostAsync(_databaseApiPath, content, null, token).ConfigureAwait(false))
+ using (var response = await _client.PostAsync(_databaseApiPath, content, webHeaderCollection: headers?.ToWebHeaderCollection(), token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -73,11 +74,15 @@ public virtual async Task PostDatabaseAsync(PostDatabaseBo
/// DELETE /_api/database/{database-name}
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task DeleteDatabaseAsync(string databaseName, CancellationToken token = default)
+ public virtual async Task DeleteDatabaseAsync(string databaseName, ApiHeaderProperties headers = null, CancellationToken token = default)
{
- using (var response = await _client.DeleteAsync(_databaseApiPath + "/" + WebUtility.UrlEncode(databaseName), null, token).ConfigureAwait(false))
+ using (var response = await _client.DeleteAsync(
+ _databaseApiPath + "/" + WebUtility.UrlEncode(databaseName),
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
+ token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -92,15 +97,19 @@ public virtual async Task DeleteDatabaseAsync(string dat
/// Retrieves the list of all existing databases.
/// (Only possible from within the _system database)
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// You should use to fetch the list of the databases
/// available for the current user.
///
///
- public virtual async Task GetDatabasesAsync(CancellationToken token = default)
+ public virtual async Task GetDatabasesAsync(ApiHeaderProperties headers = null, CancellationToken token = default)
{
- using (var response = await _client.GetAsync(_databaseApiPath, null, token).ConfigureAwait(false))
+ using (var response = await _client.GetAsync(
+ _databaseApiPath,
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
+ token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -114,11 +123,15 @@ public virtual async Task GetDatabasesAsync(CancellationTo
///
/// Retrieves the list of all databases the current user can access.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task GetUserDatabasesAsync(CancellationToken token = default)
+ public virtual async Task GetUserDatabasesAsync(ApiHeaderProperties headers = null, CancellationToken token = default)
{
- using (var response = await _client.GetAsync(_databaseApiPath + "/user", null, token).ConfigureAwait(false))
+ using (var response = await _client.GetAsync(
+ _databaseApiPath + "/user",
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
+ token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -132,11 +145,15 @@ public virtual async Task GetUserDatabasesAsync(Cancellati
///
/// Retrieves information about the current database.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task GetCurrentDatabaseInfoAsync(CancellationToken token = default)
+ public virtual async Task GetCurrentDatabaseInfoAsync(ApiHeaderProperties headers = null, CancellationToken token = default)
{
- using (var response = await _client.GetAsync(_databaseApiPath + "/current",null,token).ConfigureAwait(false))
+ using (var response = await _client.GetAsync(
+ _databaseApiPath + "/current",
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
+ token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
diff --git a/arangodb-net-standard/DatabaseApi/IDatabaseApiClient.cs b/arangodb-net-standard/DatabaseApi/IDatabaseApiClient.cs
index dadf666e..ef536df3 100644
--- a/arangodb-net-standard/DatabaseApi/IDatabaseApiClient.cs
+++ b/arangodb-net-standard/DatabaseApi/IDatabaseApiClient.cs
@@ -14,9 +14,10 @@ public interface IDatabaseApiClient
/// (Only possible from within the _system database)
///
/// The parameters required by this endpoint.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task PostDatabaseAsync(PostDatabaseBody request, CancellationToken token = default);
+ Task PostDatabaseAsync(PostDatabaseBody request, ApiHeaderProperties headers = null, CancellationToken token = default);
///
/// Delete a database. Dropping a database is only possible from within the _system database.
@@ -24,34 +25,38 @@ public interface IDatabaseApiClient
/// DELETE /_api/database/{database-name}
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task DeleteDatabaseAsync(string databaseName, CancellationToken token = default);
+ Task DeleteDatabaseAsync(string databaseName, ApiHeaderProperties headers = null, CancellationToken token = default);
///
/// Retrieves the list of all existing databases.
/// (Only possible from within the _system database)
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// You should use to fetch the list of the databases
/// available for the current user.
///
///
- Task GetDatabasesAsync(CancellationToken token = default);
+ Task GetDatabasesAsync(ApiHeaderProperties headers = null, CancellationToken token = default);
///
/// Retrieves the list of all databases the current user can access.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task GetUserDatabasesAsync(CancellationToken token = default);
+ Task GetUserDatabasesAsync(ApiHeaderProperties headers = null, CancellationToken token = default);
///
/// Retrieves information about the current database.
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- Task GetCurrentDatabaseInfoAsync(CancellationToken token = default);
+ Task GetCurrentDatabaseInfoAsync(ApiHeaderProperties headers = null, CancellationToken token = default);
}
}
diff --git a/arangodb-net-standard/DocumentApi/Models/DocumentHeaderProperties.cs b/arangodb-net-standard/DocumentApi/Models/DocumentHeaderProperties.cs
index e295608c..04c25ba2 100644
--- a/arangodb-net-standard/DocumentApi/Models/DocumentHeaderProperties.cs
+++ b/arangodb-net-standard/DocumentApi/Models/DocumentHeaderProperties.cs
@@ -2,7 +2,7 @@
namespace ArangoDBNetStandard.DocumentApi.Models
{
- public class DocumentHeaderProperties:ApiHeaderProperties
+ public class DocumentHeaderProperties: ApiHeaderProperties
{
public string IfMatch { get; set; }
diff --git a/arangodb-net-standard/GraphApi/GraphApiClient.cs b/arangodb-net-standard/GraphApi/GraphApiClient.cs
index cc5d9e96..3b20ff5d 100644
--- a/arangodb-net-standard/GraphApi/GraphApiClient.cs
+++ b/arangodb-net-standard/GraphApi/GraphApiClient.cs
@@ -57,11 +57,14 @@ public GraphApiClient(IApiClientTransport transport, IApiClientSerialization ser
///
/// The information of the graph to create. Must be an instance of or .
/// Optional query parameters of the request.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PostGraphAsync(
PostGraphBody postGraphBody,
- PostGraphQuery query = null, CancellationToken token = default)
+ PostGraphQuery query = null,
+ GraphHeaderProperties headers = null,
+ CancellationToken token = default)
{
string uri = _graphApiPath;
@@ -72,7 +75,9 @@ public virtual async Task PostGraphAsync(
var content = await GetContentAsync(postGraphBody, new ApiClientSerializationOptions(true, true));
- using (var response = await _transport.PostAsync(uri, content, token: token).ConfigureAwait(false))
+ using (var response = await _transport.PostAsync(uri, content,
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
+ token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -87,15 +92,20 @@ public virtual async Task PostGraphAsync(
/// Lists all graphs stored in this database.
/// GET /_api/gharial
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
/// Note: The property is null for
/// in ArangoDB 4.5.2 and below, in which case you can use instead.
///
///
- public virtual async Task GetGraphsAsync( CancellationToken token = default)
+ public virtual async Task GetGraphsAsync(
+ GraphHeaderProperties headers = null,
+ CancellationToken token = default)
{
- using (var response = await _transport.GetAsync(_graphApiPath, token: token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(_graphApiPath,
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
+ token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -114,18 +124,23 @@ public virtual async Task GetGraphsAsync( CancellationToken t
///
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task DeleteGraphAsync(
string graphName,
- DeleteGraphQuery query = null, CancellationToken token = default)
+ DeleteGraphQuery query = null,
+ GraphHeaderProperties headers = null,
+ CancellationToken token = default)
{
string uriString = _graphApiPath + "/" + WebUtility.UrlEncode(graphName);
if (query != null)
{
uriString += "?" + query.ToQueryString();
}
- using (var response = await _transport.DeleteAsync(uriString, token: token).ConfigureAwait(false))
+ using (var response = await _transport.DeleteAsync(uriString,
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
+ token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -142,11 +157,17 @@ public virtual async Task DeleteGraphAsync(
/// GET /_api/gharial/{graph}
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task GetGraphAsync(string graphName, CancellationToken token = default)
+ public virtual async Task GetGraphAsync(string graphName,
+ GraphHeaderProperties headers = null,
+ CancellationToken token = default)
{
- using (var response = await _transport.GetAsync(_graphApiPath + "/" + WebUtility.UrlEncode(graphName), token: token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(
+ _graphApiPath + "/" + WebUtility.UrlEncode(graphName),
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
+ token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -162,11 +183,17 @@ public virtual async Task GetGraphAsync(string graphName, Canc
/// GET /_api/gharial/{graph}/vertex
///
/// The name of the graph.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task GetVertexCollectionsAsync(string graphName, CancellationToken token = default)
+ public virtual async Task GetVertexCollectionsAsync(string graphName,
+ GraphHeaderProperties headers = null,
+ CancellationToken token = default)
{
- using (var response = await _transport.GetAsync(_graphApiPath + '/' + WebUtility.UrlEncode(graphName) + "/vertex", token: token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(
+ _graphApiPath + '/' + WebUtility.UrlEncode(graphName) + "/vertex",
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
+ token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -182,11 +209,17 @@ public virtual async Task GetVertexCollectionsAsyn
/// GET /_api/gharial/{graph}/edge
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
- public virtual async Task GetEdgeCollectionsAsync(string graphName, CancellationToken token = default)
+ public virtual async Task GetEdgeCollectionsAsync(string graphName,
+ GraphHeaderProperties headers = null,
+ CancellationToken token = default)
{
- using (var response = await _transport.GetAsync(_graphApiPath + "/" + WebUtility.UrlEncode(graphName) + "/edge", token: token).ConfigureAwait(false))
+ using (var response = await _transport.GetAsync(
+ _graphApiPath + "/" + WebUtility.UrlEncode(graphName) + "/edge",
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
+ token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -209,17 +242,22 @@ public virtual async Task GetEdgeCollectionsAsync(st
///
/// The name of the graph.
/// The information of the edge definition.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PostEdgeDefinitionAsync(
string graphName,
- PostEdgeDefinitionBody body, CancellationToken token = default)
+ PostEdgeDefinitionBody body,
+ GraphHeaderProperties headers = null,
+ CancellationToken token = default)
{
var content = await GetContentAsync(body, new ApiClientSerializationOptions(true, true));
string uri = _graphApiPath + "/" + WebUtility.UrlEncode(graphName) + "/edge";
- using (var response = await _transport.PostAsync(uri, content, token: token).ConfigureAwait(false))
+ using (var response = await _transport.PostAsync(uri, content,
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
+ token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -237,17 +275,22 @@ public virtual async Task PostEdgeDefinitionAsync(
///
/// The name of the graph.
/// The information of the vertex collection.
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task PostVertexCollectionAsync(
string graphName,
- PostVertexCollectionBody body, CancellationToken token = default)
+ PostVertexCollectionBody body,
+ GraphHeaderProperties headers = null,
+ CancellationToken token = default)
{
string uri = _graphApiPath + '/' + WebUtility.UrlEncode(graphName) + "/vertex";
var content = await GetContentAsync(body, new ApiClientSerializationOptions(true, true));
- using (var response = await _transport.PostAsync(uri, content, token: token).ConfigureAwait(false))
+ using (var response = await _transport.PostAsync(uri, content,
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
+ token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -288,7 +331,9 @@ public virtual async Task> PostVertexAsync(
uri += "?" + query.ToQueryString();
}
var content = await GetContentAsync(vertex, serializationOptions).ConfigureAwait(false);
- using (var response = await _transport.PostAsync(uri, content,headers?.ToWebHeaderCollection(), token: token).ConfigureAwait(false))
+ using (var response = await _transport.PostAsync(uri, content,
+ headers?.ToWebHeaderCollection(),
+ token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -308,12 +353,15 @@ public virtual async Task> PostVertexAsync(
///
///
///
+ /// Headers for the request
/// A CancellationToken to observe while waiting for the task to complete or to cancel the task.
///
public virtual async Task DeleteEdgeDefinitionAsync(
string graphName,
string collectionName,
- DeleteEdgeDefinitionQuery query = null, CancellationToken token = default)
+ DeleteEdgeDefinitionQuery query = null,
+ GraphHeaderProperties headers = null,
+ CancellationToken token = default)
{
string uri = _graphApiPath + "/" + WebUtility.UrlEncode(graphName) +
"/edge/" + WebUtility.UrlEncode(collectionName);
@@ -321,7 +369,9 @@ public virtual async Task DeleteEdgeDefinitionAsyn
{
uri += "?" + query.ToQueryString();
}
- using (var response = await _transport.DeleteAsync(uri, token: token).ConfigureAwait(false))
+ using (var response = await _transport.DeleteAsync(uri,
+ webHeaderCollection: headers?.ToWebHeaderCollection(),
+ token: token).ConfigureAwait(false))
{
if (response.IsSuccessStatusCode)
{
@@ -342,12 +392,15 @@ public virtual async Task DeleteEdgeDefinitionAsyn
///