public final class ApiClient: ObservableObject, Sendable {
public init(
baseURL: URL? = nil,
clientCredentials: ApiClientBearerToken? = nil
)
}
public typealias ApiClientBearerToken = String
public enum ApiClientError: Error { … }
public struct UserClient: Sendable {
public init(client: ApiClient)
public func create(user newUser: NewUser) async throws -> User
public func fetchUser(for token: String) async throws -> User
public func update(user: ExistingUser) async throws -> User
}
Models & Enums:
User
, NewUser
, ExistingUser
Sex
, Weight.Unit
public struct ScanClient: Sendable {
public init(client: ApiClient)
// Scan lifecycle
public func createScan(_ newScan: NewScan) async throws -> Scan
public func getScan(forScan id: String) async throws -> Scan
public func getScans(
forUser token: String,
limit: Int = 25,
cursor: String? = nil,
order: Sort = .descending
) async throws -> Paginated<Scan>
public func deleteScan(_ id: String) async throws -> Scan
// Upload URLs & assets
public func uploadUrl(forScan id: String) async throws -> UploadUrl
public func assetUrls(forScan id: String) async throws -> AssetUrls
public func assetUrl(
forScan id: String,
option: AssetUrls.Option
) async throws -> String
// Measurements & predictions
public func measurements(forScan id: String) async throws -> Measurements
public func updateBodyFatMethod(
forScan id: String,
_ bodyfatMethod: BodyfatMethod
) async throws -> Bodyfat
public func createBodyShapePrediction(
_ payload: BodyShapePredictionPayload
) async throws -> BodyShapePrediction
public func getBodyShapePrediction(
forBodyShapePrediction id: String
) async throws -> BodyShapePrediction
public func getBodyShapePredictionAsset(
forBodyShapePrediction id: String
) async throws -> BodyShapePredictionAssetUrl
}
Models & Generics:
Scan
, NewScan
, Paginated<T>
, Sort
UploadUrl
, AssetUrls
, Measurements
BodyShapePrediction
, BodyShapePredictionAssetUrl
, BodyfatMethod
, Bodyfat
PrismStateManager
public protocol PrismStateManager {
func start()
func stop()
}