diff --git a/lib/facebook.ex b/lib/facebook.ex index bb28a6d..1559de9 100644 --- a/lib/facebook.ex +++ b/lib/facebook.ex @@ -30,7 +30,7 @@ defmodule Facebook do @type fields :: list @type access_token :: String.t - @type response :: {:json, HashDict.t} | {:body, String.t} + @type response :: {:ok, Map.t} | {:error, Map.t} @type using_appsecret :: boolean @type reaction :: :reaction @@ -38,11 +38,11 @@ defmodule Facebook do If you want to use an appsecret proof, pass it into set_appsecret: ## Example - iex> Facebook.setAppsecret("appsecret") + iex> Facebook.set_appsecret("appsecret") See: https://developers.facebook.com/docs/graph-api/securing-requests """ - def setAppsecret(appsecret) do + def set_appsecret(appsecret) do Config.appsecret(appsecret) end @@ -50,7 +50,8 @@ defmodule Facebook do Basic user infos of the logged in user (specified by the access_token). ## Example - iex> Facebook.me("id,first_name", "") + iex> Facebook.me("id,first_name", "") + {:ok, %{"first_name" => "...", "id" => "..."}} See: https://developers.facebook.com/docs/graph-api/reference/user/ """ @@ -63,7 +64,8 @@ defmodule Facebook do Basic user infos of the logged in user (specified by the access_token). ## Example - iex> Facebook.me([fields: "id,first_name"], "") + iex> Facebook.me([fields: "id,first_name"], "") + {:ok, %{"first_name" => "...", "id" => "..."}} See: https://developers.facebook.com/docs/graph-api/reference/user/ """ @@ -91,9 +93,11 @@ defmodule Facebook do ## Examples iex> # publish a message iex> Facebook.publish(:feed, "", [message: "") + {:ok, %{"id" => "{page_id}_{post_id}"}} iex> # publish a link and message iex> Facebook.publish(:feed, "", [message: "") + {:ok, %{"id" => "{page_id}_{post_id}"}} """ @spec publish(:feed, feed_id :: String.t, fields, access_token) :: response @@ -111,11 +115,12 @@ defmodule Facebook do ## Example iex> Facebook.publish(:photo, "", "", [], "") - {:json, %{"id" => "..."}} + {:ok, %{"id" => photo_id, "post_id" => "{page_id}_{post_id}"} iex> Facebook.publish(:video, "", "