Skip to content

[REQ][TYPESCRIPT-FETCH] Generate requests without sending them #21708

@azertyalex

Description

@azertyalex

Is your feature request related to a problem? Please describe.

I want typed requests but I don't need to send them one by one. I have a batch endpoint which accepts requests in following format

export const Method = {
    POST: 'POST',
    DELETE: 'DELETE',
    PUT: 'PUT',
    PATCH: 'PATCH',
    GET: 'GET',
};

export type Method = (typeof Method)[keyof typeof Method];

export class BatchOperation {
    @ApiProperty({ enum: Method })
    @IsEnum(Method)
    @IsNotEmpty()
    method: Method;

    @IsString()
    @IsNotEmpty()
    path: string;

    @IsObject()
    @IsOptional()
    body?: any;
}

export class BatchOperationsDto {
    @Allow()
    operations: BatchOperation[];
}

Describe the solution you'd like

I would like to be able to create typed requests but send them myself when necessary.

Describe alternatives you've considered

I couldn't really find alternatives

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions