import { Injectable } from '@angular/core'; import { HttpClient, HttpResponse } from '@angular/common/http'; import { Observable } from 'rxjs'; import { SERVER_API_URL } from 'app/app.constants'; import { createRequestOption } from 'app/shared/util/request-util'; import { IStep } from 'app/shared/model/productmanager/step.model'; type EntityResponseType = HttpResponse; type EntityArrayResponseType = HttpResponse; @Injectable({ providedIn: 'root' }) export class StepService { public resourceUrl = SERVER_API_URL + 'services/productmanager/api/steps'; constructor(protected http: HttpClient) {} create(step: IStep): Observable { return this.http.post(this.resourceUrl, step, { observe: 'response' }); } update(step: IStep): Observable { return this.http.put(this.resourceUrl, step, { observe: 'response' }); } find(id: string): Observable { return this.http.get(`${this.resourceUrl}/${id}`, { observe: 'response' }); } query(req?: any): Observable { const options = createRequestOption(req); return this.http.get(this.resourceUrl, { params: options, observe: 'response' }); } delete(id: string): Observable> { return this.http.delete(`${this.resourceUrl}/${id}`, { observe: 'response' }); } }