Name: nuxeo-dotnet-client
Owner: Nuxeo
Description: The Nuxeo .NET Client is a cross-platform client library developed in C# for the Nuxeo Automation and REST API.
Created: 2015-11-09 10:31:07.0
Updated: 2016-12-07 08:01:05.0
Pushed: 2018-01-22 17:18:15.0
Homepage: null
Size: 5868
Language: C#
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
The Nuxeo .NET Client is a cross-platform client library developed in C# for the Nuxeo Automation and REST API.
Nuxeo .NET Client targets two platforms: net45
and dotnetcoreapp1.0
. This allows it to be used to develop apps for not only Windows but also Linux and Mac OS.
If you are developing for net45
, build the NuxeoClient_net45 solution on Visual Studio 2015 (or above).
If you are developing for dotnetcoreapp1.0
, run:
rc/NuxeoClient
et restore
et build
In order to build Nuxeo .NET Client, you must have installed the latest LTS of .NET Core 1.0.1 SDK (version 1.0.0-preview2-003133), or .NET 4.5 on a Windows setup.
Download and install .NET Framework 4.5
Visual Studio 2015 (or above) required.
Install .NET Core:
Add the following feeds to NuGet config file:
https://www.myget.org/F/aspnetvnext/
https://www.nuget.org/api/v2/
If you do not yet have a config file, create it on:
For Mac OS & Linux: ~/.config/NuGet/NuGet.config
For Windows: %AppData%/NuGet/NuGet.Config
And paste the following contents:
l version="1.0" encoding="utf-8"?>
figuration>
ackageSources>
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetvnext/" />
<add key="NuGet" value="https://www.nuget.org/api/v2/" />
packageSources>
nfiguration>
If you are using Visual Studio 2015 on Windows, you will need to install Visual Studio Update 3 and .NET Core 1.0.1 tools for Visual Studio Preview 2. Instructions here.
This project includes a Test Compatibility Kit (TCK) covering several tests on the client. In order for the tests to run, there must be an instance of the Nuxeo Server running, with nuxeo-automation-test and nuxeo-jsf-ui installed.
Before building and running the tests, the server's IP address should be updated in the test/TCK/Config.cs file.
Build the version of the TCK you want to test, by either running tools\BuildNetCore.ps1
or tools\BuildNet45.ps1
.
Run the TCK with tools\TestNetCore.ps1
or tools\TestNet45.ps1
On the solution folder, run:
dotnet restore
to download all dependencies
cd test/TCK
to move to the TCK folder
dotnet test
to run all tests
On Visual Studio, run on the Package Manager Console: PM> Install-Package NuxeoClient -Pre
If you are developing for netcoreapp1.0, include NuxeoClient in your project.json file:
.,
ependencies": {
...,
"NuxeoClient": "1.0.0-*"
.
… and run dotnet restore
.
Reference NuxeoClient and NuxeoClient.Wrappers namespaces:
g NuxeoClient;
g NuxeoClient.Wrappers;
Create a new instance of NuxeoClient:
nt client = new Client(); // assuming server running on localhost:8080
Create a folder named “Test Folder 1” on the root:
nt.Operation("Document.Create")
.SetInput("doc:/")
.SetParameter("type", "Folder")
.SetParameter("name", "TestFolder1")
.SetParameter("properties", new ParamProperties { { "dc:title", "Test Folder 1" } })
.Execute();
Please check the tests on test/TCK for more usage examples and the tutorial and the end of this document.
A demo app making use of this client is also available here.
Let's make a quick console app using .NET Core, which creates a folder on the server's root and a child document. This quit tutorial assumes that you have an instance of Nuxeo Server running on your local machine.
Create a new directory for your project named TestNuxeoApp and cd
there
Create a new project.json with dependencies to “System.Console” and “NuxeoClient”. It should look something like this:
ersion": "1.0.0",
escription": "Nuxeo Test App",
uthors": [ "John Doe" ],
uildOptions": {
"emitEntryPoint": true
rameworks": {
"netcoreapp1.0": {
"dependencies": {
"System.Console": "4.0.0",
"NuxeoClient": "1.0.0-beta-13281"
}
}
ependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
g System;
g System.Threading.Tasks;
g NuxeoClient;
g NuxeoClient.Wrappers;
space TestNuxeoApp
public class Program
{
public static void Main(string[] args)
{
// create a new Nuxeo Client, which is a disposable objects
using(var client = new Client())
{
// let's create an async job that doesn't block
Task.Run(async () => {
// perform an async request to create a folder on the root with the title "My Folder"
Document folder = (Document)await client.Operation("Document.Create")
.SetInput("doc:/")
.SetParameter("type", "Folder")
.SetParameter("name", "MyFolder")
.SetParameter("properties", new ParamProperties { { "dc:title", "My Folder" } })
.Execute();
// print the returned folder object if it is not null
Console.WriteLine(folder == null ? "Failed to create folder." : "Created " + folder.Path);
// perform an async request to create a child file named "My File"
Document file = (Document)await folder.Post(new Document {
Type = "File",
Name = "MyFile",
Properties = new Properties { { "dc:title", "My File" } }
});
// print the returned file object if it is not null
Console.WriteLine(file == null ? "Failed to create file." : "Created " + file.Path);
}).Wait(); // let's wait for the task to complete
}
}
}
Restore dependencies by running dotnet restore
Run the app by running dotnet run
Check the server and verify that the documents were created
GNU Lesser General Public License (LGPL) v2.1
Nuxeo dramatically improves how content-based applications are built, managed and deployed, making customers more agile, innovative and successful. Nuxeo provides a next generation, enterprise ready platform for building traditional and cutting-edge content oriented applications. Combining a powerful application development environment with SaaS-based tools and a modular architecture, the Nuxeo Platform and Products provide clear business value to some of the most recognizable brands including Verizon, Electronic Arts, Sharp, FICO, the U.S. Navy, and Boeing. Nuxeo is headquartered in New York and Paris. More information is available at www.nuxeo.com.