<commit_before>-module(telegrams_api).
-behaviour(cowboy_http_handler).

-export([init/3, handle/2, terminate/2]).


init({tcp, http}, Req, _Opts) ->
    {ok, Req, undefined}.

handle(Req, State) ->
    {ok, Req2} = cowboy_req:reply(200, [], <<"Hello World!">>, Req),
    {ok, Req2, State}.

terminate(_Req, _State) ->
    ok.<commit_msg>Implement a basic dispatch<commit_after>-module(telegrams_api).
-behaviour(cowboy_http_handler).

-export([init/3, handle/2, terminate/2]).


init({tcp, http}, Req, _Opts) ->
    {ok, Req, undefined}.

handle(Req, State) ->
    {ok, Req2} = dispatch(Req),
    {ok, Req2, State}.

dispatch(Req) ->
    {Channel, Req2} = cowboy_req:path(Req),
    case cowboy_req:method(Req2) of
        {<<"GET">>, Req2} ->
            subscribe(Channel, Req2);
        {<<"POST">>, Req2} ->
            publish(Channel, Req2)
    end.

subscribe(_Channel, Req) ->
    {ok, Req}.

publish(_Channel, Req) ->
    {ok, Req}.

terminate(_Req, _State) ->
    ok.
{'fraction_non_alphanumeric': 0.1985670419651996, 'fraction_numerical': 0.019447287615148412, 'mean_word_length': 3.1974248927038627, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '881951', 'n_tokens_mistral': 394, 'n_tokens_neox': 385, 'n_words': 75}