From 7891ffa0c2f173e070300101266ad05123da846f Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 15:07:48 +0000 Subject: [PATCH 1/2] SDK regeneration --- .fern/metadata.json | 8 +- pnpm-lock.yaml | 8 +- src/api/errors/ConflictError.ts | 22 + src/api/errors/UnprocessableEntityError.ts | 3 +- src/api/errors/index.ts | 1 + src/api/resources/agents/client/Client.ts | 44 +- src/api/resources/documents/client/Client.ts | 126 +++ src/api/resources/documents/index.ts | 1 + .../resources/documents/resources/index.ts | 4 + .../resources/sections/client/Client.ts | 432 ++++++++++ .../resources/sections/client/index.ts | 1 + .../requests/GuidedSectionsUpdateRequest.ts | 16 + .../client/requests/ListSectionsRequest.ts | 18 + .../sections/client/requests/index.ts | 2 + .../documents/resources/sections/index.ts | 2 + .../resources/sections/resources/index.ts | 2 + .../resources/versions/client/Client.ts | 433 ++++++++++ .../resources/versions/client/index.ts | 1 + .../GuidedSectionsCreateVersionRequest.ts | 21 + .../versions/client/requests/index.ts | 1 + .../sections/resources/versions/index.ts | 1 + .../resources/templates/client/Client.ts | 428 +++++++++ .../resources/templates/client/index.ts | 1 + .../requests/GuidedTemplatesUpdateRequest.ts | 16 + .../client/requests/ListTemplatesRequest.ts | 18 + .../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 + .../GuidedTemplatesCreateVersionRequest.ts | 17 + .../versions/client/requests/index.ts | 1 + .../templates/resources/versions/index.ts | 2 + ...TemplatesCreateVersionRequestGeneration.ts | 8 + .../resources/versions/types/index.ts | 1 + .../client/requests/FactsExtractRequest.ts | 2 +- src/api/resources/stream/client/Socket.ts | 3 +- src/api/resources/templates/client/Client.ts | 12 +- ...ListRequest.ts => ListTemplatesRequest.ts} | 2 +- ...uest.ts => SectionListTemplatesRequest.ts} | 2 +- .../templates/client/requests/index.ts | 4 +- src/api/resources/transcribe/client/Socket.ts | 3 +- .../resources/transcripts/client/Client.ts | 2 +- .../requests/TranscriptsCreateRequest.ts | 2 +- 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/CommonStatusResponse.ts | 8 + src/api/types/ContextFacts.ts | 11 + src/api/types/ContextText.ts | 10 + src/api/types/ContextTranscript.ts | 11 + src/api/types/DocumentationEvidence.ts | 9 + .../DocumentsCreateRequestWithTemplate.ts | 2 +- .../DocumentsCreateRequestWithTemplateKey.ts | 2 +- src/api/types/DocumentsGetResponse.ts | 2 +- src/api/types/EphemeralDocument.ts | 14 + src/api/types/FieldDefinition.ts | 11 + src/api/types/GuidedAssemblyRequest.ts | 14 + src/api/types/GuidedAssemblySectionRef.ts | 13 + src/api/types/GuidedDocumentContext.ts | 5 + src/api/types/GuidedDocumentFactMinimal.ts | 9 + ...GuidedDocumentTranscriptMetadataMinimal.ts | 10 + .../types/GuidedDocumentTranscriptMinimal.ts | 11 + .../GuidedDocumentTranscriptSegmentMinimal.ts | 19 + .../GuidedDocumentsCreateEphemeralResponse.ts | 11 + src/api/types/GuidedDocumentsGenerateBase.ts | 15 + .../GuidedDocumentsGenerateByAssembly.ts | 11 + .../types/GuidedDocumentsGenerateByDynamic.ts | 11 + .../GuidedDocumentsGenerateByTemplateRef.ts | 11 + .../types/GuidedDocumentsGenerateRequest.ts | 8 + src/api/types/GuidedDynamicInline.ts | 8 + src/api/types/GuidedDynamicRequest.ts | 11 + src/api/types/GuidedSectionOverride.ts | 12 + src/api/types/GuidedSectionsCreateBase.ts | 20 + ...dedSectionsCreateFromInheritanceRequest.ts | 12 + .../GuidedSectionsCreateFromScratchRequest.ts | 10 + src/api/types/GuidedSectionsCreateRequest.ts | 7 + src/api/types/GuidedTemplateOverrides.ts | 10 + src/api/types/GuidedTemplateRef.ts | 12 + src/api/types/GuidedTemplatesCreateBase.ts | 22 + ...edTemplatesCreateFromInheritanceRequest.ts | 13 + ...sCreateFromInheritanceRequestGeneration.ts | 11 + ...GuidedTemplatesCreateFromScratchRequest.ts | 10 + ...latesCreateFromScratchRequestGeneration.ts | 8 + .../GuidedTemplatesCreatePolicyRequest.ts | 10 + .../GuidedTemplatesCreatePolicyRequestKind.ts | 9 + src/api/types/GuidedTemplatesCreateRequest.ts | 7 + .../GuidedTemplatesVersionSectionRequest.ts | 8 + src/api/types/Label.ts | 6 + src/api/types/NumberNode.ts | 15 + src/api/types/ObjectNode.ts | 15 + src/api/types/OutputSchema.ts | 5 + src/api/types/Section.ts | 34 + src/api/types/SectionGeneration.ts | 11 + src/api/types/SectionGenerationPartial.ts | 15 + src/api/types/SectionInstructions.ts | 10 + src/api/types/SectionInstructionsOverride.ts | 13 + src/api/types/SectionInstructionsPartial.ts | 13 + src/api/types/SectionOverrides.ts | 14 + src/api/types/SectionSource.ts | 8 + src/api/types/SectionVersion.ts | 13 + src/api/types/StreamAudioEventData.ts | 12 + src/api/types/StreamAudioEventDataEvent.ts | 10 + src/api/types/StreamAudioEventMessage.ts | 8 + src/api/types/StreamAudioEventsConfig.ts | 6 + src/api/types/StreamConfig.ts | 1 + src/api/types/StreamConfigMode.ts | 2 + .../StreamConfigModeFactGenerationInterval.ts | 9 + src/api/types/StringNode.ts | 13 + src/api/types/Template.ts | 35 + src/api/types/TemplateGeneration.ts | 9 + src/api/types/TemplateInstructions.ts | 6 + src/api/types/TemplateInstructionsPartial.ts | 9 + src/api/types/TemplatePolicy.ts | 15 + src/api/types/TemplatePolicyKind.ts | 8 + src/api/types/TemplateSource.ts | 8 + src/api/types/TemplateVersion.ts | 13 + src/api/types/TranscribeAudioEventData.ts | 12 + .../types/TranscribeAudioEventDataEvent.ts | 11 + src/api/types/TranscribeAudioEventMessage.ts | 8 + src/api/types/TranscribeAudioEventsConfig.ts | 6 + src/api/types/TranscribeConfig.ts | 1 + src/api/types/index.ts | 75 +- .../resources/documents/index.ts | 1 + .../resources/documents/resources/index.ts | 4 + .../resources/sections/client/index.ts | 2 + .../resources/sections/client/list.ts | 13 + .../requests/GuidedSectionsUpdateRequest.ts | 29 + .../sections/client/requests/index.ts | 1 + .../documents/resources/sections/index.ts | 2 + .../resources/sections/resources/index.ts | 2 + .../resources/versions/client/index.ts | 2 + .../resources/versions/client/list.ts | 15 + .../GuidedSectionsCreateVersionRequest.ts | 19 + .../versions/client/requests/index.ts | 1 + .../sections/resources/versions/index.ts | 1 + .../resources/templates/client/index.ts | 2 + .../resources/templates/client/list.ts | 13 + .../requests/GuidedTemplatesUpdateRequest.ts | 29 + .../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 + .../GuidedTemplatesCreateVersionRequest.ts | 19 + .../versions/client/requests/index.ts | 1 + .../templates/resources/versions/index.ts | 2 + ...TemplatesCreateVersionRequestGeneration.ts | 22 + .../resources/versions/types/index.ts | 1 + .../client/socket/StreamSocketResponse.ts | 6 +- .../client/socket/TranscribeSocketResponse.ts | 6 +- .../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 + .../types/CommonStatusResponse.ts | 21 + src/serialization/types/ContextFacts.ts | 19 + src/serialization/types/ContextText.ts | 18 + src/serialization/types/ContextTranscript.ts | 21 + .../types/DocumentationEvidence.ts | 23 + src/serialization/types/EphemeralDocument.ts | 30 + src/serialization/types/FieldDefinition.ts | 20 + .../types/GuidedAssemblyRequest.ts | 24 + .../types/GuidedAssemblySectionRef.ts | 23 + .../types/GuidedDocumentContext.ts | 17 + .../types/GuidedDocumentFactMinimal.ts | 18 + ...GuidedDocumentTranscriptMetadataMinimal.ts | 19 + .../types/GuidedDocumentTranscriptMinimal.ts | 22 + .../GuidedDocumentTranscriptSegmentMinimal.ts | 28 + .../GuidedDocumentsCreateEphemeralResponse.ts | 22 + .../types/GuidedDocumentsGenerateBase.ts | 23 + .../GuidedDocumentsGenerateByAssembly.ts | 22 + .../types/GuidedDocumentsGenerateByDynamic.ts | 22 + .../GuidedDocumentsGenerateByTemplateRef.ts | 22 + .../types/GuidedDocumentsGenerateRequest.ts | 24 + .../types/GuidedDynamicInline.ts | 22 + .../types/GuidedDynamicRequest.ts | 21 + .../types/GuidedSectionOverride.ts | 21 + .../types/GuidedSectionsCreateBase.ts | 31 + ...dedSectionsCreateFromInheritanceRequest.ts | 24 + .../GuidedSectionsCreateFromScratchRequest.ts | 22 + .../types/GuidedSectionsCreateRequest.ts | 19 + .../types/GuidedTemplateOverrides.ts | 22 + src/serialization/types/GuidedTemplateRef.ts | 23 + .../types/GuidedTemplatesCreateBase.ts | 34 + ...edTemplatesCreateFromInheritanceRequest.ts | 24 + ...sCreateFromInheritanceRequestGeneration.ts | 22 + ...GuidedTemplatesCreateFromScratchRequest.ts | 22 + ...latesCreateFromScratchRequestGeneration.ts | 22 + .../GuidedTemplatesCreatePolicyRequest.ts | 21 + .../GuidedTemplatesCreatePolicyRequestKind.ts | 14 + .../types/GuidedTemplatesCreateRequest.ts | 19 + .../GuidedTemplatesVersionSectionRequest.ts | 20 + src/serialization/types/Label.ts | 17 + src/serialization/types/NumberNode.ts | 26 + src/serialization/types/ObjectNode.ts | 24 + src/serialization/types/OutputSchema.ts | 26 + src/serialization/types/Section.ts | 45 + src/serialization/types/SectionGeneration.ts | 23 + .../types/SectionGenerationPartial.ts | 23 + .../types/SectionInstructions.ts | 22 + .../types/SectionInstructionsOverride.ts | 22 + .../types/SectionInstructionsPartial.ts | 22 + src/serialization/types/SectionOverrides.ts | 23 + src/serialization/types/SectionSource.ts | 12 + src/serialization/types/SectionVersion.ts | 23 + .../types/StreamAudioEventData.ts | 23 + .../types/StreamAudioEventDataEvent.ts | 23 + .../types/StreamAudioEventMessage.ts | 21 + .../types/StreamAudioEventsConfig.ts | 18 + src/serialization/types/StreamConfig.ts | 3 + src/serialization/types/StreamConfigMode.ts | 3 + .../StreamConfigModeFactGenerationInterval.ts | 14 + src/serialization/types/StringNode.ts | 24 + src/serialization/types/Template.ts | 48 ++ src/serialization/types/TemplateGeneration.ts | 22 + .../types/TemplateInstructions.ts | 18 + .../types/TemplateInstructionsPartial.ts | 18 + src/serialization/types/TemplatePolicy.ts | 29 + src/serialization/types/TemplatePolicyKind.ts | 14 + src/serialization/types/TemplateSource.ts | 12 + src/serialization/types/TemplateVersion.ts | 23 + .../types/TranscribeAudioEventData.ts | 23 + .../types/TranscribeAudioEventDataEvent.ts | 23 + .../types/TranscribeAudioEventMessage.ts | 21 + .../types/TranscribeAudioEventsConfig.ts | 18 + src/serialization/types/TranscribeConfig.ts | 3 + src/serialization/types/index.ts | 75 +- tests/wire/agents.test.ts | 12 +- tests/wire/documents.test.ts | 190 ++++ tests/wire/documents/sections.test.ts | 565 ++++++++++++ .../wire/documents/sections/versions.test.ts | 460 ++++++++++ tests/wire/documents/templates.test.ts | 809 ++++++++++++++++++ .../wire/documents/templates/versions.test.ts | 533 ++++++++++++ 245 files changed, 7397 insertions(+), 214 deletions(-) create mode 100644 src/api/errors/ConflictError.ts 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/GuidedSectionsUpdateRequest.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/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/client/requests/GuidedSectionsCreateVersionRequest.ts create mode 100644 src/api/resources/documents/resources/sections/resources/versions/client/requests/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/GuidedTemplatesUpdateRequest.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/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/GuidedTemplatesCreateVersionRequest.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/GuidedTemplatesCreateVersionRequestGeneration.ts create mode 100644 src/api/resources/documents/resources/templates/resources/versions/types/index.ts rename src/api/resources/templates/client/requests/{TemplatesListRequest.ts => ListTemplatesRequest.ts} (88%) rename src/api/resources/templates/client/requests/{TemplatesSectionListRequest.ts => SectionListTemplatesRequest.ts} (84%) 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/CommonStatusResponse.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/DocumentationEvidence.ts create mode 100644 src/api/types/EphemeralDocument.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/GuidedDocumentContext.ts create mode 100644 src/api/types/GuidedDocumentFactMinimal.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/GuidedDocumentsCreateEphemeralResponse.ts create mode 100644 src/api/types/GuidedDocumentsGenerateBase.ts create mode 100644 src/api/types/GuidedDocumentsGenerateByAssembly.ts create mode 100644 src/api/types/GuidedDocumentsGenerateByDynamic.ts create mode 100644 src/api/types/GuidedDocumentsGenerateByTemplateRef.ts create mode 100644 src/api/types/GuidedDocumentsGenerateRequest.ts create mode 100644 src/api/types/GuidedDynamicInline.ts create mode 100644 src/api/types/GuidedDynamicRequest.ts create mode 100644 src/api/types/GuidedSectionOverride.ts create mode 100644 src/api/types/GuidedSectionsCreateBase.ts create mode 100644 src/api/types/GuidedSectionsCreateFromInheritanceRequest.ts create mode 100644 src/api/types/GuidedSectionsCreateFromScratchRequest.ts create mode 100644 src/api/types/GuidedSectionsCreateRequest.ts create mode 100644 src/api/types/GuidedTemplateOverrides.ts create mode 100644 src/api/types/GuidedTemplateRef.ts create mode 100644 src/api/types/GuidedTemplatesCreateBase.ts create mode 100644 src/api/types/GuidedTemplatesCreateFromInheritanceRequest.ts create mode 100644 src/api/types/GuidedTemplatesCreateFromInheritanceRequestGeneration.ts create mode 100644 src/api/types/GuidedTemplatesCreateFromScratchRequest.ts create mode 100644 src/api/types/GuidedTemplatesCreateFromScratchRequestGeneration.ts create mode 100644 src/api/types/GuidedTemplatesCreatePolicyRequest.ts create mode 100644 src/api/types/GuidedTemplatesCreatePolicyRequestKind.ts create mode 100644 src/api/types/GuidedTemplatesCreateRequest.ts create mode 100644 src/api/types/GuidedTemplatesVersionSectionRequest.ts create mode 100644 src/api/types/Label.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/SectionSource.ts create mode 100644 src/api/types/SectionVersion.ts create mode 100644 src/api/types/StreamAudioEventData.ts create mode 100644 src/api/types/StreamAudioEventDataEvent.ts create mode 100644 src/api/types/StreamAudioEventMessage.ts create mode 100644 src/api/types/StreamAudioEventsConfig.ts create mode 100644 src/api/types/StreamConfigModeFactGenerationInterval.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/TemplatePolicy.ts create mode 100644 src/api/types/TemplatePolicyKind.ts create mode 100644 src/api/types/TemplateSource.ts create mode 100644 src/api/types/TemplateVersion.ts create mode 100644 src/api/types/TranscribeAudioEventData.ts create mode 100644 src/api/types/TranscribeAudioEventDataEvent.ts create mode 100644 src/api/types/TranscribeAudioEventMessage.ts create mode 100644 src/api/types/TranscribeAudioEventsConfig.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/GuidedSectionsUpdateRequest.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/client/requests/GuidedSectionsCreateVersionRequest.ts create mode 100644 src/serialization/resources/documents/resources/sections/resources/versions/client/requests/index.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/GuidedTemplatesUpdateRequest.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/GuidedTemplatesCreateVersionRequest.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/GuidedTemplatesCreateVersionRequestGeneration.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/CommonStatusResponse.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/DocumentationEvidence.ts create mode 100644 src/serialization/types/EphemeralDocument.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/GuidedDocumentContext.ts create mode 100644 src/serialization/types/GuidedDocumentFactMinimal.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/GuidedDocumentsCreateEphemeralResponse.ts create mode 100644 src/serialization/types/GuidedDocumentsGenerateBase.ts create mode 100644 src/serialization/types/GuidedDocumentsGenerateByAssembly.ts create mode 100644 src/serialization/types/GuidedDocumentsGenerateByDynamic.ts create mode 100644 src/serialization/types/GuidedDocumentsGenerateByTemplateRef.ts create mode 100644 src/serialization/types/GuidedDocumentsGenerateRequest.ts create mode 100644 src/serialization/types/GuidedDynamicInline.ts create mode 100644 src/serialization/types/GuidedDynamicRequest.ts create mode 100644 src/serialization/types/GuidedSectionOverride.ts create mode 100644 src/serialization/types/GuidedSectionsCreateBase.ts create mode 100644 src/serialization/types/GuidedSectionsCreateFromInheritanceRequest.ts create mode 100644 src/serialization/types/GuidedSectionsCreateFromScratchRequest.ts create mode 100644 src/serialization/types/GuidedSectionsCreateRequest.ts create mode 100644 src/serialization/types/GuidedTemplateOverrides.ts create mode 100644 src/serialization/types/GuidedTemplateRef.ts create mode 100644 src/serialization/types/GuidedTemplatesCreateBase.ts create mode 100644 src/serialization/types/GuidedTemplatesCreateFromInheritanceRequest.ts create mode 100644 src/serialization/types/GuidedTemplatesCreateFromInheritanceRequestGeneration.ts create mode 100644 src/serialization/types/GuidedTemplatesCreateFromScratchRequest.ts create mode 100644 src/serialization/types/GuidedTemplatesCreateFromScratchRequestGeneration.ts create mode 100644 src/serialization/types/GuidedTemplatesCreatePolicyRequest.ts create mode 100644 src/serialization/types/GuidedTemplatesCreatePolicyRequestKind.ts create mode 100644 src/serialization/types/GuidedTemplatesCreateRequest.ts create mode 100644 src/serialization/types/GuidedTemplatesVersionSectionRequest.ts create mode 100644 src/serialization/types/Label.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/SectionSource.ts create mode 100644 src/serialization/types/SectionVersion.ts create mode 100644 src/serialization/types/StreamAudioEventData.ts create mode 100644 src/serialization/types/StreamAudioEventDataEvent.ts create mode 100644 src/serialization/types/StreamAudioEventMessage.ts create mode 100644 src/serialization/types/StreamAudioEventsConfig.ts create mode 100644 src/serialization/types/StreamConfigModeFactGenerationInterval.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/TemplatePolicy.ts create mode 100644 src/serialization/types/TemplatePolicyKind.ts create mode 100644 src/serialization/types/TemplateSource.ts create mode 100644 src/serialization/types/TemplateVersion.ts create mode 100644 src/serialization/types/TranscribeAudioEventData.ts create mode 100644 src/serialization/types/TranscribeAudioEventDataEvent.ts create mode 100644 src/serialization/types/TranscribeAudioEventMessage.ts create mode 100644 src/serialization/types/TranscribeAudioEventsConfig.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..ebd79a49 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,5 +1,5 @@ { - "cliVersion": "4.86.1", + "cliVersion": "5.28.3", "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": "d52d71cc05b86ce3071e7dee5192458862012439", "sdkVersion": "0.0.0-dev" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index afca55cf..b74f1d68 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.21.0 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.21.0: + resolution: {integrity: sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==} 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.21.0: {} y18n@5.0.8: {} diff --git a/src/api/errors/ConflictError.ts b/src/api/errors/ConflictError.ts new file mode 100644 index 00000000..ea2acb33 --- /dev/null +++ b/src/api/errors/ConflictError.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as core from "../../core/index.js"; +import * as errors from "../../errors/index.js"; +import type * as Corti from "../index.js"; + +export class ConflictError extends errors.CortiError { + constructor(body: Corti.ErrorResponse, rawResponse?: core.RawResponse) { + super({ + message: "ConflictError", + statusCode: 409, + body: body, + rawResponse: rawResponse, + }); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = this.constructor.name; + } +} 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/errors/index.ts b/src/api/errors/index.ts index af2e352e..7ce4a0f0 100644 --- a/src/api/errors/index.ts +++ b/src/api/errors/index.ts @@ -1,5 +1,6 @@ export * from "./BadGatewayError.js"; export * from "./BadRequestError.js"; +export * from "./ConflictError.js"; export * from "./ForbiddenError.js"; export * from "./GatewayTimeoutError.js"; export * from "./InternalServerError.js"; 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..95cde920 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,12 +19,24 @@ 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)); + } + /** + * @deprecated + * * List Documents * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. @@ -123,6 +137,8 @@ export class DocumentsClient { } /** + * @deprecated + * * This endpoint offers different ways to generate a document. Find guides to document generation [here](/textgen/documents-standard). * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. @@ -246,6 +262,8 @@ export class DocumentsClient { } /** + * @deprecated + * * Get Document. * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. @@ -354,6 +372,8 @@ export class DocumentsClient { } /** + * @deprecated + * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.Uuid} documentId - The document ID representing the context for the request. Must be a valid UUID. * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration. @@ -451,6 +471,8 @@ export class DocumentsClient { } /** + * @deprecated + * * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.Uuid} documentId - The document ID representing the context for the request. Must be a valid UUID. * @param {Corti.DocumentsUpdateRequest} request @@ -564,4 +586,108 @@ export class DocumentsClient { "/interactions/{id}/documents/{documentId}", ); } + + /** + * Generates a structured document using one of three 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.GuidedDocumentsGenerateRequest} request + * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.BadRequestError} + * @throws {@link Corti.NotFoundError} + * @throws {@link Corti.UnprocessableEntityError} + * @throws {@link Corti.InternalServerError} + * + * @example + * await client.documents.generate({ + * outputLanguage: "outputLanguage", + * templateRef: { + * templateId: "templateId" + * } + * }) + */ + public generate( + request: Corti.GuidedDocumentsGenerateRequest, + requestOptions?: DocumentsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__generate(request, requestOptions)); + } + + private async __generate( + request: Corti.GuidedDocumentsGenerateRequest, + 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.GuidedDocumentsGenerateRequest.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.GuidedDocumentsCreateEphemeralResponse.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 500: + throw new Corti.InternalServerError( + 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..288a407b --- /dev/null +++ b/src/api/resources/documents/resources/sections/client/Client.ts @@ -0,0 +1,432 @@ +// 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, region, specialty, label, published } = request; + const _queryParams: Record = { + lang, + region, + specialty, + 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.GuidedSectionsCreateRequest} request + * @param {SectionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.BadRequestError} + * + * @example + * await client.documents.sections.create({ + * name: "name", + * generation: { + * heading: "heading", + * instructions: { + * contentPrompt: "contentPrompt" + * }, + * outputSchema: { + * type: "string" + * } + * } + * }) + */ + public create( + request: Corti.GuidedSectionsCreateRequest, + requestOptions?: SectionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Corti.GuidedSectionsCreateRequest, + 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.GuidedSectionsCreateRequest.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}", + ); + } + + /** + * Deletes a section and its versions. Returns 409 if other sections inherit from this section. + * + * @param {string} sectionID + * @param {SectionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * @throws {@link Corti.ConflictError} + * + * @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); + case 409: + throw new Corti.ConflictError( + 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, + "DELETE", + "/documents/sections/{sectionID}", + ); + } + + /** + * @param {string} sectionID + * @param {Corti.documents.GuidedSectionsUpdateRequest} 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.GuidedSectionsUpdateRequest = {}, + requestOptions?: SectionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(sectionID, request, requestOptions)); + } + + private async __update( + sectionID: string, + request: Corti.documents.GuidedSectionsUpdateRequest = {}, + 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.GuidedSectionsUpdateRequest.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/GuidedSectionsUpdateRequest.ts b/src/api/resources/documents/resources/sections/client/requests/GuidedSectionsUpdateRequest.ts new file mode 100644 index 00000000..02bce675 --- /dev/null +++ b/src/api/resources/documents/resources/sections/client/requests/GuidedSectionsUpdateRequest.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../../../index.js"; + +/** + * @example + * {} + */ +export interface GuidedSectionsUpdateRequest { + name?: string; + description?: string; + languages?: string[]; + regions?: string[]; + specialties?: string[]; + labels?: Corti.Label[]; +} 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..52480bb2 --- /dev/null +++ b/src/api/resources/documents/resources/sections/client/requests/ListSectionsRequest.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * {} + */ +export interface ListSectionsRequest { + /** Filter sections by BCP 47 language subtag (e.g. `fr`, `de`). Repeatable. */ + lang?: string | string[]; + /** Filter sections by ISO 3166-1 alpha-3 region code (e.g. `BEL`). Repeatable. */ + region?: string | string[]; + /** Filter sections by clinical specialty. Repeatable. */ + specialty?: string | string[]; + /** Filter sections by label in `key:value` format. 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/index.ts b/src/api/resources/documents/resources/sections/client/requests/index.ts new file mode 100644 index 00000000..16102088 --- /dev/null +++ b/src/api/resources/documents/resources/sections/client/requests/index.ts @@ -0,0 +1,2 @@ +export type { GuidedSectionsUpdateRequest } from "./GuidedSectionsUpdateRequest.js"; +export type { ListSectionsRequest } from "./ListSectionsRequest.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..766a768b --- /dev/null +++ b/src/api/resources/documents/resources/sections/resources/index.ts @@ -0,0 +1,2 @@ +export * from "./versions/client/requests/index.js"; +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..831f184d --- /dev/null +++ b/src/api/resources/documents/resources/sections/resources/versions/client/Client.ts @@ -0,0 +1,433 @@ +// 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.documents.sections.GuidedSectionsCreateVersionRequest} request + * @param {VersionsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.BadRequestError} + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.documents.sections.versions.create("sectionID", { + * generation: { + * heading: "heading", + * instructions: { + * contentPrompt: "contentPrompt" + * }, + * outputSchema: { + * type: "string" + * } + * } + * }) + */ + public create( + sectionID: string, + request: Corti.documents.sections.GuidedSectionsCreateVersionRequest, + requestOptions?: VersionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(sectionID, request, requestOptions)); + } + + private async __create( + sectionID: string, + request: Corti.documents.sections.GuidedSectionsCreateVersionRequest, + 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.documents.sections.GuidedSectionsCreateVersionRequest.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.CommonStatusResponse.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..195f9aa8 --- /dev/null +++ b/src/api/resources/documents/resources/sections/resources/versions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests/index.js"; diff --git a/src/api/resources/documents/resources/sections/resources/versions/client/requests/GuidedSectionsCreateVersionRequest.ts b/src/api/resources/documents/resources/sections/resources/versions/client/requests/GuidedSectionsCreateVersionRequest.ts new file mode 100644 index 00000000..1c6877dc --- /dev/null +++ b/src/api/resources/documents/resources/sections/resources/versions/client/requests/GuidedSectionsCreateVersionRequest.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../../../../../index.js"; + +/** + * @example + * { + * generation: { + * heading: "heading", + * instructions: { + * contentPrompt: "contentPrompt" + * }, + * outputSchema: { + * type: "string" + * } + * } + * } + */ +export interface GuidedSectionsCreateVersionRequest { + generation: Corti.SectionGeneration; +} diff --git a/src/api/resources/documents/resources/sections/resources/versions/client/requests/index.ts b/src/api/resources/documents/resources/sections/resources/versions/client/requests/index.ts new file mode 100644 index 00000000..2e8efdd9 --- /dev/null +++ b/src/api/resources/documents/resources/sections/resources/versions/client/requests/index.ts @@ -0,0 +1 @@ +export type { GuidedSectionsCreateVersionRequest } from "./GuidedSectionsCreateVersionRequest.js"; 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..1a6205df --- /dev/null +++ b/src/api/resources/documents/resources/templates/client/Client.ts @@ -0,0 +1,428 @@ +// 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, region, specialty, label, published } = request; + const _queryParams: Record = { + lang, + region, + specialty, + 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.GuidedTemplatesCreateRequest} request + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.BadRequestError} + * + * @example + * await client.documents.templates.create({ + * name: "name", + * generation: { + * instructions: { + * prompt: "prompt" + * } + * } + * }) + */ + public create( + request: Corti.GuidedTemplatesCreateRequest, + requestOptions?: TemplatesClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Corti.GuidedTemplatesCreateRequest, + 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.GuidedTemplatesCreateRequest.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. Returns 409 if other templates or sections inherit from this template. + * + * @param {string} templateID + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.NotFoundError} + * @throws {@link Corti.ConflictError} + * + * @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); + case 409: + throw new Corti.ConflictError( + 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, + "DELETE", + "/documents/templates/{templateID}", + ); + } + + /** + * @param {string} templateID + * @param {Corti.documents.GuidedTemplatesUpdateRequest} 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.GuidedTemplatesUpdateRequest = {}, + requestOptions?: TemplatesClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(templateID, request, requestOptions)); + } + + private async __update( + templateID: string, + request: Corti.documents.GuidedTemplatesUpdateRequest = {}, + 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.GuidedTemplatesUpdateRequest.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/GuidedTemplatesUpdateRequest.ts b/src/api/resources/documents/resources/templates/client/requests/GuidedTemplatesUpdateRequest.ts new file mode 100644 index 00000000..629d2169 --- /dev/null +++ b/src/api/resources/documents/resources/templates/client/requests/GuidedTemplatesUpdateRequest.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../../../index.js"; + +/** + * @example + * {} + */ +export interface GuidedTemplatesUpdateRequest { + name?: string; + description?: string; + languages?: string[]; + regions?: string[]; + specialties?: string[]; + labels?: Corti.Label[]; +} 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..163db544 --- /dev/null +++ b/src/api/resources/documents/resources/templates/client/requests/ListTemplatesRequest.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * {} + */ +export interface ListTemplatesRequest { + /** Filter templates by BCP 47 language subtag (e.g. `fr`, `de`). Repeatable. */ + lang?: string | string[]; + /** Filter templates by ISO 3166-1 alpha-3 region code (e.g. `BEL`). Repeatable. */ + region?: string | string[]; + /** Filter templates by clinical specialty. Repeatable. */ + specialty?: string | string[]; + /** Filter templates by label in `key:value` format. 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/index.ts b/src/api/resources/documents/resources/templates/client/requests/index.ts new file mode 100644 index 00000000..fc143736 --- /dev/null +++ b/src/api/resources/documents/resources/templates/client/requests/index.ts @@ -0,0 +1,2 @@ +export type { GuidedTemplatesUpdateRequest } from "./GuidedTemplatesUpdateRequest.js"; +export type { ListTemplatesRequest } from "./ListTemplatesRequest.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..d0c6d290 --- /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.GuidedTemplatesCreateVersionRequest} 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.GuidedTemplatesCreateVersionRequest, + requestOptions?: VersionsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(templateID, request, requestOptions)); + } + + private async __create( + templateID: string, + request: Corti.documents.templates.GuidedTemplatesCreateVersionRequest, + 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.GuidedTemplatesCreateVersionRequest.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.CommonStatusResponse.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/GuidedTemplatesCreateVersionRequest.ts b/src/api/resources/documents/resources/templates/resources/versions/client/requests/GuidedTemplatesCreateVersionRequest.ts new file mode 100644 index 00000000..bd7fe7b9 --- /dev/null +++ b/src/api/resources/documents/resources/templates/resources/versions/client/requests/GuidedTemplatesCreateVersionRequest.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 GuidedTemplatesCreateVersionRequest { + generation: Corti.documents.templates.GuidedTemplatesCreateVersionRequestGeneration; +} 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..e1b33267 --- /dev/null +++ b/src/api/resources/documents/resources/templates/resources/versions/client/requests/index.ts @@ -0,0 +1 @@ +export type { GuidedTemplatesCreateVersionRequest } from "./GuidedTemplatesCreateVersionRequest.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/GuidedTemplatesCreateVersionRequestGeneration.ts b/src/api/resources/documents/resources/templates/resources/versions/types/GuidedTemplatesCreateVersionRequestGeneration.ts new file mode 100644 index 00000000..5c42ac56 --- /dev/null +++ b/src/api/resources/documents/resources/templates/resources/versions/types/GuidedTemplatesCreateVersionRequestGeneration.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 GuidedTemplatesCreateVersionRequestGeneration { + instructions: Corti.TemplateInstructions; + sections?: Corti.GuidedTemplatesVersionSectionRequest[]; +} 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..421609d5 --- /dev/null +++ b/src/api/resources/documents/resources/templates/resources/versions/types/index.ts @@ -0,0 +1 @@ +export * from "./GuidedTemplatesCreateVersionRequestGeneration.js"; diff --git a/src/api/resources/facts/client/requests/FactsExtractRequest.ts b/src/api/resources/facts/client/requests/FactsExtractRequest.ts index f20eeec9..8107b215 100644 --- a/src/api/resources/facts/client/requests/FactsExtractRequest.ts +++ b/src/api/resources/facts/client/requests/FactsExtractRequest.ts @@ -14,6 +14,6 @@ import type * as Corti from "../../../../index.js"; */ export interface FactsExtractRequest { context: Corti.CommonTextContext[]; - /** The desired output language code for extracted facts. Check [languages page](/about/languages) for more. */ + /** The desired output language code for extracted facts. Check [languages page](/stt/languages) for more. */ outputLanguage: string; } diff --git a/src/api/resources/stream/client/Socket.ts b/src/api/resources/stream/client/Socket.ts index 3a343680..6b76c77d 100644 --- a/src/api/resources/stream/client/Socket.ts +++ b/src/api/resources/stream/client/Socket.ts @@ -21,7 +21,8 @@ export declare namespace StreamSocket { | Corti.StreamEndedMessage | Corti.StreamUsageMessage | Corti.StreamErrorMessage - | Corti.StreamConfigStatusMessage; + | Corti.StreamConfigStatusMessage + | Corti.StreamAudioEventMessage; type EventHandlers = { open?: () => void; message?: (message: Response) => void; diff --git a/src/api/resources/templates/client/Client.ts b/src/api/resources/templates/client/Client.ts index 3a109232..33f5af94 100644 --- a/src/api/resources/templates/client/Client.ts +++ b/src/api/resources/templates/client/Client.ts @@ -25,7 +25,7 @@ export class TemplatesClient { /** * Retrieves a list of template sections with optional filters for organization and language. * - * @param {Corti.TemplatesSectionListRequest} request + * @param {Corti.SectionListTemplatesRequest} request * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.UnauthorizedError} @@ -35,14 +35,14 @@ export class TemplatesClient { * await client.templates.sectionList() */ public sectionList( - request: Corti.TemplatesSectionListRequest = {}, + request: Corti.SectionListTemplatesRequest = {}, requestOptions?: TemplatesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__sectionList(request, requestOptions)); } private async __sectionList( - request: Corti.TemplatesSectionListRequest = {}, + request: Corti.SectionListTemplatesRequest = {}, requestOptions?: TemplatesClient.RequestOptions, ): Promise> { const { org, lang } = request; @@ -115,7 +115,7 @@ export class TemplatesClient { /** * Retrieves a list of templates with optional filters for organization, language, and status. * - * @param {Corti.TemplatesListRequest} request + * @param {Corti.ListTemplatesRequest} request * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Corti.UnauthorizedError} @@ -125,14 +125,14 @@ export class TemplatesClient { * await client.templates.list() */ public list( - request: Corti.TemplatesListRequest = {}, + request: Corti.ListTemplatesRequest = {}, requestOptions?: TemplatesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions)); } private async __list( - request: Corti.TemplatesListRequest = {}, + request: Corti.ListTemplatesRequest = {}, requestOptions?: TemplatesClient.RequestOptions, ): Promise> { const { org, lang, status } = request; diff --git a/src/api/resources/templates/client/requests/TemplatesListRequest.ts b/src/api/resources/templates/client/requests/ListTemplatesRequest.ts similarity index 88% rename from src/api/resources/templates/client/requests/TemplatesListRequest.ts rename to src/api/resources/templates/client/requests/ListTemplatesRequest.ts index abc1c28c..5fb937e5 100644 --- a/src/api/resources/templates/client/requests/TemplatesListRequest.ts +++ b/src/api/resources/templates/client/requests/ListTemplatesRequest.ts @@ -4,7 +4,7 @@ * @example * {} */ -export interface TemplatesListRequest { +export interface ListTemplatesRequest { /** Filter templates by organization. */ org?: string | string[]; /** Filter templates by language. */ diff --git a/src/api/resources/templates/client/requests/TemplatesSectionListRequest.ts b/src/api/resources/templates/client/requests/SectionListTemplatesRequest.ts similarity index 84% rename from src/api/resources/templates/client/requests/TemplatesSectionListRequest.ts rename to src/api/resources/templates/client/requests/SectionListTemplatesRequest.ts index d0768d63..4c21662d 100644 --- a/src/api/resources/templates/client/requests/TemplatesSectionListRequest.ts +++ b/src/api/resources/templates/client/requests/SectionListTemplatesRequest.ts @@ -4,7 +4,7 @@ * @example * {} */ -export interface TemplatesSectionListRequest { +export interface SectionListTemplatesRequest { /** Filter template sections by organization. */ org?: string | string[]; /** Filter template sections by language. */ diff --git a/src/api/resources/templates/client/requests/index.ts b/src/api/resources/templates/client/requests/index.ts index d2764071..94ab1ada 100644 --- a/src/api/resources/templates/client/requests/index.ts +++ b/src/api/resources/templates/client/requests/index.ts @@ -1,2 +1,2 @@ -export type { TemplatesListRequest } from "./TemplatesListRequest.js"; -export type { TemplatesSectionListRequest } from "./TemplatesSectionListRequest.js"; +export type { ListTemplatesRequest } from "./ListTemplatesRequest.js"; +export type { SectionListTemplatesRequest } from "./SectionListTemplatesRequest.js"; diff --git a/src/api/resources/transcribe/client/Socket.ts b/src/api/resources/transcribe/client/Socket.ts index 21d26868..51510d87 100644 --- a/src/api/resources/transcribe/client/Socket.ts +++ b/src/api/resources/transcribe/client/Socket.ts @@ -21,7 +21,8 @@ export declare namespace TranscribeSocket { | Corti.TranscribeErrorMessage | Corti.TranscribeTranscriptMessage | Corti.TranscribeCommandMessage - | Corti.TranscribeConfigStatusMessage; + | Corti.TranscribeConfigStatusMessage + | Corti.TranscribeAudioEventMessage; type EventHandlers = { open?: () => void; message?: (message: Response) => void; diff --git a/src/api/resources/transcripts/client/Client.ts b/src/api/resources/transcripts/client/Client.ts index 80c82573..f4875e6c 100644 --- a/src/api/resources/transcripts/client/Client.ts +++ b/src/api/resources/transcripts/client/Client.ts @@ -138,7 +138,7 @@ export class TranscriptsClient { } /** - * Create a transcript from an audio file attached, via `/recordings` endpoint, to the interaction.
Each interaction may have more than one audio file and transcript associated with it. While audio files up to 60min in total duration, or 150MB in total size, may be attached to an interaction, synchronous processing is only supported for audio files less than ~2min in duration.

If an audio file takes longer to transcribe than the 25sec synchronous processing timeout, then it will continue to process asynchronously. In this scenario, an incomplete or empty transcript with `status=processing` will be returned with a location header that can be used to retrieve the final transcript.

The client can poll the Get Transcript endpoint (`GET /interactions/{id}/transcripts/{transcriptId}/status`) for transcript status changes:
- `200 OK` with status `processing`, `completed`, or `failed`
- `404 Not Found` if the `interactionId` or `transcriptId` are invalid

The completed transcript can be retrieved via the Get Transcript endpoint (`GET /interactions/{id}/transcripts/{transcriptId}/`).
+ * Create a transcript from an audio file uploaded to the interaction via `/recordings` endpoint.
Each interaction may have more than one audio file and transcript associated with it. Audio files up to 60 min in total duration, or 150 MB in total size, may be used.

Requests will process synchronously for 25 seconds before timeout, upon which processing will continue asynchronously. In the latter scenario, a partial or empty transcript with `status=processing` will be returned with a location header that can be used to retrieve the completed transcript.

The client can poll the `/transcripts` endpoint (`GET /interactions/{id}/transcripts/{transcriptId}/status`) for transcript status monitoring:
- `200 OK` with status `processing`, `completed`, or `failed`
- `404 Not Found` if the `interactionId` or `transcriptId` are invalid

The completed transcript can be retrieved via the Get Transcript request (`GET /interactions/{id}/transcripts/{transcriptId}/`).
* * @param {Corti.Uuid} id - The unique identifier of the interaction. Must be a valid UUID. * @param {Corti.TranscriptsCreateRequest} request diff --git a/src/api/resources/transcripts/client/requests/TranscriptsCreateRequest.ts b/src/api/resources/transcripts/client/requests/TranscriptsCreateRequest.ts index bedda24e..3546b546 100644 --- a/src/api/resources/transcripts/client/requests/TranscriptsCreateRequest.ts +++ b/src/api/resources/transcripts/client/requests/TranscriptsCreateRequest.ts @@ -12,7 +12,7 @@ import type * as Corti from "../../../../index.js"; export interface TranscriptsCreateRequest { /** The unique identifier for the recording. */ recordingId: Corti.Uuid; - /** The primary spoken language of the recording. Check https://docs.corti.ai/about/languages for more. */ + /** The primary spoken language of the recording. Check https://docs.corti.ai/stt/languages for more. */ primaryLanguage: string; /** Indicates whether spoken dictation commands should be converted to punctuation (e.g., 'comma' → ','). */ isDictation?: boolean; 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/CommonStatusResponse.ts b/src/api/types/CommonStatusResponse.ts new file mode 100644 index 00000000..18c54e97 --- /dev/null +++ b/src/api/types/CommonStatusResponse.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 CommonStatusResponse { + status: string; + evidence?: Corti.DocumentationEvidence; +} 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/DocumentationEvidence.ts b/src/api/types/DocumentationEvidence.ts new file mode 100644 index 00000000..622d1e01 --- /dev/null +++ b/src/api/types/DocumentationEvidence.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 DocumentationEvidence { + evidenceId?: Corti.Uuid; + type?: string; + quote?: string; +} diff --git a/src/api/types/DocumentsCreateRequestWithTemplate.ts b/src/api/types/DocumentsCreateRequestWithTemplate.ts index 69357041..82cd4dbd 100644 --- a/src/api/types/DocumentsCreateRequestWithTemplate.ts +++ b/src/api/types/DocumentsCreateRequestWithTemplate.ts @@ -9,7 +9,7 @@ export interface DocumentsCreateRequestWithTemplate { template: Corti.DocumentsTemplate; /** An optional name for the document. */ name?: string; - /** The language in which the document will be generated. Check [languages page](/about/languages) for more. */ + /** The language in which the document will be generated. Check [languages page](/stt/languages) for more. */ outputLanguage: string; /** Set to true to disable guardrails during document generation, default is false. */ disableGuardrails?: boolean; diff --git a/src/api/types/DocumentsCreateRequestWithTemplateKey.ts b/src/api/types/DocumentsCreateRequestWithTemplateKey.ts index f8133d1e..5b5f8640 100644 --- a/src/api/types/DocumentsCreateRequestWithTemplateKey.ts +++ b/src/api/types/DocumentsCreateRequestWithTemplateKey.ts @@ -9,7 +9,7 @@ export interface DocumentsCreateRequestWithTemplateKey { templateKey: string; /** An optional name for the document. */ name?: string; - /** The language in which the document will be generated. Check [languages page](/about/languages) for more. */ + /** The language in which the document will be generated. Check [languages page](/stt/languages) for more. */ outputLanguage: string; /** Set to true to disable guardrails during document generation, default is false. */ disableGuardrails?: boolean; diff --git a/src/api/types/DocumentsGetResponse.ts b/src/api/types/DocumentsGetResponse.ts index 1d79cd9f..43df56f8 100644 --- a/src/api/types/DocumentsGetResponse.ts +++ b/src/api/types/DocumentsGetResponse.ts @@ -16,7 +16,7 @@ export interface DocumentsGetResponse { createdAt: Date; /** The timestamp when the document was last updated. */ updatedAt: Date; - /** The language in which the document will be generated. Check https://docs.corti.ai/about/languages for more. */ + /** The language in which the document will be generated. Check https://docs.corti.ai/stt/languages for more. */ outputLanguage: string; usageInfo: Corti.CommonUsageInfo; } diff --git a/src/api/types/EphemeralDocument.ts b/src/api/types/EphemeralDocument.ts new file mode 100644 index 00000000..78874e12 --- /dev/null +++ b/src/api/types/EphemeralDocument.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * A generated document that was not saved to the database. + */ +export interface EphemeralDocument { + name: string; + templateId: string; + templateVersionId: string; + /** The BCP 47 language tag of the generated output. */ + language: string; + stringDocument: Record; + structuredDocument?: Record | null; +} 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..d4c517a7 --- /dev/null +++ b/src/api/types/GuidedAssemblyRequest.ts @@ -0,0 +1,14 @@ +// 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; + /** 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/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/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/GuidedDocumentsCreateEphemeralResponse.ts b/src/api/types/GuidedDocumentsCreateEphemeralResponse.ts new file mode 100644 index 00000000..f3b5824e --- /dev/null +++ b/src/api/types/GuidedDocumentsCreateEphemeralResponse.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Response when a document is generated but not saved (retention policy `none`). + */ +export interface GuidedDocumentsCreateEphemeralResponse { + document: Corti.EphemeralDocument; + usageInfo: Corti.CommonUsageInfo; +} diff --git a/src/api/types/GuidedDocumentsGenerateBase.ts b/src/api/types/GuidedDocumentsGenerateBase.ts new file mode 100644 index 00000000..88e8668f --- /dev/null +++ b/src/api/types/GuidedDocumentsGenerateBase.ts @@ -0,0 +1,15 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +/** + * Fields shared across all guided-document request variants. + */ +export interface GuidedDocumentsGenerateBase { + /** The language in which the document will be generated as a BCP 47 tag. */ + outputLanguage: string; + /** 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; +} diff --git a/src/api/types/GuidedDocumentsGenerateByAssembly.ts b/src/api/types/GuidedDocumentsGenerateByAssembly.ts new file mode 100644 index 00000000..bb5b9abf --- /dev/null +++ b/src/api/types/GuidedDocumentsGenerateByAssembly.ts @@ -0,0 +1,11 @@ +// 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 GuidedDocumentsGenerateByAssembly extends Corti.GuidedDocumentsGenerateBase { + /** Assemble a template from existing stored sections. */ + assemblyTemplate: Corti.GuidedAssemblyRequest; +} diff --git a/src/api/types/GuidedDocumentsGenerateByDynamic.ts b/src/api/types/GuidedDocumentsGenerateByDynamic.ts new file mode 100644 index 00000000..9a6b7923 --- /dev/null +++ b/src/api/types/GuidedDocumentsGenerateByDynamic.ts @@ -0,0 +1,11 @@ +// 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 GuidedDocumentsGenerateByDynamic extends Corti.GuidedDocumentsGenerateBase { + /** Fully inline template defined in the request body. */ + dynamicTemplate: Corti.GuidedDynamicRequest; +} diff --git a/src/api/types/GuidedDocumentsGenerateByTemplateRef.ts b/src/api/types/GuidedDocumentsGenerateByTemplateRef.ts new file mode 100644 index 00000000..8972d09c --- /dev/null +++ b/src/api/types/GuidedDocumentsGenerateByTemplateRef.ts @@ -0,0 +1,11 @@ +// 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 GuidedDocumentsGenerateByTemplateRef extends Corti.GuidedDocumentsGenerateBase { + /** Reference an existing stored template, optionally with overrides. */ + templateRef: Corti.GuidedTemplateRef; +} diff --git a/src/api/types/GuidedDocumentsGenerateRequest.ts b/src/api/types/GuidedDocumentsGenerateRequest.ts new file mode 100644 index 00000000..d4f4d93e --- /dev/null +++ b/src/api/types/GuidedDocumentsGenerateRequest.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 GuidedDocumentsGenerateRequest = + | Corti.GuidedDocumentsGenerateByTemplateRef + | Corti.GuidedDocumentsGenerateByAssembly + | Corti.GuidedDocumentsGenerateByDynamic; 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..b5898cd8 --- /dev/null +++ b/src/api/types/GuidedDynamicRequest.ts @@ -0,0 +1,11 @@ +// 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; + generation: Corti.GuidedDynamicInline; +} 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/GuidedSectionsCreateBase.ts b/src/api/types/GuidedSectionsCreateBase.ts new file mode 100644 index 00000000..6b7fd5c2 --- /dev/null +++ b/src/api/types/GuidedSectionsCreateBase.ts @@ -0,0 +1,20 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface GuidedSectionsCreateBase { + /** A human-readable identifier for this section. Not passed to the LLM. */ + name: string; + /** A description for this section. Not passed to the LLM. */ + description?: string; + /** BCP 47 language subtags this section has been tweaked for. */ + languages?: string[]; + /** ISO 3166-1 alpha-3 country codes this section has been tweaked for. */ + regions?: string[]; + /** Clinical specialties this section has been tweaked for. */ + specialties?: string[]; + /** Labels work as query param filter in the LIST /sections endpoint. */ + labels?: Corti.Label[]; + /** 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/GuidedSectionsCreateFromInheritanceRequest.ts b/src/api/types/GuidedSectionsCreateFromInheritanceRequest.ts new file mode 100644 index 00000000..d0d8d45d --- /dev/null +++ b/src/api/types/GuidedSectionsCreateFromInheritanceRequest.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 GuidedSectionsCreateFromInheritanceRequest extends Corti.GuidedSectionsCreateBase { + /** 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/GuidedSectionsCreateFromScratchRequest.ts b/src/api/types/GuidedSectionsCreateFromScratchRequest.ts new file mode 100644 index 00000000..7ba96a1c --- /dev/null +++ b/src/api/types/GuidedSectionsCreateFromScratchRequest.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 GuidedSectionsCreateFromScratchRequest extends Corti.GuidedSectionsCreateBase { + generation: Corti.SectionGeneration; +} diff --git a/src/api/types/GuidedSectionsCreateRequest.ts b/src/api/types/GuidedSectionsCreateRequest.ts new file mode 100644 index 00000000..ef06fe2d --- /dev/null +++ b/src/api/types/GuidedSectionsCreateRequest.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export type GuidedSectionsCreateRequest = + | Corti.GuidedSectionsCreateFromScratchRequest + | Corti.GuidedSectionsCreateFromInheritanceRequest; 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/GuidedTemplatesCreateBase.ts b/src/api/types/GuidedTemplatesCreateBase.ts new file mode 100644 index 00000000..641cc1da --- /dev/null +++ b/src/api/types/GuidedTemplatesCreateBase.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export interface GuidedTemplatesCreateBase { + /** The name of this template. Not passed to the LLM. */ + name: string; + /** A description for this template. Not passed to the LLM. */ + description?: string; + /** BCP 47 language subtags this template has been tweaked for (e.g. `["fr", "de"]`). */ + languages?: string[]; + /** ISO 3166-1 alpha-3 country codes this template has been tweaked for (e.g. `["BEL"]`). */ + regions?: string[]; + /** Clinical specialties this template has been tweaked for. */ + specialties?: string[]; + /** Labels work as query param filter in the LIST /templates endpoint. */ + labels?: Corti.Label[]; + /** 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; + /** Access policies to apply to the template on creation. */ + policies?: Corti.GuidedTemplatesCreatePolicyRequest[]; +} diff --git a/src/api/types/GuidedTemplatesCreateFromInheritanceRequest.ts b/src/api/types/GuidedTemplatesCreateFromInheritanceRequest.ts new file mode 100644 index 00000000..cfade50c --- /dev/null +++ b/src/api/types/GuidedTemplatesCreateFromInheritanceRequest.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 GuidedTemplatesCreateFromInheritanceRequest extends Corti.GuidedTemplatesCreateBase { + /** Reference to the template to inherit 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.GuidedTemplatesCreateFromInheritanceRequestGeneration; +} diff --git a/src/api/types/GuidedTemplatesCreateFromInheritanceRequestGeneration.ts b/src/api/types/GuidedTemplatesCreateFromInheritanceRequestGeneration.ts new file mode 100644 index 00000000..95625bd9 --- /dev/null +++ b/src/api/types/GuidedTemplatesCreateFromInheritanceRequestGeneration.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 GuidedTemplatesCreateFromInheritanceRequestGeneration { + instructions?: Corti.TemplateInstructionsPartial; + sections?: Corti.GuidedTemplatesVersionSectionRequest[]; +} diff --git a/src/api/types/GuidedTemplatesCreateFromScratchRequest.ts b/src/api/types/GuidedTemplatesCreateFromScratchRequest.ts new file mode 100644 index 00000000..259c0986 --- /dev/null +++ b/src/api/types/GuidedTemplatesCreateFromScratchRequest.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 GuidedTemplatesCreateFromScratchRequest extends Corti.GuidedTemplatesCreateBase { + generation: Corti.GuidedTemplatesCreateFromScratchRequestGeneration; +} diff --git a/src/api/types/GuidedTemplatesCreateFromScratchRequestGeneration.ts b/src/api/types/GuidedTemplatesCreateFromScratchRequestGeneration.ts new file mode 100644 index 00000000..0af2e341 --- /dev/null +++ b/src/api/types/GuidedTemplatesCreateFromScratchRequestGeneration.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 GuidedTemplatesCreateFromScratchRequestGeneration { + instructions: Corti.TemplateInstructions; + sections?: Corti.GuidedTemplatesVersionSectionRequest[]; +} diff --git a/src/api/types/GuidedTemplatesCreatePolicyRequest.ts b/src/api/types/GuidedTemplatesCreatePolicyRequest.ts new file mode 100644 index 00000000..d4b20518 --- /dev/null +++ b/src/api/types/GuidedTemplatesCreatePolicyRequest.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 GuidedTemplatesCreatePolicyRequest { + /** The kind of access policy. */ + kind: Corti.GuidedTemplatesCreatePolicyRequestKind; + /** Required when kind is `customers`. */ + customerIds?: string[] | null; +} diff --git a/src/api/types/GuidedTemplatesCreatePolicyRequestKind.ts b/src/api/types/GuidedTemplatesCreatePolicyRequestKind.ts new file mode 100644 index 00000000..d26258cf --- /dev/null +++ b/src/api/types/GuidedTemplatesCreatePolicyRequestKind.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The kind of access policy. */ +export const GuidedTemplatesCreatePolicyRequestKind = { + Project: "project", + Customers: "customers", +} as const; +export type GuidedTemplatesCreatePolicyRequestKind = + (typeof GuidedTemplatesCreatePolicyRequestKind)[keyof typeof GuidedTemplatesCreatePolicyRequestKind]; diff --git a/src/api/types/GuidedTemplatesCreateRequest.ts b/src/api/types/GuidedTemplatesCreateRequest.ts new file mode 100644 index 00000000..b5101f2e --- /dev/null +++ b/src/api/types/GuidedTemplatesCreateRequest.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../index.js"; + +export type GuidedTemplatesCreateRequest = + | Corti.GuidedTemplatesCreateFromScratchRequest + | Corti.GuidedTemplatesCreateFromInheritanceRequest; diff --git a/src/api/types/GuidedTemplatesVersionSectionRequest.ts b/src/api/types/GuidedTemplatesVersionSectionRequest.ts new file mode 100644 index 00000000..5e3a61b1 --- /dev/null +++ b/src/api/types/GuidedTemplatesVersionSectionRequest.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface GuidedTemplatesVersionSectionRequest { + /** 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/Label.ts b/src/api/types/Label.ts new file mode 100644 index 00000000..c800a734 --- /dev/null +++ b/src/api/types/Label.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface Label { + key: string; + value: string; +} 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..dbfc3a4e --- /dev/null +++ b/src/api/types/Section.ts @@ -0,0 +1,34 @@ +// 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; + /** Whether this section was created by the user or from the Corti standard resources. */ + source?: Corti.SectionSource; + /** The name of the section. */ + name: string; + /** BCP 47 languages this section has been tweaked for. Empty means no language-specific tweaks. */ + languages: string[]; + /** ISO 3166-1 alpha-3 country codes this section has been tweaked for. Empty means no region-specific tweaks. */ + regions: string[]; + /** Clinical specialties this section has been tweaked for. Empty means no specialty-specific tweaks. */ + specialties: string[]; + /** The description for the section. */ + description?: string; + /** The labels available to use as query param filter in the LIST /sections endpoint. */ + labels: Corti.Label[]; + /** 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; + /** Present when the section has been deleted. GET by ID still returns the full resource with this field populated. */ + deletedAt?: Date | null; +} 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..8aab8e28 --- /dev/null +++ b/src/api/types/SectionInstructionsOverride.ts @@ -0,0 +1,13 @@ +// 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; + /** When provided, replaces the section's misc prompt. Omit to inherit from the parent. */ + miscPrompt?: 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..a77f37ba --- /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 heading for this call. */ + heading?: string | null; + instructions?: Corti.SectionInstructionsOverride; + /** When provided, fully replaces the parent's output schema. */ + outputSchema?: Corti.OutputSchema; +} diff --git a/src/api/types/SectionSource.ts b/src/api/types/SectionSource.ts new file mode 100644 index 00000000..926e9d59 --- /dev/null +++ b/src/api/types/SectionSource.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +/** Whether this section was created by the user or from the Corti standard resources. */ +export const SectionSource = { + User: "user", + Corti: "corti", +} as const; +export type SectionSource = (typeof SectionSource)[keyof typeof SectionSource]; diff --git a/src/api/types/SectionVersion.ts b/src/api/types/SectionVersion.ts new file mode 100644 index 00000000..2e4cb5f7 --- /dev/null +++ b/src/api/types/SectionVersion.ts @@ -0,0 +1,13 @@ +// 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; + /** Present when the section version has been deleted. */ + deletedAt?: Date | null; + generation: Corti.SectionGeneration; +} diff --git a/src/api/types/StreamAudioEventData.ts b/src/api/types/StreamAudioEventData.ts new file mode 100644 index 00000000..48a14aa8 --- /dev/null +++ b/src/api/types/StreamAudioEventData.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 StreamAudioEventData { + /** The type of audio quality or speech activity event */ + event: Corti.StreamAudioEventDataEvent; + /** Audio channel identifier */ + channel: number; + /** Start time of the event in milliseconds */ + startTimeMs: number; +} diff --git a/src/api/types/StreamAudioEventDataEvent.ts b/src/api/types/StreamAudioEventDataEvent.ts new file mode 100644 index 00000000..36eae668 --- /dev/null +++ b/src/api/types/StreamAudioEventDataEvent.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The type of audio quality or speech activity event */ +export const StreamAudioEventDataEvent = { + SpeechQualityIssueDetected: "speechQualityIssueDetected", + SpeechQualityIssueRecovered: "speechQualityIssueRecovered", + LongSilenceDetected: "longSilenceDetected", + LongSilenceRecovered: "longSilenceRecovered", +} as const; +export type StreamAudioEventDataEvent = (typeof StreamAudioEventDataEvent)[keyof typeof StreamAudioEventDataEvent]; diff --git a/src/api/types/StreamAudioEventMessage.ts b/src/api/types/StreamAudioEventMessage.ts new file mode 100644 index 00000000..82d12a64 --- /dev/null +++ b/src/api/types/StreamAudioEventMessage.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 StreamAudioEventMessage { + type: "audioEvent"; + data: Corti.StreamAudioEventData; +} diff --git a/src/api/types/StreamAudioEventsConfig.ts b/src/api/types/StreamAudioEventsConfig.ts new file mode 100644 index 00000000..db971c8f --- /dev/null +++ b/src/api/types/StreamAudioEventsConfig.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface StreamAudioEventsConfig { + /** When true, enables audio quality and speech activity events to be sent over the WebSocket. Disabled by default. */ + enabled?: boolean; +} diff --git a/src/api/types/StreamConfig.ts b/src/api/types/StreamConfig.ts index 590dc285..6c8ceeed 100644 --- a/src/api/types/StreamConfig.ts +++ b/src/api/types/StreamConfig.ts @@ -7,6 +7,7 @@ export interface StreamConfig { mode: Corti.StreamConfigMode; /** Optional parameter to specify data retention policy for the generated transcripts and facts. Use value 'none' to indicate data should not be stored in the database. Use value 'retain' to indicate that the data should be retained according to standard retention policies. If configuration is not provided, then the default retention policy will apply. */ retentionPolicy?: Corti.StreamConfigRetentionPolicy; + audioEvents?: Corti.StreamAudioEventsConfig; /** The audio format of the incoming audio stream */ audioFormat?: string; } diff --git a/src/api/types/StreamConfigMode.ts b/src/api/types/StreamConfigMode.ts index 5ec39b72..50c85cbb 100644 --- a/src/api/types/StreamConfigMode.ts +++ b/src/api/types/StreamConfigMode.ts @@ -7,4 +7,6 @@ export interface StreamConfigMode { type: Corti.StreamConfigModeType; /** Output language locale specific to facts. */ outputLocale?: Corti.StreamSupportedLanguage; + /** Rate at which fact generation should process and return results. If no value is set, the default is `fixed` and will trigger fact generation at the standard interval of around 60s. With `fast_init`, fact generation will follow a logarithmic curve. */ + factGenerationInterval?: Corti.StreamConfigModeFactGenerationInterval; } diff --git a/src/api/types/StreamConfigModeFactGenerationInterval.ts b/src/api/types/StreamConfigModeFactGenerationInterval.ts new file mode 100644 index 00000000..1705cf81 --- /dev/null +++ b/src/api/types/StreamConfigModeFactGenerationInterval.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +/** Rate at which fact generation should process and return results. If no value is set, the default is `fixed` and will trigger fact generation at the standard interval of around 60s. With `fast_init`, fact generation will follow a logarithmic curve. */ +export const StreamConfigModeFactGenerationInterval = { + Fixed: "fixed", + FastInit: "fast_init", +} as const; +export type StreamConfigModeFactGenerationInterval = + (typeof StreamConfigModeFactGenerationInterval)[keyof typeof StreamConfigModeFactGenerationInterval]; 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..2f4cc384 --- /dev/null +++ b/src/api/types/Template.ts @@ -0,0 +1,35 @@ +// 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; + /** Whether this template was created by the user or is a Corti standard resource. */ + source?: Corti.TemplateSource; + /** The name of this template. Not passed to the LLM. */ + name: string; + /** A description for this template. Not passed to the LLM. */ + description?: string; + /** BCP 47 language subtags this template has been tweaked for (e.g. `["fr", "de"]`). Empty means no language-specific tweaks. */ + languages: string[]; + /** ISO 3166-1 alpha-3 country codes this template has been tweaked for (e.g. `["BEL"]`). Empty means no region-specific tweaks. */ + regions: string[]; + /** Clinical specialties this template has been tweaked for. Empty means no specialty-specific tweaks. */ + specialties: string[]; + /** The available labels to use as query param filter in the LIST /templates endpoint. */ + labels: Corti.Label[]; + /** Access policies for this template. */ + policies?: Corti.TemplatePolicy[]; + publishedVersion?: Corti.TemplateVersion; + /** The original timestamp when the template was created. */ + createdAt: Date; + /** The original timestamp when the template was last updated. */ + updatedAt: Date; + /** Present when the template has been deleted. GET by ID still returns the full resource with this field populated. */ + deletedAt?: Date | null; +} 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/TemplatePolicy.ts b/src/api/types/TemplatePolicy.ts new file mode 100644 index 00000000..db02f944 --- /dev/null +++ b/src/api/types/TemplatePolicy.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 TemplatePolicy { + id: string; + /** The kind of access policy. `project` means all users in the project can access, `customers` restricts to specific customer IDs. */ + kind: Corti.TemplatePolicyKind; + /** Required when kind is `customers`. The list of customer IDs that can access this template. */ + customerIds?: string[] | null; + templateId: string; + createdBy: string; + createdAt: Date; + updatedAt: Date; +} diff --git a/src/api/types/TemplatePolicyKind.ts b/src/api/types/TemplatePolicyKind.ts new file mode 100644 index 00000000..39e656e4 --- /dev/null +++ b/src/api/types/TemplatePolicyKind.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The kind of access policy. `project` means all users in the project can access, `customers` restricts to specific customer IDs. */ +export const TemplatePolicyKind = { + Project: "project", + Customers: "customers", +} as const; +export type TemplatePolicyKind = (typeof TemplatePolicyKind)[keyof typeof TemplatePolicyKind]; diff --git a/src/api/types/TemplateSource.ts b/src/api/types/TemplateSource.ts new file mode 100644 index 00000000..2e5f446b --- /dev/null +++ b/src/api/types/TemplateSource.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +/** Whether this template was created by the user or is a Corti standard resource. */ +export const TemplateSource = { + User: "user", + Corti: "corti", +} as const; +export type TemplateSource = (typeof TemplateSource)[keyof typeof TemplateSource]; diff --git a/src/api/types/TemplateVersion.ts b/src/api/types/TemplateVersion.ts new file mode 100644 index 00000000..182b279f --- /dev/null +++ b/src/api/types/TemplateVersion.ts @@ -0,0 +1,13 @@ +// 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; + /** Present when the template version has been deleted. */ + deletedAt?: Date | null; + generation: Corti.TemplateGeneration; +} diff --git a/src/api/types/TranscribeAudioEventData.ts b/src/api/types/TranscribeAudioEventData.ts new file mode 100644 index 00000000..dd992404 --- /dev/null +++ b/src/api/types/TranscribeAudioEventData.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 TranscribeAudioEventData { + /** The type of audio quality or speech activity event */ + event: Corti.TranscribeAudioEventDataEvent; + /** Audio channel identifier */ + channel: number; + /** Start time of the event in milliseconds */ + startTimeMs: number; +} diff --git a/src/api/types/TranscribeAudioEventDataEvent.ts b/src/api/types/TranscribeAudioEventDataEvent.ts new file mode 100644 index 00000000..7fe8a279 --- /dev/null +++ b/src/api/types/TranscribeAudioEventDataEvent.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The type of audio quality or speech activity event */ +export const TranscribeAudioEventDataEvent = { + SpeechQualityIssueDetected: "speechQualityIssueDetected", + SpeechQualityIssueRecovered: "speechQualityIssueRecovered", + LongSilenceDetected: "longSilenceDetected", + LongSilenceRecovered: "longSilenceRecovered", +} as const; +export type TranscribeAudioEventDataEvent = + (typeof TranscribeAudioEventDataEvent)[keyof typeof TranscribeAudioEventDataEvent]; diff --git a/src/api/types/TranscribeAudioEventMessage.ts b/src/api/types/TranscribeAudioEventMessage.ts new file mode 100644 index 00000000..f7f69f06 --- /dev/null +++ b/src/api/types/TranscribeAudioEventMessage.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 TranscribeAudioEventMessage { + type: "audioEvent"; + data: Corti.TranscribeAudioEventData; +} diff --git a/src/api/types/TranscribeAudioEventsConfig.ts b/src/api/types/TranscribeAudioEventsConfig.ts new file mode 100644 index 00000000..c6802e7a --- /dev/null +++ b/src/api/types/TranscribeAudioEventsConfig.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface TranscribeAudioEventsConfig { + /** When true, enables audio quality and speech activity events to be sent over the WebSocket. Disabled by default. */ + enabled?: boolean; +} diff --git a/src/api/types/TranscribeConfig.ts b/src/api/types/TranscribeConfig.ts index e651492f..0cb6beea 100644 --- a/src/api/types/TranscribeConfig.ts +++ b/src/api/types/TranscribeConfig.ts @@ -14,6 +14,7 @@ export interface TranscribeConfig { /** Commands that should be registered and detected */ commands?: Corti.TranscribeCommand[]; formatting?: Corti.TranscribeFormatting; + audioEvents?: Corti.TranscribeAudioEventsConfig; /** The audio format of the incoming audio stream */ audioFormat?: string; } diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 66b9b853..23c9b073 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"; @@ -73,11 +71,16 @@ export * from "./CommonDocumentIdContext.js"; export * from "./CommonDocumentIdContextType.js"; export * from "./CommonSortingDirectionEnum.js"; export * from "./CommonSourceEnum.js"; +export * from "./CommonStatusResponse.js"; export * from "./CommonTextContext.js"; 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 "./DocumentationEvidence.js"; export * from "./DocumentsContext.js"; export * from "./DocumentsContextWithFacts.js"; export * from "./DocumentsContextWithFactsType.js"; @@ -96,6 +99,7 @@ export * from "./DocumentsSectionOverride.js"; export * from "./DocumentsTemplate.js"; export * from "./DocumentsTemplateWithSectionKeys.js"; export * from "./DocumentsTemplateWithSections.js"; +export * from "./EphemeralDocument.js"; export * from "./ErrorResponse.js"; export * from "./FactsBatchUpdateInput.js"; export * from "./FactsBatchUpdateItem.js"; @@ -113,6 +117,38 @@ 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 "./GuidedDocumentContext.js"; +export * from "./GuidedDocumentFactMinimal.js"; +export * from "./GuidedDocumentsCreateEphemeralResponse.js"; +export * from "./GuidedDocumentsGenerateBase.js"; +export * from "./GuidedDocumentsGenerateByAssembly.js"; +export * from "./GuidedDocumentsGenerateByDynamic.js"; +export * from "./GuidedDocumentsGenerateByTemplateRef.js"; +export * from "./GuidedDocumentsGenerateRequest.js"; +export * from "./GuidedDocumentTranscriptMetadataMinimal.js"; +export * from "./GuidedDocumentTranscriptMinimal.js"; +export * from "./GuidedDocumentTranscriptSegmentMinimal.js"; +export * from "./GuidedDynamicInline.js"; +export * from "./GuidedDynamicRequest.js"; +export * from "./GuidedSectionOverride.js"; +export * from "./GuidedSectionsCreateBase.js"; +export * from "./GuidedSectionsCreateFromInheritanceRequest.js"; +export * from "./GuidedSectionsCreateFromScratchRequest.js"; +export * from "./GuidedSectionsCreateRequest.js"; +export * from "./GuidedTemplateOverrides.js"; +export * from "./GuidedTemplateRef.js"; +export * from "./GuidedTemplatesCreateBase.js"; +export * from "./GuidedTemplatesCreateFromInheritanceRequest.js"; +export * from "./GuidedTemplatesCreateFromInheritanceRequestGeneration.js"; +export * from "./GuidedTemplatesCreateFromScratchRequest.js"; +export * from "./GuidedTemplatesCreateFromScratchRequestGeneration.js"; +export * from "./GuidedTemplatesCreatePolicyRequest.js"; +export * from "./GuidedTemplatesCreatePolicyRequestKind.js"; +export * from "./GuidedTemplatesCreateRequest.js"; +export * from "./GuidedTemplatesVersionSectionRequest.js"; export * from "./InteractionsCreateResponse.js"; export * from "./InteractionsEncounterCreateRequest.js"; export * from "./InteractionsEncounterPeriod.js"; @@ -124,12 +160,30 @@ export * from "./InteractionsGenderEnum.js"; export * from "./InteractionsGetResponse.js"; export * from "./InteractionsListResponse.js"; export * from "./InteractionsPatient.js"; +export * from "./Label.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 "./SectionSource.js"; +export * from "./SectionVersion.js"; +export * from "./StreamAudioEventData.js"; +export * from "./StreamAudioEventDataEvent.js"; +export * from "./StreamAudioEventMessage.js"; +export * from "./StreamAudioEventsConfig.js"; export * from "./StreamConfig.js"; export * from "./StreamConfigMessage.js"; export * from "./StreamConfigMode.js"; +export * from "./StreamConfigModeFactGenerationInterval.js"; export * from "./StreamConfigModeType.js"; export * from "./StreamConfigParticipant.js"; export * from "./StreamConfigParticipantRole.js"; @@ -152,6 +206,14 @@ 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 "./TemplatePolicy.js"; +export * from "./TemplatePolicyKind.js"; +export * from "./TemplateSource.js"; export * from "./TemplatesDocumentationModeEnum.js"; export * from "./TemplatesFormatRule.js"; export * from "./TemplatesItem.js"; @@ -162,6 +224,11 @@ export * from "./TemplatesSectionSorted.js"; export * from "./TemplatesSectionTranslation.js"; export * from "./TemplatesTranslation.js"; export * from "./TemplatesWritingStyle.js"; +export * from "./TemplateVersion.js"; +export * from "./TranscribeAudioEventData.js"; +export * from "./TranscribeAudioEventDataEvent.js"; +export * from "./TranscribeAudioEventMessage.js"; +export * from "./TranscribeAudioEventsConfig.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/GuidedSectionsUpdateRequest.ts b/src/serialization/resources/documents/resources/sections/client/requests/GuidedSectionsUpdateRequest.ts new file mode 100644 index 00000000..3f2f93fd --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/client/requests/GuidedSectionsUpdateRequest.ts @@ -0,0 +1,29 @@ +// 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 { Label } from "../../../../../../types/Label.js"; + +export const GuidedSectionsUpdateRequest: core.serialization.Schema< + serializers.documents.GuidedSectionsUpdateRequest.Raw, + Corti.documents.GuidedSectionsUpdateRequest +> = core.serialization.object({ + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + languages: core.serialization.list(core.serialization.string()).optional(), + regions: core.serialization.list(core.serialization.string()).optional(), + specialties: core.serialization.list(core.serialization.string()).optional(), + labels: core.serialization.list(Label).optional(), +}); + +export declare namespace GuidedSectionsUpdateRequest { + export interface Raw { + name?: string | null; + description?: string | null; + languages?: string[] | null; + regions?: string[] | null; + specialties?: string[] | null; + labels?: Label.Raw[] | 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..8030e204 --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/client/requests/index.ts @@ -0,0 +1 @@ +export { GuidedSectionsUpdateRequest } from "./GuidedSectionsUpdateRequest.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..766a768b --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/resources/index.ts @@ -0,0 +1,2 @@ +export * from "./versions/client/requests/index.js"; +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..cd155427 --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/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/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/client/requests/GuidedSectionsCreateVersionRequest.ts b/src/serialization/resources/documents/resources/sections/resources/versions/client/requests/GuidedSectionsCreateVersionRequest.ts new file mode 100644 index 00000000..074ca040 --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/resources/versions/client/requests/GuidedSectionsCreateVersionRequest.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 { SectionGeneration } from "../../../../../../../../types/SectionGeneration.js"; + +export const GuidedSectionsCreateVersionRequest: core.serialization.Schema< + serializers.documents.sections.GuidedSectionsCreateVersionRequest.Raw, + Corti.documents.sections.GuidedSectionsCreateVersionRequest +> = core.serialization.object({ + generation: SectionGeneration, +}); + +export declare namespace GuidedSectionsCreateVersionRequest { + export interface Raw { + generation: SectionGeneration.Raw; + } +} diff --git a/src/serialization/resources/documents/resources/sections/resources/versions/client/requests/index.ts b/src/serialization/resources/documents/resources/sections/resources/versions/client/requests/index.ts new file mode 100644 index 00000000..9a2bd635 --- /dev/null +++ b/src/serialization/resources/documents/resources/sections/resources/versions/client/requests/index.ts @@ -0,0 +1 @@ +export { GuidedSectionsCreateVersionRequest } from "./GuidedSectionsCreateVersionRequest.js"; 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/GuidedTemplatesUpdateRequest.ts b/src/serialization/resources/documents/resources/templates/client/requests/GuidedTemplatesUpdateRequest.ts new file mode 100644 index 00000000..97efa291 --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/client/requests/GuidedTemplatesUpdateRequest.ts @@ -0,0 +1,29 @@ +// 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 { Label } from "../../../../../../types/Label.js"; + +export const GuidedTemplatesUpdateRequest: core.serialization.Schema< + serializers.documents.GuidedTemplatesUpdateRequest.Raw, + Corti.documents.GuidedTemplatesUpdateRequest +> = core.serialization.object({ + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + languages: core.serialization.list(core.serialization.string()).optional(), + regions: core.serialization.list(core.serialization.string()).optional(), + specialties: core.serialization.list(core.serialization.string()).optional(), + labels: core.serialization.list(Label).optional(), +}); + +export declare namespace GuidedTemplatesUpdateRequest { + export interface Raw { + name?: string | null; + description?: string | null; + languages?: string[] | null; + regions?: string[] | null; + specialties?: string[] | null; + labels?: Label.Raw[] | 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..10fb1166 --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/client/requests/index.ts @@ -0,0 +1 @@ +export { GuidedTemplatesUpdateRequest } from "./GuidedTemplatesUpdateRequest.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/GuidedTemplatesCreateVersionRequest.ts b/src/serialization/resources/documents/resources/templates/resources/versions/client/requests/GuidedTemplatesCreateVersionRequest.ts new file mode 100644 index 00000000..dc6e383f --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/resources/versions/client/requests/GuidedTemplatesCreateVersionRequest.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 { GuidedTemplatesCreateVersionRequestGeneration } from "../../types/GuidedTemplatesCreateVersionRequestGeneration.js"; + +export const GuidedTemplatesCreateVersionRequest: core.serialization.Schema< + serializers.documents.templates.GuidedTemplatesCreateVersionRequest.Raw, + Corti.documents.templates.GuidedTemplatesCreateVersionRequest +> = core.serialization.object({ + generation: GuidedTemplatesCreateVersionRequestGeneration, +}); + +export declare namespace GuidedTemplatesCreateVersionRequest { + export interface Raw { + generation: GuidedTemplatesCreateVersionRequestGeneration.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..882cf459 --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/resources/versions/client/requests/index.ts @@ -0,0 +1 @@ +export { GuidedTemplatesCreateVersionRequest } from "./GuidedTemplatesCreateVersionRequest.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/GuidedTemplatesCreateVersionRequestGeneration.ts b/src/serialization/resources/documents/resources/templates/resources/versions/types/GuidedTemplatesCreateVersionRequestGeneration.ts new file mode 100644 index 00000000..0e87a3e5 --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/resources/versions/types/GuidedTemplatesCreateVersionRequestGeneration.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 { GuidedTemplatesVersionSectionRequest } from "../../../../../../../types/GuidedTemplatesVersionSectionRequest.js"; +import { TemplateInstructions } from "../../../../../../../types/TemplateInstructions.js"; + +export const GuidedTemplatesCreateVersionRequestGeneration: core.serialization.ObjectSchema< + serializers.documents.templates.GuidedTemplatesCreateVersionRequestGeneration.Raw, + Corti.documents.templates.GuidedTemplatesCreateVersionRequestGeneration +> = core.serialization.object({ + instructions: TemplateInstructions, + sections: core.serialization.list(GuidedTemplatesVersionSectionRequest).optional(), +}); + +export declare namespace GuidedTemplatesCreateVersionRequestGeneration { + export interface Raw { + instructions: TemplateInstructions.Raw; + sections?: GuidedTemplatesVersionSectionRequest.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..421609d5 --- /dev/null +++ b/src/serialization/resources/documents/resources/templates/resources/versions/types/index.ts @@ -0,0 +1 @@ +export * from "./GuidedTemplatesCreateVersionRequestGeneration.js"; diff --git a/src/serialization/resources/stream/client/socket/StreamSocketResponse.ts b/src/serialization/resources/stream/client/socket/StreamSocketResponse.ts index 6a4bb9a0..a93b5a70 100644 --- a/src/serialization/resources/stream/client/socket/StreamSocketResponse.ts +++ b/src/serialization/resources/stream/client/socket/StreamSocketResponse.ts @@ -3,6 +3,7 @@ import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; import type * as serializers from "../../../../index.js"; +import { StreamAudioEventMessage } from "../../../../types/StreamAudioEventMessage.js"; import { StreamConfigStatusMessage } from "../../../../types/StreamConfigStatusMessage.js"; import { StreamDeltaUsageMessage } from "../../../../types/StreamDeltaUsageMessage.js"; import { StreamEndedMessage } from "../../../../types/StreamEndedMessage.js"; @@ -22,6 +23,7 @@ export const StreamSocketResponse: core.serialization.Schema< | Corti.StreamUsageMessage | Corti.StreamErrorMessage | Corti.StreamConfigStatusMessage + | Corti.StreamAudioEventMessage > = core.serialization.undiscriminatedUnion([ StreamTranscriptMessage, StreamFactsMessage, @@ -31,6 +33,7 @@ export const StreamSocketResponse: core.serialization.Schema< StreamUsageMessage, StreamErrorMessage, StreamConfigStatusMessage, + StreamAudioEventMessage, ]); export declare namespace StreamSocketResponse { @@ -42,5 +45,6 @@ export declare namespace StreamSocketResponse { | StreamEndedMessage.Raw | StreamUsageMessage.Raw | StreamErrorMessage.Raw - | StreamConfigStatusMessage.Raw; + | StreamConfigStatusMessage.Raw + | StreamAudioEventMessage.Raw; } diff --git a/src/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.ts b/src/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.ts index 32c21517..c530f75a 100644 --- a/src/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.ts +++ b/src/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.ts @@ -3,6 +3,7 @@ import type * as Corti from "../../../../../api/index.js"; import * as core from "../../../../../core/index.js"; import type * as serializers from "../../../../index.js"; +import { TranscribeAudioEventMessage } from "../../../../types/TranscribeAudioEventMessage.js"; import { TranscribeCommandMessage } from "../../../../types/TranscribeCommandMessage.js"; import { TranscribeConfigStatusMessage } from "../../../../types/TranscribeConfigStatusMessage.js"; import { TranscribeDeltaUsageMessage } from "../../../../types/TranscribeDeltaUsageMessage.js"; @@ -22,6 +23,7 @@ export const TranscribeSocketResponse: core.serialization.Schema< | Corti.TranscribeTranscriptMessage | Corti.TranscribeCommandMessage | Corti.TranscribeConfigStatusMessage + | Corti.TranscribeAudioEventMessage > = core.serialization.undiscriminatedUnion([ TranscribeUsageMessage, TranscribeFlushedMessage, @@ -31,6 +33,7 @@ export const TranscribeSocketResponse: core.serialization.Schema< TranscribeTranscriptMessage, TranscribeCommandMessage, TranscribeConfigStatusMessage, + TranscribeAudioEventMessage, ]); export declare namespace TranscribeSocketResponse { @@ -42,5 +45,6 @@ export declare namespace TranscribeSocketResponse { | TranscribeErrorMessage.Raw | TranscribeTranscriptMessage.Raw | TranscribeCommandMessage.Raw - | TranscribeConfigStatusMessage.Raw; + | TranscribeConfigStatusMessage.Raw + | TranscribeAudioEventMessage.Raw; } 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/CommonStatusResponse.ts b/src/serialization/types/CommonStatusResponse.ts new file mode 100644 index 00000000..0f8bc28f --- /dev/null +++ b/src/serialization/types/CommonStatusResponse.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 { DocumentationEvidence } from "./DocumentationEvidence.js"; + +export const CommonStatusResponse: core.serialization.ObjectSchema< + serializers.CommonStatusResponse.Raw, + Corti.CommonStatusResponse +> = core.serialization.object({ + status: core.serialization.string(), + evidence: DocumentationEvidence.optional(), +}); + +export declare namespace CommonStatusResponse { + export interface Raw { + status: string; + evidence?: DocumentationEvidence.Raw | 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/DocumentationEvidence.ts b/src/serialization/types/DocumentationEvidence.ts new file mode 100644 index 00000000..279420af --- /dev/null +++ b/src/serialization/types/DocumentationEvidence.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 { Uuid } from "./Uuid.js"; + +export const DocumentationEvidence: core.serialization.ObjectSchema< + serializers.DocumentationEvidence.Raw, + Corti.DocumentationEvidence +> = core.serialization.object({ + evidenceId: Uuid.optional(), + type: core.serialization.string().optional(), + quote: core.serialization.string().optional(), +}); + +export declare namespace DocumentationEvidence { + export interface Raw { + evidenceId?: Uuid.Raw | null; + type?: string | null; + quote?: string | null; + } +} diff --git a/src/serialization/types/EphemeralDocument.ts b/src/serialization/types/EphemeralDocument.ts new file mode 100644 index 00000000..eac13132 --- /dev/null +++ b/src/serialization/types/EphemeralDocument.ts @@ -0,0 +1,30 @@ +// 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 EphemeralDocument: core.serialization.ObjectSchema< + serializers.EphemeralDocument.Raw, + Corti.EphemeralDocument +> = core.serialization.object({ + name: core.serialization.string(), + templateId: core.serialization.string(), + templateVersionId: core.serialization.string(), + language: core.serialization.string(), + stringDocument: core.serialization.record(core.serialization.string(), core.serialization.string()), + structuredDocument: core.serialization + .record(core.serialization.string(), core.serialization.unknown()) + .optionalNullable(), +}); + +export declare namespace EphemeralDocument { + export interface Raw { + name: string; + templateId: string; + templateVersionId: string; + language: string; + stringDocument: Record; + structuredDocument?: (Record | null | undefined) | null; + } +} 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..7d96ad38 --- /dev/null +++ b/src/serialization/types/GuidedAssemblyRequest.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 { 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(), + instructions: TemplateInstructions.optional(), + sectionRefs: core.serialization.list(GuidedAssemblySectionRef), +}); + +export declare namespace GuidedAssemblyRequest { + export interface Raw { + name: 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/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/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/GuidedDocumentsCreateEphemeralResponse.ts b/src/serialization/types/GuidedDocumentsCreateEphemeralResponse.ts new file mode 100644 index 00000000..479c9a81 --- /dev/null +++ b/src/serialization/types/GuidedDocumentsCreateEphemeralResponse.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 { CommonUsageInfo } from "./CommonUsageInfo.js"; +import { EphemeralDocument } from "./EphemeralDocument.js"; + +export const GuidedDocumentsCreateEphemeralResponse: core.serialization.ObjectSchema< + serializers.GuidedDocumentsCreateEphemeralResponse.Raw, + Corti.GuidedDocumentsCreateEphemeralResponse +> = core.serialization.object({ + document: EphemeralDocument, + usageInfo: CommonUsageInfo, +}); + +export declare namespace GuidedDocumentsCreateEphemeralResponse { + export interface Raw { + document: EphemeralDocument.Raw; + usageInfo: CommonUsageInfo.Raw; + } +} diff --git a/src/serialization/types/GuidedDocumentsGenerateBase.ts b/src/serialization/types/GuidedDocumentsGenerateBase.ts new file mode 100644 index 00000000..8547bfe1 --- /dev/null +++ b/src/serialization/types/GuidedDocumentsGenerateBase.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 { GuidedDocumentContext } from "./GuidedDocumentContext.js"; + +export const GuidedDocumentsGenerateBase: core.serialization.ObjectSchema< + serializers.GuidedDocumentsGenerateBase.Raw, + Corti.GuidedDocumentsGenerateBase +> = core.serialization.object({ + outputLanguage: core.serialization.string(), + context: core.serialization.list(GuidedDocumentContext).optional(), + interactionId: core.serialization.string().optional(), +}); + +export declare namespace GuidedDocumentsGenerateBase { + export interface Raw { + outputLanguage: string; + context?: GuidedDocumentContext.Raw[] | null; + interactionId?: string | null; + } +} diff --git a/src/serialization/types/GuidedDocumentsGenerateByAssembly.ts b/src/serialization/types/GuidedDocumentsGenerateByAssembly.ts new file mode 100644 index 00000000..0ca63a4b --- /dev/null +++ b/src/serialization/types/GuidedDocumentsGenerateByAssembly.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 { GuidedAssemblyRequest } from "./GuidedAssemblyRequest.js"; +import { GuidedDocumentsGenerateBase } from "./GuidedDocumentsGenerateBase.js"; + +export const GuidedDocumentsGenerateByAssembly: core.serialization.ObjectSchema< + serializers.GuidedDocumentsGenerateByAssembly.Raw, + Corti.GuidedDocumentsGenerateByAssembly +> = core.serialization + .object({ + assemblyTemplate: GuidedAssemblyRequest, + }) + .extend(GuidedDocumentsGenerateBase); + +export declare namespace GuidedDocumentsGenerateByAssembly { + export interface Raw extends GuidedDocumentsGenerateBase.Raw { + assemblyTemplate: GuidedAssemblyRequest.Raw; + } +} diff --git a/src/serialization/types/GuidedDocumentsGenerateByDynamic.ts b/src/serialization/types/GuidedDocumentsGenerateByDynamic.ts new file mode 100644 index 00000000..acdb2cde --- /dev/null +++ b/src/serialization/types/GuidedDocumentsGenerateByDynamic.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 { GuidedDocumentsGenerateBase } from "./GuidedDocumentsGenerateBase.js"; +import { GuidedDynamicRequest } from "./GuidedDynamicRequest.js"; + +export const GuidedDocumentsGenerateByDynamic: core.serialization.ObjectSchema< + serializers.GuidedDocumentsGenerateByDynamic.Raw, + Corti.GuidedDocumentsGenerateByDynamic +> = core.serialization + .object({ + dynamicTemplate: GuidedDynamicRequest, + }) + .extend(GuidedDocumentsGenerateBase); + +export declare namespace GuidedDocumentsGenerateByDynamic { + export interface Raw extends GuidedDocumentsGenerateBase.Raw { + dynamicTemplate: GuidedDynamicRequest.Raw; + } +} diff --git a/src/serialization/types/GuidedDocumentsGenerateByTemplateRef.ts b/src/serialization/types/GuidedDocumentsGenerateByTemplateRef.ts new file mode 100644 index 00000000..3a7df0b8 --- /dev/null +++ b/src/serialization/types/GuidedDocumentsGenerateByTemplateRef.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 { GuidedDocumentsGenerateBase } from "./GuidedDocumentsGenerateBase.js"; +import { GuidedTemplateRef } from "./GuidedTemplateRef.js"; + +export const GuidedDocumentsGenerateByTemplateRef: core.serialization.ObjectSchema< + serializers.GuidedDocumentsGenerateByTemplateRef.Raw, + Corti.GuidedDocumentsGenerateByTemplateRef +> = core.serialization + .object({ + templateRef: GuidedTemplateRef, + }) + .extend(GuidedDocumentsGenerateBase); + +export declare namespace GuidedDocumentsGenerateByTemplateRef { + export interface Raw extends GuidedDocumentsGenerateBase.Raw { + templateRef: GuidedTemplateRef.Raw; + } +} diff --git a/src/serialization/types/GuidedDocumentsGenerateRequest.ts b/src/serialization/types/GuidedDocumentsGenerateRequest.ts new file mode 100644 index 00000000..4651dc8e --- /dev/null +++ b/src/serialization/types/GuidedDocumentsGenerateRequest.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 { GuidedDocumentsGenerateByAssembly } from "./GuidedDocumentsGenerateByAssembly.js"; +import { GuidedDocumentsGenerateByDynamic } from "./GuidedDocumentsGenerateByDynamic.js"; +import { GuidedDocumentsGenerateByTemplateRef } from "./GuidedDocumentsGenerateByTemplateRef.js"; + +export const GuidedDocumentsGenerateRequest: core.serialization.Schema< + serializers.GuidedDocumentsGenerateRequest.Raw, + Corti.GuidedDocumentsGenerateRequest +> = core.serialization.undiscriminatedUnion([ + GuidedDocumentsGenerateByTemplateRef, + GuidedDocumentsGenerateByAssembly, + GuidedDocumentsGenerateByDynamic, +]); + +export declare namespace GuidedDocumentsGenerateRequest { + export type Raw = + | GuidedDocumentsGenerateByTemplateRef.Raw + | GuidedDocumentsGenerateByAssembly.Raw + | GuidedDocumentsGenerateByDynamic.Raw; +} 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..d6d46367 --- /dev/null +++ b/src/serialization/types/GuidedDynamicRequest.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 { GuidedDynamicInline } from "./GuidedDynamicInline.js"; + +export const GuidedDynamicRequest: core.serialization.ObjectSchema< + serializers.GuidedDynamicRequest.Raw, + Corti.GuidedDynamicRequest +> = core.serialization.object({ + name: core.serialization.string(), + generation: GuidedDynamicInline, +}); + +export declare namespace GuidedDynamicRequest { + export interface Raw { + name: string; + generation: GuidedDynamicInline.Raw; + } +} 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/GuidedSectionsCreateBase.ts b/src/serialization/types/GuidedSectionsCreateBase.ts new file mode 100644 index 00000000..99640d8b --- /dev/null +++ b/src/serialization/types/GuidedSectionsCreateBase.ts @@ -0,0 +1,31 @@ +// 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 { Label } from "./Label.js"; + +export const GuidedSectionsCreateBase: core.serialization.ObjectSchema< + serializers.GuidedSectionsCreateBase.Raw, + Corti.GuidedSectionsCreateBase +> = core.serialization.object({ + name: core.serialization.string(), + description: core.serialization.string().optional(), + languages: core.serialization.list(core.serialization.string()).optional(), + regions: core.serialization.list(core.serialization.string()).optional(), + specialties: core.serialization.list(core.serialization.string()).optional(), + labels: core.serialization.list(Label).optional(), + publish: core.serialization.boolean().optional(), +}); + +export declare namespace GuidedSectionsCreateBase { + export interface Raw { + name: string; + description?: string | null; + languages?: string[] | null; + regions?: string[] | null; + specialties?: string[] | null; + labels?: Label.Raw[] | null; + publish?: boolean | null; + } +} diff --git a/src/serialization/types/GuidedSectionsCreateFromInheritanceRequest.ts b/src/serialization/types/GuidedSectionsCreateFromInheritanceRequest.ts new file mode 100644 index 00000000..d3b38a1b --- /dev/null +++ b/src/serialization/types/GuidedSectionsCreateFromInheritanceRequest.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 { GuidedSectionsCreateBase } from "./GuidedSectionsCreateBase.js"; +import { SectionGenerationPartial } from "./SectionGenerationPartial.js"; + +export const GuidedSectionsCreateFromInheritanceRequest: core.serialization.ObjectSchema< + serializers.GuidedSectionsCreateFromInheritanceRequest.Raw, + Corti.GuidedSectionsCreateFromInheritanceRequest +> = core.serialization + .object({ + inheritFromId: core.serialization.string(), + generation: SectionGenerationPartial.optional(), + }) + .extend(GuidedSectionsCreateBase); + +export declare namespace GuidedSectionsCreateFromInheritanceRequest { + export interface Raw extends GuidedSectionsCreateBase.Raw { + inheritFromId: string; + generation?: SectionGenerationPartial.Raw | null; + } +} diff --git a/src/serialization/types/GuidedSectionsCreateFromScratchRequest.ts b/src/serialization/types/GuidedSectionsCreateFromScratchRequest.ts new file mode 100644 index 00000000..a80751fa --- /dev/null +++ b/src/serialization/types/GuidedSectionsCreateFromScratchRequest.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 { GuidedSectionsCreateBase } from "./GuidedSectionsCreateBase.js"; +import { SectionGeneration } from "./SectionGeneration.js"; + +export const GuidedSectionsCreateFromScratchRequest: core.serialization.ObjectSchema< + serializers.GuidedSectionsCreateFromScratchRequest.Raw, + Corti.GuidedSectionsCreateFromScratchRequest +> = core.serialization + .object({ + generation: SectionGeneration, + }) + .extend(GuidedSectionsCreateBase); + +export declare namespace GuidedSectionsCreateFromScratchRequest { + export interface Raw extends GuidedSectionsCreateBase.Raw { + generation: SectionGeneration.Raw; + } +} diff --git a/src/serialization/types/GuidedSectionsCreateRequest.ts b/src/serialization/types/GuidedSectionsCreateRequest.ts new file mode 100644 index 00000000..71e06efc --- /dev/null +++ b/src/serialization/types/GuidedSectionsCreateRequest.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 { GuidedSectionsCreateFromInheritanceRequest } from "./GuidedSectionsCreateFromInheritanceRequest.js"; +import { GuidedSectionsCreateFromScratchRequest } from "./GuidedSectionsCreateFromScratchRequest.js"; + +export const GuidedSectionsCreateRequest: core.serialization.Schema< + serializers.GuidedSectionsCreateRequest.Raw, + Corti.GuidedSectionsCreateRequest +> = core.serialization.undiscriminatedUnion([ + GuidedSectionsCreateFromScratchRequest, + GuidedSectionsCreateFromInheritanceRequest, +]); + +export declare namespace GuidedSectionsCreateRequest { + export type Raw = GuidedSectionsCreateFromScratchRequest.Raw | GuidedSectionsCreateFromInheritanceRequest.Raw; +} 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/GuidedTemplatesCreateBase.ts b/src/serialization/types/GuidedTemplatesCreateBase.ts new file mode 100644 index 00000000..21bd996a --- /dev/null +++ b/src/serialization/types/GuidedTemplatesCreateBase.ts @@ -0,0 +1,34 @@ +// 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 { GuidedTemplatesCreatePolicyRequest } from "./GuidedTemplatesCreatePolicyRequest.js"; +import { Label } from "./Label.js"; + +export const GuidedTemplatesCreateBase: core.serialization.ObjectSchema< + serializers.GuidedTemplatesCreateBase.Raw, + Corti.GuidedTemplatesCreateBase +> = core.serialization.object({ + name: core.serialization.string(), + description: core.serialization.string().optional(), + languages: core.serialization.list(core.serialization.string()).optional(), + regions: core.serialization.list(core.serialization.string()).optional(), + specialties: core.serialization.list(core.serialization.string()).optional(), + labels: core.serialization.list(Label).optional(), + publish: core.serialization.boolean().optional(), + policies: core.serialization.list(GuidedTemplatesCreatePolicyRequest).optional(), +}); + +export declare namespace GuidedTemplatesCreateBase { + export interface Raw { + name: string; + description?: string | null; + languages?: string[] | null; + regions?: string[] | null; + specialties?: string[] | null; + labels?: Label.Raw[] | null; + publish?: boolean | null; + policies?: GuidedTemplatesCreatePolicyRequest.Raw[] | null; + } +} diff --git a/src/serialization/types/GuidedTemplatesCreateFromInheritanceRequest.ts b/src/serialization/types/GuidedTemplatesCreateFromInheritanceRequest.ts new file mode 100644 index 00000000..e0792a72 --- /dev/null +++ b/src/serialization/types/GuidedTemplatesCreateFromInheritanceRequest.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 { GuidedTemplatesCreateBase } from "./GuidedTemplatesCreateBase.js"; +import { GuidedTemplatesCreateFromInheritanceRequestGeneration } from "./GuidedTemplatesCreateFromInheritanceRequestGeneration.js"; + +export const GuidedTemplatesCreateFromInheritanceRequest: core.serialization.ObjectSchema< + serializers.GuidedTemplatesCreateFromInheritanceRequest.Raw, + Corti.GuidedTemplatesCreateFromInheritanceRequest +> = core.serialization + .object({ + inheritFromId: core.serialization.string(), + generation: GuidedTemplatesCreateFromInheritanceRequestGeneration.optional(), + }) + .extend(GuidedTemplatesCreateBase); + +export declare namespace GuidedTemplatesCreateFromInheritanceRequest { + export interface Raw extends GuidedTemplatesCreateBase.Raw { + inheritFromId: string; + generation?: GuidedTemplatesCreateFromInheritanceRequestGeneration.Raw | null; + } +} diff --git a/src/serialization/types/GuidedTemplatesCreateFromInheritanceRequestGeneration.ts b/src/serialization/types/GuidedTemplatesCreateFromInheritanceRequestGeneration.ts new file mode 100644 index 00000000..fc97a421 --- /dev/null +++ b/src/serialization/types/GuidedTemplatesCreateFromInheritanceRequestGeneration.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 { GuidedTemplatesVersionSectionRequest } from "./GuidedTemplatesVersionSectionRequest.js"; +import { TemplateInstructionsPartial } from "./TemplateInstructionsPartial.js"; + +export const GuidedTemplatesCreateFromInheritanceRequestGeneration: core.serialization.ObjectSchema< + serializers.GuidedTemplatesCreateFromInheritanceRequestGeneration.Raw, + Corti.GuidedTemplatesCreateFromInheritanceRequestGeneration +> = core.serialization.object({ + instructions: TemplateInstructionsPartial.optional(), + sections: core.serialization.list(GuidedTemplatesVersionSectionRequest).optional(), +}); + +export declare namespace GuidedTemplatesCreateFromInheritanceRequestGeneration { + export interface Raw { + instructions?: TemplateInstructionsPartial.Raw | null; + sections?: GuidedTemplatesVersionSectionRequest.Raw[] | null; + } +} diff --git a/src/serialization/types/GuidedTemplatesCreateFromScratchRequest.ts b/src/serialization/types/GuidedTemplatesCreateFromScratchRequest.ts new file mode 100644 index 00000000..70683b43 --- /dev/null +++ b/src/serialization/types/GuidedTemplatesCreateFromScratchRequest.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 { GuidedTemplatesCreateBase } from "./GuidedTemplatesCreateBase.js"; +import { GuidedTemplatesCreateFromScratchRequestGeneration } from "./GuidedTemplatesCreateFromScratchRequestGeneration.js"; + +export const GuidedTemplatesCreateFromScratchRequest: core.serialization.ObjectSchema< + serializers.GuidedTemplatesCreateFromScratchRequest.Raw, + Corti.GuidedTemplatesCreateFromScratchRequest +> = core.serialization + .object({ + generation: GuidedTemplatesCreateFromScratchRequestGeneration, + }) + .extend(GuidedTemplatesCreateBase); + +export declare namespace GuidedTemplatesCreateFromScratchRequest { + export interface Raw extends GuidedTemplatesCreateBase.Raw { + generation: GuidedTemplatesCreateFromScratchRequestGeneration.Raw; + } +} diff --git a/src/serialization/types/GuidedTemplatesCreateFromScratchRequestGeneration.ts b/src/serialization/types/GuidedTemplatesCreateFromScratchRequestGeneration.ts new file mode 100644 index 00000000..7845794b --- /dev/null +++ b/src/serialization/types/GuidedTemplatesCreateFromScratchRequestGeneration.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 { GuidedTemplatesVersionSectionRequest } from "./GuidedTemplatesVersionSectionRequest.js"; +import { TemplateInstructions } from "./TemplateInstructions.js"; + +export const GuidedTemplatesCreateFromScratchRequestGeneration: core.serialization.ObjectSchema< + serializers.GuidedTemplatesCreateFromScratchRequestGeneration.Raw, + Corti.GuidedTemplatesCreateFromScratchRequestGeneration +> = core.serialization.object({ + instructions: TemplateInstructions, + sections: core.serialization.list(GuidedTemplatesVersionSectionRequest).optional(), +}); + +export declare namespace GuidedTemplatesCreateFromScratchRequestGeneration { + export interface Raw { + instructions: TemplateInstructions.Raw; + sections?: GuidedTemplatesVersionSectionRequest.Raw[] | null; + } +} diff --git a/src/serialization/types/GuidedTemplatesCreatePolicyRequest.ts b/src/serialization/types/GuidedTemplatesCreatePolicyRequest.ts new file mode 100644 index 00000000..6384504f --- /dev/null +++ b/src/serialization/types/GuidedTemplatesCreatePolicyRequest.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 { GuidedTemplatesCreatePolicyRequestKind } from "./GuidedTemplatesCreatePolicyRequestKind.js"; + +export const GuidedTemplatesCreatePolicyRequest: core.serialization.ObjectSchema< + serializers.GuidedTemplatesCreatePolicyRequest.Raw, + Corti.GuidedTemplatesCreatePolicyRequest +> = core.serialization.object({ + kind: GuidedTemplatesCreatePolicyRequestKind, + customerIds: core.serialization.list(core.serialization.string()).optionalNullable(), +}); + +export declare namespace GuidedTemplatesCreatePolicyRequest { + export interface Raw { + kind: GuidedTemplatesCreatePolicyRequestKind.Raw; + customerIds?: (string[] | null | undefined) | null; + } +} diff --git a/src/serialization/types/GuidedTemplatesCreatePolicyRequestKind.ts b/src/serialization/types/GuidedTemplatesCreatePolicyRequestKind.ts new file mode 100644 index 00000000..152bdcbd --- /dev/null +++ b/src/serialization/types/GuidedTemplatesCreatePolicyRequestKind.ts @@ -0,0 +1,14 @@ +// 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 GuidedTemplatesCreatePolicyRequestKind: core.serialization.Schema< + serializers.GuidedTemplatesCreatePolicyRequestKind.Raw, + Corti.GuidedTemplatesCreatePolicyRequestKind +> = core.serialization.enum_(["project", "customers"]); + +export declare namespace GuidedTemplatesCreatePolicyRequestKind { + export type Raw = "project" | "customers"; +} diff --git a/src/serialization/types/GuidedTemplatesCreateRequest.ts b/src/serialization/types/GuidedTemplatesCreateRequest.ts new file mode 100644 index 00000000..5882b908 --- /dev/null +++ b/src/serialization/types/GuidedTemplatesCreateRequest.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 { GuidedTemplatesCreateFromInheritanceRequest } from "./GuidedTemplatesCreateFromInheritanceRequest.js"; +import { GuidedTemplatesCreateFromScratchRequest } from "./GuidedTemplatesCreateFromScratchRequest.js"; + +export const GuidedTemplatesCreateRequest: core.serialization.Schema< + serializers.GuidedTemplatesCreateRequest.Raw, + Corti.GuidedTemplatesCreateRequest +> = core.serialization.undiscriminatedUnion([ + GuidedTemplatesCreateFromScratchRequest, + GuidedTemplatesCreateFromInheritanceRequest, +]); + +export declare namespace GuidedTemplatesCreateRequest { + export type Raw = GuidedTemplatesCreateFromScratchRequest.Raw | GuidedTemplatesCreateFromInheritanceRequest.Raw; +} diff --git a/src/serialization/types/GuidedTemplatesVersionSectionRequest.ts b/src/serialization/types/GuidedTemplatesVersionSectionRequest.ts new file mode 100644 index 00000000..17fc7cf1 --- /dev/null +++ b/src/serialization/types/GuidedTemplatesVersionSectionRequest.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 GuidedTemplatesVersionSectionRequest: core.serialization.ObjectSchema< + serializers.GuidedTemplatesVersionSectionRequest.Raw, + Corti.GuidedTemplatesVersionSectionRequest +> = core.serialization.object({ + sectionId: core.serialization.string(), + orderIndex: core.serialization.number().optional(), +}); + +export declare namespace GuidedTemplatesVersionSectionRequest { + export interface Raw { + sectionId: string; + orderIndex?: number | null; + } +} diff --git a/src/serialization/types/Label.ts b/src/serialization/types/Label.ts new file mode 100644 index 00000000..7c29664a --- /dev/null +++ b/src/serialization/types/Label.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"; + +export const Label: core.serialization.ObjectSchema = core.serialization.object({ + key: core.serialization.string(), + value: core.serialization.string(), +}); + +export declare namespace Label { + export interface Raw { + key: string; + value: string; + } +} 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..c293bff2 --- /dev/null +++ b/src/serialization/types/Section.ts @@ -0,0 +1,45 @@ +// 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 { Label } from "./Label.js"; +import { SectionSource } from "./SectionSource.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(), + source: SectionSource.optional(), + name: core.serialization.string(), + languages: core.serialization.list(core.serialization.string()), + regions: core.serialization.list(core.serialization.string()), + specialties: core.serialization.list(core.serialization.string()), + description: core.serialization.string().optional(), + labels: core.serialization.list(Label), + publishedVersion: SectionVersion.optional(), + createdAt: core.serialization.date(), + updatedAt: core.serialization.date(), + deletedAt: core.serialization.date().optionalNullable(), + }); + +export declare namespace Section { + export interface Raw { + id: string; + inheritedFromId?: (string | null | undefined) | null; + autoGenerated?: boolean | null; + source?: SectionSource.Raw | null; + name: string; + languages: string[]; + regions: string[]; + specialties: string[]; + description?: string | null; + labels: Label.Raw[]; + publishedVersion?: SectionVersion.Raw | null; + createdAt: string; + updatedAt: string; + deletedAt?: (string | null | undefined) | null; + } +} 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..d396d60f --- /dev/null +++ b/src/serialization/types/SectionInstructionsOverride.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 SectionInstructionsOverride: core.serialization.ObjectSchema< + serializers.SectionInstructionsOverride.Raw, + Corti.SectionInstructionsOverride +> = core.serialization.object({ + contentPrompt: core.serialization.string().optional(), + writingStylePrompt: core.serialization.string().optional(), + miscPrompt: core.serialization.string().optional(), +}); + +export declare namespace SectionInstructionsOverride { + export interface Raw { + contentPrompt?: string | null; + writingStylePrompt?: string | null; + miscPrompt?: 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..479b13ee --- /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({ + heading: core.serialization.string().optionalNullable(), + instructions: SectionInstructionsOverride.optional(), + outputSchema: core.serialization.lazy(() => serializers.OutputSchema).optional(), +}); + +export declare namespace SectionOverrides { + export interface Raw { + heading?: (string | null | undefined) | null; + instructions?: SectionInstructionsOverride.Raw | null; + outputSchema?: serializers.OutputSchema.Raw | null; + } +} diff --git a/src/serialization/types/SectionSource.ts b/src/serialization/types/SectionSource.ts new file mode 100644 index 00000000..0b5e620f --- /dev/null +++ b/src/serialization/types/SectionSource.ts @@ -0,0 +1,12 @@ +// 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 SectionSource: core.serialization.Schema = + core.serialization.enum_(["user", "corti"]); + +export declare namespace SectionSource { + export type Raw = "user" | "corti"; +} diff --git a/src/serialization/types/SectionVersion.ts b/src/serialization/types/SectionVersion.ts new file mode 100644 index 00000000..dab7ed66 --- /dev/null +++ b/src/serialization/types/SectionVersion.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 { SectionGeneration } from "./SectionGeneration.js"; + +export const SectionVersion: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + versionNumber: core.serialization.number(), + deletedAt: core.serialization.date().optionalNullable(), + generation: SectionGeneration, + }); + +export declare namespace SectionVersion { + export interface Raw { + id: string; + versionNumber: number; + deletedAt?: (string | null | undefined) | null; + generation: SectionGeneration.Raw; + } +} diff --git a/src/serialization/types/StreamAudioEventData.ts b/src/serialization/types/StreamAudioEventData.ts new file mode 100644 index 00000000..debeecc7 --- /dev/null +++ b/src/serialization/types/StreamAudioEventData.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 { StreamAudioEventDataEvent } from "./StreamAudioEventDataEvent.js"; + +export const StreamAudioEventData: core.serialization.ObjectSchema< + serializers.StreamAudioEventData.Raw, + Corti.StreamAudioEventData +> = core.serialization.object({ + event: StreamAudioEventDataEvent, + channel: core.serialization.number(), + startTimeMs: core.serialization.number(), +}); + +export declare namespace StreamAudioEventData { + export interface Raw { + event: StreamAudioEventDataEvent.Raw; + channel: number; + startTimeMs: number; + } +} diff --git a/src/serialization/types/StreamAudioEventDataEvent.ts b/src/serialization/types/StreamAudioEventDataEvent.ts new file mode 100644 index 00000000..b6fbbe55 --- /dev/null +++ b/src/serialization/types/StreamAudioEventDataEvent.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"; + +export const StreamAudioEventDataEvent: core.serialization.Schema< + serializers.StreamAudioEventDataEvent.Raw, + Corti.StreamAudioEventDataEvent +> = core.serialization.enum_([ + "speechQualityIssueDetected", + "speechQualityIssueRecovered", + "longSilenceDetected", + "longSilenceRecovered", +]); + +export declare namespace StreamAudioEventDataEvent { + export type Raw = + | "speechQualityIssueDetected" + | "speechQualityIssueRecovered" + | "longSilenceDetected" + | "longSilenceRecovered"; +} diff --git a/src/serialization/types/StreamAudioEventMessage.ts b/src/serialization/types/StreamAudioEventMessage.ts new file mode 100644 index 00000000..48a44161 --- /dev/null +++ b/src/serialization/types/StreamAudioEventMessage.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 { StreamAudioEventData } from "./StreamAudioEventData.js"; + +export const StreamAudioEventMessage: core.serialization.ObjectSchema< + serializers.StreamAudioEventMessage.Raw, + Corti.StreamAudioEventMessage +> = core.serialization.object({ + type: core.serialization.stringLiteral("audioEvent"), + data: StreamAudioEventData, +}); + +export declare namespace StreamAudioEventMessage { + export interface Raw { + type: "audioEvent"; + data: StreamAudioEventData.Raw; + } +} diff --git a/src/serialization/types/StreamAudioEventsConfig.ts b/src/serialization/types/StreamAudioEventsConfig.ts new file mode 100644 index 00000000..60c48234 --- /dev/null +++ b/src/serialization/types/StreamAudioEventsConfig.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 StreamAudioEventsConfig: core.serialization.ObjectSchema< + serializers.StreamAudioEventsConfig.Raw, + Corti.StreamAudioEventsConfig +> = core.serialization.object({ + enabled: core.serialization.boolean().optional(), +}); + +export declare namespace StreamAudioEventsConfig { + export interface Raw { + enabled?: boolean | null; + } +} diff --git a/src/serialization/types/StreamConfig.ts b/src/serialization/types/StreamConfig.ts index c01d12f1..e9c3b762 100644 --- a/src/serialization/types/StreamConfig.ts +++ b/src/serialization/types/StreamConfig.ts @@ -3,6 +3,7 @@ import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; import type * as serializers from "../index.js"; +import { StreamAudioEventsConfig } from "./StreamAudioEventsConfig.js"; import { StreamConfigMode } from "./StreamConfigMode.js"; import { StreamConfigRetentionPolicy } from "./StreamConfigRetentionPolicy.js"; import { StreamConfigTranscription } from "./StreamConfigTranscription.js"; @@ -12,6 +13,7 @@ export const StreamConfig: core.serialization.ObjectSchema = core.serialization.object({ type: StreamConfigModeType, outputLocale: StreamSupportedLanguage.optional(), + factGenerationInterval: StreamConfigModeFactGenerationInterval.optional(), }); export declare namespace StreamConfigMode { export interface Raw { type: StreamConfigModeType.Raw; outputLocale?: StreamSupportedLanguage.Raw | null; + factGenerationInterval?: StreamConfigModeFactGenerationInterval.Raw | null; } } diff --git a/src/serialization/types/StreamConfigModeFactGenerationInterval.ts b/src/serialization/types/StreamConfigModeFactGenerationInterval.ts new file mode 100644 index 00000000..01a0ccef --- /dev/null +++ b/src/serialization/types/StreamConfigModeFactGenerationInterval.ts @@ -0,0 +1,14 @@ +// 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 StreamConfigModeFactGenerationInterval: core.serialization.Schema< + serializers.StreamConfigModeFactGenerationInterval.Raw, + Corti.StreamConfigModeFactGenerationInterval +> = core.serialization.enum_(["fixed", "fast_init"]); + +export declare namespace StreamConfigModeFactGenerationInterval { + export type Raw = "fixed" | "fast_init"; +} 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..0f84cf3a --- /dev/null +++ b/src/serialization/types/Template.ts @@ -0,0 +1,48 @@ +// 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 { Label } from "./Label.js"; +import { TemplatePolicy } from "./TemplatePolicy.js"; +import { TemplateSource } from "./TemplateSource.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(), + source: TemplateSource.optional(), + name: core.serialization.string(), + description: core.serialization.string().optional(), + languages: core.serialization.list(core.serialization.string()), + regions: core.serialization.list(core.serialization.string()), + specialties: core.serialization.list(core.serialization.string()), + labels: core.serialization.list(Label), + policies: core.serialization.list(TemplatePolicy).optional(), + publishedVersion: TemplateVersion.optional(), + createdAt: core.serialization.date(), + updatedAt: core.serialization.date(), + deletedAt: core.serialization.date().optionalNullable(), + }); + +export declare namespace Template { + export interface Raw { + id: string; + inheritedFromId?: (string | null | undefined) | null; + autoGenerated?: boolean | null; + source?: TemplateSource.Raw | null; + name: string; + description?: string | null; + languages: string[]; + regions: string[]; + specialties: string[]; + labels: Label.Raw[]; + policies?: TemplatePolicy.Raw[] | null; + publishedVersion?: TemplateVersion.Raw | null; + createdAt: string; + updatedAt: string; + deletedAt?: (string | null | undefined) | null; + } +} 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/TemplatePolicy.ts b/src/serialization/types/TemplatePolicy.ts new file mode 100644 index 00000000..adce035b --- /dev/null +++ b/src/serialization/types/TemplatePolicy.ts @@ -0,0 +1,29 @@ +// 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 { TemplatePolicyKind } from "./TemplatePolicyKind.js"; + +export const TemplatePolicy: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + kind: TemplatePolicyKind, + customerIds: core.serialization.list(core.serialization.string()).optionalNullable(), + templateId: core.serialization.string(), + createdBy: core.serialization.string(), + createdAt: core.serialization.date(), + updatedAt: core.serialization.date(), + }); + +export declare namespace TemplatePolicy { + export interface Raw { + id: string; + kind: TemplatePolicyKind.Raw; + customerIds?: (string[] | null | undefined) | null; + templateId: string; + createdBy: string; + createdAt: string; + updatedAt: string; + } +} diff --git a/src/serialization/types/TemplatePolicyKind.ts b/src/serialization/types/TemplatePolicyKind.ts new file mode 100644 index 00000000..6501d467 --- /dev/null +++ b/src/serialization/types/TemplatePolicyKind.ts @@ -0,0 +1,14 @@ +// 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 TemplatePolicyKind: core.serialization.Schema< + serializers.TemplatePolicyKind.Raw, + Corti.TemplatePolicyKind +> = core.serialization.enum_(["project", "customers"]); + +export declare namespace TemplatePolicyKind { + export type Raw = "project" | "customers"; +} diff --git a/src/serialization/types/TemplateSource.ts b/src/serialization/types/TemplateSource.ts new file mode 100644 index 00000000..82de4d20 --- /dev/null +++ b/src/serialization/types/TemplateSource.ts @@ -0,0 +1,12 @@ +// 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 TemplateSource: core.serialization.Schema = + core.serialization.enum_(["user", "corti"]); + +export declare namespace TemplateSource { + export type Raw = "user" | "corti"; +} diff --git a/src/serialization/types/TemplateVersion.ts b/src/serialization/types/TemplateVersion.ts new file mode 100644 index 00000000..85749f58 --- /dev/null +++ b/src/serialization/types/TemplateVersion.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 { TemplateGeneration } from "./TemplateGeneration.js"; + +export const TemplateVersion: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + versionNumber: core.serialization.number(), + deletedAt: core.serialization.date().optionalNullable(), + generation: TemplateGeneration, + }); + +export declare namespace TemplateVersion { + export interface Raw { + id: string; + versionNumber: number; + deletedAt?: (string | null | undefined) | null; + generation: TemplateGeneration.Raw; + } +} diff --git a/src/serialization/types/TranscribeAudioEventData.ts b/src/serialization/types/TranscribeAudioEventData.ts new file mode 100644 index 00000000..400347a2 --- /dev/null +++ b/src/serialization/types/TranscribeAudioEventData.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 { TranscribeAudioEventDataEvent } from "./TranscribeAudioEventDataEvent.js"; + +export const TranscribeAudioEventData: core.serialization.ObjectSchema< + serializers.TranscribeAudioEventData.Raw, + Corti.TranscribeAudioEventData +> = core.serialization.object({ + event: TranscribeAudioEventDataEvent, + channel: core.serialization.number(), + startTimeMs: core.serialization.number(), +}); + +export declare namespace TranscribeAudioEventData { + export interface Raw { + event: TranscribeAudioEventDataEvent.Raw; + channel: number; + startTimeMs: number; + } +} diff --git a/src/serialization/types/TranscribeAudioEventDataEvent.ts b/src/serialization/types/TranscribeAudioEventDataEvent.ts new file mode 100644 index 00000000..4d27ca09 --- /dev/null +++ b/src/serialization/types/TranscribeAudioEventDataEvent.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"; + +export const TranscribeAudioEventDataEvent: core.serialization.Schema< + serializers.TranscribeAudioEventDataEvent.Raw, + Corti.TranscribeAudioEventDataEvent +> = core.serialization.enum_([ + "speechQualityIssueDetected", + "speechQualityIssueRecovered", + "longSilenceDetected", + "longSilenceRecovered", +]); + +export declare namespace TranscribeAudioEventDataEvent { + export type Raw = + | "speechQualityIssueDetected" + | "speechQualityIssueRecovered" + | "longSilenceDetected" + | "longSilenceRecovered"; +} diff --git a/src/serialization/types/TranscribeAudioEventMessage.ts b/src/serialization/types/TranscribeAudioEventMessage.ts new file mode 100644 index 00000000..17efdee7 --- /dev/null +++ b/src/serialization/types/TranscribeAudioEventMessage.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 { TranscribeAudioEventData } from "./TranscribeAudioEventData.js"; + +export const TranscribeAudioEventMessage: core.serialization.ObjectSchema< + serializers.TranscribeAudioEventMessage.Raw, + Corti.TranscribeAudioEventMessage +> = core.serialization.object({ + type: core.serialization.stringLiteral("audioEvent"), + data: TranscribeAudioEventData, +}); + +export declare namespace TranscribeAudioEventMessage { + export interface Raw { + type: "audioEvent"; + data: TranscribeAudioEventData.Raw; + } +} diff --git a/src/serialization/types/TranscribeAudioEventsConfig.ts b/src/serialization/types/TranscribeAudioEventsConfig.ts new file mode 100644 index 00000000..bd2e793a --- /dev/null +++ b/src/serialization/types/TranscribeAudioEventsConfig.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 TranscribeAudioEventsConfig: core.serialization.ObjectSchema< + serializers.TranscribeAudioEventsConfig.Raw, + Corti.TranscribeAudioEventsConfig +> = core.serialization.object({ + enabled: core.serialization.boolean().optional(), +}); + +export declare namespace TranscribeAudioEventsConfig { + export interface Raw { + enabled?: boolean | null; + } +} diff --git a/src/serialization/types/TranscribeConfig.ts b/src/serialization/types/TranscribeConfig.ts index 8f957e6d..fc2fe365 100644 --- a/src/serialization/types/TranscribeConfig.ts +++ b/src/serialization/types/TranscribeConfig.ts @@ -3,6 +3,7 @@ import type * as Corti from "../../api/index.js"; import * as core from "../../core/index.js"; import type * as serializers from "../index.js"; +import { TranscribeAudioEventsConfig } from "./TranscribeAudioEventsConfig.js"; import { TranscribeCommand } from "./TranscribeCommand.js"; import { TranscribeFormatting } from "./TranscribeFormatting.js"; import { TranscribeSupportedLanguage } from "./TranscribeSupportedLanguage.js"; @@ -17,6 +18,7 @@ export const TranscribeConfig: core.serialization.ObjectSchema< automaticPunctuation: core.serialization.boolean().optional(), commands: core.serialization.list(TranscribeCommand).optional(), formatting: TranscribeFormatting.optional(), + audioEvents: TranscribeAudioEventsConfig.optional(), audioFormat: core.serialization.string().optional(), }); @@ -28,6 +30,7 @@ export declare namespace TranscribeConfig { automaticPunctuation?: boolean | null; commands?: TranscribeCommand.Raw[] | null; formatting?: TranscribeFormatting.Raw | null; + audioEvents?: TranscribeAudioEventsConfig.Raw | null; audioFormat?: string | null; } } diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 66b9b853..23c9b073 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"; @@ -73,11 +71,16 @@ export * from "./CommonDocumentIdContext.js"; export * from "./CommonDocumentIdContextType.js"; export * from "./CommonSortingDirectionEnum.js"; export * from "./CommonSourceEnum.js"; +export * from "./CommonStatusResponse.js"; export * from "./CommonTextContext.js"; 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 "./DocumentationEvidence.js"; export * from "./DocumentsContext.js"; export * from "./DocumentsContextWithFacts.js"; export * from "./DocumentsContextWithFactsType.js"; @@ -96,6 +99,7 @@ export * from "./DocumentsSectionOverride.js"; export * from "./DocumentsTemplate.js"; export * from "./DocumentsTemplateWithSectionKeys.js"; export * from "./DocumentsTemplateWithSections.js"; +export * from "./EphemeralDocument.js"; export * from "./ErrorResponse.js"; export * from "./FactsBatchUpdateInput.js"; export * from "./FactsBatchUpdateItem.js"; @@ -113,6 +117,38 @@ 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 "./GuidedDocumentContext.js"; +export * from "./GuidedDocumentFactMinimal.js"; +export * from "./GuidedDocumentsCreateEphemeralResponse.js"; +export * from "./GuidedDocumentsGenerateBase.js"; +export * from "./GuidedDocumentsGenerateByAssembly.js"; +export * from "./GuidedDocumentsGenerateByDynamic.js"; +export * from "./GuidedDocumentsGenerateByTemplateRef.js"; +export * from "./GuidedDocumentsGenerateRequest.js"; +export * from "./GuidedDocumentTranscriptMetadataMinimal.js"; +export * from "./GuidedDocumentTranscriptMinimal.js"; +export * from "./GuidedDocumentTranscriptSegmentMinimal.js"; +export * from "./GuidedDynamicInline.js"; +export * from "./GuidedDynamicRequest.js"; +export * from "./GuidedSectionOverride.js"; +export * from "./GuidedSectionsCreateBase.js"; +export * from "./GuidedSectionsCreateFromInheritanceRequest.js"; +export * from "./GuidedSectionsCreateFromScratchRequest.js"; +export * from "./GuidedSectionsCreateRequest.js"; +export * from "./GuidedTemplateOverrides.js"; +export * from "./GuidedTemplateRef.js"; +export * from "./GuidedTemplatesCreateBase.js"; +export * from "./GuidedTemplatesCreateFromInheritanceRequest.js"; +export * from "./GuidedTemplatesCreateFromInheritanceRequestGeneration.js"; +export * from "./GuidedTemplatesCreateFromScratchRequest.js"; +export * from "./GuidedTemplatesCreateFromScratchRequestGeneration.js"; +export * from "./GuidedTemplatesCreatePolicyRequest.js"; +export * from "./GuidedTemplatesCreatePolicyRequestKind.js"; +export * from "./GuidedTemplatesCreateRequest.js"; +export * from "./GuidedTemplatesVersionSectionRequest.js"; export * from "./InteractionsCreateResponse.js"; export * from "./InteractionsEncounterCreateRequest.js"; export * from "./InteractionsEncounterPeriod.js"; @@ -124,12 +160,30 @@ export * from "./InteractionsGenderEnum.js"; export * from "./InteractionsGetResponse.js"; export * from "./InteractionsListResponse.js"; export * from "./InteractionsPatient.js"; +export * from "./Label.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 "./SectionSource.js"; +export * from "./SectionVersion.js"; +export * from "./StreamAudioEventData.js"; +export * from "./StreamAudioEventDataEvent.js"; +export * from "./StreamAudioEventMessage.js"; +export * from "./StreamAudioEventsConfig.js"; export * from "./StreamConfig.js"; export * from "./StreamConfigMessage.js"; export * from "./StreamConfigMode.js"; +export * from "./StreamConfigModeFactGenerationInterval.js"; export * from "./StreamConfigModeType.js"; export * from "./StreamConfigParticipant.js"; export * from "./StreamConfigParticipantRole.js"; @@ -152,6 +206,14 @@ 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 "./TemplatePolicy.js"; +export * from "./TemplatePolicyKind.js"; +export * from "./TemplateSource.js"; export * from "./TemplatesDocumentationModeEnum.js"; export * from "./TemplatesFormatRule.js"; export * from "./TemplatesItem.js"; @@ -162,6 +224,11 @@ export * from "./TemplatesSectionSorted.js"; export * from "./TemplatesSectionTranslation.js"; export * from "./TemplatesTranslation.js"; export * from "./TemplatesWritingStyle.js"; +export * from "./TemplateVersion.js"; +export * from "./TranscribeAudioEventData.js"; +export * from "./TranscribeAudioEventDataEvent.js"; +export * from "./TranscribeAudioEventMessage.js"; +export * from "./TranscribeAudioEventsConfig.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..d42ad83c 100644 --- a/tests/wire/documents.test.ts +++ b/tests/wire/documents.test.ts @@ -1012,4 +1012,194 @@ 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 = { outputLanguage: "outputLanguage", templateRef: { templateId: "templateId" } }; + const rawResponseBody = { + document: { + name: "name", + templateId: "templateId", + templateVersionId: "templateVersionId", + language: "language", + stringDocument: { key: "value" }, + structuredDocument: { key: "value" }, + }, + usageInfo: { creditsConsumed: 1.1 }, + }; + + server + .mockEndpoint() + .post("/documents/") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.documents.generate({ + outputLanguage: "outputLanguage", + templateRef: { + templateId: "templateId", + }, + }); + expect(response).toEqual({ + document: { + name: "name", + templateId: "templateId", + templateVersionId: "templateVersionId", + language: "language", + stringDocument: { + key: "value", + }, + structuredDocument: { + key: "value", + }, + }, + usageInfo: { + creditsConsumed: 1.1, + }, + }); + }); + + 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(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.generate({ + templateRef: { + templateId: "templateId", + }, + outputLanguage: "outputLanguage", + }); + }).rejects.toThrow(Corti.InternalServerError); + }); }); diff --git a/tests/wire/documents/sections.test.ts b/tests/wire/documents/sections.test.ts new file mode 100644 index 00000000..1f84fb6f --- /dev/null +++ b/tests/wire/documents/sections.test.ts @@ -0,0 +1,565 @@ +// 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, + source: "user", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + description: "description", + labels: [{ key: "key", value: "value" }], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: "2024-01-15T09:30:00Z", + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + deletedAt: "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, + source: "user", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + description: "description", + labels: [ + { + key: "key", + value: "value", + }, + ], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + 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"), + deletedAt: 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", + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }; + const rawResponseBody = { + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + source: "user", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + description: "description", + labels: [{ key: "key", value: "value" }], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: "2024-01-15T09:30:00Z", + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + deletedAt: "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", + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }); + expect(response).toEqual({ + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + source: "user", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + description: "description", + labels: [ + { + key: "key", + value: "value", + }, + ], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + 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"), + deletedAt: 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", + }; + 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", + }); + }).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, + source: "user", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + description: "description", + labels: [{ key: "key", value: "value" }], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: "2024-01-15T09:30:00Z", + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + deletedAt: "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, + source: "user", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + description: "description", + labels: [ + { + key: "key", + value: "value", + }, + ], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + 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"), + deletedAt: 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("delete (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 rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + + server + .mockEndpoint() + .delete("/documents/sections/sectionID") + .respondWith() + .statusCode(409) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.sections.delete("sectionID"); + }).rejects.toThrow(Corti.ConflictError); + }); + + 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, + source: "user", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + description: "description", + labels: [{ key: "key", value: "value" }], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: "2024-01-15T09:30:00Z", + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }, + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + deletedAt: "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, + source: "user", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + description: "description", + labels: [ + { + key: "key", + value: "value", + }, + ], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + 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"), + deletedAt: 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..c9d8f543 --- /dev/null +++ b/tests/wire/documents/sections/versions.test.ts @@ -0,0 +1,460 @@ +// 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, + deletedAt: "2024-01-15T09:30:00Z", + 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, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + 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 = { + generation: { + heading: "heading", + instructions: { contentPrompt: "contentPrompt" }, + outputSchema: { type: "string" }, + }, + }; + const rawResponseBody = { + id: "id", + versionNumber: 1, + deletedAt: "2024-01-15T09:30:00Z", + 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", { + generation: { + heading: "heading", + instructions: { + contentPrompt: "contentPrompt", + }, + outputSchema: { + type: "string", + }, + }, + }); + expect(response).toEqual({ + id: "id", + versionNumber: 1, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + 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 = { + generation: { + 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", { + generation: { + 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 = { + generation: { + 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", { + generation: { + 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, + deletedAt: "2024-01-15T09:30:00Z", + 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, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + 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: "status", + evidence: { evidenceId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", type: "transcript", quote: "quote" }, + }; + + 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: "status", + evidence: { + evidenceId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + type: "transcript", + quote: "quote", + }, + }); + }); + + 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..dd767132 --- /dev/null +++ b/tests/wire/documents/templates.test.ts @@ -0,0 +1,809 @@ +// 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, + source: "user", + name: "name", + description: "description", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [{ key: "key", value: "value" }], + policies: [ + { + id: "id", + kind: "project", + templateId: "templateId", + createdBy: "createdBy", + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: "2024-01-15T09:30:00Z", + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [{ key: "key", value: "value" }], + 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", + deletedAt: "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, + source: "user", + name: "name", + description: "description", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [ + { + key: "key", + value: "value", + }, + ], + policies: [ + { + id: "id", + kind: "project", + templateId: "templateId", + createdBy: "createdBy", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [ + { + key: "key", + value: "value", + }, + ], + 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"), + deletedAt: 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", generation: { instructions: { prompt: "prompt" } } }; + const rawResponseBody = { + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + source: "user", + name: "name", + description: "description", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [{ key: "key", value: "value" }], + policies: [ + { + id: "id", + kind: "project", + customerIds: ["customerIds"], + templateId: "templateId", + createdBy: "createdBy", + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: "2024-01-15T09:30:00Z", + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [{ key: "key", value: "value" }], + 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", + deletedAt: "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", + generation: { + instructions: { + prompt: "prompt", + }, + }, + }); + expect(response).toEqual({ + id: "id", + inheritedFromId: "inheritedFromId", + autoGenerated: true, + source: "user", + name: "name", + description: "description", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [ + { + key: "key", + value: "value", + }, + ], + policies: [ + { + id: "id", + kind: "project", + customerIds: ["customerIds"], + templateId: "templateId", + createdBy: "createdBy", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [ + { + key: "key", + value: "value", + }, + ], + 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"), + deletedAt: 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" }; + 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", + }); + }).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, + source: "user", + name: "name", + description: "description", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [{ key: "key", value: "value" }], + policies: [ + { + id: "id", + kind: "project", + customerIds: ["customerIds"], + templateId: "templateId", + createdBy: "createdBy", + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: "2024-01-15T09:30:00Z", + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [{ key: "key", value: "value" }], + 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", + deletedAt: "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, + source: "user", + name: "name", + description: "description", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [ + { + key: "key", + value: "value", + }, + ], + policies: [ + { + id: "id", + kind: "project", + customerIds: ["customerIds"], + templateId: "templateId", + createdBy: "createdBy", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [ + { + key: "key", + value: "value", + }, + ], + 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"), + deletedAt: 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("delete (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 rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + + server + .mockEndpoint() + .delete("/documents/templates/templateID") + .respondWith() + .statusCode(409) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.documents.templates.delete("templateID"); + }).rejects.toThrow(Corti.ConflictError); + }); + + 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, + source: "user", + name: "name", + description: "description", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [{ key: "key", value: "value" }], + policies: [ + { + id: "id", + kind: "project", + customerIds: ["customerIds"], + templateId: "templateId", + createdBy: "createdBy", + createdAt: "2024-01-15T09:30:00Z", + updatedAt: "2024-01-15T09:30:00Z", + }, + ], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: "2024-01-15T09:30:00Z", + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [{ key: "key", value: "value" }], + 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", + deletedAt: "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, + source: "user", + name: "name", + description: "description", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [ + { + key: "key", + value: "value", + }, + ], + policies: [ + { + id: "id", + kind: "project", + customerIds: ["customerIds"], + templateId: "templateId", + createdBy: "createdBy", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + publishedVersion: { + id: "id", + versionNumber: 1, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [ + { + key: "key", + value: "value", + }, + ], + 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"), + deletedAt: 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..f31e42da --- /dev/null +++ b/tests/wire/documents/templates/versions.test.ts @@ -0,0 +1,533 @@ +// 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, + deletedAt: "2024-01-15T09:30:00Z", + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [{ key: "key", value: "value" }], + 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, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [ + { + key: "key", + value: "value", + }, + ], + 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, + deletedAt: "2024-01-15T09:30:00Z", + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [{ key: "key", value: "value" }], + 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, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [ + { + key: "key", + value: "value", + }, + ], + 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, + deletedAt: "2024-01-15T09:30:00Z", + generation: { + instructions: { prompt: "prompt" }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [{ key: "key", value: "value" }], + 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, + deletedAt: new Date("2024-01-15T09:30:00.000Z"), + generation: { + instructions: { + prompt: "prompt", + }, + sections: [ + { + id: "id", + name: "name", + languages: ["languages"], + regions: ["regions"], + specialties: ["specialties"], + labels: [ + { + key: "key", + value: "value", + }, + ], + 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: "status", + evidence: { evidenceId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", type: "transcript", quote: "quote" }, + }; + + 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: "status", + evidence: { + evidenceId: "f47ac10b-58cc-4372-a567-0e02b2c3d479", + type: "transcript", + quote: "quote", + }, + }); + }); + + 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); + }); +}); From 76f4151d1503af29dd0c689ae0b21176f497c35b Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 28 May 2026 08:20:56 +0000 Subject: [PATCH 2/2] SDK regeneration --- .fern/metadata.json | 4 +- src/Client.ts | 6 + src/api/resources/agents/client/Client.ts | 78 ++++++++++++ src/api/resources/documents/client/Client.ts | 4 +- .../requests/GuidedSectionsUpdateRequest.ts | 6 + .../client/requests/ListSectionsRequest.ts | 2 +- .../requests/GuidedTemplatesUpdateRequest.ts | 6 + .../client/requests/ListTemplatesRequest.ts | 2 +- src/api/resources/index.ts | 3 + src/api/resources/languages/client/Client.ts | 119 ++++++++++++++++++ src/api/resources/languages/client/index.ts | 1 + .../client/requests/LanguagesListRequest.ts | 12 ++ .../languages/client/requests/index.ts | 1 + src/api/resources/languages/index.ts | 2 + .../types/LanguagesListRequestEndpoint.ts | 10 ++ src/api/resources/languages/types/index.ts | 1 + src/api/types/GuidedDocumentFactMinimal.ts | 2 + src/api/types/GuidedDocumentsGenerateBase.ts | 4 +- src/api/types/GuidedSectionsCreateBase.ts | 2 +- src/api/types/GuidedTemplatesCreateBase.ts | 2 +- src/api/types/LanguagesListResponse.ts | 5 + src/api/types/ObjectNode.ts | 6 +- src/api/types/Template.ts | 2 +- src/api/types/index.ts | 1 + src/serialization/resources/index.ts | 2 + .../resources/languages/index.ts | 1 + .../types/LanguagesListRequestEndpoint.ts | 14 +++ .../resources/languages/types/index.ts | 1 + .../types/GuidedDocumentFactMinimal.ts | 2 + .../types/LanguagesListResponse.ts | 18 +++ src/serialization/types/ObjectNode.ts | 6 +- src/serialization/types/index.ts | 1 + tests/wire/agents.test.ts | 104 +++++++++++++++ tests/wire/languages.test.ts | 74 +++++++++++ 34 files changed, 485 insertions(+), 19 deletions(-) create mode 100644 src/api/resources/languages/client/Client.ts create mode 100644 src/api/resources/languages/client/index.ts create mode 100644 src/api/resources/languages/client/requests/LanguagesListRequest.ts create mode 100644 src/api/resources/languages/client/requests/index.ts create mode 100644 src/api/resources/languages/index.ts create mode 100644 src/api/resources/languages/types/LanguagesListRequestEndpoint.ts create mode 100644 src/api/resources/languages/types/index.ts create mode 100644 src/api/types/LanguagesListResponse.ts create mode 100644 src/serialization/resources/languages/index.ts create mode 100644 src/serialization/resources/languages/types/LanguagesListRequestEndpoint.ts create mode 100644 src/serialization/resources/languages/types/index.ts create mode 100644 src/serialization/types/LanguagesListResponse.ts create mode 100644 tests/wire/languages.test.ts diff --git a/.fern/metadata.json b/.fern/metadata.json index ebd79a49..5d77d4e4 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,5 +1,5 @@ { - "cliVersion": "5.28.3", + "cliVersion": "5.35.2", "generatorName": "fernapi/fern-typescript-node-sdk", "generatorVersion": "3.54.0", "generatorConfig": { @@ -34,6 +34,6 @@ } } }, - "originGitCommit": "d52d71cc05b86ce3071e7dee5192458862012439", + "originGitCommit": "e2c066722308d4c0d7bbf864b8961eef50548709", "sdkVersion": "0.0.0-dev" } diff --git a/src/Client.ts b/src/Client.ts index 7aa94bd7..2098b736 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -6,6 +6,7 @@ import { CodesClient } from "./api/resources/codes/client/Client.js"; import { DocumentsClient } from "./api/resources/documents/client/Client.js"; import { FactsClient } from "./api/resources/facts/client/Client.js"; import { InteractionsClient } from "./api/resources/interactions/client/Client.js"; +import { LanguagesClient } from "./api/resources/languages/client/Client.js"; import { RecordingsClient } from "./api/resources/recordings/client/Client.js"; import { StreamClient } from "./api/resources/stream/client/Client.js"; import { TemplatesClient } from "./api/resources/templates/client/Client.js"; @@ -30,6 +31,7 @@ export class CortiClient { protected _documents: DocumentsClient | undefined; protected _templates: TemplatesClient | undefined; protected _codes: CodesClient | undefined; + protected _languages: LanguagesClient | undefined; protected _agents: AgentsClient | undefined; protected _stream: StreamClient | undefined; protected _transcribe: TranscribeClient | undefined; @@ -70,6 +72,10 @@ export class CortiClient { return (this._codes ??= new CodesClient(this._options)); } + public get languages(): LanguagesClient { + return (this._languages ??= new LanguagesClient(this._options)); + } + public get agents(): AgentsClient { return (this._agents ??= new AgentsClient(this._options)); } diff --git a/src/api/resources/agents/client/Client.ts b/src/api/resources/agents/client/Client.ts index 0136af74..c9b40606 100644 --- a/src/api/resources/agents/client/Client.ts +++ b/src/api/resources/agents/client/Client.ts @@ -808,6 +808,84 @@ export class AgentsClient { ); } + /** + * This endpoint deletes a context (thread) and scrubs all associated data including messages, memories, and memory chunks for the given agent. Thread and task metadata is soft-deleted for audit purposes, while content columns are irreversibly overwritten. + * + * @param {string} id - The identifier of the agent associated with the context. + * @param {string} contextId - The identifier of the context (thread) to delete. + * @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.BadRequestError} + * @throws {@link Corti.UnauthorizedError} + * @throws {@link Corti.NotFoundError} + * + * @example + * await client.agents.deleteContext("12345678-90ab-cdef-gh12-34567890abc", "contextId") + */ + public deleteContext( + id: string, + contextId: string, + requestOptions?: AgentsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteContext(id, contextId, requestOptions)); + } + + private async __deleteContext( + id: string, + contextId: string, + requestOptions?: AgentsClient.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)).agents, + `agents/${core.url.encodePathParam(id)}/v1/contexts/${core.url.encodePathParam(contextId)}`, + ), + 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 400: + throw new Corti.BadRequestError(_response.error.body, _response.rawResponse); + case 401: + throw new Corti.UnauthorizedError(_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, + "DELETE", + "/agents/{id}/v1/contexts/{contextId}", + ); + } + /** * This endpoint retrieves the experts registry, which contains information about all available experts that can be referenced when creating agents through the AgentsCreateExpertReference schema. * diff --git a/src/api/resources/documents/client/Client.ts b/src/api/resources/documents/client/Client.ts index 95cde920..ed2310bb 100644 --- a/src/api/resources/documents/client/Client.ts +++ b/src/api/resources/documents/client/Client.ts @@ -589,8 +589,8 @@ export class DocumentsClient { /** * Generates a structured document using one of three 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. + * Context can combine different types or reference an interactionId to automatically fetch existing context to pass to the LLM. Note that discarded facts are not passed to the LLM. + * With the exception of the plain `templateRef` path (no overrides), every call creates a new auto-generated template aggregate that snapshots the resolved prompts as a drift-proof receipt, persisted for 30 days. * * @param {Corti.GuidedDocumentsGenerateRequest} request * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration. diff --git a/src/api/resources/documents/resources/sections/client/requests/GuidedSectionsUpdateRequest.ts b/src/api/resources/documents/resources/sections/client/requests/GuidedSectionsUpdateRequest.ts index 02bce675..072260e6 100644 --- a/src/api/resources/documents/resources/sections/client/requests/GuidedSectionsUpdateRequest.ts +++ b/src/api/resources/documents/resources/sections/client/requests/GuidedSectionsUpdateRequest.ts @@ -7,10 +7,16 @@ import type * as Corti from "../../../../../../index.js"; * {} */ export interface GuidedSectionsUpdateRequest { + /** A human-readable identifier for this section. Not passed to the LLM. */ name?: string; + /** A description for this section. Not passed to the LLM. */ description?: string; + /** BCP 47 language tags this section has been tweaked for. */ languages?: string[]; + /** ISO 3166-1 alpha-3 country codes this section has been tweaked for. */ regions?: string[]; + /** Clinical specialties this section has been tweaked for. */ specialties?: string[]; + /** Labels work as query param filter in the LIST /sections endpoint. */ labels?: Corti.Label[]; } diff --git a/src/api/resources/documents/resources/sections/client/requests/ListSectionsRequest.ts b/src/api/resources/documents/resources/sections/client/requests/ListSectionsRequest.ts index 52480bb2..8c723a86 100644 --- a/src/api/resources/documents/resources/sections/client/requests/ListSectionsRequest.ts +++ b/src/api/resources/documents/resources/sections/client/requests/ListSectionsRequest.ts @@ -5,7 +5,7 @@ * {} */ export interface ListSectionsRequest { - /** Filter sections by BCP 47 language subtag (e.g. `fr`, `de`). Repeatable. */ + /** Filter sections by BCP 47 language tag (e.g. `fr`, `de`, or `en-GB`). Repeatable. */ lang?: string | string[]; /** Filter sections by ISO 3166-1 alpha-3 region code (e.g. `BEL`). Repeatable. */ region?: string | string[]; diff --git a/src/api/resources/documents/resources/templates/client/requests/GuidedTemplatesUpdateRequest.ts b/src/api/resources/documents/resources/templates/client/requests/GuidedTemplatesUpdateRequest.ts index 629d2169..d7860a21 100644 --- a/src/api/resources/documents/resources/templates/client/requests/GuidedTemplatesUpdateRequest.ts +++ b/src/api/resources/documents/resources/templates/client/requests/GuidedTemplatesUpdateRequest.ts @@ -7,10 +7,16 @@ import type * as Corti from "../../../../../../index.js"; * {} */ export interface GuidedTemplatesUpdateRequest { + /** The name of this template. Not passed to the LLM. */ name?: string; + /** A description for this template. Not passed to the LLM. */ description?: string; + /** BCP 47 language tags this template has been tweaked for (e.g. `["fr", "de", "en-GB"]`). */ languages?: string[]; + /** ISO 3166-1 alpha-3 country codes this template has been tweaked for (e.g. `["BEL"]`). */ regions?: string[]; + /** Clinical specialties this template has been tweaked for. */ specialties?: string[]; + /** Labels work as query param filter in the LIST /templates endpoint. */ labels?: Corti.Label[]; } diff --git a/src/api/resources/documents/resources/templates/client/requests/ListTemplatesRequest.ts b/src/api/resources/documents/resources/templates/client/requests/ListTemplatesRequest.ts index 163db544..ac3fc293 100644 --- a/src/api/resources/documents/resources/templates/client/requests/ListTemplatesRequest.ts +++ b/src/api/resources/documents/resources/templates/client/requests/ListTemplatesRequest.ts @@ -5,7 +5,7 @@ * {} */ export interface ListTemplatesRequest { - /** Filter templates by BCP 47 language subtag (e.g. `fr`, `de`). Repeatable. */ + /** Filter templates by BCP 47 language tag (e.g. `fr`, `de`, or `en-GB`). Repeatable. */ lang?: string | string[]; /** Filter templates by ISO 3166-1 alpha-3 region code (e.g. `BEL`). Repeatable. */ region?: string | string[]; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index 018dfdfd..56984c66 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -12,6 +12,9 @@ export * as facts from "./facts/index.js"; export * from "./interactions/client/requests/index.js"; export * as interactions from "./interactions/index.js"; export * from "./interactions/types/index.js"; +export * from "./languages/client/requests/index.js"; +export * as languages from "./languages/index.js"; +export * from "./languages/types/index.js"; export * as recordings from "./recordings/index.js"; export * as stream from "./stream/index.js"; export * from "./templates/client/requests/index.js"; diff --git a/src/api/resources/languages/client/Client.ts b/src/api/resources/languages/client/Client.ts new file mode 100644 index 00000000..08ecca82 --- /dev/null +++ b/src/api/resources/languages/client/Client.ts @@ -0,0 +1,119 @@ +// 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 LanguagesClient { + export type Options = BaseClientOptions; + + export interface RequestOptions extends BaseRequestOptions {} +} + +export class LanguagesClient { + protected readonly _options: NormalizedClientOptionsWithAuth; + + constructor(options: LanguagesClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); + } + + /** + * Returns a list of available languages with their enabled endpoints details. + * + * @param {Corti.LanguagesListRequest} request + * @param {LanguagesClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Corti.BadRequestError} + * @throws {@link Corti.InternalServerError} + * + * @example + * await client.languages.list() + */ + public list( + request: Corti.LanguagesListRequest = {}, + requestOptions?: LanguagesClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions)); + } + + private async __list( + request: Corti.LanguagesListRequest = {}, + requestOptions?: LanguagesClient.RequestOptions, + ): Promise> { + const { endpoint } = request; + const _queryParams: Record = { + endpoint: + endpoint != null + ? serializers.LanguagesListRequestEndpoint.jsonOrThrow(endpoint, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }) + : undefined, + }; + 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, + "languages/", + ), + 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.LanguagesListResponse.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 500: + throw new Corti.InternalServerError( + 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, "GET", "/languages/"); + } +} diff --git a/src/api/resources/languages/client/index.ts b/src/api/resources/languages/client/index.ts new file mode 100644 index 00000000..195f9aa8 --- /dev/null +++ b/src/api/resources/languages/client/index.ts @@ -0,0 +1 @@ +export * from "./requests/index.js"; diff --git a/src/api/resources/languages/client/requests/LanguagesListRequest.ts b/src/api/resources/languages/client/requests/LanguagesListRequest.ts new file mode 100644 index 00000000..9d25dcbc --- /dev/null +++ b/src/api/resources/languages/client/requests/LanguagesListRequest.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Corti from "../../../../index.js"; + +/** + * @example + * {} + */ +export interface LanguagesListRequest { + /** Field used to filter languages that supported specific endpoint. */ + endpoint?: Corti.LanguagesListRequestEndpoint; +} diff --git a/src/api/resources/languages/client/requests/index.ts b/src/api/resources/languages/client/requests/index.ts new file mode 100644 index 00000000..9af20108 --- /dev/null +++ b/src/api/resources/languages/client/requests/index.ts @@ -0,0 +1 @@ +export type { LanguagesListRequest } from "./LanguagesListRequest.js"; diff --git a/src/api/resources/languages/index.ts b/src/api/resources/languages/index.ts new file mode 100644 index 00000000..d9adb1af --- /dev/null +++ b/src/api/resources/languages/index.ts @@ -0,0 +1,2 @@ +export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/languages/types/LanguagesListRequestEndpoint.ts b/src/api/resources/languages/types/LanguagesListRequestEndpoint.ts new file mode 100644 index 00000000..3ac60d6d --- /dev/null +++ b/src/api/resources/languages/types/LanguagesListRequestEndpoint.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +/** Field used to filter languages that supported specific endpoint. */ +export const LanguagesListRequestEndpoint = { + Streams: "streams", + Transcribe: "transcribe", + Transcripts: "transcripts", +} as const; +export type LanguagesListRequestEndpoint = + (typeof LanguagesListRequestEndpoint)[keyof typeof LanguagesListRequestEndpoint]; diff --git a/src/api/resources/languages/types/index.ts b/src/api/resources/languages/types/index.ts new file mode 100644 index 00000000..57aadfa0 --- /dev/null +++ b/src/api/resources/languages/types/index.ts @@ -0,0 +1 @@ +export * from "./LanguagesListRequestEndpoint.js"; diff --git a/src/api/types/GuidedDocumentFactMinimal.ts b/src/api/types/GuidedDocumentFactMinimal.ts index a16a987f..cbe1e958 100644 --- a/src/api/types/GuidedDocumentFactMinimal.ts +++ b/src/api/types/GuidedDocumentFactMinimal.ts @@ -6,4 +6,6 @@ export interface GuidedDocumentFactMinimal { /** The text of the fact. */ text: string; + /** The group to which the fact belongs. */ + group?: string; } diff --git a/src/api/types/GuidedDocumentsGenerateBase.ts b/src/api/types/GuidedDocumentsGenerateBase.ts index 88e8668f..16b68c63 100644 --- a/src/api/types/GuidedDocumentsGenerateBase.ts +++ b/src/api/types/GuidedDocumentsGenerateBase.ts @@ -3,13 +3,13 @@ import type * as Corti from "../index.js"; /** - * Fields shared across all guided-document request variants. + * Fields shared across all guided-document request variants. `outputLanguage` is always required. Exactly one input mode must be supplied: provide context items inline, or reference an existing interaction whose attached facts and transcripts will be used. */ export interface GuidedDocumentsGenerateBase { /** The language in which the document will be generated as a BCP 47 tag. */ outputLanguage: string; /** 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. */ + /** When supplied, all facts and transcripts already attached to the referenced interaction are passed implicitly as input context. Facts with `isDiscarded: true` are not passed on. */ interactionId?: string; } diff --git a/src/api/types/GuidedSectionsCreateBase.ts b/src/api/types/GuidedSectionsCreateBase.ts index 6b7fd5c2..83db2ddf 100644 --- a/src/api/types/GuidedSectionsCreateBase.ts +++ b/src/api/types/GuidedSectionsCreateBase.ts @@ -7,7 +7,7 @@ export interface GuidedSectionsCreateBase { name: string; /** A description for this section. Not passed to the LLM. */ description?: string; - /** BCP 47 language subtags this section has been tweaked for. */ + /** BCP 47 language tags this section has been tweaked for. */ languages?: string[]; /** ISO 3166-1 alpha-3 country codes this section has been tweaked for. */ regions?: string[]; diff --git a/src/api/types/GuidedTemplatesCreateBase.ts b/src/api/types/GuidedTemplatesCreateBase.ts index 641cc1da..95b9026d 100644 --- a/src/api/types/GuidedTemplatesCreateBase.ts +++ b/src/api/types/GuidedTemplatesCreateBase.ts @@ -7,7 +7,7 @@ export interface GuidedTemplatesCreateBase { name: string; /** A description for this template. Not passed to the LLM. */ description?: string; - /** BCP 47 language subtags this template has been tweaked for (e.g. `["fr", "de"]`). */ + /** BCP 47 language tags this template has been tweaked for (e.g. `["fr", "de", "en-GB"]`). */ languages?: string[]; /** ISO 3166-1 alpha-3 country codes this template has been tweaked for (e.g. `["BEL"]`). */ regions?: string[]; diff --git a/src/api/types/LanguagesListResponse.ts b/src/api/types/LanguagesListResponse.ts new file mode 100644 index 00000000..4b7cfb2c --- /dev/null +++ b/src/api/types/LanguagesListResponse.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface LanguagesListResponse { + languages: Record; +} diff --git a/src/api/types/ObjectNode.ts b/src/api/types/ObjectNode.ts index 99d070f9..64a13f33 100644 --- a/src/api/types/ObjectNode.ts +++ b/src/api/types/ObjectNode.ts @@ -6,10 +6,8 @@ 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; + /** Format string used to render each field in the generated string output. For example use `{key}` and `{value}` placeholders for the field key and its value respectively to programmatically control inline or block subheadings or other use cases. */ + fieldFormat?: string; /** Define what fields are possible to return in the object. */ fields?: Corti.FieldDefinition[]; } diff --git a/src/api/types/Template.ts b/src/api/types/Template.ts index 2f4cc384..0b9e08cc 100644 --- a/src/api/types/Template.ts +++ b/src/api/types/Template.ts @@ -15,7 +15,7 @@ export interface Template { name: string; /** A description for this template. Not passed to the LLM. */ description?: string; - /** BCP 47 language subtags this template has been tweaked for (e.g. `["fr", "de"]`). Empty means no language-specific tweaks. */ + /** BCP 47 language tags this template has been tweaked for (e.g. `["fr", "de", "en-GB"]`). Empty means no language-specific tweaks. */ languages: string[]; /** ISO 3166-1 alpha-3 country codes this template has been tweaked for (e.g. `["BEL"]`). Empty means no region-specific tweaks. */ regions: string[]; diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 23c9b073..f4aeec98 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -161,6 +161,7 @@ export * from "./InteractionsGetResponse.js"; export * from "./InteractionsListResponse.js"; export * from "./InteractionsPatient.js"; export * from "./Label.js"; +export * from "./LanguagesListResponse.js"; export * from "./NumberNode.js"; export * from "./OAuthTokenRequest.js"; export * from "./ObjectNode.js"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts index 58cf7e90..a169e34b 100644 --- a/src/serialization/resources/index.ts +++ b/src/serialization/resources/index.ts @@ -12,6 +12,8 @@ export * as facts from "./facts/index.js"; export * from "./interactions/client/requests/index.js"; export * as interactions from "./interactions/index.js"; export * from "./interactions/types/index.js"; +export * as languages from "./languages/index.js"; +export * from "./languages/types/index.js"; export * from "./stream/client/socket/index.js"; export * as stream from "./stream/index.js"; export * from "./transcribe/client/socket/index.js"; diff --git a/src/serialization/resources/languages/index.ts b/src/serialization/resources/languages/index.ts new file mode 100644 index 00000000..2f88e301 --- /dev/null +++ b/src/serialization/resources/languages/index.ts @@ -0,0 +1 @@ +export * from "./types/index.js"; diff --git a/src/serialization/resources/languages/types/LanguagesListRequestEndpoint.ts b/src/serialization/resources/languages/types/LanguagesListRequestEndpoint.ts new file mode 100644 index 00000000..4f4a3031 --- /dev/null +++ b/src/serialization/resources/languages/types/LanguagesListRequestEndpoint.ts @@ -0,0 +1,14 @@ +// 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 LanguagesListRequestEndpoint: core.serialization.Schema< + serializers.LanguagesListRequestEndpoint.Raw, + Corti.LanguagesListRequestEndpoint +> = core.serialization.enum_(["streams", "transcribe", "transcripts"]); + +export declare namespace LanguagesListRequestEndpoint { + export type Raw = "streams" | "transcribe" | "transcripts"; +} diff --git a/src/serialization/resources/languages/types/index.ts b/src/serialization/resources/languages/types/index.ts new file mode 100644 index 00000000..57aadfa0 --- /dev/null +++ b/src/serialization/resources/languages/types/index.ts @@ -0,0 +1 @@ +export * from "./LanguagesListRequestEndpoint.js"; diff --git a/src/serialization/types/GuidedDocumentFactMinimal.ts b/src/serialization/types/GuidedDocumentFactMinimal.ts index 2b3ddba2..838ec87d 100644 --- a/src/serialization/types/GuidedDocumentFactMinimal.ts +++ b/src/serialization/types/GuidedDocumentFactMinimal.ts @@ -9,10 +9,12 @@ export const GuidedDocumentFactMinimal: core.serialization.ObjectSchema< Corti.GuidedDocumentFactMinimal > = core.serialization.object({ text: core.serialization.string(), + group: core.serialization.string().optional(), }); export declare namespace GuidedDocumentFactMinimal { export interface Raw { text: string; + group?: string | null; } } diff --git a/src/serialization/types/LanguagesListResponse.ts b/src/serialization/types/LanguagesListResponse.ts new file mode 100644 index 00000000..4e7c45d7 --- /dev/null +++ b/src/serialization/types/LanguagesListResponse.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 LanguagesListResponse: core.serialization.ObjectSchema< + serializers.LanguagesListResponse.Raw, + Corti.LanguagesListResponse +> = core.serialization.object({ + languages: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace LanguagesListResponse { + export interface Raw { + languages: Record; + } +} diff --git a/src/serialization/types/ObjectNode.ts b/src/serialization/types/ObjectNode.ts index ee8a6e62..7727f550 100644 --- a/src/serialization/types/ObjectNode.ts +++ b/src/serialization/types/ObjectNode.ts @@ -8,8 +8,7 @@ export const ObjectNode: core.serialization.ObjectSchema serializers.FieldDefinition)).optional(), }); @@ -17,8 +16,7 @@ export declare namespace ObjectNode { export interface Raw { type: "object"; description?: string | null; - subheadingFormat?: string | null; - objectFormat?: string | null; + fieldFormat?: string | null; fields?: serializers.FieldDefinition.Raw[] | null; } } diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 23c9b073..f4aeec98 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -161,6 +161,7 @@ export * from "./InteractionsGetResponse.js"; export * from "./InteractionsListResponse.js"; export * from "./InteractionsPatient.js"; export * from "./Label.js"; +export * from "./LanguagesListResponse.js"; export * from "./NumberNode.js"; export * from "./OAuthTokenRequest.js"; export * from "./ObjectNode.js"; diff --git a/tests/wire/agents.test.ts b/tests/wire/agents.test.ts index a041e8c1..9e0692d2 100644 --- a/tests/wire/agents.test.ts +++ b/tests/wire/agents.test.ts @@ -1773,6 +1773,110 @@ describe("AgentsClient", () => { }).rejects.toThrow(Corti.NotFoundError); }); + test("deleteContext (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("/agents/12345678-90ab-cdef-gh12-34567890abc/v1/contexts/contextId") + .respondWith() + .statusCode(200) + .build(); + + const response = await client.agents.deleteContext("12345678-90ab-cdef-gh12-34567890abc", "contextId"); + expect(response).toEqual(undefined); + }); + + test("deleteContext (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("/agents/id/v1/contexts/contextId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.deleteContext("id", "contextId"); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("deleteContext (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 rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .delete("/agents/id/v1/contexts/contextId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.deleteContext("id", "contextId"); + }).rejects.toThrow(Corti.UnauthorizedError); + }); + + test("deleteContext (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 rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .delete("/agents/id/v1/contexts/contextId") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.agents.deleteContext("id", "contextId"); + }).rejects.toThrow(Corti.NotFoundError); + }); + test("getRegistryExperts (1)", async () => { const server = mockServerPool.createServer(); mockOAuth(server); diff --git a/tests/wire/languages.test.ts b/tests/wire/languages.test.ts new file mode 100644 index 00000000..61b40a6c --- /dev/null +++ b/tests/wire/languages.test.ts @@ -0,0 +1,74 @@ +// 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("LanguagesClient", () => { + 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 = { languages: { key: "value" } }; + + server.mockEndpoint().get("/languages/").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.languages.list(); + expect(response).toEqual({ + languages: { + key: "value", + }, + }); + }); + + 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("/languages/").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.languages.list(); + }).rejects.toThrow(Corti.BadRequestError); + }); + + test("list (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 rawResponseBody = { requestid: "requestid", status: 1, type: "type", detail: "detail" }; + + server.mockEndpoint().get("/languages/").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.languages.list(); + }).rejects.toThrow(Corti.InternalServerError); + }); +});