Skip to content

feat: Add create() and update() methods to DocumentTypes resource#18

Merged
rarce merged 2 commits into
mainfrom
feat/issue-17-document-types-create-update
Apr 7, 2026
Merged

feat: Add create() and update() methods to DocumentTypes resource#18
rarce merged 2 commits into
mainfrom
feat/issue-17-document-types-create-update

Conversation

@rarce
Copy link
Copy Markdown
Contributor

@rarce rarce commented Apr 7, 2026

🔗 Related Issue

Closes #17

📋 Changes Summary

  • Added DocumentTypeCreateParams and DocumentTypeUpdateParams interfaces to src/types/document-type.ts
  • Added status: string field to DocumentType interface
  • Added create(params) and update(id, params) methods to DocumentTypes resource with { data: DocumentType } response unwrapping
  • Added withRawResponse variants for both new methods
  • Re-exported new param types from src/types/index.ts, src/resources/index.ts, src/index.ts
  • Added test fixture mockDocumentTypeCreated and comprehensive MSW-based tests
  • Updated CHANGELOG with v0.1.2 entry
  • Bumped version to 0.1.2

✅ Completed Acceptance Criteria

  • client.documentTypes.create(params) sends POST to /api/document-types and returns DocumentType
  • client.documentTypes.update(id, params) sends PUT to /api/document-types/{id} and returns DocumentType
  • Both methods available via withRawResponse returning RawResponse
  • DocumentTypeCreateParams and DocumentTypeUpdateParams types exported
  • DocumentType interface includes status field
  • All new types re-exported from index files
  • Unit tests with MSW handlers for both endpoints
  • CHANGELOG updated, version bumped to 0.1.2

🧪 Testing

  • 194 tests passing (12 in document-types suite, 5 new)
  • Tests verify request body forwarding, { data } response unwrapping, and RawResponse status codes
  • Full validation: typecheck ✅ | lint ✅ | test ✅ | build ✅

🤖 Generated with Claude Code

Add support for POST /api/document-types and PUT /api/document-types/{id}
endpoints. Includes DocumentTypeCreateParams and DocumentTypeUpdateParams
types, withRawResponse variants, status field on DocumentType, and
comprehensive MSW-based tests.

Closes #17

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds write support to the DocumentTypes SDK resource (create/update) and exposes the associated request parameter types, aligning the SDK with newly available DocuTray API endpoints.

Changes:

  • Added DocumentTypes.create() and DocumentTypes.update() (plus withRawResponse variants) and corresponding MSW tests.
  • Extended DocumentType with a status field and introduced DocumentTypeCreateParams / DocumentTypeUpdateParams types with re-exports.
  • Updated release metadata (CHANGELOG + package version).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/resources/document-types.test.ts Adds MSW-based tests for create/update and raw-response variants
tests/helpers/fixtures.ts Extends document type fixtures with status and adds a “created” fixture
src/types/document-type.ts Adds status to DocumentType and defines create/update param interfaces
src/types/index.ts Re-exports new document type param types
src/resources/document-types.ts Implements create/update methods and raw-response variants
src/resources/index.ts Re-exports new document type param types from the resource layer
src/index.ts Re-exports new document type param types from the package entrypoint
CHANGELOG.md Adds v0.1.2 changelog entry
package.json Bumps package version to 0.1.2

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json
Comment thread CHANGELOG.md Outdated
Comment thread src/resources/document-types.ts
Comment thread src/resources/document-types.ts Outdated
Sync VERSION constant with package.json (0.1.0 → 0.1.2), consolidate
CHANGELOG 0.1.1 items into 0.1.2, and align withRawResponse.create/update
return types to RawResponse<DocumentType> for consistency with other resources.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rarce rarce merged commit 8cfa760 into main Apr 7, 2026
6 checks passed
@rarce rarce deleted the feat/issue-17-document-types-create-update branch April 7, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add create() and update() methods to DocumentTypes resource

2 participants