Giter Site home page Giter Site logo

arangodb-community / arangodb-net-standard Goto Github PK

View Code? Open in Web Editor NEW
74.0 9.0 30.0 7.62 MB

A consistent, comprehensive, minimal interface to enable .NET applications to use the complete range of features exposed by the ArangoDB REST API.

License: Apache License 2.0

C# 100.00%
arangodb

arangodb-net-standard's People

Contributors

alistairb99124 avatar dependabot[bot] avatar discjockeydj avatar discopyf avatar emcg0402429 avatar grzesiekjaczewski avatar ilya-murashko-leverx avatar jledel avatar kealist avatar leoltron avatar modios avatar otixa avatar robsiera avatar rossmills99 avatar tjoubert avatar zyqsempai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arangodb-net-standard's Issues

Consider changing the naming used for data model carrying parameters

I got confused by the naming of the data models that carry parameters for the client methods. I didn't realize at first the distinction between the models for body parameters and the other for query parameters.

Example: PostCollectionRequest (JSON body parameters) and PostCollectionOptions (query parameters)

What about renaming them to make that distinction more obvious?

Example: PostCollectionBodyParams and PostCollectionQueryParams?

I find using the term Options especially confusing.

Maybe when using the client in code the distinction is more natural. I made this consideration while looking at the classes rather than actually using one of the client.

Bug remove ObjectId

Appears to be undocumented property that is not consistent across arangodb versions

Rename the PostGraphQuery class used in PostGraphBody

In the namespace ArangoDBNetStandard.GraphApi, the PostGraphQuery represents the graph options inside the PostGraphBody.

It is not a model that represents query parameters. I think we should rename it to PostGraphOptions or PostGraphBodyOptions.

Consider implementing a generic ToQueryString() method

So currently you have to define every property to be added to a query. Perhaps we can refactor to be more generic. This was my solution but perhaps we can find a way that does not use Reflection:

`private object GetPropertyValue(T src, string propName)
{
return src.GetType().GetProperty(propName).GetValue(src, null);
}

    private string ToCamelCaseString(string value)
    {
        return Char.ToLowerInvariant(value[0]) + value.Substring(1);
    }

    protected string ToQueryString<T>(T parameters)
    {
        List<string> query = new List<string>();
        foreach (var property in parameters.GetType().GetProperties())
        {
            var value = GetPropertyValue(parameters, property.Name);
            if (GetPropertyValue(parameters, property.Name) != null)
            {
                var queryItem = ToCamelCaseString(property.Name) + "=";
                if (value.GetType().Name == "Boolean")
                {
                    query.Add(queryItem + value.ToString().ToLower());
                }
                else
                {
                    query.Add(queryItem + value.ToString());
                }
            }
        }
        return string.Join("&", query);
    }`

Implement properties for DeleteCursorResponse model

Endpoint: DELETE /_api/cursor/{cursor-identifier}

When successful, response is:

{
    "id": "3936323",
    "error": false,
    "code": 202
}

When not found, response is:

{
    "error": true,
    "errorMessage": "cursor not found",
    "code": 404,
    "errorNum": 1600
}

Group related API models in dedicated namespace

This is a proposal to group models that belongs to the same API to a common namespace.

Right now each API has its own namespace, e.g. GraphApiClient in ArangoDBNetStandard.GraphApi. However all models are alongside the client classes which makes the namespace a bit messy.

image

I propose to group models in each API namespace into Models, like so: ArangoDBNetStandard.GraphApi.Models.

I remember discussing about this with @AlistairB99124 and he suggested that we could even group models across all API clients into one namespace, like ArangoDBNetStandard.Models. However, doing so may create some restriction, like prevent us from using 2 models with the same name but different properties (to use in 2 different API client).

What are your thoughts about this?

Use asynchronous test fixtures

Currently, we wait for tasks in the constructor and Dispose method of our test fixtures, e.g. CollectionApiClientTestFixture. This causes deadlocks when running tests in parallels with a fixed limited number of threads.

XUnit provides IAsyncLifetime to support for asynchronous initialization and cleanup operations. We should use that and support async all the way.

The property _dbName in CursorApiClientTest is not used and creates warnings

The build for ArangoDBNetStandardTest has a warning:

1>------ Build started: Project: ArangoDBNetStandard, Configuration: Debug Any CPU ------
1>ArangoDBNetStandard -> C:\Users\pfare\Desktop\Centro workspace\arangodb-net-standard\arangodb-net-standard\bin\Debug\netstandard2.0\ArangoDBNetStandard.dll
2>------ Build started: Project: ArangoDBNetStandardTest, Configuration: Debug Any CPU ------
2>CursorApi\CursorApiClientTest.cs(16,33,16,40): warning CS0414: The field 'CursorApiClientTest._dbName' is assigned but its value is never used
2>ArangoDBNetStandardTest -> C:\Users\pfare\Desktop\Centro workspace\arangodb-net-standard\arangodb-net-standard.Test\bin\Debug\netcoreapp2.2\ArangoDBNetStandardTest.dll
2>Done building project "ArangoDBNetStandardTest.csproj".
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.