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

497 lines
14 KiB
GraphQL
Raw Normal View History

directive @isAuthorized on FIELD_DEFINITION
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
2022-02-05 01:21:00 +01:00
"Used to specify which order to sort items in"
2020-02-09 15:26:59 +01:00
enum OrderDirection {
2022-02-05 01:21:00 +01:00
"Sort accending A-Z"
2020-02-09 15:26:59 +01:00
ASC
2022-02-05 01:21:00 +01:00
"Sort decending Z-A"
2020-02-09 15:26:59 +01:00
DESC
}
2022-02-05 01:21:00 +01:00
"Used to specify pagination on a list of items"
input Pagination {
2022-02-05 01:21:00 +01:00
"How many items to maximally fetch"
2020-02-09 15:26:59 +01:00
limit: Int
2022-02-05 01:21:00 +01:00
"How many items to skip from the beginning of the query, specified by the `Ordering`"
2020-02-09 15:26:59 +01:00
offset: Int
}
2022-02-05 01:21:00 +01:00
"Used to specify how to sort items"
input Ordering {
2022-02-05 01:21:00 +01:00
"A column in the database to order by"
order_by: String
order_direction: OrderDirection
}
"Credentials used to identify and authenticate a share token"
input ShareTokenCredentials {
token: String!
password: String
}
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"
myUser: User! @isAuthorized
2022-02-05 01:21:00 +01:00
"User preferences for the logged in user"
myUserPreferences: UserPreferences! @isAuthorized
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
): [Album!]! @isAuthorized
"""
Get album by id, user must own the album or be admin
If valid tokenCredentials are provided, the album may be retrived without further authentication
"""
album(id: ID!, tokenCredentials: ShareTokenCredentials): Album!
2020-02-01 14:52:27 +01:00
"List of media owned by the logged in user"
myMedia(order: Ordering, paginate: Pagination): [Media!]! @isAuthorized
"""
Get media by id, user must own the media or be admin.
If valid tokenCredentials are provided, the media may be retrived without further authentication
"""
media(id: ID!, tokenCredentials: ShareTokenCredentials): 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!]!
2021-09-18 20:17:24 +02:00
"""
Get a list of media, ordered first by day, then by album if multiple media was found for the same day.
"""
myTimeline(
paginate: Pagination,
onlyFavorites: Boolean,
"Only fetch media that is older than this date"
fromDate: Time
): [Media!]! @isAuthorized
2021-02-04 19:02:51 +01:00
"Get media owned by the logged in user, returned in GeoJson format"
myMediaGeoJson: Any! @isAuthorized
"Get the mapbox api token, returns null if mapbox is not enabled"
mapboxToken: String
2022-02-05 01:21:00 +01:00
"Fetch a share token containing an `Album` or `Media`"
shareToken(credentials: ShareTokenCredentials!): ShareToken!
2022-02-05 01:21:00 +01:00
"Check if the `ShareToken` credentials are valid"
shareTokenValidatePassword(credentials: ShareTokenCredentials!): Boolean!
2020-03-05 11:53:42 +01:00
2022-02-05 01:21:00 +01:00
"Perform a search query on the contents of the media library"
search(query: String!, limitMedia: Int, limitAlbums: Int): SearchResult!
2021-02-16 12:01:10 +01:00
2022-02-05 01:21:00 +01:00
"Get a list of `FaceGroup`s for the logged in user"
myFaceGroups(paginate: Pagination): [FaceGroup!]! @isAuthorized
2022-02-05 01:21:00 +01:00
"Get a particular `FaceGroup` specified by its ID"
faceGroup(id: ID!): FaceGroup! @isAuthorized
2020-01-30 14:28:14 +01:00
}
type Mutation {
2022-02-05 01:21:00 +01:00
"Authorizes a user and returns a token used to identify the new session"
2020-01-30 14:28:14 +01:00
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! @isAdmin
2020-02-09 21:25:33 +01:00
"Generate share token for album"
2021-04-13 19:57:33 +02:00
shareAlbum(albumId: ID!, expire: Time, password: String): ShareToken! @isAuthorized
"Generate share token for media"
2021-04-13 19:57:33 +02:00
shareMedia(mediaId: ID!, expire: Time, password: String): ShareToken! @isAuthorized
2020-02-11 15:36:12 +01:00
"Delete a share token by it's token value"
2021-04-13 19:57:33 +02:00
deleteShareToken(token: String!): ShareToken! @isAuthorized
"Set a password for a token, if null is passed for the password argument, the password will be cleared"
2021-04-13 19:57:33 +02:00
protectShareToken(token: String!, password: String): ShareToken! @isAuthorized
2020-02-16 12:22:00 +01:00
"Mark or unmark a media as being a favorite"
2021-04-13 19:57:33 +02:00
favoriteMedia(mediaId: ID!, favorite: Boolean!): Media! @isAuthorized
2020-06-17 18:00:58 +02:00
2022-02-05 01:21:00 +01:00
"Update a user, fields left as `null` will not be changed"
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
2021-04-13 19:57:33 +02:00
): User! @isAdmin
2022-02-05 01:21:00 +01:00
"Create a new user"
2020-02-16 12:22:00 +01:00
createUser(
username: String!
password: String
admin: Boolean!
2021-04-13 19:57:33 +02:00
): User! @isAdmin
2022-02-05 01:21:00 +01:00
"Delete an existing user"
2021-04-13 19:57:33 +02:00
deleteUser(id: ID!): User! @isAdmin
2020-09-21 11:50:39 +02:00
2022-02-05 01:21:00 +01:00
"Add a root path from where to look for media for the given user, specified by their user id."
userAddRootPath(id: ID!, rootPath: String!): Album @isAdmin
2022-02-05 01:21:00 +01:00
"""
Remove a root path from a user, specified by the id of the user and the top album representing the root path.
This album was returned when creating the path using `userAddRootPath`.
A list of root paths for a particular user can be retrived from the `User.rootAlbums` path.
"""
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! @isAdmin
"Set max number of concurrent scanner jobs running at once"
setScannerConcurrentWorkers(workers: Int!): Int! @isAdmin
2022-08-05 20:37:55 +02:00
"Set the filter to be used when generating thumbnails"
setThumbnailDownsampleMethod(method: ThumbnailFilter!): ThumbnailFilter! @isAdmin
2022-08-05 20:37:55 +02:00
2022-02-05 01:21:00 +01:00
"Change user preferences for the logged in user"
changeUserPreferences(language: String): UserPreferences! @isAuthorized
2021-02-17 13:50:32 +01:00
"Reset the assigned cover photo for an album"
resetAlbumCover(albumID: ID!): Album! @isAuthorized
"Assign a cover photo to an album"
setAlbumCover(coverID: ID!): Album! @isAuthorized
2021-02-17 13:50:32 +01:00
"Assign a label to a face group, set label to null to remove the current one"
setFaceGroupLabel(faceGroupID: ID!, label: String): FaceGroup! @isAuthorized
2021-02-17 13:50:32 +01:00
"Merge two face groups into a single one, all ImageFaces from source will be moved to destination"
combineFaceGroups(destinationFaceGroupID: ID!, sourceFaceGroupID: ID!): FaceGroup! @isAuthorized
2021-02-20 14:45:43 +01:00
"Move a list of ImageFaces to another face group"
moveImageFaces(imageFaceIDs: [ID!]!, destinationFaceGroupID: ID!): FaceGroup! @isAuthorized
2021-02-17 13:50:32 +01:00
"Check all unlabeled faces to see if they match a labeled FaceGroup, and move them if they match"
recognizeUnlabeledFaces: [ImageFace!]! @isAuthorized
2021-02-22 18:14:31 +01:00
"Move a list of ImageFaces to a new face group"
detachImageFaces(imageFaceIDs: [ID!]!): FaceGroup! @isAuthorized
2020-01-30 14:28:14 +01:00
}
type Subscription {
notification: Notification!
}
2022-02-05 01:21:00 +01:00
"Specified the type a particular notification is of"
enum NotificationType {
2022-02-05 01:21:00 +01:00
"A regular message with no special additions"
Message
2022-02-05 01:21:00 +01:00
"A notification with an attached progress indicator"
Progress
2020-02-26 19:44:47 +01:00
"Close a notification with a given key"
Close
}
type Notification {
2022-02-05 01:21:00 +01:00
"A key used to identify the notification, new notification updates with the same key, should replace the old notifications"
key: String!
type: NotificationType!
2022-02-05 01:21:00 +01:00
"The text for the title of the notification"
header: String!
2022-02-05 01:21:00 +01:00
"The text for the body of the notification"
content: String!
2022-02-05 01:21:00 +01:00
"A value between 0 and 1 when the notification type is `Progress`"
progress: Float
2022-02-05 01:21:00 +01:00
"Whether or not the message of the notification is positive, the UI might reflect this with a green color"
positive: Boolean!
2022-02-05 01:21:00 +01:00
"Whether or not the message of the notification is negative, the UI might reflect this with a red color"
negative: Boolean!
2022-02-05 01:21:00 +01:00
"Time in milliseconds before the notification should close"
2020-02-26 19:44:47 +01:00
timeout: Int
}
2020-01-30 14:28:14 +01:00
type AuthorizeResult {
success: Boolean!
2022-02-05 01:21:00 +01:00
"A textual status message describing the result, can be used to show an error message when `success` is false"
2020-01-30 14:28:14 +01:00
status: String!
2022-02-05 01:21:00 +01:00
"An access token used to authenticate new API requests as the newly authorized user. Is present when success is true"
2020-01-30 14:28:14 +01:00
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
}
"Supported downsampling filters for thumbnail generation"
enum ThumbnailFilter {
NearestNeighbor,
Box,
Linear,
MitchellNetravali,
CatmullRom,
Lanczos,
}
"General information about the site"
2020-02-05 16:49:51 +01:00
type SiteInfo {
"Whether or not the initial setup wizard should be shown"
2020-02-05 16:49:51 +01:00
initialSetup: Boolean!
"Whether or not face detection is enabled and working"
faceDetectionEnabled: 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
2022-08-05 20:37:55 +02:00
"The filter to use when generating thumbnails"
thumbnailMethod: ThumbnailFilter! @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!
"All albums owned by this user"
albums: [Album!]! @isAdmin
"Top level albums owned by this user"
rootAlbums: [Album!]! @isAdmin
2022-02-05 01:21:00 +01:00
"Whether or not the user has admin privileges"
2020-01-30 14:28:14 +01:00
admin: Boolean!
}
2020-02-01 14:52:27 +01:00
2022-02-05 01:21:00 +01:00
"Supported language translations of the user interface"
enum LanguageTranslation {
2021-04-12 00:14:27 +02:00
English,
2021-04-14 12:36:16 +02:00
French,
Italian,
2021-04-15 11:59:49 +02:00
Swedish,
Danish,
2021-04-19 13:23:21 +02:00
Spanish,
2021-04-19 19:09:40 +02:00
Polish,
2021-04-20 01:16:39 +02:00
German,
2021-07-22 13:56:29 +02:00
Russian,
TraditionalChinese,
2021-08-30 12:17:39 +02:00
SimplifiedChinese,
Portuguese,
2022-12-02 13:32:49 +01:00
Basque,
Turkish
}
2022-02-05 01:21:00 +01:00
"Preferences for regular users"
type UserPreferences {
id: ID!
language: LanguageTranslation
}
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!]!
2021-09-18 21:46:53 +02:00
"The album which 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
2022-02-05 01:21:00 +01:00
"A breadcrumb list of all parent albums down to this one"
2020-03-07 16:19:27 +01:00
path: [Album!]!
2020-02-01 14:52:27 +01:00
2022-02-05 01:21:00 +01:00
"A list of share tokens pointing to this album, owned by the logged in user"
2021-04-17 22:14:17 +02: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 {
2022-02-05 01:21:00 +01:00
"A description of the role of the media file"
2020-02-10 12:05:58 +01:00
title: String!
mediaUrl: MediaURL!
2020-02-10 12:05:58 +01:00
}
enum MediaType {
2021-04-12 00:14:27 +02:00
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!
2021-09-18 20:17:24 +02:00
"The date the image was shot or the date it was imported as a fallback"
date: Time!
2022-02-01 23:39:19 +01:00
"A short string that can be used to generate a blured version of the media, to show while the original is loading"
blurhash: String
2020-02-01 14:52:27 +01:00
2022-02-05 01:21:00 +01:00
"A list of share tokens pointing to this media, owned byt the logged in user"
2020-02-10 12:05:58 +01:00
shares: [ShareToken!]!
2022-02-05 01:21:00 +01:00
"A list of different versions of files for this media that can be downloaded by the user"
downloads: [MediaDownload!]!
2021-02-16 17:13:08 +01:00
2022-02-05 01:21:00 +01:00
"A list of faces present on the image"
2021-02-16 17:13:08 +01:00
faces: [ImageFace!]!
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!
2022-03-28 17:08:30 +02:00
"The description of the image"
description: String
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: Float
2020-02-02 00:29:42 +01:00
"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: Int
"An index describing the mode for adjusting the exposure of the image"
exposureProgram: Int
"GPS coordinates of where the image was taken"
coordinates: Coordinates
}
type Coordinates {
"GPS latitude in degrees"
latitude: Float!
"GPS longitude in degrees"
longitude: Float!
2020-02-02 00:29:42 +01:00
}
2020-03-05 11:53:42 +01:00
2022-02-05 01:21:00 +01:00
"Metadata specific to video media"
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 {
2022-02-05 01:21:00 +01:00
"The string that was searched for"
2020-03-05 11:53:42 +01:00
query: String!
2022-02-05 01:21:00 +01:00
"A list of albums that matched the query"
2020-03-05 11:53:42 +01:00
albums: [Album!]!
2022-02-05 01:21:00 +01:00
"A list of media that matched the query"
media: [Media!]!
2020-03-05 11:53:42 +01:00
}
2021-02-04 19:02:51 +01:00
2022-02-05 01:21:00 +01:00
"A group of media from the same album and the same day, that is grouped together in a timeline view"
2021-02-04 19:02:51 +01:00
type TimelineGroup {
2022-02-05 01:21:00 +01:00
"The full album containing the media in this timeline group"
2021-02-04 19:02:51 +01:00
album: Album!
2022-02-05 01:21:00 +01:00
"The media contained in this timeline group"
2021-02-04 19:02:51 +01:00
media: [Media!]!
2022-02-05 01:21:00 +01:00
"The total amount of media in this timeline group"
2021-02-04 19:02:51 +01:00
mediaTotal: Int!
2022-02-05 01:21:00 +01:00
"The day shared for all media in this timeline group"
2021-02-04 19:02:51 +01:00
date: Time!
}
2021-02-16 12:01:10 +01:00
2022-02-05 01:21:00 +01:00
"A collection of faces of a particular person"
2021-02-16 12:01:10 +01:00
type FaceGroup {
id: ID!
2022-02-05 01:21:00 +01:00
"The name of the person"
2021-02-16 12:01:10 +01:00
label: String
2021-02-25 18:48:59 +01:00
imageFaces(paginate: Pagination): [ImageFace!]!
2022-02-05 01:21:00 +01:00
"The total number of images in this collection"
2021-02-25 18:48:59 +01:00
imageFaceCount: Int!
2021-02-16 12:01:10 +01:00
}
2022-02-05 01:21:00 +01:00
"A single face on a particular image"
2021-02-16 12:01:10 +01:00
type ImageFace {
id: ID!
2022-02-05 01:21:00 +01:00
"A reference to the image the face appears on"
2021-02-16 12:01:10 +01:00
media: Media!
2022-02-05 01:21:00 +01:00
"A bounding box of where on the image the face is present"
2021-04-17 22:40:46 +02:00
rectangle: FaceRectangle!
2022-02-05 01:21:00 +01:00
"The `FaceGroup` that contains this `ImageFace`"
2021-02-19 23:30:43 +01:00
faceGroup: FaceGroup!
2021-02-16 12:01:10 +01:00
}
2022-02-05 01:21:00 +01:00
"A bounding box of where a face is present on an image. The values map from 0 to 1 as a fraction of the image width/height"
2021-02-16 12:01:10 +01:00
type FaceRectangle {
minX: Float!
maxX: Float!
minY: Float!
maxY: Float!
}