Product Management

Complete guide to working with product data in the Zync SDK.

Table of contents

  1. Getting Product Details

The Zync SDK provides comprehensive product management through the ZyncProductManager. Products represent items and services available in the catalog. The SDK follows the offline-first approach where local data is returned immediately and background sync operations keep the data updated.

Getting Product Details

The primary method for accessing detailed product information is getProductDetail(), which returns complete product data including pricing and specifications:

val result = zync.products.getProductDetail("product_uid_123")

when (result) {
    is ProductDetailResult.Success -> {
        val product = result.data
        println("Product Name: ${product.productName}")
        println("UID: ${product.productUid}")
    }
    is ProductDetailResult.Failure -> {
        println("Error: ${result.error.message}")
        when (result.error) {
            is ZyncError.Network -> {
                println("Check your internet connection")
            }
            is ZyncError.Error -> {
                result.error.code?.let { code ->
                    println("Error code: $code")
                }
            }
        }
    }
}
let result = try await zync.products.getProductDetail(productUid: "product_uid_123")

switch onEnum(of: result) {
case .success(let success):
    let product = success.data
    print("Product Name: \(product.productName)")
    print("UID: \(product.productUid)")
case .failure(let failure):
    print("Error: \(failure.error.message)")
    switch onEnum(of: failure.error) {
    case .network:
        print("Check your internet connection")
    case .error(let error):
        print("Error: \(error.message)")
        if let code = error.code {
            print("Error code: \(code)")
        }
    }
}

Copyright © 2025 Zuper Inc. All rights reserved. This software is proprietary and confidential.