requestOrganizationsForUser
Requests organizations for a user and waits for the result....
Declaration
func requestOrganizationsForUser(userId: String, pollingInterval: TimeInterval = 0.5, timeout: TimeInterval = 60.0) async throws -> OrganizationResult
Requests organizations for a user and waits for the result.
This is an async wrapper that combines request initiation and polling.
It automatically handles polling until the request completes or times out.
- Parameters:
- userId: The user ID to fetch organizations for.
- pollingInterval: The interval between status checks (default: 0.5 seconds).
- timeout: Maximum time to wait for completion (default: 60 seconds).
- Returns: An
OrganizationResultcontaining the organizations.- Throws:
-
CancellationErrorif the Task running this function was cancelled.-
TimeoutErrorif the function timed out before it could complete execution.-
SitesResult.Errorif there was an error specific to the network query.