Resources
Resources provide access to StoreHub API endpoints. Each resource corresponds to a REST entity.
ProductResource
Manage products in your StoreHub store.
Methods
list()
Fetch all products.
const products = await client.product.list();Returns: Promise<Product[]>
getById(id)
Fetch a product by ID.
const product = await client.product.getById("product-id");Parameters:
id- Product ID
Returns: Promise<Product | null> - Returns null if not found
CustomerResource
Manage customers in your StoreHub store.
Methods
list(params?)
Fetch customers with optional filters.
// Get all customers
const customers = await client.customer.list();
// Filter by first name
const customers = await client.customer.list({ firstName: "John" });
// Filter by phone
const customers = await client.customer.list({ phone: "0815494024" });
// Multiple filters (AND logic)
const customers = await client.customer.list({
firstName: "John",
phone: "0815494024",
});Parameters:
params(optional) - Filter parameters:firstName- Filter by first name (begins with)lastName- Filter by last name (begins with)email- Filter by email (contains)phone- Filter by phone (contains)
Returns: Promise<Customer[]>
getByRefId(refId)
Fetch a customer by reference ID.
const customer = await client.customer.getByRefId("customer-ref-id");Parameters:
refId- Customer reference ID
Returns: Promise<Customer | null> - Returns null if not found
TransactionResource
Manage transactions in your StoreHub store.
Methods
list(params?)
Fetch transactions with optional filters.
// Get all transactions
const transactions = await client.transaction.list();
// Filter by date range
const transactions = await client.transaction.list({
startDate: "2024-01-01",
endDate: "2024-12-31",
});Parameters:
params(optional) - Filter parameters (see StoreHub API for available query params)
Returns: Promise<Transaction[]>
InventoryResource
Manage inventory/stock levels in your StoreHub store.
Methods
getByStoreId(storeId)
Fetch inventory for a specific store.
const inventory = await client.inventory.getByStoreId("your-store-id");Parameters:
storeId- Store ID
Returns: Promise<Stock[]>
EmployeeResource
Manage employees in your StoreHub store.
Methods
list(params?)
Fetch employees with optional filters.
// Get all employees
const employees = await client.employee.list();
// Filter by modification date
const employees = await client.employee.list({
modifiedSince: new Date("2024-01-01"),
});Parameters:
params(optional) - Filter parameters:modifiedSince- Only return employees modified since this date
Returns: Promise<Employee[]>
StoreResource
Manage stores in your StoreHub account.
Methods
list()
Fetch all stores.
const stores = await client.store.list();Returns: Promise<Store[]>
TimesheetResource
Manage employee timesheets.
Methods
list(params?)
Fetch timesheets with optional filters.
// Get all timesheets
const timesheets = await client.timesheet.list();
// Filter by store
const timesheets = await client.timesheet.list({ storeId: "your-store-id" });
// Filter by employee
const timesheets = await client.timesheet.list({
employeeId: "your-employee-id",
});
// Filter by date range
const timesheets = await client.timesheet.list({
from: new Date("2024-01-01"),
to: new Date("2024-12-31"),
});Parameters:
params(optional) - Filter parameters:storeId- Filter by store IDemployeeId- Filter by employee IDfrom- Clock in after this timeto- Clock in before this time
Returns: Promise<Timesheet[]>