Skip to content

fix(antd-zig): pass payment_mode to dataPutPublic/dataPutPrivate in examples#79

Open
Nic-dorman wants to merge 1 commit into
mainfrom
fix/zig-example-arity
Open

fix(antd-zig): pass payment_mode to dataPutPublic/dataPutPrivate in examples#79
Nic-dorman wants to merge 1 commit into
mainfrom
fix/zig-example-arity

Conversation

@Nic-dorman
Copy link
Copy Markdown
Collaborator

Fixes #70.

examples/02-data.zig and examples/06-private-data.zig were calling the SDK's put methods with one arg short:

examples/02-data.zig:16:34: error: member function expected 2 argument(s), found 1
    const put_result = try client.dataPutPublic(message);
                           ~~~~~~^~~~~~~~~~~~~~
src/antd.zig:181:9: note: function declared here
    pub fn dataPutPublic(self: *Client, data: []const u8, payment_mode: ?[]const u8) !PutResult {

Pass null for the optional payment-mode (mirrors 04-files.zig, which already passes null to fileUploadPublic).

Affected:

  • 02-data.zig:16dataPutPublic
  • 06-private-data.zig:16dataPutPrivate

03-chunks.zig (chunkPut is single-arg) and 04-files.zig (already correct) are unchanged.

Test plan

  • Type-checks the SDK API surface with the new arity (the compiler error from the wrong arity is gone)
  • End-to-end run currently blocked by an unrelated Zig-version mismatch in src/json_helpers.zig / src/antd.zig itself: the source uses .empty (Zig 0.15-dev) AND http.Client.open (Zig 0.14.x), which don't coexist in any released Zig. Filed separately as antd-zig source uses Zig APIs from incompatible versions; doesn't compile on any released Zig #78. Once that lands, zig build run-02-data should green up.

Out of scope (worth a separate ticket)

examples/05-graph.zig calls graphEntryPut, graphEntryGet, graphEntryExists, and graphEntryCost, none of which exist on Client in src/antd.zig — looks like the entire graph example is targeting an API surface that hasn't landed yet. Not touching it here.

…xamples

The example call sites were one arg short:

  examples/02-data.zig:16: error: member function expected 2 argument(s), found 1
      const put_result = try client.dataPutPublic(message);

The SDK signature has been two-arg for a while:

  pub fn dataPutPublic(self: *Client, data: []const u8,
                       payment_mode: ?[]const u8) !PutResult

Pass null for the optional payment mode (matches what fileUploadPublic
already does in 04-files.zig).

Affected examples:
- 02-data.zig:16 dataPutPublic
- 06-private-data.zig:16 dataPutPrivate

Note: end-to-end execution is currently blocked on an unrelated Zig version
mismatch in the SDK source itself (.empty initializer + http.Client.open
do not coexist in any released Zig) - tracked in #78. The type-check of
the call sites passes once that is sorted; this PR fixes the example
shape independently.

Closes #70
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.

antd-zig: example 02-data calls dataPutPublic(message) but API requires (data, payment_mode)

1 participant