export type OrgGroupMembershipType = 'org_group_memberships'; export type OrgGroupMembershipBulkDeleteRequestData = {id: string, type: OrgGroupMembershipType}; export type OrgGroupMembershipBulkDeleteRequest = {data: Array}; export type CreateApiApiV2OrgGroupMembershipsBulkDeleteArgs = {'filter[org_group_id]': string, body: OrgGroupMembershipBulkDeleteRequest}; export type CreateApiApiV2OrgGroupMembershipsBulkDeleteOptions = {baseUrl?: string | undefined, apiKeyAuth?: string | undefined, appKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Bulk delete org group memberships * * POST /api/v2/org_group_memberships/bulk_delete * * Also accepts auth: AuthZ */ export const createApiApiV2OrgGroupMembershipsBulkDelete = async (args: CreateApiApiV2OrgGroupMembershipsBulkDeleteArgs, options?: CreateApiApiV2OrgGroupMembershipsBulkDeleteOptions) => { const {baseUrl = "https://api.datadoghq.com", fetch: fetchFn = fetch, apiKeyAuth, appKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['filter[org_group_id]'] != null) query.append("filter[org_group_id]", String(args['filter[org_group_id]'])) if (apiKeyAuth !== undefined) headers.set("DD-API-KEY", apiKeyAuth) if (appKeyAuth !== undefined) headers.set("DD-APPLICATION-KEY", appKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/org_group_memberships/bulk_delete${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };