Skip to content

A Node.js client for interacting with the DropCatch.com API written with support for typescript.

License

Notifications You must be signed in to change notification settings

develanet/dropcatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DropCatch API Client for Javascript & Typescript

This unofficial package is a Node.js client library for interacting with the DropCatch.com API. This library provides convenient methods for accessing DropCatch's services, including auctions, bids, backorders, and history.

Table of Contents

Installation

Install the library using npm:

npm install dropcatch

or using yarn:

yarn add dropcatch

Features

  • Authorization: Obtain and manage access tokens for interacting with the DropCatch API.
  • Auctions: Retrieve auction information, search for auctions, and fetch bid history.
  • Bids: Manage bids, including placing new bids.
  • Backorders: Create, retrieve, and cancel backorders.
  • History: Access historical data for auctions and backorders.

Usage

Installation in JavaScript and TypeScript

JavaScript:

const DropCatchClient = require("dropcatch").default;

const client = new DropCatchClient();

TypeScript:

import DropCatchClient from "dropcatch";

const client = new DropCatchClient();

Authorization

Authorize the client using your credentials to obtain an access token.

async function authorizeClient() {
  const credentials = {
    clientId: "your_client_id",
    clientSecret: "your_client_secret",
  };

  try {
    const { token } = await client.authorize(credentials);

    console.log("Access token obtained:", token);

    // Start making calls here
  } catch (error) {
    console.error("Authorization failed:", error);
  }
}

authorizeClient();

Auctions

Retrieve a specific auction by its ID or search for active auctions.

async function fetchAuctions() {
  try {
    const credentials = {
      clientId: "your_client_id",
      clientSecret: "your_client_secret",
    };

    const { token } = await client.authorize(credentials);

    const auction = await client.getAuction(12345);
    console.log("Auction Details:", auction);

    const auctions = await client.getAuctions({ searchTerm: "example" });
    console.log("Active Auctions:", auctions);
  } catch (error) {
    console.error("Error fetching auctions:", error);
  }
}

fetchAuctions();

Bids

Fetch bids and place new bids.

async function manageBids() {
  try {
    const bids = await client.getBids();
    console.log("Your Bids:", bids);

    const newBids = [{ auctionId: 12345, bidAmount: 100 }];
    const response = await client.placeBids(newBids);
    console.log("Place Bid Response:", response);
  } catch (error) {
    console.error("Error managing bids:", error);
  }
}

manageBids();

Backorders

Create, retrieve, and cancel backorders.

async function manageBackorders() {
  try {
    const backorders = await client.getBackorders();
    console.log("Active Backorders:", backorders);

    const newBackorders = [{ domain: "example.com", type: "public" }];
    const response = await client.createBackorders(newBackorders);
    console.log("Create Backorder Response:", response);

    const cancelResponse = await client.cancelBackorders(["example.com"]);
    console.log("Cancel Backorder Response:", cancelResponse);
  } catch (error) {
    console.error("Error managing backorders:", error);
  }
}

manageBackorders();

History

Access historical data for auctions and backorders.

async function fetchHistory() {
  try {
    const auctionHistory = await client.getAuctionHistory({
      searchTerm: "example",
    });
    console.log("Auction History:", auctionHistory);

    const backorderHistory = await client.getBackorderHistory({
      searchTerm: "example",
    });
    console.log("Backorder History:", backorderHistory);
  } catch (error) {
    console.error("Error fetching history:", error);
  }
}

fetchHistory();

Contributing

Contributions are welcome! Please follow the guidelines outlined in the CONTRIBUTING.md file.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A Node.js client for interacting with the DropCatch.com API written with support for typescript.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published