🏡 index : quine-global/nugitea.git

type Blob implements GitObject {
	oid: String!
	isBinary: Boolean!
	text: String
	byteSize: Int!
}

interface GitObject {
	oid: String!
}

type Organization implements RepositoryOwner & UniformResourceLocatable {
	id: ID!
	"""
	The org's full path — just its slug for a top-level org, like
	GitHub; `parent/child` for a sub-org.
	"""
	login: String!
	resourcePath: String!
	repositories(first: Int): RepositoryConnection!
	"""
	nugitea extension: the org this one is nested under, if any.
	"""
	parentOrganization: Organization
	"""
	nugitea extension: orgs nested directly under this one.
	"""
	subOrganizations(first: Int): OrganizationConnection!
}

type OrganizationConnection {
	nodes: [Organization!]!
	totalCount: Int!
}

type Query {
	repository(owner: String!, name: String!): Repository
	repositoryOwner(login: String!): RepositoryOwner
	user(login: String!): User
	organization(login: String!): Organization
	"""
	Resolves a URL or path to the user, org, or repo it names. Walks
	owner segments until one names a repo, then stops — so trailing
	segments (`/tree/main/src`) still resolve to the repo, and the
	caller can compare `resourcePath` to see what's left over.
	Unambiguous because a sub-org and a repo can't share a name
	within the same parent.
	"""
	resource(url: String!): UniformResourceLocatable
	"""
	Every repo, across all owners (nugitea extension).
	"""
	repositories(first: Int): RepositoryConnection!
	"""
	The signed-in user, or null when anonymous (nugitea's is nullable:
	GitHub has no anonymous access).
	"""
	viewer: User
}

type Ref {
	name: String!
}

type Repository implements UniformResourceLocatable {
	id: ID!
	name: String!
	nameWithOwner: String!
	owner: RepositoryOwner!
	resourcePath: String!
	visibility: RepositoryVisibility!
	isPrivate: Boolean!
	"""
	The branch HEAD names (Gitea's default branch: `main` for a new repo,
	or the first push's branch), or, if HEAD names no branch that exists,
	`main`, else `master`, else whichever branch sorts first; `null` for
	an empty repo.
	"""
	defaultBranchRef: Ref
	refs: [Ref!]!
	"""
	Full recursive file list for the search feature — see the module
	doc comment for why this isn't literal GitHub API shape.
	"""
	files(ref: String!): [String!]!
	"""
	Resolves a `"ref"` or `"ref:path"` expression to a `Tree` or
	`Blob`. Tried as a tree first (a no-op-cheap `git ls-tree`); if
	that fails on a non-empty path, it's tried as a blob instead — a
	path can't be both, so git itself is the source of truth on which
	one an expression resolves to, rather than nugitea guessing from
	the shape of the path string.
	"""
	object(expression: String!): GitObject
	"""
	Tags, newest first (nugitea extension; GitHub has refs(refPrefix:)).
	"""
	tags: [Ref!]!
	"""
	Commits reachable from `ref` (a branch, tag or commit), newest first,
	only those touching `path` if given; `first` (default 30, at most
	100) after skipping `skip`. A nugitea extension, for Gitea's
	/commits/ pages; GitHub has it under ref.target.history.
	"""
	history(ref: String!, path: String, first: Int, skip: Int): CommitHistory!
	"""
	A commit by its full or abbreviated oid (nugitea extension; GitHub
	has object(oid:)), or null if there's no such commit.
	"""
	commit(oid: String!): Commit
}

type CommitHistory {
	nodes: [Commit!]!
	hasNextPage: Boolean!
}

type Commit implements GitObject {
	oid: String!
	abbreviatedOid: String!
	message: String!
	messageHeadline: String!
	messageBody: String!
	author: GitActor!
	committer: GitActor!
	"""
	Parent oids (GitHub's is a connection).
	"""
	parents: [String!]!
	"""
	The unified diff against the first parent (against nothing for a
	repo's first commit), as Gitea's /commit/{sha}.diff (nugitea
	extension).
	"""
	diff: String!
}

type GitActor {
	name: String!
	email: String!
	"""
	ISO 8601.
	"""
	date: String!
}

type RepositoryConnection {
	nodes: [Repository!]!
	totalCount: Int!
}

interface RepositoryOwner {
	id: ID!
	login: String!
	resourcePath: String!
	repositories(first: Int): RepositoryConnection!
}

enum RepositoryVisibility {
	PUBLIC
	INTERNAL
	PRIVATE
}

type Tree implements GitObject {
	oid: String!
	entries: [TreeEntry!]!
}

type TreeEntry {
	name: String!
	type: String!
	oid: String!
}

interface UniformResourceLocatable {
	resourcePath: String!
}

type User implements RepositoryOwner & UniformResourceLocatable {
	id: ID!
	login: String!
	resourcePath: String!
	repositories(first: Int): RepositoryConnection!
}

"""
Directs the executor to include this field or fragment only when the `if` argument is true.
"""
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
"""
Directs the executor to skip this field or fragment when the `if` argument is true.
"""
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
	query: Query
}