diff options
-rw-r--r-- | api.md | 28 | ||||
-rw-r--r-- | client/src/lib.rs | 2 |
2 files changed, 18 insertions, 12 deletions
@@ -1,34 +1,38 @@ # Jellything API -Routes marked with `*` require authentification. Any endpoint returning JSON, -will report errors with an object containing error string in the `error` key. +Most endpoints require the `Accept` header to be present and set to +`application/json`. Any endpoint returning JSON, will report errors with an +object containing error string in the `error` key. Routes marked with `*` +require authentification. -The `jellycommon` crate provides useful structs for deserializing data. +The `jellyclient` crate already implements most API functionality. The +`jellycommon` crate provides useful structs for deserializing data (also +reexported in jellyclient). ```toml # Cargo.toml [depedencies] -jellycommon = { git = "https://codeberg.org/metamuffin/jellything.git" } +jellyclient = { git = "https://codeberg.org/metamuffin/jellything.git" } ``` ## GET `/api/version` Returns API version number. -## POST `/api/account/login` +## POST `/api/create_session` -Request body contains JSON with keys `username` and `password`. The Response -contains the session cookie. +Request body contains JSON with keys `username`, `password` and `expire` (in +seconds). The Response contains the session cookie as a string in JSON. -## GET* `/api/node/<path...>` +## GET* `/n/<id>` Request a library node (either a directory or item). See [`common/src/api.rs`](./common/src/api.rs) -## GET* `/api/assets/node/<path..>?<role>` +## GET* `/n/<id>/asset?<role>` -Where `role` is one of `Backdrop` or `Poster`. Returns assets for a node. +Where `role` is one of `backdrop` or `poster`. Returns assets for a node. -## GET* `/stream/<path..>?tracks=<track-ids>&webm=<bool>` +## GET* `/stream/<id>?tracks=<track-ids>&webm=<bool>` -Responds with the stream. +Responds with the stream directly or a redirect to the actual source. diff --git a/client/src/lib.rs b/client/src/lib.rs index 462dcb8..eb978ee 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -12,6 +12,8 @@ use reqwest::{ use serde_json::json; use std::{io::Write, time::Duration}; +pub use jellycommon as jc; + #[derive(Debug, Clone)] pub struct Instance { pub host: String, |