export type AddTeamMembersRequest = {emails: Array, permissionLevel?: ('Level1' | 'Level2' | 'Level3' | 'Level4' | 'Level5' | null) | undefined, title?: (string | null) | undefined, roleIds?: (Array | null) | undefined}; export type CreateApiV4OrganizationsTeamArgs = {body: AddTeamMembersRequest}; export type CreateApiV4OrganizationsTeamOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add Team Members to Organization * * POST /v4/organizations/team */ export const createApiV4OrganizationsTeam = async (args: CreateApiV4OrganizationsTeamArgs, options?: CreateApiV4OrganizationsTeamOptions) => { const {baseUrl = "https://submittable-api.submittable.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v4/organizations/team${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 };