Publish-QlikApp.ps1

function Publish-QlikApp {
    <#
    .SYNOPSIS
    This function ...
 
    .DESCRIPTION
    A bit more description
 
    .PARAMETER FromPipeline
    Shows how to process input from the pipeline, remaining parameters or by named parameter.
 
    .EXAMPLE
    Publish-QlikApp 'abc'
 
    Description of the example.
 
    #>


    <# Enable -Confirm and -WhatIf. #>
    [CmdletBinding(SupportsShouldProcess = $true)]
    param(
      [parameter(Mandatory=$true,Position=0,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)]
    [string]$id,

    [parameter(Mandatory=$true,Position=1)]
    [string]$stream,

    [string]$name
    )

    begin {
    }

    process {
    If( $stream -match $script:guid ) {
      $streamId = $stream
    } else {
      $streamId = $(Get-QlikStream -filter "name eq '$stream'").id
    }

    $path = "/qrs/app/$id/publish?stream=$streamId"

    If( $name )
    {
      $path += "&name=$name"
    }

    return Invoke-QlikPut $path
  }

    end {
    }
}

if ($loadingModule) {
    Export-ModuleMember -Function 'Publish-QlikApp'
}