Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@halal-eats/sdk

A tiny TypeScript SDK for the Halal Eats public API.

npm install @halal-eats/sdk

Quick start

import { HalalEatsClient } from "@halal-eats/sdk";

const client = new HalalEatsClient({
  apiKey: process.env.HALAL_EATS_API_KEY, // optional for public endpoints
});

const response = await client.stores.list({
  search: "Turkish",
  halalStatus: "verified_halal",
});

console.log(response.data);

Configuration

By default, the SDK points at the hosted Halal Eats API:

const client = new HalalEatsClient();

You can point it at another API base URL for local development or self-hosting:

const client = new HalalEatsClient({
  baseUrl: "http://localhost:3000/api/v1",
});

Available methods

  • client.stores.list({ page, limit, search, halalStatus, cuisine, bounds })
  • client.stores.get(id)
  • client.stores.nearby({ lat, lng, radius, limit })
  • client.categories.list()
  • client.stats.get()

Errors

Failed API responses throw HalalEatsError with:

  • status
  • code
  • body
import { HalalEatsClient, HalalEatsError } from "@halal-eats/sdk";

const client = new HalalEatsClient();

try {
  await client.stores.get("missing-id");
} catch (error) {
  if (error instanceof HalalEatsError) {
    console.error(error.status, error.code);
  }
}

Development

npm install
npm run typecheck
npm run build

License

MIT

About

A tiny TypeScript SDK for the Halal Eats public API. Search halal restaurants, find nearby spots, fetch restaurant details, and build halal food discovery apps.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages