Contract Management

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

Table of contents

  1. Getting Contract Details

The Zync SDK provides comprehensive contract management through the ZyncContractManager. Contracts represent service agreements and follow the offline-first approach where local data is returned immediately and background sync operations keep the data updated.

Getting Contract Details

The primary method for accessing detailed contract information is getContractDetail(), which returns complete contract data including related entities:

val result = zync.contracts.getContractDetail("contract_uid_123")

when (result) {
    is ContractResult.Success -> {
        val contract = result.data
        println("Contract Name: ${contract.name}")
        println("UID: ${contract.contractUid}")
    }
    is ContractResult.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.contracts.getContractDetail(contractUid: "contract_uid_123")

switch onEnum(of: result) {
case .success(let success):
    let contract = success.data
    print("Contract Name: \(contract.name)")
    print("UID: \(contract.contractUid)")
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.