Changeset View
Changeset View
Standalone View
Standalone View
swh/graphql/schema/schema.graphql
""" | |||||
SoftWare Heritage persistent Identifier | |||||
""" | |||||
scalar SWHID | scalar SWHID | ||||
""" | |||||
ISO-8601 encoded date string | |||||
""" | |||||
scalar DateTime | scalar DateTime | ||||
""" | |||||
Object with an id | |||||
""" | |||||
interface Node { | interface Node { | ||||
""" | |||||
vlorentz: you should make it clear this is internal to the protocol for caching purposes, and should not… | |||||
Id of the object. This is for caching purpose and | |||||
should not be used outside the GraphQL API | |||||
""" | |||||
id: ID! | id: ID! | ||||
} | } | ||||
""" | |||||
SWH merkle node object with a SWHID | |||||
""" | |||||
interface MerkleNode { | interface MerkleNode { | ||||
""" | |||||
SWHID of the object | |||||
""" | |||||
SWHID: SWHID! | SWHID: SWHID! | ||||
Not Done Inline Actionsthe attribute name should be lowercase vlorentz: the attribute name should be lowercase | |||||
Done Inline ActionsI will do this in another diff. It require some code changes jayeshv: I will do this in another diff. It require some code changes | |||||
} | } | ||||
""" | |||||
Information about pagination | |||||
""" | |||||
type PageInfo { | type PageInfo { | ||||
""" | |||||
Cursor to request the next page in the connection | |||||
""" | |||||
endCursor: String | endCursor: String | ||||
""" | |||||
Are there more pages in the connection? | |||||
""" | |||||
hasNextPage: Boolean! | hasNextPage: Boolean! | ||||
} | } | ||||
""" | |||||
Connection to origins | |||||
""" | |||||
type OriginConnection { | type OriginConnection { | ||||
""" | |||||
List of origin edges | |||||
""" | |||||
edges: [OriginEdge] | edges: [OriginEdge] | ||||
""" | |||||
List of origin objects | |||||
""" | |||||
nodes: [Origin] | nodes: [Origin] | ||||
""" | |||||
Information for pagination | |||||
""" | |||||
pageInfo: PageInfo! | pageInfo: PageInfo! | ||||
""" | |||||
Total number of origin objects in the connection | |||||
""" | |||||
totalCount: Int | totalCount: Int | ||||
} | } | ||||
""" | |||||
Edge in origin connection | |||||
""" | |||||
type OriginEdge { | type OriginEdge { | ||||
""" | |||||
Cursor to request the next page after the item | |||||
""" | |||||
cursor: String! | cursor: String! | ||||
""" | |||||
Origin object | |||||
""" | |||||
node: Origin | node: Origin | ||||
} | } | ||||
""" | |||||
A software origin object | |||||
""" | |||||
type Origin implements Node { | type Origin implements Node { | ||||
""" | |||||
Unique identifier | |||||
""" | |||||
id: ID! | id: ID! | ||||
""" | |||||
Origin URL | |||||
""" | |||||
url: String! | url: String! | ||||
""" | |||||
Connection to all the visit objects for the origin | |||||
""" | |||||
visits( | visits( | ||||
""" | |||||
Returns the first _n_ elements from the list | |||||
""" | |||||
first: Int! | first: Int! | ||||
""" | |||||
Returns the page after this cursor | |||||
""" | |||||
after: String | after: String | ||||
): VisitConnection! | ): VisitConnection! | ||||
""" | |||||
Latest visit object for the origin | |||||
""" | |||||
latestVisit: Visit | latestVisit: Visit | ||||
""" | |||||
Connection to all the snapshots for the origin | |||||
""" | |||||
snapshots( | snapshots( | ||||
""" | |||||
Returns the first _n_ elements from the list | |||||
""" | |||||
first: Int! | first: Int! | ||||
""" | |||||
Returns the page after this cursor | |||||
""" | |||||
after: String | after: String | ||||
): SnapshotConnection | ): SnapshotConnection | ||||
} | } | ||||
""" | |||||
Connection to origin visits | |||||
""" | |||||
type VisitConnection { | type VisitConnection { | ||||
""" | |||||
List of visit edges | |||||
""" | |||||
edges: [VisitEdge] | edges: [VisitEdge] | ||||
""" | |||||
List of visit objects | |||||
""" | |||||
nodes: [Visit] | nodes: [Visit] | ||||
""" | |||||
Information for pagination | |||||
""" | |||||
pageInfo: PageInfo! | pageInfo: PageInfo! | ||||
""" | |||||
Total number of visit objects in the connection | |||||
""" | |||||
totalCount: Int | totalCount: Int | ||||
} | } | ||||
""" | |||||
Edge in origin visit connection | |||||
""" | |||||
type VisitEdge { | type VisitEdge { | ||||
""" | |||||
Cursor to request the next page after the item | |||||
""" | |||||
cursor: String! | cursor: String! | ||||
""" | |||||
Visit object | |||||
""" | |||||
node: Visit | node: Visit | ||||
} | } | ||||
""" | |||||
An origin visit object | |||||
""" | |||||
type Visit implements Node { | type Visit implements Node { | ||||
""" | |||||
Unique identifier | |||||
""" | |||||
id: ID! | id: ID! | ||||
""" | |||||
Visit number for the origin | |||||
""" | |||||
visitId: Int | visitId: Int | ||||
""" | |||||
Visit date ISO-8601 encoded | |||||
""" | |||||
date: DateTime! | date: DateTime! | ||||
""" | |||||
Type of the origin visited. Eg: git/hg/svn/tar/deb | |||||
""" | |||||
type: String | type: String | ||||
""" | |||||
Connection to all the status objects for the visit | |||||
""" | |||||
status( | status( | ||||
""" | |||||
Returns the first _n_ elements from the list | |||||
""" | |||||
first: Int | first: Int | ||||
""" | |||||
Returns the page after this cursor | |||||
""" | |||||
after: String | after: String | ||||
): VisitStatusConnection | ): VisitStatusConnection | ||||
""" | |||||
Latest status object for the Visit | |||||
""" | |||||
latestStatus: VisitStatus | latestStatus: VisitStatus | ||||
} | } | ||||
""" | |||||
Connection to visit status | |||||
""" | |||||
type VisitStatusConnection { | type VisitStatusConnection { | ||||
""" | |||||
List of visit status edges | |||||
""" | |||||
edges: [VisitStatusEdge] | edges: [VisitStatusEdge] | ||||
""" | |||||
List of visit status objects | |||||
""" | |||||
nodes: [VisitStatus] | nodes: [VisitStatus] | ||||
""" | |||||
Information for pagination | |||||
""" | |||||
pageInfo: PageInfo! | pageInfo: PageInfo! | ||||
""" | |||||
Total number of visit status objects in the connection | |||||
""" | |||||
totalCount: Int | totalCount: Int | ||||
} | } | ||||
""" | |||||
Edge in visit status connection | |||||
""" | |||||
type VisitStatusEdge { | type VisitStatusEdge { | ||||
""" | |||||
Cursor to request the next page after the item | |||||
""" | |||||
cursor: String! | cursor: String! | ||||
""" | |||||
Visit status object | |||||
""" | |||||
node: VisitStatus | node: VisitStatus | ||||
} | } | ||||
""" | |||||
A visit status object | |||||
""" | |||||
type VisitStatus { | type VisitStatus { | ||||
""" | |||||
Status string of the visit (either full, partial or ongoing) | |||||
""" | |||||
status: String! | status: String! | ||||
""" | |||||
ISO-8601 encoded date string | |||||
""" | |||||
date: DateTime! | date: DateTime! | ||||
snapshotSWHID: SWHID | |||||
""" | |||||
Snapshot object | |||||
""" | |||||
snapshot: Snapshot | snapshot: Snapshot | ||||
""" | |||||
Type of the origin visited. Eg: git/hg/svn/tar/deb | |||||
""" | |||||
type: String | type: String | ||||
} | } | ||||
""" | |||||
Connection to snapshots | |||||
""" | |||||
type SnapshotConnection { | type SnapshotConnection { | ||||
""" | |||||
List of snapshot edges | |||||
""" | |||||
edges: [SnapshotEdge] | edges: [SnapshotEdge] | ||||
""" | |||||
List of snapshot objects | |||||
""" | |||||
nodes: [Snapshot] | nodes: [Snapshot] | ||||
""" | |||||
Information for pagination | |||||
""" | |||||
pageInfo: PageInfo! | pageInfo: PageInfo! | ||||
""" | |||||
Total number of snapshot objects in the connection | |||||
""" | |||||
totalCount: Int | totalCount: Int | ||||
} | } | ||||
""" | |||||
Edge in snapshot connection | |||||
""" | |||||
type SnapshotEdge { | type SnapshotEdge { | ||||
""" | |||||
Cursor to request the next page after the item | |||||
""" | |||||
cursor: String! | cursor: String! | ||||
""" | |||||
Snapshot object | |||||
""" | |||||
node: Snapshot | node: Snapshot | ||||
} | } | ||||
""" | |||||
A snapshot object | |||||
""" | |||||
type Snapshot implements MerkleNode & Node { | type Snapshot implements MerkleNode & Node { | ||||
""" | |||||
Unique identifier | |||||
""" | |||||
id: ID! | id: ID! | ||||
""" | |||||
SWHID of the snapshot object | |||||
""" | |||||
SWHID: SWHID! | SWHID: SWHID! | ||||
""" | |||||
Connection to all the snapshot branches | |||||
""" | |||||
branches( | branches( | ||||
""" | |||||
Returns the first _n_ elements from the list | |||||
""" | |||||
first: Int! | first: Int! | ||||
""" | |||||
Returns the page after this cursor | |||||
""" | |||||
after: String | after: String | ||||
types: [BranchTypes] | |||||
""" | |||||
Filter by branch target types | |||||
""" | |||||
types: [BranchTargetType] | |||||
""" | |||||
Filter by branch name | |||||
""" | |||||
nameInclude: String | nameInclude: String | ||||
): BranchConnection | ): BranchConnection | ||||
} | } | ||||
""" | |||||
Connection to snapshot branches | |||||
""" | |||||
type BranchConnection { | type BranchConnection { | ||||
""" | |||||
List of branch edges | |||||
""" | |||||
edges: [BranchConnectionEdge] | edges: [BranchConnectionEdge] | ||||
""" | |||||
List of branch objects | |||||
""" | |||||
nodes: [Branch] | nodes: [Branch] | ||||
""" | |||||
Information for pagination | |||||
""" | |||||
pageInfo: PageInfo! | pageInfo: PageInfo! | ||||
""" | |||||
Total number of branch objects in the connection | |||||
""" | |||||
totalCount: Int | totalCount: Int | ||||
} | } | ||||
""" | |||||
Edge in snapshot branch connection | |||||
""" | |||||
type BranchConnectionEdge { | type BranchConnectionEdge { | ||||
""" | |||||
Cursor to request the next page after the item | |||||
""" | |||||
cursor: String! | cursor: String! | ||||
""" | |||||
Branch object | |||||
""" | |||||
node: Branch | node: Branch | ||||
} | } | ||||
""" | |||||
A user object | |||||
""" | |||||
type Person { | type Person { | ||||
""" | |||||
User's email address | |||||
""" | |||||
email: String | email: String | ||||
""" | |||||
User's name | |||||
""" | |||||
name: String | name: String | ||||
""" | |||||
User's full name | |||||
""" | |||||
fullname: String | fullname: String | ||||
} | } | ||||
""" | |||||
Possible branch target objects | |||||
""" | |||||
union BranchTarget = Revision | Release | Branch | Content | Directory | Snapshot | union BranchTarget = Revision | Release | Branch | Content | Directory | Snapshot | ||||
enum BranchTypes { | """ | ||||
Possible Branch target types | |||||
""" | |||||
enum BranchTargetType { | |||||
revision | revision | ||||
release | release | ||||
alias | alias | ||||
content | content | ||||
directory | directory | ||||
snapshot | snapshot | ||||
} | } | ||||
""" | |||||
A snapshot branch object | |||||
""" | |||||
type Branch { | type Branch { | ||||
""" | |||||
Branch name | |||||
""" | |||||
name: String | name: String | ||||
type: BranchTypes | |||||
""" | |||||
Type of Branch target | |||||
""" | |||||
type: BranchTargetType | |||||
""" | |||||
Branch target object | |||||
""" | |||||
target: BranchTarget | target: BranchTarget | ||||
} | } | ||||
""" | |||||
Connection to revisions | |||||
""" | |||||
type RevisionConnection { | type RevisionConnection { | ||||
""" | |||||
List of revision edges | |||||
""" | |||||
edges: [RevisionEdge] | edges: [RevisionEdge] | ||||
""" | |||||
List of revision objects | |||||
""" | |||||
nodes: [Revision] | nodes: [Revision] | ||||
""" | |||||
Information for pagination | |||||
""" | |||||
pageInfo: PageInfo! | pageInfo: PageInfo! | ||||
""" | |||||
Total number of revision objects in the connection | |||||
""" | |||||
totalCount: Int | totalCount: Int | ||||
} | } | ||||
""" | |||||
Edge in revision connection | |||||
""" | |||||
type RevisionEdge { | type RevisionEdge { | ||||
""" | |||||
Cursor to request the next page after the item | |||||
""" | |||||
cursor: String! | cursor: String! | ||||
""" | |||||
Revision object | |||||
""" | |||||
node: Revision | node: Revision | ||||
} | } | ||||
""" | |||||
A revision object | |||||
""" | |||||
type Revision implements MerkleNode & Node { | type Revision implements MerkleNode & Node { | ||||
""" | |||||
Unique identifier | |||||
""" | |||||
id: ID! | id: ID! | ||||
""" | |||||
SWHID of the revision object | |||||
""" | |||||
SWHID: SWHID! | SWHID: SWHID! | ||||
""" | |||||
Message associated to the revision | |||||
""" | |||||
message: String | message: String | ||||
""" | |||||
""" | |||||
author: Person | author: Person | ||||
""" | |||||
""" | |||||
committer: Person | committer: Person | ||||
""" | |||||
Revision date ISO-8601 encoded | |||||
""" | |||||
date: DateTime | date: DateTime | ||||
type: String # Revision type: FIXME, change to an enum | |||||
# directorySWHID: SWHID | """ | ||||
Done Inline Actionsthis should mention examples (git/hg/tar/deb), it is not clear what the type is, otherwise. vlorentz: this should mention examples (git/hg/tar/deb), it is not clear what the type is, otherwise. | |||||
Type of the revision, eg: git/hg | |||||
""" | |||||
type: String | |||||
""" | |||||
The unique directory object that revision points to | |||||
""" | |||||
directory: Directory | directory: Directory | ||||
parentSWHIDs: [SWHID] | |||||
""" | |||||
Connection to all the parents of the revision | |||||
""" | |||||
parents( | parents( | ||||
""" | |||||
Returns the first _n_ elements from the list | |||||
""" | |||||
first: Int | first: Int | ||||
""" | |||||
Returns the page after this cursor | |||||
""" | |||||
after: String | after: String | ||||
): RevisionConnection | ): RevisionConnection | ||||
""" | |||||
Connection to all the revisions heading to this one | |||||
aka the commit log | |||||
""" | |||||
revisionLog( | revisionLog( | ||||
""" | |||||
Returns the first _n_ elements from the list | |||||
""" | |||||
first: Int! | first: Int! | ||||
""" | |||||
Returns the page after the cursor | |||||
""" | |||||
after: String | after: String | ||||
): RevisionConnection | ): RevisionConnection | ||||
} | } | ||||
""" | |||||
Possible release target objects | |||||
""" | |||||
union ReleaseTarget = Release | Revision | Directory | Content | union ReleaseTarget = Release | Revision | Directory | Content | ||||
""" | |||||
Possible release target types | |||||
""" | |||||
enum ReleaseTargetType { | enum ReleaseTargetType { | ||||
release | release | ||||
revision | revision | ||||
content | content | ||||
directory | directory | ||||
} | } | ||||
""" | |||||
A release object | |||||
""" | |||||
type Release implements MerkleNode & Node { | type Release implements MerkleNode & Node { | ||||
""" | |||||
Unique identifier | |||||
""" | |||||
id: ID! | id: ID! | ||||
""" | |||||
SWHID of the release object | |||||
""" | |||||
SWHID: SWHID! | SWHID: SWHID! | ||||
""" | |||||
The name of the release | |||||
""" | |||||
name: String | name: String | ||||
""" | |||||
The message associated to the release | |||||
""" | |||||
message: String | message: String | ||||
""" | |||||
""" | |||||
author: Person | author: Person | ||||
""" | |||||
Release date ISO-8601 encoded | |||||
""" | |||||
date: DateTime | date: DateTime | ||||
""" | |||||
Type of release target | |||||
""" | |||||
targetType: ReleaseTargetType | targetType: ReleaseTargetType | ||||
""" | |||||
Release target object | |||||
""" | |||||
target: ReleaseTarget | target: ReleaseTarget | ||||
} | } | ||||
""" | |||||
Connection to directory entries | |||||
""" | |||||
type DirectoryEntryConnection { | type DirectoryEntryConnection { | ||||
""" | |||||
List of directory entry edges | |||||
""" | |||||
edges: [DirectoryEntryEdge] | edges: [DirectoryEntryEdge] | ||||
""" | |||||
List of directory entry objects | |||||
""" | |||||
nodes: [DirectoryEntry] | nodes: [DirectoryEntry] | ||||
""" | |||||
Information for pagination | |||||
""" | |||||
pageInfo: PageInfo! | pageInfo: PageInfo! | ||||
""" | |||||
Total number of directory entry objects in the connection | |||||
""" | |||||
totalCount: Int | totalCount: Int | ||||
} | } | ||||
""" | |||||
Edge in directory entry connection | |||||
""" | |||||
type DirectoryEntryEdge { | type DirectoryEntryEdge { | ||||
""" | |||||
Cursor to request the next page after the item | |||||
""" | |||||
cursor: String! | cursor: String! | ||||
""" | |||||
Directory entry object | |||||
""" | |||||
node: DirectoryEntry | node: DirectoryEntry | ||||
} | } | ||||
""" | |||||
Possible directory entry target objects | |||||
""" | |||||
union DirectoryEntryTarget = Directory | Content | union DirectoryEntryTarget = Directory | Content | ||||
""" | |||||
Possible directory entry types | |||||
""" | |||||
enum DirectoryEntryType { | enum DirectoryEntryType { | ||||
dir | dir | ||||
file | file | ||||
rev | rev | ||||
} | } | ||||
""" | |||||
A directory entry object | |||||
""" | |||||
type DirectoryEntry { | type DirectoryEntry { | ||||
""" | |||||
The directory entry name | |||||
""" | |||||
name: String | name: String | ||||
""" | |||||
Directory entry object type; can be file, dir or rev | |||||
""" | |||||
type: DirectoryEntryType | type: DirectoryEntryType | ||||
""" | |||||
Directory entry target object | |||||
""" | |||||
target: DirectoryEntryTarget | target: DirectoryEntryTarget | ||||
} | } | ||||
""" | |||||
A directory object | |||||
""" | |||||
type Directory implements MerkleNode & Node { | type Directory implements MerkleNode & Node { | ||||
""" | |||||
Unique identifier | |||||
""" | |||||
id: ID! | id: ID! | ||||
""" | |||||
SWHID of the directory object | |||||
""" | |||||
SWHID: SWHID! | SWHID: SWHID! | ||||
""" | |||||
Connection to the directory entries | |||||
""" | |||||
entries( | entries( | ||||
""" | |||||
Returns the first _n_ elements from the list | |||||
""" | |||||
first: Int | first: Int | ||||
""" | |||||
Returns the page after this cursor | |||||
""" | |||||
after: String | after: String | ||||
): DirectoryEntryConnection | ): DirectoryEntryConnection | ||||
} | } | ||||
""" | |||||
An object with different checksums | |||||
""" | |||||
type ContentChecksum { | type ContentChecksum { | ||||
""" | |||||
""" | |||||
blake2s256: String | blake2s256: String | ||||
""" | |||||
""" | |||||
sha1: String | sha1: String | ||||
""" | |||||
""" | |||||
sha1_git: String | sha1_git: String | ||||
""" | |||||
""" | |||||
sha256: String | sha256: String | ||||
} | } | ||||
# type ContentType { | """ | ||||
# test: String | A content object | ||||
# } | """ | ||||
# type ContentLanguage { | |||||
# test: String | |||||
# } | |||||
# type ContentLicense { | |||||
# test: String | |||||
# } | |||||
type Content implements MerkleNode & Node { | type Content implements MerkleNode & Node { | ||||
""" | |||||
Unique identifier | |||||
""" | |||||
id: ID! | id: ID! | ||||
""" | |||||
SWHID of the content object | |||||
""" | |||||
SWHID: SWHID! | SWHID: SWHID! | ||||
""" | |||||
Checksums for the content | |||||
""" | |||||
checksum: ContentChecksum | checksum: ContentChecksum | ||||
# data: | |||||
# filetype: ContentType | """ | ||||
# language: ContentLanguage | Length of the content in bytes | ||||
# license: ContentLicense | """ | ||||
length: Int | length: Int | ||||
""" | |||||
Content status, visible or hidden | |||||
""" | |||||
status: String | status: String | ||||
data: String | |||||
} | } | ||||
""" | |||||
The query root of the GraphQL interface. | |||||
""" | |||||
type Query { | type Query { | ||||
""" | """ | ||||
Get an origin with its url | Get an origin with its url | ||||
""" | """ | ||||
origin( | origin( | ||||
""" | |||||
URL of the Origin | |||||
""" | |||||
url: String! | url: String! | ||||
): Origin | ): Origin | ||||
""" | """ | ||||
Get a list of origins | Get a Connection to all the origins | ||||
matching the given filters | |||||
Can also be used to search for an origin | |||||
""" | """ | ||||
# FIMXE, use Input types to make this cleaner | |||||
origins( | origins( | ||||
""" | |||||
Returns the first _n_ elements from the list | |||||
""" | |||||
first: Int! | first: Int! | ||||
""" | |||||
Returns the page after the cursor | |||||
""" | |||||
after: String | after: String | ||||
""" | |||||
Filter origins with a URL pattern | |||||
""" | |||||
urlPattern: String | urlPattern: String | ||||
): OriginConnection | ): OriginConnection | ||||
""" | """ | ||||
Get a visit object with its id | Get the visit object with an origin URL and a visit id | ||||
and/or origin and visit id | |||||
""" | """ | ||||
visit( | visit( | ||||
""" | |||||
URL of the origin | |||||
""" | |||||
originUrl: String! | originUrl: String! | ||||
""" | |||||
Visit id to get | |||||
""" | |||||
visitId: Int! | visitId: Int! | ||||
): Visit | ): Visit | ||||
""" | """ | ||||
Get a snapshot with Sha1 | Get the snapshot with a SWHID | ||||
""" | """ | ||||
snapshot( | snapshot( | ||||
""" | |||||
SWHID of the snapshot object | |||||
""" | |||||
SWHID: SWHID! | SWHID: SWHID! | ||||
): Snapshot | ): Snapshot | ||||
""" | """ | ||||
Get the revision with the given Sha1 | Get the revision with a SWHID | ||||
""" | """ | ||||
revision( | revision( | ||||
""" | |||||
SWHID of the revision object | |||||
""" | |||||
SWHID: SWHID! | SWHID: SWHID! | ||||
): Revision | ): Revision | ||||
""" | """ | ||||
Get the release with the given Sha1 | Get the release with a SWHID | ||||
""" | """ | ||||
release( | release( | ||||
""" | |||||
SWHID of the release object | |||||
""" | |||||
SWHID: SWHID! | SWHID: SWHID! | ||||
): Release | ): Release | ||||
""" | """ | ||||
Get the directory with the given Sha1 | Get the directory with a SWHID | ||||
""" | """ | ||||
directory( | directory( | ||||
""" | |||||
SWHID of the directory object | |||||
""" | |||||
SWHID: SWHID! | SWHID: SWHID! | ||||
): Directory | ): Directory | ||||
""" | """ | ||||
Get the content with the given Sha1 | Get the content with a SWHID | ||||
""" | """ | ||||
content( | content( | ||||
""" | |||||
SWHID of the content object | |||||
""" | |||||
SWHID: SWHID! | SWHID: SWHID! | ||||
): Content | ): Content | ||||
# """ | |||||
# Search with the given swhid | |||||
# """ | |||||
# searchWithSwhid | |||||
} | } |
you should make it clear this is internal to the protocol for caching purposes, and should not be used outside the API client library