Skip to content

Commit

Permalink
fix: make get_current_user_guilds parameter optiona and use it as que…
Browse files Browse the repository at this point in the history
…ry string
  • Loading branch information
SpaceEEC committed Sep 14, 2019
1 parent 33e5301 commit fed13ad
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 60 deletions.
8 changes: 5 additions & 3 deletions lib/rest/functions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1185,17 +1185,19 @@ defmodule Crux.Rest.Functions do
end

@impl true
def get_current_user_guilds(data) do
def get_current_user_guilds(data \\ []) do
path = Endpoints.me_guilds()

data =
query =
data
|> Map.new()
|> Util.optional_update_in_map(:after, &Structs.resolve_id(&1, Message))
|> Util.optional_update_in_map(:before, &Structs.resolve_id(&1, Message))
|> Keyword.new()

:get
|> Request.new(path, data)
|> Request.new(path)
|> Request.set_params(query)
|> Request.set_transform(&Structs.Util.raw_data_to_map(&1, Guild))
end

Expand Down

0 comments on commit fed13ad

Please sign in to comment.