1 |
|
-module(mongoose_graphql_private_user_query). |
2 |
|
-behaviour(mongoose_graphql). |
3 |
|
|
4 |
|
-export([execute/4]). |
5 |
|
|
6 |
|
-ignore_xref([execute/4]). |
7 |
|
|
8 |
|
-include("../mongoose_graphql_types.hrl"). |
9 |
|
|
10 |
|
-import(mongoose_graphql_helper, [make_error/2, format_result/2]). |
11 |
|
|
12 |
|
execute(#{user := CallerJID}, _Obj, <<"getPrivate">>, |
13 |
|
#{<<"element">> := Element, <<"nameSpace">> := SubElement}) -> |
14 |
:-( |
case mod_private_api:private_get(CallerJID, Element, SubElement) of |
15 |
:-( |
{ok, _} = Result -> Result; |
16 |
|
Error -> |
17 |
:-( |
make_error(Error, #{user => jid:to_binary(CallerJID), element => Element, |
18 |
|
subElement => SubElement}) |
19 |
|
end. |