import { APIClient } from "./ApiClient"; export interface OTAUpdate { platform: string; version: string; file_size: number; } export class OTAAPI { /** * Get the list of supported OTA platforms */ static async SupportedPlatforms(): Promise> { return ( await APIClient.exec({ method: "GET", uri: "/ota/supported_platforms", }) ).data; } /** * Upload new OTA firwmare */ static async UploadFirmware( platform: string, version: string, firmware: File ): Promise { const fd = new FormData(); fd.append("firmware", firmware); await APIClient.exec({ method: "POST", uri: `/ota/${platform}/${version}`, formData: fd, }); } /** * Get the list of OTA updates */ static async ListOTAUpdates(): Promise { return ( await APIClient.exec({ method: "GET", uri: "/ota", }) ).data; } }