Skip to content

Add public service-layer wrapper for modifyZones in CloudKitService #341

@leogdion

Description

@leogdion

Context

Sources/MistKit/Generated/Client.swift:1766 exposes internal func modifyZones(_ input: Operations.modifyZones.Input) async throws -> Operations.modifyZones.Output from the generated layer, but there is no public CloudKitService wrapper.

The sibling zone operations are wrapped in Sources/MistKit/Service/Extensions/CloudKitService+ZoneOperations.swift:

  • public func listZones(database:) async throws(CloudKitError) -> [ZoneInfo]
  • public func lookupZones(zoneIDs:database:) async throws(CloudKitError) -> [ZoneInfo]

modifyZones has no equivalent, which means external consumers (including MistDemo's planned modify-zones command in #215) cannot reach the endpoint at all.

Scope

Add a public func modifyZones(...) method to CloudKitService+ZoneOperations.swift that:

  • Takes ergonomic Swift inputs (e.g. an [ZoneOperation] describing create / delete with ZoneIDs) instead of raw Operations.modifyZones.Input.
  • Returns ergonomic Swift outputs (e.g. [ZoneInfo] or a small ZoneModifyResult value type) instead of Operations.modifyZones.Output.
  • Declares throws(CloudKitError) and routes failures through mapToCloudKitError(_:context:).
  • Resolves auth + transport via self.client(for: database)modifyZones is private/shared-database only, so reject .public with a clear error.
  • Validates inputs (non-empty operations list, non-empty zone names) before hitting the network, mirroring the guards in lookupZones.
  • Normalizes the response via responseProcessor if a matching helper exists; otherwise add one alongside the listZones/lookupZones processors.

Tests

  • Unit tests in Tests/MistKitTests/Service/ covering: create-only batch, delete-only batch, mixed batch, empty-operations rejection, empty-zone-name rejection, .public rejection, error mapping.
  • Mock client coverage following the pattern used for listZones / lookupZones.

Out of scope

Definition of Done

  • public func modifyZones(...) lands in CloudKitService+ZoneOperations.swift
  • Generated-layer call is encapsulated; no caller has to touch Operations.modifyZones.*
  • Unit tests cover create, delete, mixed, validation, and error paths
  • CLAUDE.md "CloudKitService Operations" table updated to list modifyZones
  • swift build + swift test + ./Scripts/lint.sh clean

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions