dimanche 13 décembre 2015

Retrieve latest Commit links and message with GitHub Api and Ember

I have reproduced my case with this jsbin http://ift.tt/1YdbStG

Github API allows me to get the list of events by author:

API Link - http://ift.tt/1lGoYE8

I can access to the commit message filtering the events “PushEvent”, and it s perfectly fine because i cam stream my latest commit message.

var gitactivitiesPromise = function() {
  return new Ember.RSVP.Promise(function (resolve) {
    Ember.$.ajax(eventsAct, {
      success: function(events) {
        var result = [];
        events.filter(function(event) {
          return event.type == 'PushEvent';
        }).forEach(function(item){
          item.payload.commits.map(function(commit){
            result.push(store.createRecord('commit', {
              message: commit.message,
            }));
          });


        });
        resolve(result);
      },  
      error: function(reason) {
        reject(reason);
      }
    });
  });
};

The problem is that i want to stream beside the msg also his own url link. html_url

I need to know how i can tackle it? since the commit url links are not in the in the API Link

  • http://ift.tt/1lGoYE8

But they are in the following api

  • http://ift.tt/1lGoWMm

This makes bit more complicate to access to the latest commits url link html_url

This is a good example of what i am trying to do

http://ift.tt/1YdbRpE

It streams in the push events the latest commits message with links




Aucun commentaire:

Enregistrer un commentaire