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

384 lines
9.4 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
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
}
"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
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!]!
myTimeline(paginate: Pagination, onlyFavorites: Boolean): [TimelineGroup!]! @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
shareToken(credentials: ShareTokenCredentials!): ShareToken!
shareTokenValidatePassword(credentials: ShareTokenCredentials!): 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!]! @isAuthorized
faceGroup(id: ID!): FaceGroup! @isAuthorized
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! @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
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
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
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! @isAdmin
"Set max number of concurrent scanner jobs running at once"
setScannerConcurrentWorkers(workers: Int!): Int! @isAdmin
changeUserPreferences(language: String): UserPreferences! @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!
}
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
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,
}
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!]!
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 {
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!
2020-02-01 14:52:27 +01:00
2020-02-10 12:05:58 +01:00
shares: [ShareToken!]!
downloads: [MediaDownload!]!
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!
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
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
2021-02-25 18:48:59 +01:00
imageFaces(paginate: Pagination): [ImageFace!]!
imageFaceCount: Int!
2021-02-16 12:01:10 +01:00
}
type ImageFace {
id: ID!
media: Media!
rectangle: FaceRectangle
2021-02-19 23:30:43 +01:00
faceGroup: FaceGroup!
2021-02-16 12:01:10 +01:00
}
type FaceRectangle {
minX: Float!
maxX: Float!
minY: Float!
maxY: Float!
}