import { Injectable } from '@angular/core' ; import { HttpClient , HttpResponse } from '@angular/common/http' ; import { Observable } from 'rxjs' ; import { ApplicationConfigService } from 'app/core/config/application-config.service' ; import { createRequestOption } from 'app/core/request/request-util' ; import { Pagination } from 'app/core/request/request.model' ; import { IUser } from '../user-management.model' ; @ Injectable ( { providedIn : 'root' } ) export class UserManagementService { private resourceUrl = this . applicationConfigService . getEndpointFor ( 'api/admin/users' ) ; constructor ( private http , private applicationConfigService ) { } create ( user ) { return this . http . post < IUser > ( this . resourceUrl , user ) ; } update ( user ) { return this . http . put < IUser > ( this . resourceUrl , user ) ; } find ( login ) { return this . http . get < IUser > ( `${ this . resourceUrl }/${ login }` ) ; } query ( req ? ) { const options = createRequestOption ( req ) ; return this . http . get < IUser [ ] > ( this . resourceUrl , { params : options , observe : 'response' } ) ; } delete ( login ) { return this . http . delete ( `${ this . resourceUrl }/${ login }` ) ; } authorities ( ) { return this . http . get < string [ ] > ( this . applicationConfigService . getEndpointFor ( 'api/authorities' ) ) ; } }