From ff07cb18309a31e37d66aaf9d18cd21192250fd6 Mon Sep 17 00:00:00 2001 From: Christian Sunesson <52162652+chsukivra@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:43:34 +0100 Subject: [PATCH] feat: use restc's typing (#32) * fix: use exported types from restc * fix: test run on otp 26 and 27 too * fix: stop testing for otp 24 * fix: app depend on jsx (dialyzer sad) * fix: upgrade restc * fix: use rebar3 3.24.0 --- .github/workflows/erlang.yml | 5 +++-- include/oauth2c.hrl | 17 ++++------------- rebar.config | 2 +- rebar.lock | 26 +++++++++++++------------- src/oauth2c.app.src | 1 + 5 files changed, 22 insertions(+), 29 deletions(-) diff --git a/.github/workflows/erlang.yml b/.github/workflows/erlang.yml index 9456a19..ac3a738 100644 --- a/.github/workflows/erlang.yml +++ b/.github/workflows/erlang.yml @@ -10,14 +10,15 @@ jobs: name: OTP ${{matrix.otp}} strategy: + fail-fast: false matrix: - otp: ["24", "25"] + otp: ["25", "26", "27"] steps: - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1.16.0 with: otp-version: ${{matrix.otp}} - rebar3-version: "3.20.0" + rebar3-version: "3.24.0" - name: Compile run: make - name: Run elvis diff --git a/include/oauth2c.hrl b/include/oauth2c.hrl index 2711427..16a659c 100644 --- a/include/oauth2c.hrl +++ b/include/oauth2c.hrl @@ -28,8 +28,8 @@ -type url() :: binary(). %% <<"password">> or <<"client_credentials">> -type at_type() :: binary(). --type headers() :: [header()]. --type header() :: {binary(), binary()}. +-type headers() :: restc:headers(). +-type header() :: restc:header(). -type status_codes() :: [status_code()]. -type status_code() :: integer(). -type reason() :: term(). @@ -37,16 +37,7 @@ -type property() :: atom() | tuple(). -type proplist() :: [property()]. -type options() :: proplist(). --type body() :: proplist() | [proplist()]. --type restc_response() :: { ok - , Status::status_code() - , Headers::headers() - , Body::body()} | - { error - , Status::status_code() - , Headers::headers() - , Body::body()} | - { error, Reason::reason()}. --type response() :: {restc_response(), #client{}}. +-type body() :: restc:body(). +-type response() :: {restc:response(), #client{}}. -type token_type() :: bearer | unsupported. -type client() :: #client{}. diff --git a/rebar.config b/rebar.config index e4f2b0a..6f7dd11 100644 --- a/rebar.config +++ b/rebar.config @@ -25,7 +25,7 @@ %% ---------------------------------------------------------------------------- {deps, - [ {restc, ".*", {git, "https://github.com/kivra/restclient.git", {tag, "0.9.9"}}} + [ {restc, ".*", {git, "https://github.com/kivra/restclient.git", {tag, "0.9.10"}}} , {jose, {git, "https://github.com/potatosalad/erlang-jose.git", {tag, "1.11.6"}}} ]}. diff --git a/rebar.lock b/rebar.lock index ad9be24..4ef5392 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,6 +1,6 @@ {"1.2.0", [{<<"base64url">>,{pkg,<<"base64url">>,<<"0.0.1">>},1}, - {<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.3">>},2}, + {<<"certifi">>,{pkg,<<"certifi">>,<<"2.12.0">>},2}, {<<"erlsom">>,{pkg,<<"erlsom">>,<<"1.5.1">>},1}, {<<"hackney">>,{pkg,<<"hackney">>,<<"1.20.1">>},1}, {<<"idna">>,{pkg,<<"idna">>,<<"6.1.1">>},2}, @@ -10,37 +10,37 @@ 0}, {<<"jsx">>,{pkg,<<"jsx">>,<<"3.1.0">>},1}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, - {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},2}, - {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},2}, + {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.3.0">>},2}, + {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.4.1">>},2}, {<<"restc">>, {git,"https://github.com/kivra/restclient.git", - {ref,"424f2a81ac478c3560254315b3604debb03a8c62"}}, + {ref,"597d8162b4a9f547046f5ca604c93908b55e7e2a"}}, 0}, - {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},2}, + {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.7">>},2}, {<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},2}]}. [ {pkg_hash,[ {<<"base64url">>, <<"36A90125F5948E3AFD7BE97662A1504B934DD5DAC78451CA6E9ABF85A10286BE">>}, - {<<"certifi">>, <<"70BDD7E7188C804F3A30EE0E7C99655BC35D8AC41C23E12325F36AB449B70651">>}, + {<<"certifi">>, <<"2D1CCA2EC95F59643862AF91F001478C9863C2AC9CB6E2F89780BFD8DE987329">>}, {<<"erlsom">>, <<"C8FE2BABD33FF0846403F6522328B8AB676F896B793634CFE7EF181C05316C03">>}, {<<"hackney">>, <<"8D97AEC62DDDDD757D128BFD1DF6C5861093419F8F7A4223823537BAD5D064E2">>}, {<<"idna">>, <<"8A63070E9F7D0C62EB9D9FCB360A7DE382448200FBBD1B106CC96D3D8099DF8D">>}, {<<"jsx">>, <<"D12516BAA0BB23A59BB35DCCAF02A1BD08243FCBB9EFE24F2D9D056CCFF71268">>}, {<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>}, - {<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>}, - {<<"parse_trans">>, <<"16328AB840CC09919BD10DAB29E431DA3AF9E9E7E7E6F0089DD5A2D2820011D8">>}, - {<<"ssl_verify_fun">>, <<"CF344F5692C82D2CD7554F5EC8FD961548D4FD09E7D22F5B62482E5AEAEBD4B0">>}, + {<<"mimerl">>, <<"D0CD9FC04B9061F82490F6581E0128379830E78535E017F7780F37FEA7545726">>}, + {<<"parse_trans">>, <<"6E6AA8167CB44CC8F39441D05193BE6E6F4E7C2946CB2759F015F8C56B76E5FF">>}, + {<<"ssl_verify_fun">>, <<"354C321CF377240C7B8716899E182CE4890C5938111A1296ADD3EC74CF1715DF">>}, {<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]}, {pkg_hash_ext,[ {<<"base64url">>, <<"FAB09B20E3F5DB886725544CBCF875B8E73EC93363954EB8A1A9ED834AA8C1F9">>}, - {<<"certifi">>, <<"ED516ACB3929B101208A9D700062D520F3953DA3B6B918D866106FFA980E1C10">>}, + {<<"certifi">>, <<"EE68D85DF22E554040CDB4BE100F33873AC6051387BAF6A8F6CE82272340FF1C">>}, {<<"erlsom">>, <<"7965485494C5844DD127656AC40F141AADFA174839EC1BE1074E7EDF5B4239EB">>}, {<<"hackney">>, <<"FE9094E5F1A2A2C0A7D10918FEE36BFEC0EC2A979994CFF8CFE8058CD9AF38E3">>}, {<<"idna">>, <<"92376EB7894412ED19AC475E4A86F7B413C1B9FBB5BD16DCCD57934157944CEA">>}, {<<"jsx">>, <<"0C5CC8FDC11B53CC25CF65AC6705AD39E54ECC56D1C22E4ADB8F5A53FB9427F3">>}, {<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>}, - {<<"mimerl">>, <<"F278585650AA581986264638EBF698F8BB19DF297F66AD91B18910DFC6E19323">>}, - {<<"parse_trans">>, <<"07CD9577885F56362D414E8C4C4E6BDF10D43A8767ABB92D24CBE8B24C54888B">>}, - {<<"ssl_verify_fun">>, <<"BDB0D2471F453C88FF3908E7686F86F9BE327D065CC1EC16FA4540197EA04680">>}, + {<<"mimerl">>, <<"A1E15A50D1887217DE95F0B9B0793E32853F7C258A5CD227650889B38839FE9D">>}, + {<<"parse_trans">>, <<"620A406CE75DADA827B82E453C19CF06776BE266F5A67CFF34E1EF2CBB60E49A">>}, + {<<"ssl_verify_fun">>, <<"FE4C190E8F37401D30167C8C405EDA19469F34577987C76DDE613E838BBC67F8">>}, {<<"unicode_util_compat">>, <<"25EEE6D67DF61960CF6A794239566599B09E17E668D3700247BC498638152521">>}]} ]. diff --git a/src/oauth2c.app.src b/src/oauth2c.app.src index 12126d8..c2ae1c3 100644 --- a/src/oauth2c.app.src +++ b/src/oauth2c.app.src @@ -34,6 +34,7 @@ kernel, stdlib, inets, + jsx, jose, restc ]},