Socket
Socket
Sign inDemoInstall

@maxim_mazurok/gapi.client.civicinfo-v2

Package Overview
Dependencies
3
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @maxim_mazurok/gapi.client.civicinfo-v2

TypeScript typings for Google Civic Information API v2


Version published
Weekly downloads
1.2K
decreased by-5.62%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

TypeScript typings for Google Civic Information API v2

Provides polling places, early vote locations, contest data, election officials, and government representatives for U.S. residential addresses. For detailed description please check documentation.

Installing

Install typings for Google Civic Information API:

npm install @types/gapi.client.civicinfo-v2 --save-dev

Usage

You need to initialize Google API client in your code:

gapi.load('client', () => {
  // now we can use gapi.client
  // ...
});

Then load api client wrapper:

gapi.client.load(
  'https://civicinfo.googleapis.com/$discovery/rest?version=v2',
  () => {
    // now we can use:
    // gapi.client.civicinfo
  }
);
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
gapi.client.load('civicinfo', 'v2', () => {
  // now we can use:
  // gapi.client.civicinfo
});

After that you can use Google Civic Information API resources:

/*
Searches for political divisions by their natural name or OCD ID.
*/
await gapi.client.civicinfo.divisions.search({});

/*
List of available elections to query.
*/
await gapi.client.civicinfo.elections.electionQuery({});

/*
Looks up information relevant to a voter based on the voter's registered address.
*/
await gapi.client.civicinfo.elections.voterInfoQuery({address: 'address'});

/*
Looks up political geography and representative information for a single address.
*/
await gapi.client.civicinfo.representatives.representativeInfoByAddress({});

/*
Looks up representative information for a single geographic division.
*/
await gapi.client.civicinfo.representatives.representativeInfoByDivision({
  ocdId: 'ocdId',
});

FAQs

Last updated on 01 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc