export type ExternalAPIContractsRequestsV1AddUserToWorkspaceRequest = {requestId?: (string | null) | undefined}; export type UpdateApiApiV1WorkspacesWorkspaceIdUsersUserIdArgs = {workspaceId: string, userId: string, body: ExternalAPIContractsRequestsV1AddUserToWorkspaceRequest}; export type UpdateApiApiV1WorkspacesWorkspaceIdUsersUserIdOptions = {baseUrl: string, TeamhoodAPIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add User to a Workspace with Workspace Collaborator access role * * PUT /api/v1/workspaces/{workspaceId}/users/{userId} */ export const updateApiApiV1WorkspacesWorkspaceIdUsersUserId = async (args: UpdateApiApiV1WorkspacesWorkspaceIdUsersUserIdArgs, options: UpdateApiApiV1WorkspacesWorkspaceIdUsersUserIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, TeamhoodAPIKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (TeamhoodAPIKey !== undefined) headers.set("X-ApiKey", TeamhoodAPIKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/workspaces/${encodeURIComponent(String(args.workspaceId))}/users/${encodeURIComponent(String(args.userId))}${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 };