From 47b60212a8ccb3ae62101937999ef8bd241777fb Mon Sep 17 00:00:00 2001 From: JohnnyT Date: Sun, 14 Sep 2025 12:46:08 -0600 Subject: [PATCH] Fixes spec for Users.list --- .gitignore | 2 ++ CLAUDE.md | 3 ++- lib/msg/users.ex | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index cbebfba..b7e64ba 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ msg-*.tar # Don't commit environment variables used for local testing .env + +/priv/plts/ diff --git a/CLAUDE.md b/CLAUDE.md index 592e741..04c233d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -79,6 +79,7 @@ The project uses ExUnit with Mox for mocking. Integration tests are separated in ### Authentication Flow The library implements OAuth2 client credentials flow: + 1. `Msg.Client.new/1` accepts credentials (`client_id`, `client_secret`, `tenant_id`) 2. `fetch_token!/1` exchanges credentials for access token via Azure AD -3. Returns configured Req client with Authorization header for Graph API calls \ No newline at end of file +3. Returns configured Req client with Authorization header for Graph API calls diff --git a/lib/msg/users.ex b/lib/msg/users.ex index af8c0a4..c654801 100644 --- a/lib/msg/users.ex +++ b/lib/msg/users.ex @@ -16,12 +16,13 @@ defmodule Msg.Users do Corresponds to: [GET /users] https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http """ - @spec list(Req.Request.t()) :: {:ok, map()} | {:error, any()} + @spec list(Req.Request.t()) :: {:ok, [map()]} | {:error, any()} def list(client) do Request.get(client, "/users") |> case do {:ok, %{"value" => value}} -> {:ok, value} + error -> error end