Improve specs
This commit is contained in:
+13
-4
@@ -801,19 +801,23 @@ contract_source(ID) ->
|
|||||||
Error -> Error
|
Error -> Error
|
||||||
end.
|
end.
|
||||||
|
|
||||||
extract(Blobby) ->
|
extract(<<"ba_", _/binary>> = Blobby) ->
|
||||||
case gmser_api_encoder:safe_decode(bytearray, Blobby) of
|
case gmser_api_encoder:safe_decode(bytearray, Blobby) of
|
||||||
{ok, TarBaby} -> extract2(TarBaby);
|
{ok, TarBaby} -> extract2(TarBaby);
|
||||||
{error, invalid_encoding} -> {ok, Blobby}
|
{error, invalid_encoding} -> {ok, unicode:characters_to_list(Blobby)}
|
||||||
end.
|
end;
|
||||||
|
extract(Blobby) when is_binary(Blobby) ->
|
||||||
|
{ok, unicode:characters_to_list(Blobby)}.
|
||||||
|
|
||||||
extract2(TarBaby) ->
|
extract2(TarBaby) ->
|
||||||
case erl_tar:extract({binary, TarBaby}, [memory, compressed]) of
|
case erl_tar:extract({binary, TarBaby}, [memory, compressed]) of
|
||||||
|
{ok, [{_File, Source}]} ->
|
||||||
|
{ok, unicode:characters_to_list(Source)};
|
||||||
{ok, Bundle} ->
|
{ok, Bundle} ->
|
||||||
{project, Bundle};
|
{project, Bundle};
|
||||||
Error ->
|
Error ->
|
||||||
io:format("Dis chit happen: ~tp~n", [Error]),
|
io:format("Dis chit happen: ~tp~n", [Error]),
|
||||||
{ok, TarBaby}
|
{ok, unicode:characters_to_list(TarBaby)}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
@@ -895,6 +899,11 @@ request(Path) ->
|
|||||||
hz_man:request(unicode:characters_to_list(Path)).
|
hz_man:request(unicode:characters_to_list(Path)).
|
||||||
|
|
||||||
|
|
||||||
|
-spec request(Path, Payload) -> {ok, Value} | {error, Reason}
|
||||||
|
when Path :: unicode:charlist(),
|
||||||
|
Payload :: unicode:charlist(),
|
||||||
|
Value :: map(),
|
||||||
|
Reason :: hz:chain_error().
|
||||||
request(Path, Payload) ->
|
request(Path, Payload) ->
|
||||||
hz_man:request(unicode:characters_to_list(Path), Payload).
|
hz_man:request(unicode:characters_to_list(Path), Payload).
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user