1.9.8 • Published 14 days ago

@local-logic/client v1.9.8

Weekly downloads
-
License
ISC
Repository
github
Last release
14 days ago

Local Logic Client

The Local Logic Client library provides a JavaScript entry point to Local Logic Scores, Points of Interest, Demographics, Schools, Profiles, and Geographies.

Installation

Npm:

npm install @local-logic/client

Yarn:

yarn add @local-logic/client

Pnpm:

pnpm add @local-logic/client

Getting Started

To use the library, start by creating a new instance by invoking LocalLogicClient with your apiKey. You can generate a apiKey using the locallogic.co/oauth/apiKey API.

Example:

  import LocalLogicClient, { Scores } from "@local-logic/client";

  ...

  const client = LocalLogicClient("<apiKey>");

  let scores: Scores | undefined;

  try {
    scores = await client.getScores({
      lat: 45.532970,
      lng: -73.585600,
      include: ["groceries"]
    });
  } catch (e) {
    // Handle error
  }

Methods

getPois(params: Params) => Promise<POIs>

getScores(params: Params) => Promise<Scores>

getSchools(params: Params) => Promise<Schools>

getGeographies(params: Params) => Promise<Geographies>

getDemographics(params: Params) => Promise<Demographics>

getProfiles(params: Params) => Promise<Profiles>

getLocation(params: Params) => Promise<Location>

Error Handling

You can catch errors by wrapping your method invokations in try / catch. You can handle your errors generically, or if you require more granular control you can make use of the provided typeguards isRequestError and isValidationError.

Example:

import LocalLogicClient, {
  isRequestError,
  isValidationError,
} from "@local-logic/client";

try {
  // Call method
} catch (e) {
  if (isRequestError(e)) {
    // Handle request errors
  }

  if (isValidationError(e)) {
    // Handle validation errors
  }

  // Handle all other errors
}

Typescript

@local-logic/client provides type definitions and typeguards.

1.9.8

14 days ago

1.9.7

1 month ago

1.9.6

1 month ago

1.9.5

2 months ago

1.9.4

3 months ago

1.9.3

3 months ago

1.9.2

4 months ago

1.9.1

7 months ago

1.9.0

7 months ago

1.7.2

9 months ago

1.8.0

7 months ago

1.7.1

9 months ago

1.7.0

9 months ago

1.6.0

12 months ago

1.2.0

1 year ago

1.1.1

1 year ago

1.5.2

1 year ago

1.5.1

1 year ago

1.5.0

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.0-beta.15

2 years ago

1.0.0-beta.13

2 years ago

1.0.0-beta.14

2 years ago

1.0.0-beta.11

2 years ago

1.0.0-beta.12

2 years ago

1.0.0-beta.10

2 years ago

1.0.0-beta.7

2 years ago

1.0.0-beta.8

2 years ago

1.0.0-beta.9

2 years ago

1.0.0-beta.3

2 years ago

1.0.0-beta.2

2 years ago

1.0.0-beta.1

2 years ago

1.0.0-alpha.9

2 years ago

1.0.0-alpha.8

2 years ago

1.0.0-alpha.7

2 years ago

1.0.0-alpha.6

2 years ago

1.0.0-alpha.5

2 years ago

1.0.0-alpha.4

2 years ago

1.0.0-alpha.3

2 years ago

1.0.0-alpha.2

2 years ago

1.0.0-alpha.1

2 years ago