Organization Management
Complete guide to working with organization data in the Zync SDK.
Table of contents
The Zync SDK provides comprehensive organization management through the ZyncOrganizationManager. This follows the offline-first approach where local data is returned immediately and background sync operations keep the data updated.
Getting Organization Details
The primary method for accessing detailed organization information is getOrganizationDetail(), which returns complete organization data including related entities:
val result = zync.organizations.getOrganizationDetail("org_uid_123")
when (result) {
is GetOrganizationResult.Success -> {
val organizationDetail = result.data
println("Organization Name: ${organizationDetail.organizationName}")
println("UID: ${organizationDetail.organizationUid}")
}
is GetOrganizationResult.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.organizations.getOrganizationDetail(organizationUid: "org_uid_123")
switch onEnum(of: result) {
case .success(let success):
let organizationDetail = success.data
print("Organization Name: \(organizationDetail.organizationName)")
print("UID: \(organizationDetail.organizationUid)")
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)")
}
}
}