Skip to content

Latest commit

 

History

History
70 lines (56 loc) · 2.08 KB

README.md

File metadata and controls

70 lines (56 loc) · 2.08 KB

Build status

Viren.NET

.NET client for the Viren API

Packages

Package Version
Viren.Core NuGet version
Viren.Execution NuGet version
Viren.Execution.Extensions.DependencyInjection NuGet version

Examples

Viren namespaces and alias

using Viren.Execution;
using Environment = Viren.Core.Enums.Environment;

Creating a client

var clientSecret = "";
var environment = Environment.Production;
var httpClient = VirenHttpClientFactory.Create(clientSecret, environment);
var executionClient = new ExecutionClient(httpClient);

Execute calculation

var request = new ExecuteCalculationRequest()
{
    Project = "Project",
    Model = "Model",
    Version = 1,
    Revision = null,
    Root = new Dictionary<string, object>
    {
        { "Input", 5 }
    },
    EntryPoint = "RootBlock",

    // Optionally specify an identifier to mark multiple calls as part of a single user session
    ClientSessionId = "my-session-identifier"
};
var calculation = client.Calculation.Execute(request);
calculation.Wait();
return calculation.Result.Result;

Get tables from model

var request = new GetLookupTablesRequest()
{
    Project = "Project",
    Model = "Model",
    Version = 1,
    Revision = null,
    GlobalIds = new []{"CarTable", "WageTable"}
};
var tables = client.Model.GetTables(request);
tables.Wait();
return tables.Result.Result;