Skip to content

tealpartners/viren.net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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;