fix: begin writing Lists integration tests. fix: list item response model's id value should be of type string so modified the created with id response model that it extends so that the id property is generically typed and type can be passed in.

This commit is contained in:
Stevan Freeborn
2023-02-17 14:27:33 -06:00
parent 369540d3c8
commit bc8b9a4977
10 changed files with 148 additions and 32 deletions
+7 -5
View File
@@ -219,17 +219,19 @@ export class ApiResponse<T> {
}
/**
* @method asCreatedWithIdResponseType - Converts the ApiResponse to an ApiResponse<CreatedWithIdResponse>.
* @returns {ApiResponse<CreatedWithIdResponse>} - An ApiResponse<CreatedWithIdResponse>.
* @method asCreatedWithIdResponseType - Converts the ApiResponse to an ApiResponse<CreatedWithIdResponse<T>>.
* @returns {ApiResponse<CreatedWithIdResponse<T>>} - An ApiResponse<CreatedWithIdResponse<T>>.
*/
public asCreatedWithIdResponseType(): ApiResponse<CreatedWithIdResponse> {
public asCreatedWithIdResponseType<T>(): ApiResponse<
CreatedWithIdResponse<T>
> {
const apiResponse = this as ApiResponse<any>;
const createdWithIdResponse = new CreatedWithIdResponse(
const createdWithIdResponse = new CreatedWithIdResponse<T>(
apiResponse.data.id
);
return new ApiResponse<CreatedWithIdResponse>(
return new ApiResponse<CreatedWithIdResponse<T>>(
apiResponse.statusCode,
apiResponse.message,
createdWithIdResponse