Creating local file attachments for a Delivery entity

The Delivery entity has an attachments field, which is a multi-entity field of type Attachment.
Is it possible to create a list of local link attachments together with creating the delivery entity itself in one step?

In Versions, for example, you only fill in

{
  "sg_path_to_frames": {
    "local_path": "...",
    "link_type": "local"
  }
}

which is sufficient and easy enough.

For the Delivery attachments though this does not work, it expects them to already be a list of Attachment entities with type and id… I guess I cannot do the same as versions/published files? Is it just because it is a list field?

API Reference — python-api v3.2.6 documentation does not mention any details about this use case.

Now I tried sg.createing the attachments first and then passing them to the delivery:

    attach_batches = [{
        "request_type": "create",
        "entity_type": "Attachment",
        "data": {
            "sg_locallink": {
                "local_path": f
            }
        }} for f in files_to_attach]

    attach_results = tk.shotgun.batch(attach_batches)

    delivery_entity = tk.shotgun.create(
        "Delivery",
        {
            "title": delivery_id,
            "sg_contents": contents,
            "project": project,
            "attachments": attach_results
        })

This “works” without complaint, but the attachments appear as just dashes in the delivery entity details screen, as if they are not valid attachments or something, and are not clickable.

Any ideas how to achieve this? Am I just missing some fields, or this is fundamentally wrong?

Figured it out after a third read of the documentation, actually the request has to be

    attach_batches = [{
        "request_type": "create",
        "entity_type": "Attachment",
        "data": {
            "this_file": {
                "link_type": "local",
                "local_path": f
            }
        }} for f in files_to_attach]

    attach_results = tk.shotgun.batch(attach_batches)

The key being that this_file is the needed field, with link_type, etc. This was not immediately clear from the examples.