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));
You can get your API key from your partner dashboard. Keep your API key secure and never expose it in client-side code. The SDK today focuses on Marketplace; financial services are available via REST, with broader SDK coverage on the roadmap.
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 tractorsgetTractorDetail(tractorId)- Get detailed information about a specific tractor
Farms
getFarms()- Retrieve a list of farmsgetFarmDetail(farmId)- Get detailed information about a specific farm
Farmers
getFarmers()- Retrieve a list of farmersgetFarmerDetail(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.
Get started
Tell us what you are building and we will align on API access and telemetry integration.