feat(documents): add Documents, Document Types, and Document Folders#102
Open
sgerrand wants to merge 4 commits into
Open
feat(documents): add Documents, Document Types, and Document Folders#102sgerrand wants to merge 4 commits into
sgerrand wants to merge 4 commits into
Conversation
Adds Humaans.Documents covering /api/documents. Documents associate a person with a file (or external link) categorised by type and folder; the struct mirrors the documented fields including the nested file metadata.
Adds Humaans.DocumentTypes covering /api/document-types. The API does not support DELETE so the resource declares actions [:list, :create, :retrieve, :update] explicitly; a guard test asserts delete/2 is not exported.
Adds Humaans.DocumentFolders covering /api/document-folders. Folders group documents and carry an audience definition (type + rules) that controls visibility; the struct exposes the documented fields including deletedAt for soft-deleted folders.
Coverage Report for CI Build 25327281444Coverage decreased (-1.5%) to 98.485%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
Adds the Documents resource family to the Elixir client so the library can access document records, document types, and document folders as first-class API modules, which aligns with the repo’s pattern of wrapping Humaans endpoints as resource modules plus structs and tests.
Changes:
- Adds three new resource modules:
Humaans.Documents,Humaans.DocumentTypes, andHumaans.DocumentFolders. - Adds matching resource structs for document, document type, and document folder payloads, including timestamp/date parsing.
- Extends docs/tests by updating the README, adding resource test suites, and exposing new module access helpers on
Humaans.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
test/humaans/documents_test.exs |
Adds CRUD tests for document requests and response shaping. |
test/humaans/document_types_test.exs |
Adds tests for document-type list/create/retrieve/update and no-delete behavior. |
test/humaans/document_folders_test.exs |
Adds CRUD tests for document-folder requests and response shaping. |
README.md |
Lists the three new document-related resource modules. |
lib/humaans/resources/document.ex |
Defines the Document struct and date/datetime parsing. |
lib/humaans/resources/document_type.ex |
Defines the DocumentType struct and timestamp parsing. |
lib/humaans/resources/document_folder.ex |
Defines the DocumentFolder struct and timestamp parsing. |
lib/humaans/documents.ex |
Adds the documents API wrapper via Humaans.Resource. |
lib/humaans/document_types.ex |
Adds the document-types API wrapper with delete disabled. |
lib/humaans/document_folders.ex |
Adds the document-folders API wrapper via Humaans.Resource. |
lib/humaans.ex |
Exposes top-level helpers for the three new resource modules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+17
to
+20
| expect(Humaans.MockHTTPClient, :request, fn client_param, opts -> | ||
| assert client_param == client | ||
| assert Keyword.fetch!(opts, :method) == :get | ||
| assert Keyword.fetch!(opts, :url) == "https://app.humaans.io/api/documents" |
Comment on lines
+17
to
+20
| expect(Humaans.MockHTTPClient, :request, fn client_param, opts -> | ||
| assert client_param == client | ||
| assert Keyword.fetch!(opts, :method) == :get | ||
| assert Keyword.fetch!(opts, :url) == "https://app.humaans.io/api/document-types" |
Comment on lines
+17
to
+20
| expect(Humaans.MockHTTPClient, :request, fn client_param, opts -> | ||
| assert client_param == client | ||
| assert Keyword.fetch!(opts, :method) == :get | ||
| assert Keyword.fetch!(opts, :url) == "https://app.humaans.io/api/document-folders" |
Comment on lines
+199
to
+213
| def documents, do: Humaans.Documents | ||
|
|
||
| @doc """ | ||
| Access the Document Types API. | ||
|
|
||
| Returns the module that contains functions for working with document type resources. | ||
| """ | ||
| def document_types, do: Humaans.DocumentTypes | ||
|
|
||
| @doc """ | ||
| Access the Document Folders API. | ||
|
|
||
| Returns the module that contains functions for working with document folder resources. | ||
| """ | ||
| def document_folders, do: Humaans.DocumentFolders |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💁 These changes add CRUD coverage for the three Documents-related resources, foundational for any onboarding-pipeline integration.
Summary
Each ships as struct + module + tests using `Humaans.Resource`. Helpers and README updated.
Addresses Group D1 (Documents family) of the API coverage review.
Test plan