View.OrchestratorBase 0.4.0.3

dotnet add package View.OrchestratorBase --version 0.4.0.3                
NuGet\Install-Package View.OrchestratorBase -Version 0.4.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="View.OrchestratorBase" Version="0.4.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add View.OrchestratorBase --version 0.4.0.3                
#r "nuget: View.OrchestratorBase, 0.4.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install View.OrchestratorBase as a Cake Addin
#addin nuget:?package=View.OrchestratorBase&version=0.4.0.3

// Install View.OrchestratorBase as a Cake Tool
#tool nuget:?package=View.OrchestratorBase&version=0.4.0.3                

View.io Orchestrator Base Classes and Interfaces

Base classes and interfaces that must be implemented to deploy code with the View Orchestrator.

C# Requirements

Include Dependent Libraries

Install the View.OrchestratorBase NuGet package:

PM> Install-Package View.OrchestratorBase

Modify your .csproj file to include the following inside a PropertyGroup:

<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>

This ensures dependency and package DLLs are copied to your output directory rather than referenced as packages.

Helpful links:

Implement Base Class and Interface

The base class StepBase and interface IStepProcessor must be implemented to be deployed on the View Orchestrator. Your code should expect a StepRequest as its input, and return a StepResponse as its output.

using View.OrchestratorBase

public class MyClass : StepBase, IStepProcessor
{
	public async Task<StepResponse> Process(StepRequest req)
	{
		// your code here

		StepResponse resp = new StepResponse
		{
			Result = StepResultEnum.Success, // or Failure, or Exception
			Data = Encoding.UTF8.GetBytes([your data here])
		};

		return resp;
	}
}

Python Requirements

User python scripts are encapsulated into a wrapper script by the Orchestrator and executed in a new shell process for each invocation. The following constraints must be met:

  • Orchestrator will invoke a method you implement as def process(req):
  • The input parameter req will always be a dictionary, following the same key names as the C# StepRequest class
  • The method must return a dictionary serializable to JSON using json.dumps(resp)
  • The Data property of the return dictionary must be a base64 string

Request and Response Dictionaries

The properties found within the input dictionary are identical to those found in the C# StepRequest class:

  • GUID - unique identifier for the request
  • Url - the URL on which the step was invoked
  • Headers - a dictionary (NameValueCollection) containing the headers attached to the request
  • Query - a dictionary (NameValueCollection) containing URL query elements
  • Data - base64-encoded string containing the input data, should be decoded before use

The returned dictionary should use the same key names as found in the C# StepResponse class:

  • Result - Success, Failure, Exception
  • StatusCode - an HTTP status code (integer)
  • ContentType - MIME type of the data within the Data property
  • Data - base64-encoded string of the response data, your code must perform the encoding

Example

import base64

def process(req) -> dict:
    input_data = str(base64.b64decode(req["Data"]))
	print("Received " + input_data)
	resp = {} 
    resp["Result"] = "Success"
    resp["StatusCode"] = 200
    resp["ContentType"] = "text/plain"
    resp["Data"] = base64.b64encode(str.encode("You said " + input_data)).decode("utf-8")
    return resp
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on View.OrchestratorBase:

Package Downloads
View.Models

View.io is currently in BETA. Database models and supporting classes for View.io services.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.4.0.3 102 8/10/2024
0.4.0.1 316 7/3/2024
0.3.0.6 98 6/29/2024
0.3.0.5 103 6/14/2024
0.3.0.4 91 6/14/2024
0.3.0.3 89 6/14/2024
0.3.0.2 87 6/13/2024
0.3.0.1 87 6/13/2024