/** Angular Imports */ import { Injectable } from '@angular/core' ; import { HttpClient , HttpParams } from '@angular/common/http' ; /** rxjs Imports */ import { Observable } from 'rxjs' ; /**
 * Shares Service.
 */ @ Injectable ( { providedIn : 'root' } ) export class SharesService { param { HttpClient } http constructor ( private http ) { } param { string } accountId param { boolean } template returns { Observable < any > } getSharesAccountData ( accountId , template ) { const httpParams = new HttpParams ( ) . set ( 'template' , template . toString ( ) ) ; return this . http . get ( `/accounts/share/${ accountId }` , { params : httpParams } ) ; } param { string } clientId param { string } productId returns { Observable < any > } getSharesAccountTemplate ( clientId , productId ? ) { let httpParams = new HttpParams ( ) . set ( 'clientId' , clientId ) ; httpParams = productId ? httpParams . set ( 'productId' , productId ) : httpParams ; return this . http . get ( '/accounts/share/template' , { params : httpParams } ) ; } param { any } sharesAccount returns { Observable < any > } createSharesAccount ( sharesAccount ) { return this . http . post ( '/accounts/share' , sharesAccount ) ; } param { string } accountId param { any } sharesAccount returns { Observable < any > } updateSharesAccount ( accountId , sharesAccount ) { return this . http . put ( `/accounts/share/${ accountId }` , sharesAccount ) ; } param { string } accountId returns { Observable < any > } deleteSharesAccount ( accountId ) { return this . http . delete ( `/accounts/share/${ accountId }` ) ; } param { string } accountId param { string } command param { any } data returns { Observable < any > } executeSharesAccountCommand ( accountId , command , data ) { const httpParams = new HttpParams ( ) . set ( 'command' , command ) ; return this . http . post ( `/accounts/share/${ accountId }` , data , { params : httpParams } ) ; } }