Skip to content
Snippets Groups Projects
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
}

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.