1 |
|
-module(mongoose_graphql_http_upload_admin_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(_Ctx, httpUpload, <<"getUrl">>, #{<<"domain">> := Domain, |
15 |
|
<<"filename">> := FileName, |
16 |
|
<<"size">> := FileSize, |
17 |
|
<<"contentType">> := ContentType, |
18 |
|
<<"timeout">> := Timeout} = Data) -> |
19 |
17 |
case mod_http_upload_api:get_urls(Domain, FileName, FileSize, ContentType, Timeout) of |
20 |
12 |
{ok, _} = Result -> Result; |
21 |
|
Error -> |
22 |
5 |
make_error(Error, Data) |
23 |
|
end. |