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