- It implements the Etherpad Lite API, more infomation on the API can be found on the Etherpad Lite wiki.
- It matches the API in structure as closely as it can.
- It parses the returned JSON into strongly typed objects to allow the use of intellisense and reduce the use of magic strings.
- The library is written in C# and uses .Net Framework 4.
Download the project and either:
- Include the project in your solution and reference the project
- Place the dll found in bin/release in your bin folder (or wherever you store external libraries) and reference it in your project
Add a using for the Etherpad namespace
using Etherpad;
Create an instance of the EtherpadLiteDotNet class
var ether = new EtherpadLiteDotNet("YourApiKeyHere", "localhost", 9001);
The class constructor has three parameters:
- The API key found in the root of your Etherpad Lite folder.
- The host of your etherpad deployment.
- The port to connect on (this parameter is optional).
After instantiating the class you simply call the methods you want
var getTextReturn = ether.GetText("11");
All objects returned by an API call inherit from EtherpadResponse which has 3 base properties:
- ReturnCode: The code returned by the API (for more info on these see the API wiki). The codes are mapped to an enumeration called EtherpadReturnCodeEnum.
- Message: The message returned by the API, this will either be a success message or a reason the request failed.
- JSON: This is the raw JSON response in case you want to pass the response on.
The API can also return data, this is returned in objects that inherit from the base EtherpadResponse and maps the the JSON structure onto .Net objects, using Generic.IEnumerable collections where needed. Please see the API wiki for more information on the JSON structure returned for each method.
So for example to access the data returned by the GetText() above you would:
string padText = test.Data.Text;
Thanks goes to the PHP API for inspiration: https://github.com/TomNomNom/etherpad-lite-client
2011 Jonathon Smith Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.