This commit is contained in:
2025-02-10 13:42:07 +01:00
parent 2c7934c249
commit 776cf7ecab

View File

@ -104,47 +104,6 @@ export class AuthDataService extends RemoteDataService {
}
}
@Injectable({
providedIn: 'root',
})
export class ScanDataService extends RemoteDataService {
/**
* Method for getting the scan data
* @param sessionId Unique identifier for the session
* @param offset Pagination offset (default = 0)
* @param limit Number of records to retrieve (default = 100)
* @param fields List of fields to include in the response
* @param includeUserData Whether to include user-related data
* @param sort Sort order for the records as a dictionary
* @returns response from the server with the scan data
* @throws HttpErrorResponse if the request fails
* @throws TimeoutError if the request takes too long
*/
getScanData(
sessionId: string,
offset: number = 0,
limit: number = 100,
fields: Array<string> | null = null,
includeUserData: boolean = false,
sort: { [key: string]: number } | null = null
) {
let headers = new HttpHeaders();
headers = headers.set('Content-Type', 'application/json; charset=utf-8');
return this.get<Array<ScanDataResponse>>(
'scans/session',
{
session_id: sessionId,
offset: offset.toString(),
limit: limit.toString(),
fields: fields ? fields : '',
sort: sort ? JSON.stringify(sort) : '',
includeUserData: includeUserData.toString(),
},
headers
);
}
}
@Injectable({
providedIn: 'root',
})
@ -184,7 +143,42 @@ export class DeploymentDataService extends RemoteDataService {
@Injectable({
providedIn: 'root',
})
export class ScanCountService extends RemoteDataService {
export class ScanDataService extends RemoteDataService {
/**
* Method for getting the scan data
* @param sessionId Unique identifier for the session
* @param offset Pagination offset (default = 0)
* @param limit Number of records to retrieve (default = 100)
* @param fields List of fields to include in the response
* @param includeUserData Whether to include user-related data
* @param sort Sort order for the records as a dictionary
* @returns response from the server with the scan data
* @throws HttpErrorResponse if the request fails
* @throws TimeoutError if the request takes too long
*/
getScanData(
sessionId: string,
offset: number = 0,
limit: number = 100,
fields: Array<string> | null = null,
includeUserData: boolean = false,
sort: { [key: string]: number } | null = null
) {
let headers = new HttpHeaders();
headers = headers.set('Content-Type', 'application/json; charset=utf-8');
return this.get<Array<ScanDataResponse>>(
'scans/session',
{
session_id: sessionId,
offset: offset.toString(),
limit: limit.toString(),
fields: fields ? fields : '',
sort: sort ? JSON.stringify(sort) : '',
includeUserData: includeUserData.toString(),
},
headers
);
}
/**
* Method for getting the scan count
* @param sessionId Unique identifier for the session (Optional)