Skip to content

feat(antd-swift)!: adopt PaymentMode enum + put/get convention (G3/1)#121

Merged
Nic-dorman merged 1 commit into
mainfrom
nic/antd-swift-payment-mode-rename
May 21, 2026
Merged

feat(antd-swift)!: adopt PaymentMode enum + put/get convention (G3/1)#121
Nic-dorman merged 1 commit into
mainfrom
nic/antd-swift-payment-mode-rename

Conversation

@Nic-dorman

Copy link
Copy Markdown
Collaborator

Brings the Swift SDK in line with the post-V2-340 wire shape. Stacks on top of nic/v2-340-file-upload-private; will rebase onto main once the base branch merges.

Summary

  • Typed PaymentMode enum (.auto / .merkle / .single) replaces stringly-typed paymentMode: String?.
  • Method renames to the put/get convention:
    • dataPutPrivatedataPut (POST /v1/data)
    • dataGetPrivatedataGet (POST /v1/data/get)
    • fileUploadPublicfilePutPublic (POST /v1/files/public)
    • fileDownloadPublicfileGetPublic (POST /v1/files/public/get)
  • New private-file methods: filePut (POST /v1/files), fileGet (POST /v1/files/get).
  • paymentMode threaded through dataPut, dataPutPublic, dataCost, filePut, filePutPublic, fileCost (REST). gRPC stays a stub set — signatures updated so the typed enum applies once stubs are wired.
  • New result types DataPutResult / DataPutPublicResult / FilePutResult / FilePutPublicResult carry chunksStored + paymentModeUsed; private results carry dataMap instead of address. PutResult is kept for chunkPut only. FileUploadResult removed.

Test plan

  • swift build clean (no warnings except the pre-existing grpc-swift unused-dep warning).
  • swift test — 23 / 23 pass on dev2 (swift 6.0 / linux).
  • New PutGetRenameWireTests assert payment_mode reaches the request body on every put/cost path, plus the POST shape of the new dataGet / fileGet / fileGetPublic endpoints.
  • ant dev example all -l swift against the live antd daemon — public data round-trip succeeds (Chunks stored: 3, mode used: single).

Note on the DTO fix

Removed explicit CodingKeys enums from the new DataPutDTO / FilePutDTO / etc. — they were silently suppressing the shared JSONDecoder's .convertFromSnakeCase strategy and nilling out every snake_case field at decode time. With CodingKeys absent, the strategy converts data_mapdataMap etc. and the property names match directly.

Mirrors the antd Swift SDK to the post-V2-340 wire shape:

- Add typed PaymentMode enum (.auto / .merkle / .single, raw string values).
- Rename methods:
    dataPutPrivate    -> dataPut          (POST /v1/data)
    dataGetPrivate    -> dataGet          (POST /v1/data/get)
    fileUploadPublic  -> filePutPublic    (POST /v1/files/public)
    fileDownloadPublic -> fileGetPublic   (POST /v1/files/public/get)
  New private-file methods:
    filePut                                (POST /v1/files)
    fileGet                                (POST /v1/files/get)
- Thread paymentMode through dataPut, dataPutPublic, dataCost,
  filePut, filePutPublic, fileCost on REST. gRPC client is still a
  stub set (throw notImplemented()) — signatures updated to match the
  protocol so the typed enum applies once stubs are wired up.
- Replace FileUploadResult with FilePutResult / FilePutPublicResult /
  DataPutResult / DataPutPublicResult — chunks_stored and
  payment_mode_used are surfaced explicitly; private results carry
  data_map instead of address. PutResult is kept for chunk_put only.
- Update SmokeTests: assert payment_mode reaches the wire body on
  every put/cost path, assert dataGet/fileGet/fileGetPublic POST shape,
  cover the new result types. The V2-249 and V2-274 prepare/finalize
  tests are unchanged.
- Update Main.swift example to use dataPutPublic(paymentMode:) and
  print chunksStored + paymentModeUsed.
- README API surface table updated.

Drop redundant CodingKeys from DataPutDTO / FilePutDTO / etc — they
were silently suppressing the shared JSONDecoder's convertFromSnakeCase
strategy, nilling out every snake_case field at decode time.
@Nic-dorman
Nic-dorman force-pushed the nic/antd-swift-payment-mode-rename branch from c8f92cf to 40bdec9 Compare May 21, 2026 15:50
Nic-dorman added a commit that referenced this pull request May 21, 2026
… PaymentMode on REST SDKs (G4)

Final fan-out tranche — the four REST-only SDKs that have no proto/gRPC
work to do. Same naming + paymentMode semantics as the typed SDKs (#116,
#117, #118, #119, #120, #121, #122, #123, #124).

Per-SDK summary:

- antd-js: new `PaymentMode` const + types `DataPutResult`,
  `DataPutPublicResult`, `FilePutResult`, `FilePutPublicResult`
  (`FileUploadResult` removed; `PutResult` kept for `chunkPut`).
  Method renames on `RestClient`: `dataPutPrivate` -> `dataPut`,
  `dataGetPrivate` -> `dataGet`, `fileUploadPublic` -> `filePutPublic`,
  `fileDownloadPublic` -> `fileGetPublic`. NEW: `filePut` + `fileGet`.
  `paymentMode` option added to data/file put + cost. package-lock.json
  refresh picks up the existing `ethers` devDep that example 07 imports.

- antd-php: new `PaymentMode` backed enum + readonly result classes; same
  method renames on `AntdClient` (sync + async variants).

- antd-zig: new `PaymentMode` enum with `.wire()`; result-type rename mirrors
  the others; `dataGet` switches to POST /v1/data/get with `data_map` body
  (replaces the old GET-with-querystring path).

- antd-lua: new `models.PaymentMode` table of wire strings; method renames
  on `Client`; `data_get` / `file_get` / `file_put_public` / `file_get_public`
  go through POST bodies on the new routes.

Validated on dev2:
- antd-js: npm test (63/63 pass) + ant dev example all -l js (all six OK).
- antd-php: phpunit (31/31 pass) + ant dev example all -l php (all OK).
- antd-zig: zig 0.14.1 build test (pass) + ant dev example all -l zig.
- antd-lua: busted (26/26 pass) + ant dev example all -l lua (all OK).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Nic-dorman
Nic-dorman merged commit a4c30ac into main May 21, 2026
Nic-dorman added a commit that referenced this pull request May 21, 2026
… PaymentMode on REST SDKs (G4) (#125)

Final fan-out tranche — the four REST-only SDKs that have no proto/gRPC
work to do. Same naming + paymentMode semantics as the typed SDKs (#116,
#117, #118, #119, #120, #121, #122, #123, #124).

Per-SDK summary:

- antd-js: new `PaymentMode` const + types `DataPutResult`,
  `DataPutPublicResult`, `FilePutResult`, `FilePutPublicResult`
  (`FileUploadResult` removed; `PutResult` kept for `chunkPut`).
  Method renames on `RestClient`: `dataPutPrivate` -> `dataPut`,
  `dataGetPrivate` -> `dataGet`, `fileUploadPublic` -> `filePutPublic`,
  `fileDownloadPublic` -> `fileGetPublic`. NEW: `filePut` + `fileGet`.
  `paymentMode` option added to data/file put + cost. package-lock.json
  refresh picks up the existing `ethers` devDep that example 07 imports.

- antd-php: new `PaymentMode` backed enum + readonly result classes; same
  method renames on `AntdClient` (sync + async variants).

- antd-zig: new `PaymentMode` enum with `.wire()`; result-type rename mirrors
  the others; `dataGet` switches to POST /v1/data/get with `data_map` body
  (replaces the old GET-with-querystring path).

- antd-lua: new `models.PaymentMode` table of wire strings; method renames
  on `Client`; `data_get` / `file_get` / `file_put_public` / `file_get_public`
  go through POST bodies on the new routes.

Validated on dev2:
- antd-js: npm test (63/63 pass) + ant dev example all -l js (all six OK).
- antd-php: phpunit (31/31 pass) + ant dev example all -l php (all OK).
- antd-zig: zig 0.14.1 build test (pass) + ant dev example all -l zig.
- antd-lua: busted (26/26 pass) + ant dev example all -l lua (all OK).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Nic-dorman
Nic-dorman deleted the nic/antd-swift-payment-mode-rename branch May 21, 2026 16:02
Nic-dorman added a commit that referenced this pull request May 21, 2026
Cuts v0.8.0 atop v0.7.1. Substantial breaking-change roll-up of the
put/get rename, the private-file PUT/GET gap close, and several minor
surface cleanups -- bundled here so the v1.0 cut can ship stable on top.

## Breaking (antd daemon)

- feat(antd)!: bind to 127.0.0.1 by default on REST and gRPC (#107).
  Previously bound 0.0.0.0; use --bind-rest / --bind-grpc to override.
- chore: remove dead graph_entry surface from antd proto + 5 SDKs (#92).
  GraphService and its 4 RPCs are gone; REST mounts dropped.
- chore: remove dir_upload_public / dir_download_public surface (#95).
  Use file_put_public on a directory path instead; the daemon recurses.
- feat(antd)!: normalize put/get convention + close private-file PUT and
  GET gaps (#115). Method renames across proto + REST + SDKs:
    data_put_private    -> data_put
    data_get_private    -> data_get
    file_upload_public  -> file_put_public
    file_download_public -> file_get_public
  New: file_put / file_get for the private file path (previously only
  the public variant existed). New typed results: DataPutResult,
  DataPutPublicResult, FilePutResult, FilePutPublicResult; PutResult
  is now annotated as chunk_put only.

## Additive

- feat(antd): honor payment_mode on gRPC put/cost paths and REST cost
  endpoints (#114). Optional kwarg threaded through every put/cost
  signature; empty/omitted maps to "auto" so older clients keep working.
- feat: external-signer public uploads + single-chunk prepare/finalize
  across 15 SDKs (#90).
- docs+spec: openapi.yaml refreshed for the v1.0 surface, including
  POST /v1/chunks/prepare and /v1/chunks/finalize for single-chunk
  external-signer publish (#126).

## SDK fan-out (PaymentMode + put/get convention, all 15)

#116 antd-go, #117 antd-py/ruby/elixir, #118 antd-rust, #119 antd-csharp,
#120 antd-java, #121 antd-swift, #122 antd-dart, #123 antd-kotlin,
#124 antd-cpp, #125 antd-js/php/zig/lua, #127 antd-mcp.

## SDK example + build fixes

- fix(antd-go): make 03-files example self-contained and runnable (#91)
- fix(examples): make 04-files runnable across cpp/rust/elixir/lua/php/ruby/zig (#93)
- fix(examples): runnable dart 04_files + java Example03Files; add java Example03Chunks (#94)
- feat: gRPC transport example for antd-py and antd-rust (#113)
- feat(antd-py): 07_external_signer example + ant-dev dispatcher entry (#98)
- feat(antd-js): 07-external-signer example + antd-py empty-payments fix (#99)
- feat(rust/go): 07-external-signer examples (#100)
- feat(antd-csharp): 07_external_signer example (#101)
- feat(antd-java): 07_external_signer example (#102)
- feat(antd-kotlin): 07_external_signer example (#103)
- feat(antd-dart): 07_external_signer example (#104)
- feat(antd-ruby): 07_external_signer example (#105)
- feat(antd-php): 07_external_signer example (#106)
- chore(antd-kotlin): drop stale GraphDescendant from local proto copy (#108)

## Docs / infra

- docs: external-signer flow reference + ABI + python smoke test (#97)
- docs: add SECURITY.md with threat model and disclosure policy (#109)
- docs!: refresh per-SDK READMEs + llms-full.txt + openapi.yaml for v1.0 surface (#126)
- ci: add Go lint + test + vuln scanning for antd-go (#112)
- ci: extend antd-rust to sibling-repo parity (fmt + clippy + audit + doc) (#111)
- ci: skip antd/openapi.yaml and llms-full.txt from triggering CI (#128)
- chore(scripts): add full-stack + integration sweep helpers (#96)
- fix(antd-rust): regenerate Cargo.lock to unbreak --locked CI (#110)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant