# Class OfflineApi OptimaJet.Workflow.Core.Runtime.OfflineApi Provides API operations for building approval maps and executing ordered batches of workflow commands. Namespace: [OptimaJet.Workflow.Core.Runtime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/) ```csharp public sealed class OfflineApi ``` ## Constructors `public OfflineApi(WorkflowRuntime runtimeOwner)` Initializes a new [OfflineApi](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/OfflineApi/) instance for the specified [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `runtimeOwner` | `WorkflowRuntime` | Runtime used to query process state and execute commands. | ## Methods `public Task> GetApprovalMapAsync(ProcessDefinition scheme, Func> predicate = null, bool ignoreSubprocesses = false)` Gets the possible approval transitions for a process scheme. ### Parameters | Name | Type | Description | | --- | --- | --- | | `scheme` | `ProcessDefinition` | Process scheme containing transitions to evaluate. | | `predicate` | `Func` | Optional asynchronous validation callback executed for each transition before it is added to the map. If omitted, all applicable transitions are included. | | `ignoreSubprocesses` | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to skip transitions where either end of the transition has a nesting level greater than zero. | ### Returns | Type | Description | | --- | --- | | `Task` | A dictionary of activity names and corresponding [ActivityDto](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.ApprovalMap/ActivityDto/) objects with their possible approval transitions. | `public Task> GetApprovalMapAsync(ProcessInstance pi, string identityId)` Gets the approval map for a running process instance and marks activities that are currently active. ### Parameters | Name | Type | Description | | --- | --- | --- | | `pi` | `ProcessInstance` | Process instance to analyze. | | `identityId` | `String` | The workflow participant identity evaluated against actor restrictions on transitions. | ### Returns | Type | Description | | --- | --- | | `Task` | A dictionary of activity names and corresponding [ActivityDto](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.ApprovalMap/ActivityDto/) objects where matching activities are marked with [ActivityDto.IsCurrent](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.ApprovalMap/ActivityDto/) when they are active in the process tree. | `public Task> ExecuteSomeCommandsAsync(IEnumerable commands)` Executes multiple commands, grouping them by process identifier and ordering each group by command date. ### Parameters | Name | Type | Description | | --- | --- | --- | | `commands` | `IEnumerable` | Commands to execute. | ### Returns | Type | Description | | --- | --- | | `Task` | One execution result per input command, returned in the original input order. An exception while executing a command interrupts only the remaining commands in the same process group. | `public Task> ExecuteSomeCommandsAsync(Guid processId, IEnumerable commands)` Executes several commands for one process, in command date order. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | Identifier of the process for which all commands are executed. | | `commands` | `IEnumerable` | Commands to execute. Their [Command.ProcessId](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.ApprovalMap/Command/) values are ignored. | ### Returns | Type | Description | | --- | --- | | `Task` | Execution results in the original input order. If executing a command throws, later commands by date are not executed and are marked as interrupted. | [Previous NamesSearchType](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/NamesSearchType/) [Next ParametersSerializer](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/ParametersSerializer/)