2026-04-12 16:34:07 +02:00

78 lines
1.5 KiB
TypeScript

import {MavenApi} from "~/utils/Api";
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<Artifact[]>("/artifacts")
.then((response) =>
{
onSuccess(response.data)
});
}
static getById(id: string, onSuccess: (artifact: Artifact) => void)
{
MavenApi.create().get<Artifact>("/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
)
{
}
}