export type ApiProjectContributorRemoveRequest = {email: string}; export type DeleteApiApiV1ProjectsProjectTokenContributorsArgs = {projectToken: string, body: ApiProjectContributorRemoveRequest}; export type DeleteApiApiV1ProjectsProjectTokenContributorsOptions = {baseUrl?: string | undefined, PersonalAccessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove contributor from project * * DELETE /api/v1/projects/{projectToken}/contributors */ export const deleteApiApiV1ProjectsProjectTokenContributors = async (args: DeleteApiApiV1ProjectsProjectTokenContributorsArgs, options?: DeleteApiApiV1ProjectsProjectTokenContributorsOptions) => { const {baseUrl = "https://api.simplelocalize.io", fetch: fetchFn = fetch, PersonalAccessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (PersonalAccessToken !== undefined) headers.set("Authorization", PersonalAccessToken) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/projects/${encodeURIComponent(String(args.projectToken))}/contributors${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };