# ============================================================================= # GRAPHQL SCHEMA # Type definitions for Clients (may be symlink so that IDE can resolve types) # ============================================================================= # ----------------------------------------------------------------------------- # TYPES # ----------------------------------------------------------------------------- # See `file.doc.md` for documentation type File { # Computed by the server, or saved to db (the actual ID for GraphQL caching) src: URL! # Type of file (ex. public/private...) kind: JSON # Identifier or index position, stored by db (ex. thumb/small/large...) i: JSON # Optional - created Timestamp (better to use entry type ID). # `id` does no guarantee uniqueness, because different versions of the file can have the same `id`. id: Id # File name with extension for UI use and to get `ext` only, stored by db name: String creatorId: Id created: Timestamp # need this field because `id` may not exist (derived from entry type) updated: Timestamp } # @Note: built-in input `Upload` can be used directly with all `FileInput` attributes attached. # But it's better to separate them for more explicit API. input FileInput { # Binary File object uploaded from the client, required if `remove` is not true. # For security reasons, do not allow User to upload arbitrary URL as src string. file: Upload # Type of file (ex. public/private...) kind: JSON # Identifier or index position, stored by db (ex. thumb/small/large...) i: JSON # Created Timestamp, can be used to unique identify the file id: Id # Ignored, upload uses GQL Upload.filename instead, for frontend convenience only. name: String # Whether to delete the file, it's called `remove` because `delete` is JS keyword remove: Boolean # Unused fields, only here to avoid GraphQL complaining about unknown inputs. #src: URLOrBase64 #creatorId: Id #created: Timestamp #updated: Timestamp } # Extends type `File` See `file.doc.md` for documentation, uses FileInput type Image { width: Int! height: Int! # List of file size suffixes as `key`, and sizes in bytes as `val` sizes: [KeyVal!] # File attributes src: URL! kind: JSON i: JSON id: Id name: String creatorId: Id created: Timestamp updated: Timestamp }