-
Tim Bastin authoredTim Bastin authored
apiClient.ts 1.78 KiB
import { config } from '../config'
export const apiCall = (input: string, init?: RequestInit) =>
fetch(config.API_BASE_URL + input, init)
export interface SarifApiResponse {
$schema: string
runs: Run[]
version: string
}
export interface Badge {
badgeId: string
badgeLevel: 'gold' | 'silver' | 'bronze'
badgeUrl: string
badgeInformationUri: string
badgeExplanation: BadgeExplanation
badgeGranted: boolean
badgeDescription: string
}
export interface BadgeExplanation {
criteria: Criteria[]
}
export interface Criteria {
description: string
value: number
status: string
ruleId: string
threshold: Threshold
badgeId: string
badgeLevel: string
evidence: string
}
export interface Run {
results: Result[]
tool: Tool
properties: {
testedRepository: string
badges: Badge[]
}
}
export interface Result {
ruleId: string
level: string
message: Message
properties: Properties
}
export interface Message {
text: string
}
export interface Properties {
avgBeforeCorrection: number
outliers: Outliers
std: number
stdBeforeCorrection: number
unit: string
value: number
}
export interface Outliers {
count: number
days: any[]
}
export interface Tool {
driver: Driver
}
export interface Driver {
informationUri: string
name: string
rules: Rule[]
}
export interface Rule {
id: string
name: string
fullDescription: FullDescription
help: Help
properties: Properties2
}
export interface FullDescription {
text: string
}
export interface Help {
text: string
}
export interface Properties2 {
thresholds: Threshold[]
unit: string
}
export interface Threshold {
min: number
max?: number
status: string
}