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
<PackageReference Include="View.OrchestratorBase" Version="0.4.0.3" />
paket add View.OrchestratorBase --version 0.4.0.3
#r "nuget: View.OrchestratorBase, 0.4.0.3"
// 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 requestUrl
- the URL on which the step was invokedHeaders
- a dictionary (NameValueCollection
) containing the headers attached to the requestQuery
- a dictionary (NameValueCollection
) containing URL query elementsData
- 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 theData
propertyData
- 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 | Versions 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. |
-
net8.0
- Timestamps (>= 1.0.9)
- View.Serializer (>= 1.0.2)
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.