./ct_report/coverage/mongoose_graphql_stanza_admin_mutation.COVER.html

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