Giter Site home page Giter Site logo

node-courtlistener's Introduction

node-courtlistener

A small javascript/nodejs client for CourtListener

Note this is early code, still under development.

Installation

This module is installed via npm:

$ npm install courtlistener

Description

Node-Courtlistener is a client side library for getting cases form CourtListener.

The client follows a chained pattern

API

initialize

  var CLClient = require('courtlistener')
  , courtlistener = new CLClient();

login([username], [password])

Description

Set the login/username for CourtListener

Example
courtlistener.login(username, password)

getCases([array of citation strings]), getCase([citation string])

Description
  • Downloads a case matching the citation string to the current destination path for downloads.
  • If no value is passed, it will use the value that is currently passing down the chain.
  • Will pass the case or array of cases down the chain on completion.
Example
courtlistener
  .login([username], [password])
  .getCases(['140 U.S. 22', '100 U.S. 50'])
  .getCase('50 U.S. 175')

citedBy(), cites() (NOT COMPLETE)

Description
  • Gets an array of case objects from the current case on the chain.
  • If no value is passed, it will use the value that is currently passing down the chain.
  • Will pass the case or array of cases down the chain on completion.
Example
courtlistener
  .login([username], [password])
  .getCase('50 U.S. 175')
  .citedBy()
  .display()
  .run()

getCitations(), getCitation()

Downloads case(s) with citation object(s) from the chain to the current destination path

courtlistener
  .login([username], [password])
  .display('***Running Court Listener Script***')
  .getCase('50 U.S. 175')
  .citedBy()
  .set('cites_50_US_175') // store the cites array
  .getCase('140 U.S. 192')
  .get('cites_50_US_175') //retrieve the array
  .to('cites_50_US_175')
  .getCitations() //then get those cases
  .display()
  .run()

to([path])

Description
  • Sets destination path

set('throttle', [delay])

  • Sets the throttle delay between group requests such as .getCases() or getCitations()
courtlistener
  .login(username, password)
  .display('***Running Court Listener Script***')
  .to('cases')
  .getCase('50 U.S. 175')
  .citedBy()
  .set('throttle', 1000) //set 1 second in between API calls
  .getCases()
  .run()

display([value])

Display [value] to the console, or when no value is passed, display the value currently in the chain.

run([value])

Run the script, passing [value] to the first method in the chain.

Other methods

See http://www.github.com/zornstar/diva for additional methods that can be used with the CourtListener object instance, e.g.:

  • Event Listeners: before, after
  • Storage/Retrieval: set, get
  • Fork: Fork a value off of the chain

Example Usage

var CLClient = require('courtlistener')
  , courtlistener = new CLClient();
courtlistener
  .login([username], [password])
  .display('***Court listener***') //display ***Court listener*** to console
  .login('username', 'password') //login
  .to('386 U.S. 738') //set the destination path for downloaded files
  .getCase('386 U.S. 738') //search for 386 U.S. 738 and download
                          //the case to the destination folder
  .cites() //get all of the cites for '386 U.S. 738'
  .display() //display to the console all of the cites for 386 U.S. 738
  .to('cited_cases') // set the destination path for downloaded files
  .getCitations() // download all of the cited cases for '386 U.S. 738'
  .run()

node-courtlistener's People

Contributors

zornstar avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.