You can download the source code, build the project, and then run dotnet-clara.exe.
Or you can install dotnet-clara in your project, through NuGet. In Visual Studio, open NuGet Package Manager Console, then run command:
Install-Package dotnet-clara
$ dotnet-clara set --apiToken <api-token>
$ dotnet-clara get --username
$ dotnet-clara scene --get <sceneId>
After installing dotnet-clara, include dotnet-clara in your project
using dotnet_clara;
using dotnet_clara.lib;
using dotnet_clara.resources;
Create a clara
instance with your api token and username, visit https://clara.io/settings/api for your api token:
Clara clara = new Clara(username, apiToken, host)
or you can create a clara
instance with default configuration
Config config = new Config();
Clara clara = new Clara(config);
The parameters for each resource method can be checked in resources classes in the resources folder.
Basically, there are there resources classes Scenes
, Jobs
and Users
.
You can access the method of resources by
clara.resource.Method(var input);
For example:
clara.jobs.get(jobId);
clara.scenes.Update(sceneId, "newSceneName");
For most methods in Jobs
User
and Scenes
rescources, they return a response of HttpResponseMessage type.
For Render
and Export
of Scenes
, the return data are Stream type. You can save the data to a file.
Please check how to handle the return data in the source code.
- scenes:library --- List public scenes
- scenes:list --- List your scenes
- scenes:create --- Create a new scene
- scenes:update --- Update a scene
- scenes:get --- Get scene data
- scenes:delete --- Delete a scene
- scenes:clone --- Clone a scene
- scenes:import --- Import a file into the scene
- scenes:export --- Export a scene
- scenes:render --- Render an image
- scenes:command [options] --- Run a command
- jobs:get --- Get job data
- user:get --- Get User Profile
- user:update --- Update user profile
- user:listScenes --- List user's scenes
- user:listJobs --- List user's jobs
- set:[option] --- Set a configuration value to $HOME/.clara.json
- get:[option] --- Return the current configuration for [option]
There are several ways to set up the configuration data command line or api:
- Pass directly (through function call, or command line).
dotnet-clara set --apiToken <apiToken> --username <username>
- Or with api:
Clara clara = new Clara(username, apiToken, host)
- Configuration file in current working directory
A json file named .clara.json
can hold configuration data:
{
"apiToken": "api-token-here",
"username": "your-username",
"host":"clara.io",
"basePath":"/api"
}
Configuration file in $HOME. If the configuration file .clara.json
exists in $HOME, it will be used.
Configuration and method commands are available from the command line runner.
$ dotnet-clara help
$ dotnet-clara scenes --get <sceneId>
$ dotnet-clara set --apiToken <apiToken> --username <username>
You can use the clara command line to quickly set/get your configuration data. It will write
to $HOME/.clara.json
:
$ dotnet-clara set --apiToken <your-api-token>
$ dotnet-clara get --username
You can call resource and method through command line:
$ dotnet-clara scenes --get <sceneId>
-----------------Job-----------------------------
"help --- for help
-----------------Configuration-----------------------------
set --[option] <value> --- set configuration data
get --[option] <value> --- get configuration data
[option] : username, apiToken, host
-----------------Job-----------------------------
job --[option] <value>
[option] : get
--get <jobId> --- get job data
-----------------User----------------------------
user --[option] <value>
[option] : get, update, listScenes, listJobs
--get <username> --- get user profile
--update <username> <profile> --- update user profile
--listScenes <username> <query> --- list user's scenes
--listJobs <username> <query> --- list user's jobs
-----------------Scene---------------------------
scene --[option] <value> : get one configuration item
[option] : get, update, library, create, delete, clone, export, import, command, render
--get <sceneId> --- get a scene data
--update <sceneId> <sceneName> --- update a scene
--library <query> --- list public scenes
--create --- create a new scene
--delete <sceneId> --- delete a scene
--clone <sceneId> --- clone a scene
--export <sceneId> <extension> <filePath> --- export a scene
--import <sceneId> <fileList> --- import a file into the scene
--command <sceneId> <commandOptions> --- run a command
--render <sceneId> <query> <options> <filePath> --- render an image
Run the tests in Visual Studio.