Giter Club home page Giter Club logo

ardoq-csharp-client's Introduction

ardoq-csharp-client

Small C# wrapper for the Ardoq REST-api.

Installation

Using NuGet:

PM> Install-Package Ardoq

Usage

var client = new ArdoqClient(new HttpClient(), "https://app.ardoq.com", "api-token", "your-org-label");

Starting a small project

NB: Before using the client you have to generate an api token as described here

using Ardoq;
using Ardoq.Models;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            var workspace = new Program().Run();
            workspace.Wait();
            Console.WriteLine(workspace.Result);
            Console.ReadLine();
        }

        public async Task<Workspace> Run()
        {
            var client = new ArdoqClient(new HttpClient(), "https://app.ardoq.com", "insert-your-token-here", "your-organization-label");
            var template = await client.ModelService.GetTemplateByName("Application Service");
            var workspace = await
                client.WorkspaceService.CreateWorkspace(new Workspace("demo-workspace", template.Id, "My demo workspace"));
            var model = await client.ModelService.GetModelById(workspace.ComponentModel);
            var webshop =
                await
                    client.ComponentService.CreateComponent(new Component("Webshop", workspace.Id, "This is the webshop", model.GetComponentTypeByName("Application")));
            var webshopCreateOrder =
                await
                    client.ComponentService.CreateComponent(new Component("Create order", workspace.Id,
                        "Creates an order based on the current shoppingcat", model.GetComponentTypeByName("Service"), webshop.Id));
            var erp =
                await
                    client.ComponentService.CreateComponent(new Component("ERP", workspace.Id, "This is the ERP system", model.GetComponentTypeByName("Application")));
            var erpCreateOrder =
                await
                    client.ComponentService.CreateComponent(new Component("Create order", workspace.Id,
                        "Creates an order", model.GetComponentTypeByName("Service"), erp.Id));

            var reference = await
                    client.ReferenceService.CreateReference(new Reference(workspace.Id, "Order from cart", webshopCreateOrder.Id, erpCreateOrder.Id,
                        model.GetReferenceTypeByName("Synchronous"))
                    { ReturnValue = "Created order" });
            await client.TagService.CreateTag(new Tag("Customer", workspace.Id, "",
                new List<string>() { webshopCreateOrder.Id, erpCreateOrder.Id }, new List<string>() { reference.Id }));
            return await client.WorkspaceService.GetWorkspaceById(workspace.Id);
        }
    }
}

Running this simple example let's Ardoq visualize the components and their relationships.

Component landscape

Components

Sequence diagram

Sequence diagram

Relationship diagram

Relationships

Models

The model API is not stable yet, so you have to create your Model in the UI and refer to the id. ##Contributing

Tests

In order to run the tests you need an Ardoq account. You also need to generate a security token and edit the settings in ArdoqTest.Helper.TestUtils to fit your configuration.

License

Copyright © 2017 Ardoq AS

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

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.