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

@4lch4/lib-congress

v1.0.1

Published

A library for interacting with the api.congress.gov API.

Downloads

21

Readme

code style: prettier Discord NPM NPM Bundle Size npm (scoped) Build Status

ForTheBadge

@4lch4/Lib-Congress

This package is a wrapper library, written in TypeScript, that enables users to interact with the US Congress API and retrieve the data it makes available.

Architecture

For notes on the architecture/structure of this package/library, please refer to the Architecture.md file.

Testing

In order to verify functionality of the library I built a suite of tests that verify each possible endpoint meets the following requirements:

  • Providing no parameters gets the root endpoint.
  • Providing each of the parameters results in the correct endpoint being called.
    • For example, providing an object like { congress: 117 } to the getAmendments method should result in hitting the /amendment/117 endpoint.
  • Executing a method returns the expected type of object.

For further details, refer to the Testing file.

Usage

To use the library you only need to import the CongressAPI class and call whichever function you wish. For example, to retrieve amendments you can do the following:

import { CongressAPI } from '@4lch4/lib-congress'

const congress = new CongressAPI({
  apiKey: 'pxPXweYA8wObIqUERnVRf2v6d84uOxjJ5MpJ8kgO',
  responseFormat: 'json' as ResponseFormat,
  baseUrl: 'https://api.congress.gov/v3',
  trimmedResponses: true,
  dataDir: 'data',
  debug: false
})

congress
  .getAmendments()
  .then(amendments => {
    console.log(`${amendments.data.length} amendments retrieved...`)
    console.log('Execution completed successfully!')
  })
  .catch(err => {
    console.error('Error received from CongressAPI#getAmendments...')
    console.error(err)
  })

Export Functions

The following is a list of all the functions/methods that are exported by the CongressAPI class:

  • getAmendments
  • getBills
  • getSummaries
  • getCongress
  • getMembers
  • getCommittees
  • getCommitteeReports
  • getCongressionalRecord
  • getHouseCommunications
  • getNominations
  • getTreaties

TODO

  • [ ] Finish implementing remaining endpoints.
    • [x] Bills
    • [ ] Amendments
    • [ ] Committee
    • [ ] Committee Report
    • [ ] Congress
    • [ ] Congressional Record
    • [ ] House Communication
    • [ ] Member
    • [ ] Nomination
    • [ ] Summaries
    • [ ] Treaty