Skip to main content
API Reference NSDK

NSDKSitesSession


Declaration

final class NSDKSitesSession

Methods

NameTypeSummary
requestAssetInfoAssetResult
Requests asset info and waits for the result.
- Parameters:
- assetId: The asset ID to fetch info for.
- pollingInterval: The interval between status checks (default: 0.5 seconds).
- timeout: Maximum time to wait for completion (default: 60 seconds).
- Returns: An AssetResult containing the asset info.
- Throws:
- CancellationError if the Task running this function was cancelled.
- TimeoutError if the function timed out before it could complete execution.
- SitesResult.Error if there was an error specific to the network query.
requestAssetsForSiteAssetResult
Requests assets for a site and waits for the result.
- Parameters:
- siteId: The site ID to fetch assets for.
- pollingInterval: The interval between status checks (default: 0.5 seconds).
- timeout: Maximum time to wait for completion (default: 60 seconds).
- Returns: An AssetResult containing the assets.
- Throws:
- CancellationError if the Task running this function was cancelled.
- TimeoutError if the function timed out before it could complete execution.
- SitesResult.Error if there was an error specific to the network query.
requestOrganizationInfoOrganizationResult
Requests organization info and waits for the result.
- Parameters:
- orgId: The organization ID to fetch info for.
- pollingInterval: The interval between status checks (default: 0.5 seconds).
- timeout: Maximum time to wait for completion (default: 60 seconds).
- Returns: An OrganizationResult containing the organization info.
- Throws:
- CancellationError if the Task running this function was cancelled.
- TimeoutError if the function timed out before it could complete execution.
- SitesResult.Error if there was an error specific to the network query.
requestOrganizationsForUserOrganizationResult
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.
- Note: Consider using requestSelfOrganizationInfo(pollingInterval:timeout:) instead.
- 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 OrganizationResult containing the organizations.
- Throws:
- CancellationError if the Task running this function was cancelled.
- TimeoutError if the function timed out before it could complete execution.
- SitesResult.Error if there was an error specific to the network query.
requestSelfOrganizationInfoOrganizationResult
Requests organizations for the current authenticated session and waits for the result.
- Parameters:
- pollingInterval: The interval between status checks (default: 0.5 seconds).
- timeout: Maximum time to wait for completion (default: 60 seconds).
- Returns: An OrganizationResult containing the organizations.
- Throws:
- CancellationError if the Task running this function was cancelled.
- TimeoutError if the function timed out before it could complete execution.
- SitesResult.Error if there was an error specific to the network query.
- NSDKError.invalidOperation if no access token was available.
requestSelfUserInfoUserResult
Requests self user info and waits for the result.
Uses the user ID from the authenticated session's metadata.
To fetch organizations, consider using
requestSelfOrganizationInfo(pollingInterval:timeout:) instead.
- Parameters:
- pollingInterval: The interval between status checks (default: 0.5 seconds).
- timeout: Maximum time to wait for completion (default: 60 seconds).
- Returns: A UserResult containing the user info.
- Throws:
- CancellationError if the Task running this function was cancelled.
- TimeoutError if the function timed out before it could complete execution.
- SitesResult.Error if there was an error specific to the network query.
- NSDKError.invalidOperation if no access token was available.
requestSiteAssetsByLocationSiteAssetsResult
Requests sites and their assets near a GPS coordinate and waits for the result.
Results are ordered by distance from the query coordinate.
- Parameters:
- lat: Latitude of the query coordinate.
- lng: Longitude of the query coordinate.
- radiusMeters: Search radius in meters.
- assetType: The type of assets to fetch (default: .vpsInfo).
- pollingInterval: The interval between status checks (default: 0.5 seconds).
- timeout: Maximum time to wait for completion (default: 60 seconds).
- Returns: A SiteAssetsResult containing site-assets entries ordered by distance.
- Throws:
- CancellationError if the Task running this function was cancelled.
- TimeoutError if the function timed out before it could complete execution.
- SitesResult.Error if there was an error specific to the network query.
requestSiteInfoSiteResult
Requests site info and waits for the result.
- Parameters:
- siteId: The site ID to fetch info for.
- pollingInterval: The interval between status checks (default: 0.5 seconds).
- timeout: Maximum time to wait for completion (default: 60 seconds).
- Returns: A SiteResult containing the site info.
- Throws:
- CancellationError if the Task running this function was cancelled.
- TimeoutError if the function timed out before it could complete execution.
- SitesResult.Error if there was an error specific to the network query.
requestSitesForOrganizationSiteResult
Requests sites for an organization and waits for the result.
- Parameters:
- orgId: The organization ID to fetch sites for.
- pollingInterval: The interval between status checks (default: 0.5 seconds).
- timeout: Maximum time to wait for completion (default: 60 seconds).
- Returns: A SiteResult containing the sites.
- Throws:
- CancellationError if the Task running this function was cancelled.
- TimeoutError if the function timed out before it could complete execution.
- SitesResult.Error if there was an error specific to the network query.
requestUserInfoUserResult
Requests user info and waits for the result.
- Parameters:
- userId: The user ID to fetch info for.
- pollingInterval: The interval between status checks (default: 0.5 seconds).
- timeout: Maximum time to wait for completion (default: 60 seconds).
- Returns: A UserResult containing the user info.
- Throws:
- CancellationError if the Task running this function was cancelled.
- TimeoutError if the function timed out before it could complete execution.
- SitesResult.Error if there was an error specific to the network query.