Exposing commands for a device via REST API

In all honesty, I’ve been hacking my way around the SmartThings API, but in all my work I have yet to find any way to list available commands for a given device.
Now I realize that there is the API documentation here,
and a list of capabilities here,
however in the case of some devices, it looks like some commands are missing. For example:

When you look at the Lock api, it mentions that there are two known commands: lock() and unlock(), however I discovered some more commands that are not listed. Namely:

setCode()

    # create a post for commands
    $body = @{
        "commands" = 
            @(@{
                "component" = $selectedDevice.components[0].id
                "capability" = "lockCodes"
                "command" = "setCode"
                "arguments" = @($nextId, $code, $codeName)
            })

and
deleteCode()

    # create a post for commands
    $body = @{
        "commands" = 
            @(@{
                "component" = $selectedDevice.components[0].id
                "capability" = "lockCodes"
                "command" = "deleteCode"
                "arguments" = @([int]$selectedCode.Name)
            })
    }    

I have been reading up on z-wave protocol and for the life of me I cannot discover where to find an extensive list of capability commands. Is there a way to make devices or capabilities to announce their commands?

This is a docs issue. I am trying to see if it has already been marked as an issue internally. If has not I will open a ticke. You can also send an email to build@smartthings.com for isuses like this one.