From 39f36a66b32ff23f380e2ea51a52d302556e6be2 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 12:48:16 +0000 Subject: [PATCH] SDK regeneration --- .fern/metadata.json | 8 +- pnpm-lock.yaml | 8 +- src/api/errors/UnprocessableEntityError.ts | 3 +- src/api/resources/agents/client/Client.ts | 44 +- src/api/resources/documents/client/Client.ts | 116 ++++ src/api/resources/documents/index.ts | 1 + .../resources/documents/resources/index.ts | 4 + .../resources/sections/client/Client.ts | 419 ++++++++++++ .../resources/sections/client/index.ts | 1 + .../client/requests/ListSectionsRequest.ts | 14 + .../client/requests/UpdateSectionRequest.ts | 12 + .../sections/client/requests/index.ts | 2 + .../documents/resources/sections/index.ts | 2 + .../resources/sections/resources/index.ts | 1 + .../resources/versions/client/Client.ts | 431 +++++++++++++ .../resources/versions/client/index.ts | 1 + .../sections/resources/versions/index.ts | 1 + .../resources/templates/client/Client.ts | 415 ++++++++++++ .../resources/templates/client/index.ts | 1 + .../client/requests/ListTemplatesRequest.ts | 14 + .../client/requests/UpdateTemplateRequest.ts | 12 + .../templates/client/requests/index.ts | 2 + .../documents/resources/templates/index.ts | 2 + .../resources/templates/resources/index.ts | 3 + .../resources/versions/client/Client.ts | 429 ++++++++++++ .../resources/versions/client/index.ts | 1 + .../requests/CreateTemplateVersionRequest.ts | 17 + .../versions/client/requests/index.ts | 1 + .../templates/resources/versions/index.ts | 2 + .../CreateTemplateVersionRequestGeneration.ts | 8 + .../resources/versions/types/index.ts | 1 + src/api/types/AgentsCreateExpertReference.ts | 2 + src/api/types/AgentsErrorResponse.ts | 14 - src/api/types/AgentsExpertReference.ts | 2 + src/api/types/AgentsRegistryExpert.ts | 2 + src/api/types/AgentsValidationError.ts | 11 - .../types/AgentsValidationErrorErrorsItem.ts | 6 - .../types/AgentsValidationErrorResponse.ts | 7 - src/api/types/ArrayNode.ts | 16 + src/api/types/BoolNode.ts | 9 + src/api/types/ContextFacts.ts | 11 + src/api/types/ContextText.ts | 10 + src/api/types/ContextTranscript.ts | 11 + src/api/types/CreateSectionBase.ts | 14 + .../CreateSectionFromInheritanceRequest.ts | 12 + .../types/CreateSectionFromScratchRequest.ts | 10 + src/api/types/CreateSectionRequest.ts | 5 + src/api/types/CreateTemplateBase.ts | 14 + .../CreateTemplateFromInheritanceRequest.ts | 13 + ...emplateFromInheritanceRequestGeneration.ts | 11 + .../types/CreateTemplateFromScratchRequest.ts | 10 + ...ateTemplateFromScratchRequestGeneration.ts | 8 + src/api/types/CreateTemplateRequest.ts | 5 + src/api/types/FieldDefinition.ts | 11 + src/api/types/GuidedAssemblyRequest.ts | 16 + src/api/types/GuidedAssemblySectionRef.ts | 13 + src/api/types/GuidedDocumentByAssembly.ts | 17 + src/api/types/GuidedDocumentByDynamic.ts | 17 + src/api/types/GuidedDocumentByTemplateRef.ts | 17 + src/api/types/GuidedDocumentContext.ts | 5 + src/api/types/GuidedDocumentFactMinimal.ts | 9 + src/api/types/GuidedDocumentRequest.ts | 8 + src/api/types/GuidedDocumentResponse.ts | 11 + ...GuidedDocumentTranscriptMetadataMinimal.ts | 10 + .../types/GuidedDocumentTranscriptMinimal.ts | 11 + .../GuidedDocumentTranscriptSegmentMinimal.ts | 19 + src/api/types/GuidedDynamicInline.ts | 8 + src/api/types/GuidedDynamicRequest.ts | 13 + src/api/types/GuidedGenerationResult.ts | 14 + src/api/types/GuidedGenerationResultUsage.ts | 7 + .../GuidedGenerationResultUsageTokenCount.ts | 6 + src/api/types/GuidedSectionOverride.ts | 12 + src/api/types/GuidedTemplateOverrides.ts | 10 + src/api/types/GuidedTemplateRef.ts | 12 + src/api/types/NumberNode.ts | 15 + src/api/types/ObjectNode.ts | 15 + src/api/types/OutputSchema.ts | 5 + src/api/types/Section.ts | 26 + src/api/types/SectionGeneration.ts | 11 + src/api/types/SectionGenerationPartial.ts | 15 + src/api/types/SectionInstructions.ts | 10 + src/api/types/SectionInstructionsOverride.ts | 11 + src/api/types/SectionInstructionsPartial.ts | 13 + src/api/types/SectionOverrides.ts | 14 + src/api/types/SectionVersion.ts | 11 + src/api/types/StatusResponse.ts | 5 + src/api/types/StringNode.ts | 13 + src/api/types/Template.ts | 25 + src/api/types/TemplateGeneration.ts | 9 + src/api/types/TemplateInstructions.ts | 6 + src/api/types/TemplateInstructionsPartial.ts | 9 + src/api/types/TemplateVersion.ts | 11 + .../types/TemplateVersionSectionRequest.ts | 8 + src/api/types/index.ts | 59 +- .../resources/documents/index.ts | 1 + .../resources/documents/resources/index.ts | 4 + .../resources/sections/client/index.ts | 2 + .../resources/sections/client/list.ts | 13 + .../client/requests/UpdateSectionRequest.ts | 24 + .../sections/client/requests/index.ts | 1 + .../documents/resources/sections/index.ts | 2 + .../resources/sections/resources/index.ts | 1 + .../resources/versions/client/index.ts | 1 + .../resources/versions/client/list.ts | 15 + .../sections/resources/versions/index.ts | 1 + .../resources/templates/client/index.ts | 2 + .../resources/templates/client/list.ts | 13 + .../client/requests/UpdateTemplateRequest.ts | 24 + .../templates/client/requests/index.ts | 1 + .../documents/resources/templates/index.ts | 2 + .../resources/templates/resources/index.ts | 3 + .../resources/versions/client/index.ts | 2 + .../resources/versions/client/list.ts | 15 + .../requests/CreateTemplateVersionRequest.ts | 19 + .../versions/client/requests/index.ts | 1 + .../templates/resources/versions/index.ts | 2 + .../CreateTemplateVersionRequestGeneration.ts | 22 + .../resources/versions/types/index.ts | 1 + .../types/AgentsCreateExpertReference.ts | 2 + .../types/AgentsErrorResponse.ts | 26 - .../types/AgentsExpertReference.ts | 2 + .../types/AgentsRegistryExpert.ts | 2 + .../types/AgentsValidationError.ts | 27 - .../types/AgentsValidationErrorErrorsItem.ts | 20 - .../types/AgentsValidationErrorResponse.ts | 22 - src/serialization/types/ArrayNode.ts | 26 + src/serialization/types/BoolNode.ts | 20 + src/serialization/types/ContextFacts.ts | 19 + src/serialization/types/ContextText.ts | 18 + src/serialization/types/ContextTranscript.ts | 21 + src/serialization/types/CreateSectionBase.ts | 26 + .../CreateSectionFromInheritanceRequest.ts | 24 + .../types/CreateSectionFromScratchRequest.ts | 22 + .../types/CreateSectionRequest.ts | 16 + src/serialization/types/CreateTemplateBase.ts | 26 + .../CreateTemplateFromInheritanceRequest.ts | 24 + ...emplateFromInheritanceRequestGeneration.ts | 22 + .../types/CreateTemplateFromScratchRequest.ts | 22 + ...ateTemplateFromScratchRequestGeneration.ts | 22 + .../types/CreateTemplateRequest.ts | 16 + src/serialization/types/FieldDefinition.ts | 20 + .../types/GuidedAssemblyRequest.ts | 26 + .../types/GuidedAssemblySectionRef.ts | 23 + .../types/GuidedDocumentByAssembly.ts | 26 + .../types/GuidedDocumentByDynamic.ts | 26 + .../types/GuidedDocumentByTemplateRef.ts | 26 + .../types/GuidedDocumentContext.ts | 17 + .../types/GuidedDocumentFactMinimal.ts | 18 + .../types/GuidedDocumentRequest.ts | 21 + .../types/GuidedDocumentResponse.ts | 23 + ...GuidedDocumentTranscriptMetadataMinimal.ts | 19 + .../types/GuidedDocumentTranscriptMinimal.ts | 22 + .../GuidedDocumentTranscriptSegmentMinimal.ts | 28 + .../types/GuidedDynamicInline.ts | 22 + .../types/GuidedDynamicRequest.ts | 23 + .../types/GuidedGenerationResult.ts | 25 + .../types/GuidedGenerationResultUsage.ts | 19 + .../GuidedGenerationResultUsageTokenCount.ts | 20 + .../types/GuidedSectionOverride.ts | 21 + .../types/GuidedTemplateOverrides.ts | 22 + src/serialization/types/GuidedTemplateRef.ts | 23 + src/serialization/types/NumberNode.ts | 26 + src/serialization/types/ObjectNode.ts | 24 + src/serialization/types/OutputSchema.ts | 26 + src/serialization/types/Section.ts | 35 + src/serialization/types/SectionGeneration.ts | 23 + .../types/SectionGenerationPartial.ts | 23 + .../types/SectionInstructions.ts | 22 + .../types/SectionInstructionsOverride.ts | 20 + .../types/SectionInstructionsPartial.ts | 22 + src/serialization/types/SectionOverrides.ts | 23 + src/serialization/types/SectionVersion.ts | 21 + src/serialization/types/StatusResponse.ts | 16 + src/serialization/types/StringNode.ts | 24 + src/serialization/types/Template.ts | 35 + src/serialization/types/TemplateGeneration.ts | 22 + .../types/TemplateInstructions.ts | 18 + .../types/TemplateInstructionsPartial.ts | 18 + src/serialization/types/TemplateVersion.ts | 21 + .../types/TemplateVersionSectionRequest.ts | 20 + src/serialization/types/index.ts | 59 +- tests/wire/agents.test.ts | 12 +- tests/wire/documents.test.ts | 179 +++++ tests/wire/documents/sections.test.ts | 482 ++++++++++++++ .../wire/documents/sections/versions.test.ts | 434 +++++++++++++ tests/wire/documents/templates.test.ts | 610 ++++++++++++++++++ .../wire/documents/templates/versions.test.ts | 492 ++++++++++++++ 187 files changed, 6296 insertions(+), 194 deletions(-) create mode 100644 src/api/resources/documents/resources/index.ts create mode 100644 src/api/resources/documents/resources/sections/client/Client.ts create mode 100644 src/api/resources/documents/resources/sections/client/index.ts create mode 100644 src/api/resources/documents/resources/sections/client/requests/ListSectionsRequest.ts create mode 100644 src/api/resources/documents/resources/sections/client/requests/UpdateSectionRequest.ts create mode 100644 src/api/resources/documents/resources/sections/client/requests/index.ts create mode 100644 src/api/resources/documents/resources/sections/index.ts create mode 100644 src/api/resources/documents/resources/sections/resources/index.ts create mode 100644 src/api/resources/documents/resources/sections/resources/versions/client/Client.ts create mode 100644 src/api/resources/documents/resources/sections/resources/versions/client/index.ts create mode 100644 src/api/resources/documents/resources/sections/resources/versions/index.ts create mode 100644 src/api/resources/documents/resources/templates/client/Client.ts create mode 100644 src/api/resources/documents/resources/templates/client/index.ts create mode 100644 src/api/resources/documents/resources/templates/client/requests/ListTemplatesRequest.ts create mode 100644 src/api/resources/documents/resources/templates/client/requests/UpdateTemplateRequest.ts create mode 100644 src/api/resources/documents/resources/templates/client/requests/index.ts create mode 100644 src/api/resources/documents/resources/templates/index.ts create mode 100644 src/api/resources/documents/resources/templates/resources/index.ts create mode 100644 src/api/resources/documents/resources/templates/resources/versions/client/Client.ts create mode 100644 src/api/resources/documents/resources/templates/resources/versions/client/index.ts create mode 100644 src/api/resources/documents/resources/templates/resources/versions/client/requests/CreateTemplateVersionRequest.ts create mode 100644 src/api/resources/documents/resources/templates/resources/versions/client/requests/index.ts create mode 100644 src/api/resources/documents/resources/templates/resources/versions/index.ts create mode 100644 src/api/resources/documents/resources/templates/resources/versions/types/CreateTemplateVersionRequestGeneration.ts create mode 100644 src/api/resources/documents/resources/templates/resources/versions/types/index.ts delete mode 100644 src/api/types/AgentsErrorResponse.ts delete mode 100644 src/api/types/AgentsValidationError.ts delete mode 100644 src/api/types/AgentsValidationErrorErrorsItem.ts delete mode 100644 src/api/types/AgentsValidationErrorResponse.ts create mode 100644 src/api/types/ArrayNode.ts create mode 100644 src/api/types/BoolNode.ts create mode 100644 src/api/types/ContextFacts.ts create mode 100644 src/api/types/ContextText.ts create mode 100644 src/api/types/ContextTranscript.ts create mode 100644 src/api/types/CreateSectionBase.ts create mode 100644 src/api/types/CreateSectionFromInheritanceRequest.ts create mode 100644 src/api/types/CreateSectionFromScratchRequest.ts create mode 100644 src/api/types/CreateSectionRequest.ts create mode 100644 src/api/types/CreateTemplateBase.ts create mode 100644 src/api/types/CreateTemplateFromInheritanceRequest.ts create mode 100644 src/api/types/CreateTemplateFromInheritanceRequestGeneration.ts create mode 100644 src/api/types/CreateTemplateFromScratchRequest.ts create mode 100644 src/api/types/CreateTemplateFromScratchRequestGeneration.ts create mode 100644 src/api/types/CreateTemplateRequest.ts create mode 100644 src/api/types/FieldDefinition.ts create mode 100644 src/api/types/GuidedAssemblyRequest.ts create mode 100644 src/api/types/GuidedAssemblySectionRef.ts create mode 100644 src/api/types/GuidedDocumentByAssembly.ts create mode 100644 src/api/types/GuidedDocumentByDynamic.ts create mode 100644 src/api/types/GuidedDocumentByTemplateRef.ts create mode 100644 src/api/types/GuidedDocumentContext.ts create mode 100644 src/api/types/GuidedDocumentFactMinimal.ts create mode 100644 src/api/types/GuidedDocumentRequest.ts create mode 100644 src/api/types/GuidedDocumentResponse.ts create mode 100644 src/api/types/GuidedDocumentTranscriptMetadataMinimal.ts create mode 100644 src/api/types/GuidedDocumentTranscriptMinimal.ts create mode 100644 src/api/types/GuidedDocumentTranscriptSegmentMinimal.ts create mode 100644 src/api/types/GuidedDynamicInline.ts create mode 100644 src/api/types/GuidedDynamicRequest.ts create mode 100644 src/api/types/GuidedGenerationResult.ts create mode 100644 src/api/types/GuidedGenerationResultUsage.ts create mode 100644 src/api/types/GuidedGenerationResultUsageTokenCount.ts create mode 100644 src/api/types/GuidedSectionOverride.ts create mode 100644 src/api/types/GuidedTemplateOverrides.ts create mode 100644 src/api/types/GuidedTemplateRef.ts create mode 100644 src/api/types/NumberNode.ts create mode 100644 src/api/types/ObjectNode.ts create mode 100644 src/api/types/OutputSchema.ts create mode 100644 src/api/types/Section.ts create mode 100644 src/api/types/SectionGeneration.ts create mode 100644 src/api/types/SectionGenerationPartial.ts create mode 100644 src/api/types/SectionInstructions.ts create mode 100644 src/api/types/SectionInstructionsOverride.ts create mode 100644 src/api/types/SectionInstructionsPartial.ts create mode 100644 src/api/types/SectionOverrides.ts create mode 100644 src/api/types/SectionVersion.ts create mode 100644 src/api/types/StatusResponse.ts create mode 100644 src/api/types/StringNode.ts create mode 100644 src/api/types/Template.ts create mode 100644 src/api/types/TemplateGeneration.ts create mode 100644 src/api/types/TemplateInstructions.ts create mode 100644 src/api/types/TemplateInstructionsPartial.ts create mode 100644 src/api/types/TemplateVersion.ts create mode 100644 src/api/types/TemplateVersionSectionRequest.ts create mode 100644 src/serialization/resources/documents/resources/index.ts create mode 100644 src/serialization/resources/documents/resources/sections/client/index.ts create mode 100644 src/serialization/resources/documents/resources/sections/client/list.ts create mode 100644 src/serialization/resources/documents/resources/sections/client/requests/UpdateSectionRequest.ts create mode 100644 src/serialization/resources/documents/resources/sections/client/requests/index.ts create mode 100644 src/serialization/resources/documents/resources/sections/index.ts create mode 100644 src/serialization/resources/documents/resources/sections/resources/index.ts create mode 100644 src/serialization/resources/documents/resources/sections/resources/versions/client/index.ts create mode 100644 src/serialization/resources/documents/resources/sections/resources/versions/client/list.ts create mode 100644 src/serialization/resources/documents/resources/sections/resources/versions/index.ts create mode 100644 src/serialization/resources/documents/resources/templates/client/index.ts create mode 100644 src/serialization/resources/documents/resources/templates/client/list.ts create mode 100644 src/serialization/resources/documents/resources/templates/client/requests/UpdateTemplateRequest.ts create mode 100644 src/serialization/resources/documents/resources/templates/client/requests/index.ts create mode 100644 src/serialization/resources/documents/resources/templates/index.ts create mode 100644 src/serialization/resources/documents/resources/templates/resources/index.ts create mode 100644 src/serialization/resources/documents/resources/templates/resources/versions/client/index.ts create mode 100644 src/serialization/resources/documents/resources/templates/resources/versions/client/list.ts create mode 100644 src/serialization/resources/documents/resources/templates/resources/versions/client/requests/CreateTemplateVersionRequest.ts create mode 100644 src/serialization/resources/documents/resources/templates/resources/versions/client/requests/index.ts create mode 100644 src/serialization/resources/documents/resources/templates/resources/versions/index.ts create mode 100644 src/serialization/resources/documents/resources/templates/resources/versions/types/CreateTemplateVersionRequestGeneration.ts create mode 100644 src/serialization/resources/documents/resources/templates/resources/versions/types/index.ts delete mode 100644 src/serialization/types/AgentsErrorResponse.ts delete mode 100644 src/serialization/types/AgentsValidationError.ts delete mode 100644 src/serialization/types/AgentsValidationErrorErrorsItem.ts delete mode 100644 src/serialization/types/AgentsValidationErrorResponse.ts create mode 100644 src/serialization/types/ArrayNode.ts create mode 100644 src/serialization/types/BoolNode.ts create mode 100644 src/serialization/types/ContextFacts.ts create mode 100644 src/serialization/types/ContextText.ts create mode 100644 src/serialization/types/ContextTranscript.ts create mode 100644 src/serialization/types/CreateSectionBase.ts create mode 100644 src/serialization/types/CreateSectionFromInheritanceRequest.ts create mode 100644 src/serialization/types/CreateSectionFromScratchRequest.ts create mode 100644 src/serialization/types/CreateSectionRequest.ts create mode 100644 src/serialization/types/CreateTemplateBase.ts create mode 100644 src/serialization/types/CreateTemplateFromInheritanceRequest.ts create mode 100644 src/serialization/types/CreateTemplateFromInheritanceRequestGeneration.ts create mode 100644 src/serialization/types/CreateTemplateFromScratchRequest.ts create mode 100644 src/serialization/types/CreateTemplateFromScratchRequestGeneration.ts create mode 100644 src/serialization/types/CreateTemplateRequest.ts create mode 100644 src/serialization/types/FieldDefinition.ts create mode 100644 src/serialization/types/GuidedAssemblyRequest.ts create mode 100644 src/serialization/types/GuidedAssemblySectionRef.ts create mode 100644 src/serialization/types/GuidedDocumentByAssembly.ts create mode 100644 src/serialization/types/GuidedDocumentByDynamic.ts create mode 100644 src/serialization/types/GuidedDocumentByTemplateRef.ts create mode 100644 src/serialization/types/GuidedDocumentContext.ts create mode 100644 src/serialization/types/GuidedDocumentFactMinimal.ts create mode 100644 src/serialization/types/GuidedDocumentRequest.ts create mode 100644 src/serialization/types/GuidedDocumentResponse.ts create mode 100644 src/serialization/types/GuidedDocumentTranscriptMetadataMinimal.ts create mode 100644 src/serialization/types/GuidedDocumentTranscriptMinimal.ts create mode 100644 src/serialization/types/GuidedDocumentTranscriptSegmentMinimal.ts create mode 100644 src/serialization/types/GuidedDynamicInline.ts create mode 100644 src/serialization/types/GuidedDynamicRequest.ts create mode 100644 src/serialization/types/GuidedGenerationResult.ts create mode 100644 src/serialization/types/GuidedGenerationResultUsage.ts create mode 100644 src/serialization/types/GuidedGenerationResultUsageTokenCount.ts create mode 100644 src/serialization/types/GuidedSectionOverride.ts create mode 100644 src/serialization/types/GuidedTemplateOverrides.ts create mode 100644 src/serialization/types/GuidedTemplateRef.ts create mode 100644 src/serialization/types/NumberNode.ts create mode 100644 src/serialization/types/ObjectNode.ts create mode 100644 src/serialization/types/OutputSchema.ts create mode 100644 src/serialization/types/Section.ts create mode 100644 src/serialization/types/SectionGeneration.ts create mode 100644 src/serialization/types/SectionGenerationPartial.ts create mode 100644 src/serialization/types/SectionInstructions.ts create mode 100644 src/serialization/types/SectionInstructionsOverride.ts create mode 100644 src/serialization/types/SectionInstructionsPartial.ts create mode 100644 src/serialization/types/SectionOverrides.ts create mode 100644 src/serialization/types/SectionVersion.ts create mode 100644 src/serialization/types/StatusResponse.ts create mode 100644 src/serialization/types/StringNode.ts create mode 100644 src/serialization/types/Template.ts create mode 100644 src/serialization/types/TemplateGeneration.ts create mode 100644 src/serialization/types/TemplateInstructions.ts create mode 100644 src/serialization/types/TemplateInstructionsPartial.ts create mode 100644 src/serialization/types/TemplateVersion.ts create mode 100644 src/serialization/types/TemplateVersionSectionRequest.ts create mode 100644 tests/wire/documents/sections.test.ts create mode 100644 tests/wire/documents/sections/versions.test.ts create mode 100644 tests/wire/documents/templates.test.ts create mode 100644 tests/wire/documents/templates/versions.test.ts diff --git a/.fern/metadata.json b/.fern/metadata.json index 72e5ce8b..843bc771 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,5 +1,5 @@ { - "cliVersion": "4.86.1", + "cliVersion": "5.16.0", "generatorName": "fernapi/fern-typescript-node-sdk", "generatorVersion": "3.54.0", "generatorConfig": { @@ -15,7 +15,9 @@ }, "packageJson": { "scripts": { - "test:integration": "vitest --config vitest.integration.config.mts" + "test:integration": "pnpm test:integration:main && pnpm test:integration:empty-state", + "test:integration:main": "vitest run --config vitest.integration.config.mts --project integration", + "test:integration:empty-state": "vitest run --config vitest.integration.config.mts --project integration-empty-state" }, "exports": { "./utils": { @@ -32,6 +34,6 @@ } } }, - "originGitCommit": "23bce53307f0836f2dcd50e82ef0aba136e7ec2f", + "originGitCommit": "33e722748626b7bb941efe15e18e21a5af94081e", "sdkVersion": "0.0.0-dev" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index afca55cf..5ee8b97c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,7 +10,7 @@ importers: dependencies: ws: specifier: ^8.16.0 - version: 8.20.0 + version: 8.20.1 devDependencies: '@biomejs/biome': specifier: 2.4.3 @@ -1146,8 +1146,8 @@ packages: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} - ws@8.20.0: - resolution: {integrity: sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA==} + ws@8.20.1: + resolution: {integrity: sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w==} engines: {node: '>=10.0.0'} peerDependencies: bufferutil: ^4.0.1 @@ -2163,7 +2163,7 @@ snapshots: string-width: 4.2.3 strip-ansi: 6.0.1 - ws@8.20.0: {} + ws@8.20.1: {} y18n@5.0.8: {} diff --git a/src/api/errors/UnprocessableEntityError.ts b/src/api/errors/UnprocessableEntityError.ts index bc71fc87..53d1ef21 100644 --- a/src/api/errors/UnprocessableEntityError.ts +++ b/src/api/errors/UnprocessableEntityError.ts @@ -2,10 +2,9 @@ import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import type * as Corti from "../index.js"; export class UnprocessableEntityError extends errors.CortiError { - constructor(body: Corti.AgentsValidationErrorResponse, rawResponse?: core.RawResponse) { + constructor(body?: unknown, rawResponse?: core.RawResponse) { super({ message: "UnprocessableEntityError", statusCode: 422, diff --git a/src/api/resources/agents/client/Client.ts b/src/api/resources/agents/client/Client.ts index 0ac4113a..0136af74 100644 --- a/src/api/resources/agents/client/Client.ts +++ b/src/api/resources/agents/client/Client.ts @@ -183,16 +183,7 @@ export class AgentsClient { case 401: throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse); case 422: - throw new Corti.UnprocessableEntityError( - serializers.AgentsValidationErrorResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - _response.rawResponse, - ); + throw new Corti.UnprocessableEntityError(_response.error.body, _response.rawResponse); default: throw new errors.CortiError({ statusCode: _response.error.statusCode, @@ -429,16 +420,7 @@ export class AgentsClient { case 404: throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); case 422: - throw new Corti.UnprocessableEntityError( - serializers.AgentsValidationErrorResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - _response.rawResponse, - ); + throw new Corti.UnprocessableEntityError(_response.error.body, _response.rawResponse); default: throw new errors.CortiError({ statusCode: _response.error.statusCode, @@ -621,16 +603,7 @@ export class AgentsClient { case 404: throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); case 422: - throw new Corti.UnprocessableEntityError( - serializers.AgentsValidationErrorResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - _response.rawResponse, - ); + throw new Corti.UnprocessableEntityError(_response.error.body, _response.rawResponse); default: throw new errors.CortiError({ statusCode: _response.error.statusCode, @@ -909,16 +882,7 @@ export class AgentsClient { case 401: throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse); case 422: - throw new Corti.UnprocessableEntityError( - serializers.AgentsValidationErrorResponse.parseOrThrow(_response.error.body, { - unrecognizedObjectKeys: "passthrough", - allowUnrecognizedUnionMembers: true, - allowUnrecognizedEnumValues: true, - skipValidation: true, - breadcrumbsPrefix: ["response"], - }), - _response.rawResponse, - ); + throw new Corti.UnprocessableEntityError(_response.error.body, _response.rawResponse); default: throw new errors.CortiError({ statusCode: _response.error.statusCode, diff --git a/src/api/resources/documents/client/Client.ts b/src/api/resources/documents/client/Client.ts index f31aa00e..7f458ecd 100644 --- a/src/api/resources/documents/client/Client.ts +++ b/src/api/resources/documents/client/Client.ts @@ -8,6 +8,8 @@ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCode import * as errors from "../../../../errors/index.js"; import * as serializers from "../../../../serialization/index.js"; import * as Corti from "../../../index.js"; +import { SectionsClient } from "../resources/sections/client/Client.js"; +import { TemplatesClient } from "../resources/templates/client/Client.js"; export declare namespace DocumentsClient { export type Options = BaseClientOptions; @@ -17,11 +19,21 @@ export declare namespace DocumentsClient { export class DocumentsClient { protected readonly _options: NormalizedClientOptionsWithAuth; + protected _templates: TemplatesClient | undefined; + protected _sections: SectionsClient | undefined; constructor(options: DocumentsClient.Options) { this._options = normalizeClientOptionsWithAuth(options); } + public get templates(): TemplatesClient { + return (this._templates ??= new TemplatesClient(this._options)); + } + + public get sections(): SectionsClient { + return (this._sections ??= new SectionsClient(this._options)); + } + /** * List Documents * @@ -564,4 +576,108 @@ export class DocumentsClient { "/interactions/{id}/documents/{documentId}", ); } + + /** + * Generates a structured document using one of four template-supply paths: a stored template reference (optionally with runtime overrides), an ad-hoc assembly of stored sections, or a fully inline dynamic template. Exactly one of `templateRef`, `assemblyTemplate`, or `dynamicTemplate` must be provided. + * + * With the exception of the plain `templateRef` path (no overrides), every call persists a new auto-generated template aggregate that snapshots the resolved content. The snapshot is drift-proof: subsequent edits to base templates or sections do not affect previously generated documents. + * + * @param {Corti.GuidedDocumentRequest} request + * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.BadRequestError} + * @throws {@link Corti.NotFoundError} + * @throws {@link Corti.UnprocessableEntityError} + * @throws {@link Corti.BadGatewayError} + * + * @example + * await client.documents.generate({ + * templateRef: { + * templateId: "templateId" + * }, + * outputLanguage: "outputLanguage" + * }) + */ + public generate( + request: Corti.GuidedDocumentRequest, + requestOptions?: DocumentsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__generate(request, requestOptions)); + } + + private async __generate( + request: Corti.GuidedDocumentRequest, + requestOptions?: DocumentsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + "documents/", + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: serializers.GuidedDocumentRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.GuidedDocumentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Corti.BadRequestError(_response.error.body, _response.rawResponse); + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + case 422: + throw new Corti.UnprocessableEntityError(_response.error.body, _response.rawResponse); + case 502: + throw new Corti.BadGatewayError( + serializers.ErrorResponse.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/documents/"); + } } diff --git a/src/api/resources/documents/index.ts b/src/api/resources/documents/index.ts index 914b8c3c..9eb1192d 100644 --- a/src/api/resources/documents/index.ts +++ b/src/api/resources/documents/index.ts @@ -1 +1,2 @@ export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/documents/resources/index.ts b/src/api/resources/documents/resources/index.ts new file mode 100644 index 00000000..102cb9b5 --- /dev/null +++ b/src/api/resources/documents/resources/index.ts @@ -0,0 +1,4 @@ +export * from "./sections/client/requests/index.js"; +export * as sections from "./sections/index.js"; +export * from "./templates/client/requests/index.js"; +export * as templates from "./templates/index.js"; diff --git a/src/api/resources/documents/resources/sections/client/Client.ts b/src/api/resources/documents/resources/sections/client/Client.ts new file mode 100644 index 00000000..97f9a216 --- /dev/null +++ b/src/api/resources/documents/resources/sections/client/Client.ts @@ -0,0 +1,419 @@ +// This file was auto-generated by Fern from our API Definition. + +import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as core from "../../../../../../core/index.js"; +import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; +import * as errors from "../../../../../../errors/index.js"; +import * as serializers from "../../../../../../serialization/index.js"; +import * as Corti from "../../../../../index.js"; +import { VersionsClient } from "../resources/versions/client/Client.js"; + +export declare namespace SectionsClient { + export type Options = BaseClientOptions; + + export interface RequestOptions extends BaseRequestOptions {} +} + +export class SectionsClient { + protected readonly _options: NormalizedClientOptionsWithAuth; + protected _versions: VersionsClient | undefined; + + constructor(options: SectionsClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); + } + + public get versions(): VersionsClient { + return (this._versions ??= new VersionsClient(this._options)); + } + + /** + * @param {Corti.documents.ListSectionsRequest} request + * @param {SectionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.documents.sections.list() + */ + public list( + request: Corti.documents.ListSectionsRequest = {}, + requestOptions?: SectionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions)); + } + + private async __list( + request: Corti.documents.ListSectionsRequest = {}, + requestOptions?: SectionsClient.RequestOptions, + ): Promise> { + const { lang, label, published } = request; + const _queryParams: Record = { + lang, + label, + published, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + "documents/sections/", + ), + method: "GET", + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.documents.sections.list.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/documents/sections/"); + } + + /** + * @param {Corti.CreateSectionRequest} request + * @param {SectionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.BadRequestError} + * + * @example + * await client.documents.sections.create({ + * name: "name", + * language: "language", + * generation: { + * heading: "heading", + * instructions: { + * contentPrompt: "contentPrompt" + * }, + * outputSchema: { + * type: "string" + * } + * } + * }) + */ + public create( + request: Corti.CreateSectionRequest, + requestOptions?: SectionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Corti.CreateSectionRequest, + requestOptions?: SectionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + "documents/sections/", + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: serializers.CreateSectionRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.Section.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Corti.BadRequestError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/documents/sections/"); + } + + /** + * @param {string} sectionID + * @param {SectionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.sections.get("sectionID") + */ + public get( + sectionID: string, + requestOptions?: SectionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(sectionID, requestOptions)); + } + + private async __get( + sectionID: string, + requestOptions?: SectionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/sections/${core.url.encodePathParam(sectionID)}`, + ), + method: "GET", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.Section.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/documents/sections/{sectionID}", + ); + } + + /** + * Delete section + * + * @param {string} sectionID + * @param {SectionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.sections.delete("sectionID") + */ + public delete(sectionID: string, requestOptions?: SectionsClient.RequestOptions): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(sectionID, requestOptions)); + } + + private async __delete( + sectionID: string, + requestOptions?: SectionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/sections/${core.url.encodePathParam(sectionID)}`, + ), + method: "DELETE", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/documents/sections/{sectionID}", + ); + } + + /** + * @param {string} sectionID + * @param {Corti.documents.UpdateSectionRequest} request + * @param {SectionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.BadRequestError} + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.sections.update("sectionID") + */ + public update( + sectionID: string, + request: Corti.documents.UpdateSectionRequest = {}, + requestOptions?: SectionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(sectionID, request, requestOptions)); + } + + private async __update( + sectionID: string, + request: Corti.documents.UpdateSectionRequest = {}, + requestOptions?: SectionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/sections/${core.url.encodePathParam(sectionID)}`, + ), + method: "PATCH", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: serializers.documents.UpdateSectionRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.Section.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Corti.BadRequestError(_response.error.body, _response.rawResponse); + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "PATCH", + "/documents/sections/{sectionID}", + ); + } +} diff --git a/src/api/resources/documents/resources/sections/client/index.ts b/src/api/resources/documents/resources/sections/client/index.ts new file mode 100644 index 00000000..195f9aa8 --- /dev/null +++ b/src/api/resources/documents/resources/sections/client/index.ts @@ -0,0 +1 @@ +export * from "./requests/index.js"; diff --git a/src/api/resources/documents/resources/sections/client/requests/ListSectionsRequest.ts b/src/api/resources/documents/resources/sections/client/requests/ListSectionsRequest.ts new file mode 100644 index 00000000..e33bdd82 --- /dev/null +++ b/src/api/resources/documents/resources/sections/client/requests/ListSectionsRequest.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * {} + */ +export interface ListSectionsRequest { + /** Filter sections by language (BCP 47 tag). Repeatable. */ + lang?: string | string[]; + /** Filter sections by label. Repeatable; matches sections that have any of the given labels. */ + label?: string | string[]; + /** Filter by publish status. Omit to return both published and unpublished items; set to `true` for published only, `false` for unpublished only. */ + published?: boolean; +} diff --git a/src/api/resources/documents/resources/sections/client/requests/UpdateSectionRequest.ts b/src/api/resources/documents/resources/sections/client/requests/UpdateSectionRequest.ts new file mode 100644 index 00000000..9e5d0e59 --- /dev/null +++ b/src/api/resources/documents/resources/sections/client/requests/UpdateSectionRequest.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * {} + */ +export interface UpdateSectionRequest { + name?: string; + language?: string; + description?: string; + labels?: string[]; +} diff --git a/src/api/resources/documents/resources/sections/client/requests/index.ts b/src/api/resources/documents/resources/sections/client/requests/index.ts new file mode 100644 index 00000000..a1487582 --- /dev/null +++ b/src/api/resources/documents/resources/sections/client/requests/index.ts @@ -0,0 +1,2 @@ +export type { ListSectionsRequest } from "./ListSectionsRequest.js"; +export type { UpdateSectionRequest } from "./UpdateSectionRequest.js"; diff --git a/src/api/resources/documents/resources/sections/index.ts b/src/api/resources/documents/resources/sections/index.ts new file mode 100644 index 00000000..9eb1192d --- /dev/null +++ b/src/api/resources/documents/resources/sections/index.ts @@ -0,0 +1,2 @@ +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/documents/resources/sections/resources/index.ts b/src/api/resources/documents/resources/sections/resources/index.ts new file mode 100644 index 00000000..2e28ce2f --- /dev/null +++ b/src/api/resources/documents/resources/sections/resources/index.ts @@ -0,0 +1 @@ +export * as versions from "./versions/index.js"; diff --git a/src/api/resources/documents/resources/sections/resources/versions/client/Client.ts b/src/api/resources/documents/resources/sections/resources/versions/client/Client.ts new file mode 100644 index 00000000..06a59d52 --- /dev/null +++ b/src/api/resources/documents/resources/sections/resources/versions/client/Client.ts @@ -0,0 +1,431 @@ +// This file was auto-generated by Fern from our API Definition. + +import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../../../BaseClient.js"; +import { + type NormalizedClientOptionsWithAuth, + normalizeClientOptionsWithAuth, +} from "../../../../../../../../BaseClient.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../../../core/headers.js"; +import * as core from "../../../../../../../../core/index.js"; +import { handleNonStatusCodeError } from "../../../../../../../../errors/handleNonStatusCodeError.js"; +import * as errors from "../../../../../../../../errors/index.js"; +import * as serializers from "../../../../../../../../serialization/index.js"; +import * as Corti from "../../../../../../../index.js"; + +export declare namespace VersionsClient { + export type Options = BaseClientOptions; + + export interface RequestOptions extends BaseRequestOptions {} +} + +export class VersionsClient { + protected readonly _options: NormalizedClientOptionsWithAuth; + + constructor(options: VersionsClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); + } + + /** + * @param {string} sectionID + * @param {VersionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.sections.versions.list("sectionID") + */ + public list( + sectionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(sectionID, requestOptions)); + } + + private async __list( + sectionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/sections/${core.url.encodePathParam(sectionID)}/versions/`, + ), + method: "GET", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.documents.sections.versions.list.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/documents/sections/{sectionID}/versions/", + ); + } + + /** + * @param {string} sectionID + * @param {Corti.SectionGeneration} request + * @param {VersionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.BadRequestError} + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.sections.versions.create("sectionID", { + * heading: "heading", + * instructions: { + * contentPrompt: "contentPrompt" + * }, + * outputSchema: { + * type: "string" + * } + * }) + */ + public create( + sectionID: string, + request: Corti.SectionGeneration, + requestOptions?: VersionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(sectionID, request, requestOptions)); + } + + private async __create( + sectionID: string, + request: Corti.SectionGeneration, + requestOptions?: VersionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/sections/${core.url.encodePathParam(sectionID)}/versions/`, + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: serializers.SectionGeneration.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.SectionVersion.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Corti.BadRequestError(_response.error.body, _response.rawResponse); + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/documents/sections/{sectionID}/versions/", + ); + } + + /** + * @param {string} sectionID + * @param {string} versionID + * @param {VersionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.sections.versions.get("sectionID", "versionID") + */ + public get( + sectionID: string, + versionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(sectionID, versionID, requestOptions)); + } + + private async __get( + sectionID: string, + versionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/sections/${core.url.encodePathParam(sectionID)}/versions/${core.url.encodePathParam(versionID)}`, + ), + method: "GET", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.SectionVersion.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/documents/sections/{sectionID}/versions/{versionID}", + ); + } + + /** + * Currently published version cannot be deleted. Last remaining version can be deleted, simply create a new section version again if needed. + * + * @param {string} sectionID + * @param {string} versionID + * @param {VersionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.sections.versions.delete("sectionID", "versionID") + */ + public delete( + sectionID: string, + versionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(sectionID, versionID, requestOptions)); + } + + private async __delete( + sectionID: string, + versionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/sections/${core.url.encodePathParam(sectionID)}/versions/${core.url.encodePathParam(versionID)}`, + ), + method: "DELETE", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/documents/sections/{sectionID}/versions/{versionID}", + ); + } + + /** + * Sets this version as the published version of the section. + * + * @param {string} sectionID + * @param {string} versionID + * @param {VersionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.sections.versions.publish("sectionID", "versionID") + */ + public publish( + sectionID: string, + versionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__publish(sectionID, versionID, requestOptions)); + } + + private async __publish( + sectionID: string, + versionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/sections/${core.url.encodePathParam(sectionID)}/versions/${core.url.encodePathParam(versionID)}/publish`, + ), + method: "POST", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.StatusResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/documents/sections/{sectionID}/versions/{versionID}/publish", + ); + } +} diff --git a/src/api/resources/documents/resources/sections/resources/versions/client/index.ts b/src/api/resources/documents/resources/sections/resources/versions/client/index.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/src/api/resources/documents/resources/sections/resources/versions/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/documents/resources/sections/resources/versions/index.ts b/src/api/resources/documents/resources/sections/resources/versions/index.ts new file mode 100644 index 00000000..914b8c3c --- /dev/null +++ b/src/api/resources/documents/resources/sections/resources/versions/index.ts @@ -0,0 +1 @@ +export * from "./client/index.js"; diff --git a/src/api/resources/documents/resources/templates/client/Client.ts b/src/api/resources/documents/resources/templates/client/Client.ts new file mode 100644 index 00000000..5d01f58b --- /dev/null +++ b/src/api/resources/documents/resources/templates/client/Client.ts @@ -0,0 +1,415 @@ +// This file was auto-generated by Fern from our API Definition. + +import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; +import * as core from "../../../../../../core/index.js"; +import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; +import * as errors from "../../../../../../errors/index.js"; +import * as serializers from "../../../../../../serialization/index.js"; +import * as Corti from "../../../../../index.js"; +import { VersionsClient } from "../resources/versions/client/Client.js"; + +export declare namespace TemplatesClient { + export type Options = BaseClientOptions; + + export interface RequestOptions extends BaseRequestOptions {} +} + +export class TemplatesClient { + protected readonly _options: NormalizedClientOptionsWithAuth; + protected _versions: VersionsClient | undefined; + + constructor(options: TemplatesClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); + } + + public get versions(): VersionsClient { + return (this._versions ??= new VersionsClient(this._options)); + } + + /** + * @param {Corti.documents.ListTemplatesRequest} request + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.documents.templates.list() + */ + public list( + request: Corti.documents.ListTemplatesRequest = {}, + requestOptions?: TemplatesClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions)); + } + + private async __list( + request: Corti.documents.ListTemplatesRequest = {}, + requestOptions?: TemplatesClient.RequestOptions, + ): Promise> { + const { lang, label, published } = request; + const _queryParams: Record = { + lang, + label, + published, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + "documents/templates/", + ), + method: "GET", + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.documents.templates.list.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/documents/templates/"); + } + + /** + * @param {Corti.CreateTemplateRequest} request + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.BadRequestError} + * + * @example + * await client.documents.templates.create({ + * name: "name", + * language: "language", + * generation: { + * instructions: { + * prompt: "prompt" + * } + * } + * }) + */ + public create( + request: Corti.CreateTemplateRequest, + requestOptions?: TemplatesClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Corti.CreateTemplateRequest, + requestOptions?: TemplatesClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + "documents/templates/", + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: serializers.CreateTemplateRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.Template.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Corti.BadRequestError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/documents/templates/"); + } + + /** + * @param {string} templateID + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.templates.get("templateID") + */ + public get( + templateID: string, + requestOptions?: TemplatesClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(templateID, requestOptions)); + } + + private async __get( + templateID: string, + requestOptions?: TemplatesClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/templates/${core.url.encodePathParam(templateID)}`, + ), + method: "GET", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.Template.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/documents/templates/{templateID}", + ); + } + + /** + * Deletes a template and its versions. + * + * @param {string} templateID + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.templates.delete("templateID") + */ + public delete(templateID: string, requestOptions?: TemplatesClient.RequestOptions): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(templateID, requestOptions)); + } + + private async __delete( + templateID: string, + requestOptions?: TemplatesClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/templates/${core.url.encodePathParam(templateID)}`, + ), + method: "DELETE", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/documents/templates/{templateID}", + ); + } + + /** + * @param {string} templateID + * @param {Corti.documents.UpdateTemplateRequest} request + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.BadRequestError} + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.templates.update("templateID") + */ + public update( + templateID: string, + request: Corti.documents.UpdateTemplateRequest = {}, + requestOptions?: TemplatesClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(templateID, request, requestOptions)); + } + + private async __update( + templateID: string, + request: Corti.documents.UpdateTemplateRequest = {}, + requestOptions?: TemplatesClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/templates/${core.url.encodePathParam(templateID)}`, + ), + method: "PATCH", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: serializers.documents.UpdateTemplateRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.Template.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Corti.BadRequestError(_response.error.body, _response.rawResponse); + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "PATCH", + "/documents/templates/{templateID}", + ); + } +} diff --git a/src/api/resources/documents/resources/templates/client/index.ts b/src/api/resources/documents/resources/templates/client/index.ts new file mode 100644 index 00000000..195f9aa8 --- /dev/null +++ b/src/api/resources/documents/resources/templates/client/index.ts @@ -0,0 +1 @@ +export * from "./requests/index.js"; diff --git a/src/api/resources/documents/resources/templates/client/requests/ListTemplatesRequest.ts b/src/api/resources/documents/resources/templates/client/requests/ListTemplatesRequest.ts new file mode 100644 index 00000000..8ea15909 --- /dev/null +++ b/src/api/resources/documents/resources/templates/client/requests/ListTemplatesRequest.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * {} + */ +export interface ListTemplatesRequest { + /** Filter templates by language (BCP 47 tag). Repeatable. */ + lang?: string | string[]; + /** Filter templates by label. Repeatable; matches templates that have any of the given labels. */ + label?: string | string[]; + /** Filter by publish status. Omit to return both published and unpublished items; set to `true` for published only, `false` for unpublished only. */ + published?: boolean; +} diff --git a/src/api/resources/documents/resources/templates/client/requests/UpdateTemplateRequest.ts b/src/api/resources/documents/resources/templates/client/requests/UpdateTemplateRequest.ts new file mode 100644 index 00000000..0ab19a77 --- /dev/null +++ b/src/api/resources/documents/resources/templates/client/requests/UpdateTemplateRequest.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * {} + */ +export interface UpdateTemplateRequest { + name?: string; + description?: string; + language?: string; + labels?: string[]; +} diff --git a/src/api/resources/documents/resources/templates/client/requests/index.ts b/src/api/resources/documents/resources/templates/client/requests/index.ts new file mode 100644 index 00000000..ea632440 --- /dev/null +++ b/src/api/resources/documents/resources/templates/client/requests/index.ts @@ -0,0 +1,2 @@ +export type { ListTemplatesRequest } from "./ListTemplatesRequest.js"; +export type { UpdateTemplateRequest } from "./UpdateTemplateRequest.js"; diff --git a/src/api/resources/documents/resources/templates/index.ts b/src/api/resources/documents/resources/templates/index.ts new file mode 100644 index 00000000..9eb1192d --- /dev/null +++ b/src/api/resources/documents/resources/templates/index.ts @@ -0,0 +1,2 @@ +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/documents/resources/templates/resources/index.ts b/src/api/resources/documents/resources/templates/resources/index.ts new file mode 100644 index 00000000..e8c0651d --- /dev/null +++ b/src/api/resources/documents/resources/templates/resources/index.ts @@ -0,0 +1,3 @@ +export * from "./versions/client/requests/index.js"; +export * as versions from "./versions/index.js"; +export * from "./versions/types/index.js"; diff --git a/src/api/resources/documents/resources/templates/resources/versions/client/Client.ts b/src/api/resources/documents/resources/templates/resources/versions/client/Client.ts new file mode 100644 index 00000000..68b6da9c --- /dev/null +++ b/src/api/resources/documents/resources/templates/resources/versions/client/Client.ts @@ -0,0 +1,429 @@ +// This file was auto-generated by Fern from our API Definition. + +import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../../../BaseClient.js"; +import { + type NormalizedClientOptionsWithAuth, + normalizeClientOptionsWithAuth, +} from "../../../../../../../../BaseClient.js"; +import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../../../core/headers.js"; +import * as core from "../../../../../../../../core/index.js"; +import { handleNonStatusCodeError } from "../../../../../../../../errors/handleNonStatusCodeError.js"; +import * as errors from "../../../../../../../../errors/index.js"; +import * as serializers from "../../../../../../../../serialization/index.js"; +import * as Corti from "../../../../../../../index.js"; + +export declare namespace VersionsClient { + export type Options = BaseClientOptions; + + export interface RequestOptions extends BaseRequestOptions {} +} + +export class VersionsClient { + protected readonly _options: NormalizedClientOptionsWithAuth; + + constructor(options: VersionsClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); + } + + /** + * @param {string} templateID + * @param {VersionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.templates.versions.list("templateID") + */ + public list( + templateID: string, + requestOptions?: VersionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(templateID, requestOptions)); + } + + private async __list( + templateID: string, + requestOptions?: VersionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/templates/${core.url.encodePathParam(templateID)}/versions/`, + ), + method: "GET", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.documents.templates.versions.list.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/documents/templates/{templateID}/versions/", + ); + } + + /** + * @param {string} templateID + * @param {Corti.documents.templates.CreateTemplateVersionRequest} request + * @param {VersionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.BadRequestError} + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.templates.versions.create("templateID", { + * generation: { + * instructions: { + * prompt: "prompt" + * } + * } + * }) + */ + public create( + templateID: string, + request: Corti.documents.templates.CreateTemplateVersionRequest, + requestOptions?: VersionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(templateID, request, requestOptions)); + } + + private async __create( + templateID: string, + request: Corti.documents.templates.CreateTemplateVersionRequest, + requestOptions?: VersionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/templates/${core.url.encodePathParam(templateID)}/versions/`, + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: serializers.documents.templates.CreateTemplateVersionRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.TemplateVersion.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Corti.BadRequestError(_response.error.body, _response.rawResponse); + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/documents/templates/{templateID}/versions/", + ); + } + + /** + * @param {string} templateID + * @param {string} versionID + * @param {VersionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.templates.versions.get("templateID", "versionID") + */ + public get( + templateID: string, + versionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__get(templateID, versionID, requestOptions)); + } + + private async __get( + templateID: string, + versionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/templates/${core.url.encodePathParam(templateID)}/versions/${core.url.encodePathParam(versionID)}`, + ), + method: "GET", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.TemplateVersion.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/documents/templates/{templateID}/versions/{versionID}", + ); + } + + /** + * A published version cannot be deleted. When deleting a last remaining version of a template, simply create a new version again if needed. + * + * @param {string} templateID + * @param {string} versionID + * @param {VersionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.templates.versions.delete("templateID", "versionID") + */ + public delete( + templateID: string, + versionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(templateID, versionID, requestOptions)); + } + + private async __delete( + templateID: string, + versionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/templates/${core.url.encodePathParam(templateID)}/versions/${core.url.encodePathParam(versionID)}`, + ), + method: "DELETE", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/documents/templates/{templateID}/versions/{versionID}", + ); + } + + /** + * Sets this version as the published version of the template. + * + * @param {string} templateID + * @param {string} versionID + * @param {VersionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.templates.versions.publish("templateID", "versionID") + */ + public publish( + templateID: string, + versionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__publish(templateID, versionID, requestOptions)); + } + + private async __publish( + templateID: string, + versionID: string, + requestOptions?: VersionsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ "Tenant-Name": requestOptions?.tenantName ?? this._options?.tenantName }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)).base, + `documents/templates/${core.url.encodePathParam(templateID)}/versions/${core.url.encodePathParam(versionID)}/publish`, + ), + method: "POST", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.StatusResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Corti.NotFoundError(_response.error.body, _response.rawResponse); + default: + throw new errors.CortiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/documents/templates/{templateID}/versions/{versionID}/publish", + ); + } +} diff --git a/src/api/resources/documents/resources/templates/resources/versions/client/index.ts b/src/api/resources/documents/resources/templates/resources/versions/client/index.ts new file mode 100644 index 00000000..195f9aa8 --- /dev/null +++ b/src/api/resources/documents/resources/templates/resources/versions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests/index.js"; diff --git a/src/api/resources/documents/resources/templates/resources/versions/client/requests/CreateTemplateVersionRequest.ts b/src/api/resources/documents/resources/templates/resources/versions/client/requests/CreateTemplateVersionRequest.ts new file mode 100644 index 00000000..b4b9359c --- /dev/null +++ b/src/api/resources/documents/resources/templates/resources/versions/client/requests/CreateTemplateVersionRequest.ts @@ -0,0 +1,17 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../../../../../index.js"; + +/** + * @example + * { + * generation: { + * instructions: { + * prompt: "prompt" + * } + * } + * } + */ +export interface CreateTemplateVersionRequest { + generation: Corti.documents.templates.CreateTemplateVersionRequestGeneration; +} diff --git a/src/api/resources/documents/resources/templates/resources/versions/client/requests/index.ts b/src/api/resources/documents/resources/templates/resources/versions/client/requests/index.ts new file mode 100644 index 00000000..3d35d2f7 --- /dev/null +++ b/src/api/resources/documents/resources/templates/resources/versions/client/requests/index.ts @@ -0,0 +1 @@ +export type { CreateTemplateVersionRequest } from "./CreateTemplateVersionRequest.js"; diff --git a/src/api/resources/documents/resources/templates/resources/versions/index.ts b/src/api/resources/documents/resources/templates/resources/versions/index.ts new file mode 100644 index 00000000..d9adb1af --- /dev/null +++ b/src/api/resources/documents/resources/templates/resources/versions/index.ts @@ -0,0 +1,2 @@ +export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/documents/resources/templates/resources/versions/types/CreateTemplateVersionRequestGeneration.ts b/src/api/resources/documents/resources/templates/resources/versions/types/CreateTemplateVersionRequestGeneration.ts new file mode 100644 index 00000000..49104bc0 --- /dev/null +++ b/src/api/resources/documents/resources/templates/resources/versions/types/CreateTemplateVersionRequestGeneration.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../../../../index.js"; + +export interface CreateTemplateVersionRequestGeneration { + instructions: Corti.TemplateInstructions; + sections?: Corti.TemplateVersionSectionRequest[]; +} diff --git a/src/api/resources/documents/resources/templates/resources/versions/types/index.ts b/src/api/resources/documents/resources/templates/resources/versions/types/index.ts new file mode 100644 index 00000000..78af3000 --- /dev/null +++ b/src/api/resources/documents/resources/templates/resources/versions/types/index.ts @@ -0,0 +1 @@ +export * from "./CreateTemplateVersionRequestGeneration.js"; diff --git a/src/api/types/AgentsCreateExpertReference.ts b/src/api/types/AgentsCreateExpertReference.ts index 733a6184..faa939f2 100644 --- a/src/api/types/AgentsCreateExpertReference.ts +++ b/src/api/types/AgentsCreateExpertReference.ts @@ -13,4 +13,6 @@ export interface AgentsCreateExpertReference { name?: string; /** Optional. Additional system instructions appended to the default system prompt when creating an expert from the registry, extending the expert's behavior. */ systemPrompt?: string; + /** Optional configuration override for the registry expert. Values provided here are deep-merged with the schema defaults declared on the registry expert and validated against its `configSchema`. Ignored when the registry expert has no schema. */ + config?: Record; } diff --git a/src/api/types/AgentsErrorResponse.ts b/src/api/types/AgentsErrorResponse.ts deleted file mode 100644 index f75ff873..00000000 --- a/src/api/types/AgentsErrorResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -export interface AgentsErrorResponse { - /** A machine-readable error code that identifies the type of error. */ - code: string; - /** A human-readable description of the error, providing more context about what went wrong. */ - description: string; - /** A human-readable message describing how to fix the issue. */ - howToFix?: string; - /** An optional object containing additional details about the error. */ - details?: Record; - /** An optional object containing the cause of the error, following the same structure as the parent error response. */ - cause?: Record; -} diff --git a/src/api/types/AgentsExpertReference.ts b/src/api/types/AgentsExpertReference.ts index c5d5dd72..09c21b14 100644 --- a/src/api/types/AgentsExpertReference.ts +++ b/src/api/types/AgentsExpertReference.ts @@ -13,4 +13,6 @@ export interface AgentsExpertReference { name: string; /** Optional. Additional system instructions appended to the default system prompt when creating an expert from the registry, extending the expert's behavior. */ systemPrompt?: string; + /** The fully resolved configuration for this expert: schema defaults from the registry expert deep-merged with any `config` override supplied at creation. Present only when the source registry expert defined a `configSchema`. */ + resolvedConfig?: Record; } diff --git a/src/api/types/AgentsRegistryExpert.ts b/src/api/types/AgentsRegistryExpert.ts index ef98affa..6bb800f1 100644 --- a/src/api/types/AgentsRegistryExpert.ts +++ b/src/api/types/AgentsRegistryExpert.ts @@ -13,4 +13,6 @@ export interface AgentsRegistryExpert { description: string; /** A list of MCP servers the expert can call, including their authorization types. */ mcpServers?: Corti.AgentsRegistryMcpServer[]; + /** Optional JSON Schema describing the configuration this expert accepts. When present, callers may supply a matching `config` object on `AgentsCreateExpertReference`; values are deep-merged with schema defaults and validated against this schema. */ + configSchema?: Record; } diff --git a/src/api/types/AgentsValidationError.ts b/src/api/types/AgentsValidationError.ts deleted file mode 100644 index 615b2225..00000000 --- a/src/api/types/AgentsValidationError.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as Corti from "../index.js"; - -export interface AgentsValidationError { - msg: string; - type: string; - reason: string; - howToFix: string; - errors?: Corti.AgentsValidationErrorErrorsItem[]; -} diff --git a/src/api/types/AgentsValidationErrorErrorsItem.ts b/src/api/types/AgentsValidationErrorErrorsItem.ts deleted file mode 100644 index cd20e80c..00000000 --- a/src/api/types/AgentsValidationErrorErrorsItem.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -export interface AgentsValidationErrorErrorsItem { - location?: string; - reason?: string; -} diff --git a/src/api/types/AgentsValidationErrorResponse.ts b/src/api/types/AgentsValidationErrorResponse.ts deleted file mode 100644 index b7c94f27..00000000 --- a/src/api/types/AgentsValidationErrorResponse.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as Corti from "../index.js"; - -export interface AgentsValidationErrorResponse extends Corti.AgentsErrorResponse { - detail?: Corti.AgentsValidationError[]; -} diff --git a/src/api/types/ArrayNode.ts b/src/api/types/ArrayNode.ts new file mode 100644 index 00000000..cddff8a6 --- /dev/null +++ b/src/api/types/ArrayNode.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface ArrayNode { + type: "array"; + /** Can be used to prompt the LLM with more guidance in addition to the section.instructions */ + description?: string; + items: Corti.OutputSchema; + /** Controls how each array item is rendered in the generated output. Use `bullet` (default), `numbered`, or `plain`, or provide a custom format string containing the `{item}` placeholder. */ + itemFormat?: string; + /** Minimum number of array items to generate. */ + minItems?: number | null; + /** Maximum number of array items to generate. */ + maxItems?: number | null; +} diff --git a/src/api/types/BoolNode.ts b/src/api/types/BoolNode.ts new file mode 100644 index 00000000..9d9d69eb --- /dev/null +++ b/src/api/types/BoolNode.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface BoolNode { + type: "boolean"; + /** Can be used to prompt the LLM with more guidance in addition to the section.instructions */ + description?: string; + /** The default to output if nothing to output. */ + default?: boolean | null; +} diff --git a/src/api/types/ContextFacts.ts b/src/api/types/ContextFacts.ts new file mode 100644 index 00000000..f74da108 --- /dev/null +++ b/src/api/types/ContextFacts.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * A single fact provided as input context to the model. + */ +export interface ContextFacts { + type: "facts"; + fact: Corti.GuidedDocumentFactMinimal; +} diff --git a/src/api/types/ContextText.ts b/src/api/types/ContextText.ts new file mode 100644 index 00000000..8e40a297 --- /dev/null +++ b/src/api/types/ContextText.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * A freeform text snippet provided as input context to the model. + */ +export interface ContextText { + type: "text"; + /** Arbitrary text to be reasoned over. */ + text: string; +} diff --git a/src/api/types/ContextTranscript.ts b/src/api/types/ContextTranscript.ts new file mode 100644 index 00000000..8dfcb10f --- /dev/null +++ b/src/api/types/ContextTranscript.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * A transcript provided as input context to the model. + */ +export interface ContextTranscript { + type: "transcript"; + transcript: Corti.GuidedDocumentTranscriptMinimal; +} diff --git a/src/api/types/CreateSectionBase.ts b/src/api/types/CreateSectionBase.ts new file mode 100644 index 00000000..42104bbf --- /dev/null +++ b/src/api/types/CreateSectionBase.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface CreateSectionBase { + /** A human-readable identifier for this section. Not passed to the LLM. */ + name: string; + /** The intended language for outputs as BCP 47 tag. Informational metadata only. The final output language is determined by outputLanguage in the POST /documents request. */ + language: string; + /** A description for this section. Not passed to the LLM. */ + description?: string; + /** Labels work as query param filter in the LIST /sections endpoint. */ + labels?: string[]; + /** Defaults to true when omitted. Set this to false if you do not want the section to automatically show up in LIST /sections. */ + publish?: boolean; +} diff --git a/src/api/types/CreateSectionFromInheritanceRequest.ts b/src/api/types/CreateSectionFromInheritanceRequest.ts new file mode 100644 index 00000000..1a5e0e71 --- /dev/null +++ b/src/api/types/CreateSectionFromInheritanceRequest.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Creates a section that inherits from another section. Any fields omitted in `generation` are inherited from the referenced section's published version; any fields provided override the inherited values. + */ +export interface CreateSectionFromInheritanceRequest extends Corti.CreateSectionBase { + /** Reference to the section to inherit generation configuration from. Inherits from the published version of the referenced section. */ + inheritFromId: string; + generation: Corti.SectionGenerationPartial; +} diff --git a/src/api/types/CreateSectionFromScratchRequest.ts b/src/api/types/CreateSectionFromScratchRequest.ts new file mode 100644 index 00000000..dcc2c5f2 --- /dev/null +++ b/src/api/types/CreateSectionFromScratchRequest.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Creates a section from scratch with an explicit generation configuration. All required fields on `generation` apply. + */ +export interface CreateSectionFromScratchRequest extends Corti.CreateSectionBase { + generation: Corti.SectionGeneration; +} diff --git a/src/api/types/CreateSectionRequest.ts b/src/api/types/CreateSectionRequest.ts new file mode 100644 index 00000000..456c3459 --- /dev/null +++ b/src/api/types/CreateSectionRequest.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export type CreateSectionRequest = Corti.CreateSectionFromScratchRequest | Corti.CreateSectionFromInheritanceRequest; diff --git a/src/api/types/CreateTemplateBase.ts b/src/api/types/CreateTemplateBase.ts new file mode 100644 index 00000000..40c32884 --- /dev/null +++ b/src/api/types/CreateTemplateBase.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface CreateTemplateBase { + /** The name of this template. Not passed to the LLM. */ + name: string; + /** A description for this template. Not passed to the LLM. */ + description?: string; + /** The intended language for outputs as BCP 47 tag. Informational metadata only. The final output language is determined by outputLanguage in the POST /documents request. */ + language: string; + /** Labels work as query param filter in the LIST /templates endpoint. */ + labels?: string[]; + /** Defaults to true when omitted. Set this to false if you do not want the template to automatically show up in LIST templates. */ + publish?: boolean; +} diff --git a/src/api/types/CreateTemplateFromInheritanceRequest.ts b/src/api/types/CreateTemplateFromInheritanceRequest.ts new file mode 100644 index 00000000..24cfafa0 --- /dev/null +++ b/src/api/types/CreateTemplateFromInheritanceRequest.ts @@ -0,0 +1,13 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Creates a template that inherits from another template. Any fields omitted in `generation` are inherited from the referenced template's published version; any fields provided override the inherited values. + */ +export interface CreateTemplateFromInheritanceRequest extends Corti.CreateTemplateBase { + /** Reference to the template to inherit template instructions and sections from. Inherits from the published version of the referenced template. */ + inheritFromId: string; + /** Partial overrides applied on top of the inherited template. All inner fields are optional. Any field omitted is inherited from the referenced template. */ + generation: Corti.CreateTemplateFromInheritanceRequestGeneration; +} diff --git a/src/api/types/CreateTemplateFromInheritanceRequestGeneration.ts b/src/api/types/CreateTemplateFromInheritanceRequestGeneration.ts new file mode 100644 index 00000000..dea4c1b7 --- /dev/null +++ b/src/api/types/CreateTemplateFromInheritanceRequestGeneration.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Partial overrides applied on top of the inherited template. All inner fields are optional. Any field omitted is inherited from the referenced template. + */ +export interface CreateTemplateFromInheritanceRequestGeneration { + instructions?: Corti.TemplateInstructionsPartial; + sections?: Corti.TemplateVersionSectionRequest[]; +} diff --git a/src/api/types/CreateTemplateFromScratchRequest.ts b/src/api/types/CreateTemplateFromScratchRequest.ts new file mode 100644 index 00000000..d50ab930 --- /dev/null +++ b/src/api/types/CreateTemplateFromScratchRequest.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Creates a template from scratch. `generation.instructions` is required and the template fully specifies its own instructions and sections. + */ +export interface CreateTemplateFromScratchRequest extends Corti.CreateTemplateBase { + generation: Corti.CreateTemplateFromScratchRequestGeneration; +} diff --git a/src/api/types/CreateTemplateFromScratchRequestGeneration.ts b/src/api/types/CreateTemplateFromScratchRequestGeneration.ts new file mode 100644 index 00000000..bf84ccbd --- /dev/null +++ b/src/api/types/CreateTemplateFromScratchRequestGeneration.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface CreateTemplateFromScratchRequestGeneration { + instructions: Corti.TemplateInstructions; + sections?: Corti.TemplateVersionSectionRequest[]; +} diff --git a/src/api/types/CreateTemplateRequest.ts b/src/api/types/CreateTemplateRequest.ts new file mode 100644 index 00000000..7d709365 --- /dev/null +++ b/src/api/types/CreateTemplateRequest.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export type CreateTemplateRequest = Corti.CreateTemplateFromScratchRequest | Corti.CreateTemplateFromInheritanceRequest; diff --git a/src/api/types/FieldDefinition.ts b/src/api/types/FieldDefinition.ts new file mode 100644 index 00000000..0bf1e301 --- /dev/null +++ b/src/api/types/FieldDefinition.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface FieldDefinition { + /** Use to set a key to reference. */ + key: string; + /** Can be used to prompt the LLM with more guidance in addition to the section.instructions */ + description: string; + value: Corti.OutputSchema; +} diff --git a/src/api/types/GuidedAssemblyRequest.ts b/src/api/types/GuidedAssemblyRequest.ts new file mode 100644 index 00000000..d6667c2a --- /dev/null +++ b/src/api/types/GuidedAssemblyRequest.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Compose a template by referencing existing stored sections in declaration order. + */ +export interface GuidedAssemblyRequest { + /** Name for the auto-generated template aggregate that will be persisted. */ + name: string; + /** BCP 47 language tag. */ + language: string; + /** Template-level instructions for the assembled template. */ + instructions?: Corti.TemplateInstructions; + sectionRefs: Corti.GuidedAssemblySectionRef[]; +} diff --git a/src/api/types/GuidedAssemblySectionRef.ts b/src/api/types/GuidedAssemblySectionRef.ts new file mode 100644 index 00000000..8324bbb7 --- /dev/null +++ b/src/api/types/GuidedAssemblySectionRef.ts @@ -0,0 +1,13 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Per-section reference for the assembly path. + */ +export interface GuidedAssemblySectionRef { + sectionId: string; + /** Optional explicit section version. Defaults to the section's published version when omitted. */ + sectionVersionId?: string | null; + overrides?: Corti.SectionOverrides; +} diff --git a/src/api/types/GuidedDocumentByAssembly.ts b/src/api/types/GuidedDocumentByAssembly.ts new file mode 100644 index 00000000..6421797b --- /dev/null +++ b/src/api/types/GuidedDocumentByAssembly.ts @@ -0,0 +1,17 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Generate a document by assembling a template from existing stored sections. The resulting template aggregate is auto-saved and can be referenced in future calls. At least one of `context` or `interactionId` must be supplied as input context for the model. + */ +export interface GuidedDocumentByAssembly { + /** Ordered list of context items the model reasons over. Each item is one of text, a transcript (with optional metadata and segments), or a single fact. Items are interleaved by timestamps where present on transcript segments; otherwise array order is preserved. */ + context?: Corti.GuidedDocumentContext[]; + /** When supplied, all facts and transcripts already attached to the referenced interaction are passed implicitly as input context. */ + interactionId?: string; + /** Assemble a template from existing stored sections. */ + assemblyTemplate: Corti.GuidedAssemblyRequest; + /** The language in which the document will be generated as a BCP 47 tag. */ + outputLanguage: string; +} diff --git a/src/api/types/GuidedDocumentByDynamic.ts b/src/api/types/GuidedDocumentByDynamic.ts new file mode 100644 index 00000000..269289c2 --- /dev/null +++ b/src/api/types/GuidedDocumentByDynamic.ts @@ -0,0 +1,17 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Generate a document from a fully inline template definition supplied in the request body. Sections and the wrapping template are created and immediately published as auto-generated resources. At least one of `context` or `interactionId` must be supplied as input context for the model. + */ +export interface GuidedDocumentByDynamic { + /** Ordered list of context items the model reasons over. Each item is one of text, a transcript (with optional metadata and segments), or a single fact. Items are interleaved by timestamps where present on transcript segments; otherwise array order is preserved. */ + context?: Corti.GuidedDocumentContext[]; + /** When supplied, all facts and transcripts already attached to the referenced interaction are passed implicitly as input context. */ + interactionId?: string; + /** Fully inline template defined in the request body. */ + dynamicTemplate: Corti.GuidedDynamicRequest; + /** The language in which the document will be generated as a BCP 47 tag. */ + outputLanguage: string; +} diff --git a/src/api/types/GuidedDocumentByTemplateRef.ts b/src/api/types/GuidedDocumentByTemplateRef.ts new file mode 100644 index 00000000..6881670b --- /dev/null +++ b/src/api/types/GuidedDocumentByTemplateRef.ts @@ -0,0 +1,17 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Generate a document using a stored template. Optionally supply runtime overrides to patch instructions or sections without mutating the base template. At least one of `context` or `interactionId` must be supplied as input context for the model. + */ +export interface GuidedDocumentByTemplateRef { + /** Ordered list of context items the model reasons over. Each item is one of text, a transcript (with optional metadata and segments), or a single fact. Items are interleaved by timestamps where present on transcript segments; otherwise array order is preserved. */ + context?: Corti.GuidedDocumentContext[]; + /** When supplied, all facts and transcripts already attached to the referenced interaction are passed implicitly as input context. */ + interactionId?: string; + /** Reference an existing stored template, optionally with overrides. */ + templateRef: Corti.GuidedTemplateRef; + /** The language in which the document will be generated as a BCP 47 tag. */ + outputLanguage: string; +} diff --git a/src/api/types/GuidedDocumentContext.ts b/src/api/types/GuidedDocumentContext.ts new file mode 100644 index 00000000..03b30d68 --- /dev/null +++ b/src/api/types/GuidedDocumentContext.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export type GuidedDocumentContext = Corti.ContextText | Corti.ContextTranscript | Corti.ContextFacts; diff --git a/src/api/types/GuidedDocumentFactMinimal.ts b/src/api/types/GuidedDocumentFactMinimal.ts new file mode 100644 index 00000000..a16a987f --- /dev/null +++ b/src/api/types/GuidedDocumentFactMinimal.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Minimal fact shape. Only `text` is required. + */ +export interface GuidedDocumentFactMinimal { + /** The text of the fact. */ + text: string; +} diff --git a/src/api/types/GuidedDocumentRequest.ts b/src/api/types/GuidedDocumentRequest.ts new file mode 100644 index 00000000..c52054b3 --- /dev/null +++ b/src/api/types/GuidedDocumentRequest.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export type GuidedDocumentRequest = + | Corti.GuidedDocumentByTemplateRef + | Corti.GuidedDocumentByAssembly + | Corti.GuidedDocumentByDynamic; diff --git a/src/api/types/GuidedDocumentResponse.ts b/src/api/types/GuidedDocumentResponse.ts new file mode 100644 index 00000000..3a3f226d --- /dev/null +++ b/src/api/types/GuidedDocumentResponse.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface GuidedDocumentResponse { + /** The template ID used for generation. For Path 1 (plain `templateRef` with no overrides), this is the referenced template. For other paths, it is the newly saved, auto-generated template aggregate. */ + templateId: string; + /** The specific template version that was used for generation. */ + templateVersionId: string; + result: Corti.GuidedGenerationResult; +} diff --git a/src/api/types/GuidedDocumentTranscriptMetadataMinimal.ts b/src/api/types/GuidedDocumentTranscriptMetadataMinimal.ts new file mode 100644 index 00000000..8bc68a14 --- /dev/null +++ b/src/api/types/GuidedDocumentTranscriptMetadataMinimal.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Optional transcript-level metadata. All fields optional. + */ +export interface GuidedDocumentTranscriptMetadataMinimal { + participantsRoles?: Corti.TranscriptsParticipant[] | null; +} diff --git a/src/api/types/GuidedDocumentTranscriptMinimal.ts b/src/api/types/GuidedDocumentTranscriptMinimal.ts new file mode 100644 index 00000000..d509a43a --- /dev/null +++ b/src/api/types/GuidedDocumentTranscriptMinimal.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Minimal transcript shape accepted as guided-document input context. Decoupled from the transcript resource: only `transcripts` is required, and within each segment only `text` is required. + */ +export interface GuidedDocumentTranscriptMinimal { + metadata?: Corti.GuidedDocumentTranscriptMetadataMinimal; + transcripts: Corti.GuidedDocumentTranscriptSegmentMinimal[]; +} diff --git a/src/api/types/GuidedDocumentTranscriptSegmentMinimal.ts b/src/api/types/GuidedDocumentTranscriptSegmentMinimal.ts new file mode 100644 index 00000000..92733875 --- /dev/null +++ b/src/api/types/GuidedDocumentTranscriptSegmentMinimal.ts @@ -0,0 +1,19 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Minimal transcript segment. Only `text` is required. + */ +export interface GuidedDocumentTranscriptSegmentMinimal { + /** The channel associated with this phrase/utterance. */ + channel?: number; + /** The identifier of the participant. */ + participant?: number; + /** Id to tag an identified speaker. */ + speakerId?: number; + /** The spoken phrase or utterance. */ + text: string; + /** Start time in milliseconds for phrase/utterance. */ + start?: number; + /** End time in milliseconds for phrase/utterance. */ + end?: number; +} diff --git a/src/api/types/GuidedDynamicInline.ts b/src/api/types/GuidedDynamicInline.ts new file mode 100644 index 00000000..41e68bf3 --- /dev/null +++ b/src/api/types/GuidedDynamicInline.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface GuidedDynamicInline { + instructions: Corti.TemplateInstructions; + sections: Corti.SectionGeneration[]; +} diff --git a/src/api/types/GuidedDynamicRequest.ts b/src/api/types/GuidedDynamicRequest.ts new file mode 100644 index 00000000..2e3a2b0b --- /dev/null +++ b/src/api/types/GuidedDynamicRequest.ts @@ -0,0 +1,13 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Fully inline template definition. Sections and the wrapping template are created and immediately published as auto-generated resources. + */ +export interface GuidedDynamicRequest { + name: string; + /** BCP 47 language tag. */ + language: string; + generation: Corti.GuidedDynamicInline; +} diff --git a/src/api/types/GuidedGenerationResult.ts b/src/api/types/GuidedGenerationResult.ts new file mode 100644 index 00000000..fdbbc8a4 --- /dev/null +++ b/src/api/types/GuidedGenerationResult.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * ML-service result. The shape mirrors the resolved template's section output schemas. + */ +export interface GuidedGenerationResult { + /** The generated document as a map of section key to rendered string output. */ + stringDocument?: Record; + /** The generated document as a structured object keyed by section. */ + structuredDocument?: Record | null; + usage?: Corti.GuidedGenerationResultUsage; +} diff --git a/src/api/types/GuidedGenerationResultUsage.ts b/src/api/types/GuidedGenerationResultUsage.ts new file mode 100644 index 00000000..35988177 --- /dev/null +++ b/src/api/types/GuidedGenerationResultUsage.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface GuidedGenerationResultUsage { + tokenCount?: Corti.GuidedGenerationResultUsageTokenCount; +} diff --git a/src/api/types/GuidedGenerationResultUsageTokenCount.ts b/src/api/types/GuidedGenerationResultUsageTokenCount.ts new file mode 100644 index 00000000..3479b0c9 --- /dev/null +++ b/src/api/types/GuidedGenerationResultUsageTokenCount.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface GuidedGenerationResultUsageTokenCount { + input?: number; + output?: number; +} diff --git a/src/api/types/GuidedSectionOverride.ts b/src/api/types/GuidedSectionOverride.ts new file mode 100644 index 00000000..103e15bb --- /dev/null +++ b/src/api/types/GuidedSectionOverride.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Override patch applied to a section linked to the base template version. Override semantics are per-field for `instructions` (any field you omit is inherited from the parent's published version) and wholesale for `outputSchema` (whatever you submit fully replaces the parent schema — partial schemas are not merged). The same rule applies when a section is forked via `inheritFromId`. + */ +export interface GuidedSectionOverride { + /** The UUID of a section linked to the base template version. */ + sectionId: string; + generation?: Corti.SectionOverrides; +} diff --git a/src/api/types/GuidedTemplateOverrides.ts b/src/api/types/GuidedTemplateOverrides.ts new file mode 100644 index 00000000..2de9b5de --- /dev/null +++ b/src/api/types/GuidedTemplateOverrides.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface GuidedTemplateOverrides { + /** Replaces the template-level instructions for this call. */ + instructions?: Corti.TemplateInstructions; + /** Per-section override patches. Each entry must reference a section already linked to the base template version. */ + sections?: Corti.GuidedSectionOverride[]; +} diff --git a/src/api/types/GuidedTemplateRef.ts b/src/api/types/GuidedTemplateRef.ts new file mode 100644 index 00000000..2334be6b --- /dev/null +++ b/src/api/types/GuidedTemplateRef.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface GuidedTemplateRef { + /** The UUID of a stored template. */ + templateId: string; + /** Optional explicit template version. Defaults to the template's published version when omitted. */ + templateVersionId?: string | null; + /** Runtime overrides applied on top of the resolved template. When present, a new auto-generated template is persisted with `inheritedFromId` pointing at the base template. */ + overrides?: Corti.GuidedTemplateOverrides; +} diff --git a/src/api/types/NumberNode.ts b/src/api/types/NumberNode.ts new file mode 100644 index 00000000..553e4038 --- /dev/null +++ b/src/api/types/NumberNode.ts @@ -0,0 +1,15 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface NumberNode { + type: "number"; + /** Can be used to prompt the LLM with more guidance in addition to the section.instructions */ + description?: string; + /** The default to output if nothing to output. */ + default?: number | null; + /** Can be used to prompt the LLM for specifically allowed numeric values to output. */ + enum?: number[]; + /** Use if a minimum value applies. */ + minimum?: number | null; + /** Use if a maximum value applies. */ + maximum?: number | null; +} diff --git a/src/api/types/ObjectNode.ts b/src/api/types/ObjectNode.ts new file mode 100644 index 00000000..99d070f9 --- /dev/null +++ b/src/api/types/ObjectNode.ts @@ -0,0 +1,15 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface ObjectNode { + type: "object"; + /** Can be used to prompt the LLM with more guidance in addition to the section.instructions */ + description?: string; + /** Controls how subheadings are rendered in the generated output. Use `inline` (default) for `{key}: {value}\n` or `block` for `{key}\n{value}\n`, or provide a custom format string containing both `{key}` and `{value}` placeholders. Mutually exclusive with `objectFormat`. */ + subheadingFormat?: string; + /** A format string referencing field keys as placeholders (e.g. `{fieldKey}`). All placeholders must correspond to defined field keys. Mutually exclusive with `subheadingFormat`. */ + objectFormat?: string; + /** Define what fields are possible to return in the object. */ + fields?: Corti.FieldDefinition[]; +} diff --git a/src/api/types/OutputSchema.ts b/src/api/types/OutputSchema.ts new file mode 100644 index 00000000..57e6832d --- /dev/null +++ b/src/api/types/OutputSchema.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export type OutputSchema = Corti.StringNode | Corti.NumberNode | Corti.BoolNode | Corti.ObjectNode | Corti.ArrayNode; diff --git a/src/api/types/Section.ts b/src/api/types/Section.ts new file mode 100644 index 00000000..842d201b --- /dev/null +++ b/src/api/types/Section.ts @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface Section { + /** The UUID of the section. */ + id: string; + /** Reference to the section to inherit generation configuration from. Inherits from published version by default. */ + inheritedFromId?: string | null; + /** True if the section was auto-generated as part of an inline section-composed POST /documents request. */ + autoGenerated?: boolean; + /** The name of the section. */ + name: string; + /** The intended language for outputs as BCP 47 tag. */ + language: string; + /** The description for the section. */ + description?: string; + /** The labels available to use as query param filter in the LIST /sections endpoint. */ + labels: string[]; + /** Shows the currently published version of this section. */ + publishedVersion?: Corti.SectionVersion; + /** The original timestamp when the section was created. */ + createdAt: Date; + /** The original timestamp when the section was last updated. */ + updatedAt: Date; +} diff --git a/src/api/types/SectionGeneration.ts b/src/api/types/SectionGeneration.ts new file mode 100644 index 00000000..54a16083 --- /dev/null +++ b/src/api/types/SectionGeneration.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface SectionGeneration { + /** The heading of this section. Passed to the LLM. */ + heading: string; + /** The prompt instructions for this section. */ + instructions: Corti.SectionInstructions; + outputSchema: Corti.OutputSchema; +} diff --git a/src/api/types/SectionGenerationPartial.ts b/src/api/types/SectionGenerationPartial.ts new file mode 100644 index 00000000..968c6f0c --- /dev/null +++ b/src/api/types/SectionGenerationPartial.ts @@ -0,0 +1,15 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Partial form of SectionGeneration used when inheriting from another section. Any field omitted is inherited from the referenced section. + */ +export interface SectionGenerationPartial { + /** Override the inherited section title. Passed to the LLM. */ + heading?: string; + /** Override the inherited prompt instructions for this section. Any field omitted is inherited. */ + instructions?: Corti.SectionInstructionsPartial; + /** Override the inherited output schema. */ + outputSchema?: Corti.OutputSchema; +} diff --git a/src/api/types/SectionInstructions.ts b/src/api/types/SectionInstructions.ts new file mode 100644 index 00000000..2ce814e5 --- /dev/null +++ b/src/api/types/SectionInstructions.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface SectionInstructions { + /** The content prompt instructs the model what to include for synthesis. For `documentationMode: routed_parallel` this impacts what facts to route to this section. */ + contentPrompt: string; + /** The writingStyle prompt instructs the model in what tone and style to output. */ + writingStylePrompt?: string; + /** Optional free-form prompt for any instructions that don't fit contentPrompt or writingStylePrompt. */ + miscPrompt?: string; +} diff --git a/src/api/types/SectionInstructionsOverride.ts b/src/api/types/SectionInstructionsOverride.ts new file mode 100644 index 00000000..38dd91f2 --- /dev/null +++ b/src/api/types/SectionInstructionsOverride.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Partial section-instructions patch used in override and fork contexts. Each field is independent: provide only the fields you want to replace, and any field you omit is inherited from the parent's published version. + */ +export interface SectionInstructionsOverride { + /** When provided, replaces the section's content prompt. Omit to inherit from the parent. */ + contentPrompt?: string; + /** When provided, replaces the section's writing style prompt. Omit to inherit from the parent. */ + writingStylePrompt?: string; +} diff --git a/src/api/types/SectionInstructionsPartial.ts b/src/api/types/SectionInstructionsPartial.ts new file mode 100644 index 00000000..e4809f70 --- /dev/null +++ b/src/api/types/SectionInstructionsPartial.ts @@ -0,0 +1,13 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Partial form of SectionInstructions used when inheriting from another section. Any field omitted is inherited. + */ +export interface SectionInstructionsPartial { + /** Override the inherited content prompt. */ + contentPrompt?: string; + /** Override the inherited writing style prompt. */ + writingStylePrompt?: string; + /** Override the inherited misc prompt. */ + miscPrompt?: string; +} diff --git a/src/api/types/SectionOverrides.ts b/src/api/types/SectionOverrides.ts new file mode 100644 index 00000000..4728ed93 --- /dev/null +++ b/src/api/types/SectionOverrides.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Patches a section's content at link time without mutating the underlying section. Override semantics are per-field for instructions (any field you omit is inherited from the parent's published version) and wholesale for `outputSchema` (whatever you submit fully replaces the parent schema). The same applies when a section is forked via `inheritFromId`. + */ +export interface SectionOverrides { + /** When provided, replaces the section's title for this call. */ + title?: string | null; + instructions?: Corti.SectionInstructionsOverride; + /** When provided, fully replaces the parent's output schema. */ + outputSchema?: Corti.OutputSchema; +} diff --git a/src/api/types/SectionVersion.ts b/src/api/types/SectionVersion.ts new file mode 100644 index 00000000..fe3c6b68 --- /dev/null +++ b/src/api/types/SectionVersion.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface SectionVersion { + /** The UUID of the section version. */ + id: string; + /** Starts at 0 and auto-increments. */ + versionNumber: number; + generation: Corti.SectionGeneration; +} diff --git a/src/api/types/StatusResponse.ts b/src/api/types/StatusResponse.ts new file mode 100644 index 00000000..15ca5217 --- /dev/null +++ b/src/api/types/StatusResponse.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface StatusResponse { + status: string; +} diff --git a/src/api/types/StringNode.ts b/src/api/types/StringNode.ts new file mode 100644 index 00000000..5571866e --- /dev/null +++ b/src/api/types/StringNode.ts @@ -0,0 +1,13 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface StringNode { + type: "string"; + /** Can be used to prompt the LLM with more guidance in addition to the section.instructions */ + description?: string; + /** The default to output if nothing to output. */ + default?: string | null; + /** Can be used to prompt the LLM with specific values to output. */ + enum?: string[]; + /** Can be used to prompt the LLM for a specific output pattern. */ + pattern?: string | null; +} diff --git a/src/api/types/Template.ts b/src/api/types/Template.ts new file mode 100644 index 00000000..515ea47d --- /dev/null +++ b/src/api/types/Template.ts @@ -0,0 +1,25 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface Template { + /** The UUID of the template. */ + id: string; + /** Reference to the template to inherit template instructions and sections from. Inherits from published version by default. */ + inheritedFromId?: string | null; + /** True if the template was auto-generated based on the section-composed POST /documents request. */ + autoGenerated?: boolean; + /** The name of this template. Not passed to the LLM. */ + name: string; + /** A description for this template. Not passed to the LLM. */ + description?: string; + /** The intended language as BCP 47 tag. Informational metadata only. The final output language is determined by outputLanguage in the POST /documents request. */ + language: string; + /** The available labels to use as query param filter in the LIST /templates endpoint. */ + labels: string[]; + publishedVersion?: Corti.TemplateVersion; + /** The original timestamp when the template was created. */ + createdAt: Date; + /** The original timestamp when the template was last updated. */ + updatedAt: Date; +} diff --git a/src/api/types/TemplateGeneration.ts b/src/api/types/TemplateGeneration.ts new file mode 100644 index 00000000..b235e6f6 --- /dev/null +++ b/src/api/types/TemplateGeneration.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface TemplateGeneration { + instructions: Corti.TemplateInstructions; + /** Populated only on GET /documents/templates/{templateID}/versions/{versionID}; omitted from list responses. */ + sections?: Corti.Section[]; +} diff --git a/src/api/types/TemplateInstructions.ts b/src/api/types/TemplateInstructions.ts new file mode 100644 index 00000000..c72499a1 --- /dev/null +++ b/src/api/types/TemplateInstructions.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface TemplateInstructions { + /** Template-level prompt instructions that apply generally to all sections. */ + prompt: string; +} diff --git a/src/api/types/TemplateInstructionsPartial.ts b/src/api/types/TemplateInstructionsPartial.ts new file mode 100644 index 00000000..4335cb78 --- /dev/null +++ b/src/api/types/TemplateInstructionsPartial.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Partial form of TemplateInstructions used when inheriting from another template. Any field omitted is inherited. + */ +export interface TemplateInstructionsPartial { + /** Override the inherited template-level prompt instructions. */ + prompt?: string; +} diff --git a/src/api/types/TemplateVersion.ts b/src/api/types/TemplateVersion.ts new file mode 100644 index 00000000..94e72fb7 --- /dev/null +++ b/src/api/types/TemplateVersion.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface TemplateVersion { + /** The UUID of the version. */ + id: string; + /** Starts at 0 and auto-increments. */ + versionNumber: number; + generation: Corti.TemplateGeneration; +} diff --git a/src/api/types/TemplateVersionSectionRequest.ts b/src/api/types/TemplateVersionSectionRequest.ts new file mode 100644 index 00000000..ac0d2ba0 --- /dev/null +++ b/src/api/types/TemplateVersionSectionRequest.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface TemplateVersionSectionRequest { + /** The UUID of the section to include in the template version. */ + sectionId: string; + /** Sets the order of this section within this template. Starts at 0. */ + orderIndex?: number; +} diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 66b9b853..26bc8fc4 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -22,7 +22,6 @@ export * from "./AgentsCreateMcpServerAuthorizationType.js"; export * from "./AgentsCreateMcpServerTransportType.js"; export * from "./AgentsDataPart.js"; export * from "./AgentsDataPartKind.js"; -export * from "./AgentsErrorResponse.js"; export * from "./AgentsExpert.js"; export * from "./AgentsExpertReference.js"; export * from "./AgentsExpertReferenceType.js"; @@ -53,15 +52,14 @@ export * from "./AgentsTaskStatusState.js"; export * from "./AgentsTextPart.js"; export * from "./AgentsTextPartKind.js"; export * from "./AgentsUpdateExpertReference.js"; -export * from "./AgentsValidationError.js"; -export * from "./AgentsValidationErrorErrorsItem.js"; -export * from "./AgentsValidationErrorResponse.js"; +export * from "./ArrayNode.js"; export * from "./AuthTokenRequestAuthorizationCode.js"; export * from "./AuthTokenRequestAuthorizationPkce.js"; export * from "./AuthTokenRequestClientCredentials.js"; export * from "./AuthTokenRequestRefresh.js"; export * from "./AuthTokenRequestRopc.js"; export * from "./AuthTokenResponse.js"; +export * from "./BoolNode.js"; export * from "./CodesFilter.js"; export * from "./CodesGeneralReadResponse.js"; export * from "./CodesGeneralReadResponseAlternativesItem.js"; @@ -78,6 +76,19 @@ export * from "./CommonTextContextType.js"; export * from "./CommonTranscriptRequest.js"; export * from "./CommonTranscriptResponse.js"; export * from "./CommonUsageInfo.js"; +export * from "./ContextFacts.js"; +export * from "./ContextText.js"; +export * from "./ContextTranscript.js"; +export * from "./CreateSectionBase.js"; +export * from "./CreateSectionFromInheritanceRequest.js"; +export * from "./CreateSectionFromScratchRequest.js"; +export * from "./CreateSectionRequest.js"; +export * from "./CreateTemplateBase.js"; +export * from "./CreateTemplateFromInheritanceRequest.js"; +export * from "./CreateTemplateFromInheritanceRequestGeneration.js"; +export * from "./CreateTemplateFromScratchRequest.js"; +export * from "./CreateTemplateFromScratchRequestGeneration.js"; +export * from "./CreateTemplateRequest.js"; export * from "./DocumentsContext.js"; export * from "./DocumentsContextWithFacts.js"; export * from "./DocumentsContextWithFactsType.js"; @@ -113,6 +124,27 @@ export * from "./FactsFactGroupsListResponse.js"; export * from "./FactsListItem.js"; export * from "./FactsListResponse.js"; export * from "./FactsUpdateResponse.js"; +export * from "./FieldDefinition.js"; +export * from "./GuidedAssemblyRequest.js"; +export * from "./GuidedAssemblySectionRef.js"; +export * from "./GuidedDocumentByAssembly.js"; +export * from "./GuidedDocumentByDynamic.js"; +export * from "./GuidedDocumentByTemplateRef.js"; +export * from "./GuidedDocumentContext.js"; +export * from "./GuidedDocumentFactMinimal.js"; +export * from "./GuidedDocumentRequest.js"; +export * from "./GuidedDocumentResponse.js"; +export * from "./GuidedDocumentTranscriptMetadataMinimal.js"; +export * from "./GuidedDocumentTranscriptMinimal.js"; +export * from "./GuidedDocumentTranscriptSegmentMinimal.js"; +export * from "./GuidedDynamicInline.js"; +export * from "./GuidedDynamicRequest.js"; +export * from "./GuidedGenerationResult.js"; +export * from "./GuidedGenerationResultUsage.js"; +export * from "./GuidedGenerationResultUsageTokenCount.js"; +export * from "./GuidedSectionOverride.js"; +export * from "./GuidedTemplateOverrides.js"; +export * from "./GuidedTemplateRef.js"; export * from "./InteractionsCreateResponse.js"; export * from "./InteractionsEncounterCreateRequest.js"; export * from "./InteractionsEncounterPeriod.js"; @@ -124,9 +156,21 @@ export * from "./InteractionsGenderEnum.js"; export * from "./InteractionsGetResponse.js"; export * from "./InteractionsListResponse.js"; export * from "./InteractionsPatient.js"; +export * from "./NumberNode.js"; export * from "./OAuthTokenRequest.js"; +export * from "./ObjectNode.js"; +export * from "./OutputSchema.js"; export * from "./RecordingsCreateResponse.js"; export * from "./RecordingsListResponse.js"; +export * from "./Section.js"; +export * from "./SectionGeneration.js"; +export * from "./SectionGenerationPartial.js"; +export * from "./SectionInstructions.js"; +export * from "./SectionInstructionsOverride.js"; +export * from "./SectionInstructionsPartial.js"; +export * from "./SectionOverrides.js"; +export * from "./SectionVersion.js"; +export * from "./StatusResponse.js"; export * from "./StreamConfig.js"; export * from "./StreamConfigMessage.js"; export * from "./StreamConfigMode.js"; @@ -152,6 +196,11 @@ export * from "./StreamTranscript.js"; export * from "./StreamTranscriptMessage.js"; export * from "./StreamTranscriptTime.js"; export * from "./StreamUsageMessage.js"; +export * from "./StringNode.js"; +export * from "./Template.js"; +export * from "./TemplateGeneration.js"; +export * from "./TemplateInstructions.js"; +export * from "./TemplateInstructionsPartial.js"; export * from "./TemplatesDocumentationModeEnum.js"; export * from "./TemplatesFormatRule.js"; export * from "./TemplatesItem.js"; @@ -162,6 +211,8 @@ export * from "./TemplatesSectionSorted.js"; export * from "./TemplatesSectionTranslation.js"; export * from "./TemplatesTranslation.js"; export * from "./TemplatesWritingStyle.js"; +export * from "./TemplateVersion.js"; +export * from "./TemplateVersionSectionRequest.js"; export * from "./TranscribeCommand.js"; export * from "./TranscribeCommandData.js"; export * from "./TranscribeCommandMessage.js"; diff --git a/src/serialization/resources/documents/index.ts b/src/serialization/resources/documents/index.ts index 914b8c3c..9eb1192d 100644 --- a/src/serialization/resources/documents/index.ts +++ b/src/serialization/resources/documents/index.ts @@ -1 +1,2 @@ export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/serialization/resources/documents/resources/index.ts b/src/serialization/resources/documents/resources/index.ts new file mode 100644 index 00000000..102cb9b5 --- /dev/null +++ b/src/serialization/resources/documents/resources/index.ts @@ -0,0 +1,4 @@ +export * from "./sections/client/requests/index.js"; +export * as sections from "./sections/index.js"; +export * from "./templates/client/requests/index.js"; +export * as templates from "./templates/index.js"; diff --git a/src/serialization/resources/documents/resources/sections/client/index.ts b/src/serialization/resources/documents/resources/sections/client/index.ts new file mode 100644 index 00000000..cd155427 --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/client/index.ts @@ -0,0 +1,2 @@ +export * as list from "./list.js"; +export * from "./requests/index.js"; diff --git a/src/serialization/resources/documents/resources/sections/client/list.ts b/src/serialization/resources/documents/resources/sections/client/list.ts new file mode 100644 index 00000000..18305a71 --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/client/list.ts @@ -0,0 +1,13 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../../../api/index.js"; +import * as core from "../../../../../../core/index.js"; +import type * as serializers from "../../../../../index.js"; +import { Section } from "../../../../../types/Section.js"; + +export const Response: core.serialization.Schema = + core.serialization.list(Section); + +export declare namespace Response { + export type Raw = Section.Raw[]; +} diff --git a/src/serialization/resources/documents/resources/sections/client/requests/UpdateSectionRequest.ts b/src/serialization/resources/documents/resources/sections/client/requests/UpdateSectionRequest.ts new file mode 100644 index 00000000..89d9a6f9 --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/client/requests/UpdateSectionRequest.ts @@ -0,0 +1,24 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../../../../api/index.js"; +import * as core from "../../../../../../../core/index.js"; +import type * as serializers from "../../../../../../index.js"; + +export const UpdateSectionRequest: core.serialization.Schema< + serializers.documents.UpdateSectionRequest.Raw, + Corti.documents.UpdateSectionRequest +> = core.serialization.object({ + name: core.serialization.string().optional(), + language: core.serialization.string().optional(), + description: core.serialization.string().optional(), + labels: core.serialization.list(core.serialization.string()).optional(), +}); + +export declare namespace UpdateSectionRequest { + export interface Raw { + name?: string | null; + language?: string | null; + description?: string | null; + labels?: string[] | null; + } +} diff --git a/src/serialization/resources/documents/resources/sections/client/requests/index.ts b/src/serialization/resources/documents/resources/sections/client/requests/index.ts new file mode 100644 index 00000000..a36d62ad --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/client/requests/index.ts @@ -0,0 +1 @@ +export { UpdateSectionRequest } from "./UpdateSectionRequest.js"; diff --git a/src/serialization/resources/documents/resources/sections/index.ts b/src/serialization/resources/documents/resources/sections/index.ts new file mode 100644 index 00000000..9eb1192d --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/index.ts @@ -0,0 +1,2 @@ +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/serialization/resources/documents/resources/sections/resources/index.ts b/src/serialization/resources/documents/resources/sections/resources/index.ts new file mode 100644 index 00000000..2e28ce2f --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/resources/index.ts @@ -0,0 +1 @@ +export * as versions from "./versions/index.js"; diff --git a/src/serialization/resources/documents/resources/sections/resources/versions/client/index.ts b/src/serialization/resources/documents/resources/sections/resources/versions/client/index.ts new file mode 100644 index 00000000..b64f754c --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/resources/versions/client/index.ts @@ -0,0 +1 @@ +export * as list from "./list.js"; diff --git a/src/serialization/resources/documents/resources/sections/resources/versions/client/list.ts b/src/serialization/resources/documents/resources/sections/resources/versions/client/list.ts new file mode 100644 index 00000000..9b88c630 --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/resources/versions/client/list.ts @@ -0,0 +1,15 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../../../../../api/index.js"; +import * as core from "../../../../../../../../core/index.js"; +import type * as serializers from "../../../../../../../index.js"; +import { SectionVersion } from "../../../../../../../types/SectionVersion.js"; + +export const Response: core.serialization.Schema< + serializers.documents.sections.versions.list.Response.Raw, + Corti.SectionVersion[] +> = core.serialization.list(SectionVersion); + +export declare namespace Response { + export type Raw = SectionVersion.Raw[]; +} diff --git a/src/serialization/resources/documents/resources/sections/resources/versions/index.ts b/src/serialization/resources/documents/resources/sections/resources/versions/index.ts new file mode 100644 index 00000000..914b8c3c --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/resources/versions/index.ts @@ -0,0 +1 @@ +export * from "./client/index.js"; diff --git a/src/serialization/resources/documents/resources/templates/client/index.ts b/src/serialization/resources/documents/resources/templates/client/index.ts new file mode 100644 index 00000000..cd155427 --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/client/index.ts @@ -0,0 +1,2 @@ +export * as list from "./list.js"; +export * from "./requests/index.js"; diff --git a/src/serialization/resources/documents/resources/templates/client/list.ts b/src/serialization/resources/documents/resources/templates/client/list.ts new file mode 100644 index 00000000..3a636594 --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/client/list.ts @@ -0,0 +1,13 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../../../api/index.js"; +import * as core from "../../../../../../core/index.js"; +import type * as serializers from "../../../../../index.js"; +import { Template } from "../../../../../types/Template.js"; + +export const Response: core.serialization.Schema = + core.serialization.list(Template); + +export declare namespace Response { + export type Raw = Template.Raw[]; +} diff --git a/src/serialization/resources/documents/resources/templates/client/requests/UpdateTemplateRequest.ts b/src/serialization/resources/documents/resources/templates/client/requests/UpdateTemplateRequest.ts new file mode 100644 index 00000000..1963db47 --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/client/requests/UpdateTemplateRequest.ts @@ -0,0 +1,24 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../../../../api/index.js"; +import * as core from "../../../../../../../core/index.js"; +import type * as serializers from "../../../../../../index.js"; + +export const UpdateTemplateRequest: core.serialization.Schema< + serializers.documents.UpdateTemplateRequest.Raw, + Corti.documents.UpdateTemplateRequest +> = core.serialization.object({ + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + language: core.serialization.string().optional(), + labels: core.serialization.list(core.serialization.string()).optional(), +}); + +export declare namespace UpdateTemplateRequest { + export interface Raw { + name?: string | null; + description?: string | null; + language?: string | null; + labels?: string[] | null; + } +} diff --git a/src/serialization/resources/documents/resources/templates/client/requests/index.ts b/src/serialization/resources/documents/resources/templates/client/requests/index.ts new file mode 100644 index 00000000..aa555e1b --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/client/requests/index.ts @@ -0,0 +1 @@ +export { UpdateTemplateRequest } from "./UpdateTemplateRequest.js"; diff --git a/src/serialization/resources/documents/resources/templates/index.ts b/src/serialization/resources/documents/resources/templates/index.ts new file mode 100644 index 00000000..9eb1192d --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/index.ts @@ -0,0 +1,2 @@ +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/serialization/resources/documents/resources/templates/resources/index.ts b/src/serialization/resources/documents/resources/templates/resources/index.ts new file mode 100644 index 00000000..e8c0651d --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/resources/index.ts @@ -0,0 +1,3 @@ +export * from "./versions/client/requests/index.js"; +export * as versions from "./versions/index.js"; +export * from "./versions/types/index.js"; diff --git a/src/serialization/resources/documents/resources/templates/resources/versions/client/index.ts b/src/serialization/resources/documents/resources/templates/resources/versions/client/index.ts new file mode 100644 index 00000000..cd155427 --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/resources/versions/client/index.ts @@ -0,0 +1,2 @@ +export * as list from "./list.js"; +export * from "./requests/index.js"; diff --git a/src/serialization/resources/documents/resources/templates/resources/versions/client/list.ts b/src/serialization/resources/documents/resources/templates/resources/versions/client/list.ts new file mode 100644 index 00000000..dd65a92c --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/resources/versions/client/list.ts @@ -0,0 +1,15 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../../../../../api/index.js"; +import * as core from "../../../../../../../../core/index.js"; +import type * as serializers from "../../../../../../../index.js"; +import { TemplateVersion } from "../../../../../../../types/TemplateVersion.js"; + +export const Response: core.serialization.Schema< + serializers.documents.templates.versions.list.Response.Raw, + Corti.TemplateVersion[] +> = core.serialization.list(TemplateVersion); + +export declare namespace Response { + export type Raw = TemplateVersion.Raw[]; +} diff --git a/src/serialization/resources/documents/resources/templates/resources/versions/client/requests/CreateTemplateVersionRequest.ts b/src/serialization/resources/documents/resources/templates/resources/versions/client/requests/CreateTemplateVersionRequest.ts new file mode 100644 index 00000000..84ab138a --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/resources/versions/client/requests/CreateTemplateVersionRequest.ts @@ -0,0 +1,19 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../../../../../../api/index.js"; +import * as core from "../../../../../../../../../core/index.js"; +import type * as serializers from "../../../../../../../../index.js"; +import { CreateTemplateVersionRequestGeneration } from "../../types/CreateTemplateVersionRequestGeneration.js"; + +export const CreateTemplateVersionRequest: core.serialization.Schema< + serializers.documents.templates.CreateTemplateVersionRequest.Raw, + Corti.documents.templates.CreateTemplateVersionRequest +> = core.serialization.object({ + generation: CreateTemplateVersionRequestGeneration, +}); + +export declare namespace CreateTemplateVersionRequest { + export interface Raw { + generation: CreateTemplateVersionRequestGeneration.Raw; + } +} diff --git a/src/serialization/resources/documents/resources/templates/resources/versions/client/requests/index.ts b/src/serialization/resources/documents/resources/templates/resources/versions/client/requests/index.ts new file mode 100644 index 00000000..bea03b68 --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/resources/versions/client/requests/index.ts @@ -0,0 +1 @@ +export { CreateTemplateVersionRequest } from "./CreateTemplateVersionRequest.js"; diff --git a/src/serialization/resources/documents/resources/templates/resources/versions/index.ts b/src/serialization/resources/documents/resources/templates/resources/versions/index.ts new file mode 100644 index 00000000..d9adb1af --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/resources/versions/index.ts @@ -0,0 +1,2 @@ +export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/serialization/resources/documents/resources/templates/resources/versions/types/CreateTemplateVersionRequestGeneration.ts b/src/serialization/resources/documents/resources/templates/resources/versions/types/CreateTemplateVersionRequestGeneration.ts new file mode 100644 index 00000000..5cb10d50 --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/resources/versions/types/CreateTemplateVersionRequestGeneration.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../../../../../api/index.js"; +import * as core from "../../../../../../../../core/index.js"; +import type * as serializers from "../../../../../../../index.js"; +import { TemplateInstructions } from "../../../../../../../types/TemplateInstructions.js"; +import { TemplateVersionSectionRequest } from "../../../../../../../types/TemplateVersionSectionRequest.js"; + +export const CreateTemplateVersionRequestGeneration: core.serialization.ObjectSchema< + serializers.documents.templates.CreateTemplateVersionRequestGeneration.Raw, + Corti.documents.templates.CreateTemplateVersionRequestGeneration +> = core.serialization.object({ + instructions: TemplateInstructions, + sections: core.serialization.list(TemplateVersionSectionRequest).optional(), +}); + +export declare namespace CreateTemplateVersionRequestGeneration { + export interface Raw { + instructions: TemplateInstructions.Raw; + sections?: TemplateVersionSectionRequest.Raw[] | null; + } +} diff --git a/src/serialization/resources/documents/resources/templates/resources/versions/types/index.ts b/src/serialization/resources/documents/resources/templates/resources/versions/types/index.ts new file mode 100644 index 00000000..78af3000 --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/resources/versions/types/index.ts @@ -0,0 +1 @@ +export * from "./CreateTemplateVersionRequestGeneration.js"; diff --git a/src/serialization/types/AgentsCreateExpertReference.ts b/src/serialization/types/AgentsCreateExpertReference.ts index 535bdd16..db40af90 100644 --- a/src/serialization/types/AgentsCreateExpertReference.ts +++ b/src/serialization/types/AgentsCreateExpertReference.ts @@ -13,6 +13,7 @@ export const AgentsCreateExpertReference: core.serialization.ObjectSchema< id: core.serialization.string().optional(), name: core.serialization.string().optional(), systemPrompt: core.serialization.string().optional(), + config: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), }); export declare namespace AgentsCreateExpertReference { @@ -21,5 +22,6 @@ export declare namespace AgentsCreateExpertReference { id?: string | null; name?: string | null; systemPrompt?: string | null; + config?: Record | null; } } diff --git a/src/serialization/types/AgentsErrorResponse.ts b/src/serialization/types/AgentsErrorResponse.ts deleted file mode 100644 index 06424ccf..00000000 --- a/src/serialization/types/AgentsErrorResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as Corti from "../../api/index.js"; -import * as core from "../../core/index.js"; -import type * as serializers from "../index.js"; - -export const AgentsErrorResponse: core.serialization.ObjectSchema< - serializers.AgentsErrorResponse.Raw, - Corti.AgentsErrorResponse -> = core.serialization.object({ - code: core.serialization.string(), - description: core.serialization.string(), - howToFix: core.serialization.string().optional(), - details: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), - cause: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), -}); - -export declare namespace AgentsErrorResponse { - export interface Raw { - code: string; - description: string; - howToFix?: string | null; - details?: Record | null; - cause?: Record | null; - } -} diff --git a/src/serialization/types/AgentsExpertReference.ts b/src/serialization/types/AgentsExpertReference.ts index 1dbdbf71..00a6167b 100644 --- a/src/serialization/types/AgentsExpertReference.ts +++ b/src/serialization/types/AgentsExpertReference.ts @@ -13,6 +13,7 @@ export const AgentsExpertReference: core.serialization.ObjectSchema< id: core.serialization.string(), name: core.serialization.string(), systemPrompt: core.serialization.string().optional(), + resolvedConfig: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), }); export declare namespace AgentsExpertReference { @@ -21,5 +22,6 @@ export declare namespace AgentsExpertReference { id: string; name: string; systemPrompt?: string | null; + resolvedConfig?: Record | null; } } diff --git a/src/serialization/types/AgentsRegistryExpert.ts b/src/serialization/types/AgentsRegistryExpert.ts index c29b3a23..674c9ced 100644 --- a/src/serialization/types/AgentsRegistryExpert.ts +++ b/src/serialization/types/AgentsRegistryExpert.ts @@ -14,6 +14,7 @@ export const AgentsRegistryExpert: core.serialization.ObjectSchema< displayDescription: core.serialization.string().optional(), description: core.serialization.string(), mcpServers: core.serialization.list(AgentsRegistryMcpServer).optional(), + configSchema: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), }); export declare namespace AgentsRegistryExpert { @@ -23,5 +24,6 @@ export declare namespace AgentsRegistryExpert { displayDescription?: string | null; description: string; mcpServers?: AgentsRegistryMcpServer.Raw[] | null; + configSchema?: Record | null; } } diff --git a/src/serialization/types/AgentsValidationError.ts b/src/serialization/types/AgentsValidationError.ts deleted file mode 100644 index bab2cb33..00000000 --- a/src/serialization/types/AgentsValidationError.ts +++ /dev/null @@ -1,27 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as Corti from "../../api/index.js"; -import * as core from "../../core/index.js"; -import type * as serializers from "../index.js"; -import { AgentsValidationErrorErrorsItem } from "./AgentsValidationErrorErrorsItem.js"; - -export const AgentsValidationError: core.serialization.ObjectSchema< - serializers.AgentsValidationError.Raw, - Corti.AgentsValidationError -> = core.serialization.object({ - msg: core.serialization.string(), - type: core.serialization.string(), - reason: core.serialization.string(), - howToFix: core.serialization.string(), - errors: core.serialization.list(AgentsValidationErrorErrorsItem).optional(), -}); - -export declare namespace AgentsValidationError { - export interface Raw { - msg: string; - type: string; - reason: string; - howToFix: string; - errors?: AgentsValidationErrorErrorsItem.Raw[] | null; - } -} diff --git a/src/serialization/types/AgentsValidationErrorErrorsItem.ts b/src/serialization/types/AgentsValidationErrorErrorsItem.ts deleted file mode 100644 index a1fb44b3..00000000 --- a/src/serialization/types/AgentsValidationErrorErrorsItem.ts +++ /dev/null @@ -1,20 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as Corti from "../../api/index.js"; -import * as core from "../../core/index.js"; -import type * as serializers from "../index.js"; - -export const AgentsValidationErrorErrorsItem: core.serialization.ObjectSchema< - serializers.AgentsValidationErrorErrorsItem.Raw, - Corti.AgentsValidationErrorErrorsItem -> = core.serialization.object({ - location: core.serialization.string().optional(), - reason: core.serialization.string().optional(), -}); - -export declare namespace AgentsValidationErrorErrorsItem { - export interface Raw { - location?: string | null; - reason?: string | null; - } -} diff --git a/src/serialization/types/AgentsValidationErrorResponse.ts b/src/serialization/types/AgentsValidationErrorResponse.ts deleted file mode 100644 index 46415c5d..00000000 --- a/src/serialization/types/AgentsValidationErrorResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -import type * as Corti from "../../api/index.js"; -import * as core from "../../core/index.js"; -import type * as serializers from "../index.js"; -import { AgentsErrorResponse } from "./AgentsErrorResponse.js"; -import { AgentsValidationError } from "./AgentsValidationError.js"; - -export const AgentsValidationErrorResponse: core.serialization.ObjectSchema< - serializers.AgentsValidationErrorResponse.Raw, - Corti.AgentsValidationErrorResponse -> = core.serialization - .object({ - detail: core.serialization.list(AgentsValidationError).optional(), - }) - .extend(AgentsErrorResponse); - -export declare namespace AgentsValidationErrorResponse { - export interface Raw extends AgentsErrorResponse.Raw { - detail?: AgentsValidationError.Raw[] | null; - } -} diff --git a/src/serialization/types/ArrayNode.ts b/src/serialization/types/ArrayNode.ts new file mode 100644 index 00000000..363d8b79 --- /dev/null +++ b/src/serialization/types/ArrayNode.ts @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import * as serializers from "../index.js"; + +export const ArrayNode: core.serialization.ObjectSchema = + core.serialization.object({ + type: core.serialization.stringLiteral("array"), + description: core.serialization.string().optional(), + items: core.serialization.lazy(() => serializers.OutputSchema), + itemFormat: core.serialization.string().optional(), + minItems: core.serialization.number().optionalNullable(), + maxItems: core.serialization.number().optionalNullable(), + }); + +export declare namespace ArrayNode { + export interface Raw { + type: "array"; + description?: string | null; + items: serializers.OutputSchema.Raw; + itemFormat?: string | null; + minItems?: (number | null | undefined) | null; + maxItems?: (number | null | undefined) | null; + } +} diff --git a/src/serialization/types/BoolNode.ts b/src/serialization/types/BoolNode.ts new file mode 100644 index 00000000..38a73c89 --- /dev/null +++ b/src/serialization/types/BoolNode.ts @@ -0,0 +1,20 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const BoolNode: core.serialization.ObjectSchema = + core.serialization.object({ + type: core.serialization.stringLiteral("boolean"), + description: core.serialization.string().optional(), + default: core.serialization.boolean().optionalNullable(), + }); + +export declare namespace BoolNode { + export interface Raw { + type: "boolean"; + description?: string | null; + default?: (boolean | null | undefined) | null; + } +} diff --git a/src/serialization/types/ContextFacts.ts b/src/serialization/types/ContextFacts.ts new file mode 100644 index 00000000..b0f75952 --- /dev/null +++ b/src/serialization/types/ContextFacts.ts @@ -0,0 +1,19 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedDocumentFactMinimal } from "./GuidedDocumentFactMinimal.js"; + +export const ContextFacts: core.serialization.ObjectSchema = + core.serialization.object({ + type: core.serialization.stringLiteral("facts"), + fact: GuidedDocumentFactMinimal, + }); + +export declare namespace ContextFacts { + export interface Raw { + type: "facts"; + fact: GuidedDocumentFactMinimal.Raw; + } +} diff --git a/src/serialization/types/ContextText.ts b/src/serialization/types/ContextText.ts new file mode 100644 index 00000000..e092f46b --- /dev/null +++ b/src/serialization/types/ContextText.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const ContextText: core.serialization.ObjectSchema = + core.serialization.object({ + type: core.serialization.stringLiteral("text"), + text: core.serialization.string(), + }); + +export declare namespace ContextText { + export interface Raw { + type: "text"; + text: string; + } +} diff --git a/src/serialization/types/ContextTranscript.ts b/src/serialization/types/ContextTranscript.ts new file mode 100644 index 00000000..5c2eeffb --- /dev/null +++ b/src/serialization/types/ContextTranscript.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedDocumentTranscriptMinimal } from "./GuidedDocumentTranscriptMinimal.js"; + +export const ContextTranscript: core.serialization.ObjectSchema< + serializers.ContextTranscript.Raw, + Corti.ContextTranscript +> = core.serialization.object({ + type: core.serialization.stringLiteral("transcript"), + transcript: GuidedDocumentTranscriptMinimal, +}); + +export declare namespace ContextTranscript { + export interface Raw { + type: "transcript"; + transcript: GuidedDocumentTranscriptMinimal.Raw; + } +} diff --git a/src/serialization/types/CreateSectionBase.ts b/src/serialization/types/CreateSectionBase.ts new file mode 100644 index 00000000..7b039e00 --- /dev/null +++ b/src/serialization/types/CreateSectionBase.ts @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const CreateSectionBase: core.serialization.ObjectSchema< + serializers.CreateSectionBase.Raw, + Corti.CreateSectionBase +> = core.serialization.object({ + name: core.serialization.string(), + language: core.serialization.string(), + description: core.serialization.string().optional(), + labels: core.serialization.list(core.serialization.string()).optional(), + publish: core.serialization.boolean().optional(), +}); + +export declare namespace CreateSectionBase { + export interface Raw { + name: string; + language: string; + description?: string | null; + labels?: string[] | null; + publish?: boolean | null; + } +} diff --git a/src/serialization/types/CreateSectionFromInheritanceRequest.ts b/src/serialization/types/CreateSectionFromInheritanceRequest.ts new file mode 100644 index 00000000..f29f279c --- /dev/null +++ b/src/serialization/types/CreateSectionFromInheritanceRequest.ts @@ -0,0 +1,24 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { CreateSectionBase } from "./CreateSectionBase.js"; +import { SectionGenerationPartial } from "./SectionGenerationPartial.js"; + +export const CreateSectionFromInheritanceRequest: core.serialization.ObjectSchema< + serializers.CreateSectionFromInheritanceRequest.Raw, + Corti.CreateSectionFromInheritanceRequest +> = core.serialization + .object({ + inheritFromId: core.serialization.string(), + generation: SectionGenerationPartial, + }) + .extend(CreateSectionBase); + +export declare namespace CreateSectionFromInheritanceRequest { + export interface Raw extends CreateSectionBase.Raw { + inheritFromId: string; + generation: SectionGenerationPartial.Raw; + } +} diff --git a/src/serialization/types/CreateSectionFromScratchRequest.ts b/src/serialization/types/CreateSectionFromScratchRequest.ts new file mode 100644 index 00000000..25cc9c7d --- /dev/null +++ b/src/serialization/types/CreateSectionFromScratchRequest.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { CreateSectionBase } from "./CreateSectionBase.js"; +import { SectionGeneration } from "./SectionGeneration.js"; + +export const CreateSectionFromScratchRequest: core.serialization.ObjectSchema< + serializers.CreateSectionFromScratchRequest.Raw, + Corti.CreateSectionFromScratchRequest +> = core.serialization + .object({ + generation: SectionGeneration, + }) + .extend(CreateSectionBase); + +export declare namespace CreateSectionFromScratchRequest { + export interface Raw extends CreateSectionBase.Raw { + generation: SectionGeneration.Raw; + } +} diff --git a/src/serialization/types/CreateSectionRequest.ts b/src/serialization/types/CreateSectionRequest.ts new file mode 100644 index 00000000..f62c46f6 --- /dev/null +++ b/src/serialization/types/CreateSectionRequest.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { CreateSectionFromInheritanceRequest } from "./CreateSectionFromInheritanceRequest.js"; +import { CreateSectionFromScratchRequest } from "./CreateSectionFromScratchRequest.js"; + +export const CreateSectionRequest: core.serialization.Schema< + serializers.CreateSectionRequest.Raw, + Corti.CreateSectionRequest +> = core.serialization.undiscriminatedUnion([CreateSectionFromScratchRequest, CreateSectionFromInheritanceRequest]); + +export declare namespace CreateSectionRequest { + export type Raw = CreateSectionFromScratchRequest.Raw | CreateSectionFromInheritanceRequest.Raw; +} diff --git a/src/serialization/types/CreateTemplateBase.ts b/src/serialization/types/CreateTemplateBase.ts new file mode 100644 index 00000000..ae04a00a --- /dev/null +++ b/src/serialization/types/CreateTemplateBase.ts @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const CreateTemplateBase: core.serialization.ObjectSchema< + serializers.CreateTemplateBase.Raw, + Corti.CreateTemplateBase +> = core.serialization.object({ + name: core.serialization.string(), + description: core.serialization.string().optional(), + language: core.serialization.string(), + labels: core.serialization.list(core.serialization.string()).optional(), + publish: core.serialization.boolean().optional(), +}); + +export declare namespace CreateTemplateBase { + export interface Raw { + name: string; + description?: string | null; + language: string; + labels?: string[] | null; + publish?: boolean | null; + } +} diff --git a/src/serialization/types/CreateTemplateFromInheritanceRequest.ts b/src/serialization/types/CreateTemplateFromInheritanceRequest.ts new file mode 100644 index 00000000..a4254957 --- /dev/null +++ b/src/serialization/types/CreateTemplateFromInheritanceRequest.ts @@ -0,0 +1,24 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { CreateTemplateBase } from "./CreateTemplateBase.js"; +import { CreateTemplateFromInheritanceRequestGeneration } from "./CreateTemplateFromInheritanceRequestGeneration.js"; + +export const CreateTemplateFromInheritanceRequest: core.serialization.ObjectSchema< + serializers.CreateTemplateFromInheritanceRequest.Raw, + Corti.CreateTemplateFromInheritanceRequest +> = core.serialization + .object({ + inheritFromId: core.serialization.string(), + generation: CreateTemplateFromInheritanceRequestGeneration, + }) + .extend(CreateTemplateBase); + +export declare namespace CreateTemplateFromInheritanceRequest { + export interface Raw extends CreateTemplateBase.Raw { + inheritFromId: string; + generation: CreateTemplateFromInheritanceRequestGeneration.Raw; + } +} diff --git a/src/serialization/types/CreateTemplateFromInheritanceRequestGeneration.ts b/src/serialization/types/CreateTemplateFromInheritanceRequestGeneration.ts new file mode 100644 index 00000000..5d9f7039 --- /dev/null +++ b/src/serialization/types/CreateTemplateFromInheritanceRequestGeneration.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { TemplateInstructionsPartial } from "./TemplateInstructionsPartial.js"; +import { TemplateVersionSectionRequest } from "./TemplateVersionSectionRequest.js"; + +export const CreateTemplateFromInheritanceRequestGeneration: core.serialization.ObjectSchema< + serializers.CreateTemplateFromInheritanceRequestGeneration.Raw, + Corti.CreateTemplateFromInheritanceRequestGeneration +> = core.serialization.object({ + instructions: TemplateInstructionsPartial.optional(), + sections: core.serialization.list(TemplateVersionSectionRequest).optional(), +}); + +export declare namespace CreateTemplateFromInheritanceRequestGeneration { + export interface Raw { + instructions?: TemplateInstructionsPartial.Raw | null; + sections?: TemplateVersionSectionRequest.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateTemplateFromScratchRequest.ts b/src/serialization/types/CreateTemplateFromScratchRequest.ts new file mode 100644 index 00000000..7d067925 --- /dev/null +++ b/src/serialization/types/CreateTemplateFromScratchRequest.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { CreateTemplateBase } from "./CreateTemplateBase.js"; +import { CreateTemplateFromScratchRequestGeneration } from "./CreateTemplateFromScratchRequestGeneration.js"; + +export const CreateTemplateFromScratchRequest: core.serialization.ObjectSchema< + serializers.CreateTemplateFromScratchRequest.Raw, + Corti.CreateTemplateFromScratchRequest +> = core.serialization + .object({ + generation: CreateTemplateFromScratchRequestGeneration, + }) + .extend(CreateTemplateBase); + +export declare namespace CreateTemplateFromScratchRequest { + export interface Raw extends CreateTemplateBase.Raw { + generation: CreateTemplateFromScratchRequestGeneration.Raw; + } +} diff --git a/src/serialization/types/CreateTemplateFromScratchRequestGeneration.ts b/src/serialization/types/CreateTemplateFromScratchRequestGeneration.ts new file mode 100644 index 00000000..b3433cc7 --- /dev/null +++ b/src/serialization/types/CreateTemplateFromScratchRequestGeneration.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { TemplateInstructions } from "./TemplateInstructions.js"; +import { TemplateVersionSectionRequest } from "./TemplateVersionSectionRequest.js"; + +export const CreateTemplateFromScratchRequestGeneration: core.serialization.ObjectSchema< + serializers.CreateTemplateFromScratchRequestGeneration.Raw, + Corti.CreateTemplateFromScratchRequestGeneration +> = core.serialization.object({ + instructions: TemplateInstructions, + sections: core.serialization.list(TemplateVersionSectionRequest).optional(), +}); + +export declare namespace CreateTemplateFromScratchRequestGeneration { + export interface Raw { + instructions: TemplateInstructions.Raw; + sections?: TemplateVersionSectionRequest.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateTemplateRequest.ts b/src/serialization/types/CreateTemplateRequest.ts new file mode 100644 index 00000000..d042bbca --- /dev/null +++ b/src/serialization/types/CreateTemplateRequest.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { CreateTemplateFromInheritanceRequest } from "./CreateTemplateFromInheritanceRequest.js"; +import { CreateTemplateFromScratchRequest } from "./CreateTemplateFromScratchRequest.js"; + +export const CreateTemplateRequest: core.serialization.Schema< + serializers.CreateTemplateRequest.Raw, + Corti.CreateTemplateRequest +> = core.serialization.undiscriminatedUnion([CreateTemplateFromScratchRequest, CreateTemplateFromInheritanceRequest]); + +export declare namespace CreateTemplateRequest { + export type Raw = CreateTemplateFromScratchRequest.Raw | CreateTemplateFromInheritanceRequest.Raw; +} diff --git a/src/serialization/types/FieldDefinition.ts b/src/serialization/types/FieldDefinition.ts new file mode 100644 index 00000000..169d1073 --- /dev/null +++ b/src/serialization/types/FieldDefinition.ts @@ -0,0 +1,20 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import * as serializers from "../index.js"; + +export const FieldDefinition: core.serialization.ObjectSchema = + core.serialization.object({ + key: core.serialization.string(), + description: core.serialization.string(), + value: core.serialization.lazy(() => serializers.OutputSchema), + }); + +export declare namespace FieldDefinition { + export interface Raw { + key: string; + description: string; + value: serializers.OutputSchema.Raw; + } +} diff --git a/src/serialization/types/GuidedAssemblyRequest.ts b/src/serialization/types/GuidedAssemblyRequest.ts new file mode 100644 index 00000000..9a386d91 --- /dev/null +++ b/src/serialization/types/GuidedAssemblyRequest.ts @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedAssemblySectionRef } from "./GuidedAssemblySectionRef.js"; +import { TemplateInstructions } from "./TemplateInstructions.js"; + +export const GuidedAssemblyRequest: core.serialization.ObjectSchema< + serializers.GuidedAssemblyRequest.Raw, + Corti.GuidedAssemblyRequest +> = core.serialization.object({ + name: core.serialization.string(), + language: core.serialization.string(), + instructions: TemplateInstructions.optional(), + sectionRefs: core.serialization.list(GuidedAssemblySectionRef), +}); + +export declare namespace GuidedAssemblyRequest { + export interface Raw { + name: string; + language: string; + instructions?: TemplateInstructions.Raw | null; + sectionRefs: GuidedAssemblySectionRef.Raw[]; + } +} diff --git a/src/serialization/types/GuidedAssemblySectionRef.ts b/src/serialization/types/GuidedAssemblySectionRef.ts new file mode 100644 index 00000000..303aa42d --- /dev/null +++ b/src/serialization/types/GuidedAssemblySectionRef.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { SectionOverrides } from "./SectionOverrides.js"; + +export const GuidedAssemblySectionRef: core.serialization.ObjectSchema< + serializers.GuidedAssemblySectionRef.Raw, + Corti.GuidedAssemblySectionRef +> = core.serialization.object({ + sectionId: core.serialization.string(), + sectionVersionId: core.serialization.string().optionalNullable(), + overrides: SectionOverrides.optional(), +}); + +export declare namespace GuidedAssemblySectionRef { + export interface Raw { + sectionId: string; + sectionVersionId?: (string | null | undefined) | null; + overrides?: SectionOverrides.Raw | null; + } +} diff --git a/src/serialization/types/GuidedDocumentByAssembly.ts b/src/serialization/types/GuidedDocumentByAssembly.ts new file mode 100644 index 00000000..566d1fb5 --- /dev/null +++ b/src/serialization/types/GuidedDocumentByAssembly.ts @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedAssemblyRequest } from "./GuidedAssemblyRequest.js"; +import { GuidedDocumentContext } from "./GuidedDocumentContext.js"; + +export const GuidedDocumentByAssembly: core.serialization.ObjectSchema< + serializers.GuidedDocumentByAssembly.Raw, + Corti.GuidedDocumentByAssembly +> = core.serialization.object({ + context: core.serialization.list(GuidedDocumentContext).optional(), + interactionId: core.serialization.string().optional(), + assemblyTemplate: GuidedAssemblyRequest, + outputLanguage: core.serialization.string(), +}); + +export declare namespace GuidedDocumentByAssembly { + export interface Raw { + context?: GuidedDocumentContext.Raw[] | null; + interactionId?: string | null; + assemblyTemplate: GuidedAssemblyRequest.Raw; + outputLanguage: string; + } +} diff --git a/src/serialization/types/GuidedDocumentByDynamic.ts b/src/serialization/types/GuidedDocumentByDynamic.ts new file mode 100644 index 00000000..dd05584a --- /dev/null +++ b/src/serialization/types/GuidedDocumentByDynamic.ts @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedDocumentContext } from "./GuidedDocumentContext.js"; +import { GuidedDynamicRequest } from "./GuidedDynamicRequest.js"; + +export const GuidedDocumentByDynamic: core.serialization.ObjectSchema< + serializers.GuidedDocumentByDynamic.Raw, + Corti.GuidedDocumentByDynamic +> = core.serialization.object({ + context: core.serialization.list(GuidedDocumentContext).optional(), + interactionId: core.serialization.string().optional(), + dynamicTemplate: GuidedDynamicRequest, + outputLanguage: core.serialization.string(), +}); + +export declare namespace GuidedDocumentByDynamic { + export interface Raw { + context?: GuidedDocumentContext.Raw[] | null; + interactionId?: string | null; + dynamicTemplate: GuidedDynamicRequest.Raw; + outputLanguage: string; + } +} diff --git a/src/serialization/types/GuidedDocumentByTemplateRef.ts b/src/serialization/types/GuidedDocumentByTemplateRef.ts new file mode 100644 index 00000000..3268c1bb --- /dev/null +++ b/src/serialization/types/GuidedDocumentByTemplateRef.ts @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedDocumentContext } from "./GuidedDocumentContext.js"; +import { GuidedTemplateRef } from "./GuidedTemplateRef.js"; + +export const GuidedDocumentByTemplateRef: core.serialization.ObjectSchema< + serializers.GuidedDocumentByTemplateRef.Raw, + Corti.GuidedDocumentByTemplateRef +> = core.serialization.object({ + context: core.serialization.list(GuidedDocumentContext).optional(), + interactionId: core.serialization.string().optional(), + templateRef: GuidedTemplateRef, + outputLanguage: core.serialization.string(), +}); + +export declare namespace GuidedDocumentByTemplateRef { + export interface Raw { + context?: GuidedDocumentContext.Raw[] | null; + interactionId?: string | null; + templateRef: GuidedTemplateRef.Raw; + outputLanguage: string; + } +} diff --git a/src/serialization/types/GuidedDocumentContext.ts b/src/serialization/types/GuidedDocumentContext.ts new file mode 100644 index 00000000..bc1ddfe4 --- /dev/null +++ b/src/serialization/types/GuidedDocumentContext.ts @@ -0,0 +1,17 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { ContextFacts } from "./ContextFacts.js"; +import { ContextText } from "./ContextText.js"; +import { ContextTranscript } from "./ContextTranscript.js"; + +export const GuidedDocumentContext: core.serialization.Schema< + serializers.GuidedDocumentContext.Raw, + Corti.GuidedDocumentContext +> = core.serialization.undiscriminatedUnion([ContextText, ContextTranscript, ContextFacts]); + +export declare namespace GuidedDocumentContext { + export type Raw = ContextText.Raw | ContextTranscript.Raw | ContextFacts.Raw; +} diff --git a/src/serialization/types/GuidedDocumentFactMinimal.ts b/src/serialization/types/GuidedDocumentFactMinimal.ts new file mode 100644 index 00000000..2b3ddba2 --- /dev/null +++ b/src/serialization/types/GuidedDocumentFactMinimal.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const GuidedDocumentFactMinimal: core.serialization.ObjectSchema< + serializers.GuidedDocumentFactMinimal.Raw, + Corti.GuidedDocumentFactMinimal +> = core.serialization.object({ + text: core.serialization.string(), +}); + +export declare namespace GuidedDocumentFactMinimal { + export interface Raw { + text: string; + } +} diff --git a/src/serialization/types/GuidedDocumentRequest.ts b/src/serialization/types/GuidedDocumentRequest.ts new file mode 100644 index 00000000..1b56a573 --- /dev/null +++ b/src/serialization/types/GuidedDocumentRequest.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedDocumentByAssembly } from "./GuidedDocumentByAssembly.js"; +import { GuidedDocumentByDynamic } from "./GuidedDocumentByDynamic.js"; +import { GuidedDocumentByTemplateRef } from "./GuidedDocumentByTemplateRef.js"; + +export const GuidedDocumentRequest: core.serialization.Schema< + serializers.GuidedDocumentRequest.Raw, + Corti.GuidedDocumentRequest +> = core.serialization.undiscriminatedUnion([ + GuidedDocumentByTemplateRef, + GuidedDocumentByAssembly, + GuidedDocumentByDynamic, +]); + +export declare namespace GuidedDocumentRequest { + export type Raw = GuidedDocumentByTemplateRef.Raw | GuidedDocumentByAssembly.Raw | GuidedDocumentByDynamic.Raw; +} diff --git a/src/serialization/types/GuidedDocumentResponse.ts b/src/serialization/types/GuidedDocumentResponse.ts new file mode 100644 index 00000000..c5c3a8f3 --- /dev/null +++ b/src/serialization/types/GuidedDocumentResponse.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedGenerationResult } from "./GuidedGenerationResult.js"; + +export const GuidedDocumentResponse: core.serialization.ObjectSchema< + serializers.GuidedDocumentResponse.Raw, + Corti.GuidedDocumentResponse +> = core.serialization.object({ + templateId: core.serialization.string(), + templateVersionId: core.serialization.string(), + result: GuidedGenerationResult, +}); + +export declare namespace GuidedDocumentResponse { + export interface Raw { + templateId: string; + templateVersionId: string; + result: GuidedGenerationResult.Raw; + } +} diff --git a/src/serialization/types/GuidedDocumentTranscriptMetadataMinimal.ts b/src/serialization/types/GuidedDocumentTranscriptMetadataMinimal.ts new file mode 100644 index 00000000..bab8ae82 --- /dev/null +++ b/src/serialization/types/GuidedDocumentTranscriptMetadataMinimal.ts @@ -0,0 +1,19 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { TranscriptsParticipant } from "./TranscriptsParticipant.js"; + +export const GuidedDocumentTranscriptMetadataMinimal: core.serialization.ObjectSchema< + serializers.GuidedDocumentTranscriptMetadataMinimal.Raw, + Corti.GuidedDocumentTranscriptMetadataMinimal +> = core.serialization.object({ + participantsRoles: core.serialization.list(TranscriptsParticipant).optionalNullable(), +}); + +export declare namespace GuidedDocumentTranscriptMetadataMinimal { + export interface Raw { + participantsRoles?: (TranscriptsParticipant.Raw[] | null | undefined) | null; + } +} diff --git a/src/serialization/types/GuidedDocumentTranscriptMinimal.ts b/src/serialization/types/GuidedDocumentTranscriptMinimal.ts new file mode 100644 index 00000000..df8959a0 --- /dev/null +++ b/src/serialization/types/GuidedDocumentTranscriptMinimal.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedDocumentTranscriptMetadataMinimal } from "./GuidedDocumentTranscriptMetadataMinimal.js"; +import { GuidedDocumentTranscriptSegmentMinimal } from "./GuidedDocumentTranscriptSegmentMinimal.js"; + +export const GuidedDocumentTranscriptMinimal: core.serialization.ObjectSchema< + serializers.GuidedDocumentTranscriptMinimal.Raw, + Corti.GuidedDocumentTranscriptMinimal +> = core.serialization.object({ + metadata: GuidedDocumentTranscriptMetadataMinimal.optional(), + transcripts: core.serialization.list(GuidedDocumentTranscriptSegmentMinimal), +}); + +export declare namespace GuidedDocumentTranscriptMinimal { + export interface Raw { + metadata?: GuidedDocumentTranscriptMetadataMinimal.Raw | null; + transcripts: GuidedDocumentTranscriptSegmentMinimal.Raw[]; + } +} diff --git a/src/serialization/types/GuidedDocumentTranscriptSegmentMinimal.ts b/src/serialization/types/GuidedDocumentTranscriptSegmentMinimal.ts new file mode 100644 index 00000000..c0a15aa9 --- /dev/null +++ b/src/serialization/types/GuidedDocumentTranscriptSegmentMinimal.ts @@ -0,0 +1,28 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const GuidedDocumentTranscriptSegmentMinimal: core.serialization.ObjectSchema< + serializers.GuidedDocumentTranscriptSegmentMinimal.Raw, + Corti.GuidedDocumentTranscriptSegmentMinimal +> = core.serialization.object({ + channel: core.serialization.number().optional(), + participant: core.serialization.number().optional(), + speakerId: core.serialization.number().optional(), + text: core.serialization.string(), + start: core.serialization.number().optional(), + end: core.serialization.number().optional(), +}); + +export declare namespace GuidedDocumentTranscriptSegmentMinimal { + export interface Raw { + channel?: number | null; + participant?: number | null; + speakerId?: number | null; + text: string; + start?: number | null; + end?: number | null; + } +} diff --git a/src/serialization/types/GuidedDynamicInline.ts b/src/serialization/types/GuidedDynamicInline.ts new file mode 100644 index 00000000..3f996825 --- /dev/null +++ b/src/serialization/types/GuidedDynamicInline.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { SectionGeneration } from "./SectionGeneration.js"; +import { TemplateInstructions } from "./TemplateInstructions.js"; + +export const GuidedDynamicInline: core.serialization.ObjectSchema< + serializers.GuidedDynamicInline.Raw, + Corti.GuidedDynamicInline +> = core.serialization.object({ + instructions: TemplateInstructions, + sections: core.serialization.list(SectionGeneration), +}); + +export declare namespace GuidedDynamicInline { + export interface Raw { + instructions: TemplateInstructions.Raw; + sections: SectionGeneration.Raw[]; + } +} diff --git a/src/serialization/types/GuidedDynamicRequest.ts b/src/serialization/types/GuidedDynamicRequest.ts new file mode 100644 index 00000000..8c85af35 --- /dev/null +++ b/src/serialization/types/GuidedDynamicRequest.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedDynamicInline } from "./GuidedDynamicInline.js"; + +export const GuidedDynamicRequest: core.serialization.ObjectSchema< + serializers.GuidedDynamicRequest.Raw, + Corti.GuidedDynamicRequest +> = core.serialization.object({ + name: core.serialization.string(), + language: core.serialization.string(), + generation: GuidedDynamicInline, +}); + +export declare namespace GuidedDynamicRequest { + export interface Raw { + name: string; + language: string; + generation: GuidedDynamicInline.Raw; + } +} diff --git a/src/serialization/types/GuidedGenerationResult.ts b/src/serialization/types/GuidedGenerationResult.ts new file mode 100644 index 00000000..cb36ef1e --- /dev/null +++ b/src/serialization/types/GuidedGenerationResult.ts @@ -0,0 +1,25 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedGenerationResultUsage } from "./GuidedGenerationResultUsage.js"; + +export const GuidedGenerationResult: core.serialization.ObjectSchema< + serializers.GuidedGenerationResult.Raw, + Corti.GuidedGenerationResult +> = core.serialization.object({ + stringDocument: core.serialization.record(core.serialization.string(), core.serialization.string()).optional(), + structuredDocument: core.serialization + .record(core.serialization.string(), core.serialization.unknown()) + .optionalNullable(), + usage: GuidedGenerationResultUsage.optional(), +}); + +export declare namespace GuidedGenerationResult { + export interface Raw { + stringDocument?: Record | null; + structuredDocument?: (Record | null | undefined) | null; + usage?: GuidedGenerationResultUsage.Raw | null; + } +} diff --git a/src/serialization/types/GuidedGenerationResultUsage.ts b/src/serialization/types/GuidedGenerationResultUsage.ts new file mode 100644 index 00000000..80aeb686 --- /dev/null +++ b/src/serialization/types/GuidedGenerationResultUsage.ts @@ -0,0 +1,19 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedGenerationResultUsageTokenCount } from "./GuidedGenerationResultUsageTokenCount.js"; + +export const GuidedGenerationResultUsage: core.serialization.ObjectSchema< + serializers.GuidedGenerationResultUsage.Raw, + Corti.GuidedGenerationResultUsage +> = core.serialization.object({ + tokenCount: core.serialization.property("token_count", GuidedGenerationResultUsageTokenCount.optional()), +}); + +export declare namespace GuidedGenerationResultUsage { + export interface Raw { + token_count?: GuidedGenerationResultUsageTokenCount.Raw | null; + } +} diff --git a/src/serialization/types/GuidedGenerationResultUsageTokenCount.ts b/src/serialization/types/GuidedGenerationResultUsageTokenCount.ts new file mode 100644 index 00000000..0b1c21f1 --- /dev/null +++ b/src/serialization/types/GuidedGenerationResultUsageTokenCount.ts @@ -0,0 +1,20 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const GuidedGenerationResultUsageTokenCount: core.serialization.ObjectSchema< + serializers.GuidedGenerationResultUsageTokenCount.Raw, + Corti.GuidedGenerationResultUsageTokenCount +> = core.serialization.object({ + input: core.serialization.number().optional(), + output: core.serialization.number().optional(), +}); + +export declare namespace GuidedGenerationResultUsageTokenCount { + export interface Raw { + input?: number | null; + output?: number | null; + } +} diff --git a/src/serialization/types/GuidedSectionOverride.ts b/src/serialization/types/GuidedSectionOverride.ts new file mode 100644 index 00000000..af28803f --- /dev/null +++ b/src/serialization/types/GuidedSectionOverride.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { SectionOverrides } from "./SectionOverrides.js"; + +export const GuidedSectionOverride: core.serialization.ObjectSchema< + serializers.GuidedSectionOverride.Raw, + Corti.GuidedSectionOverride +> = core.serialization.object({ + sectionId: core.serialization.string(), + generation: SectionOverrides.optional(), +}); + +export declare namespace GuidedSectionOverride { + export interface Raw { + sectionId: string; + generation?: SectionOverrides.Raw | null; + } +} diff --git a/src/serialization/types/GuidedTemplateOverrides.ts b/src/serialization/types/GuidedTemplateOverrides.ts new file mode 100644 index 00000000..b0be800f --- /dev/null +++ b/src/serialization/types/GuidedTemplateOverrides.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedSectionOverride } from "./GuidedSectionOverride.js"; +import { TemplateInstructions } from "./TemplateInstructions.js"; + +export const GuidedTemplateOverrides: core.serialization.ObjectSchema< + serializers.GuidedTemplateOverrides.Raw, + Corti.GuidedTemplateOverrides +> = core.serialization.object({ + instructions: TemplateInstructions.optional(), + sections: core.serialization.list(GuidedSectionOverride).optional(), +}); + +export declare namespace GuidedTemplateOverrides { + export interface Raw { + instructions?: TemplateInstructions.Raw | null; + sections?: GuidedSectionOverride.Raw[] | null; + } +} diff --git a/src/serialization/types/GuidedTemplateRef.ts b/src/serialization/types/GuidedTemplateRef.ts new file mode 100644 index 00000000..b8b1744c --- /dev/null +++ b/src/serialization/types/GuidedTemplateRef.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { GuidedTemplateOverrides } from "./GuidedTemplateOverrides.js"; + +export const GuidedTemplateRef: core.serialization.ObjectSchema< + serializers.GuidedTemplateRef.Raw, + Corti.GuidedTemplateRef +> = core.serialization.object({ + templateId: core.serialization.string(), + templateVersionId: core.serialization.string().optionalNullable(), + overrides: GuidedTemplateOverrides.optional(), +}); + +export declare namespace GuidedTemplateRef { + export interface Raw { + templateId: string; + templateVersionId?: (string | null | undefined) | null; + overrides?: GuidedTemplateOverrides.Raw | null; + } +} diff --git a/src/serialization/types/NumberNode.ts b/src/serialization/types/NumberNode.ts new file mode 100644 index 00000000..10474663 --- /dev/null +++ b/src/serialization/types/NumberNode.ts @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const NumberNode: core.serialization.ObjectSchema = + core.serialization.object({ + type: core.serialization.stringLiteral("number"), + description: core.serialization.string().optional(), + default: core.serialization.number().optionalNullable(), + enum: core.serialization.list(core.serialization.number()).optional(), + minimum: core.serialization.number().optionalNullable(), + maximum: core.serialization.number().optionalNullable(), + }); + +export declare namespace NumberNode { + export interface Raw { + type: "number"; + description?: string | null; + default?: (number | null | undefined) | null; + enum?: number[] | null; + minimum?: (number | null | undefined) | null; + maximum?: (number | null | undefined) | null; + } +} diff --git a/src/serialization/types/ObjectNode.ts b/src/serialization/types/ObjectNode.ts new file mode 100644 index 00000000..ee8a6e62 --- /dev/null +++ b/src/serialization/types/ObjectNode.ts @@ -0,0 +1,24 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import * as serializers from "../index.js"; + +export const ObjectNode: core.serialization.ObjectSchema = + core.serialization.object({ + type: core.serialization.stringLiteral("object"), + description: core.serialization.string().optional(), + subheadingFormat: core.serialization.string().optional(), + objectFormat: core.serialization.string().optional(), + fields: core.serialization.list(core.serialization.lazyObject(() => serializers.FieldDefinition)).optional(), + }); + +export declare namespace ObjectNode { + export interface Raw { + type: "object"; + description?: string | null; + subheadingFormat?: string | null; + objectFormat?: string | null; + fields?: serializers.FieldDefinition.Raw[] | null; + } +} diff --git a/src/serialization/types/OutputSchema.ts b/src/serialization/types/OutputSchema.ts new file mode 100644 index 00000000..02f2e117 --- /dev/null +++ b/src/serialization/types/OutputSchema.ts @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import * as serializers from "../index.js"; +import { BoolNode } from "./BoolNode.js"; +import { NumberNode } from "./NumberNode.js"; +import { StringNode } from "./StringNode.js"; + +export const OutputSchema: core.serialization.Schema = + core.serialization.undiscriminatedUnion([ + StringNode, + NumberNode, + BoolNode, + core.serialization.lazyObject(() => serializers.ObjectNode), + core.serialization.lazyObject(() => serializers.ArrayNode), + ]); + +export declare namespace OutputSchema { + export type Raw = + | StringNode.Raw + | NumberNode.Raw + | BoolNode.Raw + | serializers.ObjectNode.Raw + | serializers.ArrayNode.Raw; +} diff --git a/src/serialization/types/Section.ts b/src/serialization/types/Section.ts new file mode 100644 index 00000000..fe070ce9 --- /dev/null +++ b/src/serialization/types/Section.ts @@ -0,0 +1,35 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { SectionVersion } from "./SectionVersion.js"; + +export const Section: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + inheritedFromId: core.serialization.string().optionalNullable(), + autoGenerated: core.serialization.boolean().optional(), + name: core.serialization.string(), + language: core.serialization.string(), + description: core.serialization.string().optional(), + labels: core.serialization.list(core.serialization.string()), + publishedVersion: SectionVersion.optional(), + createdAt: core.serialization.date(), + updatedAt: core.serialization.date(), + }); + +export declare namespace Section { + export interface Raw { + id: string; + inheritedFromId?: (string | null | undefined) | null; + autoGenerated?: boolean | null; + name: string; + language: string; + description?: string | null; + labels: string[]; + publishedVersion?: SectionVersion.Raw | null; + createdAt: string; + updatedAt: string; + } +} diff --git a/src/serialization/types/SectionGeneration.ts b/src/serialization/types/SectionGeneration.ts new file mode 100644 index 00000000..bb0a909a --- /dev/null +++ b/src/serialization/types/SectionGeneration.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import * as serializers from "../index.js"; +import { SectionInstructions } from "./SectionInstructions.js"; + +export const SectionGeneration: core.serialization.ObjectSchema< + serializers.SectionGeneration.Raw, + Corti.SectionGeneration +> = core.serialization.object({ + heading: core.serialization.string(), + instructions: SectionInstructions, + outputSchema: core.serialization.lazy(() => serializers.OutputSchema), +}); + +export declare namespace SectionGeneration { + export interface Raw { + heading: string; + instructions: SectionInstructions.Raw; + outputSchema: serializers.OutputSchema.Raw; + } +} diff --git a/src/serialization/types/SectionGenerationPartial.ts b/src/serialization/types/SectionGenerationPartial.ts new file mode 100644 index 00000000..1e16a7be --- /dev/null +++ b/src/serialization/types/SectionGenerationPartial.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import * as serializers from "../index.js"; +import { SectionInstructionsPartial } from "./SectionInstructionsPartial.js"; + +export const SectionGenerationPartial: core.serialization.ObjectSchema< + serializers.SectionGenerationPartial.Raw, + Corti.SectionGenerationPartial +> = core.serialization.object({ + heading: core.serialization.string().optional(), + instructions: SectionInstructionsPartial.optional(), + outputSchema: core.serialization.lazy(() => serializers.OutputSchema).optional(), +}); + +export declare namespace SectionGenerationPartial { + export interface Raw { + heading?: string | null; + instructions?: SectionInstructionsPartial.Raw | null; + outputSchema?: serializers.OutputSchema.Raw | null; + } +} diff --git a/src/serialization/types/SectionInstructions.ts b/src/serialization/types/SectionInstructions.ts new file mode 100644 index 00000000..a1e097a4 --- /dev/null +++ b/src/serialization/types/SectionInstructions.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const SectionInstructions: core.serialization.ObjectSchema< + serializers.SectionInstructions.Raw, + Corti.SectionInstructions +> = core.serialization.object({ + contentPrompt: core.serialization.string(), + writingStylePrompt: core.serialization.string().optional(), + miscPrompt: core.serialization.string().optional(), +}); + +export declare namespace SectionInstructions { + export interface Raw { + contentPrompt: string; + writingStylePrompt?: string | null; + miscPrompt?: string | null; + } +} diff --git a/src/serialization/types/SectionInstructionsOverride.ts b/src/serialization/types/SectionInstructionsOverride.ts new file mode 100644 index 00000000..d33fa8d7 --- /dev/null +++ b/src/serialization/types/SectionInstructionsOverride.ts @@ -0,0 +1,20 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const SectionInstructionsOverride: core.serialization.ObjectSchema< + serializers.SectionInstructionsOverride.Raw, + Corti.SectionInstructionsOverride +> = core.serialization.object({ + contentPrompt: core.serialization.string().optional(), + writingStylePrompt: core.serialization.string().optional(), +}); + +export declare namespace SectionInstructionsOverride { + export interface Raw { + contentPrompt?: string | null; + writingStylePrompt?: string | null; + } +} diff --git a/src/serialization/types/SectionInstructionsPartial.ts b/src/serialization/types/SectionInstructionsPartial.ts new file mode 100644 index 00000000..50833a45 --- /dev/null +++ b/src/serialization/types/SectionInstructionsPartial.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const SectionInstructionsPartial: core.serialization.ObjectSchema< + serializers.SectionInstructionsPartial.Raw, + Corti.SectionInstructionsPartial +> = core.serialization.object({ + contentPrompt: core.serialization.string().optional(), + writingStylePrompt: core.serialization.string().optional(), + miscPrompt: core.serialization.string().optional(), +}); + +export declare namespace SectionInstructionsPartial { + export interface Raw { + contentPrompt?: string | null; + writingStylePrompt?: string | null; + miscPrompt?: string | null; + } +} diff --git a/src/serialization/types/SectionOverrides.ts b/src/serialization/types/SectionOverrides.ts new file mode 100644 index 00000000..5fcb6700 --- /dev/null +++ b/src/serialization/types/SectionOverrides.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import * as serializers from "../index.js"; +import { SectionInstructionsOverride } from "./SectionInstructionsOverride.js"; + +export const SectionOverrides: core.serialization.ObjectSchema< + serializers.SectionOverrides.Raw, + Corti.SectionOverrides +> = core.serialization.object({ + title: core.serialization.string().optionalNullable(), + instructions: SectionInstructionsOverride.optional(), + outputSchema: core.serialization.lazy(() => serializers.OutputSchema).optional(), +}); + +export declare namespace SectionOverrides { + export interface Raw { + title?: (string | null | undefined) | null; + instructions?: SectionInstructionsOverride.Raw | null; + outputSchema?: serializers.OutputSchema.Raw | null; + } +} diff --git a/src/serialization/types/SectionVersion.ts b/src/serialization/types/SectionVersion.ts new file mode 100644 index 00000000..8809bb35 --- /dev/null +++ b/src/serialization/types/SectionVersion.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { SectionGeneration } from "./SectionGeneration.js"; + +export const SectionVersion: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + versionNumber: core.serialization.number(), + generation: SectionGeneration, + }); + +export declare namespace SectionVersion { + export interface Raw { + id: string; + versionNumber: number; + generation: SectionGeneration.Raw; + } +} diff --git a/src/serialization/types/StatusResponse.ts b/src/serialization/types/StatusResponse.ts new file mode 100644 index 00000000..e3d3dbe6 --- /dev/null +++ b/src/serialization/types/StatusResponse.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const StatusResponse: core.serialization.ObjectSchema = + core.serialization.object({ + status: core.serialization.string(), + }); + +export declare namespace StatusResponse { + export interface Raw { + status: string; + } +} diff --git a/src/serialization/types/StringNode.ts b/src/serialization/types/StringNode.ts new file mode 100644 index 00000000..3bd5d85a --- /dev/null +++ b/src/serialization/types/StringNode.ts @@ -0,0 +1,24 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const StringNode: core.serialization.ObjectSchema = + core.serialization.object({ + type: core.serialization.stringLiteral("string"), + description: core.serialization.string().optional(), + default: core.serialization.string().optionalNullable(), + enum: core.serialization.list(core.serialization.string()).optional(), + pattern: core.serialization.string().optionalNullable(), + }); + +export declare namespace StringNode { + export interface Raw { + type: "string"; + description?: string | null; + default?: (string | null | undefined) | null; + enum?: string[] | null; + pattern?: (string | null | undefined) | null; + } +} diff --git a/src/serialization/types/Template.ts b/src/serialization/types/Template.ts new file mode 100644 index 00000000..b3814a1a --- /dev/null +++ b/src/serialization/types/Template.ts @@ -0,0 +1,35 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { TemplateVersion } from "./TemplateVersion.js"; + +export const Template: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + inheritedFromId: core.serialization.string().optionalNullable(), + autoGenerated: core.serialization.boolean().optional(), + name: core.serialization.string(), + description: core.serialization.string().optional(), + language: core.serialization.string(), + labels: core.serialization.list(core.serialization.string()), + publishedVersion: TemplateVersion.optional(), + createdAt: core.serialization.date(), + updatedAt: core.serialization.date(), + }); + +export declare namespace Template { + export interface Raw { + id: string; + inheritedFromId?: (string | null | undefined) | null; + autoGenerated?: boolean | null; + name: string; + description?: string | null; + language: string; + labels: string[]; + publishedVersion?: TemplateVersion.Raw | null; + createdAt: string; + updatedAt: string; + } +} diff --git a/src/serialization/types/TemplateGeneration.ts b/src/serialization/types/TemplateGeneration.ts new file mode 100644 index 00000000..d7d02886 --- /dev/null +++ b/src/serialization/types/TemplateGeneration.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { Section } from "./Section.js"; +import { TemplateInstructions } from "./TemplateInstructions.js"; + +export const TemplateGeneration: core.serialization.ObjectSchema< + serializers.TemplateGeneration.Raw, + Corti.TemplateGeneration +> = core.serialization.object({ + instructions: TemplateInstructions, + sections: core.serialization.list(Section).optional(), +}); + +export declare namespace TemplateGeneration { + export interface Raw { + instructions: TemplateInstructions.Raw; + sections?: Section.Raw[] | null; + } +} diff --git a/src/serialization/types/TemplateInstructions.ts b/src/serialization/types/TemplateInstructions.ts new file mode 100644 index 00000000..ac302df9 --- /dev/null +++ b/src/serialization/types/TemplateInstructions.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const TemplateInstructions: core.serialization.ObjectSchema< + serializers.TemplateInstructions.Raw, + Corti.TemplateInstructions +> = core.serialization.object({ + prompt: core.serialization.string(), +}); + +export declare namespace TemplateInstructions { + export interface Raw { + prompt: string; + } +} diff --git a/src/serialization/types/TemplateInstructionsPartial.ts b/src/serialization/types/TemplateInstructionsPartial.ts new file mode 100644 index 00000000..fe069434 --- /dev/null +++ b/src/serialization/types/TemplateInstructionsPartial.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const TemplateInstructionsPartial: core.serialization.ObjectSchema< + serializers.TemplateInstructionsPartial.Raw, + Corti.TemplateInstructionsPartial +> = core.serialization.object({ + prompt: core.serialization.string().optional(), +}); + +export declare namespace TemplateInstructionsPartial { + export interface Raw { + prompt?: string | null; + } +} diff --git a/src/serialization/types/TemplateVersion.ts b/src/serialization/types/TemplateVersion.ts new file mode 100644 index 00000000..cabcb3cd --- /dev/null +++ b/src/serialization/types/TemplateVersion.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { TemplateGeneration } from "./TemplateGeneration.js"; + +export const TemplateVersion: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + versionNumber: core.serialization.number(), + generation: TemplateGeneration, + }); + +export declare namespace TemplateVersion { + export interface Raw { + id: string; + versionNumber: number; + generation: TemplateGeneration.Raw; + } +} diff --git a/src/serialization/types/TemplateVersionSectionRequest.ts b/src/serialization/types/TemplateVersionSectionRequest.ts new file mode 100644 index 00000000..25a818c3 --- /dev/null +++ b/src/serialization/types/TemplateVersionSectionRequest.ts @@ -0,0 +1,20 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const TemplateVersionSectionRequest: core.serialization.ObjectSchema< + serializers.TemplateVersionSectionRequest.Raw, + Corti.TemplateVersionSectionRequest +> = core.serialization.object({ + sectionId: core.serialization.string(), + orderIndex: core.serialization.number().optional(), +}); + +export declare namespace TemplateVersionSectionRequest { + export interface Raw { + sectionId: string; + orderIndex?: number | null; + } +} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 66b9b853..26bc8fc4 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -22,7 +22,6 @@ export * from "./AgentsCreateMcpServerAuthorizationType.js"; export * from "./AgentsCreateMcpServerTransportType.js"; export * from "./AgentsDataPart.js"; export * from "./AgentsDataPartKind.js"; -export * from "./AgentsErrorResponse.js"; export * from "./AgentsExpert.js"; export * from "./AgentsExpertReference.js"; export * from "./AgentsExpertReferenceType.js"; @@ -53,15 +52,14 @@ export * from "./AgentsTaskStatusState.js"; export * from "./AgentsTextPart.js"; export * from "./AgentsTextPartKind.js"; export * from "./AgentsUpdateExpertReference.js"; -export * from "./AgentsValidationError.js"; -export * from "./AgentsValidationErrorErrorsItem.js"; -export * from "./AgentsValidationErrorResponse.js"; +export * from "./ArrayNode.js"; export * from "./AuthTokenRequestAuthorizationCode.js"; export * from "./AuthTokenRequestAuthorizationPkce.js"; export * from "./AuthTokenRequestClientCredentials.js"; export * from "./AuthTokenRequestRefresh.js"; export * from "./AuthTokenRequestRopc.js"; export * from "./AuthTokenResponse.js"; +export * from "./BoolNode.js"; export * from "./CodesFilter.js"; export * from "./CodesGeneralReadResponse.js"; export * from "./CodesGeneralReadResponseAlternativesItem.js"; @@ -78,6 +76,19 @@ export * from "./CommonTextContextType.js"; export * from "./CommonTranscriptRequest.js"; export * from "./CommonTranscriptResponse.js"; export * from "./CommonUsageInfo.js"; +export * from "./ContextFacts.js"; +export * from "./ContextText.js"; +export * from "./ContextTranscript.js"; +export * from "./CreateSectionBase.js"; +export * from "./CreateSectionFromInheritanceRequest.js"; +export * from "./CreateSectionFromScratchRequest.js"; +export * from "./CreateSectionRequest.js"; +export * from "./CreateTemplateBase.js"; +export * from "./CreateTemplateFromInheritanceRequest.js"; +export * from "./CreateTemplateFromInheritanceRequestGeneration.js"; +export * from "./CreateTemplateFromScratchRequest.js"; +export * from "./CreateTemplateFromScratchRequestGeneration.js"; +export * from "./CreateTemplateRequest.js"; export * from "./DocumentsContext.js"; export * from "./DocumentsContextWithFacts.js"; export * from "./DocumentsContextWithFactsType.js"; @@ -113,6 +124,27 @@ export * from "./FactsFactGroupsListResponse.js"; export * from "./FactsListItem.js"; export * from "./FactsListResponse.js"; export * from "./FactsUpdateResponse.js"; +export * from "./FieldDefinition.js"; +export * from "./GuidedAssemblyRequest.js"; +export * from "./GuidedAssemblySectionRef.js"; +export * from "./GuidedDocumentByAssembly.js"; +export * from "./GuidedDocumentByDynamic.js"; +export * from "./GuidedDocumentByTemplateRef.js"; +export * from "./GuidedDocumentContext.js"; +export * from "./GuidedDocumentFactMinimal.js"; +export * from "./GuidedDocumentRequest.js"; +export * from "./GuidedDocumentResponse.js"; +export * from "./GuidedDocumentTranscriptMetadataMinimal.js"; +export * from "./GuidedDocumentTranscriptMinimal.js"; +export * from "./GuidedDocumentTranscriptSegmentMinimal.js"; +export * from "./GuidedDynamicInline.js"; +export * from "./GuidedDynamicRequest.js"; +export * from "./GuidedGenerationResult.js"; +export * from "./GuidedGenerationResultUsage.js"; +export * from "./GuidedGenerationResultUsageTokenCount.js"; +export * from "./GuidedSectionOverride.js"; +export * from "./GuidedTemplateOverrides.js"; +export * from "./GuidedTemplateRef.js"; export * from "./InteractionsCreateResponse.js"; export * from "./InteractionsEncounterCreateRequest.js"; export * from "./InteractionsEncounterPeriod.js"; @@ -124,9 +156,21 @@ export * from "./InteractionsGenderEnum.js"; export * from "./InteractionsGetResponse.js"; export * from "./InteractionsListResponse.js"; export * from "./InteractionsPatient.js"; +export * from "./NumberNode.js"; export * from "./OAuthTokenRequest.js"; +export * from "./ObjectNode.js"; +export * from "./OutputSchema.js"; export * from "./RecordingsCreateResponse.js"; export * from "./RecordingsListResponse.js"; +export * from "./Section.js"; +export * from "./SectionGeneration.js"; +export * from "./SectionGenerationPartial.js"; +export * from "./SectionInstructions.js"; +export * from "./SectionInstructionsOverride.js"; +export * from "./SectionInstructionsPartial.js"; +export * from "./SectionOverrides.js"; +export * from "./SectionVersion.js"; +export * from "./StatusResponse.js"; export * from "./StreamConfig.js"; export * from "./StreamConfigMessage.js"; export * from "./StreamConfigMode.js"; @@ -152,6 +196,11 @@ export * from "./StreamTranscript.js"; export * from "./StreamTranscriptMessage.js"; export * from "./StreamTranscriptTime.js"; export * from "./StreamUsageMessage.js"; +export * from "./StringNode.js"; +export * from "./Template.js"; +export * from "./TemplateGeneration.js"; +export * from "./TemplateInstructions.js"; +export * from "./TemplateInstructionsPartial.js"; export * from "./TemplatesDocumentationModeEnum.js"; export * from "./TemplatesFormatRule.js"; export * from "./TemplatesItem.js"; @@ -162,6 +211,8 @@ export * from "./TemplatesSectionSorted.js"; export * from "./TemplatesSectionTranslation.js"; export * from "./TemplatesTranslation.js"; export * from "./TemplatesWritingStyle.js"; +export * from "./TemplateVersion.js"; +export * from "./TemplateVersionSectionRequest.js"; export * from "./TranscribeCommand.js"; export * from "./TranscribeCommandData.js"; export * from "./TranscribeCommandMessage.js"; diff --git a/tests/wire/agents.test.ts b/tests/wire/agents.test.ts index acd362e9..a041e8c1 100644 --- a/tests/wire/agents.test.ts +++ b/tests/wire/agents.test.ts @@ -276,7 +276,7 @@ describe("AgentsClient", () => { environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, }); const rawRequestBody = { name: "name", description: "description" }; - const rawResponseBody = { code: "code", description: "description" }; + const rawResponseBody = { key: "value" }; server .mockEndpoint() @@ -717,7 +717,7 @@ describe("AgentsClient", () => { environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, }); const rawRequestBody = {}; - const rawResponseBody = { code: "code", description: "description" }; + const rawResponseBody = { key: "value" }; server .mockEndpoint() @@ -1332,7 +1332,7 @@ describe("AgentsClient", () => { kind: "message", }, }; - const rawResponseBody = { code: "code", description: "description" }; + const rawResponseBody = { key: "value" }; server .mockEndpoint() @@ -1793,6 +1793,7 @@ describe("AgentsClient", () => { displayDescription: "displayDescription", description: "description", mcpServers: [{ name: "name", authorizationType: "none" }], + configSchema: { key: "value" }, }, ], }; @@ -1822,6 +1823,9 @@ describe("AgentsClient", () => { authorizationType: "none", }, ], + configSchema: { + key: "value", + }, }, ], }); @@ -1893,7 +1897,7 @@ describe("AgentsClient", () => { environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, }); - const rawResponseBody = { code: "code", description: "description" }; + const rawResponseBody = { key: "value" }; server .mockEndpoint() diff --git a/tests/wire/documents.test.ts b/tests/wire/documents.test.ts index 0e11d839..1c5efa82 100644 --- a/tests/wire/documents.test.ts +++ b/tests/wire/documents.test.ts @@ -1012,4 +1012,183 @@ describe("DocumentsClient", () => { return await client.documents.update("id", "documentId"); }).rejects.toThrow(Corti.GatewayTimeoutError); }); + + test("generate (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { templateRef: { templateId: "templateId" }, outputLanguage: "outputLanguage" }; + const rawResponseBody = { + templateId: "templateId", + templateVersionId: "templateVersionId", + result: { stringDocument: { key: "value" }, structuredDocument: { key: "value" } }, + }; + + server + .mockEndpoint() + .post("/documents/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.generate({ + templateRef: { + templateId: "templateId", + }, + outputLanguage: "outputLanguage", + }); + expect(response).toEqual({ + templateId: "templateId", + templateVersionId: "templateVersionId", + result: { + stringDocument: { + key: "value", + }, + structuredDocument: { + key: "value", + }, + }, + }); + }); + + test("generate (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { templateRef: { templateId: "templateId" }, outputLanguage: "outputLanguage" }; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .post("/documents/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.generate({ + templateRef: { + templateId: "templateId", + }, + outputLanguage: "outputLanguage", + }); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("generate (3)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { templateRef: { templateId: "templateId" }, outputLanguage: "outputLanguage" }; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .post("/documents/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.generate({ + templateRef: { + templateId: "templateId", + }, + outputLanguage: "outputLanguage", + }); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("generate (4)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { templateRef: { templateId: "templateId" }, outputLanguage: "outputLanguage" }; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .post("/documents/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(422) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.generate({ + templateRef: { + templateId: "templateId", + }, + outputLanguage: "outputLanguage", + }); + }).rejects.toThrow(Corti.UnprocessableEntityError); + }); + + test("generate (5)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { templateRef: { templateId: "templateId" }, outputLanguage: "outputLanguage" }; + const rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + + server + .mockEndpoint() + .post("/documents/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(502) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.generate({ + templateRef: { + templateId: "templateId", + }, + outputLanguage: "outputLanguage", + }); + }).rejects.toThrow(Corti.BadGatewayError); + }); }); diff --git a/tests/wire/documents/sections.test.ts b/tests/wire/documents/sections.test.ts new file mode 100644 index 00000000..e955dc22 --- /dev/null +++ b/tests/wire/documents/sections.test.ts @@ -0,0 +1,482 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Corti from "../../../src/api/index"; +import { CortiClient } from "../../../src/Client"; +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { mockOAuth } from "../mockAuth"; + +describe("SectionsClient", () => { + test("list", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = [ + { + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + language: "language", + description: "description", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ]; + + server + .mockEndpoint() + .get("/documents/sections/") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.sections.list(); + expect(response).toEqual([ + { + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + language: "language", + description: "description", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ]); + }); + + test("create (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + name: "name", + language: "language", + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }; + const rawResponseBody = { + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + language: "language", + description: "description", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }; + + server + .mockEndpoint() + .post("/documents/sections/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.sections.create({ + name: "name", + language: "language", + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }); + expect(response).toEqual({ + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + language: "language", + description: "description", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }); + }); + + test("create (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + name: "name", + language: "language", + }; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .post("/documents/sections/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.sections.create({ + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + name: "name", + language: "language", + }); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("get (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + language: "language", + description: "description", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }; + + server + .mockEndpoint() + .get("/documents/sections/sectionID") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.sections.get("sectionID"); + expect(response).toEqual({ + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + language: "language", + description: "description", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }); + }); + + test("get (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .get("/documents/sections/sectionID") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.sections.get("sectionID"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("delete (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + server.mockEndpoint().delete("/documents/sections/sectionID").respondWith().statusCode(200).build(); + + const response = await client.documents.sections.delete("sectionID"); + expect(response).toEqual(undefined); + }); + + test("delete (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .delete("/documents/sections/sectionID") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.sections.delete("sectionID"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("update (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + language: "language", + description: "description", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }; + + server + .mockEndpoint() + .patch("/documents/sections/sectionID") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.sections.update("sectionID"); + expect(response).toEqual({ + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + language: "language", + description: "description", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }); + }); + + test("update (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .patch("/documents/sections/sectionID") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.sections.update("sectionID"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("update (3)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .patch("/documents/sections/sectionID") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.sections.update("sectionID"); + }).rejects.toThrow(Corti.NotFoundError); + }); +}); diff --git a/tests/wire/documents/sections/versions.test.ts b/tests/wire/documents/sections/versions.test.ts new file mode 100644 index 00000000..31e9dae2 --- /dev/null +++ b/tests/wire/documents/sections/versions.test.ts @@ -0,0 +1,434 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Corti from "../../../../src/api/index"; +import { CortiClient } from "../../../../src/Client"; +import { mockServerPool } from "../../../mock-server/MockServerPool"; +import { mockOAuth } from "../../mockAuth"; + +describe("VersionsClient", () => { + test("list (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = [ + { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + ]; + + server + .mockEndpoint() + .get("/documents/sections/sectionID/versions/") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.sections.versions.list("sectionID"); + expect(response).toEqual([ + { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }, + ]); + }); + + test("list (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .get("/documents/sections/sectionID/versions/") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.sections.versions.list("sectionID"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("create (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }; + const rawResponseBody = { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + writingStylePrompt: "writingStylePrompt", + miscPrompt: "miscPrompt", + }, + outputSchema: { + type: "string", + description: "description", + default: "default", + enum: ["enum"], + pattern: "pattern", + }, + }, + }; + + server + .mockEndpoint() + .post("/documents/sections/sectionID/versions/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.sections.versions.create("sectionID", { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }); + expect(response).toEqual({ + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + writingStylePrompt: "writingStylePrompt", + miscPrompt: "miscPrompt", + }, + outputSchema: { + type: "string", + description: "description", + default: "default", + enum: ["enum"], + pattern: "pattern", + }, + }, + }); + }); + + test("create (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .post("/documents/sections/sectionID/versions/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.sections.versions.create("sectionID", { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("create (3)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .post("/documents/sections/sectionID/versions/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.sections.versions.create("sectionID", { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("get (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + writingStylePrompt: "writingStylePrompt", + miscPrompt: "miscPrompt", + }, + outputSchema: { + type: "string", + description: "description", + default: "default", + enum: ["enum"], + pattern: "pattern", + }, + }, + }; + + server + .mockEndpoint() + .get("/documents/sections/sectionID/versions/versionID") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.sections.versions.get("sectionID", "versionID"); + expect(response).toEqual({ + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + writingStylePrompt: "writingStylePrompt", + miscPrompt: "miscPrompt", + }, + outputSchema: { + type: "string", + description: "description", + default: "default", + enum: ["enum"], + pattern: "pattern", + }, + }, + }); + }); + + test("get (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .get("/documents/sections/sectionID/versions/versionID") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.sections.versions.get("sectionID", "versionID"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("delete (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + server + .mockEndpoint() + .delete("/documents/sections/sectionID/versions/versionID") + .respondWith() + .statusCode(200) + .build(); + + const response = await client.documents.sections.versions.delete("sectionID", "versionID"); + expect(response).toEqual(undefined); + }); + + test("delete (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .delete("/documents/sections/sectionID/versions/versionID") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.sections.versions.delete("sectionID", "versionID"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("publish (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { status: "published" }; + + server + .mockEndpoint() + .post("/documents/sections/sectionID/versions/versionID/publish") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.sections.versions.publish("sectionID", "versionID"); + expect(response).toEqual({ + status: "published", + }); + }); + + test("publish (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .post("/documents/sections/sectionID/versions/versionID/publish") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.sections.versions.publish("sectionID", "versionID"); + }).rejects.toThrow(Corti.NotFoundError); + }); +}); diff --git a/tests/wire/documents/templates.test.ts b/tests/wire/documents/templates.test.ts new file mode 100644 index 00000000..fe858ecb --- /dev/null +++ b/tests/wire/documents/templates.test.ts @@ -0,0 +1,610 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Corti from "../../../src/api/index"; +import { CortiClient } from "../../../src/Client"; +import { mockServerPool } from "../../mock-server/MockServerPool"; +import { mockOAuth } from "../mockAuth"; + +describe("TemplatesClient", () => { + test("list", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = [ + { + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + description: "description", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ]; + + server + .mockEndpoint() + .get("/documents/templates/") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.templates.list(); + expect(response).toEqual([ + { + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + description: "description", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ]); + }); + + test("create (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + name: "name", + language: "language", + generation: { instructions: { prompt: "prompt" } }, + }; + const rawResponseBody = { + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + description: "description", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }; + + server + .mockEndpoint() + .post("/documents/templates/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.templates.create({ + name: "name", + language: "language", + generation: { + instructions: { + prompt: "prompt", + }, + }, + }); + expect(response).toEqual({ + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + description: "description", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }); + }); + + test("create (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { + generation: { instructions: { prompt: "prompt" } }, + name: "name", + language: "language", + }; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .post("/documents/templates/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.templates.create({ + generation: { + instructions: { + prompt: "prompt", + }, + }, + name: "name", + language: "language", + }); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("get (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + description: "description", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }; + + server + .mockEndpoint() + .get("/documents/templates/templateID") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.templates.get("templateID"); + expect(response).toEqual({ + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + description: "description", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }); + }); + + test("get (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .get("/documents/templates/templateID") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.templates.get("templateID"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("delete (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + server.mockEndpoint().delete("/documents/templates/templateID").respondWith().statusCode(200).build(); + + const response = await client.documents.templates.delete("templateID"); + expect(response).toEqual(undefined); + }); + + test("delete (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .delete("/documents/templates/templateID") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.templates.delete("templateID"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("update (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + description: "description", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }; + + server + .mockEndpoint() + .patch("/documents/templates/templateID") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.templates.update("templateID"); + expect(response).toEqual({ + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + name: "name", + description: "description", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }); + }); + + test("update (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .patch("/documents/templates/templateID") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.templates.update("templateID"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("update (3)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .patch("/documents/templates/templateID") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.templates.update("templateID"); + }).rejects.toThrow(Corti.NotFoundError); + }); +}); diff --git a/tests/wire/documents/templates/versions.test.ts b/tests/wire/documents/templates/versions.test.ts new file mode 100644 index 00000000..9190673d --- /dev/null +++ b/tests/wire/documents/templates/versions.test.ts @@ -0,0 +1,492 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Corti from "../../../../src/api/index"; +import { CortiClient } from "../../../../src/Client"; +import { mockServerPool } from "../../../mock-server/MockServerPool"; +import { mockOAuth } from "../../mockAuth"; + +describe("VersionsClient", () => { + test("list (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = [ + { + id: "id", + versionNumber: 1, + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + }, + }, + ]; + + server + .mockEndpoint() + .get("/documents/templates/templateID/versions/") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.templates.versions.list("templateID"); + expect(response).toEqual([ + { + id: "id", + versionNumber: 1, + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + }, + }, + ]); + }); + + test("list (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .get("/documents/templates/templateID/versions/") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.templates.versions.list("templateID"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("create (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { generation: { instructions: { prompt: "prompt" } } }; + const rawResponseBody = { + id: "id", + versionNumber: 1, + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + }, + }; + + server + .mockEndpoint() + .post("/documents/templates/templateID/versions/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.templates.versions.create("templateID", { + generation: { + instructions: { + prompt: "prompt", + }, + }, + }); + expect(response).toEqual({ + id: "id", + versionNumber: 1, + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + }, + }); + }); + + test("create (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { generation: { instructions: { prompt: "prompt" } } }; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .post("/documents/templates/templateID/versions/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.templates.versions.create("templateID", { + generation: { + instructions: { + prompt: "prompt", + }, + }, + }); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("create (3)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + const rawRequestBody = { generation: { instructions: { prompt: "prompt" } } }; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .post("/documents/templates/templateID/versions/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.templates.versions.create("templateID", { + generation: { + instructions: { + prompt: "prompt", + }, + }, + }); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("get (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { + id: "id", + versionNumber: 1, + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + }, + }; + + server + .mockEndpoint() + .get("/documents/templates/templateID/versions/versionID") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.templates.versions.get("templateID", "versionID"); + expect(response).toEqual({ + id: "id", + versionNumber: 1, + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + language: "language", + labels: ["labels"], + publishedVersion: { + id: "id", + versionNumber: 1, + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + }, + }); + }); + + test("get (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .get("/documents/templates/templateID/versions/versionID") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.templates.versions.get("templateID", "versionID"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("delete (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + server + .mockEndpoint() + .delete("/documents/templates/templateID/versions/versionID") + .respondWith() + .statusCode(200) + .build(); + + const response = await client.documents.templates.versions.delete("templateID", "versionID"); + expect(response).toEqual(undefined); + }); + + test("delete (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .delete("/documents/templates/templateID/versions/versionID") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.templates.versions.delete("templateID", "versionID"); + }).rejects.toThrow(Corti.NotFoundError); + }); + + test("publish (1)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { status: "published" }; + + server + .mockEndpoint() + .post("/documents/templates/templateID/versions/versionID/publish") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.templates.versions.publish("templateID", "versionID"); + expect(response).toEqual({ + status: "published", + }); + }); + + test("publish (2)", async () => { + const server = mockServerPool.createServer(); + mockOAuth(server); + + const client = new CortiClient({ + maxRetries: 0, + clientId: "client_id", + clientSecret: "client_secret", + tenantName: "test", + environment: { base: server.baseUrl, wss: server.baseUrl, login: server.baseUrl, agents: server.baseUrl }, + }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .post("/documents/templates/templateID/versions/versionID/publish") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.templates.versions.publish("templateID", "versionID"); + }).rejects.toThrow(Corti.NotFoundError); + }); +});