export type DeleteApiApiV1PostsPostIdCommentsCommentIdArgs = {'x-request-id': string, 'x-api-key': string, 'x-user-key': string, postId: string, commentId: string}; export type DeleteApiApiV1PostsPostIdCommentsCommentIdOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Soft-delete a comment * * DELETE /api/v1/posts/{postId}/comments/{commentId} */ export const deleteApiApiV1PostsPostIdCommentsCommentId = async (args: DeleteApiApiV1PostsPostIdCommentsCommentIdArgs, options?: DeleteApiApiV1PostsPostIdCommentsCommentIdOptions) => { const {baseUrl = "https://public-api.etoro.com", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['x-request-id'] != null) headers.set("x-request-id", String(args['x-request-id'])) if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) if (args['x-user-key'] != null) headers.set("x-user-key", String(args['x-user-key'])) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/posts/${encodeURIComponent(String(args.postId))}/comments/${encodeURIComponent(String(args.commentId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };