Elixir ATProtocol firehose & subscription listener

Initial commit

ovyerus.com 3df61b08

verified
+4
.formatter.exs
···
+
# Used by "mix format"
+
[
+
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
+
]
+28
.gitignore
···
+
# The directory Mix will write compiled artifacts to.
+
/_build/
+
+
# If you run "mix test --cover", coverage assets end up here.
+
/cover/
+
+
# The directory Mix downloads your dependencies sources to.
+
/deps/
+
+
# Where third-party dependencies like ExDoc output generated docs.
+
/doc/
+
+
# If the VM crashes, it generates a dump, let's ignore it too.
+
erl_crash.dump
+
+
# Also ignore archive artifacts (built via "mix archive.build").
+
*.ez
+
+
# Ignore package tarball (built via "mix hex.build").
+
drinkup-*.tar
+
+
# Temporary files, for example, from tests.
+
/tmp/
+
+
# Nix
+
.envrc
+
.direnv
+
result
+4
README.md
···
+
# Drinkup
+
+
Drinkup is an ELixir library for listening to events from an ATProtocol
+
firehose.
+27
flake.lock
···
+
{
+
"nodes": {
+
"nixpkgs": {
+
"locked": {
+
"lastModified": 1748026106,
+
"narHash": "sha256-6m1Y3/4pVw1RWTsrkAK2VMYSzG4MMIj7sqUy7o8th1o=",
+
"owner": "nixos",
+
"repo": "nixpkgs",
+
"rev": "063f43f2dbdef86376cc29ad646c45c46e93234c",
+
"type": "github"
+
},
+
"original": {
+
"owner": "nixos",
+
"ref": "nixos-unstable",
+
"repo": "nixpkgs",
+
"type": "github"
+
}
+
},
+
"root": {
+
"inputs": {
+
"nixpkgs": "nixpkgs"
+
}
+
}
+
},
+
"root": "root",
+
"version": 7
+
}
+21
flake.nix
···
+
{
+
inputs = {
+
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
+
};
+
+
outputs = {nixpkgs, ...}: let
+
forSystems = fn:
+
nixpkgs.lib.genAttrs [
+
"aarch64-linux"
+
"aarch64-darwin"
+
"x86_64-darwin"
+
"x86_64-linux"
+
] (system: fn nixpkgs.legacyPackages.${system});
+
defaultForSystems = fn: forSystems (pkgs: {default = fn pkgs;});
+
in {
+
devShells = defaultForSystems (pkgs:
+
pkgs.mkShell {
+
nativeBuildInputs = with pkgs; [elixir erlang];
+
});
+
};
+
}
+18
lib/drinkup.ex
···
+
defmodule Drinkup do
+
@moduledoc """
+
Documentation for `Drinkup`.
+
"""
+
+
@doc """
+
Hello world.
+
+
## Examples
+
+
iex> Drinkup.hello()
+
:world
+
+
"""
+
def hello do
+
:world
+
end
+
end
+28
mix.exs
···
+
defmodule Drinkup.MixProject do
+
use Mix.Project
+
+
def project do
+
[
+
app: :drinkup,
+
version: "0.1.0",
+
elixir: "~> 1.18",
+
start_permanent: Mix.env() == :prod,
+
deps: deps()
+
]
+
end
+
+
# Run "mix help compile.app" to learn about applications.
+
def application do
+
[
+
extra_applications: [:logger]
+
]
+
end
+
+
# Run "mix help deps" to learn about dependencies.
+
defp deps do
+
[
+
# {:dep_from_hexpm, "~> 0.3.0"},
+
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
+
]
+
end
+
end
+8
test/drinkup_test.exs
···
+
defmodule DrinkupTest do
+
use ExUnit.Case
+
doctest Drinkup
+
+
test "greets the world" do
+
assert Drinkup.hello() == :world
+
end
+
end
+1
test/test_helper.exs
···
+
ExUnit.start()