router: change scrobble timeline route from now-playing to scrobbles
authorAriadne Conill <ariadne@dereferenced.org>
Sun, 29 Sep 2019 00:18:06 +0000 (00:18 +0000)
committerAriadne Conill <ariadne@dereferenced.org>
Mon, 30 Sep 2019 10:39:48 +0000 (10:39 +0000)
docs/api/pleroma_api.md
lib/pleroma/web/pleroma_api/controllers/pleroma_api_controller.ex
lib/pleroma/web/router.ex

index 183cf8a2837fe0594d3c70ea73df23397fc6a718..33116b4b9ff95c30f7465719869312d1507958ad 100644 (file)
@@ -440,7 +440,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
 * Response: the archive of the pack with a 200 status code, 403 if the pack is not set as shared,
   404 if the pack does not exist
 
-## `GET /api/v1/pleroma/accounts/:uid/now-playing`
+## `GET /api/v1/pleroma/accounts/:id/scrobbles`
 ### Requests a list of current and recent Listen activities for an account
 * Method `GET`
 * Authentication: not required
@@ -450,11 +450,13 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
 ```json
 [
    {
+       "account": {...},
        "id": "1234",
        "title": "Some Title",
        "artist": "Some Artist",
        "album": "Some Album",
-       "length": 180000
+       "length": 180000,
+       "created_at": "2019-09-28T12:40:45.000Z"
    }
 ]
 ```
index 1b0ed1f40cd2186d4cb66575ef7c8ec2e8ba1d24..6010732dbeff83b04c2212c4c4f94069c7ae932a 100644 (file)
@@ -110,7 +110,7 @@ defmodule Pleroma.Web.PleromaAPI.PleromaAPIController do
     end
   end
 
-  def user_now_playing(%{assigns: %{user: reading_user}} = conn, params) do
+  def user_scrobbles(%{assigns: %{user: reading_user}} = conn, params) do
     with %User{} = user <- User.get_cached_by_nickname_or_id(params["id"], for: reading_user) do
       params = Map.put(params, "type", ["Listen"])
 
index bd5f02af1739924ccce042ed8641d8edae47c899..8966e8cc04e1d5bc228f412aab150829c1248846 100644 (file)
@@ -310,7 +310,7 @@ defmodule Pleroma.Web.Router do
   scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
     pipe_through([:api, :oauth_read_or_public])
 
-    get("/accounts/:id/now-playing", PleromaAPIController, :user_now_playing)
+    get("/accounts/:id/scrobbles", PleromaAPIController, :user_scrobbles)
   end
 
   scope "/api/v1", Pleroma.Web.MastodonAPI do