1 |
|
-module(mongoose_graphql_http_upload_user_mutation). |
2 |
|
-behaviour(mongoose_graphql). |
3 |
|
|
4 |
|
-export([execute/4]). |
5 |
|
|
6 |
|
-import(mongoose_graphql_helper, [make_error/2]). |
7 |
|
|
8 |
|
-ignore_xref([execute/4]). |
9 |
|
|
10 |
|
-include("../mongoose_graphql_types.hrl"). |
11 |
|
-include("mongoose.hrl"). |
12 |
|
-include("jlib.hrl"). |
13 |
|
|
14 |
|
execute(#{user := #jid{lserver = Domain}}, httpUpload, <<"getUrl">>, |
15 |
|
#{<<"filename">> := FileName, <<"size">> := FileSize, |
16 |
|
<<"contentType">> := ContentType, <<"timeout">> := Timeout} = Data) -> |
17 |
:-( |
case mod_http_upload_api:get_urls(Domain, FileName, FileSize, ContentType, Timeout) of |
18 |
|
{ok, _} = Result -> |
19 |
:-( |
Result; |
20 |
|
Error -> |
21 |
:-( |
make_error(Error, Data) |
22 |
|
end. |