export interface StatsParams { tag : string ; firstWord ? : string ; questionMark ? : string ; weekday ? : string ; accountCreation ? : string ; questionLength ? : string ; hour ? : string ; } export interface StatsAnser { minutes : number ; probability_of_answer : number ; probabiliy_of_downvote : number ; } /**
 * Calls the backend and returns a url of a generated video. If this isn't possible the
 * promise fails.
 */ export function getStats ( params ) { let query = `?tag=${ params . tag }` + `&first_word=${ params . firstWord || "i" }` + `&ends_question=${ params . questionMark || "false" }` + `&weekday_utc=${ params . weekday || "Monday" }` + `&account_creation_year=${ params . accountCreation || "2018" }` + `&question_length=${ params . questionLength || "short" }` + `&hour_utc=${ params . hour || "0" }` ; return fetch ( `${ location . origin }/experiment/bqml-stackoverflow/api/query${ query }` ) . then ( response => response . json ( ) ) ; }