/ardoq-csharp-client

C# wrapper for the Ardoq REST-api

Primary LanguageC#

ardoq-csharp-client

Small C# wrapper for the Ardoq REST-api.

###Install Install the NuGet package

 PM> Install-Package Ardoq

###Usage

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

The client will operate on the default organization (Personal). To change this set the Org field on the client to the appropriate organization.

###Starting a small project

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

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(), "http://app.ardoq.com", "my-token");
            var model = await client.ModelService.GetModelByName("Application Service");
            var workspace = await
                client.WorkspaceService.CreateWorkspace(new Workspace("demo-workspace", model.Id, "My demo workspace"));
            var webshop =
                await
                    client.ComponentService.CreateComponent(new Component("Webshop", workspace.Id, "This is the webshop"));
            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"));
            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.

Components
######Component landscape Sequence diagram ######Sequence diagram Relationships ######Relationship diagram ####Models The model API is not stable yet, so you have to create your Model in the UI and refer to the id. ###License

Copyright © 2014 Ardoq AS

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