UNPKG

digital-humani-js-sdk

Version:

[![Continuous Integrations](https://github.com/impe93/digital-humani-js-sdk/actions/workflows/continuous-integrations.yaml/badge.svg?branch=main)](https://github.com/impe93/digital-humani-js-sdk/actions/workflows/continuous-integrations.yaml) [![License](

34 lines (29 loc) 846 B
import type { IHttpClient } from '../../services/HttpClient/IHttpClient'; import type { ITreeRepository } from './tree.interface'; import type { GetTreesRequest, GetTreesResponse, GetTreeRequest, Tree, PlanteTreesRequest, } from './tree.models'; export class TreeRepository implements ITreeRepository { constructor(private httpClient: IHttpClient) {} public readonly getTrees = async ({ enterpriseId, user, }: GetTreesRequest) => { return this.httpClient.get<GetTreesResponse>('/tree', { params: { enterpriseId, user, }, }); }; public readonly getTree = ({ treeId }: GetTreeRequest) => { return this.httpClient.get<Tree>(`/tree/${treeId}`); }; public readonly plantTrees = (body: PlanteTreesRequest) => { return this.httpClient.post<Tree>('/tree', { body }); }; }