Skip to content

src/types.ts

70 lines · 1.2 KB · TypeScript
Raw
export type OriginAuthMode = 'app' | 'installation'

export type OriginQuery = Record<
	string,
	string | number | boolean | null | undefined
>

export type OriginRequestParams = {
	path: string
	method?: string
	query?: OriginQuery
	body?: unknown
	auth?: OriginAuthMode
	installationId?: string
	scopes?: Array<string>
}

export type OriginRequestResult = {
	ok: boolean
	status: number
	body: unknown
	rateLimit: {
		limit: string | null
		remaining: string | null
		used: string | null
		reset: string | null
	}
}

export type OriginOwner = {
	slug: string
	id: string
}

export type OriginRepoSummary = {
	id: string
	name: string
	fullName: string | null
	owner: OriginOwner | null
	defaultBranch: string | null
	cloneUrl: string | null
	mirror: {
		source: string | null
		status: string | null
	} | null
}

export type OriginInstallation = {
	id: string
	appId: string | null
	target: OriginOwner | null
	repoSelectionMode: string | null
	scopes: Array<string>
}

export type OriginPullSummary = {
	number: string | number | null
	title: string | null
	state: string | null
	head: string | null
	base: string | null
	url: string | null
}

export type OriginRateLimit = {
	limit: number | null
	remaining: number | null
	used: number | null
	reset: number | null
}