export type DeleteApiApiV1ReposUserIdRepoMasterTokensIdArgs = {user_id: string, repo: string, id: number}; export type DeleteApiApiV1ReposUserIdRepoMasterTokensIdOptions = {baseUrl?: string | undefined, apiToken?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * destroy * * DELETE /api/v1/repos/{user_id}/{repo}/master_tokens/{id} */ export const deleteApiApiV1ReposUserIdRepoMasterTokensId = async (args: DeleteApiApiV1ReposUserIdRepoMasterTokensIdArgs, options?: DeleteApiApiV1ReposUserIdRepoMasterTokensIdOptions) => { const {baseUrl = "https://packagecloud.io", fetch: fetchFn = fetch, apiToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiToken !== undefined) headers.set('authorization', `Basic ${btoa(`${apiToken.username}:${apiToken.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/repos/${encodeURIComponent(String(args.user_id))}/${encodeURIComponent(String(args.repo))}/master_tokens/${encodeURIComponent(String(args.id))}${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 };