CLASS
ArdkSitesSession
public final class ArdkSitesSession: ArdkSession.IDisposable
Methods
requestOrganizationsForUser(userId:pollingInterval:timeout:)
public 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.
Parameters
| Name | Description |
|---|---|
| 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). |
requestSitesForOrganization(orgId:pollingInterval:timeout:)
public func requestSitesForOrganization(
orgId: String,
pollingInterval: TimeInterval = 0.5,
timeout: TimeInterval = 60.0
) async throws -> SiteResult
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
SiteResultcontaining the sites. - 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.
Parameters
| Name | Description |
|---|---|
| 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). |
requestAssetsForSite(siteId:pollingInterval:timeout:)
public func requestAssetsForSite(
siteId: String,
pollingInterval: TimeInterval = 0.5,
timeout: TimeInterval = 60.0
) async throws -> AssetResult
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
AssetResultcontaining the assets. - 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.
Parameters
| Name | Description |
|---|---|
| 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). |
requestOrganizationInfo(orgId:pollingInterval:timeout:)
public func requestOrganizationInfo(
orgId: String,
pollingInterval: TimeInterval = 0.5,
timeout: TimeInterval = 60.0
) async throws -> OrganizationResult
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
OrganizationResultcontaining the organization info. - 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.
Parameters
| Name | Description |
|---|---|
| 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). |
requestSiteInfo(siteId:pollingInterval:timeout:)
public func requestSiteInfo(
siteId: String,
pollingInterval: TimeInterval = 0.5,
timeout: TimeInterval = 60.0
) async throws -> SiteResult
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
SiteResultcontaining the site info. - 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.
Parameters
| Name | Description |
|---|---|
| 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). |
requestAssetInfo(assetId:pollingInterval:timeout:)
public func requestAssetInfo(
assetId: String,
pollingInterval: TimeInterval = 0.5,
timeout: TimeInterval = 60.0
) async throws -> AssetResult
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
AssetResultcontaining the asset info. - 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.
Parameters
| Name | Description |
|---|---|
| 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). |
requestUserInfo(userId:pollingInterval:timeout:)
public func requestUserInfo(
userId: String,
pollingInterval: TimeInterval = 0.5,
timeout: TimeInterval = 60.0
) async throws -> UserResult
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
UserResultcontaining the user info. - 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.
Parameters
| Name | Description |
|---|---|
| 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). |
requestSelfUserInfo(pollingInterval:timeout:)
public func requestSelfUserInfo(
pollingInterval: TimeInterval = 0.5,
timeout: TimeInterval = 60.0
) async throws -> UserResult
Requests self user info and waits for the result.
Uses the user ID from the authenticated session's metadata.
- Parameters:
- pollingInterval: The interval between status checks (default: 0.5 seconds).
- timeout: Maximum time to wait for completion (default: 60 seconds).
- Returns: A
UserResultcontaining the user info. - 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.ArdkError.invalidOperationif no access token was available.
Parameters
| Name | Description |
|---|---|
| pollingInterval | The interval between status checks (default: 0.5 seconds). |
| timeout | Maximum time to wait for completion (default: 60 seconds). |