aboutsummaryrefslogtreecommitdiff
path: root/sourcehut_builds.d.luau
blob: 100e388bc99be6627400f0b50759b3be882bfdf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
export type SourcehutBuildsState = {
  successful: number,
  failed: number,
  inProgress: number,
  user: string,
  builds: { SourcehutBuild }
}

export type SourcehutBuild = {
  id: number,
  created: string,
  updated: string,
  status: SourcehutBuildStatus,
  note: string,
  tags: {[number]: string},
  tasks: {[number]: SourcehutBuildTask}
}

export type SourcehutBuildStatus = "PENDING" | "QUEUED" | "RUNNING" | "FAILED" | "SUCCESS" | "TIMEOUT" | "CANCELLED"

export type SourcehutBuildTask = {
  name: string,
  status: SourcehutBuildTaskStatus
}
export type SourcehutBuildTaskStatus = "PENDING" | "RUNNING" | "FAILED" | "SUCCESS" | "SKIPPED"

type Err<E> = {type: "error", error: string}
type Pending = {type: "pending"}
type Ok = {type: "ok"}
export type PollerStatus = Err<string> | Pending | Ok

export type SourcehutBuildResponse = {
  data: SourcehutBuildData
}

export type SourcehutBuildData = {
  me: SourcehutUser,
}

export type SourcehutUser = {
  canonicalName: string,
  jobs: SourcehutUserJobs
}

export type SourcehutUserJobs = {
  results: {[number]: SourcehutBuild},
}