Giter Club home page Giter Club logo

healthgraphapi's Introduction

HealthGraphAPI

Runkeeper (HealthGraph) API REST client in .NET Core 2.0.

NOTE: The current project is in development phase, so it is not fully functional. November 2017

Download/Install

Currently, only the source code is available for download from this repository.

git clone https://github.com/yorchideas/HealthGraphAPI.git

In the future, this can be installed using NuGet, by running the following command in the Package Manager Console: PM> Install-Package HealthGraphAPI

Getting started

  1. Ensure you already registered your application in the Runkeeper Partner Portal.
  2. Ensure your project references the HealthGraphAPI.
  3. Perform authorization/authentication flow to request the user to allow access to its Runkeeper information.
using HealthGraphAPI;

namespace HealthGraphAPI.Examples
{
    public class HealthGraphAPIAuthExample
    {
        private readonly HealthGraphAuth auth;
        private readonly HealthGraphClient client;
        private HealthGraphToken token;
        public HealthGraphAPIAuthExample()
        {
            auth = new HealthGraphAuth
            {
                ClientID = "<<your application client_id>>",
                ClientSecret = "<<your application client_secret>>",
                RedirectUri = new Uri("<<your application redirect_uri>>")
            };
            client = new HealthGraphClient(auth);
        }
        private void PerformAuthFlow()
        {
            var authorizeUri = client.BuildAuthorizeUri();
            // TODO: Use a WebBrowser to navigate the URL retrieved in authorizeUri, it can be done manually or by using any WebBrowser control in any supported client-platform (WinForms, WPF, UWP, Xamarin), sign-in to your Runkeeper account and allow the application to access, when finished, the WebBrowser will redirect to the RedirectUri especified, copy the URL and paste in the next part
            var redirectUri = new Uri("<<paste here the URL redirected from WebBrowser>>");
            var result = client.HandleAuthorization(redirectUri); // TODO: When running in a WebBrowser control, use the 'OnNavigation' event (accordingly to the control)
            if (result.Status = HealthGraphAuthStatus.Auhtorized && client.Token != null)
            {
                // TODO: Authorization/authentication flow was successful, now you can store the client.Token values, to use in futher examples
                token = client.Token;
            }
            else
            {
                // TODO: Handle error
            }
        }
    }
}

Build

TODO

Test

TODO

healthgraphapi's People

Contributors

jahernandez-gbm avatar jhquirino avatar

Watchers

 avatar

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.