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' ; import { IEvent } from 'app/shared/model/event.model' ; type EntityResponseType = HttpResponse < IEvent > ; type EntityArrayResponseType = HttpResponse < IEvent [ ] > ; @ Injectable ( { providedIn : 'root' } ) export class EventService { public resourceUrl = SERVER_API_URL + 'api/events' ; constructor ( protected http ) { } create ( event ) { return this . http . post < IEvent > ( this . resourceUrl , event , { observe : 'response' } ) ; } update ( event ) { return this . http . put < IEvent > ( this . resourceUrl , event , { observe : 'response' } ) ; } find ( id ) { return this . http . get < IEvent > ( `${ this . resourceUrl }/${ id }` , { observe : 'response' } ) ; } query ( req ? ) { const options = createRequestOption ( req ) ; return this . http . get < IEvent [ ] > ( this . resourceUrl , { params : options , observe : 'response' } ) ; } delete ( id ) { return this . http . delete < any > ( `${ this . resourceUrl }/${ id }` , { observe : 'response' } ) ; } }