LegiScan API Pull Interface Class
Basic pull class to generate API requests and decode the JSON responses. Doing
something interesting with the results is the job of LegiScan_Process.
Each get*() function maps to the corresponding API operation, preparing the
request array and processing through LegiScan_Pull::apiRequest().
Methods summary
public
|
#
__construct( string $api_key,… )
Class constructor that nominally validates the API key
Class constructor that nominally validates the API key
Parameters
- $api_key,…
- (OPTIONAL) Override the api_key from LegiScan::getConfig()
Throws
|
public
array
|
#
getSessionList( string $state )
Get a session list for a specified state
Get a session list for a specified state
Parameters
- $state
- State to pull the session list for
Returns
array The list of state sessions and their corresponding session_id numbers
|
public
array
|
#
getMasterList( integer $session_id )
Get a master list of bills for a specific session_id
Get a master list of bills for a specific session_id
Parameters
- $session_id
- LegiScan session_id to pull the master list for
Returns
array The master list of current bills with their corresponding bill_id numbers
|
public
array
|
#
getMasterListRaw( integer $session_id )
Get a master list of bills for a specific session_id optimized for
change_hash detection
Get a master list of bills for a specific session_id optimized for
change_hash detection
Parameters
- $session_id
- LegiScan session_id to pull the master list for
Returns
array The master list of current bills with their corresponding bill_id numbers
|
public
array
|
#
getBill( integer $bill_id )
Get the bill detail record for a specified bill
Get the bill detail record for a specified bill
Parameters
- $bill_id
- The internal bill id for the requested bill
Returns
array The record containing a summary of the bill detail information
|
public
array
|
#
getBillText( integer $text_id )
Get a copy of the bill text for the specified document id
Get a copy of the bill text for the specified document id
(Note: doc is base64 encoded)
Parameters
- $text_id
- The internal bill id for the requested bill text
Returns
array The bill text record with the actual text and meta type information
|
public
array
|
#
getAmendment( integer $amendment_id )
Get a copy of the bill amendment for the specified amendment id
Get a copy of the bill amendment for the specified amendment id
(Note: doc is base64 encoded)
Parameters
- $amendment_id
- The internal amendment id for the requested bill amendment
Returns
array The bill amendment record with the actual amendment and meta type information
|
public
array
|
#
getSupplement( integer $supplement_id )
Get a copy of the bill supplement for the specified supplement id
Get a copy of the bill supplement for the specified supplement id
(Note: doc is base64 encoded)
Parameters
- $supplement_id
- The internal supplement id for the requested bill supplement
Returns
array The bill supplement record with the actual supplement and meta type information
|
public
array
|
#
getRollCall( integer $roll_call_id )
Get the roll call record for a specified bill with vote summary and
individual legislator vote information
Get the roll call record for a specified bill with vote summary and
individual legislator vote information
Parameters
- $roll_call_id
- The internal LegiScan roll_call_id for the requested vote
Returns
array A detailed roll call record with individual vote data
|
public
array
|
#
getPerson( integer $people_id )
Get a basic people record for the specified id
Get a basic people record for the specified id
Parameters
Returns
array The basic sponsor information for the given people_id
|
public
array
|
#
getSearch( array $search )
Performs a search against the LegiScan national legislative database
Performs a search against the LegiScan national legislative database
Parameters
- $search
An associative array with the search parameters: state, bill,
query, year
Returns
array A page of search results for the given query parameters
Throws
|
public
array
|
#
getSearchRaw( array $search )
Performs a raw search against the LegiScan national legislative database
Performs a raw search against the LegiScan national legislative database
Parameters
- $search
An associative array with the search parameters: state, bill,
query, year
Returns
array A page of search results for the given query parameters
Throws
|
public
array
|
#
getDatasetList( array $filter )
Get a list of available datasets with optional filters
Get a list of available datasets with optional filters
Parameters
- $filter
- Optional state and year filters
Returns
array The list of datasets available and their corresponding access keys
|
public
array
|
#
getDataset( integer $session_id, string $access_key )
Get a dataset archive payload for a specific session id
Get a dataset archive payload for a specific session id
Parameters
- $session_id
- The internal LegiScan session_id to be retrieved
- $access_key
- A valid access key provided in getDatasetList
Returns
array The dataset payload with the actual zip file and meta information
|
public
array
|
#
getSessionPeople( integer $session_id )
Retrieve a list of people records active in a specific session id
Retrieve a list of people records active in a specific session id
Parameters
- $session_id
- The internal LegiScan session_id to scan
Returns
|
public
array
|
#
getMonitorList( array $filter )
Retrieve a list of bills monitored in the GAITS account associated with the
API key
Retrieve a list of bills monitored in the GAITS account associated with the
API key
Parameters
- $filter
- An associative array with the filter parameters:
record
Returns
array Information on the list of monitored bills
|
public
array
|
#
getMonitorListRaw( array $filter )
Retrieve a list of bills monitored in the associated GAITS account, optimized for
change_hash detection
Retrieve a list of bills monitored in the associated GAITS account, optimized for
change_hash detection
Parameters
- $filter
- An associative array with the filter parameters:
record
Returns
array Information on the list of monitored bills
|
public
array
|
#
setMonitor( array $monitor )
Set the monitoring status of one or more bill_id in the GAITS account
monitoring or ignore list
Set the monitoring status of one or more bill_id in the GAITS account
monitoring or ignore list
Parameters
- $monitor
An associative array with the monitor parameters:
action - action to take: monitor, ignore, remove
list - bill_id list to operate on
stance - position on bill: watch, support, oppose
Returns
array Information on the list of monitored bills
|
protected
mixed[]
|
#
apiRequest( string $op, array $params )
Makes the actual request to the LegiScan API server via cURL
Makes the actual request to the LegiScan API server via cURL
Parameters
- $op
- The API operation to actually perform
- $params
An associative array of the required parameters to perform the
needed API operation
Returns
mixed[] An associative array representing the API response
Throws
|
public
boolean
|
#
importBillList( array $bills, LegiScan_Process $logic )
Process a bill_id list processing and requesting any necessary missing child objects
Process a bill_id list processing and requesting any necessary missing child objects
Parameters
- $bills
$payload
List of the LegiScan bill_ids that should be imported
- $logic
- An instance of
LegiScan_Process attached to its database
Returns
boolean Indicating the success/failure of bill payload processing
|
public
string
|
|
public
string
|
|
public
string
|
#
getCacheFilename( string $op, array $params )
Generate an API cache filename
Generate an API cache filename
Parameters
- $op
- The API operation hook name
- $params
- The API paramaters that were part of the call
Returns
string Filename path fragment for the cache location under cache root
|