diff --git a/src/resources/simulations/index.ts b/src/resources/simulations/index.ts index a22874f..79eea10 100644 --- a/src/resources/simulations/index.ts +++ b/src/resources/simulations/index.ts @@ -26,9 +26,7 @@ const SimulationPaths = { } as const; export class SimulationsResource extends BaseResource { - public list( - queryParams?: ListSimulationQueryParameters, - ): SimulationCollection { + public list(queryParams?: ListSimulationQueryParameters): SimulationCollection { const queryParameters = new QueryParameters(queryParams); return new SimulationCollection(this.client, SimulationPaths.list + queryParameters.toQueryString()); } @@ -62,14 +60,14 @@ export class SimulationsResource extends BaseResource { public async update( simulationId: string, - updateSimulation: UpdateSimulationRequestBody, + updateSimulation: UpdateSimulationRequestBody, ): Promise> { const urlWithPathParams = new PathParameters(SimulationPaths.update, { simulation_id: simulationId, }).deriveUrl(); const response = await this.client.patch< - UpdateSimulationRequestBody, + UpdateSimulationRequestBody, Response> | ErrorResponse >(urlWithPathParams, updateSimulation); diff --git a/src/resources/simulations/operations/update-simulation-request-body.ts b/src/resources/simulations/operations/update-simulation-request-body.ts index ec4413c..a342c2e 100644 --- a/src/resources/simulations/operations/update-simulation-request-body.ts +++ b/src/resources/simulations/operations/update-simulation-request-body.ts @@ -5,12 +5,12 @@ */ import type { SimulationScenarioType, Status } from '../../../enums'; -import type { IEventName } from '../../../notifications'; +import type { EventMap, IEventName } from '../../../notifications'; -export interface UpdateSimulationRequestBody { +export interface UpdateSimulationRequestBody { notificationSettingId?: string; name?: string; status?: Status; - type?: IEventName | SimulationScenarioType; - payload?: any; + type?: T; + payload?: (T extends IEventName ? EventMap[T] : null) | null; }