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

227 lines
4.8 KiB
GraphQL

directive @isAdmin on FIELD_DEFINITION
scalar Time
enum OrderDirection {
ASC
DESC
}
input Filter {
order_by: String
order_direction: OrderDirection
limit: Int
offset: Int
}
type Query {
siteInfo: SiteInfo!
"List of registered users, must be admin to call"
user(filter: Filter): [User!]! @isAdmin
"Information about the currently logged in user"
myUser: User!
"List of albums owned by the logged in user."
myAlbums(
filter: Filter
"Return only albums from the root directory of the user"
onlyRoot: Boolean
"Return also albums with no photos directly in them"
showEmpty: Boolean
): [Album!]!
"Get album by id, user must own the album or be admin"
album(id: Int!): Album!
"List of photos owned by the logged in user"
myPhotos(filter: Filter): [Photo!]!
"Get photo by id, user must own the photo or be admin"
photo(id: Int!): Photo!
shareToken(token: String!, password: String): ShareToken!
}
type Mutation {
authorizeUser(username: String!, password: String!): AuthorizeResult!
"Registers a new user, must be admin to call"
registerUser(
username: String!
password: String!
rootPath: String!
): AuthorizeResult!
"Registers the initial user, can only be called if initialSetup from SiteInfo is true"
initialSetupWizard(
username: String!
password: String!
rootPath: String!
): AuthorizeResult
"Scan all users for new photos"
scanAll: ScannerResult! @isAdmin
"Scan a single user for new photos"
scanUser(userId: Int!): ScannerResult!
"Generate share token for album"
shareAlbum(albumId: Int!, expire: Time, password: String): ShareToken
"Generate share token for photo"
sharePhoto(photoId: Int!, expire: Time, password: String): ShareToken
"Delete a share token by it's token value"
deleteShareToken(token: String!): ShareToken
updateUser(
id: Int!
username: String
rootPath: String
password: String
admin: Boolean
): User @isAdmin
createUser(
username: String!
rootPath: String!
password: String
admin: Boolean!
): User @isAdmin
deleteUser(id: Int!): User @isAdmin
}
type Subscription {
notification: Notification!
}
enum NotificationType {
Message
Progress
}
type Notification {
key: String!
type: NotificationType!
header: String!
content: String!
progress: Float
positive: Boolean!
negative: Boolean!
}
type AuthorizeResult {
success: Boolean!
status: String!
token: String
}
type ScannerResult {
finished: Boolean!
success: Boolean!
progress: Float
message: String
}
"A token used to publicly access an album or photo"
type ShareToken {
id: Int!
token: String!
"The user who created the token"
owner: User!
"Optional expire date"
expire: Time
"The album this token shares"
album: Album
"The photo this token shares"
photo: Photo
}
"General public information about the site"
type SiteInfo {
initialSetup: Boolean!
}
type User {
id: Int!
username: String!
#albums: [Album]
"Local filepath for the user's photos"
rootPath: String! @isAdmin
admin: Boolean!
#shareTokens: [ShareToken]
}
type Album {
id: Int!
title: String!
"The photos inside this album"
photos(filter: Filter): [Photo!]!
"The albums contained in this album"
subAlbums(filter: Filter): [Album!]!
"The album witch contains this album"
parentAlbum: Album
"The user who owns this album"
owner: User!
"The path on the filesystem of the server, where this album is located"
path: String!
"An image in this album used for previewing this album"
thumbnail: Photo
shares: [ShareToken]
}
type PhotoURL {
"URL for previewing the image"
url: String!
"Width of the image in pixels"
width: Int!
"Height of the image in pixels"
height: Int!
}
type PhotoDownload {
title: String!
width: Int!
height: Int!
url: String!
}
type Photo {
id: Int!
title: String!
"Local filepath for the photo"
path: String!
"URL to display the photo in a smaller resolution"
thumbnail: PhotoURL!
"URL to display the photo in full resolution"
highRes: PhotoURL!
"The album that holds the photo"
album: Album!
exif: PhotoEXIF
shares: [ShareToken!]!
downloads: [PhotoDownload!]!
}
"EXIF metadata from the camera"
type PhotoEXIF {
id: Int!
photo: Photo
"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"
focalLength: Float
"A formatted description of the flash settings, when the image was taken"
flash: String
"An index describing the mode for adjusting the exposure of the image"
exposureProgram: Int
}