Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 19x 19x 19x 19x 19x 2x 1x 1x | import { Injectable } from '@angular/core';
import { Observable, map } from 'rxjs';
import { WarrantyData } from 'ish-core/models/warranty/warranty.interface';
import { WarrantyMapper } from 'ish-core/models/warranty/warranty.mapper';
import { Warranty } from 'ish-core/models/warranty/warranty.model';
import { ApiService } from 'ish-core/services/api/api.service';
@Injectable({ providedIn: 'root' })
export class WarrantyService {
constructor(private apiService: ApiService) {}
/**
* Gets the the details of a warranty product.
*
* @param warrantySku The sku of the warranty product.
* @returns The warranty.
*/
getWarranty(warrantySku: string): Observable<Warranty> {
return this.apiService
.get<WarrantyData>(`products/${this.apiService.encodeResourceId(warrantySku)}`, { sendSPGID: true })
.pipe(map(warrantyData => WarrantyMapper.fromData(warrantyData)));
}
}
|