Changeset View
Changeset View
Standalone View
Standalone View
swh/graphql/schema/schema.graphql
directive @cost(complexity: Int, multipliers: [String!], useMultipliers: Boolean) on FIELD | FIELD_DEFINITION | |||||
""" | """ | ||||
SoftWare Heritage persistent Identifier | SoftWare Heritage persistent Identifier | ||||
""" | """ | ||||
scalar SWHID | scalar SWHID | ||||
""" | """ | ||||
ISO-8601 encoded date string | ISO-8601 encoded date string | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | visits( | ||||
Returns the first _n_ elements from the list | Returns the first _n_ elements from the list | ||||
""" | """ | ||||
first: Int! | first: Int! | ||||
""" | """ | ||||
Returns the page after this cursor | Returns the page after this cursor | ||||
""" | """ | ||||
after: String | after: String | ||||
): VisitConnection | ): VisitConnection! @cost(complexity: 1, multipliers: ["first"]) | ||||
""" | """ | ||||
Latest visit object for the origin | Latest visit object for the origin | ||||
""" | """ | ||||
latestVisit( | latestVisit( | ||||
""" | """ | ||||
Return the latest visit with the given visit type | Return the latest visit with the given visit type | ||||
""" | """ | ||||
visitType: String | visitType: String | ||||
""" | """ | ||||
Return the latest visit with any of the given statuses | Return the latest visit with any of the given statuses | ||||
""" | """ | ||||
allowedStatuses: [VisitStatusState] | allowedStatuses: [VisitStatusState] | ||||
""" | """ | ||||
If True, the latest visit with a snapshot will be returned | If True, the latest visit with a snapshot will be returned | ||||
""" | """ | ||||
requireSnapshot: Boolean | requireSnapshot: Boolean | ||||
): Visit | ): Visit @cost(complexity: 1) | ||||
""" | """ | ||||
Connection to all the snapshots for the origin | Connection to all the snapshots for the origin | ||||
""" | """ | ||||
snapshots( | snapshots( | ||||
""" | """ | ||||
Returns the first _n_ elements from the list | Returns the first _n_ elements from the list | ||||
""" | """ | ||||
first: Int! | first: Int! | ||||
""" | """ | ||||
Returns the page after this cursor | Returns the page after this cursor | ||||
""" | """ | ||||
after: String | after: String | ||||
): SnapshotConnection | ): SnapshotConnection @cost(complexity: 2, multipliers: ["first"]) # This costs more because of local (graphql level) pagination | ||||
} | } | ||||
""" | """ | ||||
Connection to origin visits | Connection to origin visits | ||||
""" | """ | ||||
type VisitConnection { | type VisitConnection { | ||||
""" | """ | ||||
List of visit edges | List of visit edges | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | statuses( | ||||
Returns the first _n_ elements from the list | Returns the first _n_ elements from the list | ||||
""" | """ | ||||
first: Int | first: Int | ||||
""" | """ | ||||
Returns the page after this cursor | Returns the page after this cursor | ||||
""" | """ | ||||
after: String | after: String | ||||
): VisitStatusConnection | ): VisitStatusConnection @cost(complexity: 3) # here first is optional, hence adding a higher value for cost | ||||
""" | """ | ||||
Latest status object for the Visit | Latest status object for the Visit | ||||
""" | """ | ||||
latestStatus( | latestStatus( | ||||
""" | """ | ||||
Filter by status state | Filter by status state | ||||
""" | """ | ||||
allowedStatuses: [VisitStatusState] | allowedStatuses: [VisitStatusState] | ||||
""" | """ | ||||
Filter by the availability of a snapshot in the status | Filter by the availability of a snapshot in the status | ||||
""" | """ | ||||
requireSnapshot: Boolean | requireSnapshot: Boolean | ||||
): VisitStatus | ): VisitStatus @cost(complexity: 1) | ||||
} | } | ||||
""" | """ | ||||
Connection to visit status | Connection to visit status | ||||
""" | """ | ||||
type VisitStatusConnection { | type VisitStatusConnection { | ||||
""" | """ | ||||
List of visit status edges | List of visit status edges | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | type VisitStatus { | ||||
""" | """ | ||||
ISO-8601 encoded date string | ISO-8601 encoded date string | ||||
""" | """ | ||||
date: DateTime! | date: DateTime! | ||||
""" | """ | ||||
Snapshot object | Snapshot object | ||||
""" | """ | ||||
snapshot: Snapshot | snapshot: Snapshot @cost(complexity: 1) | ||||
""" | """ | ||||
Type of the origin visited. Eg: git/hg/svn/tar/deb | Type of the origin visited. Eg: git/hg/svn/tar/deb | ||||
""" | """ | ||||
type: String | type: String | ||||
} | } | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | branches( | ||||
Return branches whose name contains the given substring | Return branches whose name contains the given substring | ||||
""" | """ | ||||
nameInclude: String | nameInclude: String | ||||
""" | """ | ||||
Do not return branches whose name contains the given prefix | Do not return branches whose name contains the given prefix | ||||
""" | """ | ||||
nameExcludePrefix: String | nameExcludePrefix: String | ||||
): BranchConnection | ): BranchConnection @cost(complexity: 2, multipliers: ["first"]) # This costs more because of local (graphql level) pagination | ||||
} | } | ||||
""" | """ | ||||
Connection to snapshot branches | Connection to snapshot branches | ||||
""" | """ | ||||
type BranchConnection { | type BranchConnection { | ||||
""" | """ | ||||
List of branch edges | List of branch edges | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | type Branch { | ||||
""" | """ | ||||
Type of Branch target | Type of Branch target | ||||
""" | """ | ||||
targetType: BranchTargetType | targetType: BranchTargetType | ||||
""" | """ | ||||
Branch target object | Branch target object | ||||
""" | """ | ||||
target: BranchTarget | target: BranchTarget @cost(complexity: 1) | ||||
} | } | ||||
""" | """ | ||||
Connection to revisions | Connection to revisions | ||||
""" | """ | ||||
type RevisionConnection { | type RevisionConnection { | ||||
""" | """ | ||||
List of revision edges | List of revision edges | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | type Revision implements MerkleNode & Node { | ||||
""" | """ | ||||
Type of the revision, eg: git/hg | Type of the revision, eg: git/hg | ||||
""" | """ | ||||
type: String | type: String | ||||
""" | """ | ||||
The unique directory object that revision points to | The unique directory object that revision points to | ||||
""" | """ | ||||
directory: Directory | directory: Directory @cost(complexity: 1) | ||||
""" | """ | ||||
Connection to all the parents of the revision | Connection to all the parents of the revision | ||||
""" | """ | ||||
parents( | parents( | ||||
""" | """ | ||||
Returns the first _n_ elements from the list | Returns the first _n_ elements from the list | ||||
""" | """ | ||||
first: Int | first: Int | ||||
""" | """ | ||||
Returns the page after this cursor | Returns the page after this cursor | ||||
""" | """ | ||||
after: String | after: String | ||||
): RevisionConnection | ): RevisionConnection @cost(complexity: 3) # here first is not mandatory, hence adding a higher value for cost | ||||
""" | """ | ||||
Connection to all the revisions heading to this one | Connection to all the revisions heading to this one | ||||
aka the commit log | aka the commit log | ||||
""" | """ | ||||
revisionLog( | revisionLog( | ||||
""" | """ | ||||
Returns the first _n_ elements from the list | Returns the first _n_ elements from the list | ||||
""" | """ | ||||
first: Int! | first: Int! | ||||
""" | """ | ||||
Returns the page after the cursor | Returns the page after the cursor | ||||
""" | """ | ||||
after: String | after: String | ||||
): RevisionConnection | ): RevisionConnection @cost(complexity: 2, multipliers: ["first"]) # This costs more because of local (graphql level) pagination | ||||
} | } | ||||
""" | """ | ||||
Possible release target objects | Possible release target objects | ||||
""" | """ | ||||
union ReleaseTarget = Release | Revision | Directory | Content | union ReleaseTarget = Release | Revision | Directory | Content | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | type Release implements MerkleNode & Node { | ||||
""" | """ | ||||
Type of release target | Type of release target | ||||
""" | """ | ||||
targetType: ReleaseTargetType | targetType: ReleaseTargetType | ||||
""" | """ | ||||
Release target object | Release target object | ||||
""" | """ | ||||
target: ReleaseTarget | target: ReleaseTarget @cost(complexity: 1) | ||||
} | } | ||||
""" | """ | ||||
Connection to directory entries | Connection to directory entries | ||||
""" | """ | ||||
type DirectoryEntryConnection { | type DirectoryEntryConnection { | ||||
""" | """ | ||||
List of directory entry edges | List of directory entry edges | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | type DirectoryEntry { | ||||
""" | """ | ||||
Directory entry object type; can be file, dir or rev | Directory entry object type; can be file, dir or rev | ||||
""" | """ | ||||
targetType: DirectoryEntryTargetType | targetType: DirectoryEntryTargetType | ||||
""" | """ | ||||
Directory entry target object | Directory entry target object | ||||
""" | """ | ||||
target: DirectoryEntryTarget | target: DirectoryEntryTarget @cost(complexity: 1) | ||||
} | } | ||||
""" | """ | ||||
A directory object | A directory object | ||||
""" | """ | ||||
type Directory implements MerkleNode & Node { | type Directory implements MerkleNode & Node { | ||||
""" | """ | ||||
Unique identifier | Unique identifier | ||||
Show All 18 Lines | entries( | ||||
Returns the page after this cursor | Returns the page after this cursor | ||||
""" | """ | ||||
after: String | after: String | ||||
""" | """ | ||||
Filter by entry name | Filter by entry name | ||||
""" | """ | ||||
nameInclude: String | nameInclude: String | ||||
): DirectoryEntryConnection | ): DirectoryEntryConnection @cost(complexity: 2, multipliers: ["first"]) # pagination is local, hence adding a higher value for cost | ||||
} | } | ||||
""" | """ | ||||
An object with different content checksums | An object with different content checksums | ||||
""" | """ | ||||
type ContentChecksum { | type ContentChecksum { | ||||
blake2s256: String | blake2s256: String | ||||
sha1: String | sha1: String | ||||
▲ Show 20 Lines • Show All 145 Lines • ▼ Show 20 Lines | type SearchResult { | ||||
""" | """ | ||||
Result target type | Result target type | ||||
""" | """ | ||||
targetType: SearchResultTargetType | targetType: SearchResultTargetType | ||||
""" | """ | ||||
Result target object | Result target object | ||||
""" | """ | ||||
target: SearchResultTarget | target: SearchResultTarget @cost(complexity: 1) | ||||
} | } | ||||
""" | """ | ||||
The query root of the GraphQL interface. | 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 of the Origin | ||||
""" | """ | ||||
url: String! | url: String! | ||||
): Origin | ): Origin @cost(complexity: 1) | ||||
""" | """ | ||||
Get a Connection to all the origins | Get a Connection to all the origins | ||||
""" | """ | ||||
origins( | origins( | ||||
""" | """ | ||||
Returns the first _n_ elements from the list | Returns the first _n_ elements from the list | ||||
""" | """ | ||||
first: Int! | first: Int! | ||||
""" | """ | ||||
Returns the page after the cursor | Returns the page after the cursor | ||||
""" | """ | ||||
after: String | after: String | ||||
""" | """ | ||||
Filter origins with a URL pattern | Filter origins with a URL pattern | ||||
""" | """ | ||||
urlPattern: String | urlPattern: String | ||||
): OriginConnection | ): OriginConnection @cost(complexity: 1, multipliers: ["first"]) | ||||
""" | """ | ||||
Get the visit object with an origin URL and a visit id | Get the visit object with an origin URL and a visit id | ||||
""" | """ | ||||
visit( | visit( | ||||
""" | """ | ||||
URL of the origin | URL of the origin | ||||
""" | """ | ||||
originUrl: String! | originUrl: String! | ||||
""" | """ | ||||
Visit id to get | Visit id to get | ||||
""" | """ | ||||
visitId: Int! | visitId: Int! | ||||
): Visit | ): Visit @cost(complexity: 1) | ||||
""" | """ | ||||
Get the snapshot with a SWHID | Get the snapshot with a SWHID | ||||
""" | """ | ||||
snapshot( | snapshot( | ||||
""" | """ | ||||
SWHID of the snapshot object | SWHID of the snapshot object | ||||
""" | """ | ||||
swhid: SWHID! | swhid: SWHID! | ||||
): Snapshot | ): Snapshot @cost(complexity: 1) | ||||
""" | """ | ||||
Get the revision with a SWHID | Get the revision with a SWHID | ||||
""" | """ | ||||
revision( | revision( | ||||
""" | """ | ||||
SWHID of the revision object | SWHID of the revision object | ||||
""" | """ | ||||
swhid: SWHID! | swhid: SWHID! | ||||
): Revision | ): Revision @cost(complexity: 1) | ||||
""" | """ | ||||
Get the release with a SWHID | Get the release with a SWHID | ||||
""" | """ | ||||
release( | release( | ||||
""" | """ | ||||
SWHID of the release object | SWHID of the release object | ||||
""" | """ | ||||
swhid: SWHID! | swhid: SWHID! | ||||
): Release | ): Release @cost(complexity: 1) | ||||
""" | """ | ||||
Get the directory with a SWHID | Get the directory with a SWHID | ||||
""" | """ | ||||
directory( | directory( | ||||
""" | """ | ||||
SWHID of the directory object | SWHID of the directory object | ||||
""" | """ | ||||
swhid: SWHID! | swhid: SWHID! | ||||
): Directory | ): Directory @cost(complexity: 1) | ||||
""" | """ | ||||
Get a directory entry with directory SWHID and a path | Get a directory entry with directory SWHID and a path | ||||
""" | """ | ||||
directoryEntry( | directoryEntry( | ||||
""" | """ | ||||
SWHID of the directory object | SWHID of the directory object | ||||
""" | """ | ||||
directorySwhid: SWHID! | directorySwhid: SWHID! | ||||
""" | """ | ||||
Relative path to the requested object | Relative path to the requested object | ||||
""" | """ | ||||
path: String! | path: String! | ||||
): DirectoryEntry | ): DirectoryEntry @cost(complexity: 1) | ||||
""" | """ | ||||
Get the content with a SWHID | Get the content with a SWHID | ||||
""" | """ | ||||
content( | content( | ||||
""" | """ | ||||
SWHID of the content object | SWHID of the content object | ||||
""" | """ | ||||
swhid: SWHID! | swhid: SWHID! | ||||
): Content | ): Content @cost(complexity: 1) | ||||
""" | """ | ||||
Get the content by one or more hashes | Get the content by one or more hashes | ||||
Use multiple hashes for an accurate result | Use multiple hashes for an accurate result | ||||
""" | """ | ||||
contentByHash( | contentByHash( | ||||
""" | """ | ||||
List of hashType:hashValue strings | List of hashType:hashValue strings | ||||
""" | """ | ||||
checksums: [ContentHash]! | checksums: [ContentHash]! | ||||
): Content | ): Content @cost(complexity: 1) | ||||
""" | """ | ||||
Resolve the given SWHID to an object | Resolve the given SWHID to an object | ||||
""" | """ | ||||
resolveSwhid( | resolveSwhid( | ||||
""" | """ | ||||
SWHID to look for | SWHID to look for | ||||
""" | """ | ||||
swhid: SWHID! | swhid: SWHID! | ||||
): SearchResultConnection | ): SearchResultConnection! @cost(complexity: 1) | ||||
""" | """ | ||||
Search in SWH | Search in SWH | ||||
""" | """ | ||||
search( | search( | ||||
""" | """ | ||||
String to search for | String to search for | ||||
""" | """ | ||||
query: String! | query: String! | ||||
""" | """ | ||||
Returns the first _n_ elements from the list | Returns the first _n_ elements from the list | ||||
""" | """ | ||||
first: Int! | first: Int! | ||||
""" | """ | ||||
Returns the page after the cursor | Returns the page after the cursor | ||||
""" | """ | ||||
after: String | after: String | ||||
): SearchResultConnection | ): SearchResultConnection! @cost(complexity: 1, multipliers: ["first"]) | ||||
} | } |