https://github.com/markfchavez/ex_github
Github Repositories API using Elixir Agents
https://github.com/markfchavez/ex_github
Last synced: over 1 year ago
JSON representation
Github Repositories API using Elixir Agents
- Host: GitHub
- URL: https://github.com/markfchavez/ex_github
- Owner: MarkFChavez
- Created: 2017-08-09T05:25:18.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-09T14:48:19.000Z (almost 9 years ago)
- Last Synced: 2025-02-06T15:53:13.601Z (over 1 year ago)
- Language: Elixir
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Github
This is a basic implementation of fetching a list of GitHub repositories by
passing in a username.
## So What's Special?
It enables a caching mechanism that stores the username as a key and his/her
repositories as its value. So that subsequent calls to the same *username*
will not call GitHub.
**TODOs**:
- Capability to sync a username with GitHub so when a new repository is added to
an already-cached user, the state will update to reflect the latest.
## Simple Usage
```elixir
{:ok, pid} = Github.start()
Github.get("mrkjlchvz")
Github.get("ccelestial")
Github.get("bnicart")
```
## Concurrency Demo
```elixir
{:ok, pid} = Github.start()
usernames = ["mrkjlchvz", "bnicart", "ccelestial"]
Enum.each usernames, fn username ->
spawn fn -> Github.get(username) end
end
Github.get("mrkjlchvz") # should access from cache
```
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `github` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:github, "~> 0.1.0"}]
end
```
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/github](https://hexdocs.pm/github).