1
Fork 0
photoview/api/graphql/schema.graphql

338 lines
7.6 KiB
GraphQL
Raw Normal View History

2020-01-31 23:30:34 +01:00
directive @isAdmin on FIELD_DEFINITION
2020-01-31 18:51:24 +01:00
scalar Time
scalar Any
2020-01-31 18:51:24 +01:00
2020-02-09 15:26:59 +01:00
enum OrderDirection {
ASC
DESC
}
input Pagination {
2020-02-09 15:26:59 +01:00
limit: Int
offset: Int
}
input Ordering {
order_by: String
order_direction: OrderDirection
}
2020-01-30 14:28:14 +01:00
type Query {
2020-02-09 12:53:21 +01:00
siteInfo: SiteInfo!
2020-02-05 16:49:51 +01:00
2020-02-01 14:52:27 +01:00
"List of registered users, must be admin to call"
user(order: Ordering, paginate: Pagination): [User!]! @isAdmin
2020-02-01 14:52:27 +01:00
"Information about the currently logged in user"
2020-02-09 12:53:21 +01:00
myUser: User!
2020-02-01 14:52:27 +01:00
2020-02-20 17:14:11 +01:00
"List of albums owned by the logged in user."
myAlbums(
order: Ordering,
paginate: Pagination
2020-02-20 17:14:11 +01:00
"Return only albums from the root directory of the user"
onlyRoot: Boolean
"Return also albums with no media directly in them"
2020-02-20 17:14:11 +01:00
showEmpty: Boolean
"Show only albums having favorites"
onlyWithFavorites: Boolean
2020-02-20 17:14:11 +01:00
): [Album!]!
2020-02-01 14:52:27 +01:00
"Get album by id, user must own the album or be admin"
album(id: ID!): Album!
2020-02-01 14:52:27 +01:00
"List of media owned by the logged in user"
myMedia(order: Ordering, paginate: Pagination): [Media!]!
"Get media by id, user must own the media or be admin"
media(id: ID!): Media!
2020-02-09 21:25:33 +01:00
"Get a list of media by their ids, user must own the media or be admin"
mediaList(ids: [ID!]!): [Media!]!
myTimeline(paginate: Pagination, onlyFavorites: Boolean): [TimelineGroup!]!
2021-02-04 19:02:51 +01:00
"Get media owned by the logged in user, returned in GeoJson format"
myMediaGeoJson: Any!
"Get the mapbox api token, returns null if mapbox is not enabled"
mapboxToken: String
2020-02-11 14:32:35 +01:00
shareToken(token: String!, password: String): ShareToken!
2020-06-14 20:56:48 +02:00
shareTokenValidatePassword(token: String!, password: String): Boolean!
2020-03-05 11:53:42 +01:00
search(query: String!, limitMedia: Int, limitAlbums: Int): SearchResult!
2021-02-16 12:01:10 +01:00
myFaceGroups(paginate: Pagination): [FaceGroup!]!
2020-01-30 14:28:14 +01:00
}
type Mutation {
authorizeUser(username: String!, password: String!): AuthorizeResult!
2020-02-05 16:49:51 +01:00
"Registers the initial user, can only be called if initialSetup from SiteInfo is true"
initialSetupWizard(
username: String!
password: String!
rootPath: String!
): AuthorizeResult
2020-02-01 17:58:45 +01:00
"Scan all users for new media"
2020-02-16 12:22:00 +01:00
scanAll: ScannerResult! @isAdmin
"Scan a single user for new media"
scanUser(userId: ID!): ScannerResult!
2020-02-09 21:25:33 +01:00
"Generate share token for album"
shareAlbum(albumId: ID!, expire: Time, password: String): ShareToken
"Generate share token for media"
shareMedia(mediaId: ID!, expire: Time, password: String): ShareToken
2020-02-11 15:36:12 +01:00
"Delete a share token by it's token value"
deleteShareToken(token: String!): ShareToken
"Set a password for a token, if null is passed for the password argument, the password will be cleared"
protectShareToken(token: String!, password: String): ShareToken
2020-02-16 12:22:00 +01:00
"Mark or unmark a media as being a favorite"
favoriteMedia(mediaId: ID!, favorite: Boolean!): Media
2020-06-17 18:00:58 +02:00
2020-02-16 12:22:00 +01:00
updateUser(
id: ID!
2020-02-16 12:22:00 +01:00
username: String
2020-02-22 14:05:33 +01:00
password: String
2020-02-16 12:22:00 +01:00
admin: Boolean
): User @isAdmin
createUser(
username: String!
password: String
admin: Boolean!
): User @isAdmin
deleteUser(id: ID!): User @isAdmin
2020-09-21 11:50:39 +02:00
"Add a root path from where to look for media for the given user"
userAddRootPath(id: ID!, rootPath: String!): Album @isAdmin
userRemoveRootAlbum(userId: ID!, albumId: ID!): Album @isAdmin
2020-09-21 11:50:39 +02:00
"""
Set how often, in seconds, the server should automatically scan for new media,
a value of 0 will disable periodic scans
"""
setPeriodicScanInterval(interval: Int!): Int!
"Set max number of concurrent scanner jobs running at once"
setScannerConcurrentWorkers(workers: Int!): Int!
2020-01-30 14:28:14 +01:00
}
type Subscription {
notification: Notification!
}
enum NotificationType {
Message
Progress
2020-02-26 19:44:47 +01:00
"Close a notification with a given key"
Close
}
type Notification {
key: String!
type: NotificationType!
header: String!
content: String!
progress: Float
positive: Boolean!
negative: Boolean!
2020-02-26 19:44:47 +01:00
"Time in milliseconds before the notification will close"
timeout: Int
}
2020-01-30 14:28:14 +01:00
type AuthorizeResult {
success: Boolean!
status: String!
token: String
}
2020-02-01 17:58:45 +01:00
type ScannerResult {
finished: Boolean!
success: Boolean!
progress: Float
message: String
}
"A token used to publicly access an album or media"
2020-02-09 21:25:33 +01:00
type ShareToken {
id: ID!
2020-02-09 21:25:33 +01:00
token: String!
"The user who created the token"
owner: User!
"Optional expire date"
expire: Time
"Whether or not a password is needed to access the share"
hasPassword: Boolean!
2020-02-09 21:25:33 +01:00
"The album this token shares"
album: Album
"The media this token shares"
media: Media
2020-02-09 21:25:33 +01:00
}
"General information about the site"
2020-02-05 16:49:51 +01:00
type SiteInfo {
initialSetup: Boolean!
"How often automatic scans should be initiated in seconds"
periodicScanInterval: Int! @isAdmin
"How many max concurrent scanner jobs that should run at once"
concurrentWorkers: Int! @isAdmin
2020-02-05 16:49:51 +01:00
}
2020-01-30 14:28:14 +01:00
type User {
id: ID!
2020-01-30 14:28:14 +01:00
username: String!
#albums: [Album]
# rootPath: String! @isAdmin
"All albums owned by this user"
albums: [Album!]! @isAdmin
"Top level albums owned by this user"
rootAlbums: [Album!]! @isAdmin
2020-01-30 14:28:14 +01:00
admin: Boolean!
#shareTokens: [ShareToken]
}
2020-02-01 14:52:27 +01:00
type Album {
id: ID!
2020-02-09 12:53:21 +01:00
title: String!
"The media inside this album"
media(
order: Ordering,
paginate: Pagination
"Return only the favorited media"
onlyFavorites: Boolean
): [Media!]!
2020-02-09 21:25:33 +01:00
"The albums contained in this album"
subAlbums(
order: Ordering,
paginate: Pagination
): [Album!]!
2020-02-09 21:25:33 +01:00
"The album witch contains this album"
2020-02-01 14:52:27 +01:00
parentAlbum: Album
2020-02-09 21:25:33 +01:00
"The user who owns this album"
2020-02-01 14:52:27 +01:00
owner: User!
2020-02-09 21:25:33 +01:00
"The path on the filesystem of the server, where this album is located"
2020-03-07 16:19:27 +01:00
filePath: String!
2020-02-09 21:25:33 +01:00
"An image in this album used for previewing this album"
thumbnail: Media
2020-03-07 16:19:27 +01:00
path: [Album!]!
2020-02-01 14:52:27 +01:00
2020-02-11 14:32:35 +01:00
shares: [ShareToken]
2020-02-01 14:52:27 +01:00
}
type MediaURL {
2020-02-01 14:52:27 +01:00
"URL for previewing the image"
2020-02-09 12:53:21 +01:00
url: String!
2020-02-01 14:52:27 +01:00
"Width of the image in pixels"
2020-02-09 12:53:21 +01:00
width: Int!
2020-02-01 14:52:27 +01:00
"Height of the image in pixels"
2020-02-09 12:53:21 +01:00
height: Int!
"The file size of the resource in bytes"
fileSize: Int!
2020-02-01 14:52:27 +01:00
}
type MediaDownload {
2020-02-10 12:05:58 +01:00
title: String!
mediaUrl: MediaURL!
2020-02-10 12:05:58 +01:00
}
enum MediaType {
photo
video
}
type Media {
id: ID!
2020-02-09 12:53:21 +01:00
title: String!
"Local filepath for the media"
2020-02-09 12:53:21 +01:00
path: String!
"URL to display the media in a smaller resolution"
thumbnail: MediaURL
"URL to display the photo in full resolution, will be null for videos"
highRes: MediaURL
2020-07-11 15:57:58 +02:00
"URL to get the video in a web format that can be played in the browser, will be null for photos"
videoWeb: MediaURL
"The album that holds the media"
2020-02-01 14:52:27 +01:00
album: Album!
exif: MediaEXIF
2020-07-12 14:17:49 +02:00
videoMetadata: VideoMetadata
2020-06-17 18:00:58 +02:00
favorite: Boolean!
type: MediaType!
2020-02-01 14:52:27 +01:00
2020-02-10 12:05:58 +01:00
shares: [ShareToken!]!
downloads: [MediaDownload!]!
2020-02-01 14:52:27 +01:00
}
2020-02-02 00:29:42 +01:00
"EXIF metadata from the camera"
type MediaEXIF {
id: ID!
media: Media!
2020-02-02 00:29:42 +01:00
"The model name of the camera"
camera: String
"The maker of the camera"
maker: String
"The name of the lens"
lens: String
dateShot: Time
"The exposure time of the image"
exposure: String
"The aperature stops of the image"
aperture: Float
"The ISO setting of the image"
iso: Int
"The focal length of the lens, when the image was taken"
2020-02-24 23:30:08 +01:00
focalLength: Float
2020-02-02 00:29:42 +01:00
"A formatted description of the flash settings, when the image was taken"
flash: String
2020-02-24 23:30:08 +01:00
"An index describing the mode for adjusting the exposure of the image"
exposureProgram: Int
2020-02-02 00:29:42 +01:00
}
2020-03-05 11:53:42 +01:00
2020-07-12 14:17:49 +02:00
type VideoMetadata {
id: ID!
2020-07-12 14:17:49 +02:00
media: Media!
width: Int!
height: Int!
duration: Float!
codec: String
framerate: Float
bitrate: String
2020-07-12 14:17:49 +02:00
colorProfile: String
audio: String
}
2020-03-05 11:53:42 +01:00
type SearchResult {
query: String!
albums: [Album!]!
media: [Media!]!
2020-03-05 11:53:42 +01:00
}
2021-02-04 19:02:51 +01:00
type TimelineGroup {
album: Album!
media: [Media!]!
mediaTotal: Int!
date: Time!
}
2021-02-16 12:01:10 +01:00
type FaceGroup {
id: ID!
label: String
imageFaces: [ImageFace!]!
}
type ImageFace {
id: ID!
media: Media!
rectangle: FaceRectangle
}
type FaceRectangle {
minX: Float!
maxX: Float!
minY: Float!
maxY: Float!
}