Skip to content

iarekk/cat_facts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CatFacts

Simple Elixir client for the cat facts API https://github.com/alexwohlbruck/cat-facts.

Written to quickly/imperfectly illustrate:

Discord bot

The bot will respond to any message with text !fact, and will post a random cat fact:

Cat facts bot in action

Current state

The API can be called like that:

iex(5)> CatFacts.ApiClient.get_random_fact()

23:15:27.080 [info] Received response with status code=200
{:ok,
 %{
   "__v" => 0,
   "_id" => "63d7cad26e605bbb069f1445",
   "createdAt" => "2023-01-30T13:49:06.481Z",
   "deleted" => false,
   "status" => %{"sentCount" => 0, "verified" => nil},
   "text" => "Cats purr because their vocal cords in their throats vibrate. So the muscles of the larynx open and close the passage of air about 25 times per second.",
   "type" => "cat",
   "updatedAt" => "2023-01-30T13:49:06.481Z",
   "user" => "63cd5150eec42e60ec32de30"
 }}

Installation

If available in Hex, the package can be installed by adding cat_facts to your list of dependencies in mix.exs:

def deps do
  [
    {:cat_facts, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/cat_facts.

About

Cat Facts API client in Elixirs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages