Skip to content

Commit 88f012a

Browse files
Merge pull request #53 from PhenoML/fern-bot/2026-02-03T21-42Z
refactor: simplify document API by removing fileType parameter
2 parents 5e318c6 + 8816b3f commit 88f012a

File tree

8 files changed

+29
-49
lines changed

8 files changed

+29
-49
lines changed

changelog.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## 4.0.0 - 2026-02-03
2+
* refactor: simplify document API by removing fileType parameter
3+
* The Lang2Fhir document endpoint now auto-detects file types from content magic bytes,
4+
* eliminating the need for manual MIME type specification. This change streamlines the
5+
* API interface while maintaining support for PDF, PNG, and JPEG file formats.
6+
* Key changes:
7+
* Remove fileType parameter from DocumentRequest interface
8+
* Update content parameter documentation to specify supported formats
9+
* Remove FileType enum and associated type definitions
10+
* Update all code examples and tests to use simplified API
11+
* Maintain backward compatibility for file type detection
12+
* 🌿 Generated with Fern
13+
114
## 3.1.0 - 2026-01-29
215
* feat: add citation support and rename text search method
316
* Adds source text citation functionality to code extraction and renames the text search method for better clarity. Citations provide exact text spans with character offsets showing where each code was found in the source text, enabling precise traceability.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "phenoml",
3-
"version": "3.1.0",
3+
"version": "4.0.0",
44
"private": false,
55
"repository": "github:PhenoML/phenoml-ts-sdk",
66
"type": "commonjs",

reference.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3096,8 +3096,7 @@ Extracts text from a document (PDF or image) and converts it into a structured F
30963096
await client.lang2Fhir.document({
30973097
version: "R4",
30983098
resource: "questionnaire",
3099-
content: "content",
3100-
fileType: "application/pdf"
3099+
content: "content"
31013100
});
31023101

31033102
```

src/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export class phenomlClient {
4040
{
4141
"X-Fern-Language": "JavaScript",
4242
"X-Fern-SDK-Name": "phenoml",
43-
"X-Fern-SDK-Version": "3.1.0",
44-
"User-Agent": "phenoml/3.1.0",
43+
"X-Fern-SDK-Version": "4.0.0",
44+
"User-Agent": "phenoml/4.0.0",
4545
"X-Fern-Runtime": core.RUNTIME.type,
4646
"X-Fern-Runtime-Version": core.RUNTIME.version,
4747
},

src/api/resources/lang2Fhir/client/Client.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,7 @@ export class Lang2Fhir {
430430
* await client.lang2Fhir.document({
431431
* version: "R4",
432432
* resource: "questionnaire",
433-
* content: "content",
434-
* fileType: "application/pdf"
433+
* content: "content"
435434
* })
436435
*/
437436
public document(

src/api/resources/lang2Fhir/client/requests/DocumentRequest.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@
55
* {
66
* version: "R4",
77
* resource: "questionnaire",
8-
* content: "content",
9-
* fileType: "application/pdf"
8+
* content: "content"
109
* }
1110
*/
1211
export interface DocumentRequest {
1312
/** FHIR version to use */
1413
version: string;
1514
/** Type of FHIR resource to create (questionnaire and US Core questionnaireresponse profiles currently supported) */
1615
resource: DocumentRequest.Resource;
17-
/** Base64 encoded file content */
16+
/**
17+
* Base64 encoded file content.
18+
* Supported file types: PDF (application/pdf), PNG (image/png), JPEG (image/jpeg).
19+
* File type is auto-detected from content magic bytes.
20+
*/
1821
content: string;
19-
/** MIME type of the file */
20-
fileType: DocumentRequest.FileType;
2122
}
2223

2324
export namespace DocumentRequest {
@@ -27,12 +28,4 @@ export namespace DocumentRequest {
2728
Questionnaireresponse: "questionnaireresponse",
2829
} as const;
2930
export type Resource = (typeof Resource)[keyof typeof Resource];
30-
/** MIME type of the file */
31-
export const FileType = {
32-
ApplicationPdf: "application/pdf",
33-
ImagePng: "image/png",
34-
ImageJpeg: "image/jpeg",
35-
ImageJpg: "image/jpg",
36-
} as const;
37-
export type FileType = (typeof FileType)[keyof typeof FileType];
3831
}

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const SDK_VERSION = "3.1.0";
1+
export const SDK_VERSION = "4.0.0";

tests/wire/lang2fhir/main.test.ts

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,7 @@ describe("Lang2Fhir", () => {
460460
test("document (1)", async () => {
461461
const server = mockServerPool.createServer();
462462
const client = new phenomlClient({ token: "test", environment: server.baseUrl });
463-
const rawRequestBody = {
464-
version: "R4",
465-
resource: "questionnaire",
466-
content: "content",
467-
fileType: "application/pdf",
468-
};
463+
const rawRequestBody = { version: "R4", resource: "questionnaire", content: "content" };
469464
const rawResponseBody = { key: "value" };
470465
server
471466
.mockEndpoint()
@@ -480,7 +475,6 @@ describe("Lang2Fhir", () => {
480475
version: "R4",
481476
resource: "questionnaire",
482477
content: "content",
483-
fileType: "application/pdf",
484478
});
485479
expect(response).toEqual({
486480
key: "value",
@@ -490,12 +484,7 @@ describe("Lang2Fhir", () => {
490484
test("document (2)", async () => {
491485
const server = mockServerPool.createServer();
492486
const client = new phenomlClient({ token: "test", environment: server.baseUrl });
493-
const rawRequestBody = {
494-
version: "version",
495-
resource: "questionnaire",
496-
content: "content",
497-
fileType: "application/pdf",
498-
};
487+
const rawRequestBody = { version: "version", resource: "questionnaire", content: "content" };
499488
const rawResponseBody = { key: "value" };
500489
server
501490
.mockEndpoint()
@@ -511,20 +500,14 @@ describe("Lang2Fhir", () => {
511500
version: "version",
512501
resource: "questionnaire",
513502
content: "content",
514-
fileType: "application/pdf",
515503
});
516504
}).rejects.toThrow(phenoml.lang2Fhir.BadRequestError);
517505
});
518506

519507
test("document (3)", async () => {
520508
const server = mockServerPool.createServer();
521509
const client = new phenomlClient({ token: "test", environment: server.baseUrl });
522-
const rawRequestBody = {
523-
version: "version",
524-
resource: "questionnaire",
525-
content: "content",
526-
fileType: "application/pdf",
527-
};
510+
const rawRequestBody = { version: "version", resource: "questionnaire", content: "content" };
528511
const rawResponseBody = { key: "value" };
529512
server
530513
.mockEndpoint()
@@ -540,20 +523,14 @@ describe("Lang2Fhir", () => {
540523
version: "version",
541524
resource: "questionnaire",
542525
content: "content",
543-
fileType: "application/pdf",
544526
});
545527
}).rejects.toThrow(phenoml.lang2Fhir.UnauthorizedError);
546528
});
547529

548530
test("document (4)", async () => {
549531
const server = mockServerPool.createServer();
550532
const client = new phenomlClient({ token: "test", environment: server.baseUrl });
551-
const rawRequestBody = {
552-
version: "version",
553-
resource: "questionnaire",
554-
content: "content",
555-
fileType: "application/pdf",
556-
};
533+
const rawRequestBody = { version: "version", resource: "questionnaire", content: "content" };
557534
const rawResponseBody = { key: "value" };
558535
server
559536
.mockEndpoint()
@@ -569,7 +546,6 @@ describe("Lang2Fhir", () => {
569546
version: "version",
570547
resource: "questionnaire",
571548
content: "content",
572-
fileType: "application/pdf",
573549
});
574550
}).rejects.toThrow(phenoml.lang2Fhir.InternalServerError);
575551
});

0 commit comments

Comments
 (0)