-module(chrobot@internal@download_protocol). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([main/0]). -spec download(binary(), binary()) -> nil. download(Origin_url, Destination_path) -> gleam@io:println(<<"Making request to "/utf8, Origin_url/binary>>), _assert_subject = gleam@http@request:to(Origin_url), {ok, Request} = case _assert_subject of {ok, _} -> _assert_subject; _assert_fail -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail, module => <<"chrobot/internal/download_protocol"/utf8>>, function => <<"download"/utf8>>, line => 30}) end, _assert_subject@1 = gleam@httpc:send(Request), {ok, Res} = case _assert_subject@1 of {ok, _} -> _assert_subject@1; _assert_fail@1 -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail@1, module => <<"chrobot/internal/download_protocol"/utf8>>, function => <<"download"/utf8>>, line => 31}) end, case erlang:element(2, Res) of 200 -> gleam@io:println( <<"Writing response to "/utf8, Destination_path/binary>> ), _assert_subject@2 = simplifile:write( Destination_path, erlang:element(4, Res) ), {ok, _} = case _assert_subject@2 of {ok, _} -> _assert_subject@2; _assert_fail@2 -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail@2, module => <<"chrobot/internal/download_protocol"/utf8>>, function => <<"download"/utf8>>, line => 35}) end, nil; _ -> gleam@io:println(<<"Non-200 response from server!"/utf8>>), erlang:error(#{gleam_error => panic, message => <<"panic expression evaluated"/utf8>>, module => <<"chrobot/internal/download_protocol"/utf8>>, function => <<"download"/utf8>>, line => 40}) end. -spec main() -> nil. main() -> download( <<"https://raw.githubusercontent.com/ChromeDevTools/devtools-protocol/master/json/browser_protocol.json"/utf8>>, <<"./assets/"/utf8, "browser_protocol.json"/utf8>> ), download( <<"https://raw.githubusercontent.com/ChromeDevTools/devtools-protocol/master/json/js_protocol.json"/utf8>>, <<"./assets/"/utf8, "js_protocol.json"/utf8>> ).