freecycle-api
TypeScript icon, indicating that this package has built-in type declarations

1.0.0--.1 • Public • Published

Freecycle API

Library for fetching data from freecycle.org

Install

Add the package:

# npm
npm install freecycle-api

# yarn
yarn add freecycle-api

# pnpm
pnpm add freecycle-api

Usage

The library exports two functions fetchTowns and fetchPosts, which are both fully typed.

import { fetchTowns, fetchPosts } from "freecycle-api";

// Fetch all the towns available on Freecycle
const groupData = await fetchTowns();
// => { groups: { name: string, .. }, .. }

// Fetch all the posts for a given town
const townData = await fetchPosts("BirminghamUK");
// => { posts: { id: string, .. }, .. }

// Example: find all the available offers
const offersInBirmingham = townData.posts.filter(
  ({ type }) => type.const === "FC_POST_OFFER"
);

Readme

Keywords

none

Package Sidebar

Install

npm i freecycle-api

Weekly Downloads

1

Version

1.0.0--.1

License

MIT

Unpacked Size

189 kB

Total Files

14

Last publish

Collaborators

  • insertish