Class XBRApiRoutines
Provides factory methods for creating routine clients and managing routine system interactions.
Namespace: Workspace.XBR.Xperiflow.SubApis
Assembly: Xperiflow.dll
public class XBRApiRoutines
Examples
Basic routine client creation and usage:
// Create a routine client for general use
var routineClient = XBRApi.Routines.GetRoutineClient(sessionInfo);
// Create a routine instance
var instance = routineClient.CreateRoutineInstanceAsync(
"DataProcessor",
"1.0.0",
"Daily Processing Instance"
).Result;
// Execute a routine method
var run = instance.CreateMethodRunAsync(
"process_data",
inputParams: new JObject { ["date"] = "2023-12-01" }
).Result;
// Monitor execution and get results
run.WaitForCompletionAsync().Wait();
var artifacts = run.GetArtifactsAsync().Result;
Project-specific routine client for AI integration:
// Create a routine client scoped to a specific AI project
var projectRoutineClient = XBRApi.Routines.GetRoutineClient(sessionInfo, projectId: 123);
// Create an AI-specific routine instance
var aiInstance = projectRoutineClient.CreateRoutineInstanceAsync(
"AIModelTrainer",
"2.0.0",
"Monthly Model Training"
).Result;
// Execute model training
var trainingRun = aiInstance.CreateMethodRunAsync(
"train_model",
inputParams: new JObject {
["dataset"] = "customer_data_2023",
["algorithm"] = "random_forest"
},
storeArtifacts: true,
includeStatistics: true
).Result;
trainingRun.WaitForCompletionAsync().Result;
var modelArtifacts = trainingRun.GetArtifactsAsync().Result;
Remarks
The Workspace.XBR.Xperiflow.SubApis.XBRApiRoutines class serves as the primary entry point for accessing the Xperiflow routine system. It provides factory methods to create appropriately configured Workspace.XBR.Xperiflow.Routines.IRoutineClient instances that can be used to manage routine instances, execute routine methods, and handle routine-related operations.
Key Features:
-
Multiple Client Types Support for both general routine clients and project-specific clients for AI project integration
-
Solution Scoping Ability to scope routine clients to specific solution codes for multi-tenant scenarios
-
Dependency Management Automatic configuration of all required dependencies including file system clients, metadata lookup clients, and artifact resolvers
-
Authentication Support Optional OIS token support for authenticated operations
Client Configuration:
The factory methods handle the complex initialization of routine clients, including setting up HTTP clients, file system connections, metadata lookup services, and artifact data resolvers. This ensures that clients are properly configured for production use with minimal setup code.
Thread Safety:
All methods in this class are thread-safe and can be called concurrently from multiple threads. The created routine clients are also thread-safe for concurrent operations.
Methods
GetRoutineClient(SessionInfo, OISToken?)
Creates a routine client using the default solution code for general routine operations.
public IRoutineClient GetRoutineClient(SessionInfo si, OISToken? oisToken = null)
Remarks
This method creates a routine client configured with the default solution code, making it suitable for general routine operations that don't require specific solution scoping.
The created client includes all necessary dependencies:
Returns
Workspace.XBR.Xperiflow.Routines.IRoutineClient
A configured Workspace.XBR.Xperiflow.Routines.IRoutineClient instance ready for routine operations
Parameters
| Type | Name | Description |
|---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session information containing user context and connection details |
OneStream.Shared.Wcf.OISToken | oisToken | Optional OIS authentication token for explicit interaction with Xperiflow REST API. If null, automatically instantiates one internally. Note: You may want to provide an explicit token due to OneStream platform limitations on which Platform servers are allowed to interact with OIS |
Exceptions
OneStream.Shared.Common.XFException
Thrown when client creation fails due to configuration or authentication issues
GetRoutineClient(SessionInfo, string, OISToken?)
Creates a routine client scoped to a specific solution code for multi-tenant scenarios.
public IRoutineClient GetRoutineClient(SessionInfo si, string solutionCode, OISToken? oisToken = null)
Remarks
This method creates a routine client that is scoped to a specific solution code, enabling multi-tenant scenarios where different solutions need isolated routine environments.
Solution Scoping Benefits:
Note: Passing only solutionCode does not apply access-control restrictions. To enforce solution-specific access controls and permissions, use the overloads that accept Workspace.XBR.Xperiflow.Core.Scope.IScopeBuilders or Workspace.XBR.Xperiflow.Core.Scope.ScopeDefinitions.
Returns
Workspace.XBR.Xperiflow.Routines.IRoutineClient
A configured Workspace.XBR.Xperiflow.Routines.IRoutineClient instance scoped to the specified solution code
Parameters
| Type | Name | Description |
|---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session information containing user context and connection details |
System.String | solutionCode | The solution code to scope the client to. All routines created by this client will be associated with this solution |
OneStream.Shared.Wcf.OISToken | oisToken | Optional OIS authentication token for explicit interaction with Xperiflow REST API. If null, automatically instantiates one internally. Note: You may want to provide an explicit token due to OneStream platform limitations on which Platform servers are allowed to interact with OIS |
Exceptions
OneStream.Shared.Common.XFException
Thrown when client creation fails due to configuration, authentication, or invalid solution code
GetRoutineClient(SessionInfo, string, IList<IScopeBuilder>, OISToken?)
Creates a routine client scoped to particular Workspace.XBR.Xperiflow.Core.Scope.ScopeDefinitions that are created by the provided Workspace.XBR.Xperiflow.Core.Scope.IScopeBuilders.
public IRoutineClient GetRoutineClient(SessionInfo si, string solutionCode, IList<IScopeBuilder> scopeBuilders, OISToken? oisToken = null)
Remarks
Solution-specific access controls are enforced via the provided scopes. The solutionCode parameter controls attribution/organization of routine operations and does not by itself apply permissions.
Returns
Workspace.XBR.Xperiflow.Routines.IRoutineClient
A configured Workspace.XBR.Xperiflow.Routines.IRoutineClient for the provided scopes.
Parameters
| Type | Name | Description |
|---|---|---|
OneStream.Shared.Common.SessionInfo | si | The OneStream session info object containing user context and connection details. |
System.String | solutionCode | The solution code of the solution routine calls should be attributed to. |
System.Collections.Generic.IList< Workspace.XBR.Xperiflow.Core.Scope.IScopeBuilder > | scopeBuilders | A list of Workspace.XBR.Xperiflow.Core.Scope.IScopeBuilders that will be used to create Workspace.XBR.Xperiflow.Core.Scope.ScopeDefinitions. |
OneStream.Shared.Wcf.OISToken | oisToken | Optional OIS authentication token for explicit interaction with the Xperiflow REST API. If null, automatically instantiates one internally. Note: You may want to provide an explicit token due to OneStream platform limitations on which Platform servers are allowed to interact with OIS |
GetRoutineClient(SessionInfo, string, IList<ScopeDefinition>, OISToken?)
Creates a routine client scoped to particular Workspace.XBR.Xperiflow.Core.Scope.ScopeDefinitions. Use of Scope Definitions allow for scope level control of roles and permissions.
public IRoutineClient GetRoutineClient(SessionInfo si, string solutionCode, IList<ScopeDefinition> scopeDefinitions, OISToken? oisToken = null)
Remarks
Solution-specific access controls are enforced via the provided scope definitions. The solutionCode parameter controls attribution/organization of routine operations and does not by itself apply permissions.
Returns
Workspace.XBR.Xperiflow.Routines.IRoutineClient
A configured Workspace.XBR.Xperiflow.Routines.IRoutineClient instance scoped to the Workspace.XBR.Xperiflow.Core.Scope.ScopeDefinitions provided.
Parameters
| Type | Name | Description |
|---|---|---|
OneStream.Shared.Common.SessionInfo | si | The OneStream Session Info object containing user context and connection details. |
System.String | solutionCode | The solution code of the solution routine calls should be attributed to. |
System.Collections.Generic.IList< Workspace.XBR.Xperiflow.Core.Scope.ScopeDefinition > | scopeDefinitions | A list of Workspace.XBR.Xperiflow.Core.Scope.ScopeDefinition objects to scope the routine client to. Allows for scope level control of roles and permissions. |
OneStream.Shared.Wcf.OISToken | oisToken | Optional OIS authentication token for explicit interaction with the Xperiflow REST API. If null, automatically instantiates one internally. Note: You may want to provide an explicit token due to OneStream platform limitations on which Platform servers are allowed to interact with OIS |
GetRoutineClient(SessionInfo, int, OISToken?)
Creates a routine client scoped to a specific AI project for AI-integrated routine operations.
public IRoutineClient GetRoutineClient(SessionInfo si, int projectId, OISToken? oisToken = null)
Remarks
This method creates a routine client that is specifically configured for AI project integration, enabling seamless interaction between routine operations and AI project workflows.
AI Project Integration Features:
Returns
Workspace.XBR.Xperiflow.Routines.IRoutineClient
A configured Workspace.XBR.Xperiflow.Routines.IRoutineClient instance scoped to the specified AI project
Parameters
| Type | Name | Description |
|---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session information containing user context and connection details |
System.Int32 | projectId | The unique identifier of the AI project to scope the client to |
OneStream.Shared.Wcf.OISToken | oisToken | Optional OIS authentication token for explicit interaction with Xperiflow REST API. If null, automatically instantiates one internally. Note: You may want to provide an explicit token due to OneStream platform limitations on which Platform servers are allowed to interact with OIS |
Exceptions
OneStream.Shared.Common.XFException
Thrown when client creation fails due to configuration, authentication, or invalid project ID
GetRoutineClient(SessionInfo, int, string, OISToken?)
Creates a routine client scoped to both a specific AI project and solution code for comprehensive project integration.
public IRoutineClient GetRoutineClient(SessionInfo si, int projectId, string solutionCode, OISToken? oisToken = null)
Remarks
This method creates a routine client that combines both AI project integration and solution scoping, providing the most comprehensive configuration for complex multi-tenant AI scenarios.
Combined Scoping Benefits:
Note: Passing only solutionCode does not apply access-control restrictions. To enforce solution- or project-specific permissions, use overloads that accept Workspace.XBR.Xperiflow.Core.Scope.IScopeBuilders or Workspace.XBR.Xperiflow.Core.Scope.ScopeDefinitions.
Storage Configuration:
The client is configured with a project-specific connection key that ensures all routine data is stored in the appropriate project context while maintaining solution-level organization.
Returns
Workspace.XBR.Xperiflow.Routines.IRoutineClient
A configured Workspace.XBR.Xperiflow.Routines.IRoutineClient instance scoped to both the specified AI project and solution code
Parameters
| Type | Name | Description |
|---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session information containing user context and connection details |
System.Int32 | projectId | The unique identifier of the AI project to scope the client to |
System.String | solutionCode | The solution code to scope the client to. All routines created by this client will be associated with this solution |
OneStream.Shared.Wcf.OISToken | oisToken | Optional OIS authentication token for explicit interaction with Xperiflow REST API. If null, automatically instantiates one internally. Note: You may want to provide an explicit token due to OneStream platform limitations on which Platform servers are allowed to interact with OIS |
Exceptions
OneStream.Shared.Common.XFException
Thrown when client creation fails due to configuration, authentication, invalid project ID, or invalid solution code
GetRoutineClient(SessionInfo, int, string, IList<IScopeBuilder>, OISToken?)
Creates a routine client scoped to both a specific AI project and solution code for comprehensive project integration.
public IRoutineClient GetRoutineClient(SessionInfo si, int projectId, string solutionCode, IList<IScopeBuilder> scopeBuilders, OISToken? oisToken = null)
Remarks
This method creates a routine client that combines both AI project integration and solution scoping, providing the most comprehensive configuration for complex multi-tenant AI scenarios.
Note: Passing only solutionCode does not apply access-control restrictions. To enforce solution- or project-specific permissions, use overloads that accept Workspace.XBR.Xperiflow.Core.Scope.IScopeBuilders or Workspace.XBR.Xperiflow.Core.Scope.ScopeDefinitions.
Returns
Workspace.XBR.Xperiflow.Routines.IRoutineClient
A configured Workspace.XBR.Xperiflow.Routines.IRoutineClient instance scoped to both the specified AI project and solution code
Parameters
| Type | Name | Description |
|---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session information containing user context and connection details |
System.Int32 | projectId | The unique identifier of the AI project to scope the client to |
System.String | solutionCode | The solution code to scope the client to. All routines created by this client will be associated with this solution |
System.Collections.Generic.IList< Workspace.XBR.Xperiflow.Core.Scope.IScopeBuilder > | scopeBuilders | A list of Workspace.XBR.Xperiflow.Core.Scope.IScopeBuilders that will be used to create Workspace.XBR.Xperiflow.Core.Scope.ScopeDefinitions. |
OneStream.Shared.Wcf.OISToken | oisToken | Optional OIS authentication token for explicit interaction with the Xperiflow REST API. If null, automatically instantiates one internally. Note: You may want to provide an explicit token due to OneStream platform limitations on which Platform servers are allowed to interact with OIS |
GetRoutineClient(SessionInfo, int, string, IList<ScopeDefinition>, OISToken?)
Creates a routine client scoped to both a specific AI project and solution code for comprehensive project integration.
public IRoutineClient GetRoutineClient(SessionInfo si, int projectId, string solutionCode, IList<ScopeDefinition> scopeDefinitions, OISToken? oisToken = null)
Remarks
This method creates a routine client that combines both AI project integration and solution scoping, providing the most comprehensive configuration for complex multi-tenant AI scenarios.
Returns
Workspace.XBR.Xperiflow.Routines.IRoutineClient
A configured Workspace.XBR.Xperiflow.Routines.IRoutineClient instance scoped to both the specified AI project and solution code
Parameters
| Type | Name | Description |
|---|---|---|
OneStream.Shared.Common.SessionInfo | si | The session information containing user context and connection details |
System.Int32 | projectId | The unique identifier of the AI project to scope the client to |
System.String | solutionCode | The solution code to scope the client to. All routines created by this client will be associated with this solution |
System.Collections.Generic.IList< Workspace.XBR.Xperiflow.Core.Scope.ScopeDefinition > | scopeDefinitions | A list of Workspace.XBR.Xperiflow.Core.Scope.ScopeDefinition objects to scope the routine client to. Allows for scope level control of roles and permissions. |
OneStream.Shared.Wcf.OISToken | oisToken | Optional OIS authentication token for explicit interaction with the Xperiflow REST API. If null, automatically instantiates one internally. Note: You may want to provide an explicit token due to OneStream platform limitations on which Platform servers are allowed to interact with OIS |
GetInputParametersComponentWorkflowUrl(SessionInfo, int)
Generates the direct URL to the Xperiflow Component Workflow page for a given workflow instance.
public string GetInputParametersComponentWorkflowUrl(SessionInfo si, int workflowId)
Returns
System.String
/// The full URL (as a System.String) to the Xperiflow Component Workflow dashboard for the associated workflow instance. This URL
can be provided to a OneStream "Web Content" Dashboard Component to display the Xperiflow Component Workflow web dashboard.
Parameters
| Type | Name | Description |
|---|---|---|
OneStream.Shared.Common.SessionInfo | si | The current OneStream.Shared.Common.SessionInfo context. |
System.Int32 | workflowId | The unique identifier of the workflow instance. This may be retrieved from the Workspace.XBR.Xperiflow.Routines.Runs.RunMetadata object. |
Inherited Members
System.Object.Equals(System.Object)System.Object.Equals(System.Object,System.Object)System.Object.GetHashCodeSystem.Object.GetTypeSystem.Object.MemberwiseCloneSystem.Object.ReferenceEquals(System.Object,System.Object)System.Object.ToString