./ct_report/coverage/mongoose_graphql_stanza_user_mutation.COVER.html

1 -module(mongoose_graphql_stanza_user_mutation).
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, [null_to_undefined/1, format_result/2]).
11
12 execute(Ctx, _Obj, <<"sendMessage">>, Args) ->
13
:-(
send_message(Ctx, Args);
14 execute(Ctx, _Obj, <<"sendMessageHeadLine">>, Args) ->
15
:-(
send_message_headline(Ctx, Args);
16 execute(Ctx, _Obj, <<"sendStanza">>, Args) ->
17
:-(
send_stanza(Ctx, Args).
18
19 send_message(#{user := User}, #{<<"from">> := From, <<"to">> := To, <<"body">> := Body}) ->
20
:-(
Res = mongoose_stanza_api:send_chat_message(User, null_to_undefined(From), To, Body),
21
:-(
format_result(Res, #{}).
22
23 send_message_headline(#{user := User}, #{<<"from">> := From, <<"to">> := To, <<"body">> := Body,
24 <<"subject">> := Subject}) ->
25
:-(
Res = mongoose_stanza_api:send_headline_message(
26 User, null_to_undefined(From), To, null_to_undefined(Body), null_to_undefined(Subject)),
27
:-(
format_result(Res, #{}).
28
29 send_stanza(#{user := User}, #{<<"stanza">> := Packet}) ->
30
:-(
Res = mongoose_stanza_api:send_stanza(User, Packet),
31
:-(
format_result(Res, #{}).
Line Hits Source