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

@interep/api

v0.8.0

Published

A JS library to wrap the APIs from the Interep reputation service.

Downloads

52

Readme

Interep provides HTTP endpoints to interact with the reputation service. This library allows you to use those APIs with a simple JavaScript library.


🛠 Install

NPM or Yarn

Install the @interep/api package with npm:

npm i @interep/api --save

or yarn:

yarn add @interep/api

CDN

You can also load it using a script tag using unpkg:

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://unpkg.com/@interep/api/"></script>

or JSDelivr:

<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@interep/api/"></script>

📜 Usage

# new API(network: Network): API

import { API } from "@interep/api"

const api = new API()
const goerliApi = new API("goerli")
const kovanApi = new API("kovan")
const localApi = new API("local")

console.log(api.url) // "https://app.interep.link/api/v1"
console.log(goerliApi.url) // "https://goerli.interep.link/api/v1"
console.log(kovanApi.url) // "https://kovan.interep.link/api/v1"
console.log(localApi.url) // "http://localhost:3000/api/v1"

# api.getProviders(): Promise<string[]>

const providers = await api.getProviders()

API: api/v1/providers

# api.getGroups(): Promise<any[]>

const groups = await api.getGroups()

API: api/v1/groups

# api.getGroup(parameters: GetGroupRequest): Promise<any>

const group = await api.getGroup({
    provider: "twitter",
    name: "gold"
})

API: /api/v1/groups/:provider/:name

# api.getGroupMembers(parameters: GetGroupMembersRequest): Promise<string[]>

const members = await api.getGroupMembers({
    provider: "twitter",
    name: "gold",
    limit: 1,
    offset: 1
})

API: /api/v1/groups/:provider/:name/members

# api.hasMember(parameters: HasMemberRequest): Promise<boolean>

// For any provider group.
const hasMember = await api.hasMember({
    provider: "twitter",
    member: "1231231..."
})

API: /api/v1/providers/:provider/:member

// For specific group.
const hasMember = await api.hasMember({
    provider: "twitter",
    name: "gold",
    member: "1231231..."
})

API (method: get): /api/v1/groups/:provider/:name/:member

# api.addMember(parameters: AddMemberRequest): Promise<boolean>

// For Web2 providers.
await api.addMember({
    provider: "twitter",
    name: "gold",
    member: "1231231...",
    authenticationHeader: "token <OAuth-token>"
})
// For Web3 providers.
await api.addMember({
    provider: "poap",
    name: "devcon4",
    member: "1231231...",
    userAddress: "0xueaoueao",
    userSignature: "aueouaoe"
})

API (method: post): /api/v1/groups/:provider/:name/:member

# api.getMerkleTreeProof(parameters: GetMerkleTreeProofRequest): Promise<any>

const proof = await api.getMerkleTreeProof({
    provider: "twitter",
    name: "gold",
    member: "1231231..."
})

API: /api/v1/groups/:provider/:name/:member/proof

# api.getMerkleTreeLeaves(parameters: GetMerkleTreeLeavesRequest): Promise<string[]>

const leaves = await api.getMerkleTreeLeaves({
    root: "1212121...",
    limit: 10
})

API: /api/v1/trees/:root

# api.hasMerkleTreeLeaf(parameters: HasMerkleTreeLeafRequest): Promise<boolean>

const hasMerkleTreeLeaf = await api.hasMerkleTreeLeaf({
    root: "1212121...",
    leaf: "2122131..."
})

API: /api/v1/trees/:root/:leaf

# api.getMerkleTreeRootBatches(): Promise<any[]>

const rootBatches = await api.getMerkleTreeRootBatches()

API: /api/v1/batches

# api.getMerkleTreeRootBatch(parameters: GetMerkleTreeRootBatchRequest): Promise<any>

const rootBatch = await api.getMerkleTreeRootBatch({
    root: "1212121..."
})

API: /api/v1/batches/:root