import { Injectable } from '@angular/core' ; import { Observable } from 'rxjs/Observable' ; import { Modification } from 'app/shared/models/modification.model' ; import { User } from 'app/shared/models/user.model' ; import { Icon } from 'app/shared/models/icon.model' ; import { ModificationType } from 'app/shared/enums/modificationType.enum' ; import { HttpClient , HttpParams } from '@angular/common/http' ; @ Injectable ( ) export class ModificationService { constructor ( private http ) { } async getModificationsByType ( packageId , modifications , page = 1 , size = 100 ) { return await this . http . get < Modification [ ] > ( '/api/package/' + packageId + '/modification' , { params : ( new HttpParams ( ) ) . set ( 'modificationId' , modifications . join ( ',' ) ) . set ( 'page' , page . toString ( ) ) . set ( 'size' , size . toString ( ) ) } ) . toPromise ( ) ; } async getIconModificationsByType ( iconId , modifications , page = 1 , size = 100 ) { return await this . http . get < Modification [ ] > ( '/api/icon/' + iconId + '/modification' , { params : ( new HttpParams ( ) ) . set ( 'modificationId' , modifications . join ( ',' ) ) . set ( 'page' , page . toString ( ) ) . set ( 'size' , size . toString ( ) ) } ) . toPromise ( ) ; } async getAdminIconModificationsByType ( iconId , modifications , page = 1 , size = 100 ) { return await this . http . get < Modification [ ] > ( '/api/admin/icon/' + iconId + '/modification' , { params : ( new HttpParams ( ) ) . set ( 'modificationId' , modifications . join ( ',' ) ) . set ( 'page' , page . toString ( ) ) . set ( 'size' , size . toString ( ) ) } ) . toPromise ( ) ; } async setAssignedIssue ( m ) { return await this . http . post < Modification > ( '/api/admin/modification/issue' , m ) . toPromise ( ) ; } async setVisible ( m ) { return await this . http . post < Modification > ( '/api/admin/modification/visible' , m ) . toPromise ( ) ; } async setHidden ( m ) { return await this . http . post < Modification > ( '/api/admin/modification/hidden' , m ) . toPromise ( ) ; } }