fork of hey-api/openapi-ts because I need some additional things

test: add Opencode SDK snapshots

Lubos 31e44a4e 23342be3

+9806 -207
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@angular/common/default-class/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@angular/common/default/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@angular/common/default-class/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@angular/common/default/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-recursive/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/import-file-extension-ts/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/import-file-extension-ts/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/import-file-extension-ts/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/import-file-extension-ts/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-number/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-strict/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-string/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/clean-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/default/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/import-file-extension-ts/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/sdk-client-optional/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/sdk-client-required/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/tsconfig-nodenext-sdk/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@angular/common/default-class/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@angular/common/default/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-ofetch/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-recursive/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/core/params.gen.ts
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/core/params.gen.ts.snap
··· 92 92 headers: Record<string, unknown>; 93 93 path: Record<string, unknown>; 94 94 query: Record<string, unknown>; 95 - }; 95 + } 96 96 97 97 const stripEmptySlots = (params: Params) => { 98 98 for (const [slot, value] of Object.entries(params)) {
+19
packages/openapi-ts-tests/sdks/.gitignore
··· 1 + .DS_Store 2 + .idea 3 + .tsdown 4 + .tmp 5 + junit.xml 6 + logs 7 + node_modules 8 + npm-debug.log* 9 + temp 10 + yarn-debug.log* 11 + yarn-error.log* 12 + 13 + *.iml 14 + dist 15 + coverage 16 + .env 17 + 18 + # test files 19 + .gen/
+16
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { type ClientOptions, type Config, createClient, createConfig } from './client'; 4 + import type { ClientOptions as ClientOptions2 } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions2>());
+268
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/client/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { createSseClient } from '../core/serverSentEvents.gen'; 4 + import type { HttpMethod } from '../core/types.gen'; 5 + import { getValidRequestBody } from '../core/utils.gen'; 6 + import type { 7 + Client, 8 + Config, 9 + RequestOptions, 10 + ResolvedRequestOptions, 11 + } from './types.gen'; 12 + import { 13 + buildUrl, 14 + createConfig, 15 + createInterceptors, 16 + getParseAs, 17 + mergeConfigs, 18 + mergeHeaders, 19 + setAuthParams, 20 + } from './utils.gen'; 21 + 22 + type ReqInit = Omit<RequestInit, 'body' | 'headers'> & { 23 + body?: any; 24 + headers: ReturnType<typeof mergeHeaders>; 25 + }; 26 + 27 + export const createClient = (config: Config = {}): Client => { 28 + let _config = mergeConfigs(createConfig(), config); 29 + 30 + const getConfig = (): Config => ({ ..._config }); 31 + 32 + const setConfig = (config: Config): Config => { 33 + _config = mergeConfigs(_config, config); 34 + return getConfig(); 35 + }; 36 + 37 + const interceptors = createInterceptors< 38 + Request, 39 + Response, 40 + unknown, 41 + ResolvedRequestOptions 42 + >(); 43 + 44 + const beforeRequest = async (options: RequestOptions) => { 45 + const opts = { 46 + ..._config, 47 + ...options, 48 + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, 49 + headers: mergeHeaders(_config.headers, options.headers), 50 + serializedBody: undefined, 51 + }; 52 + 53 + if (opts.security) { 54 + await setAuthParams({ 55 + ...opts, 56 + security: opts.security, 57 + }); 58 + } 59 + 60 + if (opts.requestValidator) { 61 + await opts.requestValidator(opts); 62 + } 63 + 64 + if (opts.body !== undefined && opts.bodySerializer) { 65 + opts.serializedBody = opts.bodySerializer(opts.body); 66 + } 67 + 68 + // remove Content-Type header if body is empty to avoid sending invalid requests 69 + if (opts.body === undefined || opts.serializedBody === '') { 70 + opts.headers.delete('Content-Type'); 71 + } 72 + 73 + const url = buildUrl(opts); 74 + 75 + return { opts, url }; 76 + }; 77 + 78 + const request: Client['request'] = async (options) => { 79 + // @ts-expect-error 80 + const { opts, url } = await beforeRequest(options); 81 + const requestInit: ReqInit = { 82 + redirect: 'follow', 83 + ...opts, 84 + body: getValidRequestBody(opts), 85 + }; 86 + 87 + let request = new Request(url, requestInit); 88 + 89 + for (const fn of interceptors.request.fns) { 90 + if (fn) { 91 + request = await fn(request, opts); 92 + } 93 + } 94 + 95 + // fetch must be assigned here, otherwise it would throw the error: 96 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 + const _fetch = opts.fetch!; 98 + let response = await _fetch(request); 99 + 100 + for (const fn of interceptors.response.fns) { 101 + if (fn) { 102 + response = await fn(response, request, opts); 103 + } 104 + } 105 + 106 + const result = { 107 + request, 108 + response, 109 + }; 110 + 111 + if (response.ok) { 112 + const parseAs = 113 + (opts.parseAs === 'auto' 114 + ? getParseAs(response.headers.get('Content-Type')) 115 + : opts.parseAs) ?? 'json'; 116 + 117 + if ( 118 + response.status === 204 || 119 + response.headers.get('Content-Length') === '0' 120 + ) { 121 + let emptyData: any; 122 + switch (parseAs) { 123 + case 'arrayBuffer': 124 + case 'blob': 125 + case 'text': 126 + emptyData = await response[parseAs](); 127 + break; 128 + case 'formData': 129 + emptyData = new FormData(); 130 + break; 131 + case 'stream': 132 + emptyData = response.body; 133 + break; 134 + case 'json': 135 + default: 136 + emptyData = {}; 137 + break; 138 + } 139 + return opts.responseStyle === 'data' 140 + ? emptyData 141 + : { 142 + data: emptyData, 143 + ...result, 144 + }; 145 + } 146 + 147 + let data: any; 148 + switch (parseAs) { 149 + case 'arrayBuffer': 150 + case 'blob': 151 + case 'formData': 152 + case 'json': 153 + case 'text': 154 + data = await response[parseAs](); 155 + break; 156 + case 'stream': 157 + return opts.responseStyle === 'data' 158 + ? response.body 159 + : { 160 + data: response.body, 161 + ...result, 162 + }; 163 + } 164 + 165 + if (parseAs === 'json') { 166 + if (opts.responseValidator) { 167 + await opts.responseValidator(data); 168 + } 169 + 170 + if (opts.responseTransformer) { 171 + data = await opts.responseTransformer(data); 172 + } 173 + } 174 + 175 + return opts.responseStyle === 'data' 176 + ? data 177 + : { 178 + data, 179 + ...result, 180 + }; 181 + } 182 + 183 + const textError = await response.text(); 184 + let jsonError: unknown; 185 + 186 + try { 187 + jsonError = JSON.parse(textError); 188 + } catch { 189 + // noop 190 + } 191 + 192 + const error = jsonError ?? textError; 193 + let finalError = error; 194 + 195 + for (const fn of interceptors.error.fns) { 196 + if (fn) { 197 + finalError = (await fn(error, response, request, opts)) as string; 198 + } 199 + } 200 + 201 + finalError = finalError || ({} as string); 202 + 203 + if (opts.throwOnError) { 204 + throw finalError; 205 + } 206 + 207 + // TODO: we probably want to return error and improve types 208 + return opts.responseStyle === 'data' 209 + ? undefined 210 + : { 211 + error: finalError, 212 + ...result, 213 + }; 214 + }; 215 + 216 + const makeMethodFn = 217 + (method: Uppercase<HttpMethod>) => (options: RequestOptions) => 218 + request({ ...options, method }); 219 + 220 + const makeSseFn = 221 + (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => { 222 + const { opts, url } = await beforeRequest(options); 223 + return createSseClient({ 224 + ...opts, 225 + body: opts.body as BodyInit | null | undefined, 226 + headers: opts.headers as unknown as Record<string, string>, 227 + method, 228 + onRequest: async (url, init) => { 229 + let request = new Request(url, init); 230 + for (const fn of interceptors.request.fns) { 231 + if (fn) { 232 + request = await fn(request, opts); 233 + } 234 + } 235 + return request; 236 + }, 237 + url, 238 + }); 239 + }; 240 + 241 + return { 242 + buildUrl, 243 + connect: makeMethodFn('CONNECT'), 244 + delete: makeMethodFn('DELETE'), 245 + get: makeMethodFn('GET'), 246 + getConfig, 247 + head: makeMethodFn('HEAD'), 248 + interceptors, 249 + options: makeMethodFn('OPTIONS'), 250 + patch: makeMethodFn('PATCH'), 251 + post: makeMethodFn('POST'), 252 + put: makeMethodFn('PUT'), 253 + request, 254 + setConfig, 255 + sse: { 256 + connect: makeSseFn('CONNECT'), 257 + delete: makeSseFn('DELETE'), 258 + get: makeSseFn('GET'), 259 + head: makeSseFn('HEAD'), 260 + options: makeSseFn('OPTIONS'), 261 + patch: makeSseFn('PATCH'), 262 + post: makeSseFn('POST'), 263 + put: makeSseFn('PUT'), 264 + trace: makeSseFn('TRACE'), 265 + }, 266 + trace: makeMethodFn('TRACE'), 267 + } as Client; 268 + };
+26
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/client/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type { Auth } from '../core/auth.gen'; 4 + export type { QuerySerializerOptions } from '../core/bodySerializer.gen'; 5 + export { 6 + formDataBodySerializer, 7 + jsonBodySerializer, 8 + urlSearchParamsBodySerializer, 9 + } from '../core/bodySerializer.gen'; 10 + export { buildClientParams } from '../core/params.gen'; 11 + export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen'; 12 + export { createClient } from './client.gen'; 13 + export type { 14 + Client, 15 + ClientOptions, 16 + Config, 17 + CreateClientConfig, 18 + Options, 19 + OptionsLegacyParser, 20 + RequestOptions, 21 + RequestResult, 22 + ResolvedRequestOptions, 23 + ResponseStyle, 24 + TDataShape, 25 + } from './types.gen'; 26 + export { createConfig, mergeHeaders } from './utils.gen';
+268
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/client/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth } from '../core/auth.gen'; 4 + import type { 5 + ServerSentEventsOptions, 6 + ServerSentEventsResult, 7 + } from '../core/serverSentEvents.gen'; 8 + import type { 9 + Client as CoreClient, 10 + Config as CoreConfig, 11 + } from '../core/types.gen'; 12 + import type { Middleware } from './utils.gen'; 13 + 14 + export type ResponseStyle = 'data' | 'fields'; 15 + 16 + export interface Config<T extends ClientOptions = ClientOptions> 17 + extends Omit<RequestInit, 'body' | 'headers' | 'method'>, 18 + CoreConfig { 19 + /** 20 + * Base URL for all requests made by this client. 21 + */ 22 + baseUrl?: T['baseUrl']; 23 + /** 24 + * Fetch API implementation. You can use this option to provide a custom 25 + * fetch instance. 26 + * 27 + * @default globalThis.fetch 28 + */ 29 + fetch?: typeof fetch; 30 + /** 31 + * Please don't use the Fetch client for Next.js applications. The `next` 32 + * options won't have any effect. 33 + * 34 + * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. 35 + */ 36 + next?: never; 37 + /** 38 + * Return the response data parsed in a specified format. By default, `auto` 39 + * will infer the appropriate method from the `Content-Type` response header. 40 + * You can override this behavior with any of the {@link Body} methods. 41 + * Select `stream` if you don't want to parse response data at all. 42 + * 43 + * @default 'auto' 44 + */ 45 + parseAs?: 46 + | 'arrayBuffer' 47 + | 'auto' 48 + | 'blob' 49 + | 'formData' 50 + | 'json' 51 + | 'stream' 52 + | 'text'; 53 + /** 54 + * Should we return only data or multiple fields (data, error, response, etc.)? 55 + * 56 + * @default 'fields' 57 + */ 58 + responseStyle?: ResponseStyle; 59 + /** 60 + * Throw an error instead of returning it in the response? 61 + * 62 + * @default false 63 + */ 64 + throwOnError?: T['throwOnError']; 65 + } 66 + 67 + export interface RequestOptions< 68 + TData = unknown, 69 + TResponseStyle extends ResponseStyle = 'fields', 70 + ThrowOnError extends boolean = boolean, 71 + Url extends string = string, 72 + > extends Config<{ 73 + responseStyle: TResponseStyle; 74 + throwOnError: ThrowOnError; 75 + }>, 76 + Pick< 77 + ServerSentEventsOptions<TData>, 78 + | 'onSseError' 79 + | 'onSseEvent' 80 + | 'sseDefaultRetryDelay' 81 + | 'sseMaxRetryAttempts' 82 + | 'sseMaxRetryDelay' 83 + > { 84 + /** 85 + * Any body that you want to add to your request. 86 + * 87 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} 88 + */ 89 + body?: unknown; 90 + path?: Record<string, unknown>; 91 + query?: Record<string, unknown>; 92 + /** 93 + * Security mechanism(s) to use for the request. 94 + */ 95 + security?: ReadonlyArray<Auth>; 96 + url: Url; 97 + } 98 + 99 + export interface ResolvedRequestOptions< 100 + TResponseStyle extends ResponseStyle = 'fields', 101 + ThrowOnError extends boolean = boolean, 102 + Url extends string = string, 103 + > extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> { 104 + serializedBody?: string; 105 + } 106 + 107 + export type RequestResult< 108 + TData = unknown, 109 + TError = unknown, 110 + ThrowOnError extends boolean = boolean, 111 + TResponseStyle extends ResponseStyle = 'fields', 112 + > = ThrowOnError extends true 113 + ? Promise< 114 + TResponseStyle extends 'data' 115 + ? TData extends Record<string, unknown> 116 + ? TData[keyof TData] 117 + : TData 118 + : { 119 + data: TData extends Record<string, unknown> 120 + ? TData[keyof TData] 121 + : TData; 122 + request: Request; 123 + response: Response; 124 + } 125 + > 126 + : Promise< 127 + TResponseStyle extends 'data' 128 + ? 129 + | (TData extends Record<string, unknown> 130 + ? TData[keyof TData] 131 + : TData) 132 + | undefined 133 + : ( 134 + | { 135 + data: TData extends Record<string, unknown> 136 + ? TData[keyof TData] 137 + : TData; 138 + error: undefined; 139 + } 140 + | { 141 + data: undefined; 142 + error: TError extends Record<string, unknown> 143 + ? TError[keyof TError] 144 + : TError; 145 + } 146 + ) & { 147 + request: Request; 148 + response: Response; 149 + } 150 + >; 151 + 152 + export interface ClientOptions { 153 + baseUrl?: string; 154 + responseStyle?: ResponseStyle; 155 + throwOnError?: boolean; 156 + } 157 + 158 + type MethodFn = < 159 + TData = unknown, 160 + TError = unknown, 161 + ThrowOnError extends boolean = false, 162 + TResponseStyle extends ResponseStyle = 'fields', 163 + >( 164 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 165 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 166 + 167 + type SseFn = < 168 + TData = unknown, 169 + TError = unknown, 170 + ThrowOnError extends boolean = false, 171 + TResponseStyle extends ResponseStyle = 'fields', 172 + >( 173 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 174 + ) => Promise<ServerSentEventsResult<TData, TError>>; 175 + 176 + type RequestFn = < 177 + TData = unknown, 178 + TError = unknown, 179 + ThrowOnError extends boolean = false, 180 + TResponseStyle extends ResponseStyle = 'fields', 181 + >( 182 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & 183 + Pick< 184 + Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 185 + 'method' 186 + >, 187 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 188 + 189 + type BuildUrlFn = < 190 + TData extends { 191 + body?: unknown; 192 + path?: Record<string, unknown>; 193 + query?: Record<string, unknown>; 194 + url: string; 195 + }, 196 + >( 197 + options: Pick<TData, 'url'> & Options<TData>, 198 + ) => string; 199 + 200 + export type Client = CoreClient< 201 + RequestFn, 202 + Config, 203 + MethodFn, 204 + BuildUrlFn, 205 + SseFn 206 + > & { 207 + interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>; 208 + }; 209 + 210 + /** 211 + * The `createClientConfig()` function will be called on client initialization 212 + * and the returned object will become the client's initial configuration. 213 + * 214 + * You may want to initialize your client this way instead of calling 215 + * `setConfig()`. This is useful for example if you're using Next.js 216 + * to ensure your client always has the correct values. 217 + */ 218 + export type CreateClientConfig<T extends ClientOptions = ClientOptions> = ( 219 + override?: Config<ClientOptions & T>, 220 + ) => Config<Required<ClientOptions> & T>; 221 + 222 + export interface TDataShape { 223 + body?: unknown; 224 + headers?: unknown; 225 + path?: unknown; 226 + query?: unknown; 227 + url: string; 228 + } 229 + 230 + type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>; 231 + 232 + export type Options< 233 + TData extends TDataShape = TDataShape, 234 + ThrowOnError extends boolean = boolean, 235 + TResponse = unknown, 236 + TResponseStyle extends ResponseStyle = 'fields', 237 + > = OmitKeys< 238 + RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 239 + 'body' | 'path' | 'query' | 'url' 240 + > & 241 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 242 + 243 + export type OptionsLegacyParser< 244 + TData = unknown, 245 + ThrowOnError extends boolean = boolean, 246 + TResponseStyle extends ResponseStyle = 'fields', 247 + > = TData extends { body?: any } 248 + ? TData extends { headers?: any } 249 + ? OmitKeys< 250 + RequestOptions<unknown, TResponseStyle, ThrowOnError>, 251 + 'body' | 'headers' | 'url' 252 + > & 253 + TData 254 + : OmitKeys< 255 + RequestOptions<unknown, TResponseStyle, ThrowOnError>, 256 + 'body' | 'url' 257 + > & 258 + TData & 259 + Pick<RequestOptions<unknown, TResponseStyle, ThrowOnError>, 'headers'> 260 + : TData extends { headers?: any } 261 + ? OmitKeys< 262 + RequestOptions<unknown, TResponseStyle, ThrowOnError>, 263 + 'headers' | 'url' 264 + > & 265 + TData & 266 + Pick<RequestOptions<unknown, TResponseStyle, ThrowOnError>, 'body'> 267 + : OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, 'url'> & 268 + TData;
+332
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/client/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { getAuthToken } from '../core/auth.gen'; 4 + import type { QuerySerializerOptions } from '../core/bodySerializer.gen'; 5 + import { jsonBodySerializer } from '../core/bodySerializer.gen'; 6 + import { 7 + serializeArrayParam, 8 + serializeObjectParam, 9 + serializePrimitiveParam, 10 + } from '../core/pathSerializer.gen'; 11 + import { getUrl } from '../core/utils.gen'; 12 + import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'; 13 + 14 + export const createQuerySerializer = <T = unknown>({ 15 + parameters = {}, 16 + ...args 17 + }: QuerySerializerOptions = {}) => { 18 + const querySerializer = (queryParams: T) => { 19 + const search: string[] = []; 20 + if (queryParams && typeof queryParams === 'object') { 21 + for (const name in queryParams) { 22 + const value = queryParams[name]; 23 + 24 + if (value === undefined || value === null) { 25 + continue; 26 + } 27 + 28 + const options = parameters[name] || args; 29 + 30 + if (Array.isArray(value)) { 31 + const serializedArray = serializeArrayParam({ 32 + allowReserved: options.allowReserved, 33 + explode: true, 34 + name, 35 + style: 'form', 36 + value, 37 + ...options.array, 38 + }); 39 + if (serializedArray) search.push(serializedArray); 40 + } else if (typeof value === 'object') { 41 + const serializedObject = serializeObjectParam({ 42 + allowReserved: options.allowReserved, 43 + explode: true, 44 + name, 45 + style: 'deepObject', 46 + value: value as Record<string, unknown>, 47 + ...options.object, 48 + }); 49 + if (serializedObject) search.push(serializedObject); 50 + } else { 51 + const serializedPrimitive = serializePrimitiveParam({ 52 + allowReserved: options.allowReserved, 53 + name, 54 + value: value as string, 55 + }); 56 + if (serializedPrimitive) search.push(serializedPrimitive); 57 + } 58 + } 59 + } 60 + return search.join('&'); 61 + }; 62 + return querySerializer; 63 + }; 64 + 65 + /** 66 + * Infers parseAs value from provided Content-Type header. 67 + */ 68 + export const getParseAs = ( 69 + contentType: string | null, 70 + ): Exclude<Config['parseAs'], 'auto'> => { 71 + if (!contentType) { 72 + // If no Content-Type header is provided, the best we can do is return the raw response body, 73 + // which is effectively the same as the 'stream' option. 74 + return 'stream'; 75 + } 76 + 77 + const cleanContent = contentType.split(';')[0]?.trim(); 78 + 79 + if (!cleanContent) { 80 + return; 81 + } 82 + 83 + if ( 84 + cleanContent.startsWith('application/json') || 85 + cleanContent.endsWith('+json') 86 + ) { 87 + return 'json'; 88 + } 89 + 90 + if (cleanContent === 'multipart/form-data') { 91 + return 'formData'; 92 + } 93 + 94 + if ( 95 + ['application/', 'audio/', 'image/', 'video/'].some((type) => 96 + cleanContent.startsWith(type), 97 + ) 98 + ) { 99 + return 'blob'; 100 + } 101 + 102 + if (cleanContent.startsWith('text/')) { 103 + return 'text'; 104 + } 105 + 106 + return; 107 + }; 108 + 109 + const checkForExistence = ( 110 + options: Pick<RequestOptions, 'auth' | 'query'> & { 111 + headers: Headers; 112 + }, 113 + name?: string, 114 + ): boolean => { 115 + if (!name) { 116 + return false; 117 + } 118 + if ( 119 + options.headers.has(name) || 120 + options.query?.[name] || 121 + options.headers.get('Cookie')?.includes(`${name}=`) 122 + ) { 123 + return true; 124 + } 125 + return false; 126 + }; 127 + 128 + export const setAuthParams = async ({ 129 + security, 130 + ...options 131 + }: Pick<Required<RequestOptions>, 'security'> & 132 + Pick<RequestOptions, 'auth' | 'query'> & { 133 + headers: Headers; 134 + }) => { 135 + for (const auth of security) { 136 + if (checkForExistence(options, auth.name)) { 137 + continue; 138 + } 139 + 140 + const token = await getAuthToken(auth, options.auth); 141 + 142 + if (!token) { 143 + continue; 144 + } 145 + 146 + const name = auth.name ?? 'Authorization'; 147 + 148 + switch (auth.in) { 149 + case 'query': 150 + if (!options.query) { 151 + options.query = {}; 152 + } 153 + options.query[name] = token; 154 + break; 155 + case 'cookie': 156 + options.headers.append('Cookie', `${name}=${token}`); 157 + break; 158 + case 'header': 159 + default: 160 + options.headers.set(name, token); 161 + break; 162 + } 163 + } 164 + }; 165 + 166 + export const buildUrl: Client['buildUrl'] = (options) => 167 + getUrl({ 168 + baseUrl: options.baseUrl as string, 169 + path: options.path, 170 + query: options.query, 171 + querySerializer: 172 + typeof options.querySerializer === 'function' 173 + ? options.querySerializer 174 + : createQuerySerializer(options.querySerializer), 175 + url: options.url, 176 + }); 177 + 178 + export const mergeConfigs = (a: Config, b: Config): Config => { 179 + const config = { ...a, ...b }; 180 + if (config.baseUrl?.endsWith('/')) { 181 + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); 182 + } 183 + config.headers = mergeHeaders(a.headers, b.headers); 184 + return config; 185 + }; 186 + 187 + const headersEntries = (headers: Headers): Array<[string, string]> => { 188 + const entries: Array<[string, string]> = []; 189 + headers.forEach((value, key) => { 190 + entries.push([key, value]); 191 + }); 192 + return entries; 193 + }; 194 + 195 + export const mergeHeaders = ( 196 + ...headers: Array<Required<Config>['headers'] | undefined> 197 + ): Headers => { 198 + const mergedHeaders = new Headers(); 199 + for (const header of headers) { 200 + if (!header) { 201 + continue; 202 + } 203 + 204 + const iterator = 205 + header instanceof Headers 206 + ? headersEntries(header) 207 + : Object.entries(header); 208 + 209 + for (const [key, value] of iterator) { 210 + if (value === null) { 211 + mergedHeaders.delete(key); 212 + } else if (Array.isArray(value)) { 213 + for (const v of value) { 214 + mergedHeaders.append(key, v as string); 215 + } 216 + } else if (value !== undefined) { 217 + // assume object headers are meant to be JSON stringified, i.e. their 218 + // content value in OpenAPI specification is 'application/json' 219 + mergedHeaders.set( 220 + key, 221 + typeof value === 'object' ? JSON.stringify(value) : (value as string), 222 + ); 223 + } 224 + } 225 + } 226 + return mergedHeaders; 227 + }; 228 + 229 + type ErrInterceptor<Err, Res, Req, Options> = ( 230 + error: Err, 231 + response: Res, 232 + request: Req, 233 + options: Options, 234 + ) => Err | Promise<Err>; 235 + 236 + type ReqInterceptor<Req, Options> = ( 237 + request: Req, 238 + options: Options, 239 + ) => Req | Promise<Req>; 240 + 241 + type ResInterceptor<Res, Req, Options> = ( 242 + response: Res, 243 + request: Req, 244 + options: Options, 245 + ) => Res | Promise<Res>; 246 + 247 + class Interceptors<Interceptor> { 248 + fns: Array<Interceptor | null> = []; 249 + 250 + clear(): void { 251 + this.fns = []; 252 + } 253 + 254 + eject(id: number | Interceptor): void { 255 + const index = this.getInterceptorIndex(id); 256 + if (this.fns[index]) { 257 + this.fns[index] = null; 258 + } 259 + } 260 + 261 + exists(id: number | Interceptor): boolean { 262 + const index = this.getInterceptorIndex(id); 263 + return Boolean(this.fns[index]); 264 + } 265 + 266 + getInterceptorIndex(id: number | Interceptor): number { 267 + if (typeof id === 'number') { 268 + return this.fns[id] ? id : -1; 269 + } 270 + return this.fns.indexOf(id); 271 + } 272 + 273 + update( 274 + id: number | Interceptor, 275 + fn: Interceptor, 276 + ): number | Interceptor | false { 277 + const index = this.getInterceptorIndex(id); 278 + if (this.fns[index]) { 279 + this.fns[index] = fn; 280 + return id; 281 + } 282 + return false; 283 + } 284 + 285 + use(fn: Interceptor): number { 286 + this.fns.push(fn); 287 + return this.fns.length - 1; 288 + } 289 + } 290 + 291 + export interface Middleware<Req, Res, Err, Options> { 292 + error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>; 293 + request: Interceptors<ReqInterceptor<Req, Options>>; 294 + response: Interceptors<ResInterceptor<Res, Req, Options>>; 295 + } 296 + 297 + export const createInterceptors = <Req, Res, Err, Options>(): Middleware< 298 + Req, 299 + Res, 300 + Err, 301 + Options 302 + > => ({ 303 + error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(), 304 + request: new Interceptors<ReqInterceptor<Req, Options>>(), 305 + response: new Interceptors<ResInterceptor<Res, Req, Options>>(), 306 + }); 307 + 308 + const defaultQuerySerializer = createQuerySerializer({ 309 + allowReserved: false, 310 + array: { 311 + explode: true, 312 + style: 'form', 313 + }, 314 + object: { 315 + explode: true, 316 + style: 'deepObject', 317 + }, 318 + }); 319 + 320 + const defaultHeaders = { 321 + 'Content-Type': 'application/json', 322 + }; 323 + 324 + export const createConfig = <T extends ClientOptions = ClientOptions>( 325 + override: Config<Omit<ClientOptions, keyof T> & T> = {}, 326 + ): Config<Omit<ClientOptions, keyof T> & T> => ({ 327 + ...jsonBodySerializer, 328 + headers: defaultHeaders, 329 + parseAs: 'auto', 330 + querySerializer: defaultQuerySerializer, 331 + ...override, 332 + });
+42
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/core/auth.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type AuthToken = string | undefined; 4 + 5 + export interface Auth { 6 + /** 7 + * Which part of the request do we use to send the auth? 8 + * 9 + * @default 'header' 10 + */ 11 + in?: 'header' | 'query' | 'cookie'; 12 + /** 13 + * Header or query parameter name. 14 + * 15 + * @default 'Authorization' 16 + */ 17 + name?: string; 18 + scheme?: 'basic' | 'bearer'; 19 + type: 'apiKey' | 'http'; 20 + } 21 + 22 + export const getAuthToken = async ( 23 + auth: Auth, 24 + callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken, 25 + ): Promise<string | undefined> => { 26 + const token = 27 + typeof callback === 'function' ? await callback(auth) : callback; 28 + 29 + if (!token) { 30 + return; 31 + } 32 + 33 + if (auth.scheme === 'bearer') { 34 + return `Bearer ${token}`; 35 + } 36 + 37 + if (auth.scheme === 'basic') { 38 + return `Basic ${btoa(token)}`; 39 + } 40 + 41 + return token; 42 + };
+100
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/core/bodySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + ArrayStyle, 5 + ObjectStyle, 6 + SerializerOptions, 7 + } from './pathSerializer.gen'; 8 + 9 + export type QuerySerializer = (query: Record<string, unknown>) => string; 10 + 11 + export type BodySerializer = (body: any) => any; 12 + 13 + type QuerySerializerOptionsObject = { 14 + allowReserved?: boolean; 15 + array?: Partial<SerializerOptions<ArrayStyle>>; 16 + object?: Partial<SerializerOptions<ObjectStyle>>; 17 + }; 18 + 19 + export type QuerySerializerOptions = QuerySerializerOptionsObject & { 20 + /** 21 + * Per-parameter serialization overrides. When provided, these settings 22 + * override the global array/object settings for specific parameter names. 23 + */ 24 + parameters?: Record<string, QuerySerializerOptionsObject>; 25 + }; 26 + 27 + const serializeFormDataPair = ( 28 + data: FormData, 29 + key: string, 30 + value: unknown, 31 + ): void => { 32 + if (typeof value === 'string' || value instanceof Blob) { 33 + data.append(key, value); 34 + } else if (value instanceof Date) { 35 + data.append(key, value.toISOString()); 36 + } else { 37 + data.append(key, JSON.stringify(value)); 38 + } 39 + }; 40 + 41 + const serializeUrlSearchParamsPair = ( 42 + data: URLSearchParams, 43 + key: string, 44 + value: unknown, 45 + ): void => { 46 + if (typeof value === 'string') { 47 + data.append(key, value); 48 + } else { 49 + data.append(key, JSON.stringify(value)); 50 + } 51 + }; 52 + 53 + export const formDataBodySerializer = { 54 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 55 + body: T, 56 + ): FormData => { 57 + const data = new FormData(); 58 + 59 + Object.entries(body).forEach(([key, value]) => { 60 + if (value === undefined || value === null) { 61 + return; 62 + } 63 + if (Array.isArray(value)) { 64 + value.forEach((v) => serializeFormDataPair(data, key, v)); 65 + } else { 66 + serializeFormDataPair(data, key, value); 67 + } 68 + }); 69 + 70 + return data; 71 + }, 72 + }; 73 + 74 + export const jsonBodySerializer = { 75 + bodySerializer: <T>(body: T): string => 76 + JSON.stringify(body, (_key, value) => 77 + typeof value === 'bigint' ? value.toString() : value, 78 + ), 79 + }; 80 + 81 + export const urlSearchParamsBodySerializer = { 82 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 83 + body: T, 84 + ): string => { 85 + const data = new URLSearchParams(); 86 + 87 + Object.entries(body).forEach(([key, value]) => { 88 + if (value === undefined || value === null) { 89 + return; 90 + } 91 + if (Array.isArray(value)) { 92 + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); 93 + } else { 94 + serializeUrlSearchParamsPair(data, key, value); 95 + } 96 + }); 97 + 98 + return data.toString(); 99 + }, 100 + };
+176
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/core/params.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + type Slot = 'body' | 'headers' | 'path' | 'query'; 4 + 5 + export type Field = 6 + | { 7 + in: Exclude<Slot, 'body'>; 8 + /** 9 + * Field name. This is the name we want the user to see and use. 10 + */ 11 + key: string; 12 + /** 13 + * Field mapped name. This is the name we want to use in the request. 14 + * If omitted, we use the same value as `key`. 15 + */ 16 + map?: string; 17 + } 18 + | { 19 + in: Extract<Slot, 'body'>; 20 + /** 21 + * Key isn't required for bodies. 22 + */ 23 + key?: string; 24 + map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 36 + }; 37 + 38 + export interface Fields { 39 + allowExtra?: Partial<Record<Slot, boolean>>; 40 + args?: ReadonlyArray<Field>; 41 + } 42 + 43 + export type FieldsConfig = ReadonlyArray<Field | Fields>; 44 + 45 + const extraPrefixesMap: Record<string, Slot> = { 46 + $body_: 'body', 47 + $headers_: 'headers', 48 + $path_: 'path', 49 + $query_: 'query', 50 + }; 51 + const extraPrefixes = Object.entries(extraPrefixesMap); 52 + 53 + type KeyMap = Map< 54 + string, 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 63 + >; 64 + 65 + const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { 66 + if (!map) { 67 + map = new Map(); 68 + } 69 + 70 + for (const config of fields) { 71 + if ('in' in config) { 72 + if (config.key) { 73 + map.set(config.key, { 74 + in: config.in, 75 + map: config.map, 76 + }); 77 + } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 82 + } else if (config.args) { 83 + buildKeyMap(config.args, map); 84 + } 85 + } 86 + 87 + return map; 88 + }; 89 + 90 + interface Params { 91 + body: unknown; 92 + headers: Record<string, unknown>; 93 + path: Record<string, unknown>; 94 + query: Record<string, unknown>; 95 + } 96 + 97 + const stripEmptySlots = (params: Params) => { 98 + for (const [slot, value] of Object.entries(params)) { 99 + if (value && typeof value === 'object' && !Object.keys(value).length) { 100 + delete params[slot as Slot]; 101 + } 102 + } 103 + }; 104 + 105 + export const buildClientParams = ( 106 + args: ReadonlyArray<unknown>, 107 + fields: FieldsConfig, 108 + ) => { 109 + const params: Params = { 110 + body: {}, 111 + headers: {}, 112 + path: {}, 113 + query: {}, 114 + }; 115 + 116 + const map = buildKeyMap(fields); 117 + 118 + let config: FieldsConfig[number] | undefined; 119 + 120 + for (const [index, arg] of args.entries()) { 121 + if (fields[index]) { 122 + config = fields[index]; 123 + } 124 + 125 + if (!config) { 126 + continue; 127 + } 128 + 129 + if ('in' in config) { 130 + if (config.key) { 131 + const field = map.get(config.key)!; 132 + const name = field.map || config.key; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 136 + } else { 137 + params.body = arg; 138 + } 139 + } else { 140 + for (const [key, value] of Object.entries(arg ?? {})) { 141 + const field = map.get(key); 142 + 143 + if (field) { 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 150 + } else { 151 + const extra = extraPrefixes.find(([prefix]) => 152 + key.startsWith(prefix), 153 + ); 154 + 155 + if (extra) { 156 + const [prefix, slot] = extra; 157 + (params[slot] as Record<string, unknown>)[ 158 + key.slice(prefix.length) 159 + ] = value; 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 162 + if (allowed) { 163 + (params[slot as Slot] as Record<string, unknown>)[key] = value; 164 + break; 165 + } 166 + } 167 + } 168 + } 169 + } 170 + } 171 + } 172 + 173 + stripEmptySlots(params); 174 + 175 + return params; 176 + };
+181
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/core/pathSerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + interface SerializeOptions<T> 4 + extends SerializePrimitiveOptions, 5 + SerializerOptions<T> {} 6 + 7 + interface SerializePrimitiveOptions { 8 + allowReserved?: boolean; 9 + name: string; 10 + } 11 + 12 + export interface SerializerOptions<T> { 13 + /** 14 + * @default true 15 + */ 16 + explode: boolean; 17 + style: T; 18 + } 19 + 20 + export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; 21 + export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; 22 + type MatrixStyle = 'label' | 'matrix' | 'simple'; 23 + export type ObjectStyle = 'form' | 'deepObject'; 24 + type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; 25 + 26 + interface SerializePrimitiveParam extends SerializePrimitiveOptions { 27 + value: string; 28 + } 29 + 30 + export const separatorArrayExplode = (style: ArraySeparatorStyle) => { 31 + switch (style) { 32 + case 'label': 33 + return '.'; 34 + case 'matrix': 35 + return ';'; 36 + case 'simple': 37 + return ','; 38 + default: 39 + return '&'; 40 + } 41 + }; 42 + 43 + export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { 44 + switch (style) { 45 + case 'form': 46 + return ','; 47 + case 'pipeDelimited': 48 + return '|'; 49 + case 'spaceDelimited': 50 + return '%20'; 51 + default: 52 + return ','; 53 + } 54 + }; 55 + 56 + export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { 57 + switch (style) { 58 + case 'label': 59 + return '.'; 60 + case 'matrix': 61 + return ';'; 62 + case 'simple': 63 + return ','; 64 + default: 65 + return '&'; 66 + } 67 + }; 68 + 69 + export const serializeArrayParam = ({ 70 + allowReserved, 71 + explode, 72 + name, 73 + style, 74 + value, 75 + }: SerializeOptions<ArraySeparatorStyle> & { 76 + value: unknown[]; 77 + }) => { 78 + if (!explode) { 79 + const joinedValues = ( 80 + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) 81 + ).join(separatorArrayNoExplode(style)); 82 + switch (style) { 83 + case 'label': 84 + return `.${joinedValues}`; 85 + case 'matrix': 86 + return `;${name}=${joinedValues}`; 87 + case 'simple': 88 + return joinedValues; 89 + default: 90 + return `${name}=${joinedValues}`; 91 + } 92 + } 93 + 94 + const separator = separatorArrayExplode(style); 95 + const joinedValues = value 96 + .map((v) => { 97 + if (style === 'label' || style === 'simple') { 98 + return allowReserved ? v : encodeURIComponent(v as string); 99 + } 100 + 101 + return serializePrimitiveParam({ 102 + allowReserved, 103 + name, 104 + value: v as string, 105 + }); 106 + }) 107 + .join(separator); 108 + return style === 'label' || style === 'matrix' 109 + ? separator + joinedValues 110 + : joinedValues; 111 + }; 112 + 113 + export const serializePrimitiveParam = ({ 114 + allowReserved, 115 + name, 116 + value, 117 + }: SerializePrimitiveParam) => { 118 + if (value === undefined || value === null) { 119 + return ''; 120 + } 121 + 122 + if (typeof value === 'object') { 123 + throw new Error( 124 + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', 125 + ); 126 + } 127 + 128 + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; 129 + }; 130 + 131 + export const serializeObjectParam = ({ 132 + allowReserved, 133 + explode, 134 + name, 135 + style, 136 + value, 137 + valueOnly, 138 + }: SerializeOptions<ObjectSeparatorStyle> & { 139 + value: Record<string, unknown> | Date; 140 + valueOnly?: boolean; 141 + }) => { 142 + if (value instanceof Date) { 143 + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; 144 + } 145 + 146 + if (style !== 'deepObject' && !explode) { 147 + let values: string[] = []; 148 + Object.entries(value).forEach(([key, v]) => { 149 + values = [ 150 + ...values, 151 + key, 152 + allowReserved ? (v as string) : encodeURIComponent(v as string), 153 + ]; 154 + }); 155 + const joinedValues = values.join(','); 156 + switch (style) { 157 + case 'form': 158 + return `${name}=${joinedValues}`; 159 + case 'label': 160 + return `.${joinedValues}`; 161 + case 'matrix': 162 + return `;${name}=${joinedValues}`; 163 + default: 164 + return joinedValues; 165 + } 166 + } 167 + 168 + const separator = separatorObjectExplode(style); 169 + const joinedValues = Object.entries(value) 170 + .map(([key, v]) => 171 + serializePrimitiveParam({ 172 + allowReserved, 173 + name: style === 'deepObject' ? `${name}[${key}]` : key, 174 + value: v as string, 175 + }), 176 + ) 177 + .join(separator); 178 + return style === 'label' || style === 'matrix' 179 + ? separator + joinedValues 180 + : joinedValues; 181 + };
+136
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/core/queryKeySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + /** 4 + * JSON-friendly union that mirrors what Pinia Colada can hash. 5 + */ 6 + export type JsonValue = 7 + | null 8 + | string 9 + | number 10 + | boolean 11 + | JsonValue[] 12 + | { [key: string]: JsonValue }; 13 + 14 + /** 15 + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. 16 + */ 17 + export const queryKeyJsonReplacer = (_key: string, value: unknown) => { 18 + if ( 19 + value === undefined || 20 + typeof value === 'function' || 21 + typeof value === 'symbol' 22 + ) { 23 + return undefined; 24 + } 25 + if (typeof value === 'bigint') { 26 + return value.toString(); 27 + } 28 + if (value instanceof Date) { 29 + return value.toISOString(); 30 + } 31 + return value; 32 + }; 33 + 34 + /** 35 + * Safely stringifies a value and parses it back into a JsonValue. 36 + */ 37 + export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { 38 + try { 39 + const json = JSON.stringify(input, queryKeyJsonReplacer); 40 + if (json === undefined) { 41 + return undefined; 42 + } 43 + return JSON.parse(json) as JsonValue; 44 + } catch { 45 + return undefined; 46 + } 47 + }; 48 + 49 + /** 50 + * Detects plain objects (including objects with a null prototype). 51 + */ 52 + const isPlainObject = (value: unknown): value is Record<string, unknown> => { 53 + if (value === null || typeof value !== 'object') { 54 + return false; 55 + } 56 + const prototype = Object.getPrototypeOf(value as object); 57 + return prototype === Object.prototype || prototype === null; 58 + }; 59 + 60 + /** 61 + * Turns URLSearchParams into a sorted JSON object for deterministic keys. 62 + */ 63 + const serializeSearchParams = (params: URLSearchParams): JsonValue => { 64 + const entries = Array.from(params.entries()).sort(([a], [b]) => 65 + a.localeCompare(b), 66 + ); 67 + const result: Record<string, JsonValue> = {}; 68 + 69 + for (const [key, value] of entries) { 70 + const existing = result[key]; 71 + if (existing === undefined) { 72 + result[key] = value; 73 + continue; 74 + } 75 + 76 + if (Array.isArray(existing)) { 77 + (existing as string[]).push(value); 78 + } else { 79 + result[key] = [existing, value]; 80 + } 81 + } 82 + 83 + return result; 84 + }; 85 + 86 + /** 87 + * Normalizes any accepted value into a JSON-friendly shape for query keys. 88 + */ 89 + export const serializeQueryKeyValue = ( 90 + value: unknown, 91 + ): JsonValue | undefined => { 92 + if (value === null) { 93 + return null; 94 + } 95 + 96 + if ( 97 + typeof value === 'string' || 98 + typeof value === 'number' || 99 + typeof value === 'boolean' 100 + ) { 101 + return value; 102 + } 103 + 104 + if ( 105 + value === undefined || 106 + typeof value === 'function' || 107 + typeof value === 'symbol' 108 + ) { 109 + return undefined; 110 + } 111 + 112 + if (typeof value === 'bigint') { 113 + return value.toString(); 114 + } 115 + 116 + if (value instanceof Date) { 117 + return value.toISOString(); 118 + } 119 + 120 + if (Array.isArray(value)) { 121 + return stringifyToJsonValue(value); 122 + } 123 + 124 + if ( 125 + typeof URLSearchParams !== 'undefined' && 126 + value instanceof URLSearchParams 127 + ) { 128 + return serializeSearchParams(value); 129 + } 130 + 131 + if (isPlainObject(value)) { 132 + return stringifyToJsonValue(value); 133 + } 134 + 135 + return undefined; 136 + };
+264
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/core/serverSentEvents.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Config } from './types.gen'; 4 + 5 + export type ServerSentEventsOptions<TData = unknown> = Omit< 6 + RequestInit, 7 + 'method' 8 + > & 9 + Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & { 10 + /** 11 + * Fetch API implementation. You can use this option to provide a custom 12 + * fetch instance. 13 + * 14 + * @default globalThis.fetch 15 + */ 16 + fetch?: typeof fetch; 17 + /** 18 + * Implementing clients can call request interceptors inside this hook. 19 + */ 20 + onRequest?: (url: string, init: RequestInit) => Promise<Request>; 21 + /** 22 + * Callback invoked when a network or parsing error occurs during streaming. 23 + * 24 + * This option applies only if the endpoint returns a stream of events. 25 + * 26 + * @param error The error that occurred. 27 + */ 28 + onSseError?: (error: unknown) => void; 29 + /** 30 + * Callback invoked when an event is streamed from the server. 31 + * 32 + * This option applies only if the endpoint returns a stream of events. 33 + * 34 + * @param event Event streamed from the server. 35 + * @returns Nothing (void). 36 + */ 37 + onSseEvent?: (event: StreamEvent<TData>) => void; 38 + serializedBody?: RequestInit['body']; 39 + /** 40 + * Default retry delay in milliseconds. 41 + * 42 + * This option applies only if the endpoint returns a stream of events. 43 + * 44 + * @default 3000 45 + */ 46 + sseDefaultRetryDelay?: number; 47 + /** 48 + * Maximum number of retry attempts before giving up. 49 + */ 50 + sseMaxRetryAttempts?: number; 51 + /** 52 + * Maximum retry delay in milliseconds. 53 + * 54 + * Applies only when exponential backoff is used. 55 + * 56 + * This option applies only if the endpoint returns a stream of events. 57 + * 58 + * @default 30000 59 + */ 60 + sseMaxRetryDelay?: number; 61 + /** 62 + * Optional sleep function for retry backoff. 63 + * 64 + * Defaults to using `setTimeout`. 65 + */ 66 + sseSleepFn?: (ms: number) => Promise<void>; 67 + url: string; 68 + }; 69 + 70 + export interface StreamEvent<TData = unknown> { 71 + data: TData; 72 + event?: string; 73 + id?: string; 74 + retry?: number; 75 + } 76 + 77 + export type ServerSentEventsResult< 78 + TData = unknown, 79 + TReturn = void, 80 + TNext = unknown, 81 + > = { 82 + stream: AsyncGenerator< 83 + TData extends Record<string, unknown> ? TData[keyof TData] : TData, 84 + TReturn, 85 + TNext 86 + >; 87 + }; 88 + 89 + export const createSseClient = <TData = unknown>({ 90 + onRequest, 91 + onSseError, 92 + onSseEvent, 93 + responseTransformer, 94 + responseValidator, 95 + sseDefaultRetryDelay, 96 + sseMaxRetryAttempts, 97 + sseMaxRetryDelay, 98 + sseSleepFn, 99 + url, 100 + ...options 101 + }: ServerSentEventsOptions): ServerSentEventsResult<TData> => { 102 + let lastEventId: string | undefined; 103 + 104 + const sleep = 105 + sseSleepFn ?? 106 + ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); 107 + 108 + const createStream = async function* () { 109 + let retryDelay: number = sseDefaultRetryDelay ?? 3000; 110 + let attempt = 0; 111 + const signal = options.signal ?? new AbortController().signal; 112 + 113 + while (true) { 114 + if (signal.aborted) break; 115 + 116 + attempt++; 117 + 118 + const headers = 119 + options.headers instanceof Headers 120 + ? options.headers 121 + : new Headers(options.headers as Record<string, string> | undefined); 122 + 123 + if (lastEventId !== undefined) { 124 + headers.set('Last-Event-ID', lastEventId); 125 + } 126 + 127 + try { 128 + const requestInit: RequestInit = { 129 + redirect: 'follow', 130 + ...options, 131 + body: options.serializedBody, 132 + headers, 133 + signal, 134 + }; 135 + let request = new Request(url, requestInit); 136 + if (onRequest) { 137 + request = await onRequest(url, requestInit); 138 + } 139 + // fetch must be assigned here, otherwise it would throw the error: 140 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 141 + const _fetch = options.fetch ?? globalThis.fetch; 142 + const response = await _fetch(request); 143 + 144 + if (!response.ok) 145 + throw new Error( 146 + `SSE failed: ${response.status} ${response.statusText}`, 147 + ); 148 + 149 + if (!response.body) throw new Error('No body in SSE response'); 150 + 151 + const reader = response.body 152 + .pipeThrough(new TextDecoderStream()) 153 + .getReader(); 154 + 155 + let buffer = ''; 156 + 157 + const abortHandler = () => { 158 + try { 159 + reader.cancel(); 160 + } catch { 161 + // noop 162 + } 163 + }; 164 + 165 + signal.addEventListener('abort', abortHandler); 166 + 167 + try { 168 + while (true) { 169 + const { done, value } = await reader.read(); 170 + if (done) break; 171 + buffer += value; 172 + 173 + const chunks = buffer.split('\n\n'); 174 + buffer = chunks.pop() ?? ''; 175 + 176 + for (const chunk of chunks) { 177 + const lines = chunk.split('\n'); 178 + const dataLines: Array<string> = []; 179 + let eventName: string | undefined; 180 + 181 + for (const line of lines) { 182 + if (line.startsWith('data:')) { 183 + dataLines.push(line.replace(/^data:\s*/, '')); 184 + } else if (line.startsWith('event:')) { 185 + eventName = line.replace(/^event:\s*/, ''); 186 + } else if (line.startsWith('id:')) { 187 + lastEventId = line.replace(/^id:\s*/, ''); 188 + } else if (line.startsWith('retry:')) { 189 + const parsed = Number.parseInt( 190 + line.replace(/^retry:\s*/, ''), 191 + 10, 192 + ); 193 + if (!Number.isNaN(parsed)) { 194 + retryDelay = parsed; 195 + } 196 + } 197 + } 198 + 199 + let data: unknown; 200 + let parsedJson = false; 201 + 202 + if (dataLines.length) { 203 + const rawData = dataLines.join('\n'); 204 + try { 205 + data = JSON.parse(rawData); 206 + parsedJson = true; 207 + } catch { 208 + data = rawData; 209 + } 210 + } 211 + 212 + if (parsedJson) { 213 + if (responseValidator) { 214 + await responseValidator(data); 215 + } 216 + 217 + if (responseTransformer) { 218 + data = await responseTransformer(data); 219 + } 220 + } 221 + 222 + onSseEvent?.({ 223 + data, 224 + event: eventName, 225 + id: lastEventId, 226 + retry: retryDelay, 227 + }); 228 + 229 + if (dataLines.length) { 230 + yield data as any; 231 + } 232 + } 233 + } 234 + } finally { 235 + signal.removeEventListener('abort', abortHandler); 236 + reader.releaseLock(); 237 + } 238 + 239 + break; // exit loop on normal completion 240 + } catch (error) { 241 + // connection failed or aborted; retry after delay 242 + onSseError?.(error); 243 + 244 + if ( 245 + sseMaxRetryAttempts !== undefined && 246 + attempt >= sseMaxRetryAttempts 247 + ) { 248 + break; // stop after firing error 249 + } 250 + 251 + // exponential backoff: double retry each attempt, cap at 30s 252 + const backoff = Math.min( 253 + retryDelay * 2 ** (attempt - 1), 254 + sseMaxRetryDelay ?? 30000, 255 + ); 256 + await sleep(backoff); 257 + } 258 + } 259 + }; 260 + 261 + const stream = createStream(); 262 + 263 + return { stream }; 264 + };
+118
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/core/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth, AuthToken } from './auth.gen'; 4 + import type { 5 + BodySerializer, 6 + QuerySerializer, 7 + QuerySerializerOptions, 8 + } from './bodySerializer.gen'; 9 + 10 + export type HttpMethod = 11 + | 'connect' 12 + | 'delete' 13 + | 'get' 14 + | 'head' 15 + | 'options' 16 + | 'patch' 17 + | 'post' 18 + | 'put' 19 + | 'trace'; 20 + 21 + export type Client< 22 + RequestFn = never, 23 + Config = unknown, 24 + MethodFn = never, 25 + BuildUrlFn = never, 26 + SseFn = never, 27 + > = { 28 + /** 29 + * Returns the final request URL. 30 + */ 31 + buildUrl: BuildUrlFn; 32 + getConfig: () => Config; 33 + request: RequestFn; 34 + setConfig: (config: Config) => Config; 35 + } & { 36 + [K in HttpMethod]: MethodFn; 37 + } & ([SseFn] extends [never] 38 + ? { sse?: never } 39 + : { sse: { [K in HttpMethod]: SseFn } }); 40 + 41 + export interface Config { 42 + /** 43 + * Auth token or a function returning auth token. The resolved value will be 44 + * added to the request payload as defined by its `security` array. 45 + */ 46 + auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken; 47 + /** 48 + * A function for serializing request body parameter. By default, 49 + * {@link JSON.stringify()} will be used. 50 + */ 51 + bodySerializer?: BodySerializer | null; 52 + /** 53 + * An object containing any HTTP headers that you want to pre-populate your 54 + * `Headers` object with. 55 + * 56 + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 57 + */ 58 + headers?: 59 + | RequestInit['headers'] 60 + | Record< 61 + string, 62 + | string 63 + | number 64 + | boolean 65 + | (string | number | boolean)[] 66 + | null 67 + | undefined 68 + | unknown 69 + >; 70 + /** 71 + * The request method. 72 + * 73 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} 74 + */ 75 + method?: Uppercase<HttpMethod>; 76 + /** 77 + * A function for serializing request query parameters. By default, arrays 78 + * will be exploded in form style, objects will be exploded in deepObject 79 + * style, and reserved characters are percent-encoded. 80 + * 81 + * This method will have no effect if the native `paramsSerializer()` Axios 82 + * API function is used. 83 + * 84 + * {@link https://swagger.io/docs/specification/serialization/#query View examples} 85 + */ 86 + querySerializer?: QuerySerializer | QuerySerializerOptions; 87 + /** 88 + * A function validating request data. This is useful if you want to ensure 89 + * the request conforms to the desired shape, so it can be safely sent to 90 + * the server. 91 + */ 92 + requestValidator?: (data: unknown) => Promise<unknown>; 93 + /** 94 + * A function transforming response data before it's returned. This is useful 95 + * for post-processing data, e.g. converting ISO strings into Date objects. 96 + */ 97 + responseTransformer?: (data: unknown) => Promise<unknown>; 98 + /** 99 + * A function validating response data. This is useful if you want to ensure 100 + * the response conforms to the desired shape, so it can be safely passed to 101 + * the transformers and returned to the user. 102 + */ 103 + responseValidator?: (data: unknown) => Promise<unknown>; 104 + } 105 + 106 + type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 + ? true 108 + : [T] extends [never | undefined] 109 + ? [undefined] extends [T] 110 + ? false 111 + : true 112 + : false; 113 + 114 + export type OmitNever<T extends Record<string, unknown>> = { 115 + [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 + ? never 117 + : K]: T[K]; 118 + };
+143
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/core/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; 4 + import { 5 + type ArraySeparatorStyle, 6 + serializeArrayParam, 7 + serializeObjectParam, 8 + serializePrimitiveParam, 9 + } from './pathSerializer.gen'; 10 + 11 + export interface PathSerializer { 12 + path: Record<string, unknown>; 13 + url: string; 14 + } 15 + 16 + export const PATH_PARAM_RE = /\{[^{}]+\}/g; 17 + 18 + export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { 19 + let url = _url; 20 + const matches = _url.match(PATH_PARAM_RE); 21 + if (matches) { 22 + for (const match of matches) { 23 + let explode = false; 24 + let name = match.substring(1, match.length - 1); 25 + let style: ArraySeparatorStyle = 'simple'; 26 + 27 + if (name.endsWith('*')) { 28 + explode = true; 29 + name = name.substring(0, name.length - 1); 30 + } 31 + 32 + if (name.startsWith('.')) { 33 + name = name.substring(1); 34 + style = 'label'; 35 + } else if (name.startsWith(';')) { 36 + name = name.substring(1); 37 + style = 'matrix'; 38 + } 39 + 40 + const value = path[name]; 41 + 42 + if (value === undefined || value === null) { 43 + continue; 44 + } 45 + 46 + if (Array.isArray(value)) { 47 + url = url.replace( 48 + match, 49 + serializeArrayParam({ explode, name, style, value }), 50 + ); 51 + continue; 52 + } 53 + 54 + if (typeof value === 'object') { 55 + url = url.replace( 56 + match, 57 + serializeObjectParam({ 58 + explode, 59 + name, 60 + style, 61 + value: value as Record<string, unknown>, 62 + valueOnly: true, 63 + }), 64 + ); 65 + continue; 66 + } 67 + 68 + if (style === 'matrix') { 69 + url = url.replace( 70 + match, 71 + `;${serializePrimitiveParam({ 72 + name, 73 + value: value as string, 74 + })}`, 75 + ); 76 + continue; 77 + } 78 + 79 + const replaceValue = encodeURIComponent( 80 + style === 'label' ? `.${value as string}` : (value as string), 81 + ); 82 + url = url.replace(match, replaceValue); 83 + } 84 + } 85 + return url; 86 + }; 87 + 88 + export const getUrl = ({ 89 + baseUrl, 90 + path, 91 + query, 92 + querySerializer, 93 + url: _url, 94 + }: { 95 + baseUrl?: string; 96 + path?: Record<string, unknown>; 97 + query?: Record<string, unknown>; 98 + querySerializer: QuerySerializer; 99 + url: string; 100 + }) => { 101 + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; 102 + let url = (baseUrl ?? '') + pathUrl; 103 + if (path) { 104 + url = defaultPathSerializer({ path, url }); 105 + } 106 + let search = query ? querySerializer(query) : ''; 107 + if (search.startsWith('?')) { 108 + search = search.substring(1); 109 + } 110 + if (search) { 111 + url += `?${search}`; 112 + } 113 + return url; 114 + }; 115 + 116 + export function getValidRequestBody(options: { 117 + body?: unknown; 118 + bodySerializer?: BodySerializer | null; 119 + serializedBody?: unknown; 120 + }) { 121 + const hasBody = options.body !== undefined; 122 + const isSerializedBody = hasBody && options.bodySerializer; 123 + 124 + if (isSerializedBody) { 125 + if ('serializedBody' in options) { 126 + const hasSerializedBody = 127 + options.serializedBody !== undefined && options.serializedBody !== ''; 128 + 129 + return hasSerializedBody ? options.serializedBody : null; 130 + } 131 + 132 + // not all clients implement a serializedBody property (i.e. client-axios) 133 + return options.body !== '' ? options.body : null; 134 + } 135 + 136 + // plain/text body 137 + if (hasBody) { 138 + return options.body; 139 + } 140 + 141 + // no body was provided 142 + return undefined; 143 + }
+4
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type * from './types.gen'; 4 + export * from './sdk.gen';
+912
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/sdk.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { buildClientParams, type Client, type Options as Options2, type TDataShape } from './client'; 4 + import { client } from './client.gen'; 5 + import type { AgentPartInput, AppAgentsResponses, AppGetResponses, AppInitResponses, AppLogResponses, Auth, AuthSetErrors, AuthSetResponses, ConfigGetResponses, ConfigProvidersResponses, EventSubscribeResponses, FilePartInput, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, PostSessionByIdPermissionsByPermissionIdResponses, SessionAbortResponses, SessionChatResponses, SessionChildrenResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteResponses, SessionGetResponses, SessionInitResponses, SessionListResponses, SessionMessageResponses, SessionMessagesResponses, SessionRevertResponses, SessionShareResponses, SessionShellResponses, SessionSummarizeResponses, SessionUnrevertResponses, SessionUnshareResponses, SessionUpdateResponses, TextPartInput, TuiAppendPromptResponses, TuiClearPromptResponses, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiShowToastResponses, TuiSubmitPromptResponses } from './types.gen'; 6 + 7 + export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & { 8 + /** 9 + * You can provide a client instance returned by `createClient()` instead of 10 + * individual options. This might be also useful if you want to implement a 11 + * custom client. 12 + */ 13 + client?: Client; 14 + /** 15 + * You can pass arbitrary values through the `meta` object. This can be 16 + * used to access values that aren't defined as part of the SDK function. 17 + */ 18 + meta?: Record<string, unknown>; 19 + }; 20 + 21 + /** 22 + * Get events 23 + */ 24 + export const eventSubscribe = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 25 + return (options?.client ?? client).sse.get<EventSubscribeResponses, unknown, ThrowOnError>({ 26 + url: '/event', 27 + ...options 28 + }); 29 + }; 30 + 31 + /** 32 + * Get app info 33 + */ 34 + export const appGet = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 35 + return (options?.client ?? client).get<AppGetResponses, unknown, ThrowOnError>({ 36 + url: '/app', 37 + ...options 38 + }); 39 + }; 40 + 41 + /** 42 + * Initialize the app 43 + */ 44 + export const appInit = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 45 + return (options?.client ?? client).post<AppInitResponses, unknown, ThrowOnError>({ 46 + url: '/app/init', 47 + ...options 48 + }); 49 + }; 50 + 51 + /** 52 + * Get config info 53 + */ 54 + export const configGet = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 55 + return (options?.client ?? client).get<ConfigGetResponses, unknown, ThrowOnError>({ 56 + url: '/config', 57 + ...options 58 + }); 59 + }; 60 + 61 + /** 62 + * List all sessions 63 + */ 64 + export const sessionList = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 65 + return (options?.client ?? client).get<SessionListResponses, unknown, ThrowOnError>({ 66 + url: '/session', 67 + ...options 68 + }); 69 + }; 70 + 71 + /** 72 + * Create a new session 73 + */ 74 + export const sessionCreate = <ThrowOnError extends boolean = false>(parameters?: { 75 + parentID?: string; 76 + title?: string; 77 + }, options?: Options<never, ThrowOnError>) => { 78 + const params = buildClientParams([ 79 + parameters 80 + ], [ 81 + { 82 + in: 'body', 83 + key: 'parentID' 84 + }, 85 + { 86 + in: 'body', 87 + key: 'title' 88 + } 89 + ]); 90 + return (options?.client ?? client).post<SessionCreateResponses, SessionCreateErrors, ThrowOnError>({ 91 + url: '/session', 92 + ...options, 93 + ...params, 94 + headers: { 95 + 'Content-Type': 'application/json', 96 + ...options?.headers, 97 + ...params.headers 98 + } 99 + }); 100 + }; 101 + 102 + /** 103 + * Delete a session and all its data 104 + */ 105 + export const sessionDelete = <ThrowOnError extends boolean = false>(parameters: { 106 + id: string; 107 + }, options?: Options<never, ThrowOnError>) => { 108 + const params = buildClientParams([ 109 + parameters 110 + ], [ 111 + { 112 + in: 'path', 113 + key: 'id' 114 + } 115 + ]); 116 + return (options?.client ?? client).delete<SessionDeleteResponses, unknown, ThrowOnError>({ 117 + url: '/session/{id}', 118 + ...options, 119 + ...params 120 + }); 121 + }; 122 + 123 + /** 124 + * Get session 125 + */ 126 + export const sessionGet = <ThrowOnError extends boolean = false>(parameters: { 127 + id: string; 128 + }, options?: Options<never, ThrowOnError>) => { 129 + const params = buildClientParams([ 130 + parameters 131 + ], [ 132 + { 133 + in: 'path', 134 + key: 'id' 135 + } 136 + ]); 137 + return (options?.client ?? client).get<SessionGetResponses, unknown, ThrowOnError>({ 138 + url: '/session/{id}', 139 + ...options, 140 + ...params 141 + }); 142 + }; 143 + 144 + /** 145 + * Update session properties 146 + */ 147 + export const sessionUpdate = <ThrowOnError extends boolean = false>(parameters: { 148 + id: string; 149 + title?: string; 150 + }, options?: Options<never, ThrowOnError>) => { 151 + const params = buildClientParams([ 152 + parameters 153 + ], [ 154 + { 155 + in: 'path', 156 + key: 'id' 157 + }, 158 + { 159 + in: 'body', 160 + key: 'title' 161 + } 162 + ]); 163 + return (options?.client ?? client).patch<SessionUpdateResponses, unknown, ThrowOnError>({ 164 + url: '/session/{id}', 165 + ...options, 166 + ...params, 167 + headers: { 168 + 'Content-Type': 'application/json', 169 + ...options?.headers, 170 + ...params.headers 171 + } 172 + }); 173 + }; 174 + 175 + /** 176 + * Get a session's children 177 + */ 178 + export const sessionChildren = <ThrowOnError extends boolean = false>(parameters: { 179 + id: string; 180 + }, options?: Options<never, ThrowOnError>) => { 181 + const params = buildClientParams([ 182 + parameters 183 + ], [ 184 + { 185 + in: 'path', 186 + key: 'id' 187 + } 188 + ]); 189 + return (options?.client ?? client).get<SessionChildrenResponses, unknown, ThrowOnError>({ 190 + url: '/session/{id}/children', 191 + ...options, 192 + ...params 193 + }); 194 + }; 195 + 196 + /** 197 + * Analyze the app and create an AGENTS.md file 198 + */ 199 + export const sessionInit = <ThrowOnError extends boolean = false>(parameters: { 200 + id: string; 201 + messageID?: string; 202 + providerID?: string; 203 + modelID?: string; 204 + }, options?: Options<never, ThrowOnError>) => { 205 + const params = buildClientParams([ 206 + parameters 207 + ], [ 208 + { 209 + in: 'path', 210 + key: 'id' 211 + }, 212 + { 213 + in: 'body', 214 + key: 'messageID' 215 + }, 216 + { 217 + in: 'body', 218 + key: 'providerID' 219 + }, 220 + { 221 + in: 'body', 222 + key: 'modelID' 223 + } 224 + ]); 225 + return (options?.client ?? client).post<SessionInitResponses, unknown, ThrowOnError>({ 226 + url: '/session/{id}/init', 227 + ...options, 228 + ...params, 229 + headers: { 230 + 'Content-Type': 'application/json', 231 + ...options?.headers, 232 + ...params.headers 233 + } 234 + }); 235 + }; 236 + 237 + /** 238 + * Abort a session 239 + */ 240 + export const sessionAbort = <ThrowOnError extends boolean = false>(parameters: { 241 + id: string; 242 + }, options?: Options<never, ThrowOnError>) => { 243 + const params = buildClientParams([ 244 + parameters 245 + ], [ 246 + { 247 + in: 'path', 248 + key: 'id' 249 + } 250 + ]); 251 + return (options?.client ?? client).post<SessionAbortResponses, unknown, ThrowOnError>({ 252 + url: '/session/{id}/abort', 253 + ...options, 254 + ...params 255 + }); 256 + }; 257 + 258 + /** 259 + * Unshare the session 260 + */ 261 + export const sessionUnshare = <ThrowOnError extends boolean = false>(parameters: { 262 + id: string; 263 + }, options?: Options<never, ThrowOnError>) => { 264 + const params = buildClientParams([ 265 + parameters 266 + ], [ 267 + { 268 + in: 'path', 269 + key: 'id' 270 + } 271 + ]); 272 + return (options?.client ?? client).delete<SessionUnshareResponses, unknown, ThrowOnError>({ 273 + url: '/session/{id}/share', 274 + ...options, 275 + ...params 276 + }); 277 + }; 278 + 279 + /** 280 + * Share a session 281 + */ 282 + export const sessionShare = <ThrowOnError extends boolean = false>(parameters: { 283 + id: string; 284 + }, options?: Options<never, ThrowOnError>) => { 285 + const params = buildClientParams([ 286 + parameters 287 + ], [ 288 + { 289 + in: 'path', 290 + key: 'id' 291 + } 292 + ]); 293 + return (options?.client ?? client).post<SessionShareResponses, unknown, ThrowOnError>({ 294 + url: '/session/{id}/share', 295 + ...options, 296 + ...params 297 + }); 298 + }; 299 + 300 + /** 301 + * Summarize the session 302 + */ 303 + export const sessionSummarize = <ThrowOnError extends boolean = false>(parameters: { 304 + id: string; 305 + providerID?: string; 306 + modelID?: string; 307 + }, options?: Options<never, ThrowOnError>) => { 308 + const params = buildClientParams([ 309 + parameters 310 + ], [ 311 + { 312 + in: 'path', 313 + key: 'id' 314 + }, 315 + { 316 + in: 'body', 317 + key: 'providerID' 318 + }, 319 + { 320 + in: 'body', 321 + key: 'modelID' 322 + } 323 + ]); 324 + return (options?.client ?? client).post<SessionSummarizeResponses, unknown, ThrowOnError>({ 325 + url: '/session/{id}/summarize', 326 + ...options, 327 + ...params, 328 + headers: { 329 + 'Content-Type': 'application/json', 330 + ...options?.headers, 331 + ...params.headers 332 + } 333 + }); 334 + }; 335 + 336 + /** 337 + * List messages for a session 338 + */ 339 + export const sessionMessages = <ThrowOnError extends boolean = false>(parameters: { 340 + id: string; 341 + }, options?: Options<never, ThrowOnError>) => { 342 + const params = buildClientParams([ 343 + parameters 344 + ], [ 345 + { 346 + in: 'path', 347 + key: 'id' 348 + } 349 + ]); 350 + return (options?.client ?? client).get<SessionMessagesResponses, unknown, ThrowOnError>({ 351 + url: '/session/{id}/message', 352 + ...options, 353 + ...params 354 + }); 355 + }; 356 + 357 + /** 358 + * Create and send a new message to a session 359 + */ 360 + export const sessionChat = <ThrowOnError extends boolean = false>(parameters: { 361 + id: string; 362 + messageID?: string; 363 + providerID?: string; 364 + modelID?: string; 365 + agent?: string; 366 + system?: string; 367 + tools?: { 368 + [key: string]: boolean; 369 + }; 370 + parts?: Array<({ 371 + type: 'text'; 372 + } & TextPartInput) | ({ 373 + type: 'file'; 374 + } & FilePartInput) | ({ 375 + type: 'agent'; 376 + } & AgentPartInput)>; 377 + }, options?: Options<never, ThrowOnError>) => { 378 + const params = buildClientParams([ 379 + parameters 380 + ], [ 381 + { 382 + in: 'path', 383 + key: 'id' 384 + }, 385 + { 386 + in: 'body', 387 + key: 'messageID' 388 + }, 389 + { 390 + in: 'body', 391 + key: 'providerID' 392 + }, 393 + { 394 + in: 'body', 395 + key: 'modelID' 396 + }, 397 + { 398 + in: 'body', 399 + key: 'agent' 400 + }, 401 + { 402 + in: 'body', 403 + key: 'system' 404 + }, 405 + { 406 + in: 'body', 407 + key: 'tools' 408 + }, 409 + { 410 + in: 'body', 411 + key: 'parts' 412 + } 413 + ]); 414 + return (options?.client ?? client).post<SessionChatResponses, unknown, ThrowOnError>({ 415 + url: '/session/{id}/message', 416 + ...options, 417 + ...params, 418 + headers: { 419 + 'Content-Type': 'application/json', 420 + ...options?.headers, 421 + ...params.headers 422 + } 423 + }); 424 + }; 425 + 426 + /** 427 + * Get a message from a session 428 + */ 429 + export const sessionMessage = <ThrowOnError extends boolean = false>(parameters: { 430 + id: string; 431 + messageID: string; 432 + }, options?: Options<never, ThrowOnError>) => { 433 + const params = buildClientParams([ 434 + parameters 435 + ], [ 436 + { 437 + in: 'path', 438 + key: 'id' 439 + }, 440 + { 441 + in: 'path', 442 + key: 'messageID' 443 + } 444 + ]); 445 + return (options?.client ?? client).get<SessionMessageResponses, unknown, ThrowOnError>({ 446 + url: '/session/{id}/message/{messageID}', 447 + ...options, 448 + ...params 449 + }); 450 + }; 451 + 452 + /** 453 + * Run a shell command 454 + */ 455 + export const sessionShell = <ThrowOnError extends boolean = false>(parameters: { 456 + id: string; 457 + agent?: string; 458 + command?: string; 459 + }, options?: Options<never, ThrowOnError>) => { 460 + const params = buildClientParams([ 461 + parameters 462 + ], [ 463 + { 464 + in: 'path', 465 + key: 'id' 466 + }, 467 + { 468 + in: 'body', 469 + key: 'agent' 470 + }, 471 + { 472 + in: 'body', 473 + key: 'command' 474 + } 475 + ]); 476 + return (options?.client ?? client).post<SessionShellResponses, unknown, ThrowOnError>({ 477 + url: '/session/{id}/shell', 478 + ...options, 479 + ...params, 480 + headers: { 481 + 'Content-Type': 'application/json', 482 + ...options?.headers, 483 + ...params.headers 484 + } 485 + }); 486 + }; 487 + 488 + /** 489 + * Revert a message 490 + */ 491 + export const sessionRevert = <ThrowOnError extends boolean = false>(parameters: { 492 + id: string; 493 + messageID?: string; 494 + partID?: string; 495 + }, options?: Options<never, ThrowOnError>) => { 496 + const params = buildClientParams([ 497 + parameters 498 + ], [ 499 + { 500 + in: 'path', 501 + key: 'id' 502 + }, 503 + { 504 + in: 'body', 505 + key: 'messageID' 506 + }, 507 + { 508 + in: 'body', 509 + key: 'partID' 510 + } 511 + ]); 512 + return (options?.client ?? client).post<SessionRevertResponses, unknown, ThrowOnError>({ 513 + url: '/session/{id}/revert', 514 + ...options, 515 + ...params, 516 + headers: { 517 + 'Content-Type': 'application/json', 518 + ...options?.headers, 519 + ...params.headers 520 + } 521 + }); 522 + }; 523 + 524 + /** 525 + * Restore all reverted messages 526 + */ 527 + export const sessionUnrevert = <ThrowOnError extends boolean = false>(parameters: { 528 + id: string; 529 + }, options?: Options<never, ThrowOnError>) => { 530 + const params = buildClientParams([ 531 + parameters 532 + ], [ 533 + { 534 + in: 'path', 535 + key: 'id' 536 + } 537 + ]); 538 + return (options?.client ?? client).post<SessionUnrevertResponses, unknown, ThrowOnError>({ 539 + url: '/session/{id}/unrevert', 540 + ...options, 541 + ...params 542 + }); 543 + }; 544 + 545 + /** 546 + * Respond to a permission request 547 + */ 548 + export const postSessionByIdPermissionsByPermissionId = <ThrowOnError extends boolean = false>(parameters: { 549 + id: string; 550 + permissionID: string; 551 + response?: 'once' | 'always' | 'reject'; 552 + }, options?: Options<never, ThrowOnError>) => { 553 + const params = buildClientParams([ 554 + parameters 555 + ], [ 556 + { 557 + in: 'path', 558 + key: 'id' 559 + }, 560 + { 561 + in: 'path', 562 + key: 'permissionID' 563 + }, 564 + { 565 + in: 'body', 566 + key: 'response' 567 + } 568 + ]); 569 + return (options?.client ?? client).post<PostSessionByIdPermissionsByPermissionIdResponses, unknown, ThrowOnError>({ 570 + url: '/session/{id}/permissions/{permissionID}', 571 + ...options, 572 + ...params, 573 + headers: { 574 + 'Content-Type': 'application/json', 575 + ...options?.headers, 576 + ...params.headers 577 + } 578 + }); 579 + }; 580 + 581 + /** 582 + * List all providers 583 + */ 584 + export const configProviders = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 585 + return (options?.client ?? client).get<ConfigProvidersResponses, unknown, ThrowOnError>({ 586 + url: '/config/providers', 587 + ...options 588 + }); 589 + }; 590 + 591 + /** 592 + * Find text in files 593 + */ 594 + export const findText = <ThrowOnError extends boolean = false>(parameters: { 595 + pattern: string; 596 + }, options?: Options<never, ThrowOnError>) => { 597 + const params = buildClientParams([ 598 + parameters 599 + ], [ 600 + { 601 + in: 'query', 602 + key: 'pattern' 603 + } 604 + ]); 605 + return (options?.client ?? client).get<FindTextResponses, unknown, ThrowOnError>({ 606 + url: '/find', 607 + ...options, 608 + ...params 609 + }); 610 + }; 611 + 612 + /** 613 + * Find files 614 + */ 615 + export const findFiles = <ThrowOnError extends boolean = false>(parameters: { 616 + query: string; 617 + }, options?: Options<never, ThrowOnError>) => { 618 + const params = buildClientParams([ 619 + parameters 620 + ], [ 621 + { 622 + in: 'query', 623 + key: 'query' 624 + } 625 + ]); 626 + return (options?.client ?? client).get<FindFilesResponses, unknown, ThrowOnError>({ 627 + url: '/find/file', 628 + ...options, 629 + ...params 630 + }); 631 + }; 632 + 633 + /** 634 + * Find workspace symbols 635 + */ 636 + export const findSymbols = <ThrowOnError extends boolean = false>(parameters: { 637 + query: string; 638 + }, options?: Options<never, ThrowOnError>) => { 639 + const params = buildClientParams([ 640 + parameters 641 + ], [ 642 + { 643 + in: 'query', 644 + key: 'query' 645 + } 646 + ]); 647 + return (options?.client ?? client).get<FindSymbolsResponses, unknown, ThrowOnError>({ 648 + url: '/find/symbol', 649 + ...options, 650 + ...params 651 + }); 652 + }; 653 + 654 + /** 655 + * Read a file 656 + */ 657 + export const fileRead = <ThrowOnError extends boolean = false>(parameters: { 658 + path: string; 659 + }, options?: Options<never, ThrowOnError>) => { 660 + const params = buildClientParams([ 661 + parameters 662 + ], [ 663 + { 664 + in: 'query', 665 + key: 'path' 666 + } 667 + ]); 668 + return (options?.client ?? client).get<FileReadResponses, unknown, ThrowOnError>({ 669 + url: '/file', 670 + ...options, 671 + ...params 672 + }); 673 + }; 674 + 675 + /** 676 + * Get file status 677 + */ 678 + export const fileStatus = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 679 + return (options?.client ?? client).get<FileStatusResponses, unknown, ThrowOnError>({ 680 + url: '/file/status', 681 + ...options 682 + }); 683 + }; 684 + 685 + /** 686 + * Write a log entry to the server logs 687 + */ 688 + export const appLog = <ThrowOnError extends boolean = false>(parameters?: { 689 + service?: string; 690 + level?: 'debug' | 'info' | 'error' | 'warn'; 691 + message?: string; 692 + extra?: { 693 + [key: string]: unknown; 694 + }; 695 + }, options?: Options<never, ThrowOnError>) => { 696 + const params = buildClientParams([ 697 + parameters 698 + ], [ 699 + { 700 + in: 'body', 701 + key: 'service' 702 + }, 703 + { 704 + in: 'body', 705 + key: 'level' 706 + }, 707 + { 708 + in: 'body', 709 + key: 'message' 710 + }, 711 + { 712 + in: 'body', 713 + key: 'extra' 714 + } 715 + ]); 716 + return (options?.client ?? client).post<AppLogResponses, unknown, ThrowOnError>({ 717 + url: '/log', 718 + ...options, 719 + ...params, 720 + headers: { 721 + 'Content-Type': 'application/json', 722 + ...options?.headers, 723 + ...params.headers 724 + } 725 + }); 726 + }; 727 + 728 + /** 729 + * List all agents 730 + */ 731 + export const appAgents = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 732 + return (options?.client ?? client).get<AppAgentsResponses, unknown, ThrowOnError>({ 733 + url: '/agent', 734 + ...options 735 + }); 736 + }; 737 + 738 + /** 739 + * Append prompt to the TUI 740 + */ 741 + export const tuiAppendPrompt = <ThrowOnError extends boolean = false>(parameters?: { 742 + text?: string; 743 + }, options?: Options<never, ThrowOnError>) => { 744 + const params = buildClientParams([ 745 + parameters 746 + ], [ 747 + { 748 + in: 'body', 749 + key: 'text' 750 + } 751 + ]); 752 + return (options?.client ?? client).post<TuiAppendPromptResponses, unknown, ThrowOnError>({ 753 + url: '/tui/append-prompt', 754 + ...options, 755 + ...params, 756 + headers: { 757 + 'Content-Type': 'application/json', 758 + ...options?.headers, 759 + ...params.headers 760 + } 761 + }); 762 + }; 763 + 764 + /** 765 + * Open the help dialog 766 + */ 767 + export const tuiOpenHelp = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 768 + return (options?.client ?? client).post<TuiOpenHelpResponses, unknown, ThrowOnError>({ 769 + url: '/tui/open-help', 770 + ...options 771 + }); 772 + }; 773 + 774 + /** 775 + * Open the session dialog 776 + */ 777 + export const tuiOpenSessions = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 778 + return (options?.client ?? client).post<TuiOpenSessionsResponses, unknown, ThrowOnError>({ 779 + url: '/tui/open-sessions', 780 + ...options 781 + }); 782 + }; 783 + 784 + /** 785 + * Open the theme dialog 786 + */ 787 + export const tuiOpenThemes = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 788 + return (options?.client ?? client).post<TuiOpenThemesResponses, unknown, ThrowOnError>({ 789 + url: '/tui/open-themes', 790 + ...options 791 + }); 792 + }; 793 + 794 + /** 795 + * Open the model dialog 796 + */ 797 + export const tuiOpenModels = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 798 + return (options?.client ?? client).post<TuiOpenModelsResponses, unknown, ThrowOnError>({ 799 + url: '/tui/open-models', 800 + ...options 801 + }); 802 + }; 803 + 804 + /** 805 + * Submit the prompt 806 + */ 807 + export const tuiSubmitPrompt = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 808 + return (options?.client ?? client).post<TuiSubmitPromptResponses, unknown, ThrowOnError>({ 809 + url: '/tui/submit-prompt', 810 + ...options 811 + }); 812 + }; 813 + 814 + /** 815 + * Clear the prompt 816 + */ 817 + export const tuiClearPrompt = <ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) => { 818 + return (options?.client ?? client).post<TuiClearPromptResponses, unknown, ThrowOnError>({ 819 + url: '/tui/clear-prompt', 820 + ...options 821 + }); 822 + }; 823 + 824 + /** 825 + * Execute a TUI command (e.g. agent_cycle) 826 + */ 827 + export const tuiExecuteCommand = <ThrowOnError extends boolean = false>(parameters?: { 828 + command?: string; 829 + }, options?: Options<never, ThrowOnError>) => { 830 + const params = buildClientParams([ 831 + parameters 832 + ], [ 833 + { 834 + in: 'body', 835 + key: 'command' 836 + } 837 + ]); 838 + return (options?.client ?? client).post<TuiExecuteCommandResponses, unknown, ThrowOnError>({ 839 + url: '/tui/execute-command', 840 + ...options, 841 + ...params, 842 + headers: { 843 + 'Content-Type': 'application/json', 844 + ...options?.headers, 845 + ...params.headers 846 + } 847 + }); 848 + }; 849 + 850 + /** 851 + * Show a toast notification in the TUI 852 + */ 853 + export const tuiShowToast = <ThrowOnError extends boolean = false>(parameters?: { 854 + title?: string; 855 + message?: string; 856 + variant?: 'info' | 'success' | 'warning' | 'error'; 857 + }, options?: Options<never, ThrowOnError>) => { 858 + const params = buildClientParams([ 859 + parameters 860 + ], [ 861 + { 862 + in: 'body', 863 + key: 'title' 864 + }, 865 + { 866 + in: 'body', 867 + key: 'message' 868 + }, 869 + { 870 + in: 'body', 871 + key: 'variant' 872 + } 873 + ]); 874 + return (options?.client ?? client).post<TuiShowToastResponses, unknown, ThrowOnError>({ 875 + url: '/tui/show-toast', 876 + ...options, 877 + ...params, 878 + headers: { 879 + 'Content-Type': 'application/json', 880 + ...options?.headers, 881 + ...params.headers 882 + } 883 + }); 884 + }; 885 + 886 + /** 887 + * Set authentication credentials 888 + */ 889 + export const authSet = <ThrowOnError extends boolean = false>(parameters: { 890 + id: string; 891 + auth?: Auth; 892 + }, options?: Options<never, ThrowOnError>) => { 893 + const params = buildClientParams([ 894 + parameters 895 + ], [ 896 + { 897 + in: 'path', 898 + key: 'id' 899 + }, 900 + {} 901 + ]); 902 + return (options?.client ?? client).put<AuthSetResponses, AuthSetErrors, ThrowOnError>({ 903 + url: '/auth/{id}', 904 + ...options, 905 + ...params, 906 + headers: { 907 + 'Content-Type': 'application/json', 908 + ...options?.headers, 909 + ...params.headers 910 + } 911 + }); 912 + };
+1943
packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type ClientOptions = { 4 + baseUrl: `${string}://${string}` | (string & {}); 5 + }; 6 + 7 + export type Event = ({ 8 + type: 'installation.updated'; 9 + } & EventInstallationUpdated) | ({ 10 + type: 'lsp.client.diagnostics'; 11 + } & EventLspClientDiagnostics) | ({ 12 + type: 'message.updated'; 13 + } & EventMessageUpdated) | ({ 14 + type: 'message.removed'; 15 + } & EventMessageRemoved) | ({ 16 + type: 'message.part.updated'; 17 + } & EventMessagePartUpdated) | ({ 18 + type: 'message.part.removed'; 19 + } & EventMessagePartRemoved) | ({ 20 + type: 'storage.write'; 21 + } & EventStorageWrite) | ({ 22 + type: 'permission.updated'; 23 + } & EventPermissionUpdated) | ({ 24 + type: 'permission.replied'; 25 + } & EventPermissionReplied) | ({ 26 + type: 'file.edited'; 27 + } & EventFileEdited) | ({ 28 + type: 'session.updated'; 29 + } & EventSessionUpdated) | ({ 30 + type: 'session.deleted'; 31 + } & EventSessionDeleted) | ({ 32 + type: 'session.idle'; 33 + } & EventSessionIdle) | ({ 34 + type: 'session.error'; 35 + } & EventSessionError) | ({ 36 + type: 'server.connected'; 37 + } & EventServerConnected) | ({ 38 + type: 'file.watcher.updated'; 39 + } & EventFileWatcherUpdated) | ({ 40 + type: 'ide.installed'; 41 + } & EventIdeInstalled); 42 + 43 + export type EventInstallationUpdated = { 44 + type: 'installation.updated'; 45 + properties: { 46 + version: string; 47 + }; 48 + }; 49 + 50 + export type EventLspClientDiagnostics = { 51 + type: 'lsp.client.diagnostics'; 52 + properties: { 53 + serverID: string; 54 + path: string; 55 + }; 56 + }; 57 + 58 + export type EventMessageUpdated = { 59 + type: 'message.updated'; 60 + properties: { 61 + info: Message; 62 + }; 63 + }; 64 + 65 + export type Message = ({ 66 + role: 'user'; 67 + } & UserMessage) | ({ 68 + role: 'assistant'; 69 + } & AssistantMessage); 70 + 71 + export type UserMessage = { 72 + id: string; 73 + sessionID: string; 74 + role: 'user'; 75 + time: { 76 + created: number; 77 + }; 78 + }; 79 + 80 + export type AssistantMessage = { 81 + id: string; 82 + sessionID: string; 83 + role: 'assistant'; 84 + time: { 85 + created: number; 86 + completed?: number; 87 + }; 88 + error?: ({ 89 + name: 'ProviderAuthError'; 90 + } & ProviderAuthError) | ({ 91 + name: 'UnknownError'; 92 + } & UnknownError) | ({ 93 + name: 'MessageOutputLengthError'; 94 + } & MessageOutputLengthError) | ({ 95 + name: 'MessageAbortedError'; 96 + } & MessageAbortedError); 97 + system: Array<string>; 98 + modelID: string; 99 + providerID: string; 100 + mode: string; 101 + path: { 102 + cwd: string; 103 + root: string; 104 + }; 105 + summary?: boolean; 106 + cost: number; 107 + tokens: { 108 + input: number; 109 + output: number; 110 + reasoning: number; 111 + cache: { 112 + read: number; 113 + write: number; 114 + }; 115 + }; 116 + }; 117 + 118 + export type ProviderAuthError = { 119 + name: 'ProviderAuthError'; 120 + data: { 121 + providerID: string; 122 + message: string; 123 + }; 124 + }; 125 + 126 + export type UnknownError = { 127 + name: 'UnknownError'; 128 + data: { 129 + message: string; 130 + }; 131 + }; 132 + 133 + export type MessageOutputLengthError = { 134 + name: 'MessageOutputLengthError'; 135 + data: { 136 + [key: string]: unknown; 137 + }; 138 + }; 139 + 140 + export type MessageAbortedError = { 141 + name: 'MessageAbortedError'; 142 + data: { 143 + [key: string]: unknown; 144 + }; 145 + }; 146 + 147 + export type EventMessageRemoved = { 148 + type: 'message.removed'; 149 + properties: { 150 + sessionID: string; 151 + messageID: string; 152 + }; 153 + }; 154 + 155 + export type EventMessagePartUpdated = { 156 + type: 'message.part.updated'; 157 + properties: { 158 + part: Part; 159 + }; 160 + }; 161 + 162 + export type Part = ({ 163 + type: 'text'; 164 + } & TextPart) | ({ 165 + type: 'reasoning'; 166 + } & ReasoningPart) | ({ 167 + type: 'file'; 168 + } & FilePart) | ({ 169 + type: 'tool'; 170 + } & ToolPart) | ({ 171 + type: 'step-start'; 172 + } & StepStartPart) | ({ 173 + type: 'step-finish'; 174 + } & StepFinishPart) | ({ 175 + type: 'snapshot'; 176 + } & SnapshotPart) | ({ 177 + type: 'patch'; 178 + } & PatchPart) | ({ 179 + type: 'agent'; 180 + } & AgentPart); 181 + 182 + export type TextPart = { 183 + id: string; 184 + sessionID: string; 185 + messageID: string; 186 + type: 'text'; 187 + text: string; 188 + synthetic?: boolean; 189 + time?: { 190 + start: number; 191 + end?: number; 192 + }; 193 + }; 194 + 195 + export type ReasoningPart = { 196 + id: string; 197 + sessionID: string; 198 + messageID: string; 199 + type: 'reasoning'; 200 + text: string; 201 + metadata?: { 202 + [key: string]: unknown; 203 + }; 204 + time: { 205 + start: number; 206 + end?: number; 207 + }; 208 + }; 209 + 210 + export type FilePart = { 211 + id: string; 212 + sessionID: string; 213 + messageID: string; 214 + type: 'file'; 215 + mime: string; 216 + filename?: string; 217 + url: string; 218 + source?: FilePartSource; 219 + }; 220 + 221 + export type FilePartSource = ({ 222 + type: 'file'; 223 + } & FileSource) | ({ 224 + type: 'symbol'; 225 + } & SymbolSource); 226 + 227 + export type FileSource = { 228 + text: FilePartSourceText; 229 + type: 'file'; 230 + path: string; 231 + }; 232 + 233 + export type FilePartSourceText = { 234 + value: string; 235 + start: number; 236 + end: number; 237 + }; 238 + 239 + export type SymbolSource = { 240 + text: FilePartSourceText; 241 + type: 'symbol'; 242 + path: string; 243 + range: Range; 244 + name: string; 245 + kind: number; 246 + }; 247 + 248 + export type Range = { 249 + start: { 250 + line: number; 251 + character: number; 252 + }; 253 + end: { 254 + line: number; 255 + character: number; 256 + }; 257 + }; 258 + 259 + export type ToolPart = { 260 + id: string; 261 + sessionID: string; 262 + messageID: string; 263 + type: 'tool'; 264 + callID: string; 265 + tool: string; 266 + state: ToolState; 267 + }; 268 + 269 + export type ToolState = ({ 270 + status: 'pending'; 271 + } & ToolStatePending) | ({ 272 + status: 'running'; 273 + } & ToolStateRunning) | ({ 274 + status: 'completed'; 275 + } & ToolStateCompleted) | ({ 276 + status: 'error'; 277 + } & ToolStateError); 278 + 279 + export type ToolStatePending = { 280 + status: 'pending'; 281 + }; 282 + 283 + export type ToolStateRunning = { 284 + status: 'running'; 285 + input?: unknown; 286 + title?: string; 287 + metadata?: { 288 + [key: string]: unknown; 289 + }; 290 + time: { 291 + start: number; 292 + }; 293 + }; 294 + 295 + export type ToolStateCompleted = { 296 + status: 'completed'; 297 + input: { 298 + [key: string]: unknown; 299 + }; 300 + output: string; 301 + title: string; 302 + metadata: { 303 + [key: string]: unknown; 304 + }; 305 + time: { 306 + start: number; 307 + end: number; 308 + }; 309 + }; 310 + 311 + export type ToolStateError = { 312 + status: 'error'; 313 + input: { 314 + [key: string]: unknown; 315 + }; 316 + error: string; 317 + metadata?: { 318 + [key: string]: unknown; 319 + }; 320 + time: { 321 + start: number; 322 + end: number; 323 + }; 324 + }; 325 + 326 + export type StepStartPart = { 327 + id: string; 328 + sessionID: string; 329 + messageID: string; 330 + type: 'step-start'; 331 + }; 332 + 333 + export type StepFinishPart = { 334 + id: string; 335 + sessionID: string; 336 + messageID: string; 337 + type: 'step-finish'; 338 + cost: number; 339 + tokens: { 340 + input: number; 341 + output: number; 342 + reasoning: number; 343 + cache: { 344 + read: number; 345 + write: number; 346 + }; 347 + }; 348 + }; 349 + 350 + export type SnapshotPart = { 351 + id: string; 352 + sessionID: string; 353 + messageID: string; 354 + type: 'snapshot'; 355 + snapshot: string; 356 + }; 357 + 358 + export type PatchPart = { 359 + id: string; 360 + sessionID: string; 361 + messageID: string; 362 + type: 'patch'; 363 + hash: string; 364 + files: Array<string>; 365 + }; 366 + 367 + export type AgentPart = { 368 + id: string; 369 + sessionID: string; 370 + messageID: string; 371 + type: 'agent'; 372 + name: string; 373 + source?: { 374 + value: string; 375 + start: number; 376 + end: number; 377 + }; 378 + }; 379 + 380 + export type EventMessagePartRemoved = { 381 + type: 'message.part.removed'; 382 + properties: { 383 + sessionID: string; 384 + messageID: string; 385 + partID: string; 386 + }; 387 + }; 388 + 389 + export type EventStorageWrite = { 390 + type: 'storage.write'; 391 + properties: { 392 + key: string; 393 + content?: unknown; 394 + }; 395 + }; 396 + 397 + export type EventPermissionUpdated = { 398 + type: 'permission.updated'; 399 + properties: Permission; 400 + }; 401 + 402 + export type Permission = { 403 + id: string; 404 + type: string; 405 + pattern?: string; 406 + sessionID: string; 407 + messageID: string; 408 + callID?: string; 409 + title: string; 410 + metadata: { 411 + [key: string]: unknown; 412 + }; 413 + time: { 414 + created: number; 415 + }; 416 + }; 417 + 418 + export type EventPermissionReplied = { 419 + type: 'permission.replied'; 420 + properties: { 421 + sessionID: string; 422 + permissionID: string; 423 + response: string; 424 + }; 425 + }; 426 + 427 + export type EventFileEdited = { 428 + type: 'file.edited'; 429 + properties: { 430 + file: string; 431 + }; 432 + }; 433 + 434 + export type EventSessionUpdated = { 435 + type: 'session.updated'; 436 + properties: { 437 + info: Session; 438 + }; 439 + }; 440 + 441 + export type Session = { 442 + id: string; 443 + parentID?: string; 444 + share?: { 445 + url: string; 446 + }; 447 + title: string; 448 + version: string; 449 + time: { 450 + created: number; 451 + updated: number; 452 + }; 453 + revert?: { 454 + messageID: string; 455 + partID?: string; 456 + snapshot?: string; 457 + diff?: string; 458 + }; 459 + }; 460 + 461 + export type EventSessionDeleted = { 462 + type: 'session.deleted'; 463 + properties: { 464 + info: Session; 465 + }; 466 + }; 467 + 468 + export type EventSessionIdle = { 469 + type: 'session.idle'; 470 + properties: { 471 + sessionID: string; 472 + }; 473 + }; 474 + 475 + export type EventSessionError = { 476 + type: 'session.error'; 477 + properties: { 478 + sessionID?: string; 479 + error?: ({ 480 + name: 'ProviderAuthError'; 481 + } & ProviderAuthError) | ({ 482 + name: 'UnknownError'; 483 + } & UnknownError) | ({ 484 + name: 'MessageOutputLengthError'; 485 + } & MessageOutputLengthError) | ({ 486 + name: 'MessageAbortedError'; 487 + } & MessageAbortedError); 488 + }; 489 + }; 490 + 491 + export type EventServerConnected = { 492 + type: 'server.connected'; 493 + properties: { 494 + [key: string]: unknown; 495 + }; 496 + }; 497 + 498 + export type EventFileWatcherUpdated = { 499 + type: 'file.watcher.updated'; 500 + properties: { 501 + file: string; 502 + event: 'rename' | 'change'; 503 + }; 504 + }; 505 + 506 + export type EventIdeInstalled = { 507 + type: 'ide.installed'; 508 + properties: { 509 + ide: string; 510 + }; 511 + }; 512 + 513 + export type App = { 514 + hostname: string; 515 + git: boolean; 516 + path: { 517 + config: string; 518 + data: string; 519 + root: string; 520 + cwd: string; 521 + state: string; 522 + }; 523 + time: { 524 + initialized?: number; 525 + }; 526 + }; 527 + 528 + export type Config = { 529 + /** 530 + * JSON schema reference for configuration validation 531 + */ 532 + $schema?: string; 533 + /** 534 + * Theme name to use for the interface 535 + */ 536 + theme?: string; 537 + /** 538 + * Custom keybind configurations 539 + */ 540 + keybinds?: KeybindsConfig; 541 + /** 542 + * TUI specific settings 543 + */ 544 + tui?: { 545 + /** 546 + * TUI scroll speed 547 + */ 548 + scroll_speed: number; 549 + }; 550 + plugin?: Array<string>; 551 + snapshot?: boolean; 552 + /** 553 + * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing 554 + */ 555 + share?: 'manual' | 'auto' | 'disabled'; 556 + /** 557 + * @deprecated Use 'share' field instead. Share newly created sessions automatically 558 + */ 559 + autoshare?: boolean; 560 + /** 561 + * Automatically update to the latest version 562 + */ 563 + autoupdate?: boolean; 564 + /** 565 + * Disable providers that are loaded automatically 566 + */ 567 + disabled_providers?: Array<string>; 568 + /** 569 + * Model to use in the format of provider/model, eg anthropic/claude-2 570 + */ 571 + model?: string; 572 + /** 573 + * Small model to use for tasks like title generation in the format of provider/model 574 + */ 575 + small_model?: string; 576 + /** 577 + * Custom username to display in conversations instead of system username 578 + */ 579 + username?: string; 580 + /** 581 + * @deprecated Use `agent` field instead. 582 + */ 583 + mode?: { 584 + build?: AgentConfig; 585 + plan?: AgentConfig; 586 + [key: string]: AgentConfig | undefined; 587 + }; 588 + /** 589 + * Agent configuration, see https://opencode.ai/docs/agent 590 + */ 591 + agent?: { 592 + plan?: AgentConfig; 593 + build?: AgentConfig; 594 + general?: AgentConfig; 595 + [key: string]: AgentConfig | undefined; 596 + }; 597 + /** 598 + * Custom provider configurations and model overrides 599 + */ 600 + provider?: { 601 + [key: string]: { 602 + api?: string; 603 + name?: string; 604 + env?: Array<string>; 605 + id?: string; 606 + npm?: string; 607 + models?: { 608 + [key: string]: { 609 + id?: string; 610 + name?: string; 611 + release_date?: string; 612 + attachment?: boolean; 613 + reasoning?: boolean; 614 + temperature?: boolean; 615 + tool_call?: boolean; 616 + cost?: { 617 + input: number; 618 + output: number; 619 + cache_read?: number; 620 + cache_write?: number; 621 + }; 622 + limit?: { 623 + context: number; 624 + output: number; 625 + }; 626 + options?: { 627 + [key: string]: unknown; 628 + }; 629 + }; 630 + }; 631 + options?: { 632 + apiKey?: string; 633 + baseURL?: string; 634 + [key: string]: unknown | string | undefined; 635 + }; 636 + }; 637 + }; 638 + /** 639 + * MCP (Model Context Protocol) server configurations 640 + */ 641 + mcp?: { 642 + [key: string]: ({ 643 + type: 'local'; 644 + } & McpLocalConfig) | ({ 645 + type: 'remote'; 646 + } & McpRemoteConfig); 647 + }; 648 + formatter?: { 649 + [key: string]: { 650 + disabled?: boolean; 651 + command?: Array<string>; 652 + environment?: { 653 + [key: string]: string; 654 + }; 655 + extensions?: Array<string>; 656 + }; 657 + }; 658 + lsp?: { 659 + [key: string]: { 660 + disabled: true; 661 + } | { 662 + command: Array<string>; 663 + extensions?: Array<string>; 664 + disabled?: boolean; 665 + env?: { 666 + [key: string]: string; 667 + }; 668 + initialization?: { 669 + [key: string]: unknown; 670 + }; 671 + }; 672 + }; 673 + /** 674 + * Additional instruction files or patterns to include 675 + */ 676 + instructions?: Array<string>; 677 + /** 678 + * @deprecated Always uses stretch layout. 679 + */ 680 + layout?: LayoutConfig; 681 + permission?: { 682 + edit?: 'ask' | 'allow' | 'deny'; 683 + bash?: 'ask' | 'allow' | 'deny' | { 684 + [key: string]: 'ask' | 'allow' | 'deny'; 685 + }; 686 + webfetch?: 'ask' | 'allow' | 'deny'; 687 + }; 688 + tools?: { 689 + [key: string]: boolean; 690 + }; 691 + experimental?: { 692 + hook?: { 693 + file_edited?: { 694 + [key: string]: Array<{ 695 + command: Array<string>; 696 + environment?: { 697 + [key: string]: string; 698 + }; 699 + }>; 700 + }; 701 + session_completed?: Array<{ 702 + command: Array<string>; 703 + environment?: { 704 + [key: string]: string; 705 + }; 706 + }>; 707 + }; 708 + }; 709 + }; 710 + 711 + export type KeybindsConfig = { 712 + /** 713 + * Leader key for keybind combinations 714 + */ 715 + leader: string; 716 + /** 717 + * Show help dialog 718 + */ 719 + app_help: string; 720 + /** 721 + * Exit the application 722 + */ 723 + app_exit: string; 724 + /** 725 + * Open external editor 726 + */ 727 + editor_open: string; 728 + /** 729 + * List available themes 730 + */ 731 + theme_list: string; 732 + /** 733 + * Create/update AGENTS.md 734 + */ 735 + project_init: string; 736 + /** 737 + * Toggle tool details 738 + */ 739 + tool_details: string; 740 + /** 741 + * Toggle thinking blocks 742 + */ 743 + thinking_blocks: string; 744 + /** 745 + * Export session to editor 746 + */ 747 + session_export: string; 748 + /** 749 + * Create a new session 750 + */ 751 + session_new: string; 752 + /** 753 + * List all sessions 754 + */ 755 + session_list: string; 756 + /** 757 + * Show session timeline 758 + */ 759 + session_timeline: string; 760 + /** 761 + * Share current session 762 + */ 763 + session_share: string; 764 + /** 765 + * Unshare current session 766 + */ 767 + session_unshare: string; 768 + /** 769 + * Interrupt current session 770 + */ 771 + session_interrupt: string; 772 + /** 773 + * Compact the session 774 + */ 775 + session_compact: string; 776 + /** 777 + * Cycle to next child session 778 + */ 779 + session_child_cycle: string; 780 + /** 781 + * Cycle to previous child session 782 + */ 783 + session_child_cycle_reverse: string; 784 + /** 785 + * Scroll messages up by one page 786 + */ 787 + messages_page_up: string; 788 + /** 789 + * Scroll messages down by one page 790 + */ 791 + messages_page_down: string; 792 + /** 793 + * Scroll messages up by half page 794 + */ 795 + messages_half_page_up: string; 796 + /** 797 + * Scroll messages down by half page 798 + */ 799 + messages_half_page_down: string; 800 + /** 801 + * Navigate to first message 802 + */ 803 + messages_first: string; 804 + /** 805 + * Navigate to last message 806 + */ 807 + messages_last: string; 808 + /** 809 + * Copy message 810 + */ 811 + messages_copy: string; 812 + /** 813 + * Undo message 814 + */ 815 + messages_undo: string; 816 + /** 817 + * Redo message 818 + */ 819 + messages_redo: string; 820 + /** 821 + * List available models 822 + */ 823 + model_list: string; 824 + /** 825 + * Next recent model 826 + */ 827 + model_cycle_recent: string; 828 + /** 829 + * Previous recent model 830 + */ 831 + model_cycle_recent_reverse: string; 832 + /** 833 + * List agents 834 + */ 835 + agent_list: string; 836 + /** 837 + * Next agent 838 + */ 839 + agent_cycle: string; 840 + /** 841 + * Previous agent 842 + */ 843 + agent_cycle_reverse: string; 844 + /** 845 + * Clear input field 846 + */ 847 + input_clear: string; 848 + /** 849 + * Paste from clipboard 850 + */ 851 + input_paste: string; 852 + /** 853 + * Submit input 854 + */ 855 + input_submit: string; 856 + /** 857 + * Insert newline in input 858 + */ 859 + input_newline: string; 860 + /** 861 + * @deprecated use agent_cycle. Next mode 862 + */ 863 + switch_mode: string; 864 + /** 865 + * @deprecated use agent_cycle_reverse. Previous mode 866 + */ 867 + switch_mode_reverse: string; 868 + /** 869 + * @deprecated use agent_cycle. Next agent 870 + */ 871 + switch_agent: string; 872 + /** 873 + * @deprecated use agent_cycle_reverse. Previous agent 874 + */ 875 + switch_agent_reverse: string; 876 + /** 877 + * @deprecated Currently not available. List files 878 + */ 879 + file_list: string; 880 + /** 881 + * @deprecated Close file 882 + */ 883 + file_close: string; 884 + /** 885 + * @deprecated Search file 886 + */ 887 + file_search: string; 888 + /** 889 + * @deprecated Split/unified diff 890 + */ 891 + file_diff_toggle: string; 892 + /** 893 + * @deprecated Navigate to previous message 894 + */ 895 + messages_previous: string; 896 + /** 897 + * @deprecated Navigate to next message 898 + */ 899 + messages_next: string; 900 + /** 901 + * @deprecated Toggle layout 902 + */ 903 + messages_layout_toggle: string; 904 + /** 905 + * @deprecated use messages_undo. Revert message 906 + */ 907 + messages_revert: string; 908 + }; 909 + 910 + export type AgentConfig = { 911 + model?: string; 912 + temperature?: number; 913 + top_p?: number; 914 + prompt?: string; 915 + tools?: { 916 + [key: string]: boolean; 917 + }; 918 + disable?: boolean; 919 + /** 920 + * Description of when to use the agent 921 + */ 922 + description?: string; 923 + mode?: 'subagent' | 'primary' | 'all'; 924 + permission?: { 925 + edit?: 'ask' | 'allow' | 'deny'; 926 + bash?: 'ask' | 'allow' | 'deny' | { 927 + [key: string]: 'ask' | 'allow' | 'deny'; 928 + }; 929 + webfetch?: 'ask' | 'allow' | 'deny'; 930 + }; 931 + [key: string]: unknown | string | number | { 932 + [key: string]: boolean; 933 + } | boolean | 'subagent' | 'primary' | 'all' | { 934 + edit?: 'ask' | 'allow' | 'deny'; 935 + bash?: 'ask' | 'allow' | 'deny' | { 936 + [key: string]: 'ask' | 'allow' | 'deny'; 937 + }; 938 + webfetch?: 'ask' | 'allow' | 'deny'; 939 + } | undefined; 940 + }; 941 + 942 + export type Provider = { 943 + api?: string; 944 + name: string; 945 + env: Array<string>; 946 + id: string; 947 + npm?: string; 948 + models: { 949 + [key: string]: Model; 950 + }; 951 + }; 952 + 953 + export type Model = { 954 + id: string; 955 + name: string; 956 + release_date: string; 957 + attachment: boolean; 958 + reasoning: boolean; 959 + temperature: boolean; 960 + tool_call: boolean; 961 + cost: { 962 + input: number; 963 + output: number; 964 + cache_read?: number; 965 + cache_write?: number; 966 + }; 967 + limit: { 968 + context: number; 969 + output: number; 970 + }; 971 + options: { 972 + [key: string]: unknown; 973 + }; 974 + }; 975 + 976 + export type McpLocalConfig = { 977 + /** 978 + * Type of MCP server connection 979 + */ 980 + type: 'local'; 981 + /** 982 + * Command and arguments to run the MCP server 983 + */ 984 + command: Array<string>; 985 + /** 986 + * Environment variables to set when running the MCP server 987 + */ 988 + environment?: { 989 + [key: string]: string; 990 + }; 991 + /** 992 + * Enable or disable the MCP server on startup 993 + */ 994 + enabled?: boolean; 995 + }; 996 + 997 + export type McpRemoteConfig = { 998 + /** 999 + * Type of MCP server connection 1000 + */ 1001 + type: 'remote'; 1002 + /** 1003 + * URL of the remote MCP server 1004 + */ 1005 + url: string; 1006 + /** 1007 + * Enable or disable the MCP server on startup 1008 + */ 1009 + enabled?: boolean; 1010 + /** 1011 + * Headers to send with the request 1012 + */ 1013 + headers?: { 1014 + [key: string]: string; 1015 + }; 1016 + }; 1017 + 1018 + export type LayoutConfig = 'auto' | 'stretch'; 1019 + 1020 + export type _Error = { 1021 + data: { 1022 + [key: string]: unknown; 1023 + }; 1024 + }; 1025 + 1026 + export type TextPartInput = { 1027 + id?: string; 1028 + type: 'text'; 1029 + text: string; 1030 + synthetic?: boolean; 1031 + time?: { 1032 + start: number; 1033 + end?: number; 1034 + }; 1035 + }; 1036 + 1037 + export type FilePartInput = { 1038 + id?: string; 1039 + type: 'file'; 1040 + mime: string; 1041 + filename?: string; 1042 + url: string; 1043 + source?: FilePartSource; 1044 + }; 1045 + 1046 + export type AgentPartInput = { 1047 + id?: string; 1048 + type: 'agent'; 1049 + name: string; 1050 + source?: { 1051 + value: string; 1052 + start: number; 1053 + end: number; 1054 + }; 1055 + }; 1056 + 1057 + export type Symbol = { 1058 + name: string; 1059 + kind: number; 1060 + location: { 1061 + uri: string; 1062 + range: Range; 1063 + }; 1064 + }; 1065 + 1066 + export type File = { 1067 + path: string; 1068 + added: number; 1069 + removed: number; 1070 + status: 'added' | 'deleted' | 'modified'; 1071 + }; 1072 + 1073 + export type Agent = { 1074 + name: string; 1075 + description?: string; 1076 + mode: 'subagent' | 'primary' | 'all'; 1077 + builtIn: boolean; 1078 + topP?: number; 1079 + temperature?: number; 1080 + permission: { 1081 + edit: 'ask' | 'allow' | 'deny'; 1082 + bash: { 1083 + [key: string]: 'ask' | 'allow' | 'deny'; 1084 + }; 1085 + webfetch?: 'ask' | 'allow' | 'deny'; 1086 + }; 1087 + model?: { 1088 + modelID: string; 1089 + providerID: string; 1090 + }; 1091 + prompt?: string; 1092 + tools: { 1093 + [key: string]: boolean; 1094 + }; 1095 + options: { 1096 + [key: string]: unknown; 1097 + }; 1098 + }; 1099 + 1100 + export type Auth = ({ 1101 + type: 'oauth'; 1102 + } & OAuth) | ({ 1103 + type: 'api'; 1104 + } & ApiAuth) | ({ 1105 + type: 'wellknown'; 1106 + } & WellKnownAuth); 1107 + 1108 + export type OAuth = { 1109 + type: 'oauth'; 1110 + refresh: string; 1111 + access: string; 1112 + expires: number; 1113 + }; 1114 + 1115 + export type ApiAuth = { 1116 + type: 'api'; 1117 + key: string; 1118 + }; 1119 + 1120 + export type WellKnownAuth = { 1121 + type: 'wellknown'; 1122 + key: string; 1123 + token: string; 1124 + }; 1125 + 1126 + export type EventSubscribeData = { 1127 + body?: never; 1128 + path?: never; 1129 + query?: never; 1130 + url: '/event'; 1131 + }; 1132 + 1133 + export type EventSubscribeResponses = { 1134 + /** 1135 + * Event stream 1136 + */ 1137 + 200: Event; 1138 + }; 1139 + 1140 + export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses]; 1141 + 1142 + export type AppGetData = { 1143 + body?: never; 1144 + path?: never; 1145 + query?: never; 1146 + url: '/app'; 1147 + }; 1148 + 1149 + export type AppGetResponses = { 1150 + /** 1151 + * 200 1152 + */ 1153 + 200: App; 1154 + }; 1155 + 1156 + export type AppGetResponse = AppGetResponses[keyof AppGetResponses]; 1157 + 1158 + export type AppInitData = { 1159 + body?: never; 1160 + path?: never; 1161 + query?: never; 1162 + url: '/app/init'; 1163 + }; 1164 + 1165 + export type AppInitResponses = { 1166 + /** 1167 + * Initialize the app 1168 + */ 1169 + 200: boolean; 1170 + }; 1171 + 1172 + export type AppInitResponse = AppInitResponses[keyof AppInitResponses]; 1173 + 1174 + export type ConfigGetData = { 1175 + body?: never; 1176 + path?: never; 1177 + query?: never; 1178 + url: '/config'; 1179 + }; 1180 + 1181 + export type ConfigGetResponses = { 1182 + /** 1183 + * Get config info 1184 + */ 1185 + 200: Config; 1186 + }; 1187 + 1188 + export type ConfigGetResponse = ConfigGetResponses[keyof ConfigGetResponses]; 1189 + 1190 + export type SessionListData = { 1191 + body?: never; 1192 + path?: never; 1193 + query?: never; 1194 + url: '/session'; 1195 + }; 1196 + 1197 + export type SessionListResponses = { 1198 + /** 1199 + * List of sessions 1200 + */ 1201 + 200: Array<Session>; 1202 + }; 1203 + 1204 + export type SessionListResponse = SessionListResponses[keyof SessionListResponses]; 1205 + 1206 + export type SessionCreateData = { 1207 + body?: { 1208 + parentID?: string; 1209 + title?: string; 1210 + }; 1211 + path?: never; 1212 + query?: never; 1213 + url: '/session'; 1214 + }; 1215 + 1216 + export type SessionCreateErrors = { 1217 + /** 1218 + * Bad request 1219 + */ 1220 + 400: _Error; 1221 + }; 1222 + 1223 + export type SessionCreateError = SessionCreateErrors[keyof SessionCreateErrors]; 1224 + 1225 + export type SessionCreateResponses = { 1226 + /** 1227 + * Successfully created session 1228 + */ 1229 + 200: Session; 1230 + }; 1231 + 1232 + export type SessionCreateResponse = SessionCreateResponses[keyof SessionCreateResponses]; 1233 + 1234 + export type SessionDeleteData = { 1235 + body?: never; 1236 + path: { 1237 + id: string; 1238 + }; 1239 + query?: never; 1240 + url: '/session/{id}'; 1241 + }; 1242 + 1243 + export type SessionDeleteResponses = { 1244 + /** 1245 + * Successfully deleted session 1246 + */ 1247 + 200: boolean; 1248 + }; 1249 + 1250 + export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses]; 1251 + 1252 + export type SessionGetData = { 1253 + body?: never; 1254 + path: { 1255 + id: string; 1256 + }; 1257 + query?: never; 1258 + url: '/session/{id}'; 1259 + }; 1260 + 1261 + export type SessionGetResponses = { 1262 + /** 1263 + * Get session 1264 + */ 1265 + 200: Session; 1266 + }; 1267 + 1268 + export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses]; 1269 + 1270 + export type SessionUpdateData = { 1271 + body?: { 1272 + title?: string; 1273 + }; 1274 + path: { 1275 + id: string; 1276 + }; 1277 + query?: never; 1278 + url: '/session/{id}'; 1279 + }; 1280 + 1281 + export type SessionUpdateResponses = { 1282 + /** 1283 + * Successfully updated session 1284 + */ 1285 + 200: Session; 1286 + }; 1287 + 1288 + export type SessionUpdateResponse = SessionUpdateResponses[keyof SessionUpdateResponses]; 1289 + 1290 + export type SessionChildrenData = { 1291 + body?: never; 1292 + path: { 1293 + id: string; 1294 + }; 1295 + query?: never; 1296 + url: '/session/{id}/children'; 1297 + }; 1298 + 1299 + export type SessionChildrenResponses = { 1300 + /** 1301 + * List of children 1302 + */ 1303 + 200: Array<Session>; 1304 + }; 1305 + 1306 + export type SessionChildrenResponse = SessionChildrenResponses[keyof SessionChildrenResponses]; 1307 + 1308 + export type SessionInitData = { 1309 + body?: { 1310 + messageID: string; 1311 + providerID: string; 1312 + modelID: string; 1313 + }; 1314 + path: { 1315 + /** 1316 + * Session ID 1317 + */ 1318 + id: string; 1319 + }; 1320 + query?: never; 1321 + url: '/session/{id}/init'; 1322 + }; 1323 + 1324 + export type SessionInitResponses = { 1325 + /** 1326 + * 200 1327 + */ 1328 + 200: boolean; 1329 + }; 1330 + 1331 + export type SessionInitResponse = SessionInitResponses[keyof SessionInitResponses]; 1332 + 1333 + export type SessionAbortData = { 1334 + body?: never; 1335 + path: { 1336 + id: string; 1337 + }; 1338 + query?: never; 1339 + url: '/session/{id}/abort'; 1340 + }; 1341 + 1342 + export type SessionAbortResponses = { 1343 + /** 1344 + * Aborted session 1345 + */ 1346 + 200: boolean; 1347 + }; 1348 + 1349 + export type SessionAbortResponse = SessionAbortResponses[keyof SessionAbortResponses]; 1350 + 1351 + export type SessionUnshareData = { 1352 + body?: never; 1353 + path: { 1354 + id: string; 1355 + }; 1356 + query?: never; 1357 + url: '/session/{id}/share'; 1358 + }; 1359 + 1360 + export type SessionUnshareResponses = { 1361 + /** 1362 + * Successfully unshared session 1363 + */ 1364 + 200: Session; 1365 + }; 1366 + 1367 + export type SessionUnshareResponse = SessionUnshareResponses[keyof SessionUnshareResponses]; 1368 + 1369 + export type SessionShareData = { 1370 + body?: never; 1371 + path: { 1372 + id: string; 1373 + }; 1374 + query?: never; 1375 + url: '/session/{id}/share'; 1376 + }; 1377 + 1378 + export type SessionShareResponses = { 1379 + /** 1380 + * Successfully shared session 1381 + */ 1382 + 200: Session; 1383 + }; 1384 + 1385 + export type SessionShareResponse = SessionShareResponses[keyof SessionShareResponses]; 1386 + 1387 + export type SessionSummarizeData = { 1388 + body?: { 1389 + providerID: string; 1390 + modelID: string; 1391 + }; 1392 + path: { 1393 + /** 1394 + * Session ID 1395 + */ 1396 + id: string; 1397 + }; 1398 + query?: never; 1399 + url: '/session/{id}/summarize'; 1400 + }; 1401 + 1402 + export type SessionSummarizeResponses = { 1403 + /** 1404 + * Summarized session 1405 + */ 1406 + 200: boolean; 1407 + }; 1408 + 1409 + export type SessionSummarizeResponse = SessionSummarizeResponses[keyof SessionSummarizeResponses]; 1410 + 1411 + export type SessionMessagesData = { 1412 + body?: never; 1413 + path: { 1414 + /** 1415 + * Session ID 1416 + */ 1417 + id: string; 1418 + }; 1419 + query?: never; 1420 + url: '/session/{id}/message'; 1421 + }; 1422 + 1423 + export type SessionMessagesResponses = { 1424 + /** 1425 + * List of messages 1426 + */ 1427 + 200: Array<{ 1428 + info: Message; 1429 + parts: Array<Part>; 1430 + }>; 1431 + }; 1432 + 1433 + export type SessionMessagesResponse = SessionMessagesResponses[keyof SessionMessagesResponses]; 1434 + 1435 + export type SessionChatData = { 1436 + body?: { 1437 + messageID?: string; 1438 + providerID: string; 1439 + modelID: string; 1440 + agent?: string; 1441 + system?: string; 1442 + tools?: { 1443 + [key: string]: boolean; 1444 + }; 1445 + parts: Array<({ 1446 + type: 'text'; 1447 + } & TextPartInput) | ({ 1448 + type: 'file'; 1449 + } & FilePartInput) | ({ 1450 + type: 'agent'; 1451 + } & AgentPartInput)>; 1452 + }; 1453 + path: { 1454 + /** 1455 + * Session ID 1456 + */ 1457 + id: string; 1458 + }; 1459 + query?: never; 1460 + url: '/session/{id}/message'; 1461 + }; 1462 + 1463 + export type SessionChatResponses = { 1464 + /** 1465 + * Created message 1466 + */ 1467 + 200: { 1468 + info: AssistantMessage; 1469 + parts: Array<Part>; 1470 + }; 1471 + }; 1472 + 1473 + export type SessionChatResponse = SessionChatResponses[keyof SessionChatResponses]; 1474 + 1475 + export type SessionMessageData = { 1476 + body?: never; 1477 + path: { 1478 + /** 1479 + * Session ID 1480 + */ 1481 + id: string; 1482 + /** 1483 + * Message ID 1484 + */ 1485 + messageID: string; 1486 + }; 1487 + query?: never; 1488 + url: '/session/{id}/message/{messageID}'; 1489 + }; 1490 + 1491 + export type SessionMessageResponses = { 1492 + /** 1493 + * Message 1494 + */ 1495 + 200: { 1496 + info: Message; 1497 + parts: Array<Part>; 1498 + }; 1499 + }; 1500 + 1501 + export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses]; 1502 + 1503 + export type SessionShellData = { 1504 + body?: { 1505 + agent: string; 1506 + command: string; 1507 + }; 1508 + path: { 1509 + /** 1510 + * Session ID 1511 + */ 1512 + id: string; 1513 + }; 1514 + query?: never; 1515 + url: '/session/{id}/shell'; 1516 + }; 1517 + 1518 + export type SessionShellResponses = { 1519 + /** 1520 + * Created message 1521 + */ 1522 + 200: AssistantMessage; 1523 + }; 1524 + 1525 + export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses]; 1526 + 1527 + export type SessionRevertData = { 1528 + body?: { 1529 + messageID: string; 1530 + partID?: string; 1531 + }; 1532 + path: { 1533 + id: string; 1534 + }; 1535 + query?: never; 1536 + url: '/session/{id}/revert'; 1537 + }; 1538 + 1539 + export type SessionRevertResponses = { 1540 + /** 1541 + * Updated session 1542 + */ 1543 + 200: Session; 1544 + }; 1545 + 1546 + export type SessionRevertResponse = SessionRevertResponses[keyof SessionRevertResponses]; 1547 + 1548 + export type SessionUnrevertData = { 1549 + body?: never; 1550 + path: { 1551 + id: string; 1552 + }; 1553 + query?: never; 1554 + url: '/session/{id}/unrevert'; 1555 + }; 1556 + 1557 + export type SessionUnrevertResponses = { 1558 + /** 1559 + * Updated session 1560 + */ 1561 + 200: Session; 1562 + }; 1563 + 1564 + export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses]; 1565 + 1566 + export type PostSessionByIdPermissionsByPermissionIdData = { 1567 + body?: { 1568 + response: 'once' | 'always' | 'reject'; 1569 + }; 1570 + path: { 1571 + id: string; 1572 + permissionID: string; 1573 + }; 1574 + query?: never; 1575 + url: '/session/{id}/permissions/{permissionID}'; 1576 + }; 1577 + 1578 + export type PostSessionByIdPermissionsByPermissionIdResponses = { 1579 + /** 1580 + * Permission processed successfully 1581 + */ 1582 + 200: boolean; 1583 + }; 1584 + 1585 + export type PostSessionByIdPermissionsByPermissionIdResponse = PostSessionByIdPermissionsByPermissionIdResponses[keyof PostSessionByIdPermissionsByPermissionIdResponses]; 1586 + 1587 + export type ConfigProvidersData = { 1588 + body?: never; 1589 + path?: never; 1590 + query?: never; 1591 + url: '/config/providers'; 1592 + }; 1593 + 1594 + export type ConfigProvidersResponses = { 1595 + /** 1596 + * List of providers 1597 + */ 1598 + 200: { 1599 + providers: Array<Provider>; 1600 + default: { 1601 + [key: string]: string; 1602 + }; 1603 + }; 1604 + }; 1605 + 1606 + export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses]; 1607 + 1608 + export type FindTextData = { 1609 + body?: never; 1610 + path?: never; 1611 + query: { 1612 + pattern: string; 1613 + }; 1614 + url: '/find'; 1615 + }; 1616 + 1617 + export type FindTextResponses = { 1618 + /** 1619 + * Matches 1620 + */ 1621 + 200: Array<{ 1622 + path: { 1623 + text: string; 1624 + }; 1625 + lines: { 1626 + text: string; 1627 + }; 1628 + line_number: number; 1629 + absolute_offset: number; 1630 + submatches: Array<{ 1631 + match: { 1632 + text: string; 1633 + }; 1634 + start: number; 1635 + end: number; 1636 + }>; 1637 + }>; 1638 + }; 1639 + 1640 + export type FindTextResponse = FindTextResponses[keyof FindTextResponses]; 1641 + 1642 + export type FindFilesData = { 1643 + body?: never; 1644 + path?: never; 1645 + query: { 1646 + query: string; 1647 + }; 1648 + url: '/find/file'; 1649 + }; 1650 + 1651 + export type FindFilesResponses = { 1652 + /** 1653 + * File paths 1654 + */ 1655 + 200: Array<string>; 1656 + }; 1657 + 1658 + export type FindFilesResponse = FindFilesResponses[keyof FindFilesResponses]; 1659 + 1660 + export type FindSymbolsData = { 1661 + body?: never; 1662 + path?: never; 1663 + query: { 1664 + query: string; 1665 + }; 1666 + url: '/find/symbol'; 1667 + }; 1668 + 1669 + export type FindSymbolsResponses = { 1670 + /** 1671 + * Symbols 1672 + */ 1673 + 200: Array<Symbol>; 1674 + }; 1675 + 1676 + export type FindSymbolsResponse = FindSymbolsResponses[keyof FindSymbolsResponses]; 1677 + 1678 + export type FileReadData = { 1679 + body?: never; 1680 + path?: never; 1681 + query: { 1682 + path: string; 1683 + }; 1684 + url: '/file'; 1685 + }; 1686 + 1687 + export type FileReadResponses = { 1688 + /** 1689 + * File content 1690 + */ 1691 + 200: { 1692 + type: 'raw' | 'patch'; 1693 + content: string; 1694 + }; 1695 + }; 1696 + 1697 + export type FileReadResponse = FileReadResponses[keyof FileReadResponses]; 1698 + 1699 + export type FileStatusData = { 1700 + body?: never; 1701 + path?: never; 1702 + query?: never; 1703 + url: '/file/status'; 1704 + }; 1705 + 1706 + export type FileStatusResponses = { 1707 + /** 1708 + * File status 1709 + */ 1710 + 200: Array<File>; 1711 + }; 1712 + 1713 + export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses]; 1714 + 1715 + export type AppLogData = { 1716 + body?: { 1717 + /** 1718 + * Service name for the log entry 1719 + */ 1720 + service: string; 1721 + /** 1722 + * Log level 1723 + */ 1724 + level: 'debug' | 'info' | 'error' | 'warn'; 1725 + /** 1726 + * Log message 1727 + */ 1728 + message: string; 1729 + /** 1730 + * Additional metadata for the log entry 1731 + */ 1732 + extra?: { 1733 + [key: string]: unknown; 1734 + }; 1735 + }; 1736 + path?: never; 1737 + query?: never; 1738 + url: '/log'; 1739 + }; 1740 + 1741 + export type AppLogResponses = { 1742 + /** 1743 + * Log entry written successfully 1744 + */ 1745 + 200: boolean; 1746 + }; 1747 + 1748 + export type AppLogResponse = AppLogResponses[keyof AppLogResponses]; 1749 + 1750 + export type AppAgentsData = { 1751 + body?: never; 1752 + path?: never; 1753 + query?: never; 1754 + url: '/agent'; 1755 + }; 1756 + 1757 + export type AppAgentsResponses = { 1758 + /** 1759 + * List of agents 1760 + */ 1761 + 200: Array<Agent>; 1762 + }; 1763 + 1764 + export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]; 1765 + 1766 + export type TuiAppendPromptData = { 1767 + body?: { 1768 + text: string; 1769 + }; 1770 + path?: never; 1771 + query?: never; 1772 + url: '/tui/append-prompt'; 1773 + }; 1774 + 1775 + export type TuiAppendPromptResponses = { 1776 + /** 1777 + * Prompt processed successfully 1778 + */ 1779 + 200: boolean; 1780 + }; 1781 + 1782 + export type TuiAppendPromptResponse = TuiAppendPromptResponses[keyof TuiAppendPromptResponses]; 1783 + 1784 + export type TuiOpenHelpData = { 1785 + body?: never; 1786 + path?: never; 1787 + query?: never; 1788 + url: '/tui/open-help'; 1789 + }; 1790 + 1791 + export type TuiOpenHelpResponses = { 1792 + /** 1793 + * Help dialog opened successfully 1794 + */ 1795 + 200: boolean; 1796 + }; 1797 + 1798 + export type TuiOpenHelpResponse = TuiOpenHelpResponses[keyof TuiOpenHelpResponses]; 1799 + 1800 + export type TuiOpenSessionsData = { 1801 + body?: never; 1802 + path?: never; 1803 + query?: never; 1804 + url: '/tui/open-sessions'; 1805 + }; 1806 + 1807 + export type TuiOpenSessionsResponses = { 1808 + /** 1809 + * Session dialog opened successfully 1810 + */ 1811 + 200: boolean; 1812 + }; 1813 + 1814 + export type TuiOpenSessionsResponse = TuiOpenSessionsResponses[keyof TuiOpenSessionsResponses]; 1815 + 1816 + export type TuiOpenThemesData = { 1817 + body?: never; 1818 + path?: never; 1819 + query?: never; 1820 + url: '/tui/open-themes'; 1821 + }; 1822 + 1823 + export type TuiOpenThemesResponses = { 1824 + /** 1825 + * Theme dialog opened successfully 1826 + */ 1827 + 200: boolean; 1828 + }; 1829 + 1830 + export type TuiOpenThemesResponse = TuiOpenThemesResponses[keyof TuiOpenThemesResponses]; 1831 + 1832 + export type TuiOpenModelsData = { 1833 + body?: never; 1834 + path?: never; 1835 + query?: never; 1836 + url: '/tui/open-models'; 1837 + }; 1838 + 1839 + export type TuiOpenModelsResponses = { 1840 + /** 1841 + * Model dialog opened successfully 1842 + */ 1843 + 200: boolean; 1844 + }; 1845 + 1846 + export type TuiOpenModelsResponse = TuiOpenModelsResponses[keyof TuiOpenModelsResponses]; 1847 + 1848 + export type TuiSubmitPromptData = { 1849 + body?: never; 1850 + path?: never; 1851 + query?: never; 1852 + url: '/tui/submit-prompt'; 1853 + }; 1854 + 1855 + export type TuiSubmitPromptResponses = { 1856 + /** 1857 + * Prompt submitted successfully 1858 + */ 1859 + 200: boolean; 1860 + }; 1861 + 1862 + export type TuiSubmitPromptResponse = TuiSubmitPromptResponses[keyof TuiSubmitPromptResponses]; 1863 + 1864 + export type TuiClearPromptData = { 1865 + body?: never; 1866 + path?: never; 1867 + query?: never; 1868 + url: '/tui/clear-prompt'; 1869 + }; 1870 + 1871 + export type TuiClearPromptResponses = { 1872 + /** 1873 + * Prompt cleared successfully 1874 + */ 1875 + 200: boolean; 1876 + }; 1877 + 1878 + export type TuiClearPromptResponse = TuiClearPromptResponses[keyof TuiClearPromptResponses]; 1879 + 1880 + export type TuiExecuteCommandData = { 1881 + body?: { 1882 + command: string; 1883 + }; 1884 + path?: never; 1885 + query?: never; 1886 + url: '/tui/execute-command'; 1887 + }; 1888 + 1889 + export type TuiExecuteCommandResponses = { 1890 + /** 1891 + * Command executed successfully 1892 + */ 1893 + 200: boolean; 1894 + }; 1895 + 1896 + export type TuiExecuteCommandResponse = TuiExecuteCommandResponses[keyof TuiExecuteCommandResponses]; 1897 + 1898 + export type TuiShowToastData = { 1899 + body?: { 1900 + title?: string; 1901 + message: string; 1902 + variant: 'info' | 'success' | 'warning' | 'error'; 1903 + }; 1904 + path?: never; 1905 + query?: never; 1906 + url: '/tui/show-toast'; 1907 + }; 1908 + 1909 + export type TuiShowToastResponses = { 1910 + /** 1911 + * Toast notification shown successfully 1912 + */ 1913 + 200: boolean; 1914 + }; 1915 + 1916 + export type TuiShowToastResponse = TuiShowToastResponses[keyof TuiShowToastResponses]; 1917 + 1918 + export type AuthSetData = { 1919 + body?: Auth; 1920 + path: { 1921 + id: string; 1922 + }; 1923 + query?: never; 1924 + url: '/auth/{id}'; 1925 + }; 1926 + 1927 + export type AuthSetErrors = { 1928 + /** 1929 + * Bad request 1930 + */ 1931 + 400: _Error; 1932 + }; 1933 + 1934 + export type AuthSetError = AuthSetErrors[keyof AuthSetErrors]; 1935 + 1936 + export type AuthSetResponses = { 1937 + /** 1938 + * Successfully set authentication credentials 1939 + */ 1940 + 200: boolean; 1941 + }; 1942 + 1943 + export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses];
+16
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { type ClientOptions, type Config, createClient, createConfig } from './client'; 4 + import type { ClientOptions as ClientOptions2 } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions2>());
+268
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/client/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { createSseClient } from '../core/serverSentEvents.gen'; 4 + import type { HttpMethod } from '../core/types.gen'; 5 + import { getValidRequestBody } from '../core/utils.gen'; 6 + import type { 7 + Client, 8 + Config, 9 + RequestOptions, 10 + ResolvedRequestOptions, 11 + } from './types.gen'; 12 + import { 13 + buildUrl, 14 + createConfig, 15 + createInterceptors, 16 + getParseAs, 17 + mergeConfigs, 18 + mergeHeaders, 19 + setAuthParams, 20 + } from './utils.gen'; 21 + 22 + type ReqInit = Omit<RequestInit, 'body' | 'headers'> & { 23 + body?: any; 24 + headers: ReturnType<typeof mergeHeaders>; 25 + }; 26 + 27 + export const createClient = (config: Config = {}): Client => { 28 + let _config = mergeConfigs(createConfig(), config); 29 + 30 + const getConfig = (): Config => ({ ..._config }); 31 + 32 + const setConfig = (config: Config): Config => { 33 + _config = mergeConfigs(_config, config); 34 + return getConfig(); 35 + }; 36 + 37 + const interceptors = createInterceptors< 38 + Request, 39 + Response, 40 + unknown, 41 + ResolvedRequestOptions 42 + >(); 43 + 44 + const beforeRequest = async (options: RequestOptions) => { 45 + const opts = { 46 + ..._config, 47 + ...options, 48 + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, 49 + headers: mergeHeaders(_config.headers, options.headers), 50 + serializedBody: undefined, 51 + }; 52 + 53 + if (opts.security) { 54 + await setAuthParams({ 55 + ...opts, 56 + security: opts.security, 57 + }); 58 + } 59 + 60 + if (opts.requestValidator) { 61 + await opts.requestValidator(opts); 62 + } 63 + 64 + if (opts.body !== undefined && opts.bodySerializer) { 65 + opts.serializedBody = opts.bodySerializer(opts.body); 66 + } 67 + 68 + // remove Content-Type header if body is empty to avoid sending invalid requests 69 + if (opts.body === undefined || opts.serializedBody === '') { 70 + opts.headers.delete('Content-Type'); 71 + } 72 + 73 + const url = buildUrl(opts); 74 + 75 + return { opts, url }; 76 + }; 77 + 78 + const request: Client['request'] = async (options) => { 79 + // @ts-expect-error 80 + const { opts, url } = await beforeRequest(options); 81 + const requestInit: ReqInit = { 82 + redirect: 'follow', 83 + ...opts, 84 + body: getValidRequestBody(opts), 85 + }; 86 + 87 + let request = new Request(url, requestInit); 88 + 89 + for (const fn of interceptors.request.fns) { 90 + if (fn) { 91 + request = await fn(request, opts); 92 + } 93 + } 94 + 95 + // fetch must be assigned here, otherwise it would throw the error: 96 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 97 + const _fetch = opts.fetch!; 98 + let response = await _fetch(request); 99 + 100 + for (const fn of interceptors.response.fns) { 101 + if (fn) { 102 + response = await fn(response, request, opts); 103 + } 104 + } 105 + 106 + const result = { 107 + request, 108 + response, 109 + }; 110 + 111 + if (response.ok) { 112 + const parseAs = 113 + (opts.parseAs === 'auto' 114 + ? getParseAs(response.headers.get('Content-Type')) 115 + : opts.parseAs) ?? 'json'; 116 + 117 + if ( 118 + response.status === 204 || 119 + response.headers.get('Content-Length') === '0' 120 + ) { 121 + let emptyData: any; 122 + switch (parseAs) { 123 + case 'arrayBuffer': 124 + case 'blob': 125 + case 'text': 126 + emptyData = await response[parseAs](); 127 + break; 128 + case 'formData': 129 + emptyData = new FormData(); 130 + break; 131 + case 'stream': 132 + emptyData = response.body; 133 + break; 134 + case 'json': 135 + default: 136 + emptyData = {}; 137 + break; 138 + } 139 + return opts.responseStyle === 'data' 140 + ? emptyData 141 + : { 142 + data: emptyData, 143 + ...result, 144 + }; 145 + } 146 + 147 + let data: any; 148 + switch (parseAs) { 149 + case 'arrayBuffer': 150 + case 'blob': 151 + case 'formData': 152 + case 'json': 153 + case 'text': 154 + data = await response[parseAs](); 155 + break; 156 + case 'stream': 157 + return opts.responseStyle === 'data' 158 + ? response.body 159 + : { 160 + data: response.body, 161 + ...result, 162 + }; 163 + } 164 + 165 + if (parseAs === 'json') { 166 + if (opts.responseValidator) { 167 + await opts.responseValidator(data); 168 + } 169 + 170 + if (opts.responseTransformer) { 171 + data = await opts.responseTransformer(data); 172 + } 173 + } 174 + 175 + return opts.responseStyle === 'data' 176 + ? data 177 + : { 178 + data, 179 + ...result, 180 + }; 181 + } 182 + 183 + const textError = await response.text(); 184 + let jsonError: unknown; 185 + 186 + try { 187 + jsonError = JSON.parse(textError); 188 + } catch { 189 + // noop 190 + } 191 + 192 + const error = jsonError ?? textError; 193 + let finalError = error; 194 + 195 + for (const fn of interceptors.error.fns) { 196 + if (fn) { 197 + finalError = (await fn(error, response, request, opts)) as string; 198 + } 199 + } 200 + 201 + finalError = finalError || ({} as string); 202 + 203 + if (opts.throwOnError) { 204 + throw finalError; 205 + } 206 + 207 + // TODO: we probably want to return error and improve types 208 + return opts.responseStyle === 'data' 209 + ? undefined 210 + : { 211 + error: finalError, 212 + ...result, 213 + }; 214 + }; 215 + 216 + const makeMethodFn = 217 + (method: Uppercase<HttpMethod>) => (options: RequestOptions) => 218 + request({ ...options, method }); 219 + 220 + const makeSseFn = 221 + (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => { 222 + const { opts, url } = await beforeRequest(options); 223 + return createSseClient({ 224 + ...opts, 225 + body: opts.body as BodyInit | null | undefined, 226 + headers: opts.headers as unknown as Record<string, string>, 227 + method, 228 + onRequest: async (url, init) => { 229 + let request = new Request(url, init); 230 + for (const fn of interceptors.request.fns) { 231 + if (fn) { 232 + request = await fn(request, opts); 233 + } 234 + } 235 + return request; 236 + }, 237 + url, 238 + }); 239 + }; 240 + 241 + return { 242 + buildUrl, 243 + connect: makeMethodFn('CONNECT'), 244 + delete: makeMethodFn('DELETE'), 245 + get: makeMethodFn('GET'), 246 + getConfig, 247 + head: makeMethodFn('HEAD'), 248 + interceptors, 249 + options: makeMethodFn('OPTIONS'), 250 + patch: makeMethodFn('PATCH'), 251 + post: makeMethodFn('POST'), 252 + put: makeMethodFn('PUT'), 253 + request, 254 + setConfig, 255 + sse: { 256 + connect: makeSseFn('CONNECT'), 257 + delete: makeSseFn('DELETE'), 258 + get: makeSseFn('GET'), 259 + head: makeSseFn('HEAD'), 260 + options: makeSseFn('OPTIONS'), 261 + patch: makeSseFn('PATCH'), 262 + post: makeSseFn('POST'), 263 + put: makeSseFn('PUT'), 264 + trace: makeSseFn('TRACE'), 265 + }, 266 + trace: makeMethodFn('TRACE'), 267 + } as Client; 268 + };
+26
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/client/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type { Auth } from '../core/auth.gen'; 4 + export type { QuerySerializerOptions } from '../core/bodySerializer.gen'; 5 + export { 6 + formDataBodySerializer, 7 + jsonBodySerializer, 8 + urlSearchParamsBodySerializer, 9 + } from '../core/bodySerializer.gen'; 10 + export { buildClientParams } from '../core/params.gen'; 11 + export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen'; 12 + export { createClient } from './client.gen'; 13 + export type { 14 + Client, 15 + ClientOptions, 16 + Config, 17 + CreateClientConfig, 18 + Options, 19 + OptionsLegacyParser, 20 + RequestOptions, 21 + RequestResult, 22 + ResolvedRequestOptions, 23 + ResponseStyle, 24 + TDataShape, 25 + } from './types.gen'; 26 + export { createConfig, mergeHeaders } from './utils.gen';
+268
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/client/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth } from '../core/auth.gen'; 4 + import type { 5 + ServerSentEventsOptions, 6 + ServerSentEventsResult, 7 + } from '../core/serverSentEvents.gen'; 8 + import type { 9 + Client as CoreClient, 10 + Config as CoreConfig, 11 + } from '../core/types.gen'; 12 + import type { Middleware } from './utils.gen'; 13 + 14 + export type ResponseStyle = 'data' | 'fields'; 15 + 16 + export interface Config<T extends ClientOptions = ClientOptions> 17 + extends Omit<RequestInit, 'body' | 'headers' | 'method'>, 18 + CoreConfig { 19 + /** 20 + * Base URL for all requests made by this client. 21 + */ 22 + baseUrl?: T['baseUrl']; 23 + /** 24 + * Fetch API implementation. You can use this option to provide a custom 25 + * fetch instance. 26 + * 27 + * @default globalThis.fetch 28 + */ 29 + fetch?: typeof fetch; 30 + /** 31 + * Please don't use the Fetch client for Next.js applications. The `next` 32 + * options won't have any effect. 33 + * 34 + * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. 35 + */ 36 + next?: never; 37 + /** 38 + * Return the response data parsed in a specified format. By default, `auto` 39 + * will infer the appropriate method from the `Content-Type` response header. 40 + * You can override this behavior with any of the {@link Body} methods. 41 + * Select `stream` if you don't want to parse response data at all. 42 + * 43 + * @default 'auto' 44 + */ 45 + parseAs?: 46 + | 'arrayBuffer' 47 + | 'auto' 48 + | 'blob' 49 + | 'formData' 50 + | 'json' 51 + | 'stream' 52 + | 'text'; 53 + /** 54 + * Should we return only data or multiple fields (data, error, response, etc.)? 55 + * 56 + * @default 'fields' 57 + */ 58 + responseStyle?: ResponseStyle; 59 + /** 60 + * Throw an error instead of returning it in the response? 61 + * 62 + * @default false 63 + */ 64 + throwOnError?: T['throwOnError']; 65 + } 66 + 67 + export interface RequestOptions< 68 + TData = unknown, 69 + TResponseStyle extends ResponseStyle = 'fields', 70 + ThrowOnError extends boolean = boolean, 71 + Url extends string = string, 72 + > extends Config<{ 73 + responseStyle: TResponseStyle; 74 + throwOnError: ThrowOnError; 75 + }>, 76 + Pick< 77 + ServerSentEventsOptions<TData>, 78 + | 'onSseError' 79 + | 'onSseEvent' 80 + | 'sseDefaultRetryDelay' 81 + | 'sseMaxRetryAttempts' 82 + | 'sseMaxRetryDelay' 83 + > { 84 + /** 85 + * Any body that you want to add to your request. 86 + * 87 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} 88 + */ 89 + body?: unknown; 90 + path?: Record<string, unknown>; 91 + query?: Record<string, unknown>; 92 + /** 93 + * Security mechanism(s) to use for the request. 94 + */ 95 + security?: ReadonlyArray<Auth>; 96 + url: Url; 97 + } 98 + 99 + export interface ResolvedRequestOptions< 100 + TResponseStyle extends ResponseStyle = 'fields', 101 + ThrowOnError extends boolean = boolean, 102 + Url extends string = string, 103 + > extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> { 104 + serializedBody?: string; 105 + } 106 + 107 + export type RequestResult< 108 + TData = unknown, 109 + TError = unknown, 110 + ThrowOnError extends boolean = boolean, 111 + TResponseStyle extends ResponseStyle = 'fields', 112 + > = ThrowOnError extends true 113 + ? Promise< 114 + TResponseStyle extends 'data' 115 + ? TData extends Record<string, unknown> 116 + ? TData[keyof TData] 117 + : TData 118 + : { 119 + data: TData extends Record<string, unknown> 120 + ? TData[keyof TData] 121 + : TData; 122 + request: Request; 123 + response: Response; 124 + } 125 + > 126 + : Promise< 127 + TResponseStyle extends 'data' 128 + ? 129 + | (TData extends Record<string, unknown> 130 + ? TData[keyof TData] 131 + : TData) 132 + | undefined 133 + : ( 134 + | { 135 + data: TData extends Record<string, unknown> 136 + ? TData[keyof TData] 137 + : TData; 138 + error: undefined; 139 + } 140 + | { 141 + data: undefined; 142 + error: TError extends Record<string, unknown> 143 + ? TError[keyof TError] 144 + : TError; 145 + } 146 + ) & { 147 + request: Request; 148 + response: Response; 149 + } 150 + >; 151 + 152 + export interface ClientOptions { 153 + baseUrl?: string; 154 + responseStyle?: ResponseStyle; 155 + throwOnError?: boolean; 156 + } 157 + 158 + type MethodFn = < 159 + TData = unknown, 160 + TError = unknown, 161 + ThrowOnError extends boolean = false, 162 + TResponseStyle extends ResponseStyle = 'fields', 163 + >( 164 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 165 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 166 + 167 + type SseFn = < 168 + TData = unknown, 169 + TError = unknown, 170 + ThrowOnError extends boolean = false, 171 + TResponseStyle extends ResponseStyle = 'fields', 172 + >( 173 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 174 + ) => Promise<ServerSentEventsResult<TData, TError>>; 175 + 176 + type RequestFn = < 177 + TData = unknown, 178 + TError = unknown, 179 + ThrowOnError extends boolean = false, 180 + TResponseStyle extends ResponseStyle = 'fields', 181 + >( 182 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & 183 + Pick< 184 + Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 185 + 'method' 186 + >, 187 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 188 + 189 + type BuildUrlFn = < 190 + TData extends { 191 + body?: unknown; 192 + path?: Record<string, unknown>; 193 + query?: Record<string, unknown>; 194 + url: string; 195 + }, 196 + >( 197 + options: Pick<TData, 'url'> & Options<TData>, 198 + ) => string; 199 + 200 + export type Client = CoreClient< 201 + RequestFn, 202 + Config, 203 + MethodFn, 204 + BuildUrlFn, 205 + SseFn 206 + > & { 207 + interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>; 208 + }; 209 + 210 + /** 211 + * The `createClientConfig()` function will be called on client initialization 212 + * and the returned object will become the client's initial configuration. 213 + * 214 + * You may want to initialize your client this way instead of calling 215 + * `setConfig()`. This is useful for example if you're using Next.js 216 + * to ensure your client always has the correct values. 217 + */ 218 + export type CreateClientConfig<T extends ClientOptions = ClientOptions> = ( 219 + override?: Config<ClientOptions & T>, 220 + ) => Config<Required<ClientOptions> & T>; 221 + 222 + export interface TDataShape { 223 + body?: unknown; 224 + headers?: unknown; 225 + path?: unknown; 226 + query?: unknown; 227 + url: string; 228 + } 229 + 230 + type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>; 231 + 232 + export type Options< 233 + TData extends TDataShape = TDataShape, 234 + ThrowOnError extends boolean = boolean, 235 + TResponse = unknown, 236 + TResponseStyle extends ResponseStyle = 'fields', 237 + > = OmitKeys< 238 + RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 239 + 'body' | 'path' | 'query' | 'url' 240 + > & 241 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>); 242 + 243 + export type OptionsLegacyParser< 244 + TData = unknown, 245 + ThrowOnError extends boolean = boolean, 246 + TResponseStyle extends ResponseStyle = 'fields', 247 + > = TData extends { body?: any } 248 + ? TData extends { headers?: any } 249 + ? OmitKeys< 250 + RequestOptions<unknown, TResponseStyle, ThrowOnError>, 251 + 'body' | 'headers' | 'url' 252 + > & 253 + TData 254 + : OmitKeys< 255 + RequestOptions<unknown, TResponseStyle, ThrowOnError>, 256 + 'body' | 'url' 257 + > & 258 + TData & 259 + Pick<RequestOptions<unknown, TResponseStyle, ThrowOnError>, 'headers'> 260 + : TData extends { headers?: any } 261 + ? OmitKeys< 262 + RequestOptions<unknown, TResponseStyle, ThrowOnError>, 263 + 'headers' | 'url' 264 + > & 265 + TData & 266 + Pick<RequestOptions<unknown, TResponseStyle, ThrowOnError>, 'body'> 267 + : OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, 'url'> & 268 + TData;
+332
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/client/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { getAuthToken } from '../core/auth.gen'; 4 + import type { QuerySerializerOptions } from '../core/bodySerializer.gen'; 5 + import { jsonBodySerializer } from '../core/bodySerializer.gen'; 6 + import { 7 + serializeArrayParam, 8 + serializeObjectParam, 9 + serializePrimitiveParam, 10 + } from '../core/pathSerializer.gen'; 11 + import { getUrl } from '../core/utils.gen'; 12 + import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'; 13 + 14 + export const createQuerySerializer = <T = unknown>({ 15 + parameters = {}, 16 + ...args 17 + }: QuerySerializerOptions = {}) => { 18 + const querySerializer = (queryParams: T) => { 19 + const search: string[] = []; 20 + if (queryParams && typeof queryParams === 'object') { 21 + for (const name in queryParams) { 22 + const value = queryParams[name]; 23 + 24 + if (value === undefined || value === null) { 25 + continue; 26 + } 27 + 28 + const options = parameters[name] || args; 29 + 30 + if (Array.isArray(value)) { 31 + const serializedArray = serializeArrayParam({ 32 + allowReserved: options.allowReserved, 33 + explode: true, 34 + name, 35 + style: 'form', 36 + value, 37 + ...options.array, 38 + }); 39 + if (serializedArray) search.push(serializedArray); 40 + } else if (typeof value === 'object') { 41 + const serializedObject = serializeObjectParam({ 42 + allowReserved: options.allowReserved, 43 + explode: true, 44 + name, 45 + style: 'deepObject', 46 + value: value as Record<string, unknown>, 47 + ...options.object, 48 + }); 49 + if (serializedObject) search.push(serializedObject); 50 + } else { 51 + const serializedPrimitive = serializePrimitiveParam({ 52 + allowReserved: options.allowReserved, 53 + name, 54 + value: value as string, 55 + }); 56 + if (serializedPrimitive) search.push(serializedPrimitive); 57 + } 58 + } 59 + } 60 + return search.join('&'); 61 + }; 62 + return querySerializer; 63 + }; 64 + 65 + /** 66 + * Infers parseAs value from provided Content-Type header. 67 + */ 68 + export const getParseAs = ( 69 + contentType: string | null, 70 + ): Exclude<Config['parseAs'], 'auto'> => { 71 + if (!contentType) { 72 + // If no Content-Type header is provided, the best we can do is return the raw response body, 73 + // which is effectively the same as the 'stream' option. 74 + return 'stream'; 75 + } 76 + 77 + const cleanContent = contentType.split(';')[0]?.trim(); 78 + 79 + if (!cleanContent) { 80 + return; 81 + } 82 + 83 + if ( 84 + cleanContent.startsWith('application/json') || 85 + cleanContent.endsWith('+json') 86 + ) { 87 + return 'json'; 88 + } 89 + 90 + if (cleanContent === 'multipart/form-data') { 91 + return 'formData'; 92 + } 93 + 94 + if ( 95 + ['application/', 'audio/', 'image/', 'video/'].some((type) => 96 + cleanContent.startsWith(type), 97 + ) 98 + ) { 99 + return 'blob'; 100 + } 101 + 102 + if (cleanContent.startsWith('text/')) { 103 + return 'text'; 104 + } 105 + 106 + return; 107 + }; 108 + 109 + const checkForExistence = ( 110 + options: Pick<RequestOptions, 'auth' | 'query'> & { 111 + headers: Headers; 112 + }, 113 + name?: string, 114 + ): boolean => { 115 + if (!name) { 116 + return false; 117 + } 118 + if ( 119 + options.headers.has(name) || 120 + options.query?.[name] || 121 + options.headers.get('Cookie')?.includes(`${name}=`) 122 + ) { 123 + return true; 124 + } 125 + return false; 126 + }; 127 + 128 + export const setAuthParams = async ({ 129 + security, 130 + ...options 131 + }: Pick<Required<RequestOptions>, 'security'> & 132 + Pick<RequestOptions, 'auth' | 'query'> & { 133 + headers: Headers; 134 + }) => { 135 + for (const auth of security) { 136 + if (checkForExistence(options, auth.name)) { 137 + continue; 138 + } 139 + 140 + const token = await getAuthToken(auth, options.auth); 141 + 142 + if (!token) { 143 + continue; 144 + } 145 + 146 + const name = auth.name ?? 'Authorization'; 147 + 148 + switch (auth.in) { 149 + case 'query': 150 + if (!options.query) { 151 + options.query = {}; 152 + } 153 + options.query[name] = token; 154 + break; 155 + case 'cookie': 156 + options.headers.append('Cookie', `${name}=${token}`); 157 + break; 158 + case 'header': 159 + default: 160 + options.headers.set(name, token); 161 + break; 162 + } 163 + } 164 + }; 165 + 166 + export const buildUrl: Client['buildUrl'] = (options) => 167 + getUrl({ 168 + baseUrl: options.baseUrl as string, 169 + path: options.path, 170 + query: options.query, 171 + querySerializer: 172 + typeof options.querySerializer === 'function' 173 + ? options.querySerializer 174 + : createQuerySerializer(options.querySerializer), 175 + url: options.url, 176 + }); 177 + 178 + export const mergeConfigs = (a: Config, b: Config): Config => { 179 + const config = { ...a, ...b }; 180 + if (config.baseUrl?.endsWith('/')) { 181 + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); 182 + } 183 + config.headers = mergeHeaders(a.headers, b.headers); 184 + return config; 185 + }; 186 + 187 + const headersEntries = (headers: Headers): Array<[string, string]> => { 188 + const entries: Array<[string, string]> = []; 189 + headers.forEach((value, key) => { 190 + entries.push([key, value]); 191 + }); 192 + return entries; 193 + }; 194 + 195 + export const mergeHeaders = ( 196 + ...headers: Array<Required<Config>['headers'] | undefined> 197 + ): Headers => { 198 + const mergedHeaders = new Headers(); 199 + for (const header of headers) { 200 + if (!header) { 201 + continue; 202 + } 203 + 204 + const iterator = 205 + header instanceof Headers 206 + ? headersEntries(header) 207 + : Object.entries(header); 208 + 209 + for (const [key, value] of iterator) { 210 + if (value === null) { 211 + mergedHeaders.delete(key); 212 + } else if (Array.isArray(value)) { 213 + for (const v of value) { 214 + mergedHeaders.append(key, v as string); 215 + } 216 + } else if (value !== undefined) { 217 + // assume object headers are meant to be JSON stringified, i.e. their 218 + // content value in OpenAPI specification is 'application/json' 219 + mergedHeaders.set( 220 + key, 221 + typeof value === 'object' ? JSON.stringify(value) : (value as string), 222 + ); 223 + } 224 + } 225 + } 226 + return mergedHeaders; 227 + }; 228 + 229 + type ErrInterceptor<Err, Res, Req, Options> = ( 230 + error: Err, 231 + response: Res, 232 + request: Req, 233 + options: Options, 234 + ) => Err | Promise<Err>; 235 + 236 + type ReqInterceptor<Req, Options> = ( 237 + request: Req, 238 + options: Options, 239 + ) => Req | Promise<Req>; 240 + 241 + type ResInterceptor<Res, Req, Options> = ( 242 + response: Res, 243 + request: Req, 244 + options: Options, 245 + ) => Res | Promise<Res>; 246 + 247 + class Interceptors<Interceptor> { 248 + fns: Array<Interceptor | null> = []; 249 + 250 + clear(): void { 251 + this.fns = []; 252 + } 253 + 254 + eject(id: number | Interceptor): void { 255 + const index = this.getInterceptorIndex(id); 256 + if (this.fns[index]) { 257 + this.fns[index] = null; 258 + } 259 + } 260 + 261 + exists(id: number | Interceptor): boolean { 262 + const index = this.getInterceptorIndex(id); 263 + return Boolean(this.fns[index]); 264 + } 265 + 266 + getInterceptorIndex(id: number | Interceptor): number { 267 + if (typeof id === 'number') { 268 + return this.fns[id] ? id : -1; 269 + } 270 + return this.fns.indexOf(id); 271 + } 272 + 273 + update( 274 + id: number | Interceptor, 275 + fn: Interceptor, 276 + ): number | Interceptor | false { 277 + const index = this.getInterceptorIndex(id); 278 + if (this.fns[index]) { 279 + this.fns[index] = fn; 280 + return id; 281 + } 282 + return false; 283 + } 284 + 285 + use(fn: Interceptor): number { 286 + this.fns.push(fn); 287 + return this.fns.length - 1; 288 + } 289 + } 290 + 291 + export interface Middleware<Req, Res, Err, Options> { 292 + error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>; 293 + request: Interceptors<ReqInterceptor<Req, Options>>; 294 + response: Interceptors<ResInterceptor<Res, Req, Options>>; 295 + } 296 + 297 + export const createInterceptors = <Req, Res, Err, Options>(): Middleware< 298 + Req, 299 + Res, 300 + Err, 301 + Options 302 + > => ({ 303 + error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(), 304 + request: new Interceptors<ReqInterceptor<Req, Options>>(), 305 + response: new Interceptors<ResInterceptor<Res, Req, Options>>(), 306 + }); 307 + 308 + const defaultQuerySerializer = createQuerySerializer({ 309 + allowReserved: false, 310 + array: { 311 + explode: true, 312 + style: 'form', 313 + }, 314 + object: { 315 + explode: true, 316 + style: 'deepObject', 317 + }, 318 + }); 319 + 320 + const defaultHeaders = { 321 + 'Content-Type': 'application/json', 322 + }; 323 + 324 + export const createConfig = <T extends ClientOptions = ClientOptions>( 325 + override: Config<Omit<ClientOptions, keyof T> & T> = {}, 326 + ): Config<Omit<ClientOptions, keyof T> & T> => ({ 327 + ...jsonBodySerializer, 328 + headers: defaultHeaders, 329 + parseAs: 'auto', 330 + querySerializer: defaultQuerySerializer, 331 + ...override, 332 + });
+42
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/core/auth.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type AuthToken = string | undefined; 4 + 5 + export interface Auth { 6 + /** 7 + * Which part of the request do we use to send the auth? 8 + * 9 + * @default 'header' 10 + */ 11 + in?: 'header' | 'query' | 'cookie'; 12 + /** 13 + * Header or query parameter name. 14 + * 15 + * @default 'Authorization' 16 + */ 17 + name?: string; 18 + scheme?: 'basic' | 'bearer'; 19 + type: 'apiKey' | 'http'; 20 + } 21 + 22 + export const getAuthToken = async ( 23 + auth: Auth, 24 + callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken, 25 + ): Promise<string | undefined> => { 26 + const token = 27 + typeof callback === 'function' ? await callback(auth) : callback; 28 + 29 + if (!token) { 30 + return; 31 + } 32 + 33 + if (auth.scheme === 'bearer') { 34 + return `Bearer ${token}`; 35 + } 36 + 37 + if (auth.scheme === 'basic') { 38 + return `Basic ${btoa(token)}`; 39 + } 40 + 41 + return token; 42 + };
+100
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/core/bodySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + ArrayStyle, 5 + ObjectStyle, 6 + SerializerOptions, 7 + } from './pathSerializer.gen'; 8 + 9 + export type QuerySerializer = (query: Record<string, unknown>) => string; 10 + 11 + export type BodySerializer = (body: any) => any; 12 + 13 + type QuerySerializerOptionsObject = { 14 + allowReserved?: boolean; 15 + array?: Partial<SerializerOptions<ArrayStyle>>; 16 + object?: Partial<SerializerOptions<ObjectStyle>>; 17 + }; 18 + 19 + export type QuerySerializerOptions = QuerySerializerOptionsObject & { 20 + /** 21 + * Per-parameter serialization overrides. When provided, these settings 22 + * override the global array/object settings for specific parameter names. 23 + */ 24 + parameters?: Record<string, QuerySerializerOptionsObject>; 25 + }; 26 + 27 + const serializeFormDataPair = ( 28 + data: FormData, 29 + key: string, 30 + value: unknown, 31 + ): void => { 32 + if (typeof value === 'string' || value instanceof Blob) { 33 + data.append(key, value); 34 + } else if (value instanceof Date) { 35 + data.append(key, value.toISOString()); 36 + } else { 37 + data.append(key, JSON.stringify(value)); 38 + } 39 + }; 40 + 41 + const serializeUrlSearchParamsPair = ( 42 + data: URLSearchParams, 43 + key: string, 44 + value: unknown, 45 + ): void => { 46 + if (typeof value === 'string') { 47 + data.append(key, value); 48 + } else { 49 + data.append(key, JSON.stringify(value)); 50 + } 51 + }; 52 + 53 + export const formDataBodySerializer = { 54 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 55 + body: T, 56 + ): FormData => { 57 + const data = new FormData(); 58 + 59 + Object.entries(body).forEach(([key, value]) => { 60 + if (value === undefined || value === null) { 61 + return; 62 + } 63 + if (Array.isArray(value)) { 64 + value.forEach((v) => serializeFormDataPair(data, key, v)); 65 + } else { 66 + serializeFormDataPair(data, key, value); 67 + } 68 + }); 69 + 70 + return data; 71 + }, 72 + }; 73 + 74 + export const jsonBodySerializer = { 75 + bodySerializer: <T>(body: T): string => 76 + JSON.stringify(body, (_key, value) => 77 + typeof value === 'bigint' ? value.toString() : value, 78 + ), 79 + }; 80 + 81 + export const urlSearchParamsBodySerializer = { 82 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 83 + body: T, 84 + ): string => { 85 + const data = new URLSearchParams(); 86 + 87 + Object.entries(body).forEach(([key, value]) => { 88 + if (value === undefined || value === null) { 89 + return; 90 + } 91 + if (Array.isArray(value)) { 92 + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); 93 + } else { 94 + serializeUrlSearchParamsPair(data, key, value); 95 + } 96 + }); 97 + 98 + return data.toString(); 99 + }, 100 + };
+176
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/core/params.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + type Slot = 'body' | 'headers' | 'path' | 'query'; 4 + 5 + export type Field = 6 + | { 7 + in: Exclude<Slot, 'body'>; 8 + /** 9 + * Field name. This is the name we want the user to see and use. 10 + */ 11 + key: string; 12 + /** 13 + * Field mapped name. This is the name we want to use in the request. 14 + * If omitted, we use the same value as `key`. 15 + */ 16 + map?: string; 17 + } 18 + | { 19 + in: Extract<Slot, 'body'>; 20 + /** 21 + * Key isn't required for bodies. 22 + */ 23 + key?: string; 24 + map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 36 + }; 37 + 38 + export interface Fields { 39 + allowExtra?: Partial<Record<Slot, boolean>>; 40 + args?: ReadonlyArray<Field>; 41 + } 42 + 43 + export type FieldsConfig = ReadonlyArray<Field | Fields>; 44 + 45 + const extraPrefixesMap: Record<string, Slot> = { 46 + $body_: 'body', 47 + $headers_: 'headers', 48 + $path_: 'path', 49 + $query_: 'query', 50 + }; 51 + const extraPrefixes = Object.entries(extraPrefixesMap); 52 + 53 + type KeyMap = Map< 54 + string, 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 63 + >; 64 + 65 + const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { 66 + if (!map) { 67 + map = new Map(); 68 + } 69 + 70 + for (const config of fields) { 71 + if ('in' in config) { 72 + if (config.key) { 73 + map.set(config.key, { 74 + in: config.in, 75 + map: config.map, 76 + }); 77 + } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 82 + } else if (config.args) { 83 + buildKeyMap(config.args, map); 84 + } 85 + } 86 + 87 + return map; 88 + }; 89 + 90 + interface Params { 91 + body: unknown; 92 + headers: Record<string, unknown>; 93 + path: Record<string, unknown>; 94 + query: Record<string, unknown>; 95 + } 96 + 97 + const stripEmptySlots = (params: Params) => { 98 + for (const [slot, value] of Object.entries(params)) { 99 + if (value && typeof value === 'object' && !Object.keys(value).length) { 100 + delete params[slot as Slot]; 101 + } 102 + } 103 + }; 104 + 105 + export const buildClientParams = ( 106 + args: ReadonlyArray<unknown>, 107 + fields: FieldsConfig, 108 + ) => { 109 + const params: Params = { 110 + body: {}, 111 + headers: {}, 112 + path: {}, 113 + query: {}, 114 + }; 115 + 116 + const map = buildKeyMap(fields); 117 + 118 + let config: FieldsConfig[number] | undefined; 119 + 120 + for (const [index, arg] of args.entries()) { 121 + if (fields[index]) { 122 + config = fields[index]; 123 + } 124 + 125 + if (!config) { 126 + continue; 127 + } 128 + 129 + if ('in' in config) { 130 + if (config.key) { 131 + const field = map.get(config.key)!; 132 + const name = field.map || config.key; 133 + if (field.in) { 134 + (params[field.in] as Record<string, unknown>)[name] = arg; 135 + } 136 + } else { 137 + params.body = arg; 138 + } 139 + } else { 140 + for (const [key, value] of Object.entries(arg ?? {})) { 141 + const field = map.get(key); 142 + 143 + if (field) { 144 + if (field.in) { 145 + const name = field.map || key; 146 + (params[field.in] as Record<string, unknown>)[name] = value; 147 + } else { 148 + params[field.map] = value; 149 + } 150 + } else { 151 + const extra = extraPrefixes.find(([prefix]) => 152 + key.startsWith(prefix), 153 + ); 154 + 155 + if (extra) { 156 + const [prefix, slot] = extra; 157 + (params[slot] as Record<string, unknown>)[ 158 + key.slice(prefix.length) 159 + ] = value; 160 + } else if ('allowExtra' in config && config.allowExtra) { 161 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 162 + if (allowed) { 163 + (params[slot as Slot] as Record<string, unknown>)[key] = value; 164 + break; 165 + } 166 + } 167 + } 168 + } 169 + } 170 + } 171 + } 172 + 173 + stripEmptySlots(params); 174 + 175 + return params; 176 + };
+181
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/core/pathSerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + interface SerializeOptions<T> 4 + extends SerializePrimitiveOptions, 5 + SerializerOptions<T> {} 6 + 7 + interface SerializePrimitiveOptions { 8 + allowReserved?: boolean; 9 + name: string; 10 + } 11 + 12 + export interface SerializerOptions<T> { 13 + /** 14 + * @default true 15 + */ 16 + explode: boolean; 17 + style: T; 18 + } 19 + 20 + export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; 21 + export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; 22 + type MatrixStyle = 'label' | 'matrix' | 'simple'; 23 + export type ObjectStyle = 'form' | 'deepObject'; 24 + type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; 25 + 26 + interface SerializePrimitiveParam extends SerializePrimitiveOptions { 27 + value: string; 28 + } 29 + 30 + export const separatorArrayExplode = (style: ArraySeparatorStyle) => { 31 + switch (style) { 32 + case 'label': 33 + return '.'; 34 + case 'matrix': 35 + return ';'; 36 + case 'simple': 37 + return ','; 38 + default: 39 + return '&'; 40 + } 41 + }; 42 + 43 + export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { 44 + switch (style) { 45 + case 'form': 46 + return ','; 47 + case 'pipeDelimited': 48 + return '|'; 49 + case 'spaceDelimited': 50 + return '%20'; 51 + default: 52 + return ','; 53 + } 54 + }; 55 + 56 + export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { 57 + switch (style) { 58 + case 'label': 59 + return '.'; 60 + case 'matrix': 61 + return ';'; 62 + case 'simple': 63 + return ','; 64 + default: 65 + return '&'; 66 + } 67 + }; 68 + 69 + export const serializeArrayParam = ({ 70 + allowReserved, 71 + explode, 72 + name, 73 + style, 74 + value, 75 + }: SerializeOptions<ArraySeparatorStyle> & { 76 + value: unknown[]; 77 + }) => { 78 + if (!explode) { 79 + const joinedValues = ( 80 + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) 81 + ).join(separatorArrayNoExplode(style)); 82 + switch (style) { 83 + case 'label': 84 + return `.${joinedValues}`; 85 + case 'matrix': 86 + return `;${name}=${joinedValues}`; 87 + case 'simple': 88 + return joinedValues; 89 + default: 90 + return `${name}=${joinedValues}`; 91 + } 92 + } 93 + 94 + const separator = separatorArrayExplode(style); 95 + const joinedValues = value 96 + .map((v) => { 97 + if (style === 'label' || style === 'simple') { 98 + return allowReserved ? v : encodeURIComponent(v as string); 99 + } 100 + 101 + return serializePrimitiveParam({ 102 + allowReserved, 103 + name, 104 + value: v as string, 105 + }); 106 + }) 107 + .join(separator); 108 + return style === 'label' || style === 'matrix' 109 + ? separator + joinedValues 110 + : joinedValues; 111 + }; 112 + 113 + export const serializePrimitiveParam = ({ 114 + allowReserved, 115 + name, 116 + value, 117 + }: SerializePrimitiveParam) => { 118 + if (value === undefined || value === null) { 119 + return ''; 120 + } 121 + 122 + if (typeof value === 'object') { 123 + throw new Error( 124 + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', 125 + ); 126 + } 127 + 128 + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; 129 + }; 130 + 131 + export const serializeObjectParam = ({ 132 + allowReserved, 133 + explode, 134 + name, 135 + style, 136 + value, 137 + valueOnly, 138 + }: SerializeOptions<ObjectSeparatorStyle> & { 139 + value: Record<string, unknown> | Date; 140 + valueOnly?: boolean; 141 + }) => { 142 + if (value instanceof Date) { 143 + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; 144 + } 145 + 146 + if (style !== 'deepObject' && !explode) { 147 + let values: string[] = []; 148 + Object.entries(value).forEach(([key, v]) => { 149 + values = [ 150 + ...values, 151 + key, 152 + allowReserved ? (v as string) : encodeURIComponent(v as string), 153 + ]; 154 + }); 155 + const joinedValues = values.join(','); 156 + switch (style) { 157 + case 'form': 158 + return `${name}=${joinedValues}`; 159 + case 'label': 160 + return `.${joinedValues}`; 161 + case 'matrix': 162 + return `;${name}=${joinedValues}`; 163 + default: 164 + return joinedValues; 165 + } 166 + } 167 + 168 + const separator = separatorObjectExplode(style); 169 + const joinedValues = Object.entries(value) 170 + .map(([key, v]) => 171 + serializePrimitiveParam({ 172 + allowReserved, 173 + name: style === 'deepObject' ? `${name}[${key}]` : key, 174 + value: v as string, 175 + }), 176 + ) 177 + .join(separator); 178 + return style === 'label' || style === 'matrix' 179 + ? separator + joinedValues 180 + : joinedValues; 181 + };
+136
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/core/queryKeySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + /** 4 + * JSON-friendly union that mirrors what Pinia Colada can hash. 5 + */ 6 + export type JsonValue = 7 + | null 8 + | string 9 + | number 10 + | boolean 11 + | JsonValue[] 12 + | { [key: string]: JsonValue }; 13 + 14 + /** 15 + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. 16 + */ 17 + export const queryKeyJsonReplacer = (_key: string, value: unknown) => { 18 + if ( 19 + value === undefined || 20 + typeof value === 'function' || 21 + typeof value === 'symbol' 22 + ) { 23 + return undefined; 24 + } 25 + if (typeof value === 'bigint') { 26 + return value.toString(); 27 + } 28 + if (value instanceof Date) { 29 + return value.toISOString(); 30 + } 31 + return value; 32 + }; 33 + 34 + /** 35 + * Safely stringifies a value and parses it back into a JsonValue. 36 + */ 37 + export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { 38 + try { 39 + const json = JSON.stringify(input, queryKeyJsonReplacer); 40 + if (json === undefined) { 41 + return undefined; 42 + } 43 + return JSON.parse(json) as JsonValue; 44 + } catch { 45 + return undefined; 46 + } 47 + }; 48 + 49 + /** 50 + * Detects plain objects (including objects with a null prototype). 51 + */ 52 + const isPlainObject = (value: unknown): value is Record<string, unknown> => { 53 + if (value === null || typeof value !== 'object') { 54 + return false; 55 + } 56 + const prototype = Object.getPrototypeOf(value as object); 57 + return prototype === Object.prototype || prototype === null; 58 + }; 59 + 60 + /** 61 + * Turns URLSearchParams into a sorted JSON object for deterministic keys. 62 + */ 63 + const serializeSearchParams = (params: URLSearchParams): JsonValue => { 64 + const entries = Array.from(params.entries()).sort(([a], [b]) => 65 + a.localeCompare(b), 66 + ); 67 + const result: Record<string, JsonValue> = {}; 68 + 69 + for (const [key, value] of entries) { 70 + const existing = result[key]; 71 + if (existing === undefined) { 72 + result[key] = value; 73 + continue; 74 + } 75 + 76 + if (Array.isArray(existing)) { 77 + (existing as string[]).push(value); 78 + } else { 79 + result[key] = [existing, value]; 80 + } 81 + } 82 + 83 + return result; 84 + }; 85 + 86 + /** 87 + * Normalizes any accepted value into a JSON-friendly shape for query keys. 88 + */ 89 + export const serializeQueryKeyValue = ( 90 + value: unknown, 91 + ): JsonValue | undefined => { 92 + if (value === null) { 93 + return null; 94 + } 95 + 96 + if ( 97 + typeof value === 'string' || 98 + typeof value === 'number' || 99 + typeof value === 'boolean' 100 + ) { 101 + return value; 102 + } 103 + 104 + if ( 105 + value === undefined || 106 + typeof value === 'function' || 107 + typeof value === 'symbol' 108 + ) { 109 + return undefined; 110 + } 111 + 112 + if (typeof value === 'bigint') { 113 + return value.toString(); 114 + } 115 + 116 + if (value instanceof Date) { 117 + return value.toISOString(); 118 + } 119 + 120 + if (Array.isArray(value)) { 121 + return stringifyToJsonValue(value); 122 + } 123 + 124 + if ( 125 + typeof URLSearchParams !== 'undefined' && 126 + value instanceof URLSearchParams 127 + ) { 128 + return serializeSearchParams(value); 129 + } 130 + 131 + if (isPlainObject(value)) { 132 + return stringifyToJsonValue(value); 133 + } 134 + 135 + return undefined; 136 + };
+264
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/core/serverSentEvents.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Config } from './types.gen'; 4 + 5 + export type ServerSentEventsOptions<TData = unknown> = Omit< 6 + RequestInit, 7 + 'method' 8 + > & 9 + Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & { 10 + /** 11 + * Fetch API implementation. You can use this option to provide a custom 12 + * fetch instance. 13 + * 14 + * @default globalThis.fetch 15 + */ 16 + fetch?: typeof fetch; 17 + /** 18 + * Implementing clients can call request interceptors inside this hook. 19 + */ 20 + onRequest?: (url: string, init: RequestInit) => Promise<Request>; 21 + /** 22 + * Callback invoked when a network or parsing error occurs during streaming. 23 + * 24 + * This option applies only if the endpoint returns a stream of events. 25 + * 26 + * @param error The error that occurred. 27 + */ 28 + onSseError?: (error: unknown) => void; 29 + /** 30 + * Callback invoked when an event is streamed from the server. 31 + * 32 + * This option applies only if the endpoint returns a stream of events. 33 + * 34 + * @param event Event streamed from the server. 35 + * @returns Nothing (void). 36 + */ 37 + onSseEvent?: (event: StreamEvent<TData>) => void; 38 + serializedBody?: RequestInit['body']; 39 + /** 40 + * Default retry delay in milliseconds. 41 + * 42 + * This option applies only if the endpoint returns a stream of events. 43 + * 44 + * @default 3000 45 + */ 46 + sseDefaultRetryDelay?: number; 47 + /** 48 + * Maximum number of retry attempts before giving up. 49 + */ 50 + sseMaxRetryAttempts?: number; 51 + /** 52 + * Maximum retry delay in milliseconds. 53 + * 54 + * Applies only when exponential backoff is used. 55 + * 56 + * This option applies only if the endpoint returns a stream of events. 57 + * 58 + * @default 30000 59 + */ 60 + sseMaxRetryDelay?: number; 61 + /** 62 + * Optional sleep function for retry backoff. 63 + * 64 + * Defaults to using `setTimeout`. 65 + */ 66 + sseSleepFn?: (ms: number) => Promise<void>; 67 + url: string; 68 + }; 69 + 70 + export interface StreamEvent<TData = unknown> { 71 + data: TData; 72 + event?: string; 73 + id?: string; 74 + retry?: number; 75 + } 76 + 77 + export type ServerSentEventsResult< 78 + TData = unknown, 79 + TReturn = void, 80 + TNext = unknown, 81 + > = { 82 + stream: AsyncGenerator< 83 + TData extends Record<string, unknown> ? TData[keyof TData] : TData, 84 + TReturn, 85 + TNext 86 + >; 87 + }; 88 + 89 + export const createSseClient = <TData = unknown>({ 90 + onRequest, 91 + onSseError, 92 + onSseEvent, 93 + responseTransformer, 94 + responseValidator, 95 + sseDefaultRetryDelay, 96 + sseMaxRetryAttempts, 97 + sseMaxRetryDelay, 98 + sseSleepFn, 99 + url, 100 + ...options 101 + }: ServerSentEventsOptions): ServerSentEventsResult<TData> => { 102 + let lastEventId: string | undefined; 103 + 104 + const sleep = 105 + sseSleepFn ?? 106 + ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); 107 + 108 + const createStream = async function* () { 109 + let retryDelay: number = sseDefaultRetryDelay ?? 3000; 110 + let attempt = 0; 111 + const signal = options.signal ?? new AbortController().signal; 112 + 113 + while (true) { 114 + if (signal.aborted) break; 115 + 116 + attempt++; 117 + 118 + const headers = 119 + options.headers instanceof Headers 120 + ? options.headers 121 + : new Headers(options.headers as Record<string, string> | undefined); 122 + 123 + if (lastEventId !== undefined) { 124 + headers.set('Last-Event-ID', lastEventId); 125 + } 126 + 127 + try { 128 + const requestInit: RequestInit = { 129 + redirect: 'follow', 130 + ...options, 131 + body: options.serializedBody, 132 + headers, 133 + signal, 134 + }; 135 + let request = new Request(url, requestInit); 136 + if (onRequest) { 137 + request = await onRequest(url, requestInit); 138 + } 139 + // fetch must be assigned here, otherwise it would throw the error: 140 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 141 + const _fetch = options.fetch ?? globalThis.fetch; 142 + const response = await _fetch(request); 143 + 144 + if (!response.ok) 145 + throw new Error( 146 + `SSE failed: ${response.status} ${response.statusText}`, 147 + ); 148 + 149 + if (!response.body) throw new Error('No body in SSE response'); 150 + 151 + const reader = response.body 152 + .pipeThrough(new TextDecoderStream()) 153 + .getReader(); 154 + 155 + let buffer = ''; 156 + 157 + const abortHandler = () => { 158 + try { 159 + reader.cancel(); 160 + } catch { 161 + // noop 162 + } 163 + }; 164 + 165 + signal.addEventListener('abort', abortHandler); 166 + 167 + try { 168 + while (true) { 169 + const { done, value } = await reader.read(); 170 + if (done) break; 171 + buffer += value; 172 + 173 + const chunks = buffer.split('\n\n'); 174 + buffer = chunks.pop() ?? ''; 175 + 176 + for (const chunk of chunks) { 177 + const lines = chunk.split('\n'); 178 + const dataLines: Array<string> = []; 179 + let eventName: string | undefined; 180 + 181 + for (const line of lines) { 182 + if (line.startsWith('data:')) { 183 + dataLines.push(line.replace(/^data:\s*/, '')); 184 + } else if (line.startsWith('event:')) { 185 + eventName = line.replace(/^event:\s*/, ''); 186 + } else if (line.startsWith('id:')) { 187 + lastEventId = line.replace(/^id:\s*/, ''); 188 + } else if (line.startsWith('retry:')) { 189 + const parsed = Number.parseInt( 190 + line.replace(/^retry:\s*/, ''), 191 + 10, 192 + ); 193 + if (!Number.isNaN(parsed)) { 194 + retryDelay = parsed; 195 + } 196 + } 197 + } 198 + 199 + let data: unknown; 200 + let parsedJson = false; 201 + 202 + if (dataLines.length) { 203 + const rawData = dataLines.join('\n'); 204 + try { 205 + data = JSON.parse(rawData); 206 + parsedJson = true; 207 + } catch { 208 + data = rawData; 209 + } 210 + } 211 + 212 + if (parsedJson) { 213 + if (responseValidator) { 214 + await responseValidator(data); 215 + } 216 + 217 + if (responseTransformer) { 218 + data = await responseTransformer(data); 219 + } 220 + } 221 + 222 + onSseEvent?.({ 223 + data, 224 + event: eventName, 225 + id: lastEventId, 226 + retry: retryDelay, 227 + }); 228 + 229 + if (dataLines.length) { 230 + yield data as any; 231 + } 232 + } 233 + } 234 + } finally { 235 + signal.removeEventListener('abort', abortHandler); 236 + reader.releaseLock(); 237 + } 238 + 239 + break; // exit loop on normal completion 240 + } catch (error) { 241 + // connection failed or aborted; retry after delay 242 + onSseError?.(error); 243 + 244 + if ( 245 + sseMaxRetryAttempts !== undefined && 246 + attempt >= sseMaxRetryAttempts 247 + ) { 248 + break; // stop after firing error 249 + } 250 + 251 + // exponential backoff: double retry each attempt, cap at 30s 252 + const backoff = Math.min( 253 + retryDelay * 2 ** (attempt - 1), 254 + sseMaxRetryDelay ?? 30000, 255 + ); 256 + await sleep(backoff); 257 + } 258 + } 259 + }; 260 + 261 + const stream = createStream(); 262 + 263 + return { stream }; 264 + };
+118
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/core/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth, AuthToken } from './auth.gen'; 4 + import type { 5 + BodySerializer, 6 + QuerySerializer, 7 + QuerySerializerOptions, 8 + } from './bodySerializer.gen'; 9 + 10 + export type HttpMethod = 11 + | 'connect' 12 + | 'delete' 13 + | 'get' 14 + | 'head' 15 + | 'options' 16 + | 'patch' 17 + | 'post' 18 + | 'put' 19 + | 'trace'; 20 + 21 + export type Client< 22 + RequestFn = never, 23 + Config = unknown, 24 + MethodFn = never, 25 + BuildUrlFn = never, 26 + SseFn = never, 27 + > = { 28 + /** 29 + * Returns the final request URL. 30 + */ 31 + buildUrl: BuildUrlFn; 32 + getConfig: () => Config; 33 + request: RequestFn; 34 + setConfig: (config: Config) => Config; 35 + } & { 36 + [K in HttpMethod]: MethodFn; 37 + } & ([SseFn] extends [never] 38 + ? { sse?: never } 39 + : { sse: { [K in HttpMethod]: SseFn } }); 40 + 41 + export interface Config { 42 + /** 43 + * Auth token or a function returning auth token. The resolved value will be 44 + * added to the request payload as defined by its `security` array. 45 + */ 46 + auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken; 47 + /** 48 + * A function for serializing request body parameter. By default, 49 + * {@link JSON.stringify()} will be used. 50 + */ 51 + bodySerializer?: BodySerializer | null; 52 + /** 53 + * An object containing any HTTP headers that you want to pre-populate your 54 + * `Headers` object with. 55 + * 56 + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 57 + */ 58 + headers?: 59 + | RequestInit['headers'] 60 + | Record< 61 + string, 62 + | string 63 + | number 64 + | boolean 65 + | (string | number | boolean)[] 66 + | null 67 + | undefined 68 + | unknown 69 + >; 70 + /** 71 + * The request method. 72 + * 73 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} 74 + */ 75 + method?: Uppercase<HttpMethod>; 76 + /** 77 + * A function for serializing request query parameters. By default, arrays 78 + * will be exploded in form style, objects will be exploded in deepObject 79 + * style, and reserved characters are percent-encoded. 80 + * 81 + * This method will have no effect if the native `paramsSerializer()` Axios 82 + * API function is used. 83 + * 84 + * {@link https://swagger.io/docs/specification/serialization/#query View examples} 85 + */ 86 + querySerializer?: QuerySerializer | QuerySerializerOptions; 87 + /** 88 + * A function validating request data. This is useful if you want to ensure 89 + * the request conforms to the desired shape, so it can be safely sent to 90 + * the server. 91 + */ 92 + requestValidator?: (data: unknown) => Promise<unknown>; 93 + /** 94 + * A function transforming response data before it's returned. This is useful 95 + * for post-processing data, e.g. converting ISO strings into Date objects. 96 + */ 97 + responseTransformer?: (data: unknown) => Promise<unknown>; 98 + /** 99 + * A function validating response data. This is useful if you want to ensure 100 + * the response conforms to the desired shape, so it can be safely passed to 101 + * the transformers and returned to the user. 102 + */ 103 + responseValidator?: (data: unknown) => Promise<unknown>; 104 + } 105 + 106 + type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 + ? true 108 + : [T] extends [never | undefined] 109 + ? [undefined] extends [T] 110 + ? false 111 + : true 112 + : false; 113 + 114 + export type OmitNever<T extends Record<string, unknown>> = { 115 + [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 + ? never 117 + : K]: T[K]; 118 + };
+143
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/core/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; 4 + import { 5 + type ArraySeparatorStyle, 6 + serializeArrayParam, 7 + serializeObjectParam, 8 + serializePrimitiveParam, 9 + } from './pathSerializer.gen'; 10 + 11 + export interface PathSerializer { 12 + path: Record<string, unknown>; 13 + url: string; 14 + } 15 + 16 + export const PATH_PARAM_RE = /\{[^{}]+\}/g; 17 + 18 + export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { 19 + let url = _url; 20 + const matches = _url.match(PATH_PARAM_RE); 21 + if (matches) { 22 + for (const match of matches) { 23 + let explode = false; 24 + let name = match.substring(1, match.length - 1); 25 + let style: ArraySeparatorStyle = 'simple'; 26 + 27 + if (name.endsWith('*')) { 28 + explode = true; 29 + name = name.substring(0, name.length - 1); 30 + } 31 + 32 + if (name.startsWith('.')) { 33 + name = name.substring(1); 34 + style = 'label'; 35 + } else if (name.startsWith(';')) { 36 + name = name.substring(1); 37 + style = 'matrix'; 38 + } 39 + 40 + const value = path[name]; 41 + 42 + if (value === undefined || value === null) { 43 + continue; 44 + } 45 + 46 + if (Array.isArray(value)) { 47 + url = url.replace( 48 + match, 49 + serializeArrayParam({ explode, name, style, value }), 50 + ); 51 + continue; 52 + } 53 + 54 + if (typeof value === 'object') { 55 + url = url.replace( 56 + match, 57 + serializeObjectParam({ 58 + explode, 59 + name, 60 + style, 61 + value: value as Record<string, unknown>, 62 + valueOnly: true, 63 + }), 64 + ); 65 + continue; 66 + } 67 + 68 + if (style === 'matrix') { 69 + url = url.replace( 70 + match, 71 + `;${serializePrimitiveParam({ 72 + name, 73 + value: value as string, 74 + })}`, 75 + ); 76 + continue; 77 + } 78 + 79 + const replaceValue = encodeURIComponent( 80 + style === 'label' ? `.${value as string}` : (value as string), 81 + ); 82 + url = url.replace(match, replaceValue); 83 + } 84 + } 85 + return url; 86 + }; 87 + 88 + export const getUrl = ({ 89 + baseUrl, 90 + path, 91 + query, 92 + querySerializer, 93 + url: _url, 94 + }: { 95 + baseUrl?: string; 96 + path?: Record<string, unknown>; 97 + query?: Record<string, unknown>; 98 + querySerializer: QuerySerializer; 99 + url: string; 100 + }) => { 101 + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; 102 + let url = (baseUrl ?? '') + pathUrl; 103 + if (path) { 104 + url = defaultPathSerializer({ path, url }); 105 + } 106 + let search = query ? querySerializer(query) : ''; 107 + if (search.startsWith('?')) { 108 + search = search.substring(1); 109 + } 110 + if (search) { 111 + url += `?${search}`; 112 + } 113 + return url; 114 + }; 115 + 116 + export function getValidRequestBody(options: { 117 + body?: unknown; 118 + bodySerializer?: BodySerializer | null; 119 + serializedBody?: unknown; 120 + }) { 121 + const hasBody = options.body !== undefined; 122 + const isSerializedBody = hasBody && options.bodySerializer; 123 + 124 + if (isSerializedBody) { 125 + if ('serializedBody' in options) { 126 + const hasSerializedBody = 127 + options.serializedBody !== undefined && options.serializedBody !== ''; 128 + 129 + return hasSerializedBody ? options.serializedBody : null; 130 + } 131 + 132 + // not all clients implement a serializedBody property (i.e. client-axios) 133 + return options.body !== '' ? options.body : null; 134 + } 135 + 136 + // plain/text body 137 + if (hasBody) { 138 + return options.body; 139 + } 140 + 141 + // no body was provided 142 + return undefined; 143 + }
+4
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type * from './types.gen'; 4 + export * from './sdk.gen';
+471
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/sdk.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Client, Options as Options2, TDataShape } from './client'; 4 + import { client } from './client.gen'; 5 + import type { AppAgentsData, AppAgentsResponses, AppGetData, AppGetResponses, AppInitData, AppInitResponses, AppLogData, AppLogResponses, AuthSetData, AuthSetErrors, AuthSetResponses, ConfigGetData, ConfigGetResponses, ConfigProvidersData, ConfigProvidersResponses, EventSubscribeData, EventSubscribeResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FindTextData, FindTextResponses, PostSessionByIdPermissionsByPermissionIdData, PostSessionByIdPermissionsByPermissionIdResponses, SessionAbortData, SessionAbortResponses, SessionChatData, SessionChatResponses, SessionChildrenData, SessionChildrenResponses, SessionCreateData, SessionCreateErrors, SessionCreateResponses, SessionDeleteData, SessionDeleteResponses, SessionGetData, SessionGetResponses, SessionInitData, SessionInitResponses, SessionListData, SessionListResponses, SessionMessageData, SessionMessageResponses, SessionMessagesData, SessionMessagesResponses, SessionRevertData, SessionRevertResponses, SessionShareData, SessionShareResponses, SessionShellData, SessionShellResponses, SessionSummarizeData, SessionSummarizeResponses, SessionUnrevertData, SessionUnrevertResponses, SessionUnshareData, SessionUnshareResponses, SessionUpdateData, SessionUpdateResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiClearPromptData, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponses, TuiOpenHelpData, TuiOpenHelpResponses, TuiOpenModelsData, TuiOpenModelsResponses, TuiOpenSessionsData, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponses, TuiShowToastData, TuiShowToastResponses, TuiSubmitPromptData, TuiSubmitPromptResponses } from './types.gen'; 6 + 7 + export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & { 8 + /** 9 + * You can provide a client instance returned by `createClient()` instead of 10 + * individual options. This might be also useful if you want to implement a 11 + * custom client. 12 + */ 13 + client?: Client; 14 + /** 15 + * You can pass arbitrary values through the `meta` object. This can be 16 + * used to access values that aren't defined as part of the SDK function. 17 + */ 18 + meta?: Record<string, unknown>; 19 + }; 20 + 21 + /** 22 + * Get events 23 + */ 24 + export const eventSubscribe = <ThrowOnError extends boolean = false>(options?: Options<EventSubscribeData, ThrowOnError>) => { 25 + return (options?.client ?? client).sse.get<EventSubscribeResponses, unknown, ThrowOnError>({ 26 + url: '/event', 27 + ...options 28 + }); 29 + }; 30 + 31 + /** 32 + * Get app info 33 + */ 34 + export const appGet = <ThrowOnError extends boolean = false>(options?: Options<AppGetData, ThrowOnError>) => { 35 + return (options?.client ?? client).get<AppGetResponses, unknown, ThrowOnError>({ 36 + url: '/app', 37 + ...options 38 + }); 39 + }; 40 + 41 + /** 42 + * Initialize the app 43 + */ 44 + export const appInit = <ThrowOnError extends boolean = false>(options?: Options<AppInitData, ThrowOnError>) => { 45 + return (options?.client ?? client).post<AppInitResponses, unknown, ThrowOnError>({ 46 + url: '/app/init', 47 + ...options 48 + }); 49 + }; 50 + 51 + /** 52 + * Get config info 53 + */ 54 + export const configGet = <ThrowOnError extends boolean = false>(options?: Options<ConfigGetData, ThrowOnError>) => { 55 + return (options?.client ?? client).get<ConfigGetResponses, unknown, ThrowOnError>({ 56 + url: '/config', 57 + ...options 58 + }); 59 + }; 60 + 61 + /** 62 + * List all sessions 63 + */ 64 + export const sessionList = <ThrowOnError extends boolean = false>(options?: Options<SessionListData, ThrowOnError>) => { 65 + return (options?.client ?? client).get<SessionListResponses, unknown, ThrowOnError>({ 66 + url: '/session', 67 + ...options 68 + }); 69 + }; 70 + 71 + /** 72 + * Create a new session 73 + */ 74 + export const sessionCreate = <ThrowOnError extends boolean = false>(options?: Options<SessionCreateData, ThrowOnError>) => { 75 + return (options?.client ?? client).post<SessionCreateResponses, SessionCreateErrors, ThrowOnError>({ 76 + url: '/session', 77 + ...options, 78 + headers: { 79 + 'Content-Type': 'application/json', 80 + ...options?.headers 81 + } 82 + }); 83 + }; 84 + 85 + /** 86 + * Delete a session and all its data 87 + */ 88 + export const sessionDelete = <ThrowOnError extends boolean = false>(options: Options<SessionDeleteData, ThrowOnError>) => { 89 + return (options.client ?? client).delete<SessionDeleteResponses, unknown, ThrowOnError>({ 90 + url: '/session/{id}', 91 + ...options 92 + }); 93 + }; 94 + 95 + /** 96 + * Get session 97 + */ 98 + export const sessionGet = <ThrowOnError extends boolean = false>(options: Options<SessionGetData, ThrowOnError>) => { 99 + return (options.client ?? client).get<SessionGetResponses, unknown, ThrowOnError>({ 100 + url: '/session/{id}', 101 + ...options 102 + }); 103 + }; 104 + 105 + /** 106 + * Update session properties 107 + */ 108 + export const sessionUpdate = <ThrowOnError extends boolean = false>(options: Options<SessionUpdateData, ThrowOnError>) => { 109 + return (options.client ?? client).patch<SessionUpdateResponses, unknown, ThrowOnError>({ 110 + url: '/session/{id}', 111 + ...options, 112 + headers: { 113 + 'Content-Type': 'application/json', 114 + ...options.headers 115 + } 116 + }); 117 + }; 118 + 119 + /** 120 + * Get a session's children 121 + */ 122 + export const sessionChildren = <ThrowOnError extends boolean = false>(options: Options<SessionChildrenData, ThrowOnError>) => { 123 + return (options.client ?? client).get<SessionChildrenResponses, unknown, ThrowOnError>({ 124 + url: '/session/{id}/children', 125 + ...options 126 + }); 127 + }; 128 + 129 + /** 130 + * Analyze the app and create an AGENTS.md file 131 + */ 132 + export const sessionInit = <ThrowOnError extends boolean = false>(options: Options<SessionInitData, ThrowOnError>) => { 133 + return (options.client ?? client).post<SessionInitResponses, unknown, ThrowOnError>({ 134 + url: '/session/{id}/init', 135 + ...options, 136 + headers: { 137 + 'Content-Type': 'application/json', 138 + ...options.headers 139 + } 140 + }); 141 + }; 142 + 143 + /** 144 + * Abort a session 145 + */ 146 + export const sessionAbort = <ThrowOnError extends boolean = false>(options: Options<SessionAbortData, ThrowOnError>) => { 147 + return (options.client ?? client).post<SessionAbortResponses, unknown, ThrowOnError>({ 148 + url: '/session/{id}/abort', 149 + ...options 150 + }); 151 + }; 152 + 153 + /** 154 + * Unshare the session 155 + */ 156 + export const sessionUnshare = <ThrowOnError extends boolean = false>(options: Options<SessionUnshareData, ThrowOnError>) => { 157 + return (options.client ?? client).delete<SessionUnshareResponses, unknown, ThrowOnError>({ 158 + url: '/session/{id}/share', 159 + ...options 160 + }); 161 + }; 162 + 163 + /** 164 + * Share a session 165 + */ 166 + export const sessionShare = <ThrowOnError extends boolean = false>(options: Options<SessionShareData, ThrowOnError>) => { 167 + return (options.client ?? client).post<SessionShareResponses, unknown, ThrowOnError>({ 168 + url: '/session/{id}/share', 169 + ...options 170 + }); 171 + }; 172 + 173 + /** 174 + * Summarize the session 175 + */ 176 + export const sessionSummarize = <ThrowOnError extends boolean = false>(options: Options<SessionSummarizeData, ThrowOnError>) => { 177 + return (options.client ?? client).post<SessionSummarizeResponses, unknown, ThrowOnError>({ 178 + url: '/session/{id}/summarize', 179 + ...options, 180 + headers: { 181 + 'Content-Type': 'application/json', 182 + ...options.headers 183 + } 184 + }); 185 + }; 186 + 187 + /** 188 + * List messages for a session 189 + */ 190 + export const sessionMessages = <ThrowOnError extends boolean = false>(options: Options<SessionMessagesData, ThrowOnError>) => { 191 + return (options.client ?? client).get<SessionMessagesResponses, unknown, ThrowOnError>({ 192 + url: '/session/{id}/message', 193 + ...options 194 + }); 195 + }; 196 + 197 + /** 198 + * Create and send a new message to a session 199 + */ 200 + export const sessionChat = <ThrowOnError extends boolean = false>(options: Options<SessionChatData, ThrowOnError>) => { 201 + return (options.client ?? client).post<SessionChatResponses, unknown, ThrowOnError>({ 202 + url: '/session/{id}/message', 203 + ...options, 204 + headers: { 205 + 'Content-Type': 'application/json', 206 + ...options.headers 207 + } 208 + }); 209 + }; 210 + 211 + /** 212 + * Get a message from a session 213 + */ 214 + export const sessionMessage = <ThrowOnError extends boolean = false>(options: Options<SessionMessageData, ThrowOnError>) => { 215 + return (options.client ?? client).get<SessionMessageResponses, unknown, ThrowOnError>({ 216 + url: '/session/{id}/message/{messageID}', 217 + ...options 218 + }); 219 + }; 220 + 221 + /** 222 + * Run a shell command 223 + */ 224 + export const sessionShell = <ThrowOnError extends boolean = false>(options: Options<SessionShellData, ThrowOnError>) => { 225 + return (options.client ?? client).post<SessionShellResponses, unknown, ThrowOnError>({ 226 + url: '/session/{id}/shell', 227 + ...options, 228 + headers: { 229 + 'Content-Type': 'application/json', 230 + ...options.headers 231 + } 232 + }); 233 + }; 234 + 235 + /** 236 + * Revert a message 237 + */ 238 + export const sessionRevert = <ThrowOnError extends boolean = false>(options: Options<SessionRevertData, ThrowOnError>) => { 239 + return (options.client ?? client).post<SessionRevertResponses, unknown, ThrowOnError>({ 240 + url: '/session/{id}/revert', 241 + ...options, 242 + headers: { 243 + 'Content-Type': 'application/json', 244 + ...options.headers 245 + } 246 + }); 247 + }; 248 + 249 + /** 250 + * Restore all reverted messages 251 + */ 252 + export const sessionUnrevert = <ThrowOnError extends boolean = false>(options: Options<SessionUnrevertData, ThrowOnError>) => { 253 + return (options.client ?? client).post<SessionUnrevertResponses, unknown, ThrowOnError>({ 254 + url: '/session/{id}/unrevert', 255 + ...options 256 + }); 257 + }; 258 + 259 + /** 260 + * Respond to a permission request 261 + */ 262 + export const postSessionByIdPermissionsByPermissionId = <ThrowOnError extends boolean = false>(options: Options<PostSessionByIdPermissionsByPermissionIdData, ThrowOnError>) => { 263 + return (options.client ?? client).post<PostSessionByIdPermissionsByPermissionIdResponses, unknown, ThrowOnError>({ 264 + url: '/session/{id}/permissions/{permissionID}', 265 + ...options, 266 + headers: { 267 + 'Content-Type': 'application/json', 268 + ...options.headers 269 + } 270 + }); 271 + }; 272 + 273 + /** 274 + * List all providers 275 + */ 276 + export const configProviders = <ThrowOnError extends boolean = false>(options?: Options<ConfigProvidersData, ThrowOnError>) => { 277 + return (options?.client ?? client).get<ConfigProvidersResponses, unknown, ThrowOnError>({ 278 + url: '/config/providers', 279 + ...options 280 + }); 281 + }; 282 + 283 + /** 284 + * Find text in files 285 + */ 286 + export const findText = <ThrowOnError extends boolean = false>(options: Options<FindTextData, ThrowOnError>) => { 287 + return (options.client ?? client).get<FindTextResponses, unknown, ThrowOnError>({ 288 + url: '/find', 289 + ...options 290 + }); 291 + }; 292 + 293 + /** 294 + * Find files 295 + */ 296 + export const findFiles = <ThrowOnError extends boolean = false>(options: Options<FindFilesData, ThrowOnError>) => { 297 + return (options.client ?? client).get<FindFilesResponses, unknown, ThrowOnError>({ 298 + url: '/find/file', 299 + ...options 300 + }); 301 + }; 302 + 303 + /** 304 + * Find workspace symbols 305 + */ 306 + export const findSymbols = <ThrowOnError extends boolean = false>(options: Options<FindSymbolsData, ThrowOnError>) => { 307 + return (options.client ?? client).get<FindSymbolsResponses, unknown, ThrowOnError>({ 308 + url: '/find/symbol', 309 + ...options 310 + }); 311 + }; 312 + 313 + /** 314 + * Read a file 315 + */ 316 + export const fileRead = <ThrowOnError extends boolean = false>(options: Options<FileReadData, ThrowOnError>) => { 317 + return (options.client ?? client).get<FileReadResponses, unknown, ThrowOnError>({ 318 + url: '/file', 319 + ...options 320 + }); 321 + }; 322 + 323 + /** 324 + * Get file status 325 + */ 326 + export const fileStatus = <ThrowOnError extends boolean = false>(options?: Options<FileStatusData, ThrowOnError>) => { 327 + return (options?.client ?? client).get<FileStatusResponses, unknown, ThrowOnError>({ 328 + url: '/file/status', 329 + ...options 330 + }); 331 + }; 332 + 333 + /** 334 + * Write a log entry to the server logs 335 + */ 336 + export const appLog = <ThrowOnError extends boolean = false>(options?: Options<AppLogData, ThrowOnError>) => { 337 + return (options?.client ?? client).post<AppLogResponses, unknown, ThrowOnError>({ 338 + url: '/log', 339 + ...options, 340 + headers: { 341 + 'Content-Type': 'application/json', 342 + ...options?.headers 343 + } 344 + }); 345 + }; 346 + 347 + /** 348 + * List all agents 349 + */ 350 + export const appAgents = <ThrowOnError extends boolean = false>(options?: Options<AppAgentsData, ThrowOnError>) => { 351 + return (options?.client ?? client).get<AppAgentsResponses, unknown, ThrowOnError>({ 352 + url: '/agent', 353 + ...options 354 + }); 355 + }; 356 + 357 + /** 358 + * Append prompt to the TUI 359 + */ 360 + export const tuiAppendPrompt = <ThrowOnError extends boolean = false>(options?: Options<TuiAppendPromptData, ThrowOnError>) => { 361 + return (options?.client ?? client).post<TuiAppendPromptResponses, unknown, ThrowOnError>({ 362 + url: '/tui/append-prompt', 363 + ...options, 364 + headers: { 365 + 'Content-Type': 'application/json', 366 + ...options?.headers 367 + } 368 + }); 369 + }; 370 + 371 + /** 372 + * Open the help dialog 373 + */ 374 + export const tuiOpenHelp = <ThrowOnError extends boolean = false>(options?: Options<TuiOpenHelpData, ThrowOnError>) => { 375 + return (options?.client ?? client).post<TuiOpenHelpResponses, unknown, ThrowOnError>({ 376 + url: '/tui/open-help', 377 + ...options 378 + }); 379 + }; 380 + 381 + /** 382 + * Open the session dialog 383 + */ 384 + export const tuiOpenSessions = <ThrowOnError extends boolean = false>(options?: Options<TuiOpenSessionsData, ThrowOnError>) => { 385 + return (options?.client ?? client).post<TuiOpenSessionsResponses, unknown, ThrowOnError>({ 386 + url: '/tui/open-sessions', 387 + ...options 388 + }); 389 + }; 390 + 391 + /** 392 + * Open the theme dialog 393 + */ 394 + export const tuiOpenThemes = <ThrowOnError extends boolean = false>(options?: Options<TuiOpenThemesData, ThrowOnError>) => { 395 + return (options?.client ?? client).post<TuiOpenThemesResponses, unknown, ThrowOnError>({ 396 + url: '/tui/open-themes', 397 + ...options 398 + }); 399 + }; 400 + 401 + /** 402 + * Open the model dialog 403 + */ 404 + export const tuiOpenModels = <ThrowOnError extends boolean = false>(options?: Options<TuiOpenModelsData, ThrowOnError>) => { 405 + return (options?.client ?? client).post<TuiOpenModelsResponses, unknown, ThrowOnError>({ 406 + url: '/tui/open-models', 407 + ...options 408 + }); 409 + }; 410 + 411 + /** 412 + * Submit the prompt 413 + */ 414 + export const tuiSubmitPrompt = <ThrowOnError extends boolean = false>(options?: Options<TuiSubmitPromptData, ThrowOnError>) => { 415 + return (options?.client ?? client).post<TuiSubmitPromptResponses, unknown, ThrowOnError>({ 416 + url: '/tui/submit-prompt', 417 + ...options 418 + }); 419 + }; 420 + 421 + /** 422 + * Clear the prompt 423 + */ 424 + export const tuiClearPrompt = <ThrowOnError extends boolean = false>(options?: Options<TuiClearPromptData, ThrowOnError>) => { 425 + return (options?.client ?? client).post<TuiClearPromptResponses, unknown, ThrowOnError>({ 426 + url: '/tui/clear-prompt', 427 + ...options 428 + }); 429 + }; 430 + 431 + /** 432 + * Execute a TUI command (e.g. agent_cycle) 433 + */ 434 + export const tuiExecuteCommand = <ThrowOnError extends boolean = false>(options?: Options<TuiExecuteCommandData, ThrowOnError>) => { 435 + return (options?.client ?? client).post<TuiExecuteCommandResponses, unknown, ThrowOnError>({ 436 + url: '/tui/execute-command', 437 + ...options, 438 + headers: { 439 + 'Content-Type': 'application/json', 440 + ...options?.headers 441 + } 442 + }); 443 + }; 444 + 445 + /** 446 + * Show a toast notification in the TUI 447 + */ 448 + export const tuiShowToast = <ThrowOnError extends boolean = false>(options?: Options<TuiShowToastData, ThrowOnError>) => { 449 + return (options?.client ?? client).post<TuiShowToastResponses, unknown, ThrowOnError>({ 450 + url: '/tui/show-toast', 451 + ...options, 452 + headers: { 453 + 'Content-Type': 'application/json', 454 + ...options?.headers 455 + } 456 + }); 457 + }; 458 + 459 + /** 460 + * Set authentication credentials 461 + */ 462 + export const authSet = <ThrowOnError extends boolean = false>(options: Options<AuthSetData, ThrowOnError>) => { 463 + return (options.client ?? client).put<AuthSetResponses, AuthSetErrors, ThrowOnError>({ 464 + url: '/auth/{id}', 465 + ...options, 466 + headers: { 467 + 'Content-Type': 'application/json', 468 + ...options.headers 469 + } 470 + }); 471 + };
+1943
packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type ClientOptions = { 4 + baseUrl: `${string}://${string}` | (string & {}); 5 + }; 6 + 7 + export type Event = ({ 8 + type: 'installation.updated'; 9 + } & EventInstallationUpdated) | ({ 10 + type: 'lsp.client.diagnostics'; 11 + } & EventLspClientDiagnostics) | ({ 12 + type: 'message.updated'; 13 + } & EventMessageUpdated) | ({ 14 + type: 'message.removed'; 15 + } & EventMessageRemoved) | ({ 16 + type: 'message.part.updated'; 17 + } & EventMessagePartUpdated) | ({ 18 + type: 'message.part.removed'; 19 + } & EventMessagePartRemoved) | ({ 20 + type: 'storage.write'; 21 + } & EventStorageWrite) | ({ 22 + type: 'permission.updated'; 23 + } & EventPermissionUpdated) | ({ 24 + type: 'permission.replied'; 25 + } & EventPermissionReplied) | ({ 26 + type: 'file.edited'; 27 + } & EventFileEdited) | ({ 28 + type: 'session.updated'; 29 + } & EventSessionUpdated) | ({ 30 + type: 'session.deleted'; 31 + } & EventSessionDeleted) | ({ 32 + type: 'session.idle'; 33 + } & EventSessionIdle) | ({ 34 + type: 'session.error'; 35 + } & EventSessionError) | ({ 36 + type: 'server.connected'; 37 + } & EventServerConnected) | ({ 38 + type: 'file.watcher.updated'; 39 + } & EventFileWatcherUpdated) | ({ 40 + type: 'ide.installed'; 41 + } & EventIdeInstalled); 42 + 43 + export type EventInstallationUpdated = { 44 + type: 'installation.updated'; 45 + properties: { 46 + version: string; 47 + }; 48 + }; 49 + 50 + export type EventLspClientDiagnostics = { 51 + type: 'lsp.client.diagnostics'; 52 + properties: { 53 + serverID: string; 54 + path: string; 55 + }; 56 + }; 57 + 58 + export type EventMessageUpdated = { 59 + type: 'message.updated'; 60 + properties: { 61 + info: Message; 62 + }; 63 + }; 64 + 65 + export type Message = ({ 66 + role: 'user'; 67 + } & UserMessage) | ({ 68 + role: 'assistant'; 69 + } & AssistantMessage); 70 + 71 + export type UserMessage = { 72 + id: string; 73 + sessionID: string; 74 + role: 'user'; 75 + time: { 76 + created: number; 77 + }; 78 + }; 79 + 80 + export type AssistantMessage = { 81 + id: string; 82 + sessionID: string; 83 + role: 'assistant'; 84 + time: { 85 + created: number; 86 + completed?: number; 87 + }; 88 + error?: ({ 89 + name: 'ProviderAuthError'; 90 + } & ProviderAuthError) | ({ 91 + name: 'UnknownError'; 92 + } & UnknownError) | ({ 93 + name: 'MessageOutputLengthError'; 94 + } & MessageOutputLengthError) | ({ 95 + name: 'MessageAbortedError'; 96 + } & MessageAbortedError); 97 + system: Array<string>; 98 + modelID: string; 99 + providerID: string; 100 + mode: string; 101 + path: { 102 + cwd: string; 103 + root: string; 104 + }; 105 + summary?: boolean; 106 + cost: number; 107 + tokens: { 108 + input: number; 109 + output: number; 110 + reasoning: number; 111 + cache: { 112 + read: number; 113 + write: number; 114 + }; 115 + }; 116 + }; 117 + 118 + export type ProviderAuthError = { 119 + name: 'ProviderAuthError'; 120 + data: { 121 + providerID: string; 122 + message: string; 123 + }; 124 + }; 125 + 126 + export type UnknownError = { 127 + name: 'UnknownError'; 128 + data: { 129 + message: string; 130 + }; 131 + }; 132 + 133 + export type MessageOutputLengthError = { 134 + name: 'MessageOutputLengthError'; 135 + data: { 136 + [key: string]: unknown; 137 + }; 138 + }; 139 + 140 + export type MessageAbortedError = { 141 + name: 'MessageAbortedError'; 142 + data: { 143 + [key: string]: unknown; 144 + }; 145 + }; 146 + 147 + export type EventMessageRemoved = { 148 + type: 'message.removed'; 149 + properties: { 150 + sessionID: string; 151 + messageID: string; 152 + }; 153 + }; 154 + 155 + export type EventMessagePartUpdated = { 156 + type: 'message.part.updated'; 157 + properties: { 158 + part: Part; 159 + }; 160 + }; 161 + 162 + export type Part = ({ 163 + type: 'text'; 164 + } & TextPart) | ({ 165 + type: 'reasoning'; 166 + } & ReasoningPart) | ({ 167 + type: 'file'; 168 + } & FilePart) | ({ 169 + type: 'tool'; 170 + } & ToolPart) | ({ 171 + type: 'step-start'; 172 + } & StepStartPart) | ({ 173 + type: 'step-finish'; 174 + } & StepFinishPart) | ({ 175 + type: 'snapshot'; 176 + } & SnapshotPart) | ({ 177 + type: 'patch'; 178 + } & PatchPart) | ({ 179 + type: 'agent'; 180 + } & AgentPart); 181 + 182 + export type TextPart = { 183 + id: string; 184 + sessionID: string; 185 + messageID: string; 186 + type: 'text'; 187 + text: string; 188 + synthetic?: boolean; 189 + time?: { 190 + start: number; 191 + end?: number; 192 + }; 193 + }; 194 + 195 + export type ReasoningPart = { 196 + id: string; 197 + sessionID: string; 198 + messageID: string; 199 + type: 'reasoning'; 200 + text: string; 201 + metadata?: { 202 + [key: string]: unknown; 203 + }; 204 + time: { 205 + start: number; 206 + end?: number; 207 + }; 208 + }; 209 + 210 + export type FilePart = { 211 + id: string; 212 + sessionID: string; 213 + messageID: string; 214 + type: 'file'; 215 + mime: string; 216 + filename?: string; 217 + url: string; 218 + source?: FilePartSource; 219 + }; 220 + 221 + export type FilePartSource = ({ 222 + type: 'file'; 223 + } & FileSource) | ({ 224 + type: 'symbol'; 225 + } & SymbolSource); 226 + 227 + export type FileSource = { 228 + text: FilePartSourceText; 229 + type: 'file'; 230 + path: string; 231 + }; 232 + 233 + export type FilePartSourceText = { 234 + value: string; 235 + start: number; 236 + end: number; 237 + }; 238 + 239 + export type SymbolSource = { 240 + text: FilePartSourceText; 241 + type: 'symbol'; 242 + path: string; 243 + range: Range; 244 + name: string; 245 + kind: number; 246 + }; 247 + 248 + export type Range = { 249 + start: { 250 + line: number; 251 + character: number; 252 + }; 253 + end: { 254 + line: number; 255 + character: number; 256 + }; 257 + }; 258 + 259 + export type ToolPart = { 260 + id: string; 261 + sessionID: string; 262 + messageID: string; 263 + type: 'tool'; 264 + callID: string; 265 + tool: string; 266 + state: ToolState; 267 + }; 268 + 269 + export type ToolState = ({ 270 + status: 'pending'; 271 + } & ToolStatePending) | ({ 272 + status: 'running'; 273 + } & ToolStateRunning) | ({ 274 + status: 'completed'; 275 + } & ToolStateCompleted) | ({ 276 + status: 'error'; 277 + } & ToolStateError); 278 + 279 + export type ToolStatePending = { 280 + status: 'pending'; 281 + }; 282 + 283 + export type ToolStateRunning = { 284 + status: 'running'; 285 + input?: unknown; 286 + title?: string; 287 + metadata?: { 288 + [key: string]: unknown; 289 + }; 290 + time: { 291 + start: number; 292 + }; 293 + }; 294 + 295 + export type ToolStateCompleted = { 296 + status: 'completed'; 297 + input: { 298 + [key: string]: unknown; 299 + }; 300 + output: string; 301 + title: string; 302 + metadata: { 303 + [key: string]: unknown; 304 + }; 305 + time: { 306 + start: number; 307 + end: number; 308 + }; 309 + }; 310 + 311 + export type ToolStateError = { 312 + status: 'error'; 313 + input: { 314 + [key: string]: unknown; 315 + }; 316 + error: string; 317 + metadata?: { 318 + [key: string]: unknown; 319 + }; 320 + time: { 321 + start: number; 322 + end: number; 323 + }; 324 + }; 325 + 326 + export type StepStartPart = { 327 + id: string; 328 + sessionID: string; 329 + messageID: string; 330 + type: 'step-start'; 331 + }; 332 + 333 + export type StepFinishPart = { 334 + id: string; 335 + sessionID: string; 336 + messageID: string; 337 + type: 'step-finish'; 338 + cost: number; 339 + tokens: { 340 + input: number; 341 + output: number; 342 + reasoning: number; 343 + cache: { 344 + read: number; 345 + write: number; 346 + }; 347 + }; 348 + }; 349 + 350 + export type SnapshotPart = { 351 + id: string; 352 + sessionID: string; 353 + messageID: string; 354 + type: 'snapshot'; 355 + snapshot: string; 356 + }; 357 + 358 + export type PatchPart = { 359 + id: string; 360 + sessionID: string; 361 + messageID: string; 362 + type: 'patch'; 363 + hash: string; 364 + files: Array<string>; 365 + }; 366 + 367 + export type AgentPart = { 368 + id: string; 369 + sessionID: string; 370 + messageID: string; 371 + type: 'agent'; 372 + name: string; 373 + source?: { 374 + value: string; 375 + start: number; 376 + end: number; 377 + }; 378 + }; 379 + 380 + export type EventMessagePartRemoved = { 381 + type: 'message.part.removed'; 382 + properties: { 383 + sessionID: string; 384 + messageID: string; 385 + partID: string; 386 + }; 387 + }; 388 + 389 + export type EventStorageWrite = { 390 + type: 'storage.write'; 391 + properties: { 392 + key: string; 393 + content?: unknown; 394 + }; 395 + }; 396 + 397 + export type EventPermissionUpdated = { 398 + type: 'permission.updated'; 399 + properties: Permission; 400 + }; 401 + 402 + export type Permission = { 403 + id: string; 404 + type: string; 405 + pattern?: string; 406 + sessionID: string; 407 + messageID: string; 408 + callID?: string; 409 + title: string; 410 + metadata: { 411 + [key: string]: unknown; 412 + }; 413 + time: { 414 + created: number; 415 + }; 416 + }; 417 + 418 + export type EventPermissionReplied = { 419 + type: 'permission.replied'; 420 + properties: { 421 + sessionID: string; 422 + permissionID: string; 423 + response: string; 424 + }; 425 + }; 426 + 427 + export type EventFileEdited = { 428 + type: 'file.edited'; 429 + properties: { 430 + file: string; 431 + }; 432 + }; 433 + 434 + export type EventSessionUpdated = { 435 + type: 'session.updated'; 436 + properties: { 437 + info: Session; 438 + }; 439 + }; 440 + 441 + export type Session = { 442 + id: string; 443 + parentID?: string; 444 + share?: { 445 + url: string; 446 + }; 447 + title: string; 448 + version: string; 449 + time: { 450 + created: number; 451 + updated: number; 452 + }; 453 + revert?: { 454 + messageID: string; 455 + partID?: string; 456 + snapshot?: string; 457 + diff?: string; 458 + }; 459 + }; 460 + 461 + export type EventSessionDeleted = { 462 + type: 'session.deleted'; 463 + properties: { 464 + info: Session; 465 + }; 466 + }; 467 + 468 + export type EventSessionIdle = { 469 + type: 'session.idle'; 470 + properties: { 471 + sessionID: string; 472 + }; 473 + }; 474 + 475 + export type EventSessionError = { 476 + type: 'session.error'; 477 + properties: { 478 + sessionID?: string; 479 + error?: ({ 480 + name: 'ProviderAuthError'; 481 + } & ProviderAuthError) | ({ 482 + name: 'UnknownError'; 483 + } & UnknownError) | ({ 484 + name: 'MessageOutputLengthError'; 485 + } & MessageOutputLengthError) | ({ 486 + name: 'MessageAbortedError'; 487 + } & MessageAbortedError); 488 + }; 489 + }; 490 + 491 + export type EventServerConnected = { 492 + type: 'server.connected'; 493 + properties: { 494 + [key: string]: unknown; 495 + }; 496 + }; 497 + 498 + export type EventFileWatcherUpdated = { 499 + type: 'file.watcher.updated'; 500 + properties: { 501 + file: string; 502 + event: 'rename' | 'change'; 503 + }; 504 + }; 505 + 506 + export type EventIdeInstalled = { 507 + type: 'ide.installed'; 508 + properties: { 509 + ide: string; 510 + }; 511 + }; 512 + 513 + export type App = { 514 + hostname: string; 515 + git: boolean; 516 + path: { 517 + config: string; 518 + data: string; 519 + root: string; 520 + cwd: string; 521 + state: string; 522 + }; 523 + time: { 524 + initialized?: number; 525 + }; 526 + }; 527 + 528 + export type Config = { 529 + /** 530 + * JSON schema reference for configuration validation 531 + */ 532 + $schema?: string; 533 + /** 534 + * Theme name to use for the interface 535 + */ 536 + theme?: string; 537 + /** 538 + * Custom keybind configurations 539 + */ 540 + keybinds?: KeybindsConfig; 541 + /** 542 + * TUI specific settings 543 + */ 544 + tui?: { 545 + /** 546 + * TUI scroll speed 547 + */ 548 + scroll_speed: number; 549 + }; 550 + plugin?: Array<string>; 551 + snapshot?: boolean; 552 + /** 553 + * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing 554 + */ 555 + share?: 'manual' | 'auto' | 'disabled'; 556 + /** 557 + * @deprecated Use 'share' field instead. Share newly created sessions automatically 558 + */ 559 + autoshare?: boolean; 560 + /** 561 + * Automatically update to the latest version 562 + */ 563 + autoupdate?: boolean; 564 + /** 565 + * Disable providers that are loaded automatically 566 + */ 567 + disabled_providers?: Array<string>; 568 + /** 569 + * Model to use in the format of provider/model, eg anthropic/claude-2 570 + */ 571 + model?: string; 572 + /** 573 + * Small model to use for tasks like title generation in the format of provider/model 574 + */ 575 + small_model?: string; 576 + /** 577 + * Custom username to display in conversations instead of system username 578 + */ 579 + username?: string; 580 + /** 581 + * @deprecated Use `agent` field instead. 582 + */ 583 + mode?: { 584 + build?: AgentConfig; 585 + plan?: AgentConfig; 586 + [key: string]: AgentConfig | undefined; 587 + }; 588 + /** 589 + * Agent configuration, see https://opencode.ai/docs/agent 590 + */ 591 + agent?: { 592 + plan?: AgentConfig; 593 + build?: AgentConfig; 594 + general?: AgentConfig; 595 + [key: string]: AgentConfig | undefined; 596 + }; 597 + /** 598 + * Custom provider configurations and model overrides 599 + */ 600 + provider?: { 601 + [key: string]: { 602 + api?: string; 603 + name?: string; 604 + env?: Array<string>; 605 + id?: string; 606 + npm?: string; 607 + models?: { 608 + [key: string]: { 609 + id?: string; 610 + name?: string; 611 + release_date?: string; 612 + attachment?: boolean; 613 + reasoning?: boolean; 614 + temperature?: boolean; 615 + tool_call?: boolean; 616 + cost?: { 617 + input: number; 618 + output: number; 619 + cache_read?: number; 620 + cache_write?: number; 621 + }; 622 + limit?: { 623 + context: number; 624 + output: number; 625 + }; 626 + options?: { 627 + [key: string]: unknown; 628 + }; 629 + }; 630 + }; 631 + options?: { 632 + apiKey?: string; 633 + baseURL?: string; 634 + [key: string]: unknown | string | undefined; 635 + }; 636 + }; 637 + }; 638 + /** 639 + * MCP (Model Context Protocol) server configurations 640 + */ 641 + mcp?: { 642 + [key: string]: ({ 643 + type: 'local'; 644 + } & McpLocalConfig) | ({ 645 + type: 'remote'; 646 + } & McpRemoteConfig); 647 + }; 648 + formatter?: { 649 + [key: string]: { 650 + disabled?: boolean; 651 + command?: Array<string>; 652 + environment?: { 653 + [key: string]: string; 654 + }; 655 + extensions?: Array<string>; 656 + }; 657 + }; 658 + lsp?: { 659 + [key: string]: { 660 + disabled: true; 661 + } | { 662 + command: Array<string>; 663 + extensions?: Array<string>; 664 + disabled?: boolean; 665 + env?: { 666 + [key: string]: string; 667 + }; 668 + initialization?: { 669 + [key: string]: unknown; 670 + }; 671 + }; 672 + }; 673 + /** 674 + * Additional instruction files or patterns to include 675 + */ 676 + instructions?: Array<string>; 677 + /** 678 + * @deprecated Always uses stretch layout. 679 + */ 680 + layout?: LayoutConfig; 681 + permission?: { 682 + edit?: 'ask' | 'allow' | 'deny'; 683 + bash?: 'ask' | 'allow' | 'deny' | { 684 + [key: string]: 'ask' | 'allow' | 'deny'; 685 + }; 686 + webfetch?: 'ask' | 'allow' | 'deny'; 687 + }; 688 + tools?: { 689 + [key: string]: boolean; 690 + }; 691 + experimental?: { 692 + hook?: { 693 + file_edited?: { 694 + [key: string]: Array<{ 695 + command: Array<string>; 696 + environment?: { 697 + [key: string]: string; 698 + }; 699 + }>; 700 + }; 701 + session_completed?: Array<{ 702 + command: Array<string>; 703 + environment?: { 704 + [key: string]: string; 705 + }; 706 + }>; 707 + }; 708 + }; 709 + }; 710 + 711 + export type KeybindsConfig = { 712 + /** 713 + * Leader key for keybind combinations 714 + */ 715 + leader: string; 716 + /** 717 + * Show help dialog 718 + */ 719 + app_help: string; 720 + /** 721 + * Exit the application 722 + */ 723 + app_exit: string; 724 + /** 725 + * Open external editor 726 + */ 727 + editor_open: string; 728 + /** 729 + * List available themes 730 + */ 731 + theme_list: string; 732 + /** 733 + * Create/update AGENTS.md 734 + */ 735 + project_init: string; 736 + /** 737 + * Toggle tool details 738 + */ 739 + tool_details: string; 740 + /** 741 + * Toggle thinking blocks 742 + */ 743 + thinking_blocks: string; 744 + /** 745 + * Export session to editor 746 + */ 747 + session_export: string; 748 + /** 749 + * Create a new session 750 + */ 751 + session_new: string; 752 + /** 753 + * List all sessions 754 + */ 755 + session_list: string; 756 + /** 757 + * Show session timeline 758 + */ 759 + session_timeline: string; 760 + /** 761 + * Share current session 762 + */ 763 + session_share: string; 764 + /** 765 + * Unshare current session 766 + */ 767 + session_unshare: string; 768 + /** 769 + * Interrupt current session 770 + */ 771 + session_interrupt: string; 772 + /** 773 + * Compact the session 774 + */ 775 + session_compact: string; 776 + /** 777 + * Cycle to next child session 778 + */ 779 + session_child_cycle: string; 780 + /** 781 + * Cycle to previous child session 782 + */ 783 + session_child_cycle_reverse: string; 784 + /** 785 + * Scroll messages up by one page 786 + */ 787 + messages_page_up: string; 788 + /** 789 + * Scroll messages down by one page 790 + */ 791 + messages_page_down: string; 792 + /** 793 + * Scroll messages up by half page 794 + */ 795 + messages_half_page_up: string; 796 + /** 797 + * Scroll messages down by half page 798 + */ 799 + messages_half_page_down: string; 800 + /** 801 + * Navigate to first message 802 + */ 803 + messages_first: string; 804 + /** 805 + * Navigate to last message 806 + */ 807 + messages_last: string; 808 + /** 809 + * Copy message 810 + */ 811 + messages_copy: string; 812 + /** 813 + * Undo message 814 + */ 815 + messages_undo: string; 816 + /** 817 + * Redo message 818 + */ 819 + messages_redo: string; 820 + /** 821 + * List available models 822 + */ 823 + model_list: string; 824 + /** 825 + * Next recent model 826 + */ 827 + model_cycle_recent: string; 828 + /** 829 + * Previous recent model 830 + */ 831 + model_cycle_recent_reverse: string; 832 + /** 833 + * List agents 834 + */ 835 + agent_list: string; 836 + /** 837 + * Next agent 838 + */ 839 + agent_cycle: string; 840 + /** 841 + * Previous agent 842 + */ 843 + agent_cycle_reverse: string; 844 + /** 845 + * Clear input field 846 + */ 847 + input_clear: string; 848 + /** 849 + * Paste from clipboard 850 + */ 851 + input_paste: string; 852 + /** 853 + * Submit input 854 + */ 855 + input_submit: string; 856 + /** 857 + * Insert newline in input 858 + */ 859 + input_newline: string; 860 + /** 861 + * @deprecated use agent_cycle. Next mode 862 + */ 863 + switch_mode: string; 864 + /** 865 + * @deprecated use agent_cycle_reverse. Previous mode 866 + */ 867 + switch_mode_reverse: string; 868 + /** 869 + * @deprecated use agent_cycle. Next agent 870 + */ 871 + switch_agent: string; 872 + /** 873 + * @deprecated use agent_cycle_reverse. Previous agent 874 + */ 875 + switch_agent_reverse: string; 876 + /** 877 + * @deprecated Currently not available. List files 878 + */ 879 + file_list: string; 880 + /** 881 + * @deprecated Close file 882 + */ 883 + file_close: string; 884 + /** 885 + * @deprecated Search file 886 + */ 887 + file_search: string; 888 + /** 889 + * @deprecated Split/unified diff 890 + */ 891 + file_diff_toggle: string; 892 + /** 893 + * @deprecated Navigate to previous message 894 + */ 895 + messages_previous: string; 896 + /** 897 + * @deprecated Navigate to next message 898 + */ 899 + messages_next: string; 900 + /** 901 + * @deprecated Toggle layout 902 + */ 903 + messages_layout_toggle: string; 904 + /** 905 + * @deprecated use messages_undo. Revert message 906 + */ 907 + messages_revert: string; 908 + }; 909 + 910 + export type AgentConfig = { 911 + model?: string; 912 + temperature?: number; 913 + top_p?: number; 914 + prompt?: string; 915 + tools?: { 916 + [key: string]: boolean; 917 + }; 918 + disable?: boolean; 919 + /** 920 + * Description of when to use the agent 921 + */ 922 + description?: string; 923 + mode?: 'subagent' | 'primary' | 'all'; 924 + permission?: { 925 + edit?: 'ask' | 'allow' | 'deny'; 926 + bash?: 'ask' | 'allow' | 'deny' | { 927 + [key: string]: 'ask' | 'allow' | 'deny'; 928 + }; 929 + webfetch?: 'ask' | 'allow' | 'deny'; 930 + }; 931 + [key: string]: unknown | string | number | { 932 + [key: string]: boolean; 933 + } | boolean | 'subagent' | 'primary' | 'all' | { 934 + edit?: 'ask' | 'allow' | 'deny'; 935 + bash?: 'ask' | 'allow' | 'deny' | { 936 + [key: string]: 'ask' | 'allow' | 'deny'; 937 + }; 938 + webfetch?: 'ask' | 'allow' | 'deny'; 939 + } | undefined; 940 + }; 941 + 942 + export type Provider = { 943 + api?: string; 944 + name: string; 945 + env: Array<string>; 946 + id: string; 947 + npm?: string; 948 + models: { 949 + [key: string]: Model; 950 + }; 951 + }; 952 + 953 + export type Model = { 954 + id: string; 955 + name: string; 956 + release_date: string; 957 + attachment: boolean; 958 + reasoning: boolean; 959 + temperature: boolean; 960 + tool_call: boolean; 961 + cost: { 962 + input: number; 963 + output: number; 964 + cache_read?: number; 965 + cache_write?: number; 966 + }; 967 + limit: { 968 + context: number; 969 + output: number; 970 + }; 971 + options: { 972 + [key: string]: unknown; 973 + }; 974 + }; 975 + 976 + export type McpLocalConfig = { 977 + /** 978 + * Type of MCP server connection 979 + */ 980 + type: 'local'; 981 + /** 982 + * Command and arguments to run the MCP server 983 + */ 984 + command: Array<string>; 985 + /** 986 + * Environment variables to set when running the MCP server 987 + */ 988 + environment?: { 989 + [key: string]: string; 990 + }; 991 + /** 992 + * Enable or disable the MCP server on startup 993 + */ 994 + enabled?: boolean; 995 + }; 996 + 997 + export type McpRemoteConfig = { 998 + /** 999 + * Type of MCP server connection 1000 + */ 1001 + type: 'remote'; 1002 + /** 1003 + * URL of the remote MCP server 1004 + */ 1005 + url: string; 1006 + /** 1007 + * Enable or disable the MCP server on startup 1008 + */ 1009 + enabled?: boolean; 1010 + /** 1011 + * Headers to send with the request 1012 + */ 1013 + headers?: { 1014 + [key: string]: string; 1015 + }; 1016 + }; 1017 + 1018 + export type LayoutConfig = 'auto' | 'stretch'; 1019 + 1020 + export type _Error = { 1021 + data: { 1022 + [key: string]: unknown; 1023 + }; 1024 + }; 1025 + 1026 + export type TextPartInput = { 1027 + id?: string; 1028 + type: 'text'; 1029 + text: string; 1030 + synthetic?: boolean; 1031 + time?: { 1032 + start: number; 1033 + end?: number; 1034 + }; 1035 + }; 1036 + 1037 + export type FilePartInput = { 1038 + id?: string; 1039 + type: 'file'; 1040 + mime: string; 1041 + filename?: string; 1042 + url: string; 1043 + source?: FilePartSource; 1044 + }; 1045 + 1046 + export type AgentPartInput = { 1047 + id?: string; 1048 + type: 'agent'; 1049 + name: string; 1050 + source?: { 1051 + value: string; 1052 + start: number; 1053 + end: number; 1054 + }; 1055 + }; 1056 + 1057 + export type Symbol = { 1058 + name: string; 1059 + kind: number; 1060 + location: { 1061 + uri: string; 1062 + range: Range; 1063 + }; 1064 + }; 1065 + 1066 + export type File = { 1067 + path: string; 1068 + added: number; 1069 + removed: number; 1070 + status: 'added' | 'deleted' | 'modified'; 1071 + }; 1072 + 1073 + export type Agent = { 1074 + name: string; 1075 + description?: string; 1076 + mode: 'subagent' | 'primary' | 'all'; 1077 + builtIn: boolean; 1078 + topP?: number; 1079 + temperature?: number; 1080 + permission: { 1081 + edit: 'ask' | 'allow' | 'deny'; 1082 + bash: { 1083 + [key: string]: 'ask' | 'allow' | 'deny'; 1084 + }; 1085 + webfetch?: 'ask' | 'allow' | 'deny'; 1086 + }; 1087 + model?: { 1088 + modelID: string; 1089 + providerID: string; 1090 + }; 1091 + prompt?: string; 1092 + tools: { 1093 + [key: string]: boolean; 1094 + }; 1095 + options: { 1096 + [key: string]: unknown; 1097 + }; 1098 + }; 1099 + 1100 + export type Auth = ({ 1101 + type: 'oauth'; 1102 + } & OAuth) | ({ 1103 + type: 'api'; 1104 + } & ApiAuth) | ({ 1105 + type: 'wellknown'; 1106 + } & WellKnownAuth); 1107 + 1108 + export type OAuth = { 1109 + type: 'oauth'; 1110 + refresh: string; 1111 + access: string; 1112 + expires: number; 1113 + }; 1114 + 1115 + export type ApiAuth = { 1116 + type: 'api'; 1117 + key: string; 1118 + }; 1119 + 1120 + export type WellKnownAuth = { 1121 + type: 'wellknown'; 1122 + key: string; 1123 + token: string; 1124 + }; 1125 + 1126 + export type EventSubscribeData = { 1127 + body?: never; 1128 + path?: never; 1129 + query?: never; 1130 + url: '/event'; 1131 + }; 1132 + 1133 + export type EventSubscribeResponses = { 1134 + /** 1135 + * Event stream 1136 + */ 1137 + 200: Event; 1138 + }; 1139 + 1140 + export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses]; 1141 + 1142 + export type AppGetData = { 1143 + body?: never; 1144 + path?: never; 1145 + query?: never; 1146 + url: '/app'; 1147 + }; 1148 + 1149 + export type AppGetResponses = { 1150 + /** 1151 + * 200 1152 + */ 1153 + 200: App; 1154 + }; 1155 + 1156 + export type AppGetResponse = AppGetResponses[keyof AppGetResponses]; 1157 + 1158 + export type AppInitData = { 1159 + body?: never; 1160 + path?: never; 1161 + query?: never; 1162 + url: '/app/init'; 1163 + }; 1164 + 1165 + export type AppInitResponses = { 1166 + /** 1167 + * Initialize the app 1168 + */ 1169 + 200: boolean; 1170 + }; 1171 + 1172 + export type AppInitResponse = AppInitResponses[keyof AppInitResponses]; 1173 + 1174 + export type ConfigGetData = { 1175 + body?: never; 1176 + path?: never; 1177 + query?: never; 1178 + url: '/config'; 1179 + }; 1180 + 1181 + export type ConfigGetResponses = { 1182 + /** 1183 + * Get config info 1184 + */ 1185 + 200: Config; 1186 + }; 1187 + 1188 + export type ConfigGetResponse = ConfigGetResponses[keyof ConfigGetResponses]; 1189 + 1190 + export type SessionListData = { 1191 + body?: never; 1192 + path?: never; 1193 + query?: never; 1194 + url: '/session'; 1195 + }; 1196 + 1197 + export type SessionListResponses = { 1198 + /** 1199 + * List of sessions 1200 + */ 1201 + 200: Array<Session>; 1202 + }; 1203 + 1204 + export type SessionListResponse = SessionListResponses[keyof SessionListResponses]; 1205 + 1206 + export type SessionCreateData = { 1207 + body?: { 1208 + parentID?: string; 1209 + title?: string; 1210 + }; 1211 + path?: never; 1212 + query?: never; 1213 + url: '/session'; 1214 + }; 1215 + 1216 + export type SessionCreateErrors = { 1217 + /** 1218 + * Bad request 1219 + */ 1220 + 400: _Error; 1221 + }; 1222 + 1223 + export type SessionCreateError = SessionCreateErrors[keyof SessionCreateErrors]; 1224 + 1225 + export type SessionCreateResponses = { 1226 + /** 1227 + * Successfully created session 1228 + */ 1229 + 200: Session; 1230 + }; 1231 + 1232 + export type SessionCreateResponse = SessionCreateResponses[keyof SessionCreateResponses]; 1233 + 1234 + export type SessionDeleteData = { 1235 + body?: never; 1236 + path: { 1237 + id: string; 1238 + }; 1239 + query?: never; 1240 + url: '/session/{id}'; 1241 + }; 1242 + 1243 + export type SessionDeleteResponses = { 1244 + /** 1245 + * Successfully deleted session 1246 + */ 1247 + 200: boolean; 1248 + }; 1249 + 1250 + export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses]; 1251 + 1252 + export type SessionGetData = { 1253 + body?: never; 1254 + path: { 1255 + id: string; 1256 + }; 1257 + query?: never; 1258 + url: '/session/{id}'; 1259 + }; 1260 + 1261 + export type SessionGetResponses = { 1262 + /** 1263 + * Get session 1264 + */ 1265 + 200: Session; 1266 + }; 1267 + 1268 + export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses]; 1269 + 1270 + export type SessionUpdateData = { 1271 + body?: { 1272 + title?: string; 1273 + }; 1274 + path: { 1275 + id: string; 1276 + }; 1277 + query?: never; 1278 + url: '/session/{id}'; 1279 + }; 1280 + 1281 + export type SessionUpdateResponses = { 1282 + /** 1283 + * Successfully updated session 1284 + */ 1285 + 200: Session; 1286 + }; 1287 + 1288 + export type SessionUpdateResponse = SessionUpdateResponses[keyof SessionUpdateResponses]; 1289 + 1290 + export type SessionChildrenData = { 1291 + body?: never; 1292 + path: { 1293 + id: string; 1294 + }; 1295 + query?: never; 1296 + url: '/session/{id}/children'; 1297 + }; 1298 + 1299 + export type SessionChildrenResponses = { 1300 + /** 1301 + * List of children 1302 + */ 1303 + 200: Array<Session>; 1304 + }; 1305 + 1306 + export type SessionChildrenResponse = SessionChildrenResponses[keyof SessionChildrenResponses]; 1307 + 1308 + export type SessionInitData = { 1309 + body?: { 1310 + messageID: string; 1311 + providerID: string; 1312 + modelID: string; 1313 + }; 1314 + path: { 1315 + /** 1316 + * Session ID 1317 + */ 1318 + id: string; 1319 + }; 1320 + query?: never; 1321 + url: '/session/{id}/init'; 1322 + }; 1323 + 1324 + export type SessionInitResponses = { 1325 + /** 1326 + * 200 1327 + */ 1328 + 200: boolean; 1329 + }; 1330 + 1331 + export type SessionInitResponse = SessionInitResponses[keyof SessionInitResponses]; 1332 + 1333 + export type SessionAbortData = { 1334 + body?: never; 1335 + path: { 1336 + id: string; 1337 + }; 1338 + query?: never; 1339 + url: '/session/{id}/abort'; 1340 + }; 1341 + 1342 + export type SessionAbortResponses = { 1343 + /** 1344 + * Aborted session 1345 + */ 1346 + 200: boolean; 1347 + }; 1348 + 1349 + export type SessionAbortResponse = SessionAbortResponses[keyof SessionAbortResponses]; 1350 + 1351 + export type SessionUnshareData = { 1352 + body?: never; 1353 + path: { 1354 + id: string; 1355 + }; 1356 + query?: never; 1357 + url: '/session/{id}/share'; 1358 + }; 1359 + 1360 + export type SessionUnshareResponses = { 1361 + /** 1362 + * Successfully unshared session 1363 + */ 1364 + 200: Session; 1365 + }; 1366 + 1367 + export type SessionUnshareResponse = SessionUnshareResponses[keyof SessionUnshareResponses]; 1368 + 1369 + export type SessionShareData = { 1370 + body?: never; 1371 + path: { 1372 + id: string; 1373 + }; 1374 + query?: never; 1375 + url: '/session/{id}/share'; 1376 + }; 1377 + 1378 + export type SessionShareResponses = { 1379 + /** 1380 + * Successfully shared session 1381 + */ 1382 + 200: Session; 1383 + }; 1384 + 1385 + export type SessionShareResponse = SessionShareResponses[keyof SessionShareResponses]; 1386 + 1387 + export type SessionSummarizeData = { 1388 + body?: { 1389 + providerID: string; 1390 + modelID: string; 1391 + }; 1392 + path: { 1393 + /** 1394 + * Session ID 1395 + */ 1396 + id: string; 1397 + }; 1398 + query?: never; 1399 + url: '/session/{id}/summarize'; 1400 + }; 1401 + 1402 + export type SessionSummarizeResponses = { 1403 + /** 1404 + * Summarized session 1405 + */ 1406 + 200: boolean; 1407 + }; 1408 + 1409 + export type SessionSummarizeResponse = SessionSummarizeResponses[keyof SessionSummarizeResponses]; 1410 + 1411 + export type SessionMessagesData = { 1412 + body?: never; 1413 + path: { 1414 + /** 1415 + * Session ID 1416 + */ 1417 + id: string; 1418 + }; 1419 + query?: never; 1420 + url: '/session/{id}/message'; 1421 + }; 1422 + 1423 + export type SessionMessagesResponses = { 1424 + /** 1425 + * List of messages 1426 + */ 1427 + 200: Array<{ 1428 + info: Message; 1429 + parts: Array<Part>; 1430 + }>; 1431 + }; 1432 + 1433 + export type SessionMessagesResponse = SessionMessagesResponses[keyof SessionMessagesResponses]; 1434 + 1435 + export type SessionChatData = { 1436 + body?: { 1437 + messageID?: string; 1438 + providerID: string; 1439 + modelID: string; 1440 + agent?: string; 1441 + system?: string; 1442 + tools?: { 1443 + [key: string]: boolean; 1444 + }; 1445 + parts: Array<({ 1446 + type: 'text'; 1447 + } & TextPartInput) | ({ 1448 + type: 'file'; 1449 + } & FilePartInput) | ({ 1450 + type: 'agent'; 1451 + } & AgentPartInput)>; 1452 + }; 1453 + path: { 1454 + /** 1455 + * Session ID 1456 + */ 1457 + id: string; 1458 + }; 1459 + query?: never; 1460 + url: '/session/{id}/message'; 1461 + }; 1462 + 1463 + export type SessionChatResponses = { 1464 + /** 1465 + * Created message 1466 + */ 1467 + 200: { 1468 + info: AssistantMessage; 1469 + parts: Array<Part>; 1470 + }; 1471 + }; 1472 + 1473 + export type SessionChatResponse = SessionChatResponses[keyof SessionChatResponses]; 1474 + 1475 + export type SessionMessageData = { 1476 + body?: never; 1477 + path: { 1478 + /** 1479 + * Session ID 1480 + */ 1481 + id: string; 1482 + /** 1483 + * Message ID 1484 + */ 1485 + messageID: string; 1486 + }; 1487 + query?: never; 1488 + url: '/session/{id}/message/{messageID}'; 1489 + }; 1490 + 1491 + export type SessionMessageResponses = { 1492 + /** 1493 + * Message 1494 + */ 1495 + 200: { 1496 + info: Message; 1497 + parts: Array<Part>; 1498 + }; 1499 + }; 1500 + 1501 + export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses]; 1502 + 1503 + export type SessionShellData = { 1504 + body?: { 1505 + agent: string; 1506 + command: string; 1507 + }; 1508 + path: { 1509 + /** 1510 + * Session ID 1511 + */ 1512 + id: string; 1513 + }; 1514 + query?: never; 1515 + url: '/session/{id}/shell'; 1516 + }; 1517 + 1518 + export type SessionShellResponses = { 1519 + /** 1520 + * Created message 1521 + */ 1522 + 200: AssistantMessage; 1523 + }; 1524 + 1525 + export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses]; 1526 + 1527 + export type SessionRevertData = { 1528 + body?: { 1529 + messageID: string; 1530 + partID?: string; 1531 + }; 1532 + path: { 1533 + id: string; 1534 + }; 1535 + query?: never; 1536 + url: '/session/{id}/revert'; 1537 + }; 1538 + 1539 + export type SessionRevertResponses = { 1540 + /** 1541 + * Updated session 1542 + */ 1543 + 200: Session; 1544 + }; 1545 + 1546 + export type SessionRevertResponse = SessionRevertResponses[keyof SessionRevertResponses]; 1547 + 1548 + export type SessionUnrevertData = { 1549 + body?: never; 1550 + path: { 1551 + id: string; 1552 + }; 1553 + query?: never; 1554 + url: '/session/{id}/unrevert'; 1555 + }; 1556 + 1557 + export type SessionUnrevertResponses = { 1558 + /** 1559 + * Updated session 1560 + */ 1561 + 200: Session; 1562 + }; 1563 + 1564 + export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses]; 1565 + 1566 + export type PostSessionByIdPermissionsByPermissionIdData = { 1567 + body?: { 1568 + response: 'once' | 'always' | 'reject'; 1569 + }; 1570 + path: { 1571 + id: string; 1572 + permissionID: string; 1573 + }; 1574 + query?: never; 1575 + url: '/session/{id}/permissions/{permissionID}'; 1576 + }; 1577 + 1578 + export type PostSessionByIdPermissionsByPermissionIdResponses = { 1579 + /** 1580 + * Permission processed successfully 1581 + */ 1582 + 200: boolean; 1583 + }; 1584 + 1585 + export type PostSessionByIdPermissionsByPermissionIdResponse = PostSessionByIdPermissionsByPermissionIdResponses[keyof PostSessionByIdPermissionsByPermissionIdResponses]; 1586 + 1587 + export type ConfigProvidersData = { 1588 + body?: never; 1589 + path?: never; 1590 + query?: never; 1591 + url: '/config/providers'; 1592 + }; 1593 + 1594 + export type ConfigProvidersResponses = { 1595 + /** 1596 + * List of providers 1597 + */ 1598 + 200: { 1599 + providers: Array<Provider>; 1600 + default: { 1601 + [key: string]: string; 1602 + }; 1603 + }; 1604 + }; 1605 + 1606 + export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses]; 1607 + 1608 + export type FindTextData = { 1609 + body?: never; 1610 + path?: never; 1611 + query: { 1612 + pattern: string; 1613 + }; 1614 + url: '/find'; 1615 + }; 1616 + 1617 + export type FindTextResponses = { 1618 + /** 1619 + * Matches 1620 + */ 1621 + 200: Array<{ 1622 + path: { 1623 + text: string; 1624 + }; 1625 + lines: { 1626 + text: string; 1627 + }; 1628 + line_number: number; 1629 + absolute_offset: number; 1630 + submatches: Array<{ 1631 + match: { 1632 + text: string; 1633 + }; 1634 + start: number; 1635 + end: number; 1636 + }>; 1637 + }>; 1638 + }; 1639 + 1640 + export type FindTextResponse = FindTextResponses[keyof FindTextResponses]; 1641 + 1642 + export type FindFilesData = { 1643 + body?: never; 1644 + path?: never; 1645 + query: { 1646 + query: string; 1647 + }; 1648 + url: '/find/file'; 1649 + }; 1650 + 1651 + export type FindFilesResponses = { 1652 + /** 1653 + * File paths 1654 + */ 1655 + 200: Array<string>; 1656 + }; 1657 + 1658 + export type FindFilesResponse = FindFilesResponses[keyof FindFilesResponses]; 1659 + 1660 + export type FindSymbolsData = { 1661 + body?: never; 1662 + path?: never; 1663 + query: { 1664 + query: string; 1665 + }; 1666 + url: '/find/symbol'; 1667 + }; 1668 + 1669 + export type FindSymbolsResponses = { 1670 + /** 1671 + * Symbols 1672 + */ 1673 + 200: Array<Symbol>; 1674 + }; 1675 + 1676 + export type FindSymbolsResponse = FindSymbolsResponses[keyof FindSymbolsResponses]; 1677 + 1678 + export type FileReadData = { 1679 + body?: never; 1680 + path?: never; 1681 + query: { 1682 + path: string; 1683 + }; 1684 + url: '/file'; 1685 + }; 1686 + 1687 + export type FileReadResponses = { 1688 + /** 1689 + * File content 1690 + */ 1691 + 200: { 1692 + type: 'raw' | 'patch'; 1693 + content: string; 1694 + }; 1695 + }; 1696 + 1697 + export type FileReadResponse = FileReadResponses[keyof FileReadResponses]; 1698 + 1699 + export type FileStatusData = { 1700 + body?: never; 1701 + path?: never; 1702 + query?: never; 1703 + url: '/file/status'; 1704 + }; 1705 + 1706 + export type FileStatusResponses = { 1707 + /** 1708 + * File status 1709 + */ 1710 + 200: Array<File>; 1711 + }; 1712 + 1713 + export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses]; 1714 + 1715 + export type AppLogData = { 1716 + body?: { 1717 + /** 1718 + * Service name for the log entry 1719 + */ 1720 + service: string; 1721 + /** 1722 + * Log level 1723 + */ 1724 + level: 'debug' | 'info' | 'error' | 'warn'; 1725 + /** 1726 + * Log message 1727 + */ 1728 + message: string; 1729 + /** 1730 + * Additional metadata for the log entry 1731 + */ 1732 + extra?: { 1733 + [key: string]: unknown; 1734 + }; 1735 + }; 1736 + path?: never; 1737 + query?: never; 1738 + url: '/log'; 1739 + }; 1740 + 1741 + export type AppLogResponses = { 1742 + /** 1743 + * Log entry written successfully 1744 + */ 1745 + 200: boolean; 1746 + }; 1747 + 1748 + export type AppLogResponse = AppLogResponses[keyof AppLogResponses]; 1749 + 1750 + export type AppAgentsData = { 1751 + body?: never; 1752 + path?: never; 1753 + query?: never; 1754 + url: '/agent'; 1755 + }; 1756 + 1757 + export type AppAgentsResponses = { 1758 + /** 1759 + * List of agents 1760 + */ 1761 + 200: Array<Agent>; 1762 + }; 1763 + 1764 + export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]; 1765 + 1766 + export type TuiAppendPromptData = { 1767 + body?: { 1768 + text: string; 1769 + }; 1770 + path?: never; 1771 + query?: never; 1772 + url: '/tui/append-prompt'; 1773 + }; 1774 + 1775 + export type TuiAppendPromptResponses = { 1776 + /** 1777 + * Prompt processed successfully 1778 + */ 1779 + 200: boolean; 1780 + }; 1781 + 1782 + export type TuiAppendPromptResponse = TuiAppendPromptResponses[keyof TuiAppendPromptResponses]; 1783 + 1784 + export type TuiOpenHelpData = { 1785 + body?: never; 1786 + path?: never; 1787 + query?: never; 1788 + url: '/tui/open-help'; 1789 + }; 1790 + 1791 + export type TuiOpenHelpResponses = { 1792 + /** 1793 + * Help dialog opened successfully 1794 + */ 1795 + 200: boolean; 1796 + }; 1797 + 1798 + export type TuiOpenHelpResponse = TuiOpenHelpResponses[keyof TuiOpenHelpResponses]; 1799 + 1800 + export type TuiOpenSessionsData = { 1801 + body?: never; 1802 + path?: never; 1803 + query?: never; 1804 + url: '/tui/open-sessions'; 1805 + }; 1806 + 1807 + export type TuiOpenSessionsResponses = { 1808 + /** 1809 + * Session dialog opened successfully 1810 + */ 1811 + 200: boolean; 1812 + }; 1813 + 1814 + export type TuiOpenSessionsResponse = TuiOpenSessionsResponses[keyof TuiOpenSessionsResponses]; 1815 + 1816 + export type TuiOpenThemesData = { 1817 + body?: never; 1818 + path?: never; 1819 + query?: never; 1820 + url: '/tui/open-themes'; 1821 + }; 1822 + 1823 + export type TuiOpenThemesResponses = { 1824 + /** 1825 + * Theme dialog opened successfully 1826 + */ 1827 + 200: boolean; 1828 + }; 1829 + 1830 + export type TuiOpenThemesResponse = TuiOpenThemesResponses[keyof TuiOpenThemesResponses]; 1831 + 1832 + export type TuiOpenModelsData = { 1833 + body?: never; 1834 + path?: never; 1835 + query?: never; 1836 + url: '/tui/open-models'; 1837 + }; 1838 + 1839 + export type TuiOpenModelsResponses = { 1840 + /** 1841 + * Model dialog opened successfully 1842 + */ 1843 + 200: boolean; 1844 + }; 1845 + 1846 + export type TuiOpenModelsResponse = TuiOpenModelsResponses[keyof TuiOpenModelsResponses]; 1847 + 1848 + export type TuiSubmitPromptData = { 1849 + body?: never; 1850 + path?: never; 1851 + query?: never; 1852 + url: '/tui/submit-prompt'; 1853 + }; 1854 + 1855 + export type TuiSubmitPromptResponses = { 1856 + /** 1857 + * Prompt submitted successfully 1858 + */ 1859 + 200: boolean; 1860 + }; 1861 + 1862 + export type TuiSubmitPromptResponse = TuiSubmitPromptResponses[keyof TuiSubmitPromptResponses]; 1863 + 1864 + export type TuiClearPromptData = { 1865 + body?: never; 1866 + path?: never; 1867 + query?: never; 1868 + url: '/tui/clear-prompt'; 1869 + }; 1870 + 1871 + export type TuiClearPromptResponses = { 1872 + /** 1873 + * Prompt cleared successfully 1874 + */ 1875 + 200: boolean; 1876 + }; 1877 + 1878 + export type TuiClearPromptResponse = TuiClearPromptResponses[keyof TuiClearPromptResponses]; 1879 + 1880 + export type TuiExecuteCommandData = { 1881 + body?: { 1882 + command: string; 1883 + }; 1884 + path?: never; 1885 + query?: never; 1886 + url: '/tui/execute-command'; 1887 + }; 1888 + 1889 + export type TuiExecuteCommandResponses = { 1890 + /** 1891 + * Command executed successfully 1892 + */ 1893 + 200: boolean; 1894 + }; 1895 + 1896 + export type TuiExecuteCommandResponse = TuiExecuteCommandResponses[keyof TuiExecuteCommandResponses]; 1897 + 1898 + export type TuiShowToastData = { 1899 + body?: { 1900 + title?: string; 1901 + message: string; 1902 + variant: 'info' | 'success' | 'warning' | 'error'; 1903 + }; 1904 + path?: never; 1905 + query?: never; 1906 + url: '/tui/show-toast'; 1907 + }; 1908 + 1909 + export type TuiShowToastResponses = { 1910 + /** 1911 + * Toast notification shown successfully 1912 + */ 1913 + 200: boolean; 1914 + }; 1915 + 1916 + export type TuiShowToastResponse = TuiShowToastResponses[keyof TuiShowToastResponses]; 1917 + 1918 + export type AuthSetData = { 1919 + body?: Auth; 1920 + path: { 1921 + id: string; 1922 + }; 1923 + query?: never; 1924 + url: '/auth/{id}'; 1925 + }; 1926 + 1927 + export type AuthSetErrors = { 1928 + /** 1929 + * Bad request 1930 + */ 1931 + 400: _Error; 1932 + }; 1933 + 1934 + export type AuthSetError = AuthSetErrors[keyof AuthSetErrors]; 1935 + 1936 + export type AuthSetResponses = { 1937 + /** 1938 + * Successfully set authentication credentials 1939 + */ 1940 + 200: boolean; 1941 + }; 1942 + 1943 + export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses];
+21
packages/openapi-ts-tests/sdks/package.json
··· 1 + { 2 + "name": "@test/openapi-ts-sdks", 3 + "version": "0.0.0", 4 + "private": true, 5 + "type": "module", 6 + "scripts": { 7 + "test:coverage": "vitest run --coverage", 8 + "test:update": "vitest watch --update", 9 + "test:watch": "vitest watch", 10 + "test": "vitest run", 11 + "typecheck": "tsc --noEmit" 12 + }, 13 + "engines": { 14 + "node": ">=20.19.0" 15 + }, 16 + "devDependencies": { 17 + "@config/vite-base": "workspace:*", 18 + "@hey-api/openapi-ts": "workspace:*", 19 + "typescript": "5.9.3" 20 + } 21 + }
+69
packages/openapi-ts-tests/sdks/test/opencode.test.ts
··· 1 + import fs from 'node:fs'; 2 + import path from 'node:path'; 3 + 4 + import { createClient } from '@hey-api/openapi-ts'; 5 + import { describe, expect, it } from 'vitest'; 6 + 7 + import { getFilePaths, getSpecsPath } from '../../utils'; 8 + import { 9 + createSdkConfig, 10 + getSnapshotsPath, 11 + getTempSnapshotsPath, 12 + } from './utils'; 13 + 14 + const namespace = 'opencode'; 15 + 16 + const outputDir = path.join(getTempSnapshotsPath(), namespace); 17 + const snapshotsDir = path.join(getSnapshotsPath(), namespace); 18 + 19 + const specPath = path.join(getSpecsPath(), '3.1.x', 'opencode.yaml'); 20 + 21 + describe(`SDK: ${namespace}`, () => { 22 + const createConfig = createSdkConfig({ 23 + outputDir, 24 + }); 25 + 26 + const scenarios = [ 27 + { 28 + config: createConfig({ 29 + input: specPath, 30 + output: 'flat', 31 + plugins: [ 32 + { 33 + name: '@hey-api/sdk', 34 + paramsStructure: 'flat', 35 + }, 36 + ], 37 + }), 38 + description: 'flat', 39 + }, 40 + { 41 + config: createConfig({ 42 + input: specPath, 43 + output: 'grouped', 44 + plugins: [ 45 + { 46 + name: '@hey-api/sdk', 47 + paramsStructure: 'grouped', 48 + }, 49 + ], 50 + }), 51 + description: 'grouped', 52 + }, 53 + ]; 54 + 55 + it.each(scenarios)('$description', async ({ config }) => { 56 + await createClient(config); 57 + 58 + const filePaths = getFilePaths(config.output); 59 + 60 + await Promise.all( 61 + filePaths.map(async (filePath) => { 62 + const fileContent = fs.readFileSync(filePath, 'utf-8'); 63 + await expect(fileContent).toMatchFileSnapshot( 64 + path.join(snapshotsDir, filePath.slice(outputDir.length + 1)), 65 + ); 66 + }), 67 + ); 68 + }); 69 + });
+27
packages/openapi-ts-tests/sdks/test/utils.ts
··· 1 + import path from 'node:path'; 2 + import { fileURLToPath } from 'node:url'; 3 + 4 + import { type UserConfig } from '@hey-api/openapi-ts'; 5 + 6 + const __filename = fileURLToPath(import.meta.url); 7 + const __dirname = path.dirname(__filename); 8 + 9 + export const createSdkConfig = 10 + ({ outputDir }: { outputDir: string }) => 11 + (userConfig: UserConfig) => 12 + ({ 13 + ...userConfig, 14 + logs: { 15 + level: 'silent', 16 + }, 17 + output: path.join( 18 + outputDir, 19 + typeof userConfig.output === 'string' ? userConfig.output : '', 20 + ), 21 + }) as const satisfies UserConfig; 22 + 23 + export const getSnapshotsPath = (): string => 24 + path.join(__dirname, '..', '__snapshots__'); 25 + 26 + export const getTempSnapshotsPath = (): string => 27 + path.join(__dirname, '..', '.gen', 'snapshots');
+9
packages/openapi-ts-tests/sdks/tsconfig.json
··· 1 + { 2 + "extends": "../tsconfig.base.json", 3 + "compilerOptions": { 4 + "declaration": false, 5 + "esModuleInterop": true, 6 + "resolveJsonModule": true, 7 + "skipLibCheck": true 8 + } 9 + }
+10
packages/openapi-ts-tests/sdks/turbo.json
··· 1 + { 2 + "$schema": "../../../node_modules/turbo/schema.json", 3 + "extends": ["//"], 4 + "tasks": { 5 + "build": { 6 + "dependsOn": [], 7 + "outputs": ["dist/**"] 8 + } 9 + } 10 + }
+15
packages/openapi-ts-tests/sdks/vitest.config.ts
··· 1 + import path from 'node:path'; 2 + import { fileURLToPath } from 'node:url'; 3 + 4 + import { createVitestConfig } from '@config/vite-base'; 5 + 6 + const rootDir = fileURLToPath(new URL('./', import.meta.url)); 7 + 8 + export default createVitestConfig(rootDir, { 9 + resolve: { 10 + alias: [ 11 + { find: /^~\/(.*)/, replacement: path.resolve(rootDir, 'src/$1') }, 12 + { find: '~', replacement: path.resolve(rootDir, 'src') }, 13 + ], 14 + }, 15 + });
+1 -1
packages/openapi-ts-tests/zod/v3/turbo.json
··· 1 1 { 2 - "$schema": "../../../node_modules/turbo/schema.json", 2 + "$schema": "../../../../node_modules/turbo/schema.json", 3 3 "extends": ["//"], 4 4 "tasks": { 5 5 "build": {
+1 -1
packages/openapi-ts-tests/zod/v4/turbo.json
··· 1 1 { 2 - "$schema": "../../../node_modules/turbo/schema.json", 2 + "$schema": "../../../../node_modules/turbo/schema.json", 3 3 "extends": ["//"], 4 4 "tasks": { 5 5 "build": {
+15 -3
pnpm-lock.yaml
··· 1488 1488 specifier: 4.1.12 1489 1489 version: 4.1.12 1490 1490 1491 + packages/openapi-ts-tests/sdks: 1492 + devDependencies: 1493 + '@config/vite-base': 1494 + specifier: workspace:* 1495 + version: link:../../config-vite-base 1496 + '@hey-api/openapi-ts': 1497 + specifier: workspace:* 1498 + version: link:../../openapi-ts 1499 + typescript: 1500 + specifier: 5.9.3 1501 + version: 5.9.3 1502 + 1491 1503 packages/openapi-ts-tests/zod/v3: 1492 1504 devDependencies: 1493 1505 '@config/vite-base': ··· 23189 23201 eslint: 9.17.0(jiti@2.6.1) 23190 23202 eslint-import-resolver-node: 0.3.9 23191 23203 eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) 23192 - eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)) 23204 + eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) 23193 23205 eslint-plugin-jsx-a11y: 6.10.2(eslint@9.17.0(jiti@2.6.1)) 23194 23206 eslint-plugin-react: 7.37.5(eslint@9.17.0(jiti@2.6.1)) 23195 23207 eslint-plugin-react-hooks: 5.2.0(eslint@9.17.0(jiti@2.6.1)) ··· 23227 23239 tinyglobby: 0.2.14 23228 23240 unrs-resolver: 1.11.1 23229 23241 optionalDependencies: 23230 - eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)) 23242 + eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) 23231 23243 transitivePeerDependencies: 23232 23244 - supports-color 23233 23245 ··· 23242 23254 transitivePeerDependencies: 23243 23255 - supports-color 23244 23256 23245 - eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)): 23257 + eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)): 23246 23258 dependencies: 23247 23259 '@rtsao/scc': 1.1.0 23248 23260 array-includes: 3.1.9