From 1d7cbdaf7b2f3ff6576959ed26885d7545f31a14 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sun, 29 Sep 2019 02:18:34 +0000 Subject: [PATCH] change new scrobble endpoint --- CHANGELOG.md | 4 ++-- docs/api/pleroma_api.md | 2 +- .../web/pleroma_api/controllers/scrobble_controller.ex | 2 +- lib/pleroma/web/router.ex | 2 +- test/web/pleroma_api/controllers/scrobble_controller_test.exs | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80d5e1ac9..3d9424c8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Refreshing poll results for remote polls - Admin API: Add ability to require password reset - Mastodon API: Account entities now include `follow_requests_count` (planned Mastodon 3.x addition) -- Pleroma API: `GET /api/v1/pleroma/accounts/:id/now-playing` to get a list of recently scrobbled items -- Pleroma API: `POST /api/v1/pleroma/now-playing` to scrobble a media item +- Pleroma API: `GET /api/v1/pleroma/accounts/:id/scrobbles` to get a list of recently scrobbled items +- Pleroma API: `POST /api/v1/pleroma/scrobble` to scrobble a media item ### Changed - **Breaking:** Elixir >=1.8 is now required (was >= 1.7) diff --git a/docs/api/pleroma_api.md b/docs/api/pleroma_api.md index 33116b4b9..41889a0ef 100644 --- a/docs/api/pleroma_api.md +++ b/docs/api/pleroma_api.md @@ -461,7 +461,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa ] ``` -## `POST /api/v1/pleroma/now-playing` +## `POST /api/v1/pleroma/scrobble` ### Creates a new Listen activity for an account * Method `POST` * Authentication: required diff --git a/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex b/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex index ac6cd8edd..0fb978c5d 100644 --- a/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex @@ -12,7 +12,7 @@ defmodule Pleroma.Web.PleromaAPI.ScrobbleController do alias Pleroma.Web.CommonAPI alias Pleroma.Web.MastodonAPI.StatusView - def update_now_playing(%{assigns: %{user: user}} = conn, %{"title" => _} = params) do + def new_scrobble(%{assigns: %{user: user}} = conn, %{"title" => _} = params) do params = if !params["length"] do params diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 8e3a72656..bf32cff1e 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -303,7 +303,7 @@ defmodule Pleroma.Web.Router do scope [] do pipe_through(:oauth_write) - post("/now-playing", ScrobbleController, :update_now_playing) + post("/scrobble", ScrobbleController, :new_scrobble) end end diff --git a/test/web/pleroma_api/controllers/scrobble_controller_test.exs b/test/web/pleroma_api/controllers/scrobble_controller_test.exs index b86bd2250..881f8012c 100644 --- a/test/web/pleroma_api/controllers/scrobble_controller_test.exs +++ b/test/web/pleroma_api/controllers/scrobble_controller_test.exs @@ -8,14 +8,14 @@ defmodule Pleroma.Web.PleromaAPI.ScrobbleControllerTest do alias Pleroma.Web.CommonAPI import Pleroma.Factory - describe "POST /api/v1/pleroma/now-playing" do + describe "POST /api/v1/pleroma/scrobble" do test "works correctly", %{conn: conn} do user = insert(:user) conn = conn |> assign(:user, user) - |> post("/api/v1/pleroma/now-playing", %{ + |> post("/api/v1/pleroma/scrobble", %{ "title" => "lain radio episode 1", "artist" => "lain", "album" => "lain radio",