npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@edlink/typescript

v1.0.16

Published

This Edlink JavaScript & TypeScript SDK is a NodeJS wrapper for the Edlink API.

Downloads

12,814

Readme

Edlink Node SDK CI

This Edlink JavaScript & TypeScript SDK is a NodeJS wrapper for the Edlink API.

You can find more thorough documentation on the Edlink SDK Docs.

Get Started

Install

Install the @edlink/typescript package using npm or yarn.

yarn add @edlink/typescript
// Initialize with your Edlink application
// Your credentials can be found on the Edlink Dashboard
import { Edlink } from '@edlink/typescript';

const edlink = new Edlink({
    version: 2,
    client_id: '3a95a779-0ed1-499b-a352-9ea30d0bd5ea',
    client_secret: '[...]'
});

Edlink.up().then(console.log); // Ok

Authorization

// TokenSets are required to access protected resources
// Integration tokens do not expire and therefore dont have a `refresh_token`
// However be sure to store the the `refresh_token` for person token sets
// You are required to provide both when making requests on behalf of a person

export type TokenSet {
    access_token: string;
    refresh_token?: string;
    expires_in?: number;
    type: TokenSetType;
}

export enum TokenSetType = {
    Integration = 'integration',
    Person = 'person'
}

Graph API

// Graph requests are even easier, just build a TokenSet from the values
// in the Edlink Dashboard

const integration_token_set = {
    access_token: '[...]'
};

const district = await edlink.use(integration_token_set).districts.fetch('3a95a779-0ed1-499b-a352-9ea30d0bd5ea');

for await (const district of edlink.use(integration_token_set).districts.list()) {
    console.log(district);
}

User Authentication

// Authenticate a user
// First build your login url to provide to the user.
// This URL doesnt change and can be hardcoded if desired
/**
 * https://ed.link/sso/login
 * ?client_id=[...]
 * &redirect_uri=[...]
 * &state=[...]
 * &response_type=code
 */
// Optionally you may provide a state parameter for Endlink to
// passback to you upon authentication of the user

edlink.loginUrl({ redirect_uri: 'https://oauthdebugger.com/debug' });
// When the user returns to your site you will be provided with a code
// e.g. https://oauthdebugger.com/debug?code=[...]
// Provide this code with the matching `redirect_uri` to recieve a token set

// Store this entire object securely
// You will require more than just the access_token
const person_token_set = await edlink.auth.grant({
    code: '[...]'.
    redirect_uri: 'https://oauthdebugger.com/debug'
});

// You can now make requests on behalf of this user
const profile = await edlink.use(person_token_set).my.profile();