feat: Add create() and update() methods to DocumentTypes resource#18
Merged
Conversation
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>
There was a problem hiding this comment.
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()andDocumentTypes.update()(pluswithRawResponsevariants) and corresponding MSW tests. - Extended
DocumentTypewith astatusfield and introducedDocumentTypeCreateParams/DocumentTypeUpdateParamstypes 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.
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>
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.
🔗 Related Issue
Closes #17
📋 Changes Summary
DocumentTypeCreateParamsandDocumentTypeUpdateParamsinterfaces tosrc/types/document-type.tsstatus: stringfield toDocumentTypeinterfacecreate(params)andupdate(id, params)methods toDocumentTypesresource with{ data: DocumentType }response unwrappingwithRawResponsevariants for both new methodssrc/types/index.ts,src/resources/index.ts,src/index.tsmockDocumentTypeCreatedand comprehensive MSW-based tests0.1.2✅ Completed Acceptance Criteria
client.documentTypes.create(params)sends POST to/api/document-typesand returnsDocumentTypeclient.documentTypes.update(id, params)sends PUT to/api/document-types/{id}and returnsDocumentTypewithRawResponsereturningRawResponseDocumentTypeCreateParamsandDocumentTypeUpdateParamstypes exportedDocumentTypeinterface includesstatusfield0.1.2🧪 Testing
{ data }response unwrapping, and RawResponse status codestypecheck ✅ | lint ✅ | test ✅ | build ✅🤖 Generated with Claude Code