File

C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-liveapps-lib/src/lib/services/tc-case-audit.service.ts

Index

Methods

Constructor

constructor(http: HttpClient)
Parameters :
Name Type Optional
http HttpClient No

Methods

Public getCaseAudit
getCaseAudit(caseRef: string, sandboxId: number, startAt: string, top: number, creationTime?: string, caseType?: CaseTypeAudit, orderBy?: OrderBy)
Parameters :
Name Type Optional
caseRef string No
sandboxId number No
startAt string No
top number No
creationTime string Yes
caseType CaseTypeAudit Yes
orderBy OrderBy Yes
Returns : Observable<AuditEventList>
import { Injectable } from '@angular/core';
import {Observable} from 'rxjs';
import {map, tap} from 'rxjs/operators';
import {HttpClient} from '@angular/common/http';
import {AuditEventList} from '../models/tc-case-audit';

@Injectable({
  providedIn: 'root'
})
export class TcCaseAuditService {

  constructor(private http: HttpClient) { }

  public getCaseAudit(caseRef: string, sandboxId: number, startAt: string, top: number,
    creationTime?: string, caseType?: CaseTypeAudit, orderBy?: OrderBy): Observable<AuditEventList> {

    const select = 's';
    let url = '/event/v1/auditEvents?$sandbox=' + sandboxId
      + '&$filter=type eq \'' + (caseType ? caseType : 'case') + '\''
      + ' and id eq \'' + caseRef + '\'';
    url = creationTime ? (url + ' and creationTime gt ' + creationTime) : url;
    url = startAt ? (url + '&$startat=' + startAt) : url;
    url = top ? (url + '&$top=' + top) : url;
    url = orderBy ? (url + '&orderby=creationTime ' + orderBy) : url;

    return this.http.get(url)
      .pipe(
        tap( val => sessionStorage.setItem('tcsTimestamp', Date.now().toString())),
        map(caseaudit => new AuditEventList().deserialize(caseaudit)));
  }
}

export enum OrderBy {
  asc = 'asc',
  desc = 'desc'
}

export enum CaseTypeAudit {
  case,
  casestate,
  casedata
}

result-matching ""

    No results matching ""