From 3958b1590059275ba480bf6b9c9696be8af4e1ff Mon Sep 17 00:00:00 2001 From: Tim Gremore Date: Mon, 7 Nov 2022 07:09:42 -0600 Subject: [PATCH] WIP add Livebook examples in documentation --- README.md | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2a75bdf..54391cf 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # AsanaEx -**TODO: Add description** - ## Installation If [available in Hex](https://hex.pm/docs/publish), the package can be installed @@ -15,7 +13,32 @@ def deps do end ``` + +### Fetch details about self, including workspace gids +```elixir +{:ok, me} = AsanaEx.Client.me(token) +my_gid = me["data"]["gid"] +workspace_gids = Enum.map(me["data"]["workspaces"], fn %{"gid" => gid} -> gid end) +``` + +### Fetch all tasks for a collection of workspace gids or a single workspace gid: +```elixir +tasks = + AsanaEx.Client.all_workspace_tasks(workspace_gids, my_gid, token) + |> Enum.to_list() + |> Enum.flat_map(fn {:ok, tasks} -> tasks end) +``` + + +### Fetch subtasks for tasks: +```elixir +subtasks = + AsanaEx.Client.maybe_get_subtasks(tasks, my_gid, token) + |> Enum.to_list() + |> Enum.flat_map(fn {:ok, tasks} -> tasks end) + |> Enum.map(& &1["name"]) +``` + 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/asana_ex](https://hexdocs.pm/asana_ex). -