import {MavenApi} from "~/utils/Api"; import {type EnhancedResponse, useUserStore} from "~/components/users/UserStore"; export class Artifact { public baseURL = "http://localhost:8080"; constructor( public id: string, public groupId: string, public artifactId: string, public updatedAt: string, public versions: Version[], public totalPullCount: number ) { } static get(onSuccess: (artifacts: Artifact[]) => void) { MavenApi.create().get>("/artifacts") .then((response) => { useUserStore().add(response.data.users); onSuccess(response.data.data); }); } static getById(id: string, onSuccess: (artifact: Artifact) => void) { MavenApi.create().get("/artifacts/" + id) .then((response) => { onSuccess(response.data) }); } static deleteById(id: string, onSuccess: () => void) { MavenApi.create().delete("/artifacts/" + id) .then(() => { onSuccess() }); } } export class Version { constructor( public id: string, public groupId: string, public artifactId: string, public version: string, public jars?: Jar[], public pom?: Pom ) { } } export class Jar { constructor( public filename: string, public url: string ) { } } export class Pom { constructor( public filename: string, public url: string ) { } }