26 lines
612 B
TypeScript
26 lines
612 B
TypeScript
import { BaseClient } from "@dpu/shared";
|
|
import { printNetworkError } from "@dpu/shared/dist/logger.js";
|
|
|
|
export class TidalClient extends BaseClient {
|
|
async get<T>(endpoint: string): Promise<T> {
|
|
try {
|
|
const response = await this.getAxios().get<T>(`/${endpoint}`);
|
|
|
|
return response.data;
|
|
} catch (error) {
|
|
printNetworkError(error);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
async put<T>(endpoint: string, data: unknown): Promise<T> {
|
|
try {
|
|
const response = await this.getAxios().put<T>(`/${endpoint}`, data);
|
|
return response.data;
|
|
} catch (error) {
|
|
printNetworkError(error);
|
|
throw error;
|
|
}
|
|
}
|
|
}
|