import { HttpClient, HttpParams } from '@angular/common/http'; import { Injectable, inject } from '@angular/core'; import { Observable } from 'rxjs'; import { DataPage } from './api.types'; /** GET /data/: rows actually stored in the destination database. */ @Injectable({ providedIn: 'root' }) export class DataApi { private readonly http = inject(HttpClient); page(target: string, limit: number, offset: number): Observable { const params = new HttpParams().set('limit', limit).set('offset', offset); return this.http.get(`/data/${encodeURIComponent(target)}`, { params }); } }