Skip to content

Code formatting: Splatting input parameters before Invoke-FabricRestMethod calls #87

Open
@NowinskiK

Description

@NowinskiK

There is an idea to format input parameters as splatting with hash tables.
All original code files from @tiagobalabuch use multiple lines with ` characters.
Example:

        $response = Invoke-FabricRestMethod `
            -Uri $apiEndpointUrl `
            -Method Post `
            -Body $bodyJson

New format suggested by @jpomfret :

            $apiParams = @{
                Uri    = $apiEndpointURI
                method = 'Post'
                body   = $bodyJson
            }
            $response = Invoke-FabricRestMethod @apiParams

Microsoft Learn: about_splatting

These are cosmetic changes and should not impact the current code logic.

Stats:

Method # used
Invoke-FabricRestMethod ` 154
Invoke-FabricRestMethod @ (hash splatting) 10
Invoke-FabricRestMethod - (one line) 27

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions