Skip to content

daniel-sim/oDesk-API-C--library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

-------------------------------

A C# library for the oDesk API
-------------------------------

Maintained by Daniel Sim (me@danielsim.co.uk), contributions welcome.



~ Overview ~

Currently demonstrates how to authenticate a user using OAuth, then query the oDesk API on their behalf.

It's a work in progress with only two working API methods. If you use this library and add other methods, please contribute your source to the project.

Uses the DotNetOpenAuth package installable through NuGet.

I've substituted the InMemoryTokenManager in my production code with one using Entity Framework.


~ To be done ~

- Split API methods out, add more to cover the whole API

- Example project

- Separate unit test project (currently within my own project)

...all help appreciated!


~ Example usage ~

Simple example using MVC and a custom token manager based on the entity framework:


        public virtual ActionResult Index(ODeskAuthModel m)
        {
            var tokenManager = new ODeskTokenManager();

            var odesk = new WebConsumer(ODeskConsumer.ServiceDescription, tokenManager);

            var accessTokenResponse = odesk.ProcessUserAuthorization();
            if (accessTokenResponse != null) //Authorised
            {
                m.AccessToken = accessTokenResponse.AccessToken;
                m.Result = ODeskConsumer.GetTeams(odesk, m.AccessToken).ToString();
            }
            else if (m.AccessToken == null)
            {
                // If we don't yet have access, immediately request it.
                ODeskConsumer.RequestAuthorization(odesk);
            }

            return View(m);
        }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages