import {inject, Injectable} from '@angular/core'; import {HttpClient} from '@angular/common/http'; import {Observable} from 'rxjs'; import {ShowsApiResponse} from '../../interfaces/shows-api-response'; import {ShowsApiCreation} from '../../interfaces/shows-api-creation'; import {ShowsApiIdResponse} from '../../interfaces/shows-api-id-response'; import {ShowsApiDeletion} from '../../interfaces/shows-api-deletion'; @Injectable({ providedIn: 'root' }) export class ShowsApiService { private readonly url: string = "https://shows.everest.tailscale/api/"; private showsEndpoint: string private http: HttpClient = inject(HttpClient); constructor() { this.showsEndpoint = this.url + "shows/" } getShows(): Observable { return this.http.get(this.showsEndpoint) } getShow(id: string): Observable { return this.http.get(this.showsEndpoint + "id/" + id ) } sendShow(newShow: {}) { return this.http.post(this.showsEndpoint, newShow) } deleteShw(id: string): Observable { return this.http.delete(this.showsEndpoint + "id/" + id) } }