Hello Tractor SDK

The hello-tractor-sdk is a TypeScript-based software development kit designed to interface with Hello Tractor's API, allowing developers to build integrations and services around tractor bookings and management. This SDK provides a simple and robust interface for accessing available tractors, fetching tractor details, and more.

Getting started

The SDK is designed with developers in mind, offering strong TypeScript support, flexible authentication, and a modular design that lets you use only the parts you need.

Features

  • API Integration: Easily interact with Hello Tractor's API to manage tractors, farms, and farmers
  • TypeScript Support: Strongly typed for safer and more reliable code
  • Flexible Authentication: Initialize the SDK with an API key to authenticate requests
  • Modular Design: Use only the parts of the SDK you need

Installation

You can install the SDK via npm or pnpm:

npm install hello-tractor-sdk

Basic usage

After installation, you can use the SDK in your project. First, initialize the SDK with your API key:

import { HTSDK } from "hello-tractor-sdk";

const sdk = HTSDK.init("YOUR-API-KEY");

// Get available tractors
sdk
  .getAvailableTractors()
  .then((tractors) => console.log(tractors))
  .catch((error) => console.error(error));

// Get specific tractor details
sdk
  .getTractorDetail("tractor-id")
  .then((tractor) => console.log(tractor))
  .catch((error) => console.error(error));

Next.js integration

The SDK works seamlessly with Next.js applications. Here's an example of how to integrate it:

import { useEffect, useState } from "react";
import { HTSDK } from "hello-tractor-sdk";

export default function TractorList() {
  const [tractors, setTractors] = useState([]);
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    const sdk = HTSDK.init(process.env.NEXT_PUBLIC_HT_API_KEY);

    sdk
      .getAvailableTractors()
      .then((data) => {
        setTractors(data);
        setLoading(false);
      })
      .catch((error) => {
        console.error(error);
        setLoading(false);
      });
  }, []);

  if (loading) return <div>Loading tractors...</div>;

  return (
    <div>
      <h1>Available Tractors</h1>
      {tractors.map((tractor) => (
        <div key={tractor.tractor_id}>
          <h2>{tractor.tractor_name}</h2>
          <p>{tractor.tractor_location.city}</p>
        </div>
      ))}
    </div>
  );
}

Available methods

The SDK provides the following methods to interact with the Hello Tractor API:

Tractors

  • getAvailableTractors() - Retrieve a list of all available tractors
  • getTractorDetail(tractorId) - Get detailed information about a specific tractor

Farms

  • getFarms() - Retrieve a list of farms
  • getFarmDetail(farmId) - Get detailed information about a specific farm

Farmers

  • getFarmers() - Retrieve a list of farmers
  • getFarmerDetail(farmerId) - Get detailed information about a specific farmer

Official libraries

Node.js / TypeScript

Official TypeScript SDK for Hello Tractor API. Strongly typed, modern, and easy to use with Next.js, React, and Node.js applications.

Read more

Python

Python SDK for Hello Tractor API. Coming soon - build powerful integrations with Python.

Read more

PHP

PHP SDK for Hello Tractor API. Coming soon - integrate Hello Tractor into your PHP applications.

Read more

Tell us what you are building and we will align on API access and telemetry integration.

Was this page helpful?