Skip to main content

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 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.

Parameters​

NameDescription
userIdThe user ID to fetch organizations for.
pollingIntervalThe interval between status checks (default: 0.5 seconds).
timeoutMaximum 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 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.

Parameters​

NameDescription
orgIdThe organization ID to fetch sites for.
pollingIntervalThe interval between status checks (default: 0.5 seconds).
timeoutMaximum 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 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.

Parameters​

NameDescription
siteIdThe site ID to fetch assets for.
pollingIntervalThe interval between status checks (default: 0.5 seconds).
timeoutMaximum 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 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.

Parameters​

NameDescription
orgIdThe organization ID to fetch info for.
pollingIntervalThe interval between status checks (default: 0.5 seconds).
timeoutMaximum 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 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.

Parameters​

NameDescription
siteIdThe site ID to fetch info for.
pollingIntervalThe interval between status checks (default: 0.5 seconds).
timeoutMaximum 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 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.

Parameters​

NameDescription
assetIdThe asset ID to fetch info for.
pollingIntervalThe interval between status checks (default: 0.5 seconds).
timeoutMaximum 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 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.

Parameters​

NameDescription
userIdThe user ID to fetch info for.
pollingIntervalThe interval between status checks (default: 0.5 seconds).
timeoutMaximum 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 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.
    • ArdkError.invalidOperation if no access token was available.

Parameters​

NameDescription
pollingIntervalThe interval between status checks (default: 0.5 seconds).
timeoutMaximum time to wait for completion (default: 60 seconds).