Include more functions in the 'In Memory' client

master
Milton Mazzarri 2017-04-16 15:45:26 -05:00
parent f4886e1195
commit f549420647
No known key found for this signature in database
GPG Key ID: 9F4193F2B5A558FE
1 changed files with 36 additions and 135 deletions

View File

@ -6,11 +6,44 @@ defmodule Hunter.Api.InMemory do
@behaviour Hunter.Api
[
%{name: :verify_credentials, arity: 1, as: %Hunter.Account{}},
%{name: :account, arity: 2, as: %Hunter.Account{}},
%{name: :block, arity: 2, as: %Hunter.Relationship{}},
%{name: :blocks, arity: 1, as: [%Hunter.Account{}]},
%{name: :card_by_status, arity: 2, as: %Hunter.Card{}},
%{name: :clear_notifications, arity: 1, as: %{}},
%{name: :create_app, arity: 5, as: %Hunter.Application{}},
%{name: :create_status, arity: 4, as: %Hunter.Status{}},
%{name: :favourite, arity: 2, as: %Hunter.Status{}},
%{name: :favourites, arity: 1, as: [%Hunter.Status{}]},
%{name: :follow, arity: 2, as: %Hunter.Relationship{}},
%{name: :follow_by_uri, arity: 2, as: %Hunter.Account{}},
%{name: :follow_requests, arity: 1, as: [%Hunter.Account{}]},
%{name: :followers, arity: 2, as: [%Hunter.Account{}]},
%{name: :following, arity: 2, as: [%Hunter.Account{}]},
%{name: :follow_by_uri, arity: 2, as: %Hunter.Account{}}
%{name: :hashtag_timeline, arity: 3, as: [%Hunter.Status{}]},
%{name: :home_timeline, arity: 2, as: [%Hunter.Status{}]},
%{name: :instance_info, arity: 1, as: %Hunter.Instance{}},
%{name: :mute, arity: 2, as: %Hunter.Relationship{}},
%{name: :mutes, arity: 1, as: [%Hunter.Account{}]},
%{name: :notification, arity: 2, as: %Hunter.Notification{}},
%{name: :notifications, arity: 1, as: [%Hunter.Notification{}]},
%{name: :public_timeline, arity: 2, as: [%Hunter.Status{}]},
%{name: :reblog, arity: 2, as: %Hunter.Status{}},
%{name: :relationships, arity: 2, as: [%Hunter.Relationship{}]},
%{name: :report, arity: 4, as: %Hunter.Report{}},
%{name: :reports, arity: 1, as: [%Hunter.Report{}]},
%{name: :search, arity: 3, as: %Hunter.Result{}},
%{name: :search_account, arity: 2, as: [%Hunter.Account{}]},
%{name: :status, arity: 2, as: %Hunter.Status{}},
%{name: :status_context, arity: 2, as: %Hunter.Context{}},
%{name: :statuses, arity: 3, as: [%Hunter.Status{}]},
%{name: :unblock, arity: 2, as: %Hunter.Relationship{}},
%{name: :unfavourite, arity: 2, as: %Hunter.Status{}},
%{name: :unfollow, arity: 2, as: %Hunter.Relationship{}},
%{name: :unmute, arity: 2, as: %Hunter.Relationship{}},
%{name: :unreblog, arity: 2, as: %Hunter.Status{}},
%{name: :upload_media, arity: 2, as: %Hunter.Attachment{}},
%{name: :verify_credentials, arity: 1, as: %Hunter.Account{}},
]
|> Enum.map(fn %{name: name, arity: arity, as: as} ->
params = for _ <- 1..arity, do: {:_, [], nil}
@ -26,137 +59,5 @@ defmodule Hunter.Api.InMemory do
end
end)
def search_account(_, _) do
[%Hunter.Account{}]
end
def blocks(_) do
[%Hunter.Account{}]
end
def follow_requests(_) do
[%Hunter.Account{}]
end
def mutes(_) do
[%Hunter.Account{}]
end
def create_app(_, _, _, _, _) do
%Hunter.Application{}
end
def upload_media(_, _) do
%Hunter.Attachment{}
end
def relationships(_, _) do
[%Hunter.Relationship{}]
end
def follow(_, _) do
%Hunter.Relationship{}
end
def unfollow(_, _) do
%Hunter.Relationship{}
end
def block(_, _) do
%Hunter.Relationship{}
end
def unblock(_, _) do
%Hunter.Relationship{}
end
def mute(_, _) do
%Hunter.Relationship{}
end
def unmute(_, _) do
%Hunter.Relationship{}
end
def search(_, _, _) do
end
def create_status(_, _, _, _) do
end
def status(_, _) do
%Hunter.Status{}
end
def destroy_status(_, _) do
true
end
def reblog(_, _) do
%Hunter.Status{}
end
def unreblog(_, _) do
%Hunter.Status{}
end
def favourite(_, _) do
%Hunter.Status{}
end
def unfavourite(_, _) do
%Hunter.Status{}
end
def favourites(_) do
[%Hunter.Status{}]
end
def statuses(_, _, _) do
[%Hunter.Status{}]
end
def home_timeline(_, _) do
[%Hunter.Status{}]
end
def public_timeline(_, _) do
[%Hunter.Status{}]
end
def hashtag_timeline(_, _, _) do
[%Hunter.Status{}]
end
def instance_info(_) do
%Hunter.Instance{}
end
def notifications(_) do
[%Hunter.Notification{}]
end
def notification(_, _) do
%Hunter.Notification{}
end
def clear_notifications(_) do
%{}
end
def reports(_) do
[%Hunter.Report{}]
end
def report(_, _, _, _) do
%Hunter.Report{}
end
def status_context(_, _) do
%Hunter.Context{}
end
def card_by_status(_, _) do
%Hunter.Card{}
end
def destroy_status(_, _), do: true
end