Class API
The API class encapsulates the REST API used by the Unity Simulation service.
Namespace: Unity.Simulation.Client
Syntax
public static class API
Methods
Describe(String, String)
Download a description of a run exection from Unity Simulation.
Declaration
public static RunDescription Describe(string executionId, string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | executionId | |
| String | accessToken |
Returns
| Type | Description |
|---|---|
| RunDescription | RunDescription struct value. |
DownloadAppParam<T>(String, String)
Download an app param from Unity Simulation to a specific location.
Declaration
public static T DownloadAppParam<T>(string id, string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | id | App param upload id to download. |
| String | accessToken |
Returns
| Type | Description |
|---|---|
| T | Copy of struct value. |
Type Parameters
| Name | Description |
|---|---|
| T |
DownloadBuild(String, String, String)
Download a build from Unity Simulation to a specific location.
Declaration
public static void DownloadBuild(string id, string location, string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | id | Build upload id to download. |
| String | location | Path to where you want the download to be saved. |
| String | accessToken |
DownloadRunDefinition(String, String)
Download a run definition from Unity Simulation.
Declaration
public static RunDefinition DownloadRunDefinition(string definitionId, string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | definitionId | |
| String | accessToken |
Returns
| Type | Description |
|---|---|
| RunDefinition | RunDefinition struct value. |
GetManifest(String, String)
Download the manifest of uploaded artifacts for a run exection.
Declaration
public static Dictionary<int, ManifestEntry> GetManifest(string executionId, string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | executionId | Execution id whose manifest you wish to download. |
| String | accessToken |
Returns
| Type | Description |
|---|---|
| Dictionary<Int32, ManifestEntry> | Dictionary of entry hash code mapped to ManifestEntry. |
Remarks
You can call this at any time, and multiple times, and the dictionary will contain new items that have been uploaded.
GetRunDefinitions(String)
Get all run definitions.
Declaration
public static RunDescription[] GetRunDefinitions(string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | accessToken |
Returns
| Type | Description |
|---|---|
| RunDescription[] | Array of RunDescription objects. |
GetSysParams(String)
Retrieves the supported SysParams for the Unity Simulation service.
Declaration
public static SysParamDefinition[] GetSysParams(string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | accessToken |
Returns
| Type | Description |
|---|---|
| SysParamDefinition[] | Array of SysParamDefinition |
Login()
Authenticates the currently active project with the Unity Simulation service.
Declaration
public static void Login()
Login(String, String)
Declaration
public static string Login(string username, string password)
Parameters
| Type | Name | Description |
|---|---|---|
| String | username | |
| String | password |
Returns
| Type | Description |
|---|---|
| String |
Refresh()
Refreshes the auth token for the currently active project with the Unity Simulation service.
Declaration
public static void Refresh()
Summarize(String, String)
Download a summary of a run execution from Unity Simulation.
Declaration
public static RunSummary Summarize(string executionId, string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | executionId | |
| String | accessToken |
Returns
| Type | Description |
|---|---|
| RunSummary | RunSummary struct value. |
UploadAppParam(String, String, String)
Serialize a struct and upload the JSON as an app param.
Declaration
public static string UploadAppParam(string name, string appParamString, string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | Name for uploaded resource. |
| String | appParamString | AppParam Json string |
| String | accessToken |
Returns
| Type | Description |
|---|---|
| String | Uploaded app param id. |
UploadAppParam<T>(String, T, String)
Serialize a struct and upload the JSON as an app param.
Declaration
public static string UploadAppParam<T>(string name, T param, string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | Name for uploaded resource. |
| T | param | |
| String | accessToken |
Returns
| Type | Description |
|---|---|
| String | Uploaded app param id. |
Type Parameters
| Name | Description |
|---|---|
| T |
UploadAppParamBatch(Dictionary<String, Object>, String)
Batch serialize and upload app param objects.
Declaration
public static Dictionary<string, string> UploadAppParamBatch(Dictionary<string, object> appParams, string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Dictionary<String, Object> | appParams | Dictionary of app param names and objects to serialzize. |
| String | accessToken |
Returns
| Type | Description |
|---|---|
| Dictionary<String, String> | Dictionary of original names mapped to the uploaded app param id. |
UploadAppParamBatch(String[], Object[], String)
Batch serialize and upload app param objects.
Declaration
public static Dictionary<string, string> UploadAppParamBatch(string[] names, object[] appParams, string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String[] | names | Array of app param names. |
| Object[] | appParams | Array of app param objects to serialize into Json. |
| String | accessToken |
Returns
| Type | Description |
|---|---|
| Dictionary<String, String> | Dictionary of original names mapped to the uploaded app param id. |
UploadAppParamBatch(String[], String[], String)
Batch serialize and upload app param objects.
Declaration
public static Dictionary<string, string> UploadAppParamBatch(string[] names, string[] appParams, string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String[] | names | Array of app param names. |
| String[] | appParams | Array of Json serialized app param objects. |
| String | accessToken |
Returns
| Type | Description |
|---|---|
| Dictionary<String, String> | Dictionary of original names mapped to the uploaded app param id. |
UploadBuild(String, String, String)
Uploads a build to the Unity Simulation Service. Note that the executable name must end with .x86_64, and the entire build must be zipped into a single archive.
Declaration
public static string UploadBuild(string name, string location, string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | Name for the build when uploaded. |
| String | location | Path to the zipped archive. |
| String | accessToken |
Returns
| Type | Description |
|---|---|
| String | Uploaded build id. |
UploadBuildAsync(String, String, String, String, CancellationTokenSource, Action<Single>)
Uploads a build to the Unity Simulation Service. Note that the executable name must end with .x86_64, and the entire build must be zipped into a single archive.
Declaration
public static Task<string> UploadBuildAsync(string name, string location, string accessToken = null, string contentType = null, CancellationTokenSource cancellationTokenSource = null, Action<float> progress = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | Name for the build when uploaded. |
| String | location | Path to the zipped archive. |
| String | accessToken | Access token to use, null will use the project access token. |
| String | contentType | |
| CancellationTokenSource | cancellationTokenSource | |
| Action<Single> | progress | Action to perform for progress updates. |
Returns
| Type | Description |
|---|---|
| Task<String> | Uploaded build id. |
UploadRunDefinition(RunDefinition, String)
Upload a run definition to Unity Simulation.
Declaration
public static string UploadRunDefinition(RunDefinition definition, string accessToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RunDefinition | definition | Run definition to be uploaded. |
| String | accessToken |
Returns
| Type | Description |
|---|---|
| String | Uploaded run definition id. |