Skip to content

ndi.cloud.api.implementation.files.signedURLFileMap_keys

 SIGNEDURLFILEMAP_KEYS Extract the uid keys of the `files` object, in order.

    UIDS = ndi.cloud.api.implementation.files.SIGNEDURLFILEMAP_KEYS(RAWPAYLOAD)

    Scans the raw JSON text of a signed-url-set response for the top-level
    "files" object and returns its member names in the order they appear, as a
    cell array of char. This exists because JSONDECODE renames object keys that
    are not valid MATLAB identifiers, and a did.ido uid usually starts with a
    digit; see ndi.cloud.api.implementation.files.signedURLFileMap.

    The scan is vectorized rather than a character loop. A signed URL set for a
    lightsheet pyramid level can hold tens of thousands of entries (several MB
    of JSON), and an interpreted per-character walk over that is seconds of
    wall time per page.

    It is a real JSON scan, not a regular expression: backslash escapes and
    string state are tracked, so a brace, a quote, or the text `"files"`
    appearing inside a signed URL cannot end the object early or be mistaken
    for the member name.

    Inputs:
        rawPayload - The raw response payload, uint8 or char.

    Outputs:
        uids - Cell array of char uids, in payload order. Empty when the
               payload has no top-level "files" object, the object is empty, or
               the payload is malformed (unbalanced quotes or braces). The
               caller compares this count against the decoded struct and errors
               on a mismatch rather than mispairing uids with URLs.

    See also: ndi.cloud.api.implementation.files.signedURLFileMap