58 lines
1.2 KiB
TypeScript
58 lines
1.2 KiB
TypeScript
import axios from "axios";
|
|
|
|
export class Artifact
|
|
{
|
|
|
|
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)
|
|
{
|
|
axios.get<Artifact[]>("http://localhost:8080/artifacts")
|
|
.then((response) => {
|
|
onSuccess(response.data)
|
|
});
|
|
}
|
|
|
|
static getById(id: string, onSuccess: (artifact: Artifact) => void)
|
|
{
|
|
axios.get<Artifact>("http://localhost:8080/artifacts/" + id)
|
|
.then((response) => {
|
|
onSuccess(response.data)
|
|
});
|
|
}
|
|
}
|
|
|
|
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
|
|
) {}
|
|
} |