export type PutV2OrganizationsOrganizationIdUpdateMembers = {members: Array<{user_id: number, role?: ('user' | 'manager' | 'owner' | 'remove') | undefined, trackable?: boolean | undefined, view_only?: boolean | undefined, first_name?: string | undefined, last_name?: string | undefined, payment?: ({rate_type?: ('hourly' | 'fixed_amount') | undefined, pay_rate?: number | undefined, pay_period?: ('none' | 'weekly' | 'twice_per_month' | 'biweekly' | 'monthly') | undefined, timesheet_approval?: boolean | undefined, period_week_day?: number | undefined, period_start_day?: number | undefined, period_second_start_day?: number | undefined, period_anchor_date?: string | undefined}) | undefined, limits?: ({limits_by_shifts?: boolean | undefined, daily_limit?: number | undefined, weekly_limit?: number | undefined, expected_per_week?: number | undefined, current_daily_limit?: number | undefined, current_weekly_limit?: number | undefined, dow_limit?: (Array<'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'>) | undefined, dow_expected?: (Array<'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'>) | undefined}) | undefined, metadata?: Array<{key: string, value: string}> | undefined, projects?: (Array<{project_id: number, role: 'viewer' | 'user' | 'manager' | 'remove'}>) | undefined}>}; export type UpdateApiV2OrganizationsOrganizationIdUpdateMembersArgs = {organization_id: number, body: PutV2OrganizationsOrganizationIdUpdateMembers}; export type UpdateApiV2OrganizationsOrganizationIdUpdateMembersOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update organization members * * PUT /v2/organizations/{organization_id}/update_members */ export const updateApiV2OrganizationsOrganizationIdUpdateMembers = async (args: UpdateApiV2OrganizationsOrganizationIdUpdateMembersArgs, options?: UpdateApiV2OrganizationsOrganizationIdUpdateMembersOptions) => { const {baseUrl = "https://api.hubstaff.com", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/organizations/${encodeURIComponent(String(args.organization_id))}/update_members${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };