1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/sourcehut-mirror-bridge synced 2024-12-23 22:32:19 +00:00
sourcehut-mirror-bridge/schemas/sourcehut.graphql

572 lines
13 KiB
GraphQL
Raw Normal View History

2023-11-13 01:34:24 +00:00
type ACL {
id: Int!
created: Time!
repository: Repository!
entity: Entity!
mode: AccessMode
}
"""
A cursor for enumerating access control list entries
If there are additional results available, the cursor object may be passed
back into the same endpoint to retrieve another page. If the cursor is null,
there are no remaining results to return.
"""
type ACLCursor {
results: [ACL!]!
cursor: Cursor
}
enum AccessKind {
RO
RW
}
enum AccessMode {
"""
Read-only
"""
RO
"""
Read/write
"""
RW
}
enum AccessScope {
PROFILE
REPOSITORIES
OBJECTS
ACLS
}
"""
Arbitrary file attached to a git repository
"""
type Artifact {
id: Int!
created: Time!
filename: String!
checksum: String!
size: Int!
url: String!
}
"""
A cursor for enumerating artifacts
If there are additional results available, the cursor object may be passed
back into the same endpoint to retrieve another page. If the cursor is null,
there are no remaining results to return.
"""
type ArtifactCursor {
results: [Artifact!]!
cursor: Cursor
}
type BinaryBlob implements Object & Blob {
type: ObjectType!
id: String!
shortId: String!
raw: String!
base64: String!
}
interface Blob {
id: String!
}
type Commit implements Object {
type: ObjectType!
id: String!
shortId: String!
raw: String!
author: Signature!
committer: Signature!
message: String!
tree: Tree!
parents: [Commit!]!
diff: String!
}
"""
A cursor for enumerating commits
If there are additional results available, the cursor object may be passed
back into the same endpoint to retrieve another page. If the cursor is null,
there are no remaining results to return.
"""
type CommitCursor {
results: [Commit!]!
cursor: Cursor
}
scalar Cursor
interface Entity {
id: Int!
created: Time!
updated: Time!
"""
The canonical name of this entity. For users, this is their username
prefixed with '~'. Additional entity types will be supported in the future.
"""
canonicalName: String!
"""
Returns a specific repository owned by the entity.
"""
repository(name: String!): Repository
"""
Returns a list of repositories owned by the entity.
"""
repositories(cursor: Cursor, filter: Filter): RepositoryCursor!
}
"""
Describes the status of optional features
"""
type Features {
artifacts: Boolean!
}
input Filter {
"""
Number of results to return.
"""
count: Int = 20
"""
Search terms. The exact meaning varies by usage, but generally these are
compatible with the web UI's search syntax.
"""
search: String
}
type Mutation {
"""
Creates a new git repository. If the cloneUrl parameter is specified, the
repository will be cloned from the given URL.
"""
createRepository(name: String!, visibility: Visibility!, description: String, cloneUrl: String): Repository
"""
Updates the metadata for a git repository
"""
updateRepository(id: Int!, input: RepoInput!): Repository
"""
Deletes a git repository
"""
deleteRepository(id: Int!): Repository
"""
Adds or updates a user in the access control list
"""
updateACL(repoId: Int!, mode: AccessMode!, entity: ID!): ACL!
"""
Deletes an entry from the access control list
"""
deleteACL(id: Int!): ACL
"""
Uploads an artifact. revspec must match a specific git tag, and the
filename must be unique among artifacts for this repository.
"""
uploadArtifact(repoId: Int!, revspec: String!, file: Upload!): Artifact!
"""
Deletes an artifact.
"""
deleteArtifact(id: Int!): Artifact
"""
Creates a new user webhook subscription. When an event from the
provided list of events occurs, the 'query' parameter (a GraphQL query)
will be evaluated and the results will be sent to the provided URL as the
body of an HTTP POST request. The list of events must include at least one
event, and no duplicates.
This query is evaluated in the webhook context, such that query { webhook }
may be used to access details of the event which trigged the webhook. The
query may not make any mutations.
"""
createUserWebhook(config: UserWebhookInput!): WebhookSubscription!
"""
Deletes a user webhook. Any events already queued may still be
delivered after this request completes. Clients authenticated with a
personal access token may delete any webhook registered for their account,
but authorized OAuth 2.0 clients may only delete their own webhooks.
Manually deleting a webhook configured by a third-party client may cause
unexpected behavior with the third-party integration.
"""
deleteUserWebhook(id: Int!): WebhookSubscription!
"""
Deletes the authenticated user's account. Internal use only.
"""
deleteUser: Int!
}
type OAuthClient {
uuid: String!
}
interface Object {
type: ObjectType!
id: String!
shortId: String!
"""
Raw git object, base64 encoded
"""
raw: String!
}
enum ObjectType {
COMMIT
TREE
BLOB
TAG
}
type Query {
"""
Returns API version information.
"""
version: Version!
"""
Returns the authenticated user.
"""
me: User!
"""
Returns a specific user.
"""
user(username: String!): User
"""
Returns repositories that the authenticated user has access to.
NOTE: in this version of the API, only repositories owned by the
authenticated user are returned, but in the future the default behavior
will be to return all repositories that the user either (1) has been given
explicit access to via ACLs or (2) has implicit access to either by
ownership or group membership.
"""
repositories(cursor: Cursor, filter: Filter): RepositoryCursor
"""
Returns a list of user webhook subscriptions. For clients
authenticated with a personal access token, this returns all webhooks
configured by all GraphQL clients for your account. For clients
authenticated with an OAuth 2.0 access token, this returns only webhooks
registered for your client.
"""
userWebhooks(cursor: Cursor): WebhookSubscriptionCursor!
"""
Returns details of a user webhook subscription by its ID.
"""
userWebhook(id: Int!): WebhookSubscription
"""
Returns information about the webhook currently being processed. This is
not valid during normal queries over HTTP, and will return an error if used
outside of a webhook context.
"""
webhook: WebhookPayload!
}
type Reference {
name: String!
target: String!
follow: Object
artifacts(cursor: Cursor): ArtifactCursor!
}
"""
A cursor for enumerating a list of references
If there are additional results available, the cursor object may be passed
back into the same endpoint to retrieve another page. If the cursor is null,
there are no remaining results to return.
"""
type ReferenceCursor {
results: [Reference!]!
cursor: Cursor
}
input RepoInput {
name: String
description: String
visibility: Visibility
"""
Updates the custom README associated with this repository. Note that the
provided HTML will be sanitized when displayed on the web; see
https://man.sr.ht/markdown/#post-processing
"""
readme: String
"""
Updates the repository HEAD reference, which serves as the default branch.
Must be a valid branch name.
"""
HEAD: String
}
type Repository {
id: Int!
created: Time!
updated: Time!
owner: Entity!
name: String!
description: String
visibility: Visibility!
"""
The repository's custom README, if set.
NOTICE: This returns unsanitized HTML. It is the client's responsibility to
sanitize this for display on the web, if so desired.
"""
readme: String
"""
The access that applies to this user for this repository
"""
access: AccessMode!
acls(cursor: Cursor): ACLCursor!
objects(ids: [String!]): [Object]!
references(cursor: Cursor): ReferenceCursor!
"""
The HEAD reference for this repository (equivalent to the default branch)
"""
HEAD: Reference
"""
Returns a list of comments sorted by committer time (similar to `git log`'s
default ordering).
If `from` is specified, it is interpreted as a revspec to start logging
from. A clever reader may notice that using commits[-1].from + "^" as the
from parameter is equivalent to passing the cursor to the next call.
"""
log(cursor: Cursor, from: String): CommitCursor!
"""
Returns a tree entry for a given path, at the given revspec.
"""
path(revspec: String = "HEAD", path: String!): TreeEntry
"""
Returns the commit for a given revspec.
"""
revparse_single(revspec: String!): Commit
}
"""
A cursor for enumerating a list of repositories
If there are additional results available, the cursor object may be passed
back into the same endpoint to retrieve another page. If the cursor is null,
there are no remaining results to return.
"""
type RepositoryCursor {
results: [Repository!]!
cursor: Cursor
}
type RepositoryEvent implements WebhookPayload {
uuid: String!
event: WebhookEvent!
date: Time!
repository: Repository!
}
"""
Instance specific settings
"""
type Settings {
sshUser: String!
}
type Signature {
name: String!
email: String!
time: Time!
}
type Tag implements Object {
type: ObjectType!
id: String!
shortId: String!
raw: String!
target: Object!
name: String!
tagger: Signature!
message: String
}
type TextBlob implements Object & Blob {
type: ObjectType!
id: String!
shortId: String!
raw: String!
text: String!
}
scalar Time
type Tree implements Object {
type: ObjectType!
id: String!
shortId: String!
raw: String!
entries(cursor: Cursor): TreeEntryCursor!
entry(path: String): TreeEntry
}
type TreeEntry {
id: String!
name: String!
object: Object!
"""
Unix-style file mode, i.e. 0755 or 0644 (octal)
"""
mode: Int!
}
"""
A cursor for enumerating tree entries
If there are additional results available, the cursor object may be passed
back into the same endpoint to retrieve another page. If the cursor is null,
there are no remaining results to return.
"""
type TreeEntryCursor {
results: [TreeEntry!]!
cursor: Cursor
}
scalar Upload
type User implements Entity {
id: Int!
created: Time!
updated: Time!
canonicalName: String!
username: String!
email: String!
url: String
location: String
bio: String
repository(name: String!): Repository
repositories(cursor: Cursor, filter: Filter): RepositoryCursor!
}
input UserWebhookInput {
url: String!
events: [WebhookEvent!]!
query: String!
}
type UserWebhookSubscription implements WebhookSubscription {
id: Int!
events: [WebhookEvent!]!
query: String!
url: String!
client: OAuthClient
deliveries(cursor: Cursor): WebhookDeliveryCursor!
sample(event: WebhookEvent): String!
}
type Version {
major: Int!
minor: Int!
patch: Int!
"""
If this API version is scheduled for deprecation, this is the date on which
it will stop working; or null if this API version is not scheduled for
deprecation.
"""
deprecationDate: Time
"""
Optional features
"""
features: Features!
"""
Config settings
"""
settings: Settings!
}
enum Visibility {
"""
Visible to everyone, listed on your profile
"""
PUBLIC
"""
Visible to everyone (if they know the URL), not listed on your profile
"""
UNLISTED
"""
Not visible to anyone except those explicitly added to the access list
"""
PRIVATE
}
type WebhookDelivery {
uuid: String!
date: Time!
event: WebhookEvent!
subscription: WebhookSubscription!
requestBody: String!
"""
These details are provided only after a response is received from the
remote server. If a response is sent whose Content-Type is not text/*, or
cannot be decoded as UTF-8, the response body will be null. It will be
truncated after 64 KiB.
"""
responseBody: String
responseHeaders: String
responseStatus: Int
}
"""
A cursor for enumerating a list of webhook deliveries
If there are additional results available, the cursor object may be passed
back into the same endpoint to retrieve another page. If the cursor is null,
there are no remaining results to return.
"""
type WebhookDeliveryCursor {
results: [WebhookDelivery!]!
cursor: Cursor
}
enum WebhookEvent {
REPO_CREATED
REPO_UPDATE
REPO_DELETED
}
interface WebhookPayload {
uuid: String!
event: WebhookEvent!
date: Time!
}
interface WebhookSubscription {
id: Int!
events: [WebhookEvent!]!
query: String!
url: String!
"""
If this webhook was registered by an authorized OAuth 2.0 client, this
field is non-null.
"""
client: OAuthClient
"""
All deliveries which have been sent to this webhook.
"""
deliveries(cursor: Cursor): WebhookDeliveryCursor!
"""
Returns a sample payload for this subscription, for testing purposes
"""
sample(event: WebhookEvent!): String!
}
"""
A cursor for enumerating a list of webhook subscriptions
If there are additional results available, the cursor object may be passed
back into the same endpoint to retrieve another page. If the cursor is null,
there are no remaining results to return.
"""
type WebhookSubscriptionCursor {
results: [WebhookSubscription!]!
cursor: Cursor
}