0.0.1 • Published 6 years ago

extra-life-node v0.0.1

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

extra-life-node

This is a clone of https://github.com/ammuench/extra-life-api

noed-extra-life is a node module to integrate with the extra-life API, and extends it to provide additional info where possible.

Installation


You can install the repo through NPM

npm i extra-life-node
import { getTeamInfo, getTeamDonations } from 'extra-life-node';
import * as extraLifeAPI from 'extra-life-node';

API


Team & Participant IDs Parameters

Every method on the module will require an individual's 'Participant ID' or a team's 'Team ID'. These can be found by going to your personal profile page or team profile page, and checking the end of the URL:

Participant ID

extra-life.org/index.cfm?fuseaction=donordrive.participant&participantID=PARTICIPANT ID HERE

Team ID

extra-life.org/index.cfm?fuseaction=donorDrive.team&teamID=TEAM ID HERE

Methods

  • getUserInfo( participantId )

    • Takes participantId as a parameter
    • Returns a basic object of user info

    Returned object

    { 
      displayName: 'Joe Smith',
      fundraisingGoal: 400,
      participantID: 506571,
      teamName: 'My Awesome Team',
      eventName: 'Extra Life 2018',
      avatarImageURL: 'https://assets.donordrive.com/extralife/images/$avatars$/constituent_42BB6E88-C292-13D6-00FFFD8987560FD1538.jpg',
      createdDateUTC: '2018-06-15T19:18:15.77+0000',
      eventID: 539,
      sumDonations: 250,
      teamID: 38961,
      isTeamCaptain: false,
      numDonations: 17,
      donateURL: 'https://www.extra-life.org/index.cfm?fuseaction=donate.participant&participantID=506571',
      teamURL: 'https://www.extra-life.org/index.cfm?fuseaction=donorDrive.team&teamID=38961' 
    }
  • getUserDonations( participantId, limit?, page?)

    • Takes participantId as a parameter. limit and page are optional parameters. Page size is equal to your limit value.
    • Returns information on page and count, and an array of donations, ordered from newest to oldest

    Returned object

    {
      countDonations: 73,
      countPages: 1,
      donations: [
        { 
          displayName: 'Tony Stark',
          message: 'Great job!',
          participantID: 681675,
          amount: 25,
          donorID: '5D4DBFFF-B861-D42E-05E6F2B574189698F',
          avatarImageURL: '//assets.donordrive.com/clients/extralife/img/avatar-constituent-default.gif',
          createdDateUTC: '2018-09-04T04:54:16.953+0000'
        },
      ]
    }
  • getTeamInfo(teamId, fetchRoster?)

    • Takes teamId as a parameter and an optional fetchRoster boolean (defaults to TRUE)
    • Returns a promise that contains an object with the basic team info and it's full roster (if fetchRoster is set to TRUE)
    • Roster returns as array of user objects

    Returned object

    { 
      fundraisingGoal: 50000,
      eventName: 'Extra Life 2018',
      avatarImageURL: 'http://assets.donordrive.com/extralife/images/$event539$/avatar_team_38961.jpg',
      createdDateUTC: '2018-01-20T04:51:25.97+0000',
      eventID: 539,
      sumDonations: 1469,
      teamID: 38961,
      name: 'Extra Life Nerds',
      numDonations: 51,
      teamURL: 'https://www.extra-life.org/index.cfm?fuseaction=donorDrive.team&teamID=38961' },
      members: [
        { displayName: 'Alex Muench',
          fundraisingGoal: 1000,
          participantID: 320706,
          teamName: 'Extra Life Nerds',
          eventName: 'Extra Life 2018',
          avatarImageURL: 'https://assets.donordrive.com/extralife/images/$avatars$/constituent_0C07ECD7-C293-34EB-45A3F7B77F8BA043.jpg',
          createdDateUTC: '2018-09-06T20:14:48.0+0000',
          eventID: 539,
          sumDonations: 0,
          teamID: 38961,
          isTeamCaptain: false,
          numDonations: 0,
          profileURL: 'https://www.extra-life.org/index.cfm?fuseaction=donorDrive.participants&participantID=320706',
          URL: 'https://www.extra-life.org/index.cfm?fuseaction=donorDrive.participant&participantID=320706'
        }
      ]
    }
  • getTeamRoster(teamId)

    • Takes teamId as a parameter
    • Returns information on page and count and an array of team members Returned object
      { 
        countMembers: 73,
        countPages: 1,
        members: [
          { displayName: 'Alex Muench',
            fundraisingGoal: 1000,
            participantID: 320706,
            teamName: 'Extra Life Nerds',
            eventName: 'Extra Life 2018',
            avatarImageURL: 'https://assets.donordrive.com/extralife/images/$avatars$/constituent_0C07ECD7-C293-34EB-45A3F7B77F8BA043.jpg',
            createdDateUTC: '2018-09-06T20:14:48.0+0000',
            eventID: 539,
            sumDonations: 0,
            teamID: 38961,
            isTeamCaptain: false,
            numDonations: 0,
            profileURL: 'https://www.extra-life.org/index.cfm?fuseaction=donorDrive.participants&participantID=320706',
            URL: 'https://www.extra-life.org/index.cfm?fuseaction=donorDrive.participant&participantID=320706'
          }
        ]
      }
  • getTeamDonations( teamId, limit, page )

    • Takes teamId as a parameter. limit and page are optional parameters. Page size is equal to your limit value.
    • Returns information on page and count, and an array of donations given to the team, ordered from newest to oldest
    • NOTE ExtraLife's API includes registrations as donations in this view. Donations of "null" are a user signing up for a team. Donations of 19 (assumedly) are users signing up as a Platinum User.

      Returned object

      ```javascript
      {
        countDonations: 73,
        countPages: 1,
        donations: [
          { 
            displayName: 'Joe Smith',
            message: null,
            participantID: 55555,
            amount: 19,
            donorID: 'ASDFF-AB7F-8295-1283655555F38D6D',
            avatarImageURL: '//assets.donordrive.com/extralife/images/$avatars$/constituent_ASDFF-AB7F-8295-1283655555F38D6D.jpg',
            createdDateUTC: '2018-01-22T14:39:04.783+0000',
            teamID: 38961 
          },
          {  
            displayName: 'Joan Smith',
            message: null,
            participantID: 55555,
            amount: 19,
            donorID: 'ASDFF-AB7F-8295-1283655555F38D6D',
            avatarImageURL: '//assets.donordrive.com/extralife/images/$avatars$/constituent_ASDFF-AB7F-8295-1283655555F38D6D.jpg',
            createdDateUTC: '2018-01-20T18:15:20.607+0000',
            teamID: 38961
          },
          { 
            displayName: 'Joey Smith',
            message: null,
            participantID: 55555,
            amount: 19,
            donorID: 'ASDFF-AB7F-8295-1283655555F38D6D',
            avatarImageURL: '//assets.donordrive.com/extralife/images/$avatars$/constituent_ASDFF-AB7F-8295-1283655555F38D6D.jpg',
            createdDateUTC: '2018-01-20T17:47:14.630+0000',
            teamID: 38961 
          }
        ]
      }
      ```

      License


The MIT License (MIT)