Giter Site home page Giter Site logo

kloutsharp's Introduction

KloutSharp

Join the chat at https://gitter.im/danvy/kloutsharp The Klout API for C#

##Introduction Like it or hate it, there's not a lot of tool to measure your impact on social networks. Klout is one of those, check it on http://klout.com. The Klout APIs are pretty simple be a C# implementation will ease your work. I created a portable library so it should be usable for .NET 4.5, Window, Windows Phone, iOS and Android. It relies on Json.NET https://www.nuget.org/packages/Newtonsoft.Json and Microsoft HTTP Client Libraries https://www.nuget.org/packages/Microsoft.Net.Http

##How to use it? First, get a Klout API key http://developer.klout.com/apps/mykeys Then, add the KloutSharp NuGet package to your project https://www.nuget.org/packages/danvy.kloutsharp.lib/
The entry point is the Klout object so create a Klout object

var k = new Klout(key);

Then you might need to get the Klout identifier of your user. You can use any Klout.Identity*Async method depending on the information your currently have (Twitter Id, Google+ Id, etc.).

var identity = await k.IdentityAsync("danvy");
Console.WriteLine(string.Format("Your Klout Id is {0}", identity.Id));

Once you have the Klout Id, you can keep it forever. Now you can call the other APIs such as UserAsync to get user informations

var user = await k.UserAsync(kloutId);
Console.WriteLine(string.Format("Klout user nick={0} score={1}", user.Nick, user.Score.Score));

A sample app with full source code is provided.

##What's new? 1.0.3 Supports Windows Universal Platform

1.0 Initial release. Supports all Klout API available on http://api.klout.com/v2/ on 2015-02-01

##Q&A

Q: What are the validated platforms?

Console app on Windows 8.1 by @danvy on 2015-02-01

If you have any problem with the scripts, use GitHub or contact me on Twitter http://twitter.com/danvy

kloutsharp's People

Contributors

danvy avatar gitter-badger avatar

Stargazers

Troy Willmot avatar

Watchers

 avatar James Cloos avatar

kloutsharp's Issues

Null/Empty Key Handling

Just noticed while browsing the source that the Klout class allows construction with a null or blank key, but will then throw an KloutException when any of the methods are called. It also appears the only way to set the key is via the constructor, so you can't fix the problem after the instance is created.

Have I missed something? While it would be a breaking change at this point, would it not be better to throw an Argument or ArgumentNull exception from the constructor on an invalid key, rather than throwing a KloutException sometime later when it's all too late anyway?

Inefficient Http Client Usage

KloutSharp is generally great, however I believe there is some inefficient usage of System.Net.HttpClient. Issues include;

  • Cannot inject an instance of HttpClient (or factory), so cannot apply modifying libaries such as https://github.com/paulcbetts/ModernHttpClient or https://github.com/paulcbetts/Fusillade
  • A new HttpClient instance is created for each call. HttpClient is designed to be re-used, with an internal connection pool (https://msdn.microsoft.com/en-us/library/system.net.http.httpclient(v=vs.110).aspx) being maintained to improve performance. Creating a new client each time defeats the connection pooling.
  • HttpClient instances are not disposed, therefore potentially, temporarily, leaking the pooled connections until garbage collection.
  • GZip compression is not enabled by default on platforms that support it.
  • The library does not use ConfigureAwait(false) on async calls, even though it does not appear to require any sort of thread affinity within the library. This adds a little overhead to each async call.

Can't Use from UWP Project

Hi,

It seems the Nuget published version can't be used from a UWP project. The nuget package installs, but no namespaces or classes show up. Obviously I can work around this by including the source or making my own fork etc, but I would prefer to use the officlal nuget package to make future updates etc easy. Is there any possibility of a published update that supports UWP projects?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.