export type DeleteApiV1CredentialsAWSSidArgs = {Sid: string}; export type DeleteApiV1CredentialsAWSSidOptions = {baseUrl?: string | undefined, accountSidAuthToken?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Delete a Credential from your account * * DELETE /v1/Credentials/AWS/{Sid} */ export const deleteApiV1CredentialsAWSSid = async (args: DeleteApiV1CredentialsAWSSidArgs, options?: DeleteApiV1CredentialsAWSSidOptions) => { const {baseUrl = "https://accounts.twilio.com", fetch: fetchFn = fetch, accountSidAuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (accountSidAuthToken !== undefined) headers.set('authorization', `Basic ${btoa(`${accountSidAuthToken.username}:${accountSidAuthToken.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/Credentials/AWS/${encodeURIComponent(String(args.Sid))}${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 };