feat: implement deleteFileById method

This commit is contained in:
StevanFreeborn
2023-02-06 22:16:43 -06:00
parent 04e1ebdf8d
commit a68ea4f63e
2 changed files with 233 additions and 0 deletions
+25
View File
@@ -253,6 +253,22 @@ export class OnspringClient {
return apiResponse.asCreatedWithIdResponseType();
}
public async deleteFileById(
recordId: number,
fieldId: number,
fileId: number
): Promise<ApiResponse<any>> {
const endpoint = EndpointFactory.getDeleteFileByIdEndpoint(
recordId,
fieldId,
fileId
);
const apiResponse = await this.delete<any>(endpoint);
return apiResponse;
}
/**
* @method get - Makes a GET request to the specified endpoint.
* @param {string} endpoint - The endpoint that will be used to make the request.
@@ -284,4 +300,13 @@ export class OnspringClient {
const apiResponse = ApiResponseFactory.getApiResponse<T>(response);
return apiResponse;
}
private async delete<T>(
endpoint: string,
config: AxiosRequestConfig = {}
): Promise<ApiResponse<T>> {
const response = await this._client.delete(endpoint, config);
const apiResponse = ApiResponseFactory.getApiResponse<T>(response);
return apiResponse;
}
}