TrySetQueryStringParameter() private méthode

private TrySetQueryStringParameter ( string parameterName, object>.Dictionary parameters ) : void
parameterName string
parameters object>.Dictionary
Résultat void
Exemple #1
0
        /// <summary>
        /// Retrieves list of registered AQL user functions.
        /// </summary>
        public AResult<List<Dictionary<string, object>>> List()
        {
            var request = new Request(HttpMethod.GET, ApiBaseUri.AqlFunction, "");

            // optional
            request.TrySetQueryStringParameter(ParameterName.Namespace, _parameters);

            var response = _connection.Send(request);
            var result = new AResult<List<Dictionary<string, object>>>(response);

            switch (response.StatusCode)
            {
                case 200:
                    if (response.DataType == DataType.List)
                    {
                        result.Value = ((IEnumerable)response.Data).Cast<Dictionary<string, object>>().ToList();
                        result.Success = (result.Value != null);
                    }
                    break;
                default:
                    // Arango error
                    break;
            }

            _parameters.Clear();

            return result;
        }
        /// <summary>
        /// Retrieves basic information, revision ID and checksum of specified collection.
        /// </summary>
        public AResult<Dictionary<string, object>> GetChecksum(string collectionName)
        {
            var request = new Request(HttpMethod.GET, ApiBaseUri.Collection, "/" + collectionName + "/checksum");

            // optional
            request.TrySetQueryStringParameter(ParameterName.WithRevisions, _parameters);
            // optional
            request.TrySetQueryStringParameter(ParameterName.WithData, _parameters);

            var response = _connection.Send(request);
            var result = new AResult<Dictionary<string, object>>(response);

            switch (response.StatusCode)
            {
                case 200:
                    var body = response.ParseBody<Dictionary<string, object>>();

                    result.Success = (body != null);
                    result.Value = body;
                    break;
                case 400:
                case 404:
                default:
                    // Arango error
                    break;
            }

            _parameters.Clear();

            return result;
        }
        /// <summary>
        /// Retrieves list of edges in specified collection.
        /// </summary>
        public AResult<List<string>> GetAllEdges(string collectionName)
        {
            var request = new Request(HttpMethod.GET, ApiBaseUri.Edge, "");

            // required
            request.QueryString.Add(ParameterName.Collection, collectionName);
            // optional
            request.TrySetQueryStringParameter(ParameterName.Type, _parameters);

            var response = _connection.Send(request);
            var result = new AResult<List<string>>(response);

            switch (response.StatusCode)
            {
                case 200:
                    var body = response.ParseBody<Dictionary<string, object>>();

                    result.Success = (body != null);
                    result.Value = body.List<string>("documents");
                    break;
                case 404:
                default:
                    // Arango error
                    break;
            }

            _parameters.Clear();

            return result;
        }
Exemple #4
0
        /// <summary>
        /// Unregisters specified AQL user function.
        /// </summary>
        public AResult<bool> Unregister(string name)
        {
            var request = new Request(HttpMethod.DELETE, ApiBaseUri.AqlFunction, "/" + name);

            // optional
            request.TrySetQueryStringParameter(ParameterName.Group, _parameters);

            var response = _connection.Send(request);
            var result = new AResult<bool>(response);

            switch (response.StatusCode)
            {
                case 200:
                    if (response.DataType == DataType.Document)
                    {
                        result.Success = true;
                        result.Value = true;
                    }
                    break;
                case 400:
                case 404:
                default:
                    // Arango error
                    break;
            }

            _parameters.Clear();

            return result;
        }
        /// <summary>
        /// Retrieves information about collections in current database connection.
        /// </summary>
        public AResult<List<Dictionary<string, object>>> GetAllCollections()
        {
            var request = new Request(HttpMethod.GET, ApiBaseUri.Collection, "");

            // optional
            request.TrySetQueryStringParameter(ParameterName.ExcludeSystem, _parameters);

            var response = _connection.Send(request);
            var result = new AResult<List<Dictionary<string, object>>>(response);

            switch (response.StatusCode)
            {
                case 200:
                    var body = response.ParseBody<Dictionary<string, object>>();

                    result.Success = (body != null);
                    result.Value = body.List<Dictionary<string, object>>("collections");
                    break;
                case 400:
                case 403:
                default:
                    // Arango error
                    break;
            }

            _parameters.Clear();

            return result;
        }