This is the .NET API wrapper for the Loklak server (http://loklak.org).
##Installation To install LoklakDotNet, run the following command in the Package Manager Console.
Install-Package LoklakDotNet
You can also search for loklak
in the Nuget Package Manager.
###Supported Platforms
- .NET Framework 4.5
- ASP.NET Core 5.0
- Windows 8/8.1
- Windows Universal (UWP)
- Windows Phone 8.1
- Windows Phone Silverlight 8.1
- Xamarin.Android
- Xamarin.iOS
- Xamarin.iOS (Classic)
##How to use See the LoklakDotNetTests project for usage examples. async/await pattern is followed. All methods output the raw JSON string response. Parse the JSON using a JSON parser of your choice. Examples in LoklakDotNetTests use Newtonsoft.JSON. For documentation on the API, go here.
LoklakDotNet
Initializes the Loklak API wrapper
Name | Type | Description |
---|---|---|
apiUrl | System.String | Optional API Url |
Loklak loklak = new Loklak();
or Loklak loklak = new Loklak("http://myloklakapp/api/");
This servlet provides geocoding of place names to location coordinates and also reverse geocoding of location coordinates to place names.
Name | Type | Description |
---|---|---|
places | System.Collections.Generic.IList{System.String} | List of place names |
var places = new List<string>();
places.Add("Delhi");
places.Add("Berlin");
var result = await loklak.geocode(places);
The hello servlet is part of the loklak peer-to-peer bootstrap process and shall be used to announce that a new client has been started up. The hello request is done automatically after a loklak startup against the loklak backend as configured in the settings in field backend. The back-end server then does not return any data, just an 'ok' string object.
{"status":"ok"}
This method has no parameters.
var result = await loklak.hello();
This servlet provides an image with text on it.
Image object in string
Name | Type | Description |
---|---|---|
text | System.String | text to be printed, markdown possible |
color_text | System.String | text color |
color_background | System.String | background color |
padding | System.Int32 | space around text |
uppercase | System.Boolean |
var result = await loklak.markdown("hello");
This servlet combined the result of the hello calls from all peers and provides a list of addresses where the remote peers can be accessed.
This method has no parameters.
var result = await loklak.peers();
Get a search result from the server
Name | Type | Description |
---|---|---|
q | LoklakDotNet.LoklakSearchTerm | query term |
count | System.Int32 | the wanted number of results |
source | System.String | the source for the search cache |
fields | System.Collections.Generic.IList{System.String} | aggregation fields for search facets |
limit | System.Int32 | a limitation of number of facets for each aggregation |
timeZoneOffset | System.Int32 | offset applied on since:, until: and the date histogram |
var st = new LoklakSearchTerm(); //See LoklakSearchTerm properties for more options
st.terms = "loklak";
var result = await loklak.search(st);
The status servlet shows the size of the internal Elasticsearch search index for messages and users. Furthermore, the servlet reflects the current browser clients settings in the client_info.
This method has no parameters.
var result = await loklak.status();
This servlet provides the retrieval of user followers and the accounts which the user is following.
Name | Type | Description |
---|---|---|
screen_name | System.String | The screen name of the Twitter user without "@" |
follower_count | System.Int32 | The maximum number of follower profiles to be fetched |
following_count | System.Int32 | The maximum number of following profiles to be fetched |
var result = await loklak.user("loklak_app", <max-follower-count>, <max-following-count>);
LoklakDotNet
Constructs a search term for the Loklak.search() method
##Contact Contact @aneeshd16 on Twitter or at me@aneesh.xyz