From 0f69f2fa6bfdc96b31ab744b8049d514cd10a35e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Sat, 15 Apr 2017 16:13:44 +0200 Subject: [PATCH 01/16] Implemented favourite_by and reblogged_by from the API and added the type alias `status_id` to replace non_neg_integer --- lib/hunter/api/http_client.ex | 15 ++++++++++++ lib/hunter/status.ex | 46 +++++++++++++++++++++++++++++------ 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/lib/hunter/api/http_client.ex b/lib/hunter/api/http_client.ex index 4fff449..a070c01 100644 --- a/lib/hunter/api/http_client.ex +++ b/lib/hunter/api/http_client.ex @@ -53,6 +53,7 @@ defmodule Hunter.Api.HTTPClient do end def create_app(%Hunter.Client{base_url: base_url} = conn, name, redirect_uri, scopes, website) do + IO.puts redirect_uri payload = Poison.encode!(%{client_name: name, redirect_uris: redirect_uri, scopes: scopes, website: website}) %HTTPoison.Response{body: body, status_code: 200} = HTTPoison.post!(base_url <> "/api/v1/apps", payload, [{"Content-Type", "application/json"} | get_headers(conn)]) @@ -154,6 +155,11 @@ defmodule Hunter.Api.HTTPClient do to_status(body) end + def reblogged_by(%Hunter.Client{base_url: base_url} = conn, id) do + %HTTPoison.Response{body: body, status_code: 200} = HTTPoison.get!(base_url <> "/api/v1/statuses/#{id}/reblogged_by", get_headers(conn)) + to_accounts(body) + end + def favourite(%Hunter.Client{base_url: base_url} = conn, id) do payload = Poison.encode!(%{}) @@ -173,6 +179,11 @@ defmodule Hunter.Api.HTTPClient do to_statuses(body) end + def favourited_by(%Hunter.Client{base_url: base_url} = conn, id) do + %HTTPoison.Response{body: body, status_code: 200} = HTTPoison.get!(base_url <> "/api/v1/statuses/#{id}/favourited_by", get_headers(conn)) + to_accounts(body) + end + @doc """ Get an account's statuses @@ -264,6 +275,10 @@ defmodule Hunter.Api.HTTPClient do Poison.decode!(body, as: [status_nested_struct()]) end + defp to_accounts(body) do + Poison.decode!(body, as: [%Hunter.Account{}]) + end + defp status_nested_struct do %Hunter.Status{ account: %Hunter.Account{}, diff --git a/lib/hunter/status.ex b/lib/hunter/status.ex index 0e0b75d..032a314 100644 --- a/lib/hunter/status.ex +++ b/lib/hunter/status.ex @@ -49,6 +49,8 @@ defmodule Hunter.Status do application: Hunter.Application.t } + @type status_id :: non_neg_integer + @derive [Poison.Encoder] defstruct [:id, :uri, @@ -82,7 +84,7 @@ defmodule Hunter.Status do * `media_ids` - [Array] """ - @spec create_status(Hunter.Client.t, String.t, non_neg_integer, [non_neg_integer]) :: Hunter.Status.t + @spec create_status(Hunter.Client.t, String.t, status_id, [status_id]) :: Hunter.Status.t def create_status(conn, text, in_reply_to_id \\ nil, media_ids \\ []) do @hunter_api.create_status(conn, text, in_reply_to_id, media_ids) end @@ -96,7 +98,7 @@ defmodule Hunter.Status do * `id` - status identifier """ - @spec status(Hunter.Client.t, non_neg_integer) :: Hunter.Status.t + @spec status(Hunter.Client.t, status_id) :: Hunter.Status.t def status(conn, id) do @hunter_api.status(conn, id) end @@ -110,7 +112,7 @@ defmodule Hunter.Status do * `id` - status identifier """ - @spec destroy_status(Hunter.Client.t, non_neg_integer) :: boolean + @spec destroy_status(Hunter.Client.t, status_id) :: boolean def destroy_status(conn, id) do @hunter_api.destroy_status(conn, id) end @@ -124,7 +126,7 @@ defmodule Hunter.Status do * `id` - status identifier """ - @spec reblog(Hunter.Client.t, non_neg_integer) :: Hunter.Status.t + @spec reblog(Hunter.Client.t, status_id) :: Hunter.Status.t def reblog(conn, id) do @hunter_api.reblog(conn, id) end @@ -138,11 +140,24 @@ defmodule Hunter.Status do * `id` - status identifier """ - @spec unreblog(Hunter.Client.t, non_neg_integer) :: Hunter.Status.t + @spec unreblog(Hunter.Client.t, status_id) :: Hunter.Status.t def unreblog(conn, id) do @hunter_api.unreblog(conn, id) end + @doc """ + Fetch the list of users who reblogged the status. + + ## Parameters + + * `conn` - connection credentials + * `id` - status identifier + """ + @spec reblogged_by(Hunter.Client.t, non_neg_integer) :: Hunter.Status.t + def reblogged_by(conn, id) do + @hunter_api.reblogged_by(conn, id) + end + @doc """ Favorite a status @@ -152,7 +167,7 @@ defmodule Hunter.Status do * `id` - status identifier """ - @spec favourite(Hunter.Client.t, non_neg_integer) :: Hunter.Status.t + @spec favourite(Hunter.Client.t, status_id) :: Hunter.Status.t def favourite(conn, id) do @hunter_api.favourite(conn, id) end @@ -166,7 +181,7 @@ defmodule Hunter.Status do * `id` - status identifier """ - @spec unfavourite(Hunter.Client.t, non_neg_integer) :: Hunter.Status.t + @spec unfavourite(Hunter.Client.t, status_id) :: Hunter.Status.t def unfavourite(conn, id) do @hunter_api.unfavourite(conn, id) end @@ -184,6 +199,21 @@ defmodule Hunter.Status do @hunter_api.favourites(conn) end + @doc """ + Fetch the list of users who favourited the status + + ## Parameters + + * `conn` - connection credentials + * `id` - status identifier + + """ + + @spec favourited_by(Hunter.Client.t, status_id) :: [Hunter.Status.t] + def favourited_by(conn, id) do + @hunter_api.favourited_by(conn, id) + end + @doc """ Get a list of statuses by a user @@ -200,7 +230,7 @@ defmodule Hunter.Status do * `limit` - [Integer] """ - @spec statuses(Hunter.Client.t, non_neg_integer, Keyword.t) :: [Hunter.Status.t] + @spec statuses(Hunter.Client.t, status_id, Keyword.t) :: [Hunter.Status.t] def statuses(conn, account_id, options \\ []) do @hunter_api.statuses(conn, account_id, options) end From aaef82ef9c23b00a1778239950f8a4c415071afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Sat, 15 Apr 2017 16:20:07 +0200 Subject: [PATCH 02/16] Add the in-memory functions --- test/support/in_memory.ex | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/support/in_memory.ex b/test/support/in_memory.ex index 39a5aed..ef659af 100644 --- a/test/support/in_memory.ex +++ b/test/support/in_memory.ex @@ -100,6 +100,10 @@ defmodule Hunter.Api.InMemory do %Hunter.Status{} end + def reblogged_by(_, _) do + [%Hunter.Account{}] + end + def favourite(_, _) do %Hunter.Status{} end @@ -112,6 +116,10 @@ defmodule Hunter.Api.InMemory do [%Hunter.Status{}] end + def favourited_by(_, _) do + [%Hunter.Account{}] + end + def statuses(_, _, _) do [%Hunter.Status{}] end From 99c993bbec0e64c02d614c8900542876e0218681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Sat, 15 Apr 2017 16:23:19 +0200 Subject: [PATCH 03/16] fix type spec --- lib/hunter/status.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/hunter/status.ex b/lib/hunter/status.ex index 032a314..a18845e 100644 --- a/lib/hunter/status.ex +++ b/lib/hunter/status.ex @@ -153,7 +153,7 @@ defmodule Hunter.Status do * `conn` - connection credentials * `id` - status identifier """ - @spec reblogged_by(Hunter.Client.t, non_neg_integer) :: Hunter.Status.t + @spec reblogged_by(Hunter.Client.t, non_neg_integer) :: [Hunter.Account.t] def reblogged_by(conn, id) do @hunter_api.reblogged_by(conn, id) end @@ -209,7 +209,7 @@ defmodule Hunter.Status do """ - @spec favourited_by(Hunter.Client.t, status_id) :: [Hunter.Status.t] + @spec favourited_by(Hunter.Client.t, status_id) :: [Hunter.Account.t] def favourited_by(conn, id) do @hunter_api.favourited_by(conn, id) end From b36e55901f0ac60a836d5190ca25eaa7afc5a0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Sat, 15 Apr 2017 16:32:39 +0200 Subject: [PATCH 04/16] add the callbacks --- lib/hunter/api.ex | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/hunter/api.ex b/lib/hunter/api.ex index a1a63c9..f53c44c 100644 --- a/lib/hunter/api.ex +++ b/lib/hunter/api.ex @@ -295,6 +295,17 @@ defmodule Hunter.Api do """ @callback unreblog(conn :: Hunter.Client.t, id :: non_neg_integer) :: Hunter.Status.t + + @doc """ + Fetch the list of users who reblogged the status. + + ## Parameters + + * `conn` - connection credentials + * `id` - status identifier + """ + @callback reblogged_by(conn :: Hunter.Client.t, id :: non_neg_integer) :: [Hunter.Account.t] + @doc """ Favorite a status @@ -327,6 +338,16 @@ defmodule Hunter.Api do """ @callback favourites(conn :: Hunter.Client.t) :: [Hunter.Status.t] + @doc """ + Fetch the list of users who favourited the status. + + ## Parameters + + * `conn` - connection credentials + * `id` - status identifier + """ + @callback favourited_by(conn :: Hunter.Client.t, id :: non_neg_integer) :: [Hunter.Account.t] + @doc """ Get a list of statuses by a user From 2778b6e9c047179795b5ea3111c61da52ff6c6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Sat, 15 Apr 2017 16:33:11 +0200 Subject: [PATCH 05/16] public API --- lib/hunter.ex | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/hunter.ex b/lib/hunter.ex index 06ece11..1290426 100644 --- a/lib/hunter.ex +++ b/lib/hunter.ex @@ -332,6 +332,17 @@ defmodule Hunter do @spec unreblog(Hunter.Client.t, non_neg_integer) :: Hunter.Status.t defdelegate unreblog(conn, id), to: Hunter.Status + @doc """ + Fetch the list of users who reblogged the status. + + ## Parameters + + * `conn` - connection credentials + * `id` - status identifier + """ + @spec reblogged_by(Hunter.Client.t, non_neg_integer) :: Hunter.Status.t + defdelegate reblogged_by(conn, id), to: Hunter.Status + @doc """ Favorite a status @@ -367,6 +378,19 @@ defmodule Hunter do @spec favourites(Hunter.Client.t) :: [Hunter.Status.t] defdelegate favourites(conn), to: Hunter.Status + @doc """ + Fetch the list of users who favourited the status + + ## Parameters + + * `conn` - connection credentials + * `id` - status identifier + + """ + + @spec favourited_by(Hunter.Client.t, non_neg_integer) :: [Hunter.Account.t] + defdelegate favourited_by(conn, id), to: Hunter.Status + @doc """ Get a list of statuses by a user From 5c9322aae75fa6a49cf0b71f227680f05ca38176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Sat, 15 Apr 2017 16:43:06 +0200 Subject: [PATCH 06/16] useless |> --- test/support/in_memory.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/support/in_memory.ex b/test/support/in_memory.ex index ef659af..121c347 100644 --- a/test/support/in_memory.ex +++ b/test/support/in_memory.ex @@ -17,7 +17,7 @@ defmodule Hunter.Api.InMemory do as = Macro.escape(as) def unquote(name)(unquote_splicing(params)) do - file = unquote(name) |> to_string() + file = to_string(unquote(name)) "../fixtures/#{file}.json" |> Path.expand(__DIR__) From acc7f723edbc776e207d71b4ad942fc4a322e7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Sat, 15 Apr 2017 16:43:20 +0200 Subject: [PATCH 07/16] remove extra space --- lib/hunter/status.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hunter/status.ex b/lib/hunter/status.ex index a18845e..6b03068 100644 --- a/lib/hunter/status.ex +++ b/lib/hunter/status.ex @@ -201,7 +201,7 @@ defmodule Hunter.Status do @doc """ Fetch the list of users who favourited the status - + ## Parameters * `conn` - connection credentials From 4902f900e6307ebb4f46b28dbc5f786bd86ce236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Mon, 17 Apr 2017 11:01:56 +0200 Subject: [PATCH 08/16] fixed typos and type signature --- lib/hunter.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/hunter.ex b/lib/hunter.ex index 1290426..e537171 100644 --- a/lib/hunter.ex +++ b/lib/hunter.ex @@ -339,8 +339,9 @@ defmodule Hunter do * `conn` - connection credentials * `id` - status identifier + """ - @spec reblogged_by(Hunter.Client.t, non_neg_integer) :: Hunter.Status.t + @spec reblogged_by(Hunter.Client.t, non_neg_integer) :: [Hunter.Account.t] defdelegate reblogged_by(conn, id), to: Hunter.Status @doc """ From ade43208f8d9f6a68ef6964d19153a7c20c3b568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Mon, 17 Apr 2017 11:02:35 +0200 Subject: [PATCH 09/16] fixed blank lines --- lib/hunter/api.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/hunter/api.ex b/lib/hunter/api.ex index f53c44c..b7d9cfd 100644 --- a/lib/hunter/api.ex +++ b/lib/hunter/api.ex @@ -295,7 +295,6 @@ defmodule Hunter.Api do """ @callback unreblog(conn :: Hunter.Client.t, id :: non_neg_integer) :: Hunter.Status.t - @doc """ Fetch the list of users who reblogged the status. @@ -303,6 +302,7 @@ defmodule Hunter.Api do * `conn` - connection credentials * `id` - status identifier + """ @callback reblogged_by(conn :: Hunter.Client.t, id :: non_neg_integer) :: [Hunter.Account.t] @@ -345,6 +345,7 @@ defmodule Hunter.Api do * `conn` - connection credentials * `id` - status identifier + """ @callback favourited_by(conn :: Hunter.Client.t, id :: non_neg_integer) :: [Hunter.Account.t] From 95c9aa8383834623c0c4ff1c14d4efca33f7f697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Mon, 17 Apr 2017 11:03:43 +0200 Subject: [PATCH 10/16] fixed type signature --- lib/hunter/status.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/hunter/status.ex b/lib/hunter/status.ex index 6b03068..6b4d948 100644 --- a/lib/hunter/status.ex +++ b/lib/hunter/status.ex @@ -84,7 +84,7 @@ defmodule Hunter.Status do * `media_ids` - [Array] """ - @spec create_status(Hunter.Client.t, String.t, status_id, [status_id]) :: Hunter.Status.t + @spec create_status(Hunter.Client.t, String.t, status_id, [non_neg_integer]) :: Hunter.Status.t def create_status(conn, text, in_reply_to_id \\ nil, media_ids \\ []) do @hunter_api.create_status(conn, text, in_reply_to_id, media_ids) end @@ -152,6 +152,7 @@ defmodule Hunter.Status do * `conn` - connection credentials * `id` - status identifier + """ @spec reblogged_by(Hunter.Client.t, non_neg_integer) :: [Hunter.Account.t] def reblogged_by(conn, id) do From ff7dd365b85ed193c7c755bcdf1b73ebb463e9ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Mon, 17 Apr 2017 11:04:56 +0200 Subject: [PATCH 11/16] removed extra IO.puts --- lib/hunter/api/http_client.ex | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/hunter/api/http_client.ex b/lib/hunter/api/http_client.ex index a070c01..ba355b5 100644 --- a/lib/hunter/api/http_client.ex +++ b/lib/hunter/api/http_client.ex @@ -53,7 +53,6 @@ defmodule Hunter.Api.HTTPClient do end def create_app(%Hunter.Client{base_url: base_url} = conn, name, redirect_uri, scopes, website) do - IO.puts redirect_uri payload = Poison.encode!(%{client_name: name, redirect_uris: redirect_uri, scopes: scopes, website: website}) %HTTPoison.Response{body: body, status_code: 200} = HTTPoison.post!(base_url <> "/api/v1/apps", payload, [{"Content-Type", "application/json"} | get_headers(conn)]) From 840ad8217983936a98b8eb018fb5e59c16f3b082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Mon, 17 Apr 2017 11:37:34 +0200 Subject: [PATCH 12/16] fixed trailing space style issues --- lib/hunter.ex | 4 ++-- lib/hunter/account.ex | 4 ++-- lib/hunter/api.ex | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/hunter.ex b/lib/hunter.ex index b8afc35..f57addb 100644 --- a/lib/hunter.ex +++ b/lib/hunter.ex @@ -125,7 +125,7 @@ defmodule Hunter do """ @spec accept_follow_request(Hunter.Client.t, non_neg_integer) :: boolean - defdelegate accept_follow_request(conn, id), to: Hunter.Account + defdelegate accept_follow_request(conn, id), to: Hunter.Account @doc """ Rejects a follow request @@ -136,7 +136,7 @@ defmodule Hunter do * `id` - follow request id """ - @spec reject_follow_request(Hunter.Client.t, non_neg_integer) :: boolean + @spec reject_follow_request(Hunter.Client.t, non_neg_integer) :: boolean defdelegate reject_follow_request(conn, id), to: Hunter.Account ## Application diff --git a/lib/hunter/account.ex b/lib/hunter/account.ex index 208fe17..9165488 100644 --- a/lib/hunter/account.ex +++ b/lib/hunter/account.ex @@ -205,8 +205,8 @@ defmodule Hunter.Account do * `id` - follow request id """ - @spec reject_follow_request(Hunter.Client.t, non_neg_integer) :: boolean + @spec reject_follow_request(Hunter.Client.t, non_neg_integer) :: boolean def reject_follow_request(conn, id ) do @hunter_api.follow_request_action(conn, id, :reject) - end + end end diff --git a/lib/hunter/api.ex b/lib/hunter/api.ex index 85e9f63..91763bd 100644 --- a/lib/hunter/api.ex +++ b/lib/hunter/api.ex @@ -120,7 +120,7 @@ defmodule Hunter.Api do * `:reject` - reject a follow request """ - @callback follow_request_action(conn :: Hunter.Client.t, id :: non_neg_integer, action :: atom) :: boolean + @callback follow_request_action(conn :: Hunter.Client.t, id :: non_neg_integer, action :: atom) :: boolean ## Application From 94046e0b8488416a9ff65029f6b95998802672ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Mon, 17 Apr 2017 11:53:17 +0200 Subject: [PATCH 13/16] fixed a syntax error --- test/support/in_memory.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/support/in_memory.ex b/test/support/in_memory.ex index 37956d3..b7f8f94 100644 --- a/test/support/in_memory.ex +++ b/test/support/in_memory.ex @@ -30,7 +30,7 @@ defmodule Hunter.Api.InMemory do %{name: :notifications, arity: 1, as: [%Hunter.Notification{}]}, %{name: :public_timeline, arity: 2, as: [%Hunter.Status{}]}, %{name: :reblog, arity: 2, as: %Hunter.Status{}}, - %{name: :reblogged_by, arity: 2, as: [%Hunter.Account]}, + %{name: :reblogged_by, arity: 2, as: [%Hunter.Account{}]}, %{name: :relationships, arity: 2, as: [%Hunter.Relationship{}]}, %{name: :report, arity: 4, as: %Hunter.Report{}}, %{name: :reports, arity: 1, as: [%Hunter.Report{}]}, From 95369fafbeb856ce06752b236e813fd0e8bc38fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Mon, 17 Apr 2017 11:55:50 +0200 Subject: [PATCH 14/16] add the fixtures --- test/fixtures/favourited_by.json | 36 ++++++++++++++++++++++++++++++++ test/fixtures/reblogged_by.json | 36 ++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 test/fixtures/favourited_by.json create mode 100644 test/fixtures/reblogged_by.json diff --git a/test/fixtures/favourited_by.json b/test/fixtures/favourited_by.json new file mode 100644 index 0000000..10b13d6 --- /dev/null +++ b/test/fixtures/favourited_by.json @@ -0,0 +1,36 @@ +[ + { + "id": 2286, + "username": "marxistvegan", + "acct": "marxistvegan", + "display_name": "stephen 🌹✪", + "locked": false, + "created_at": "2017-04-12T13:21:32.932Z", + "followers_count": 45, + "following_count": 62, + "statuses_count": 65, + "note": "Luxemburgist. Organizer in the labor & social movements. Co-host https://cyberunions.org podcast, member of https://glocal.coop. Pronoun he/him #AntiFa #marxist", + "url": "https://soc.ialis.me/@marxistvegan", + "avatar": "https://pictor.ialis.me/accounts/avatars/000/002/286/original/a7154cd28f490be2.jpeg?1492003901", + "avatar_static": "https://pictor.ialis.me/accounts/avatars/000/002/286/original/a7154cd28f490be2.jpeg?1492003901", + "header": "https://pictor.ialis.me/accounts/headers/000/002/286/original/b0457c9d6168b53e.png?1492080325", + "header_static": "https://pictor.ialis.me/accounts/headers/000/002/286/original/b0457c9d6168b53e.png?1492080325" + }, + { + "id": 1, + "username": "href", + "acct": "href", + "display_name": "href", + "locked": false, + "created_at": "2017-04-09T12:19:29.077Z", + "followers_count": 132, + "following_count": 198, + "statuses_count": 418, + "note": "cybermenace & mauvaise influence. #freebsd, #erlang, #elixir. #fr & #en.\r\n\r\nhttp://href.rocks - https://random.sh\r\n\r\nhttps://soc.ialis.me admin", + "url": "https://soc.ialis.me/@href", + "avatar": "https://pictor.ialis.me/accounts/avatars/000/000/001/original/42fe522de966bd8a.jpg?1491741513", + "avatar_static": "https://pictor.ialis.me/accounts/avatars/000/000/001/original/42fe522de966bd8a.jpg?1491741513", + "header": "https://pictor.ialis.me/accounts/headers/000/000/001/original/53b5cb6b4bb97932.jpg?1491745462", + "header_static": "https://pictor.ialis.me/accounts/headers/000/000/001/original/53b5cb6b4bb97932.jpg?1491745462" + } +] diff --git a/test/fixtures/reblogged_by.json b/test/fixtures/reblogged_by.json new file mode 100644 index 0000000..e44cddb --- /dev/null +++ b/test/fixtures/reblogged_by.json @@ -0,0 +1,36 @@ +[ + { + "id": 970, + "username": "maliciarogue", + "acct": "maliciarogue@mastodon.social", + "display_name": "R ✅", + "locked": false, + "created_at": "2017-04-10T14:30:57.949Z", + "followers_count": 3, + "following_count": 2, + "statuses_count": 156, + "note": "I troll, therefore I am. Writer; OSINT & sec analyst; I do risk & crisis mngmnt so u don't have to.Polylingual bookworm. I toot 4 chocolate /!\\Parental advisory", + "url": "https://mastodon.social/@maliciarogue", + "avatar": "https://pictor.ialis.me/accounts/avatars/000/000/970/original/d5a601a0133d75c1.jpg?1491834658", + "avatar_static": "https://pictor.ialis.me/accounts/avatars/000/000/970/original/d5a601a0133d75c1.jpg?1491834658", + "header": "/headers/original/missing.png", + "header_static": "/headers/original/missing.png" + }, + { + "id": 2495, + "username": "hecate", + "acct": "hecate", + "display_name": "Hecatée Irssiainen", + "locked": false, + "created_at": "2017-04-12T20:05:42.369Z", + "followers_count": 5, + "following_count": 6, + "statuses_count": 9, + "note": "Cyber-postrock technoqueer. I go by she/her, and it's usually with your mum.", + "url": "https://soc.ialis.me/@hecate", + "avatar": "https://pictor.ialis.me/accounts/avatars/000/002/495/original/7c78b503266e4bdf.png?1492027924", + "avatar_static": "https://pictor.ialis.me/accounts/avatars/000/002/495/original/7c78b503266e4bdf.png?1492027924", + "header": "https://pictor.ialis.me/accounts/headers/000/002/495/original/a1f76633a274cb61.jpg?1492027924", + "header_static": "https://pictor.ialis.me/accounts/headers/000/002/495/original/a1f76633a274cb61.jpg?1492027924" + } +] From f56af2181f388a6f76aa274d47bc5768ca41d310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Mon, 17 Apr 2017 16:09:53 +0200 Subject: [PATCH 15/16] better typespec --- lib/hunter/status.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hunter/status.ex b/lib/hunter/status.ex index 6b4d948..6126704 100644 --- a/lib/hunter/status.ex +++ b/lib/hunter/status.ex @@ -154,7 +154,7 @@ defmodule Hunter.Status do * `id` - status identifier """ - @spec reblogged_by(Hunter.Client.t, non_neg_integer) :: [Hunter.Account.t] + @spec reblogged_by(Hunter.Client.t, status_id) :: [Hunter.Account.t] def reblogged_by(conn, id) do @hunter_api.reblogged_by(conn, id) end From eded40e589f5c048350f691848373c4c0668920f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Choutri?= Date: Mon, 17 Apr 2017 16:10:36 +0200 Subject: [PATCH 16/16] remove the task from README --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 8f6845b..c08188f 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,6 @@ All contributions are welcome! * [Support arrays as parameter types](https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#parameter-types) * [Update current user](https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#updating-the-current-user) * Fix method: [Uploading media attachment](https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#uploading-a-media-attachment) -* [Getting who reblogged/favourited a status](https://github.com/milmazz/hunter/pull/2) * Verify each endpoint * Improve unit tests * Improve documentation