PSImmich.psm1

#Region './prefix.ps1' -1

# The content of this file will be prepended to the top of the psm1 module file. This is useful for custom module setup is needed on import.

#EndRegion './prefix.ps1' 3
#Region './Classes/ImmichSession.class.ps1' -1

[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '', Justification = 'JWT token retreived in plain text')]
class ImmichSession
{
    [string]$BaseUri
    [string]$AuthMethod
    [securestring]$AccessToken
    [boolean]$AccessTokenValid
    [pscredential]$Credential
    [securestring]$JWT
    [string]$APIUri
    [string]$ImmichVersion
    [string]$SessionID

    ImmichSession ([string]$BaseUri, [securestring]$AccessToken)
    {
        Write-Debug -Message 'ImmichSession.Class; Running constructor accesstoken'
        $this.SessionID = (New-Guid).Guid
        $this.BaseUri = $BaseUri
        $this.APIUri = "$BaseUri/api"
        $this.AuthMethod = 'AccessToken'
        $this.AccessToken = $AccessToken
        $this.GetStatus()
        Write-Verbose -Message "Connected to Immich instance at $($this.BaseUri) with AccessToken"
    }

    ImmichSession ([string]$BaseUri, [pscredential]$Credential)
    {
        Write-Debug -Message 'ImmichSession.Class; Running constructor credential'
        $this.SessionID = (New-Guid).Guid
        $this.BaseUri = $BaseUri
        $this.APIUri = "$BaseUri/api"
        $this.AuthMethod = 'Credential'
        $this.Credential = $Credential
        $this.AuthenticateCredential()
        $this.GetStatus()
        Write-Verbose -Message "Connected to Immich instance at $($this.BaseUri) with Credentials"
    }

    ValidateToken()
    {
        try
        {
            if ($this.AuthMethod -eq 'Credential')
            {
                $Result = Invoke-RestMethod -Method Post -Uri "$($this.ApiUri)/auth/validateToken" -Headers @{Authorization = "Bearer $(ConvertFromSecureString -SecureString $this.JWT)" } | Select-Object -Property AuthStatus
            }
            else
            {
                $Result = Invoke-RestMethod -Method Post -Uri "$($this.ApiUri)/auth/validateToken" -Headers @{'X-API-Key' = "$(ConvertFromSecureString -SecureString $this.AccessToken)" } | Select-Object -Property AuthStatus
            }
        }
        catch
        {
            $this.AccessTokenValid = $false
            throw $_.Exception.message
        }
        if ($Result)
        {
            $this.AccessTokenValid = $true
        }
        else
        {
            $this.AccessTokenValid = $false
            throw 'AccessToken is not valid, please reconnect'
        }
    }

    hidden AuthenticateCredential()
    {
        $BodyObject = @{
            password = $this.Credential.GetNetworkCredential().Password
            email    = $this.Credential.Username
        }
        $JWTResponse = InvokeImmichRestMethod -NoAuth -Method:'Post' -ImmichSession $this -RelativePath '/auth/login' -Body $BodyObject
        $this.JWT = ConvertTo-SecureString -String $JWTResponse.accessToken -AsPlainText -Force
        $this.AccessToken = ConvertTo-SecureString -String $JWTResponse.accessToken -AsPlainText -Force
        Remove-Variable -Name JWTResponse
    }

    hidden GetStatus()
    {
        $this.ValidateToken()
        $Status = InvokeImmichRestMethod -Method:'Get' -ImmichSession $this -RelativePath '/server-info/version'
        $this.ImmichVersion = "$($Status.Major).$($Status.Minor).$($Status.Patch)"
        Remove-Variable -Name Status
    }

}
#EndRegion './Classes/ImmichSession.class.ps1' 89
#Region './Private/ConvertFromSecureString.ps1' -1

function ConvertFromSecureString
{
    <#
    .DESCRIPTION
        Function that retreives the original value of the securestring. Obsolete in Windows Core becuase
        ConvertFrom-SecureString has an AsPlainText parameter but this function is instead used for
        Windows Powershell backwards compatiblity.
    .PARAMETER SecureString
        Defines the input securestring variable.
    .EXAMPLE
        ConvertFromSecureString
    #>

    param(
        [securestring]$SecureString
    )

    # Windows Powershell does not include ConvertFrom-SecureString -AsPlainText parameter.
    if ($PSVersionTable.PSEdition -eq 'Desktop')
    {
        $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString)
        $UnsecurePassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
        [Runtime.InteropServices.Marshal]::ZeroFreeBSTR($BSTR)
    }
    # Due to text encoding differences between windows and linux PtrToStringAuto does not work as expected with BSTR
    elseif ($PSVersionTable.PSEdition -eq 'Core')
    {
        $UnsecurePassword = ConvertFrom-SecureString -SecureString $SecureString -AsPlainText
    }

    return ($UnsecurePassword -join '')
}
#EndRegion './Private/ConvertFromSecureString.ps1' 32
#Region './Private/InvokeImmichRestMethod.ps1' -1

function InvokeImmichRestMethod
{
    <#
    .DESCRIPTION
        Function that is responsible for making the rest api web call
    .PARAMETER NoAuth
        Specifies that the REST API call do not need authentication
    .PARAMETER Method
        Defines the method to use when calling the REST API, valid values GET,POST etc.
    .PARAMETER ImmichSession
        A ImmichSession object to use for the call.
    .PARAMETER RelativePath
        The REST API path relative to the base URL
    .PARAMETER Body
        Defines body attributes for the REST API call
    .PARAMETER Headers
        Defines header attributes for the REST API call
    .PARAMETER QueryParameters
         Defines QueryParameters for the REST API call
    .PARAMETER ContentType
        Defines the contenttype for the request
    .PARAMETER OutFilePath
        Defines an output directory
    .PARAMETER RawBody
        Provides a raw body to use instead of parsing a hashtable to json.
    .EXAMPLE
        InvokeImmichRestMethod
    #>

    [CmdletBinding()] # Enabled advanced function support
    param(
        [switch]$NoAuth,
        [string]$Method,
        [immichsession]$ImmichSession,
        [string]$RelativePath,
        [hashtable]$Body,
        [string]$RawBody,
        [hashtable]$Headers,
        [hashtable]$QueryParameters,
        [string]$ContentType = 'application/json',
        [System.IO.FileInfo]$OutFilePath
    )

    # Use immich session from parameter first, from module scope session second and throw if none is found
    if (-not $ImmichSession)
    {
        Write-Debug -Message 'InvokeImmichRestMethod; No ImmichSession passed as parameter'
        if ($script:ImmichSession)
        {
            Write-Debug -Message 'InvokeImmichRestMethod; ImmichSession found in script scope'
            $ImmichSession = $script:ImmichSession
        }
        else
        {
            Write-Error -Message 'No Immich Session established, please call Connect-Immich' -ErrorAction Stop
        }
    }

    # Initialize invoke rest method splat
    $InvokeRestMethodSplat = @{
        Method      = $Method
        Uri         = "$($ImmichSession.ApiUri)$($RelativePath)"
        ContentType = $ContentType
    }

    # Skip auth headers if noauth is specified
    if (-not $NoAuth)
    {
        # Custom headers has not been provided so we need to initialize an empty hashtable
        if (-not $Headers)
        {
            $Headers = @{}
        }
        switch ($ImmichSession.AuthMethod)
        {
            'Credential'
            {
                $Headers.Authorization = "Bearer $(ConvertFromSecureString -SecureString $ImmichSession.JWT)"
            }
            'AccessToken'
            {
                $Headers.'X-API-Key' = ConvertFromSecureString -SecureString $ImmichSession.AccessToken
            }
        }
    }

    # Add headers to invoke rest method splat
    if ($Headers)
    {
        $InvokeRestMethodSplat.Headers = $Headers
    }

    # Add body to invoke rest method splat
    if ($Body)
    {
        $NewBody = @{}
        foreach ($Key in $Body.Keys)
        {
            switch ($Body.$Key.GetType().Name)
            {
                'boolean'
                {
                    $NewBody.$Key = $Body.$Key.ToString().ToLower()
                    break
                }
                'SwitchParameter'
                {
                    $NewBody.$Key = ($Body.$Key -as [boolean]).ToString().ToLower()
                    break
                }
                'datetime'
                {
                    $NewBody.$Key = $Body.$Key.ToString('yyyy-MM-ddTHH:mm:ss')
                    break
                }
                'SecureString'
                {
                    $NewBody.$Key = ConvertFromSecureString -SecureString $Body.$Key
                }
                default
                {
                    $NewBody.$Key = $Body.$Key
                }
            }
        }
        $InvokeRestMethodSplat.Body = $NewBody | ConvertTo-Json -Compress
    }

    if ($RawBody)
    {
        $InvokeRestMethodSplat.Body = $RawBody
    }

    # Add query parameters to invoke rest method splat
    if ($QueryParameters)
    {
        $InvokeRestMethodSplat.Uri += '?'
        $QueryParameterStringArray = foreach ($QueryParameter in $QueryParameters.Keys)
        {
            switch ($QueryParameters.$QueryParameter.GetType().Name)
            {
                'string'
                {
                    "$($QueryParameter)=$($QueryParameters.$QueryParameter)"
                }
                'boolean'
                {
                    "$($QueryParameter)=$($QueryParameters.$QueryParameter.ToString().ToLower())"
                }
                'SwitchParameter'
                {
                    "$($QueryParameter)=$(($QueryParameters.$QueryParameter -as [boolean]).ToString().ToLower())"
                }
                'int32'
                {
                    "$($QueryParameter)=$($QueryParameters.$QueryParameter)"
                }
                'datetime'
                {
                    "$($QueryParameter)=$($QueryParameters.$QueryParameter.ToString('yyyy-MM-ddTHH:mm:ss'))"
                }
                default
                {
                    Write-Warning -Message "Unknown type of queryparameter $QueryParameter : $($QueryParameters.$QueryParameter.GetType().Name)"
                }
            }
        }
        $InvokeRestMethodSplat.Uri += [URI]::EscapeUriString(($QueryParameterStringArray -join '&'))
    }

    # Skip token validation on auth/login calls because the token is not retreived at that point
    if ($InvokeRestMethodSplat.Uri -notlike '*auth/login*')
    {
        $ImmichSession.ValidateToken()
    }

    Write-Debug -Message "InvokeImmichRestMethod; Calling Invoke-RestMethod with settings`r`n$($InvokeRestMethodSplat | ConvertTo-Json)"

    # Output response to file if content type is octet-stream
    if ($ContentType -eq 'application/octet-stream' -and $Method -eq 'Get')
    {
        Invoke-RestMethod @InvokeRestMethodSplat -Verbose:$false -OutFile $OutFilePath
    }
    else
    {
        Invoke-RestMethod @InvokeRestMethodSplat -Verbose:$false | ForEach-Object { $_ }
    }

}


#endregion
#EndRegion './Private/InvokeImmichRestMethod.ps1' 192
#Region './Private/SelectBinding.ps1' -1

function SelectBinding
{
    <#
    .DESCRIPTION
        Function that is extracts what parameters the cmdlet was called with
    .PARAMETER Binding
        PSBoundParameters object should be passed
    .PARAMETER SelectProperty
        String array of the properties that should be extracted.
    .PARAMETER NameMapping
        Defines a hashtable where a parametername can be mapped to different name of the API parameter name.
    .EXAMPLE
        SelectBinding
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'FP')]
    param(
        $Binding,
        [string[]]$SelectProperty,
        [hashtable]$NameMapping
    )

    $ReturnHash = @{}

    # Only process binded parameters that we are intreseted in
    foreach ($Parameter in ($Binding.Keys | Where-Object { $SelectProperty -contains $PSItem }))
    {
        if ($NameMapping.Keys -contains $Parameter)
        {
            $APIName = $NameMapping[$Parameter]
        }
        else
        {
            $APIName = $Parameter
        }

        # Typecast switch to string
        #if ($Binding[$Parameter] -is [switch])
        #{
        # $ReturnHash.Add($APIName, (($Binding[$Parameter] -as [boolean]).ToString().ToLower()))
        #}
        # Typecast boolean to string
        #elseif ($Binding[$Parameter] -is [boolean])
        #{
        # $ReturnHash.Add($APIName, ($Binding[$Parameter].ToString().ToLower()))
        #}
        # Else add the value unaltered
        #else
        #{
        $ReturnHash.Add($APIName, $Binding[$Parameter])
        #}
    }
    return $ReturnHash

}
#EndRegion './Private/SelectBinding.ps1' 55
#Region './Public/Activity/Add-IMActivity.ps1' -1

function Add-IMActivity
{
    <#
    .DESCRIPTION
        Adds a new activity to an album
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER albumId
        Defines which album to add the activity to.
    .PARAMETER assetId
        Defines a specific assetid to add activities for.
    .PARAMETER comment
        Defines the comment to add.
    .PARAMETER type
        Defines the type of activity to add, valid values are comment or like.
    .EXAMPLE
        Add-IMActivity -AlbumId <albumid> -AssetId <assetid> -Comment 'Great picture!' -Type comment

        Adds a new comment to an asset in the specified album
    #>


    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $albumId,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $assetId,

        [Parameter()]
        [string]
        $comment,

        [Parameter()]
        [ValidateSet('comment', 'like')]
        [string]
        $type
    )

    BEGIN
    {
        $BodyParameters = @{}
        $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'albumId', 'assetId', 'comment', 'type')
    }

    PROCESS
    {
        InvokeImmichRestMethod -Method Post -RelativePath '/activity' -ImmichSession:$Session -Body $BodyParameters
    }

}
#endregion
#EndRegion './Public/Activity/Add-IMActivity.ps1' 63
#Region './Public/Activity/Get-IMActivity.ps1' -1

function Get-IMActivity
{
    <#
    .DESCRIPTION
        Retreives album activity
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER albumId
        Defines the album to retreive activities for.
    .PARAMETER assetId
        Defines a asset to retreive activities for.
    .PARAMETER level
        Defines the level of activities to retreive, valid values are album or asset.
    .PARAMETER type
        Defines the type of activities to retreive, valid values are comment or like.
    .PARAMETER userId
        Defines a specific user to retreive activities for.
    .EXAMPLE
        Get-IMActivity -albumId 'bde7ceba-f301-4e9e-87a2-163937a2a3db'

        Retreives all activities for an album
    .EXAMPLE
        Get-IMActivity -albumId 'bde7ceba-f301-4e9e-87a2-163937a2a3db' -assetId 'a4908e1f-697f-4d7b-9330-93b5eabe3baf'

        Retreives all activities for an album and a specific asset
    #>


    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $albumId,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $assetId,

        [Parameter()]
        [ValidateSet('album', 'asset')]
        [string]
        $level,

        [Parameter()]
        [ValidateSet('comment', 'like')]
        [string]
        $type,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $userId
    )

    BEGIN
    {
        $QueryParameters = @{}
        $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'albumId', 'assetId', 'level', 'type', 'userId')
    }

    PROCESS
    {
        InvokeImmichRestMethod -Method Get -RelativePath '/activity' -ImmichSession:$Session -QueryParameters $QueryParameters
    }

}
#endregion
#EndRegion './Public/Activity/Get-IMActivity.ps1' 75
#Region './Public/Activity/Get-IMActivityStatistic.ps1' -1

function Get-IMActivityStatistic
{
    <#
    .DESCRIPTION
        Retreives album activity
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER albumId
        Defines an album to retreive activity statistics for.
    .PARAMETER assetId
        Defines a specific asset to retreive activities for.
    .EXAMPLE
        Get-IMActivityStatistic -albumId 'bde7ceba-f301-4e9e-87a2-163937a2a3db'

        Retreives activity statistics for the album
    #>


    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $albumId,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $assetId
    )

    BEGIN
    {
        $QueryParameters = @{}
        $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'albumId', 'assetId')
    }

    PROCESS
    {
        InvokeImmichRestMethod -Method Get -RelativePath '/activity/statistics' -ImmichSession:$Session -QueryParameters $QueryParameters
    }

}
#endregion
#EndRegion './Public/Activity/Get-IMActivityStatistic.ps1' 50
#Region './Public/Activity/Remove-IMActivity.ps1' -1

function Remove-IMActivity
{
    <#
    .DESCRIPTION
        Removes an activity
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER Id
        Defines the activity to remove
    .EXAMPLE
        Remove-IMActivity -id 'bde7ceba-f301-4e9e-87a2-163937a2a3db'

        Removes the activity
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $id
    )

    PROCESS
    {
        if ($PSCmdlet.ShouldProcess($id, 'DELETE'))
        {
            InvokeImmichRestMethod -Method DELETE -RelativePath "/activity/$id" -ImmichSession:$Session
        }
    }

}
#endregion
#EndRegion './Public/Activity/Remove-IMActivity.ps1' 40
#Region './Public/Album/Add-IMAlbumUser.ps1' -1

function Add-IMAlbumUser
{
    <#
    .DESCRIPTION
        Add user to album
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER albumId
        Defines album to add the user to
    .PARAMETER userId
        Defines the user to add to the album
    .EXAMPLE
        Add-IMAlbumUser -albumid <albumid> -userid <userid>

        Add user to album
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $albumId,

        [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [Alias('id')]
        [string[]]
        $userId
    )

    BEGIN
    {
        $BodyParameters = @{
            sharedUserIds = [string[]]@()
        }
    }

    PROCESS
    {
        $userId | ForEach-Object {
            $BodyParameters.sharedUserIds += $PSItem
        }
    }

    END
    {
        InvokeImmichRestMethod -Method PUT -RelativePath "/album/$albumid/users" -ImmichSession:$Session -Body:$BodyParameters
    }
}
#endregion
#EndRegion './Public/Album/Add-IMAlbumUser.ps1' 58
#Region './Public/Album/Get-IMAlbum.ps1' -1

function Get-IMAlbum
{
    <#
    .DESCRIPTION
        Retreives Immich asset
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER albumId
        Defines the album to get
    .PARAMETER assetId
        Only returns albums that contain the asset
    .PARAMETER shared
        Defines weather to return shared albums or not.
    .PARAMETER withoutAssets
        Defines weather to return assets as part of the object or not
    .EXAMPLE
        Get-IMAlbum -albumid <albumid>

        Retreives Immich album
    #>


    [CmdletBinding(DefaultParameterSetName = 'list-shared')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'id', ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [Alias('id')]
        [string]
        $albumId,

        [Parameter(Mandatory, ParameterSetName = 'list-asset')]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $assetId,

        [Parameter(ParameterSetName = 'id')]
        [switch]
        $withoutAssets,

        [Parameter(ParameterSetName = 'list-shared')]
        [boolean]
        $shared
    )

    BEGIN
    {
        switch ($PSCmdlet.ParameterSetName)
        {
            'list-shared'
            {
                $QueryParameters = @{}
                $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'shared')
            }
            'list-asset'
            {
                $QueryParameters = @{}
                $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'assetId')
            }
            'id'
            {
                $QueryParameters = @{}
                $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'withoutAssets')
            }
        }
    }

    PROCESS
    {
        switch ($PSCmdlet.ParameterSetName)
        {
            'list-shared'
            {
                InvokeImmichRestMethod -Method Get -RelativePath '/album' -ImmichSession:$Session -QueryParameters $QueryParameters
            }
            'id'
            {
                InvokeImmichRestMethod -Method Get -RelativePath "/album/$albumId" -ImmichSession:$Session -QueryParameters $QueryParameters
            }
            'list-asset'
            {
                InvokeImmichRestMethod -Method Get -RelativePath '/album' -ImmichSession:$Session -QueryParameters $QueryParameters
            }
        }
    }

}
#endregion
#EndRegion './Public/Album/Get-IMAlbum.ps1' 93
#Region './Public/Album/Get-IMAlbumCount.ps1' -1

function Get-IMAlbumCount
{
    <#
    .DESCRIPTION
        Retreives album count
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMAlbumCount

        Retreives album count
    #>


    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null
    )

    InvokeImmichRestMethod -Method Get -RelativePath '/album/count' -ImmichSession:$Session

}
#endregion
#EndRegion './Public/Album/Get-IMAlbumCount.ps1' 27
#Region './Public/Album/New-IMAlbum.ps1' -1

function New-IMAlbum
{
    <#
    .DESCRIPTION
        Adds a new album
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER albumName
        Defines the name of the new album
    .PARAMETER assetIds
        Defines a list of assets to add to the album
    .PARAMETER description
        Defines a description for the album
    .PARAMETER sharedWithUserIds
        Defines a list of user id to share the album to
    .EXAMPLE
        New-IMAlbum -albumName 'Las Vegas'

        Adds a new an album
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Do not agree, new initiates an entity not previously known to the system, that should not cause issues.')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [string]
        $albumName,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $assetIds,

        [Parameter()]
        [string]
        $description,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $sharedWithUserIds
    )

    BEGIN
    {
        $BodyParameters = @{}
        $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'albumName', 'assetIds', 'description', 'sharedWithUserIds')
    }

    PROCESS
    {
        InvokeImmichRestMethod -Method Post -RelativePath '/album' -ImmichSession:$Session -Body $BodyParameters
    }

}
#endregion
#EndRegion './Public/Album/New-IMAlbum.ps1' 62
#Region './Public/Album/Remove-IMAlbum.ps1' -1

function Remove-IMAlbum
{
    <#
    .DESCRIPTION
        Removes an Immich album
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER albumId
        Defines the album that should be removed. Accepts pipeline input.
    .EXAMPLE
        Remove-IMAlbum -albumid <albumid>

        Removes an album
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [Alias('id')]
        [string[]]
        $albumId
    )

    PROCESS
    {
        # We loop through IDs because ids can be provided as an array to the parameter in which case the process block only gets called once.
        $albumId | ForEach-Object {
            $CurrentID = $PSItem
            if ($PSCmdlet.ShouldProcess($CurrentID, 'DELETE'))
            {
                InvokeImmichRestMethod -Method Delete -RelativePath "/album/$CurrentID" -ImmichSession:$Session
            }
        }
    }
}
#endregion
#EndRegion './Public/Album/Remove-IMAlbum.ps1' 44
#Region './Public/Album/Remove-IMAlbumUser.ps1' -1

function Remove-IMAlbumUser
{
    <#
    .DESCRIPTION
        Remove user from album
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER albumId
        Defines album to remove users from
    .PARAMETER userId
        Defines the user to remove from the album
    .EXAMPLE
        Remove-IMAlbumUser -albumid <albumid> -userid <userid>

        Remove user from album
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'albumId', Justification = 'FP')]
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $albumId,

        [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [Alias('id')]
        [string[]]
        $userId
    )

    PROCESS
    {
        $userId | ForEach-Object {
            if ($PSCmdlet.ShouldProcess($PSItem, 'DELETE'))
            {
                InvokeImmichRestMethod -Method DELETE -RelativePath "/album/$albumId/user/$psitem" -ImmichSession:$Session
            }
        }
    }

}
#endregion
#EndRegion './Public/Album/Remove-IMAlbumUser.ps1' 51
#Region './Public/Album/Rename-IMAlbum.ps1' -1

function Rename-IMAlbum
{
    <#
    .DESCRIPTION
        Renames an Immich album
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines albums to update
    .PARAMETER NewName
        Defines a new album name
    .EXAMPLE
        Rename-IMAlbum -id <albumid> -NewName 'New York 2024'

        Renames the album
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [Alias('ids', 'albumId')]
        [string[]]
        $id,

        [Parameter(Mandatory)]
        [string]
        $NewName
    )

    BEGIN
    {
        $BodyParameters = @{}
        $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'NewName' -NameMapping @{
                NewName = 'albumName'
            })
    }

    PROCESS
    {
        $id | ForEach-Object {
            if ($PSCmdlet.ShouldProcess($PSItem, 'Update'))
            {
                InvokeImmichRestMethod -Method PATCH -RelativePath "/album/$PSItem" -ImmichSession:$Session -Body:$BodyParameters
            }
        }
    }
}
#endregion
#EndRegion './Public/Album/Rename-IMAlbum.ps1' 56
#Region './Public/Album/Set-IMAlbum.ps1' -1

function Set-IMAlbum
{
    <#
    .DESCRIPTION
        Updates an Immich album
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines albums to update
    .PARAMETER albumName
        Defines a new album name
    .PARAMETER albumThumbnailAssetId
        Defines a UUID for a new thumbnail asset
    .PARAMETER description
        Defines a new description for the album
    .PARAMETER isActivityEnabled
        Defines weather activity feed should be enabled
    .PARAMETER AddAssets
        Defines assets to add to the album
    .PARAMETER RemoveAssets
        Defines assets to be removed from the album
    .PARAMETER Order
        Defines the sort order for the album
    .EXAMPLE
        Set-IMAlbum -id <albumid> -description 'Trip to New York'

        Update the description of an Immich album
    .EXAMPLE
        Set-IMAlbum -id <albumid> -AddAssets <assetid>,<assetid>

        Adds to assets to the album
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [Alias('ids', 'albumId')]
        [string[]]
        $id,

        [Parameter()]
        [string[]]
        $AddAssets,

        [Parameter()]
        [string[]]
        $RemoveAssets,

        [Parameter()]
        [string]
        $albumName,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $albumThumbnailAssetId,

        [Parameter()]
        [string]
        $description,

        [Parameter()]
        [boolean]
        $isActivityEnabled,

        [Parameter()]
        [string]
        [ValidateSet('asc', 'desc')]
        $Order
    )

    BEGIN
    {
        $BodyParameters = @{}
        $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'AlbumName', 'albumThumbnailAssetId', 'description', 'isActivityEnabled', 'Order' -namemapping @{AlbumName = 'albumName'; albumThumbnailAssetId = 'albumThumbnailAssetId'; isActivityEnabled = 'isActivityEnabled'; Order = 'order' })
    }

    PROCESS
    {
        $id | ForEach-Object {
            if ($PSCmdlet.ShouldProcess($PSItem, 'Update'))
            {
                InvokeImmichRestMethod -Method PATCH -RelativePath "/album/$PSItem" -ImmichSession:$Session -Body:$BodyParameters

                if ($PSBoundParameters.ContainsKey('AddAssets'))
                {
                    $null = InvokeImmichRestMethod -Method PUT -RelativePath "/album/$PSItem/assets" -ImmichSession:$Session -Body:@{ids = [string[]]$AddAssets }
                }
                if ($PSBoundParameters.ContainsKey('RemoveAssets'))
                {
                    $null = InvokeImmichRestMethod -Method DELETE -RelativePath "/album/$PSItem/assets" -ImmichSession:$Session -Body:@{ids = [string[]]$RemoveAssets }
                }
            }
        }
    }
}
#endregion
#EndRegion './Public/Album/Set-IMAlbum.ps1' 105
#Region './Public/APIKey/Get-IMAPIKey.ps1' -1

function Get-IMAPIKey
{
    <#
    .DESCRIPTION
        Retreives api keys
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines an api key id to get
    .EXAMPLE
        Get-IMAPIKey

        Retreives all api keys
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding(DefaultParameterSetName = 'list')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'id', ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id
    )

    PROCESS
    {
        $id | ForEach-Object {
            $CurrentID = $PSItem
            switch ($PSCmdlet.ParameterSetName)
            {
                'list'
                {
                    InvokeImmichRestMethod -Method Get -RelativePath '/api-key' -ImmichSession:$Session
                }
                'id'
                {
                    InvokeImmichRestMethod -Method Get -RelativePath "/api-key/$CurrentID" -ImmichSession:$Session
                }
            }
        }
    }

}
#endregion
#EndRegion './Public/APIKey/Get-IMAPIKey.ps1' 50
#Region './Public/APIKey/New-IMAPIKey.ps1' -1

function New-IMAPIKey
{
    <#
    .DESCRIPTION
        Adds a new an api key
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER name
        Defines the name of the new api key
    .EXAMPLE
        New-IMAPIKey -name 'Automation'

        Adds a new an api key
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Do not agree, new initiates an entity not previously known to the system, that should not cause issues.')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [string]
        $name
    )

    BEGIN
    {
        $BodyParameters = @{}
        $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'name')
    }

    PROCESS
    {
        InvokeImmichRestMethod -Method POST -RelativePath '/api-key' -ImmichSession:$Session -Body $BodyParameters
    }

}
#endregion
#EndRegion './Public/APIKey/New-IMAPIKey.ps1' 42
#Region './Public/APIKey/Remove-IMAPIKey.ps1' -1

function Remove-IMAPIKey
{
    <#
    .DESCRIPTION
        Removes Immich api key
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines an api key to remove
    .EXAMPLE
        Remove-IMAPIKey -id <apikey id>

        Remove api key
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id
    )

    PROCESS
    {
        $id | ForEach-Object {
            $CurrentID = $PSItem
            if ($PSCmdlet.ShouldProcess($CurrentID, 'DELETE'))
            {
                InvokeImmichRestMethod -Method DELETE -RelativePath "/api-key/$CurrentID" -ImmichSession:$Session
            }
        }
    }

}
#endregion
#EndRegion './Public/APIKey/Remove-IMAPIKey.ps1' 43
#Region './Public/APIKey/Rename-IMAPIKey.ps1' -1

function Rename-IMAPIKey
{
    <#
    .DESCRIPTION
        Sets name of an apikey
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines the id of the API key to update
    .PARAMETER name
        Defines a new name for the apikey
    .EXAMPLE
        Rename-IMAPIKey

        Sets name of an apikey
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Do not agree, new initiates an entity not previously known to the system, that should not cause issues.')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $id,

        [Parameter(Mandatory)]
        [string]
        $name

    )

    BEGIN
    {
        $BodyParameters = @{}
        $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'name')
    }

    PROCESS
    {
        InvokeImmichRestMethod -Method PUT -RelativePath "/api-key/$id" -ImmichSession:$Session -Body $BodyParameters
    }

}
#endregion
#EndRegion './Public/APIKey/Rename-IMAPIKey.ps1' 50
#Region './Public/Asset/Find-IMAsset.ps1' -1

function Find-IMAsset
{
    <#
    .DESCRIPTION
        Find assets
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER checksum
        Checksum filter
    .PARAMETER city
        City filter
    .PARAMETER country
        Country filter
    .PARAMETER createdAfter
        CreatedAfter filter
    .PARAMETER createdBefore
        CreatedBefore filter
    .PARAMETER deviceAssetId
        Device Asset Id filter
    .PARAMETER deviceId
        Device Id filter
    .PARAMETER encodedVideoPath
        Encoded Video path filter
    .PARAMETER id
        Id filter
    .PARAMETER isArchived
        Archvied filter
    .PARAMETER isEncoded
        Encoded filter
    .PARAMETER isExternal
        External filter
    .PARAMETER isFavorite
        Favorite filter
    .PARAMETER isMotion
        Motion filter
    .PARAMETER isNotInAlbum
        Not in Album filter
    .PARAMETER isOffline
        Offline filter
    .PARAMETER isReadOnly
        Read only filter
    .PARAMETER isVisible
        Visible filter
    .PARAMETER lensModel
        Lens model filter
    .PARAMETER libraryId
        Library id filter
    .PARAMETER make
        Make filter
    .PARAMETER model
        Model filter
    .PARAMETER order
        Defines sort order
    .PARAMETER originalFileName
        Original file name filter
    .PARAMETER originalPath
        Original path filter
    .PARAMETER personIds
        Person id filter
    .PARAMETER resizePath
        Resize path filter
    .PARAMETER size
        Size of rest call page
    .PARAMETER state
        State filter
    .PARAMETER takenAfter
        Taken after filter
    .PARAMETER takenBefore
        Taken before filter
    .PARAMETER trashedAfter
        Trashed after filter
    .PARAMETER trashedBefore
        Trashed before filter
    .PARAMETER type
        Type filter
    .PARAMETER updatedAfter
        Updated after filter
    .PARAMETER updatedBefore
        Updated before filter
    .PARAMETER webpPath
        Webp path filter
    .PARAMETER withArchived
        Archived filter
    .PARAMETER withDeleted
        Deleted filter
    .PARAMETER withExif
        Exif filter
    .PARAMETER withPeople
        With people filter
    .PARAMETER withStacked
        Stacked filter
    .EXAMPLE
        Find-IMAsset -createdAfter (Get-Date).AddDays(-30)

        Retreives all assets created in the last 30 days
    #>


    [CmdletBinding(DefaultParameterSetName = 'list-shared')]
    param(
        [Parameter()]
        [ImmichSession]$Session = $null,

        [Parameter()]
        [string]$checksum,

        [Parameter()]
        [string]$city,

        [Parameter()]
        [string]$country,

        [Parameter()]
        [datetime]$createdAfter,

        [Parameter()]
        [datetime]$createdBefore,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]$deviceAssetId,

        [Parameter()]
        [string]$deviceId,

        [Parameter()]
        [string]$encodedVideoPath,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]$id,

        [Parameter()]
        [boolean]$isArchived,

        [Parameter()]
        [boolean]$isEncoded,

        [Parameter()]
        [boolean]$isExternal,

        [Parameter()]
        [boolean]$isFavorite,

        [Parameter()]
        [boolean]$isMotion,

        [Parameter()]
        [boolean]$isNotInAlbum,

        [Parameter()]
        [boolean]$isOffline,

        [Parameter()]
        [boolean]$isReadOnly,

        [Parameter()]
        [boolean]$isVisible,

        [Parameter()]
        [string]$lensModel,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]$libraryId,

        [Parameter()]
        [string]$make,

        [Parameter()]
        [string]$model,

        [Parameter()]
        [ValidateSet('asc', 'desc')]
        [string]$order,

        [Parameter()]
        [string]$originalFileName,

        [Parameter()]
        [string]$originalPath,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]$personIds,

        [Parameter()]
        [string]$resizePath,

        [Parameter()]
        [int]$size,

        [Parameter()]
        [string]$state,

        [Parameter()]
        [datetime]$takenAfter,

        [Parameter()]
        [datetime]$takenBefore,

        [Parameter()]
        [datetime]$trashedAfter,

        [Parameter()]
        [datetime]$trashedBefore,

        [Parameter()]
        [ValidateSet('IMAGE', 'VIDEO', 'AUDIO', 'OTHER')]
        [string]$type,

        [Parameter()]
        [datetime]$updatedAfter,

        [Parameter()]
        [datetime]$updatedBefore,

        [Parameter()]
        [string]$webpPath,

        [Parameter()]
        [boolean]$withArchived,

        [Parameter()]
        [boolean]$withDeleted,

        [Parameter()]
        [boolean]$withExif,

        [Parameter()]
        [boolean]$withPeople,

        [Parameter()]
        [boolean]$withStacked
    )

    $Body = @{}
    $Body += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'checksum', 'city', 'country', 'createdAfter', 'createdBefore', 'deviceAssetId', 'deviceId', 'encodedVideoPath', 'id', 'isArchived', 'isEncoded', 'isExternal', 'isFavorite', 'isMotion', 'isNotInAlbum', 'isOffline', 'isReadOnly', 'isVisible', 'lensModel', 'libraryId', 'make', 'model', 'order', 'originalFileName', 'originalPath', 'page', 'personIds', 'resizePath', 'size', 'state', 'takenAfter', 'takenBefore', 'trashedAfter', 'trashedBefore', 'type', 'updatedAfter', 'updatedBefore', 'webpPath', 'withArchived', 'withDeleted', 'withExif', 'withPeople', 'withStacked')

    $Result = InvokeImmichRestMethod -Method POST -RelativePath '/search/metadata' -ImmichSession:$Session -Body $Body | Select-Object -ExpandProperty assets
    $Result | Select-Object -ExpandProperty items

    while ($Result.NextPage)
    {
        $Body.page = $Result.NextPage
        $Result = InvokeImmichRestMethod -Method POST -RelativePath '/search/metadata' -ImmichSession:$Session -Body $Body | Select-Object -ExpandProperty assets
        $Result | Select-Object -ExpandProperty items
    }

}
#endregion
#EndRegion './Public/Asset/Find-IMAsset.ps1' 253
#Region './Public/Asset/Get-IMAsset.ps1' -1

function Get-IMAsset
{
    <#
    .DESCRIPTION
        Retreives Immich asset
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines a specific asset id to be retreived
    .PARAMETER isFavorite
        Defines if faviorites should be returned or not. Do not specify if either should be returned.
    .PARAMETER isArchived
        Defines if archvied assets should be returned or not. Do not specify if either should be returned.
    .PARAMETER skip
        Defines skip
    .PARAMETER take
        Defines take
    .PARAMETER updatedAfter
        Deinfes updatedAfter
    .PARAMETER updatedBefore
        Defines updatedBefore
    .PARAMETER userId
        Defines userId
    .PARAMETER deviceId
        Defines a device id
    .PARAMETER personId
        Defines a personId to retreive assets for
    .PARAMETER tagId
        Defines a tagid to retreive assets for
    .PARAMETER Random
        Defines that random assets should be retreived. Unless -count is also specified one random asset is returned.
    .PARAMETER Count
        Defines how many random assets should be returned. Required -Random
    .EXAMPLE
        Get-IMAsset -isFavorite:$true

        Retreives all favorites
    #>


    [CmdletBinding(DefaultParameterSetName = 'list')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'random')]
        [switch]
        $Random,

        [Parameter(ParameterSetName = 'random')]
        [int]
        $Count,

        [Parameter(Mandatory, ParameterSetName = 'deviceid')]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $deviceID,

        [Parameter(Mandatory, ParameterSetName = 'personid')]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $personId,

        [Parameter(Mandatory, ParameterSetName = 'tagid')]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $tagId,

        [Parameter(Mandatory, ParameterSetName = 'id', ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $id,

        [Parameter(ParameterSetName = 'list')]
        [boolean]
        $isFavorite,

        [Parameter(ParameterSetName = 'list')]
        [boolean]
        $isArchived,

        [Parameter(ParameterSetName = 'list')]
        [int]
        $skip,

        [Parameter(ParameterSetName = 'list')]
        [int]
        $take,

        [Parameter(ParameterSetName = 'list')]
        [datetime]
        $updatedAfter,

        [Parameter(ParameterSetName = 'list')]
        [datetime]
        $updatedBefore,

        [Parameter(ParameterSetName = 'list')]
        [string]
        $userId
    )

    BEGIN
    {
        switch ($PSCmdlet.ParameterSetName)
        {
            'list'
            {
                $QueryParameters = @{}
                $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'isFavorite', 'isArchived', 'skip', 'take', 'updatedAfter', 'updatedBefore', 'userId', 'key')
            }
            'id'
            {
                $QueryParameters = @{}
                $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'isFavorite', 'isArchived', 'skip', 'take', 'updatedAfter', 'updatedBefore', 'userId', 'key')
            }
            'random'
            {
                $QueryParameters = @{}
                $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'count' -NameMapping @{Count = 'count' })
            }
        }
    }

    PROCESS
    {
        switch ($PSCmdlet.ParameterSetName)
        {
            'list'
            {
                InvokeImmichRestMethod -Method Get -RelativePath '/asset' -ImmichSession:$Session -QueryParameters $QueryParameters
            }
            'id'
            {
                InvokeImmichRestMethod -Method Get -RelativePath "/asset/$id" -ImmichSession:$Session -QueryParameters $QueryParameters
            }
            'deviceid'
            {
                InvokeImmichRestMethod -Method Get -RelativePath "/asset/device/$deviceid" -ImmichSession:$Session | Get-IMAsset
            }
            'personId'
            {
                InvokeImmichRestMethod -Method Get -RelativePath "/person/$personid/assets/" -ImmichSession:$Session | Get-IMAsset
            }
            'tagid'
            {
                InvokeImmichRestMethod -Method Get -RelativePath "/tag/$tagid/assets" -ImmichSession:$Session | Get-IMAsset
            }
            'random'
            {
                InvokeImmichRestMethod -Method Get -RelativePath '/asset/random' -ImmichSession:$Session -QueryParameters $QueryParameters
            }
        }
    }

}
#endregion
#EndRegion './Public/Asset/Get-IMAsset.ps1' 160
#Region './Public/Asset/Get-IMAssetMapMarker.ps1' -1

function Get-IMAssetMapMarker
{
    <#
    .DESCRIPTION
        Retreives asset map markers
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER CreatedAfter
        Created after filter
    .PARAMETER CreatedBefore
        Created before filter
    .PARAMETER IsArchived
        Archived filter
    .PARAMETER IsFavorite
        Favorite filter
    .PARAMETER WithPartners
        With partners filter
    .EXAMPLE
        Get-IMAssetMapMarker

        Retreives asset map markers
    #>


    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter()]
        [datetime]
        $CreatedAfter,

        [Parameter()]
        [datetime]
        $CreatedBefore,

        [Parameter()]
        [boolean]
        $IsArchived,

        [Parameter()]
        [boolean]
        $IsFavorite,

        [Parameter()]
        [boolean]
        $WithPartners
    )

    BEGIN
    {
        $QueryParameters = @{}
        $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'CreatedAfter', 'CreatedBefore', 'IsArchived', 'IsFavorite', 'WithPartners' -NameMapping @{
                CreatedAfter  = 'fileCreatedAfter'
                CreatedBefore = 'fileCreatedBefore'
                IsArchived    = 'isArchived'
                IsFavorite    = 'isFavorite'
                WithPartners  = 'withPartners'
            })
    }

    PROCESS
    {
        InvokeImmichRestMethod -Method Get -RelativePath '/asset/map-marker' -ImmichSession:$Session -QueryParameters $QueryParameters
    }
}
#endregion
#EndRegion './Public/Asset/Get-IMAssetMapMarker.ps1' 71
#Region './Public/Asset/Get-IMAssetMemoryLane.ps1' -1

function Get-IMAssetMemoryLane
{
    <#
    .DESCRIPTION
        Retreives asset memory lane
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER DayOfMonth
        Defines which day of month to query
    .PARAMETER Month
        Defines which month
    .EXAMPLE
        Get-IMAssetMemoryLane -DayOfMonth 1 -Month 4

        Retreives assets for 1 of April for every year
    #>


    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [ValidateRange(1, 31)]
        [int]
        $DayOfMonth,

        [Parameter(Mandatory)]
        [ValidateRange(1, 12)]
        [int]
        $Month
    )

    BEGIN
    {
        $QueryParameters = @{}
        $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'DayOfMonth', 'Month' -NameMapping @{
                DayOfMonth = 'day'
                Month      = 'month'
            })
    }

    PROCESS
    {
        InvokeImmichRestMethod -Method Get -RelativePath '/asset/memory-lane' -ImmichSession:$Session -QueryParameters $QueryParameters
    }
}
#endregion
#EndRegion './Public/Asset/Get-IMAssetMemoryLane.ps1' 52
#Region './Public/Asset/Get-IMAssetSearchTerm.ps1' -1

function Get-IMAssetSearchTerm
{
    <#
    .DESCRIPTION
        Retreives search terms
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMAssetSearchTerm

        Retreives search terms
    #>


    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null
    )

    PROCESS
    {
        InvokeImmichRestMethod -Method Get -RelativePath '/asset/search-terms' -ImmichSession:$Session
    }
}
#endregion
#EndRegion './Public/Asset/Get-IMAssetSearchTerm.ps1' 29
#Region './Public/Asset/Get-IMAssetStatistic.ps1' -1

function Get-IMAssetStatistic
{
    <#
    .DESCRIPTION
        Retreives asset statistic
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER isArchived
        Archived filter
    .PARAMETER isFavorite
        Favorite filter
    .PARAMETER isTrashed
        Trashed filter
    .EXAMPLE
        Get-IMAssetStatistic

        Retreives asset statistic
    #>


    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter()]
        [boolean]
        $isArchived,

        [Parameter()]
        [boolean]
        $isFavorite,

        [Parameter()]
        [boolean]
        $isTrashed
    )

    BEGIN
    {
        $QueryParameters = @{}
        $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'isArchived', 'isFavorite', 'isTrashed')
    }

    PROCESS
    {
        InvokeImmichRestMethod -Method Get -RelativePath '/asset/statistics' -ImmichSession:$Session -QueryParameters $QueryParameters
    }
}
#endregion
#EndRegion './Public/Asset/Get-IMAssetStatistic.ps1' 53
#Region './Public/Asset/Get-IMCuratedLocation.ps1' -1

function Get-IMCuratedLocation
{
    <#
    .DESCRIPTION
        Retreives Immich curated locations
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMCuratedLocation

        Retreives Immich curated locations
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null
    )

    InvokeImmichRestMethod -Method Get -RelativePath '/asset/curated-locations' -ImmichSession:$Session

}
#endregion
#EndRegion './Public/Asset/Get-IMCuratedLocation.ps1' 25
#Region './Public/Asset/Get-IMCuratedObject.ps1' -1

function Get-IMCuratedObject
{
    <#
    .DESCRIPTION
        Retreives Immich curated objects
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMCuratedObject

        Retreives Immich curated objects
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null
    )

    InvokeImmichRestMethod -Method Get -RelativePath '/asset/curated-objects' -ImmichSession:$Session

}
#endregion
#EndRegion './Public/Asset/Get-IMCuratedObject.ps1' 25
#Region './Public/Asset/Get-IMTimeBucket.ps1' -1

function Get-IMTimeBucket
{
    <#
    .DESCRIPTION
        Retreives timebucket objects
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER albumId
        Albumid filter
    .PARAMETER isArchived
        Archived filter
    .PARAMETER isFavorite
        Favorite filter
    .PARAMETER isTrashed
        Trashed filter
    .PARAMETER order
        Defines sort order
    .PARAMETER personId
        PersonId filter
    .PARAMETER size
        Defines size, DAY or MONTH
    .PARAMETER timeBucket
        Timebucket
    .PARAMETER userId
        UserId filter
    .PARAMETER withPartners
        With partners filter
    .PARAMETER withStacked
        With stacked filter
    .EXAMPLE
        Get-IMTimeBucket

        Retreives timebucket
    #>


    [CmdletBinding(DefaultParameterSetName = 'list')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $albumId,

        [Parameter()]
        [boolean]
        $isArchived,

        [Parameter()]
        [boolean]
        $isFavorite,

        [Parameter()]
        [boolean]
        $isTrashed,

        [Parameter()]
        [ValidateSet('asc', 'desc')]
        [string]
        $order = 'asc',

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $personId,

        [Parameter(Mandatory)]
        [ValidateSet('DAY', 'MONTH')]
        [string]
        $size,

        [Parameter(ParameterSetName = 'timebucket')]
        [string]
        $timeBucket,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $userId,

        [Parameter()]
        [boolean]
        $withPartners,

        [Parameter()]
        [boolean]
        $withStacked
    )

    BEGIN
    {
        $QueryParameters = @{}
        $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'albumId', 'isArchived', 'isFavorite', 'isTrashed', 'order', 'personId', 'size', 'timeBucket', 'userId', 'withPartners', 'withStacked')
    }

    PROCESS
    {
        switch ($PSCmdlet.ParameterSetName)
        {
            'list'
            {
                InvokeImmichRestMethod -Method Get -RelativePath '/asset/time-buckets' -ImmichSession:$Session -QueryParameters $QueryParameters
            }
            'timebucket'
            {
                InvokeImmichRestMethod -Method Get -RelativePath '/asset/time-bucket' -ImmichSession:$Session -QueryParameters $QueryParameters
            }
        }
    }
}
#endregion
#EndRegion './Public/Asset/Get-IMTimeBucket.ps1' 116
#Region './Public/Asset/Import-IMAsset.ps1' -1

function Import-IMAsset
{
    <#
    .DESCRIPTION
        Imports an Immich asset
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER FilePath
        Defines the path to the file to upload. Accepts pipeline input.
    .PARAMETER Duration
        Defines the duration if its a video asset
    .PARAMETER isArchived
        Defines if the new asset should be archived.
    .PARAMETER isFavorite
        Defines if the new asset should be a favorite
    .PARAMETER isOffline
        Defines if the new asset should be offline
    .PARAMETER isReadOnly
        Defines if the new asset should be read only
    .PARAMETER isVisible
        Defines if the new asset should be visible
    .PARAMETER libraryId
        Defines which library to upload the asset to
    .EXAMPLE
        Import-IMAsset -FilePath C:\file.jpg

        Uploads image to Immich
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'FP, retreived through PSBoundParameters')]
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [System.IO.FileInfo[]]
        $FilePath,

        [Parameter()]
        [string]
        $Duration,

        [Parameter()]
        [switch]
        $isArchived,

        [Parameter()]
        [switch]
        $isFavorite ,

        [Parameter()]
        [switch]
        $isOffline ,

        [Parameter()]
        [switch]
        $isReadOnly,

        [Parameter()]
        [switch]
        $isVisible,

        [Parameter()]
        [string]
        $libraryId

    )

    BEGIN
    {
        # Do not run on Windows Powershell
        if ($PSVersionTable.PSEdition -eq 'Desktop')
        {
            Write-Warning -Message 'Import-IMAsset is not currently supported on Windows Powershell, please use Powershell Core on Windows instead.'
            break
        }
    }

    PROCESS
    {
        $FilePath | ForEach-Object {
            $FileInfo = Get-Item -Path $PSItem.FullName
            $Uri = "$($ImmichSession.ApiUri)/asset/upload"
            $Header = @{
                'Accept'    = 'application/json'
                'x-api-key' = ConvertFromSecureString -SecureString $ImmichSession.AccessToken
            }
            $Form = @{}
            $Form += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'Duration', 'isArchived', 'isFavorite', 'isOffline', 'isReadOnly', 'isVisible', 'libraryId')
            $Form += @{
                deviceAssetId  = $FileInfo.Name
                deviceId       = 'PSImmich'
                fileCreatedAt  = $FileInfo.CreationTime.ToString('yyyy-MM-ddTHH:mm:ss')
                fileModifiedAt = $FileInfo.LastWriteTime.ToString('yyyy-MM-ddTHH:mm:ss')
                assetData      = $FileInfo
            }
            $Result = Invoke-WebRequest -Uri $Uri -Method Post -Headers $Header -Form $Form -ContentType 'multipart/form-data'
            $Result.Content | ConvertFrom-Json | Get-IMAsset
        }
    }
}
#EndRegion './Public/Asset/Import-IMAsset.ps1' 105
#Region './Public/Asset/Remove-IMAsset.ps1' -1

function Remove-IMAsset
{
    <#
    .DESCRIPTION
        Removes an Immich asset
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER ids
        Defines the asset ids that should be removed. Accepts pipeline input.
    .PARAMETER force
        Performs a hard delete bypassing the Trash
    .EXAMPLE
        Remove-IMAsset -ids <assetid>

        Removes an Immich asset
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        [Alias('id')]
        $ids,

        [Parameter()]
        [switch]
        $force
    )

    BEGIN
    {
        $BodyParameters = @{
            ids = @()
        }
        $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'force')
    }

    PROCESS
    {
        $ids | ForEach-Object {
            $BodyParameters.ids += $psitem
        }
    }

    END
    {
        if ($PSCmdlet.ShouldProcess(($BodyParameters.ids -join ','), 'DELETE'))
        {
            InvokeImmichRestMethod -Method Delete -RelativePath '/asset' -ImmichSession:$Session -Body:$BodyParameters
        }
    }

}
#endregion
#EndRegion './Public/Asset/Remove-IMAsset.ps1' 62
#Region './Public/Asset/Restore-IMAsset.ps1' -1

function Restore-IMAsset
{
    <#
    .DESCRIPTION
        Restore asset from trash
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines an asset id to restore
    .PARAMETER All
        Defines that all assets in trash should be restored.
    .EXAMPLE
        Restore-IMAsset -id <assetid>

        Restore asset from trash
    .EXAMPLE
        Restore-IMAsset -All

        Restores all assets from trash
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'FP')]
    [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = 'id')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline, ParameterSetName = 'id')]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [Alias('assetId')]
        [string[]]
        $id,

        [Parameter(Mandatory, ParameterSetName = 'all')]
        [switch]
        $All
    )

    BEGIN
    {
        if ($PSCmdlet.ParameterSetName -eq 'id')
        {
            $AssetIDs = [System.Collections.Generic.List[string]]::New()
        }
    }

    PROCESS
    {
        if ($PSCmdlet.ParameterSetName -eq 'id')
        {
            $id | ForEach-Object {
                $AssetIDs.Add($PSItem)
            }
        }
    }

    END
    {
        switch ($PSCMdlet.ParameterSetName)
        {
            'id'
            {
                if ($PSCmdlet.ShouldProcess(($AssetIDs -join ','), 'Restore'))
                {
                    $BodyParameters = @{
                        ids = ($AssetIDs -as [string[]])
                    }
                    InvokeImmichRestMethod -Method POST -RelativePath '/trash/restore/assets' -ImmichSession:$Session -Body:$BodyParameters
                }
            }
            'all'
            {
                if ($PSCmdlet.ShouldProcess('All trashed assets', 'Restore'))
                {
                    InvokeImmichRestMethod -Method POST -RelativePath '/trash/restore' -ImmichSession:$Session
                }
            }
        }
    }
}
#endregion
#EndRegion './Public/Asset/Restore-IMAsset.ps1' 84
#Region './Public/Asset/Save-IMAsset.ps1' -1

function Save-IMAsset
{
    <#
    .DESCRIPTION
        Save Immich asset
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines a specific asset id to be retreived
    .PARAMETER isThumb
        Defines if faviorites should be returned or not. Do not specify if either should be returned.
    .PARAMETER isWeb
        Defines if archvied assets should be returned or not. Do not specify if either should be returned.
    .PARAMETER Path
        Defines the directory for the output file
    .EXAMPLE
        Save-IMAsset -id <assetid> -Path C:\download

        Save asset
    #>


    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $id,

        [Parameter()]
        [switch]
        $isThumb,

        [Parameter()]
        [switch]
        $isWeb,

        [Parameter()]
        [System.IO.DirectoryInfo]
        $Path
    )

    BEGIN
    {
        $QueryParameters = @{}
        $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'isThumb', 'isWeb')
    }

    PROCESS
    {
        $id | ForEach-Object {
            $CurrentID = $PSItem
            $AssetObject = Get-IMAsset -Id $CurrentID
            $OutputPath = Join-Path -Path $Path -ChildPath $AssetObject.originalFileName
            if ($PSVersionTable.PSEdition -eq 'Desktop')
            {
                $SavedProgressPreference = $global:ProgressPreference
                $global:ProgressPreference = 'SilentlyContinue'
            }
            InvokeImmichRestMethod -Method Get -RelativePath "/asset/file/$CurrentID" -ImmichSession:$Session -QueryParameters $QueryParameters -ContentType 'application/octet-stream' -OutFilePath $OutputPath
            if ($PSVersionTable.PSEdition -eq 'Desktop')
            {
                $global:ProgressPreference = $SavedProgressPreference
            }
        }
    }

}
#endregion
#EndRegion './Public/Asset/Save-IMAsset.ps1' 75
#Region './Public/Asset/Set-IMAsset.ps1' -1

function Set-IMAsset
{
    <#
    .DESCRIPTION
        Updates an Immich asset
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines the asset to update
    .PARAMETER dateTimeOriginal
        Defines the assets taken date
    .PARAMETER isArchived
        Defines if the asset should archived
    .PARAMETER isFavorite
        Defines if the asset should be set as favorite
    .PARAMETER latitude
        Set location latitude
    .PARAMETER longitude
        Set location longitude
    .PARAMETER removeParent
        Defines if stack parent should be removed
    .PARAMETER stackParentId
        Defines a parent asset
    .PARAMETER description
        Defines a description
    .PARAMETER AddToAlbum
        Defines if the asset should be added to an album
    .PARAMETER RemoveFromAlbum
        Defines if the asset should be removed from an album
    .PARAMETER AddTag
        Defines if a tag should be added to the asset
    .PARAMETER RemoveTag
        Defines if a tag should be removed from the asset
    .EXAMPLE
        Set-IMAsset -id <assetid> -AddTag <tagid>

        Adds a tag to an asset
    #>


    [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = 'batch')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline, ParameterSetName = 'batch')]
        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline, ParameterSetName = 'id')]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [Alias('ids')]
        [string[]]
        $id,

        [Parameter(ParameterSetName = 'batch')]
        [Parameter(ParameterSetName = 'id')]
        [string]
        $dateTimeOriginal,

        [Parameter(ParameterSetName = 'batch')]
        [Parameter(ParameterSetName = 'id')]
        [boolean]
        $isArchived,

        [Parameter(ParameterSetName = 'batch')]
        [Parameter(ParameterSetName = 'id')]
        [boolean]
        $isFavorite,

        [Parameter(ParameterSetName = 'batch')]
        [Parameter(ParameterSetName = 'id')]
        [Int32]
        $latitude,

        [Parameter(ParameterSetName = 'batch')]
        [Parameter(ParameterSetName = 'id')]
        [int32]
        $longitude,

        [Parameter(ParameterSetName = 'batch')]
        [switch]
        $removeParent,

        [Parameter(ParameterSetName = 'batch')]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $stackParentId,

        [Parameter(ParameterSetName = 'id')]
        [string]
        $description,

        [Parameter()]
        [string]
        $AddToAlbum,

        [Parameter()]
        [string]
        $RemoveFromAlbum,

        [Parameter()]
        [string]
        $AddTag,

        [Parameter()]
        [string]
        $RemoveTag
)

    BEGIN
    {
        switch ($PSCmdlet.ParameterSetName)
        {
            'batch'
            {
                $BodyParameters = @{
                    ids = @()
                }
                $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'dateTimeOriginal', 'isFavorite', 'isArchived', 'latitude', 'longitude', 'removeParent', 'stackParentId')
            }
            'id'
            {
                $BodyParameters = @{}
                $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'dateTimeOriginal', 'isFavorite', 'isArchived', 'latitude', 'longitude', 'description')
            }
        }
    }

    PROCESS
    {
        switch ($PSCmdlet.ParameterSetName)
        {
            'batch'
            {
                $id | ForEach-Object {
                    $BodyParameters.ids += $psitem
                }
            }
            'id'
            {
                foreach ($object in $id)
                {
                    if ($PSCmdlet.ShouldProcess(($BodyParameters.ids -join ','), 'PUT'))
                    {
                        InvokeImmichRestMethod -Method Put -RelativePath "/asset/$object" -ImmichSession:$Session -Body:$BodyParameters
                        if ($PSBoundParameters.ContainsKey('AddToAlbum'))
                        {
                            $null = InvokeImmichRestMethod -Method PUT -RelativePath "/album/$AddToAlbum/assets" -ImmichSession:$Session -Body:@{ids = [string[]]$object }
                        }
                        if ($PSBoundParameters.ContainsKey('RemoveFromAlbum'))
                        {
                            $null = InvokeImmichRestMethod -Method DELETE -RelativePath "/album/$RemoveFromAlbum/assets" -ImmichSession:$Session -Body:@{ids = [string[]]$object }
                        }
                        if ($PSBoundParameters.ContainsKey('AddTag'))
                        {
                            $null = InvokeImmichRestMethod -Method PUT -RelativePath "/tag/$AddTag/assets" -ImmichSession:$Session -Body:@{assetIds = [string[]]$object }
                        }
                        if ($PSBoundParameters.ContainsKey('RemoveTag'))
                        {
                            $null = InvokeImmichRestMethod -Method DELETE -RelativePath "/tag/$AddTag/assets" -ImmichSession:$Session -Body:@{assetIds = [string[]]$object }
                        }
                    }
                }
            }
        }
    }

    END
    {
        switch ($PSCmdlet.ParameterSetName)
        {
            'batch'
            {
                if ($PSCmdlet.ShouldProcess(($BodyParameters.ids -join ','), 'PUT'))
                {
                    InvokeImmichRestMethod -Method Put -RelativePath '/asset' -ImmichSession:$Session -Body:$BodyParameters
                    if ($PSBoundParameters.ContainsKey('AddToAlbum'))
                    {
                        $null = InvokeImmichRestMethod -Method PUT -RelativePath "/album/$AddToAlbum/assets" -ImmichSession:$Session -Body:@{ids = [string[]]($BodyParameters.ids) }
                    }
                    if ($PSBoundParameters.ContainsKey('RemoveFromAlbum'))
                    {
                        $null = InvokeImmichRestMethod -Method DELETE -RelativePath "/album/$RemoveFromAlbum/assets" -ImmichSession:$Session -Body:@{ids = [string[]]($BodyParameters.ids) }
                    }
                    if ($PSBoundParameters.ContainsKey('AddTag'))
                    {
                        $null = InvokeImmichRestMethod -Method PUT -RelativePath "/tag/$AddTag/assets" -ImmichSession:$Session -Body:@{assetIds = [string[]]($BodyParameters.ids) }
                    }
                    if ($PSBoundParameters.ContainsKey('RemoveTag'))
                    {
                        $null = InvokeImmichRestMethod -Method DELETE -RelativePath "/tag/$RemoveTag/assets" -ImmichSession:$Session -Body:@{assetIds = [string[]]($BodyParameters.ids) }
                    }
                }
            }
        }
    }

}
#endregion
#EndRegion './Public/Asset/Set-IMAsset.ps1' 200
#Region './Public/Asset/Start-IMVideoTranscode.ps1' -1

function Start-IMVideoTranscode
{
    <#
    .DESCRIPTION
        Recreates the transcoded version of the source video files
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines the asset id that the job should target. Accepts pipeline input.
    .EXAMPLE
        Start-IMVideoTranscode

        Recreates the transcoded version of the source video files
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id
    )

    BEGIN
    {
        $BodyParameters = @{
            assetIds = @()
            name     = 'transcode-video'
        }
    }

    PROCESS
    {
        $id | ForEach-Object {
            $BodyParameters.assetIds += $psitem
        }
    }

    END
    {
        if ($PSCmdlet.ShouldProcess(($BodyParameters.assetIds -join ','), 'Transcode videos'))
        {
            InvokeImmichRestMethod -Method POST -RelativePath '/asset/jobs' -ImmichSession:$Session -Body:$BodyParameters
        }
    }

}
#endregion
#EndRegion './Public/Asset/Start-IMVideoTranscode.ps1' 55
#Region './Public/Asset/Update-IMAssetMetadata.ps1' -1

function Update-IMAssetMetadata
{
    <#
    .DESCRIPTION
        Update IM asset metadata
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines the asset ids that metadata should be refreshed for. Accepts pipeline input.
    .EXAMPLE
        Update-IMAssetMetadata -id <assetid>

        Update IM asset metadata
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns','', Justification='FP')]
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id
    )

    BEGIN
    {
        $BodyParameters = @{
            assetIds = @()
            name     = 'refresh-metadata'
        }
    }

    PROCESS
    {
        $id | ForEach-Object {
            $BodyParameters.assetIds += $psitem
        }
    }

    END
    {
        if ($PSCmdlet.ShouldProcess(($BodyParameters.assetIds -join ','), 'Update metadata'))
        {
            InvokeImmichRestMethod -Method POST -RelativePath '/asset/jobs' -ImmichSession:$Session -Body:$BodyParameters
        }
    }

}
#endregion
#EndRegion './Public/Asset/Update-IMAssetMetadata.ps1' 55
#Region './Public/Asset/Update-IMAssetThumbnail.ps1' -1

function Update-IMAssetThumbnail
{
    <#
    .DESCRIPTION
        Update IM asset thumbnails
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines the asset ids that thumbnails should be refreshed for. Accepts pipeline input.
    .EXAMPLE
        Update-IMAssetThumbnail -id <assetid>

        Update IM asset thumbnails
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id
    )

    BEGIN
    {
        $BodyParameters = @{
            assetIds = @()
            name     = 'regenerate-thumbnail'
        }
    }

    PROCESS
    {
        $id | ForEach-Object {
            $BodyParameters.assetIds += $psitem
        }
    }

    END
    {
        if ($PSCmdlet.ShouldProcess(($BodyParameters.assetIds -join ','), 'Update thumbnail'))
        {
            InvokeImmichRestMethod -Method POST -RelativePath '/asset/jobs' -ImmichSession:$Session -Body:$BodyParameters
        }
    }

}
#endregion
#EndRegion './Public/Asset/Update-IMAssetThumbnail.ps1' 55
#Region './Public/Audit/Get-IMAuditDelete.ps1' -1

function Get-IMAuditDelete
{
    <#
    .DESCRIPTION
        Retreives Immich audit deletes
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER after
        Defines after date filter
    .PARAMETER entityType
        Defines an entity type, ASSET or ALBUM
    .PARAMETER userId
        Defines a user filter
    .EXAMPLE
        Get-IMAuditDelete

        Retreives Immich audit deletes
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding(DefaultParameterSetName = 'list')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $userId,

        [Parameter(Mandatory)]
        [datetime]
        $after,

        [Parameter(Mandatory)]
        [ValidateSet('ASSET', 'ALBUM')]
        [string]
        $entityType
    )

    BEGIN
    {
        $QueryParameters = @{}
        $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'userId', 'after', 'entityType')
    }

    PROCESS
    {
        InvokeImmichRestMethod -Method Get -RelativePath '/audit/deletes' -ImmichSession:$Session -QueryParameters:$QueryParameters
    }

}
#endregion
#EndRegion './Public/Audit/Get-IMAuditDelete.ps1' 56
#Region './Public/Audit/Get-IMAuditFile.ps1' -1

function Get-IMAuditFile
{
    <#
    .DESCRIPTION
        Retreives Immich audit files
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMAuditFile

        Retreives Immich audit files
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding(DefaultParameterSetName = 'list')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null
    )

    InvokeImmichRestMethod -Method Get -RelativePath '/audit/file-report' -ImmichSession:$Session

}
#endregion
#EndRegion './Public/Audit/Get-IMAuditFile.ps1' 27
#Region './Public/Audit/Get-IMFileChecksum.ps1' -1

function Get-IMFileChecksum
{
    <#
    .DESCRIPTION
        Retreives Immich file checksum
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER FileName
        Defines the full path to the file that checksum should be calculated for.
    .EXAMPLE
        Get-IMFileChecksum

        Retreives Immich file checksum
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [string[]]
        $FileName
    )

    BEGIN
    {
        $BodyParameters = @{}
        $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'FileName' -NameMapping @{FileName = 'filenames' })
    }

    PROCESS
    {
        InvokeImmichRestMethod -Method POST -RelativePath '/audit/file-report/checksum' -ImmichSession:$Session -Body:$BodyParameters
    }

}
#endregion
#EndRegion './Public/Audit/Get-IMFileChecksum.ps1' 42
#Region './Public/Auth/Get-IMAuthDevice.ps1' -1

function Get-IMAuthDevice
{
    <#
    .DESCRIPTION
        Get authorized devices
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMAuthDevice

        Get authorized devices
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding(DefaultParameterSetName = 'list')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null
    )

    InvokeImmichRestMethod -Method GET -RelativePath '/auth/devices' -ImmichSession:$Session
}
#endregion
#EndRegion './Public/Auth/Get-IMAuthDevice.ps1' 26
#Region './Public/Auth/Remove-IMAuthDevice.ps1' -1

function Remove-IMAuthDevice
{
    <#
    .DESCRIPTION
        Remove one or many auth devices. Not that if id is not specified all but the current auth device will be purged.
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines a uuid of a auth device that should be removed
    .EXAMPLE
        Remove-IMAuthDevice

        Remove all auth device (except current)
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding(DefaultParameterSetName = 'list', SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'id', ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id

    )

    PROCESS
    {
        $id | ForEach-Object {
            $CurrentID = $PSItem
            switch ($PSCmdlet.ParameterSetName)
            {
                'list'
                {
                    if ($PSCmdlet.ShouldProcess('All auth devices', 'DELETE'))
                    {
                        InvokeImmichRestMethod -Method DELETE -RelativePath '/auth/devices' -ImmichSession:$Session
                    }
                }
                'id'
                {
                    if ($PSCmdlet.ShouldProcess($CurrentID, 'DELETE'))
                    {
                        InvokeImmichRestMethod -Method DELETE -RelativePath "/auth/devices/$CurrentID" -ImmichSession:$Session
                    }
                }
            }
        }
    }
}
#endregion
#EndRegion './Public/Auth/Remove-IMAuthDevice.ps1' 56
#Region './Public/Auth/Test-IMAccessToken.ps1' -1

function Test-IMAccessToken
{
    <#
    .DESCRIPTION
        Verifies that the provided access token is valid
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Test-IMAccessToken

        Verifies that the provided access token is valid
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding()]
    [OutputType([boolean])]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null
    )

    $Result = InvokeImmichRestMethod -Method POST -RelativePath '/auth/validateToken' -ImmichSession:$Session
    if ($Result)
    {
        return $Result.AuthStatus
    }
    else
    {
        return $false
    }
}
#endregion
#EndRegion './Public/Auth/Test-IMAccessToken.ps1' 35
#Region './Public/Face/Get-IMFace.ps1' -1

function Get-IMFace
{
    <#
    .DESCRIPTION
        Get immich face
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines the asset id to get faces for
    .EXAMPLE
        Get-IMFace

        Get immich face
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [Alias('assetId')]
        [string[]]
        $id

    )

    PROCESS
    {
        $id | ForEach-Object {
            $CurrentID = $PSItem
            $QueryParameters = @{
                id = $CurrentID
            }
            InvokeImmichRestMethod -Method GET -RelativePath '/face' -ImmichSession:$Session -QueryParameters:$QueryParameters
        }
    }
}
#endregion
#EndRegion './Public/Face/Get-IMFace.ps1' 44
#Region './Public/Job/Clear-IMJob.ps1' -1

function Clear-IMJob
{
    <#
    .DESCRIPTION
        Clear immich job
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER Job
        Defines the job type
    .PARAMETER Force
        Defines force
    .PARAMETER FailedOnly
        Defines that only failed jobs should be cleared
    .EXAMPLE
        Clear-IMJob

        Clear immich job
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'FP')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [ValidateSet('thumbnailGeneration', 'metadataExtraction', 'videoConversion', 'faceDetection', 'facialRecognition', 'smartSearch', 'backgroundTask', 'storageTemplateMigration', 'migration', 'search', 'sidecar', 'library')]
        [string[]]
        $Job,

        [Parameter()]
        [switch]
        $FailedOnly,

        [Parameter()]
        [switch]
        $Force
    )

    $Job | ForEach-Object {
        $CurrentJob = $PSItem
        $Body = @{}
        $Body += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'Force')
        if ($FailedOnly)
        {
            $Body += @{command = 'clear-failed' }
        }
        else
        {
            $Body += @{command = 'empty' }
        }
        InvokeImmichRestMethod -Method PUT -RelativePath "/jobs/$CurrentJob" -ImmichSession:$Session -Body:$Body
    }
}
#endregion
#EndRegion './Public/Job/Clear-IMJob.ps1' 58
#Region './Public/Job/Get-IMJob.ps1' -1

function Get-IMJob
{
    <#
    .DESCRIPTION
        Get immich job
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMJob

        Get immich job
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null
    )

    InvokeImmichRestMethod -Method GET -RelativePath '/jobs' -ImmichSession:$Session

}
#endregion
#EndRegion './Public/Job/Get-IMJob.ps1' 27
#Region './Public/Job/Resume-IMJob.ps1' -1

function Resume-IMJob
{
    <#
    .DESCRIPTION
        Resume immich job
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER Job
        Defines the job type
    .PARAMETER Force
        Defines force
    .EXAMPLE
        Resume-IMJob

        Resume immich job
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'FP')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [ValidateSet('thumbnailGeneration', 'metadataExtraction', 'videoConversion', 'faceDetection', 'facialRecognition', 'smartSearch', 'backgroundTask', 'storageTemplateMigration', 'migration', 'search', 'sidecar', 'library')]
        [string[]]
        $Job,

        [Parameter()]
        [switch]
        $Force
    )

    $Job | ForEach-Object {
        $CurrentJob = $PSItem
        $Body = @{}
        $Body += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'Force')
        $Body += @{command = 'resume' }
        InvokeImmichRestMethod -Method PUT -RelativePath "/jobs/$CurrentJob" -ImmichSession:$Session -Body:$Body
    }
}
#endregion
#EndRegion './Public/Job/Resume-IMJob.ps1' 45
#Region './Public/Job/Start-IMJob.ps1' -1

function Start-IMJob
{
    <#
    .DESCRIPTION
        Start immich job
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER Job
        Defines the job type
    .PARAMETER Force
        Define force
    .EXAMPLE
        Start-IMJob -job 'thumbnailGeneration'

        Start thumbnail generation job
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'FP')]
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'FP')]
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [ValidateSet('emptyTrash', 'thumbnailGeneration', 'metadataExtraction', 'videoConversion', 'faceDetection', 'facialRecognition', 'smartSearch', 'backgroundTask', 'storageTemplateMigration', 'migration', 'search', 'sidecar', 'library')]
        [string[]]
        $Job,

        [Parameter()]
        [switch]
        $Force
    )

    $Job | ForEach-Object {
        switch ($PSItem)
        {
            'emptyTrash'
            {
                if ($PSCmdlet.ShouldProcess('All assets in trash', 'REMOVE'))
                {
                    InvokeImmichRestMethod -Method POST -RelativePath '/trash/empty' -ImmichSession:$Session
                }
            }
            default
            {
                $CurrentJob = $PSItem
                $Body = @{}
                $Body += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'Force')
                $Body += @{command = 'start' }
                InvokeImmichRestMethod -Method PUT -RelativePath "/jobs/$CurrentJob" -ImmichSession:$Session -Body:$Body
            }
        }
    }
}
#endregion
#EndRegion './Public/Job/Start-IMJob.ps1' 59
#Region './Public/Job/Suspend-IMJob.ps1' -1

function Suspend-IMJob
{
    <#
    .DESCRIPTION
        Suspend immich job
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER Job
        Defines the job type to pause
    .PARAMETER Force
        Defines force
    .EXAMPLE
        Suspend-IMJob -job 'thumbnailGeneration'

        Suspend immich job
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'FP')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [ValidateSet('thumbnailGeneration', 'metadataExtraction', 'videoConversion', 'faceDetection', 'facialRecognition', 'smartSearch', 'backgroundTask', 'storageTemplateMigration', 'migration', 'search', 'sidecar', 'library')]
        [string[]]
        $Job,

        [Parameter()]
        [switch]
        $Force
    )

    $Job | ForEach-Object {
        $CurrentJob = $PSItem
        $Body = @{}
        $Body += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'Force')
        $Body += @{command = 'pause' }
        InvokeImmichRestMethod -Method PUT -RelativePath "/jobs/$CurrentJob" -ImmichSession:$Session -Body:$Body
    }
}
#endregion
#EndRegion './Public/Job/Suspend-IMJob.ps1' 45
#Region './Public/Library/Get-IMLibrary.ps1' -1

function Get-IMLibrary
{
    <#
    .DESCRIPTION
        Retreives Immich library
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines a specific library id to be retreived
    .PARAMETER type
        Defines which type of library to retreive
    .PARAMETER ownerId
        Retreive libraries for a user
    .PARAMETER IncludeStatistics
        Includes statistics for the library in the return object
    .EXAMPLE
        Get-IMLibrary

        Retreives Immich library
    #>


    [CmdletBinding(DefaultParameterSetName = 'list')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'id', ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id,

        [Parameter(ParameterSetName = 'id')]
        [switch]
        $IncludeStatistics,

        [Parameter(ParameterSetName = 'list')]
        [ValidateSet('UPLOAD', 'EXTERNAL')]
        [string]
        $type,

        [Parameter(ParameterSetName = 'list')]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $ownerId

    )

    BEGIN
    {
        if ($PSCmdlet.ParameterSetName -eq 'list')
        {
            $QueryParameters = @{}
            $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'type')
        }
    }

    PROCESS
    {
        if ($PSCmdlet.ParameterSetName -eq 'id')
        {
            $id | ForEach-Object {
                $CurrentID = $PSItem
                $Result = InvokeImmichRestMethod -Method Get -RelativePath "/library/$CurrentID" -ImmichSession:$Session
                if ($IncludeStatistics)
                {
                    $Stats = InvokeImmichRestMethod -Method GET -RelativePath "/library/$CurrentID/statistics" -ImmichSession:$Session
                    $Result | Add-Member -MemberType NoteProperty -Name 'Statistics' -Value $Stats
                }
                $Result
            }
        }
    }

    END
    {
        if ($PSCmdlet.ParameterSetName -eq 'list')
        {
            if ($ownerId)
            {
                InvokeImmichRestMethod -Method Get -RelativePath '/library' -ImmichSession:$Session -QueryParameters $QueryParameters | Where-Object { $_.ownerid -eq $ownerid }
            }
            else
            {
                InvokeImmichRestMethod -Method Get -RelativePath '/library' -ImmichSession:$Session -QueryParameters $QueryParameters
            }
        }
    }
}
#endregion
#EndRegion './Public/Library/Get-IMLibrary.ps1' 93
#Region './Public/Library/New-IMLibrary.ps1' -1

function New-IMLibrary
{
    <#
    .DESCRIPTION
        Adds a new library
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER name
        Defines the name of the library
    .PARAMETER exclusionPatterns
        Defines an exclusion pattern
    .PARAMETER importPaths
        Defines the import paths
    .PARAMETER isVisible
        Defines if the library should be visible
    .PARAMETER isWatched
        Defines if the library should be watched by immich
    .PARAMETER ownerId
        Defines the owner of library
    .PARAMETER type
        Defines the type of library ASSET, EXTERNAL
    .EXAMPLE
        New-IMLibrary -Name 'NAS' -ImportPaths '/mnt/media/pictures'

        Adds a new library
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Do not agree, new initiates an entity not previously known to the system, that should not cause issues.')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [string]
        $name,

        [Parameter()]
        [string[]]
        $exclusionPatterns,

        [Parameter()]
        [string[]]
        $importPaths,

        [Parameter()]
        [boolean]
        $isVisible = $true,

        [Parameter()]
        [boolean]
        $isWatched = $false,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $ownerId,

        [Parameter(Mandatory)]
        [ValidateSet('UPLOAD', 'EXTERNAL')]
        [string]
        $type

    )

    BEGIN
    {
        $BodyParameters = @{}
        $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'name', 'exclusionPatterns', 'importPaths', 'isVisible', 'isWatched', 'ownerId', 'type')

        # Force provided value to upper case to satisfy API
        $BodyParameters.type = $BodyParameters.type.ToUpper()
    }

    PROCESS
    {
        InvokeImmichRestMethod -Method Post -RelativePath '/library' -ImmichSession:$Session -Body $BodyParameters
    }

}
#endregion
#EndRegion './Public/Library/New-IMLibrary.ps1' 84
#Region './Public/Library/Remove-IMLibrary.ps1' -1

function Remove-IMLibrary
{
    <#
    .DESCRIPTION
        Removes an Immich library
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines the library ids that should be removed. Accepts pipeline input.
    .EXAMPLE
        Remove-IMLibrary -id <libraryid>

        Removes an Immich library
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [Alias('libraryId')]
        [string[]]
        $id
    )

    PROCESS
    {
        # We loop through IDs because ids can be provided as an array to the parameter in which case the process block only gets called once.
        $id | ForEach-Object {
            $CurrentID = $PSItem
            if ($PSCmdlet.ShouldProcess($CurrentID, 'DELETE'))
            {
                InvokeImmichRestMethod -Method Delete -RelativePath "/library/$CurrentID" -ImmichSession:$Session
            }
        }
    }
}
#endregion
#EndRegion './Public/Library/Remove-IMLibrary.ps1' 44
#Region './Public/Library/Remove-IMOfflineLibraryFile.ps1' -1

function Remove-IMOfflineLibraryFile
{
    <#
    .DESCRIPTION
        Purge offline files in library
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines a specific library id to be cleaned up
    .EXAMPLE
        Remove-IMOfflineLibraryFile -id <libraryid>

        Purge offline files in library
    #>


    [CmdletBinding(DefaultParameterSetName = 'list', SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'id', ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id
    )

    PROCESS
    {
        $id | ForEach-Object {
            $CurrentID = $PSItem
            if ($PSCmdlet.ShouldProcess($CurrentID, 'purge offline files'))
            {
                InvokeImmichRestMethod -Method POST -RelativePath "/library/$CurrentID/removeOffline" -ImmichSession:$Session
            }
        }

    }
}
#endregion
#EndRegion './Public/Library/Remove-IMOfflineLibraryFile.ps1' 43
#Region './Public/Library/Set-IMLibrary.ps1' -1

function Set-IMLibrary
{
    <#
    .DESCRIPTION
        Updates an Immich library
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines library to update
    .PARAMETER exclusionPatterns
        Defines exclusion patterns
    .PARAMETER importPaths
        Defines import paths
    .PARAMETER isVisible
        Defines if the library should be visible
    .PARAMETER name
        Defines the name of the library
    .EXAMPLE
        Set-IMLibrary -id <libraryid> -Name 'NewName'

        Update an Immich library
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id,

        [Parameter()]
        [string[]]
        $exclusionPatterns,

        [Parameter()]
        [string[]]
        $importPaths,

        [Parameter()]
        [boolean]
        $isVisible,

        [Parameter()]
        [string]
        $name
    )

    BEGIN
    {
        $BodyParameters = @{}
        $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'exclusionPatterns', 'importPaths', 'isVisible', 'name')
    }

    PROCESS
    {
        $id | ForEach-Object {
            if ($PSCmdlet.ShouldProcess($PSItem, 'Update'))
            {
                InvokeImmichRestMethod -Method PUT -RelativePath "/library/$PSItem" -ImmichSession:$Session -Body:$BodyParameters
            }
        }
    }
}
#endregion
#EndRegion './Public/Library/Set-IMLibrary.ps1' 71
#Region './Public/Library/Sync-IMLibrary.ps1' -1

function Sync-IMLibrary
{
    <#
    .DESCRIPTION
        Start library scan job
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines a specific library id to be cleaned up
    .PARAMETER refreshAllFiles
        Defines if all assets should be scanned. Default false
    .PARAMETER refreshModifiedFiles
        Defines that only new/modified assets should be scanned. Default true
    .EXAMPLE
        Sync-IMLibrary -id <libraryid>

        Start library scan job
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'FP')]
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'FP')]
    [CmdletBinding(DefaultParameterSetName = 'list')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'id', ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id,

        [Parameter()]
        [boolean]
        $refreshAllFiles = $false,

        [Parameter()]
        [boolean]
        $refreshModifiedFiles = $true
    )

    PROCESS
    {
        $id | ForEach-Object {
            $CurrentID = $PSItem
            InvokeImmichRestMethod -Method POST -RelativePath "/library/$CurrentID/scan" -ImmichSession:$Session
        }

    }
}
#endregion
#EndRegion './Public/Library/Sync-IMLibrary.ps1' 53
#Region './Public/Library/Test-IMLibrary.ps1' -1

function Test-IMLibrary
{
    <#
    .DESCRIPTION
        Validate library
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines libraries to validate
    .PARAMETER exclusionPatterns
        Defines exlusion patterns
    .PARAMETER importPaths
        Defines import paths
    .EXAMPLE
        Test-IMLibrary -id <libraryid>

       Validate library
    #>


    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id,

        [Parameter()]
        [string[]]
        $exclusionPatterns,

        [Parameter()]
        [string[]]
        $importPaths
    )

    BEGIN
    {
        $BodyParameters = @{}
        $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'exclusionPatterns', 'importPaths')
    }

    PROCESS
    {
        $id | ForEach-Object {
            InvokeImmichRestMethod -Method POST -RelativePath "/library/$PSItem/validate" -ImmichSession:$Session -Body:$BodyParameters
        }
    }
}
#endregion
#EndRegion './Public/Library/Test-IMLibrary.ps1' 56
#Region './Public/Partner/Add-IMPartner.ps1' -1

function Add-IMPartner
{
    <#
    .DESCRIPTION
        Add immich partner
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Define the id of the partner to add
    .EXAMPLE
        Add-IMPartner -id <userid>

        Add immich partner
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $id
    )

    InvokeImmichRestMethod -Method POST -RelativePath "/partner/$id" -ImmichSession:$Session
}
#endregion
#EndRegion './Public/Partner/Add-IMPartner.ps1' 33
#Region './Public/Partner/Get-IMPartner.ps1' -1

function Get-IMPartner
{
    <#
    .DESCRIPTION
        Get immich partner
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER direction
        Defines the direction of the partnership
    .EXAMPLE
        Get-IMPartner -direction 'shared-with'

        Get immich partner
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [ValidateSet('shared-by', 'shared-with')]
        [string]
        $Direction

    )

    PROCESS
    {
        $QueryParameters = @{
            direction = $Direction
        }
        InvokeImmichRestMethod -Method GET -RelativePath '/partner' -ImmichSession:$Session -QueryParameters:$QueryParameters
    }
}
#endregion
#EndRegion './Public/Partner/Get-IMPartner.ps1' 40
#Region './Public/Partner/Remove-IMPartner.ps1' -1

function Remove-IMPartner
{
    <#
    .DESCRIPTION
        Remove immich partner
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines the partner id
    .EXAMPLE
        Remove-IMPartner -id <userid>

        Remove immich partner
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', 'Session', Justification = 'FP')]
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $id
    )
    if ($PSCmdlet.ShouldProcess($id, 'DELETE'))
    {
        InvokeImmichRestMethod -Method DELETE -RelativePath "/partner/$id" -ImmichSession:$Session
    }
}
#endregion
#EndRegion './Public/Partner/Remove-IMPartner.ps1' 35
#Region './Public/Partner/Set-IMPartner.ps1' -1

function Set-IMPartner
{
    <#
    .DESCRIPTION
        Set immich partner
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Define the id of the partner to update
    .PARAMETER EnableTimeline
        Defines that the partners assets should be displayed within the main timeline
    .EXAMPLE
        Set-IMPartner -id <userid> -EnableTimeline

        Set immich partner
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'FP')]
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $id,

        [Parameter()]
        [switch]
        $EnableTimeline
    )

    if ($PSCmdlet.ShouldProcess($id, 'Update'))
    {
        $Body = @{}
        $Body += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'EnableTimeline' -NameMapping @{EnableTimeline = 'inTimeline' })

        InvokeImmichRestMethod -Method PUT -RelativePath "/partner/$id" -ImmichSession:$Session -Body:$Body
    }
}
#endregion
#EndRegion './Public/Partner/Set-IMPartner.ps1' 45
#Region './Public/Person/Get-IMPerson.ps1' -1

function Get-IMPerson
{
    <#
    .DESCRIPTION
        Retreives Immich person
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines a specific person to be retreived
    .PARAMETER withHidden
        Defines if hidden should be returned or not. Do not specify if either should be returned.
    .EXAMPLE
        Get-IMPerson

        Retreives Immich person
    #>


    [CmdletBinding(DefaultParameterSetName = 'list')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'id', ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $id,

        [Parameter(ParameterSetName = 'list')]
        [switch]
        $withHidden
    )

    BEGIN
    {
        if ($PSCmdlet.ParameterSetName -eq 'list')
        {
            $QueryParameters = @{}
            $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'withHidden')
        }
    }

    PROCESS
    {
        switch ($PSCmdlet.ParameterSetName)
        {
            'list'
            {
                InvokeImmichRestMethod -Method Get -RelativePath '/person' -ImmichSession:$Session -QueryParameters $QueryParameters
            }
            'id'
            {
                InvokeImmichRestMethod -Method Get -RelativePath "/person/$id" -ImmichSession:$Session -QueryParameters $QueryParameters
            }
        }
    }
}
#endregion
#EndRegion './Public/Person/Get-IMPerson.ps1' 61
#Region './Public/Person/New-IMPerson.ps1' -1

function New-IMPerson
{
    <#
    .DESCRIPTION
        Adds a new Immich person
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER birthDate
        Defines a birthdate for the person
    .PARAMETER isHidden
        Defines if the person is hidden
    .PARAMETER name
        Defines the name of the person
    .EXAMPLE
        New-IMPerson -Name 'John Smith'

        Adds a new Immich person
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'FP')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [string]
        $Name,

        [Parameter()]
        [switch]
        $IsHidden,

        [Parameter()]
        [datetime]
        $BirthDate
    )

    $Body = @{}
    $Body += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'BirthDate', 'IsHidden', 'Name' -namemapping @{BirthDate = 'birthDate'; IsHidden = 'isHidden'; Name = 'name' })
    InvokeImmichRestMethod -Method Post -RelativePath '/person' -ImmichSession:$Session -Body:$Body
}
#endregion
#EndRegion './Public/Person/New-IMPerson.ps1' 46
#Region './Public/Person/Set-IMPerson.ps1' -1

function Set-IMPerson
{
    <#
    .DESCRIPTION
        Updates an Immich asset
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines the person to update
    .PARAMETER BirthDate
        Defines birth date
    .PARAMETER FaceAssetId
        Defines an face asset id
    .PARAMETER IsHidden
        Defines if the person should be hidden
    .PARAMETER Name
        Defines the name of the person
    .EXAMPLE
        Set-IMPerson -id <personid> -Name 'John Smith'

        Update an Immich asset
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'FP')]
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $Id,

        [Parameter()]
        [datetime]
        $BirthDate,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $FaceAssetId,

        [Parameter()]
        [boolean]
        $IsHidden,

        [Parameter()]
        [string]
        $Name

    )

    BEGIN
    {
        $ObjectArray = [array]@()
    }

    PROCESS
    {
        $id | ForEach-Object {
            $CurrentID = $PSItem
            $BodyParameters = @{}
            $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'BirthDate', 'FaceAssetId', 'IsHidden', 'Name' -NameMapping @{
                    BirthDate   = 'birthDate'
                    FaceAssetId = 'featureFaceAssetId'
                    IsHidden    = 'isHidden'
                    Name        = 'name'
                })
            $BodyParameters += @{id = $CurrentID }
            $ObjectArray += $BodyParameters
        }
    }

    END
    {
        if ($PSCmdlet.ShouldProcess(($ObjectArray.id -join ','), 'PUT'))
        {
            $BodyResult = @{
                people = $ObjectArray
            }
            InvokeImmichRestMethod -Method Put -RelativePath '/person' -ImmichSession:$Session -Body:$BodyResult
        }
    }

}
#endregion
#EndRegion './Public/Person/Set-IMPerson.ps1' 90
#Region './Public/ServerConfig/Get-IMConfig.ps1' -1

function Get-IMConfig
{
    <#
    .DESCRIPTION
        Retreives Immich config
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER Default
        Retreives default config instead of current applied
    .PARAMETER ReturnRawJSON
        This is useful if you want to alter the current config and pass it on to Set-IMConfig
    .PARAMETER StorageTemplate
        Specifies that storage template configuration should be returned.
    .PARAMETER MapStyle
        Specifies that map style configuration should be returned.
    .PARAMETER Theme
        Specifies which theme (dark or light) should be returned.
    .EXAMPLE
        Get-IMConfig

        Retreives Immich config
    #>


    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'FP')]
    [CmdletBinding(DefaultParameterSetName = 'applied')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(ParameterSetName = 'applied')]
        [Parameter(ParameterSetName = 'default')]
        [switch]
        $ReturnRawJSON,

        [Parameter(ParameterSetName = 'default')]
        [switch]
        $Default,

        [Parameter(ParameterSetName = 'storage')]
        [switch]
        $StorageTemplate,

        [Parameter(ParameterSetName = 'mapstyle')]
        [switch]
        $MapStyle,

        [Parameter(ParameterSetName = 'mapstyle')]
        [ValidateSet('light', 'dark')]
        [ValidateScript({ $PSItem -ceq 'light' -or $PSItem -ceq 'dark' })]
        [string]
        $Theme
    )

    switch ($PSCmdlet.ParameterSetName)
    {
        'applied'
        {
            $Result = InvokeImmichRestMethod -Method Get -RelativePath '/system-config' -ImmichSession:$Session
            if ($ReturnRawJSON)
            {
                $Result | ConvertTo-Json -Depth 10
            }
            else
            {
                $Result
            }
            break
        }
        'default'
        {
            $Result = InvokeImmichRestMethod -Method Get -RelativePath '/system-config/defaults' -ImmichSession:$Session
            if ($ReturnRawJSON)
            {
                $Result | ConvertTo-Json -Depth 10
            }
            else
            {
                $Result
            }
            break
        }
        'mapstyle'
        {
            InvokeImmichRestMethod -Method Get -RelativePath '/system-config/map/style.json' -ImmichSession:$Session -QueryParameters:@{theme = $Theme }
            break
        }
        'storage'
        {
            InvokeImmichRestMethod -Method Get -RelativePath '/system-config/storage-template-options' -ImmichSession:$Session
            break
        }
    }

}
#endregion
#EndRegion './Public/ServerConfig/Get-IMConfig.ps1' 99
#Region './Public/ServerConfig/Set-IMConfig.ps1' -1

function Set-IMConfig
{
    <#
    .DESCRIPTION
        Set immich config
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER RawJSON
        Defines the immich configuration. Provided as JSON text.
    .EXAMPLE
        Set-IMConfig

        Set immich config
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter()]
        [string]
        $RawJSON
    )

    if ($PSCmdlet.ShouldProcess('Config', 'Set'))
    {
        InvokeImmichRestMethod -Method Put -RelativePath '/system-config' -ImmichSession:$Session -RawBody:$RawJSON
    }
}
#endregion
#EndRegion './Public/ServerConfig/Set-IMConfig.ps1' 35
#Region './Public/ServerInfo/Get-IMServer.ps1' -1

function Get-IMServer
{
    <#
    .DESCRIPTION
        Retreives all Immich server info properties
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMServer

        Retreives all Immich server info properties
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null
    )

    $ResultObject = [ordered]@{}
    $Results = [array]@()
    $Results += Get-IMServerConfig -Session:$Session | Add-Member -MemberType NoteProperty -Name 'ObjectType' -Value 'Config' -PassThru
    $Results += Get-IMServerFeature -Session:$Session | Add-Member -MemberType NoteProperty -Name 'ObjectType' -Value 'Feature' -PassThru
    $Results += Get-IMServerInfo -Session:$Session | Add-Member -MemberType NoteProperty -Name 'ObjectType' -Value 'Info' -PassThru
    $Results += Get-IMServerStatistic -Session:$Session | Add-Member -MemberType NoteProperty -Name 'ObjectType' -Value 'Stats' -PassThru
    $Results += Get-IMServerVersion -Session:$Session | Add-Member -MemberType NoteProperty -Name 'ObjectType' -Value 'Version' -PassThru
    $Results += Get-IMSupportedMediaType -Session:$Session | Add-Member -MemberType NoteProperty -Name 'ObjectType' -Value 'Media' -PassThru
    $Results += Get-IMTheme -Session:$Session | Add-Member -MemberType NoteProperty -Name 'ObjectType' -Value 'Theme' -PassThru
    $Results += Test-IMPing -Session:$Session | Add-Member -MemberType NoteProperty -Name 'ObjectType' -Value 'Ping' -PassThru

    foreach ($Result in $Results)
    {
        foreach ($property in ($Result.PSObject.Properties.Name | Sort-Object))
        {
            if ($property -eq 'ObjectType')
            {
                continue
            }
            $ResultObject.Add("$($Result.ObjectType)_$Property", $Result.$Property)
        }
    }
    return [pscustomobject]$ResultObject

}
#endregion
#EndRegion './Public/ServerInfo/Get-IMServer.ps1' 47
#Region './Public/ServerInfo/Get-IMServerConfig.ps1' -1

function Get-IMServerConfig
{
    <#
    .DESCRIPTION
        Retreives Immich server config
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMServerConfig

        Retreives Immich server config
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null
    )

    InvokeImmichRestMethod -noauth -Method Get -RelativePath '/server-info/config' -ImmichSession:$Session

}
#endregion
#EndRegion './Public/ServerInfo/Get-IMServerConfig.ps1' 25
#Region './Public/ServerInfo/Get-IMServerFeature.ps1' -1

function Get-IMServerFeature
{
    <#
    .DESCRIPTION
        Retreives Immich server feature
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMServerFeature

        Retreives Immich server feature
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null
    )

    InvokeImmichRestMethod -noauth -Method Get -RelativePath '/server-info/features' -ImmichSession:$Session

}
#endregion
#EndRegion './Public/ServerInfo/Get-IMServerFeature.ps1' 25
#Region './Public/ServerInfo/Get-IMServerInfo.ps1' -1

function Get-IMServerInfo
{
    <#
    .DESCRIPTION
        Retreives Immich server info
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMServerInfo

        Retreives Immich server info
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null
    )

    InvokeImmichRestMethod -Method Get -RelativePath '/server-info' -ImmichSession:$Session

}
#endregion
#EndRegion './Public/ServerInfo/Get-IMServerInfo.ps1' 25
#Region './Public/ServerInfo/Get-IMServerStatistic.ps1' -1

function Get-IMServerStatistic
{
    <#
    .DESCRIPTION
        Retreives Immich server statistic
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMServerStatistic

        Retreives Immich server statistic
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null
    )

    InvokeImmichRestMethod -Method Get -RelativePath '/server-info/statistics' -ImmichSession:$Session

}
#endregion
#EndRegion './Public/ServerInfo/Get-IMServerStatistic.ps1' 25
#Region './Public/ServerInfo/Get-IMServerVersion.ps1' -1

function Get-IMServerVersion
{
    <#
    .DESCRIPTION
        Retreives Immich server version
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMServerVersion

        Retreives Immich server version
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null
    )

    $Result = InvokeImmichRestMethod -noauth -Method Get -RelativePath '/server-info/version' -ImmichSession:$Session
    return [pscustomobject]@{
        version = "$($Result.Major).$($Result.Minor).$($Result.Patch)"
    }

}
#endregion
#EndRegion './Public/ServerInfo/Get-IMServerVersion.ps1' 28
#Region './Public/ServerInfo/Get-IMSupportedMediaType.ps1' -1

function Get-IMSupportedMediaType
{
    <#
    .DESCRIPTION
        Retreives Immich supported media type
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMSupportedMediaType

        Retreives Immich supported media type
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null
    )

    InvokeImmichRestMethod -noauth -Method Get -RelativePath '/server-info/media-types' -ImmichSession:$Session

}
#endregion
#EndRegion './Public/ServerInfo/Get-IMSupportedMediaType.ps1' 25
#Region './Public/ServerInfo/Get-IMTheme.ps1' -1

function Get-IMTheme
{
    <#
    .DESCRIPTION
        Retreives Immich theme CSS
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-IMTheme

        Retreives Immich theme CSS
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null
    )

    InvokeImmichRestMethod -Method Get -RelativePath '/server-info/theme' -ImmichSession:$Session

}
#endregion
#EndRegion './Public/ServerInfo/Get-IMTheme.ps1' 25
#Region './Public/ServerInfo/Test-IMPing.ps1' -1

function Test-IMPing
{
    <#
    .DESCRIPTION
        Ping Immich instance
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Test-IMPing

        Ping Immich instance
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null
    )

    $Result = InvokeImmichRestMethod -noauth -Method Get -RelativePath '/server-info/ping' -ImmichSession:$Session
    if ($Result.res -eq 'pong')
    {
        return [pscustomobject]@{responds = $true }
    }
    else
    {
        return [pscustomobject]@{responds = $false }
    }

}
#endregion
#EndRegion './Public/ServerInfo/Test-IMPing.ps1' 33
#Region './Public/Session/Connect-Immich.ps1' -1

function Connect-Immich
{
    <#
    .DESCRIPTION
        Connect to a Immich instance
    .PARAMETER BaseURL
        Defines the base URL to the immich instance

        -BaseURL 'https://immich.domain.com'
    .PARAMETER AccessToken
        Connects to immich using a access token. This AccessToken can be generated from the Immich Web GUI.

        -AccessToken 'ABoR54bB1NUc4aNY0F2PhppP1tVDu2Husr3vEbPUsw5'
    .PARAMETER Credential
        Connect to immich using username and password. Parameter accepts a PSCredentials object

        -Credential (Get-Credential)
    .PARAMETER PassThru
        This parameter will cause the function to return a ImmichSession object that can be stored in a variable and referensed with the -Session parameter on most cmdlets.

        -PassThru
    .EXAMPLE
        Connect-Immich -BaseURL 'https://immich.domain.com' -AccessToken 'ABoR54bB1NUc4aNY0F2PhppP1tVDu2Husr3vEbPUsw5'

        Connect using access token
    .EXAMPLE
        Connect-Immich -BaseURL 'https://immich.domain.com' -Credentials (Get-Credential)

        Connect using username and password
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '', Justification = 'AccessToken')]

    [CmdletBinding()]
    param(
        [Parameter(Mandatory)][string]$BaseURL,
        [Parameter(ParameterSetName = 'AccessToken')][string]$AccessToken,
        [Parameter(ParameterSetName = 'Credentials')][pscredential]$Credential,
        [switch]$PassThru
    )

    switch ($PSCmdlet.ParameterSetName)
    {
        'AccessToken'
        {
            $AccessTokenSS = ConvertTo-SecureString -String $AccessToken -AsPlainText -Force
            Remove-Variable -Name AccessToken
            $script:ImmichSession = [ImmichSession]::New($BaseURL, $AccessTokenSS)
        }
        'Credentials'
        {
            $script:ImmichSession = [ImmichSession]::New($BaseURL, $Credential)
        }
    }

    if ($Passthru)
    {
        return $script:ImmichSession
    }
}
#EndRegion './Public/Session/Connect-Immich.ps1' 60
#Region './Public/Session/Disconnect-Immich.ps1' -1

function Disconnect-Immich
{
    <#
    .DESCRIPTION
        Disconnect and cleanup session configuration
    .PARAMETER Session
        Defines a ImmichSession object that will be disconnected and cleaned up.
    .EXAMPLE
        Disconnect-Immich

        Disconnect from the default immich session
    .EXAMPLE
        Disconnect-Immich -Session $Session

        Disconnect the specified session
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null
    )

    InvokeImmichRestMethod -Method Post -RelativePath '/auth/logout' -ImmichSession:$Session

    # Remove ImmichSession variable
    if ($Session)
    {
        if ($script:ImmichSession.SessionID -eq $Session.SessionID)
        {
            Remove-Variable ImmichSession -Scope Script
        }
    }
    else
    {
        Remove-Variable ImmichSession -Scope Script
    }

}
#EndRegion './Public/Session/Disconnect-Immich.ps1' 39
#Region './Public/Session/Get-IMSession.ps1' -1

function Get-IMSession
{
    <#
    .DESCRIPTION
        Displays the Immich Session object.
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Get-PSession

        Returns the ImmichSession, if none is specified, it tries to retreive the default
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null
    )

    if ($Session)
    {
        Write-Debug -Message 'Get-PSession; ImmichSession was passed as parameter'
        return $Session
    }
    elseif ($script:ImmichSession)
    {
        Write-Debug -Message 'Get-PSession; ImmichSession found in script scope'
        return $script:ImmichSession
    }
    else
    {
        Write-Error -Message 'No Immich Session established, please call Connect-Immich'
    }
}
#endregion
#EndRegion './Public/Session/Get-IMSession.ps1' 37
#Region './Public/Session/Invoke-ImmichMethod.ps1' -1

function Invoke-ImmichMethod
{
    <#
    .DESCRIPTION
        Invokes command
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER Headers
        Headers
    .PARAMETER QueryParameters
        Query parameters
    .PARAMETER BodyParameters
        Body parameters
    .PARAMETER Method
        Method
    .PARAMETER RelativeURI
        RelativePath
    .PARAMETER ContentType
        ContentType
    .PARAMETER OutFilePath
        OutFilePath
    .EXAMPLE
        Invoke-ImmichMethod

        Retreives all Immich server info properties
    #>


    [CmdletBinding()]
    param(
        [Parameter()][ImmichSession]$Session = $null,

        [Parameter()][hashtable]$Headers,

        [Parameter()][hashtable]$QueryParameters,

        [Parameter()][hashtable]$BodyParameters,

        [Parameter()][string]$Method,

        [Parameter()][string]$RelativeURI,

        [Parameter()][string]$ContentType = 'application/json',

        [Parameter()][system.io.fileinfo]$OutFilePath
    )

    $Parameters = @{
        Method       = $Method
        RelativePath = $RelativeURI
        ContentType  = $ContentType
    }

    if ($QueryParameters)
    {
        $Parameters.QueryParameters = $QueryParameters
    }

    if ($BodyParameters)
    {
        $Parameters.Body = $BodyParameters
    }
    if ($Headers)
    {
        $Parameters.Headers = $Headers
    }
    if ($OutFilePath)
    {
        $Parameters.OutFilePath = $OutFilePath
    }

    InvokeImmichRestMethod @Parameters -ImmichSession:$Session

}
#endregion
#EndRegion './Public/Session/Invoke-ImmichMethod.ps1' 77
#Region './Public/SharedLink/Add-IMSharedLinkAsset.ps1' -1

function Add-IMSharedLinkAsset
{
    <#
    .DESCRIPTION
        Add Immich shared link asset
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines assets to add to the shared link
    .PARAMETER SharedLinkId
        Defines a shared link to add assets to
    .EXAMPLE
        Add-IMSharedLinkAsset

        Add Immich shared link asset
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $Id,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $SharedLinkId
    )

    BEGIN
    {
        $AssetIDs = [System.Collections.Generic.List[string]]::New()
    }

    PROCESS
    {
        $id | ForEach-Object {
            $AssetIDs.Add($PSItem)
        }
    }

    END
    {
        $Body = @{
            assetIds = $AssetIDs
        }
        InvokeImmichRestMethod -Method PUT -RelativePath "/shared-link/$SharedLinkId/assets" -ImmichSession:$Session -Body $Body
    }
}
#endregion
#EndRegion './Public/SharedLink/Add-IMSharedLinkAsset.ps1' 58
#Region './Public/SharedLink/Get-IMSharedLink.ps1' -1

function Get-IMSharedLink
{
    <#
    .DESCRIPTION
        Retreives Immich shared link
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines a specific shared link id to be retreived
    .PARAMETER password
        ...
    .PARAMETER token
        ...
    .PARAMETER Me
        Defines that the currently connected users information is retreived.
    .EXAMPLE
        Get-IMSharedLink

        Retreives Immich shared link
    #>


    [CmdletBinding(DefaultParameterSetName = 'list')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'id', ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id,

        [Parameter(ParameterSetName = 'me')]
        [securestring]
        $password,

        [Parameter(ParameterSetName = 'me')]
        [string]
        $token,

        [Parameter(Mandatory, ParameterSetName = 'me')]
        [switch]
        $Me
    )

    BEGIN
    {
        if ($PSCmdlet.ParameterSetName -eq 'list')
        {
            $QueryParameters = @{}
            $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'password', 'token')
        }
    }

    PROCESS
    {
        switch ($PSCmdlet.ParameterSetName)
        {
            'list'
            {
                InvokeImmichRestMethod -Method Get -RelativePath '/shared-link' -ImmichSession:$Session -QueryParameters $QueryParameters
            }
            'id'
            {
                $id | ForEach-Object {
                    InvokeImmichRestMethod -Method Get -RelativePath "/shared-link/$PSItem" -ImmichSession:$Session
                }
            }
            'me'
            {
                InvokeImmichRestMethod -Method Get -RelativePath '/shared-link/me' -ImmichSession:$Session
            }
        }
    }
}
#endregion
#EndRegion './Public/SharedLink/Get-IMSharedLink.ps1' 79
#Region './Public/SharedLink/New-IMSharedLink.ps1' -1

function New-IMSharedLink
{
    <#
    .DESCRIPTION
        New Immich shared link
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER AssetId
        Defines the asset ids to share
    .PARAMETER AlbumId
        Defines the albumid to share
    .PARAMETER AllowDownload
        Defines if downloading of assets are permitted.
    .PARAMETER AllowUpload
        Defines if uploads of assets are permitted.
    .PARAMETER Description
        Defines a description of the shared link
    .PARAMETER ExpiresAt
        Defines an expiration date of the shared link
    .PARAMETER ShowMetadata
        Defines if asset metadata is shown
    .PARAMETER Password
        Defines a password for the shared link
    .EXAMPLE
        New-IMSharedLink

        New Immich shared link
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'FP')]
    [CmdletBinding(DefaultParameterSetName = 'asset')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'asset', ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $AssetId,

        [Parameter(Mandatory, ParameterSetName = 'album')]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $AlbumId,

        [Parameter()]
        [switch]
        $AllowDownload,

        [Parameter()]
        [switch]
        $AllowUpload,

        [Parameter()]
        [string]
        $Description,

        [Parameter()]
        [datetime]
        $ExpiresAt,

        [Parameter()]
        [switch]
        $ShowMetadata,

        [Parameter()]
        [securestring]
        $Password
    )

    BEGIN
    {
        $Body = @{}
        $Body += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'AllowDownload', 'AllowUpload', 'Description', 'ExpiresAt', 'ShowMetadata', 'Password' -NameMapping @{
                AllowDownload = 'allowDownload'
                AllowUpload   = 'allowUpload'
                Description   = 'description'
                ExpiresAt     = 'expiresAt'
                ShowMetadata  = 'showMetadata'
                Password      = 'password'
            })
        if ($PSCmdlet.ParameterSetName -eq 'asset')
        {
            $Body.assetIds = [string[]]@()
            $Body.type = 'INDIVIDUAL'
        }
    }

    PROCESS
    {
        switch ($PSCmdlet.ParameterSetName)
        {
            'asset'
            {
                $AssetId | ForEach-Object {
                    $Body.assetIds += $PSItem
                }
            }
            'album'
            {
                $Body += @{
                    type    = 'ALBUM'
                    albumId = $AlbumId
                }
            }
        }
    }

    END
    {
        InvokeImmichRestMethod -Method POST -RelativePath '/shared-link' -ImmichSession:$Session -Body $Body
    }
}
#endregion
#EndRegion './Public/SharedLink/New-IMSharedLink.ps1' 117
#Region './Public/SharedLink/Remove-IMSharedLink.ps1' -1

function Remove-IMSharedLink
{
    <#
    .DESCRIPTION
        Remove Immich shared link
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines a specific shared link id to be removed
    .EXAMPLE
        Remove-IMSharedLink -id <sharedlinkid>

        Remove Immich shared link
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'id', ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id
    )

    PROCESS
    {
        $id | ForEach-Object {
            if ($PSCmdlet.ShouldProcess($PSItem, 'DELETE'))
            {
                InvokeImmichRestMethod -Method DELETE -RelativePath "/shared-link/$PSItem" -ImmichSession:$Session
            }
        }
    }
}
#endregion
#EndRegion './Public/SharedLink/Remove-IMSharedLink.ps1' 41
#Region './Public/SharedLink/Remove-IMSharedLinkAsset.ps1' -1

function Remove-IMSharedLinkAsset
{
    <#
    .DESCRIPTION
        Remove Immich shared link asset
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines assets to add to the shared link
    .PARAMETER SharedLinkId
        Defines a shared link to add assets to
    .EXAMPLE
        Remove-IMSharedLinkAsset -id <assetid> -sharedlinkid <sharedlinkid>

        Remove Immich shared link asset
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $Id,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $SharedLinkId
    )

    BEGIN
    {
        $AssetIDs = [System.Collections.Generic.List[string]]::New()
    }

    PROCESS
    {
        $id | ForEach-Object {
            $AssetIDs.Add($PSItem)
        }
    }

    END
    {
        $Body = @{
            assetIds = $AssetIDs
        }
        InvokeImmichRestMethod -Method DELETE -RelativePath "/shared-link/$SharedLinkId/assets" -ImmichSession:$Session -Body $Body
    }
}
#endregion
#EndRegion './Public/SharedLink/Remove-IMSharedLinkAsset.ps1' 58
#Region './Public/SharedLink/Set-IMSharedLink.ps1' -1

function Set-IMSharedLink
{
    <#
    .DESCRIPTION
        Set Immich shared link
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER Id
        Defines the asset ids to share
    .PARAMETER AllowDownload
        Defines if downloading of assets are permitted.
    .PARAMETER AllowUpload
        Defines if uploads of assets are permitted.
    .PARAMETER Description
        Defines a description of the shared link
    .PARAMETER ExpiresAt
        Defines an expiration date of the shared link
    .PARAMETER ShowMetadata
        Defines if asset metadata is shown
    .PARAMETER Password
        Defines a password for the shared link
    .EXAMPLE
        Set-IMSharedLink -id <sharedlinkid> -AllowDownload

        Set Immich shared link
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $Id,

        [Parameter()]
        [switch]
        $AllowDownload,

        [Parameter()]
        [switch]
        $AllowUpload,

        [Parameter()]
        [string]
        $Description,

        [Parameter()]
        [datetime]
        $ExpiresAt,

        [Parameter()]
        [switch]
        $ShowMetadata,

        [Parameter()]
        [securestring]
        $Password
    )

    BEGIN
    {
        $Body = @{}
        $Body += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'AllowDownload', 'AllowUpload', 'Description', 'ExpiresAt', 'ShowMetadata', 'Password' -NameMapping @{
                AllowDownload = 'allowDownload'
                AllowUpload   = 'allowUpload'
                Description   = 'description'
                ExpiresAt     = 'expiresAt'
                ShowMetadata  = 'showMetadata'
                Password      = 'password'
            })
    }

    PROCESS
    {
        $id | ForEach-Object {
            if ($PSCmdlet.ShouldProcess($PSItem, 'Update'))
            {
                InvokeImmichRestMethod -Method PATCH -RelativePath "/shared-link/$PSItem" -ImmichSession:$Session -Body $Body
            }
        }
    }

}
#endregion
#EndRegion './Public/SharedLink/Set-IMSharedLink.ps1' 91
#Region './Public/Tag/Get-IMTag.ps1' -1

function Get-IMTag
{
    <#
    .DESCRIPTION
        Retreives Immich tag
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines a specific tag id to be retreived
    .EXAMPLE
        Get-IMTag

        Retreives Immich tag
    #>


    [CmdletBinding(DefaultParameterSetName = 'list')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'id', ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id
    )

    PROCESS
    {
        if ($PSCmdlet.ParameterSetName -eq 'id')
        {
            $id | ForEach-Object {
                $CurrentID = $PSItem
                InvokeImmichRestMethod -Method Get -RelativePath "/tag/$CurrentID" -ImmichSession:$Session
            }
        }
    }

    END
    {
        if ($PSCmdlet.ParameterSetName -eq 'list')
        {
            InvokeImmichRestMethod -Method Get -RelativePath '/tag' -ImmichSession:$Session
        }
    }
}
#endregion
#EndRegion './Public/Tag/Get-IMTag.ps1' 50
#Region './Public/Tag/New-IMTag.ps1' -1

function New-IMTag
{
    <#
    .DESCRIPTION
        Creates a new Immich tag
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER name
        Defines a name for the new tag
    .PARAMETER type
        Defines the type of tag to create. Valid values, OBJECT, FACE, CUSTOM
    .EXAMPLE
        New-IMTag -name 'Dogs' -type OBJECT

        Creates a new Immich tag
    #>


    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'FP')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [string]
        $name,

        [Parameter(Mandatory)]
        [string]
        $type
    )

    $BodyParameters = @{}
    $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'name', 'type')
    InvokeImmichRestMethod -Method Post -RelativePath '/tag' -ImmichSession:$Session -Body:$BodyParameters

}
#endregion
#EndRegion './Public/Tag/New-IMTag.ps1' 42
#Region './Public/Tag/Remove-IMTag.ps1' -1

function Remove-IMTag
{
    <#
    .DESCRIPTION
        Remove Immich tag
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines a specific tag id to be retreived
    .EXAMPLE
        Remove-IMTag -id <tagid>

        Remove Immich tag
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id
    )

    PROCESS
    {
        $id | ForEach-Object {
            $CurrentID = $PSItem
            if ($PSCmdlet.ShouldProcess($CurrentID, 'Remove'))
            {
                InvokeImmichRestMethod -Method DELETE -RelativePath "/tag/$CurrentID" -ImmichSession:$Session
            }
        }
    }
}
#endregion
#EndRegion './Public/Tag/Remove-IMTag.ps1' 42
#Region './Public/Tag/Rename-IMTag.ps1' -1

function Rename-IMTag
{
    <#
    .DESCRIPTION
        Remove Immich tag
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines a specific tag id to be renamed
    .PARAMETER NewName
        Defines a new name for the tag
    .EXAMPLE
        Rename-IMTag -id <tagid> -NewName 'Cats'

        Remove Immich tag
    #>


    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string]
        $id,

        [Parameter(Mandatory)]
        [string]
        $NewName

    )

    $BodyParameters = @{}
    $BodyParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'NewName' -NameMapping:@{NewName = 'name' })
    InvokeImmichRestMethod -Method PATCH -RelativePath "/tag/$id" -ImmichSession:$Session -Body:$BodyParameters
}
#endregion
#EndRegion './Public/Tag/Rename-IMTag.ps1' 42
#Region './Public/Tag/Set-IMTag.ps1' -1

function Set-IMTag
{
    <#
    .DESCRIPTION
        Add Immich asset tag
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines an asset id to tag
    .PARAMETER tagId
        Defines a tag id to assign to assets
    .PARAMETER tagName
        Defines a tag name to assign to assets. Note that the Immich API does support filtering on tagName so all tags will be retreived and then filtered. This means that if there is a very large amount of tags this method might be slow.
    .PARAMETER AddAssets
        Defines the assets to tag
    .PARAMETER RemoveAssets
        Defines the assets to untag
    .EXAMPLE
        Set-IMTag -AddAssets <assetid>

        Add tag to asset
    #>


    [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = 'tagId')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'tagid', ValueFromPipeline, ValueFromPipelineByPropertyName)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $Id,

        [Parameter(Mandatory, ParameterSetName = 'tagName')]
        [string]
        $tagName,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $AddAssets,

        [Parameter()]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $RemoveAssets
    )

    BEGIN
    {
        if ($PSCmdlet.ParameterSetName -eq 'tagName')
        {
            $TagObject = Get-IMTag | Where-Object { $_.name -eq $tagName }
            if ($TagObject)
            {
                $id = $TagObject.id
            }
            else
            {
                throw "Unable to find tag with name $($tagName)"
            }
        }
    }

    PROCESS
    {
        $id | ForEach-Object {
            if ($PSCmdlet.ShouldProcess($id, 'Add assets'))
            {
                if ($PSBoundParameters.Keys -contains 'AddAssets') {
                    InvokeImmichRestMethod -Method PUT -RelativePath "/tag/$PSitem/assets" -ImmichSession:$Session -Body:@{assetIds = ($AddAssets -as [string[]])}
                }
                if ($PSBoundParameters.Keys -contains 'RemoveAssets') {
                    InvokeImmichRestMethod -Method DELETE -RelativePath "/tag/$PSitem/assets" -ImmichSession:$Session -Body:@{assetIds = ($RemoveAssets -as [string[]])}
                }
            }
        }
    }
}
#endregion
#EndRegion './Public/Tag/Set-IMTag.ps1' 84
#Region './Public/User/Add-IMMyProfilePicture.ps1' -1

function Add-IMMyProfilePicture
{
    <#
    .DESCRIPTION
        Adds an Immich user profile picture
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER FilePath
        Defines the asset ids that should be removed. Accepts pipeline input.
    .EXAMPLE
        Add-IMMyProfilePicture -FilePath C:\avatar.jpg

        Add profile picture to current user
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'FP, retreived through PSBoundParameters')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [System.IO.FileInfo]
        $FilePath
    )

    BEGIN
    {
        # Do not run on Windows Powershell
        if ($PSVersionTable.PSEdition -eq 'Desktop')
        {
            Write-Warning -Message 'Add-IMMyProfilePicture is not currently supported on Windows Powershell, please use Powershell Core on Windows instead.'
            break
        }
    }

    PROCESS
    {
            $FileInfo = Get-Item -Path $FilePath.FullName
            $Uri = "$($ImmichSession.ApiUri)/user/profile-image"
            $Header = @{
                'Accept'    = 'application/json'
                'x-api-key' = ConvertFromSecureString -SecureString $ImmichSession.AccessToken
            }
            $Form = @{}
            $Form += @{
                file      = $FileInfo
            }
            $Result = Invoke-WebRequest -Uri $Uri -Method Post -Headers $Header -Form $Form -ContentType 'multipart/form-data'
            $Result.Content | ConvertFrom-Json
    }
}
#EndRegion './Public/User/Add-IMMyProfilePicture.ps1' 55
#Region './Public/User/Get-IMUser.ps1' -1

function Get-IMUser
{
    <#
    .DESCRIPTION
        Retreives Immich user
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines a specific user id to be retreived
    .PARAMETER isAll
        ...
    .PARAMETER Me
        Defines that the currently connected users information is retreived.
    .EXAMPLE
        Get-IMUser -id <userid>

        Retreives Immich user
    #>


    [CmdletBinding(DefaultParameterSetName = 'list')]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ParameterSetName = 'id', ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id,

        [Parameter(ParameterSetName = 'list')]
        [boolean]
        $isAll,

        [Parameter(Mandatory,ParameterSetName = 'me')]
        [switch]
        $Me
    )

    BEGIN
    {
        if ($PSCmdlet.ParameterSetName -eq 'list')
        {
            $QueryParameters = @{}
            $QueryParameters += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'isAll')
        }
    }

    PROCESS
    {
        switch ($PSCmdlet.ParameterSetName)
        {
            'list'
            {
                InvokeImmichRestMethod -Method Get -RelativePath '/user' -ImmichSession:$Session -QueryParameters $QueryParameters
            }
            'id'
            {
                $id | ForEach-Object {
                    InvokeImmichRestMethod -Method Get -RelativePath "/user/info/$PSItem" -ImmichSession:$Session
                }
            }
            'me' {
                InvokeImmichRestMethod -Method Get -RelativePath '/user/me' -ImmichSession:$Session
            }
        }
    }
}
#endregion
#EndRegion './Public/User/Get-IMUser.ps1' 72
#Region './Public/User/New-IMUser.ps1' -1

function New-IMUser
{
    <#
    .DESCRIPTION
        New Immich user
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER email
        Defines a specific user id to be retreived
    .PARAMETER MemoriesEnabled
        Should Memories enabled. Enabled by default
    .PARAMETER Name
        Defines the name of the user
    .PARAMETER Password
        Defines the password for the user
    .PARAMETER QuotaSizeInBytes
        Defines quota for the user
    .PARAMETER ShouldChangePassword
        Defines that the user must change password on the next login
    .PARAMETER StorageLabel
        Defines the users storage label
    .EXAMPLE
        $Password = Read-Host -Prompt 'Password' -AsSecureString
        New-IMUser -Email 'testuser@domain.com' -Name 'Test User' -Password $Password

        Creates new Immich user
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions','', Justification='FP')]
    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory)]
        [string]
        $Email,

        [Parameter()]
        [boolean]
        $MemoriesEnabled = $true,

        [Parameter(Mandatory)]
        [string]
        $Name,

        [Parameter(Mandatory)]
        [securestring]
        $Password,

        [Parameter()]
        [int64]
        $QuotaSizeInBytes,

        [Parameter()]
        [boolean]
        $ShouldChangePassword,

        [Parameter()]
        [string]
        $StorageLabel
    )

    $Body = @{}
    $Body += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'Email', 'MemoriesEnabled', 'Name', 'Password', 'QuotaSizeInBytes', 'ShouldChangePassword', 'StorageLabel' -NameMapping @{
            Email                = 'email'
            MemoriesEnabled      = 'memoriesEnabled'
            Name                 = 'name'
            Password             = 'password'
            QuotaSizeInBytes     = 'quotaSizeInBytes'
            ShouldChangePassword = 'shouldChangePassword'
            StorageLabel         = 'storageLabel'
        })

    InvokeImmichRestMethod -Method POST -RelativePath '/user' -ImmichSession:$Session -Body $Body

}
#endregion
#EndRegion './Public/User/New-IMUser.ps1' 81
#Region './Public/User/Remove-IMMyProfilePicture.ps1' -1

function Remove-IMMyProfilePicture
{
    <#
    .DESCRIPTION
        Remove the profile picture of the connected user
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .EXAMPLE
        Remove-IMMyProfilePicture

        Remove the profile picture of the connected user
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null
    )

    if ($PSCmdlet.ShouldProcess('Remove profile picture')) {
        InvokeImmichRestMethod -Method DELETE -RelativePath '/user/profile-image' -ImmichSession:$Session
    }

}
#endregion
#EndRegion './Public/User/Remove-IMMyProfilePicture.ps1' 29
#Region './Public/User/Remove-IMUser.ps1' -1

function Remove-IMUser
{
    <#
    .DESCRIPTION
        Remove Immich user
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines the user id to update
    .PARAMETER force
        Defines that the user should be removed immediatly. By default the user remains in trash for 7 days before assets are removed.
    .EXAMPLE
        Remove-IMUser -id <userid> -force

        Remove Immich user
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id,

        [Parameter()]
        [switch]
        $Force
    )

    BEGIN
    {
        $Body = @{}
        $Body += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'Force' -NameMapping @{
                Force = 'force'
            })
    }

    PROCESS
    {
        $id | ForEach-Object {
            if ($PSCmdlet.ShouldProcess($PSItem, 'DELETE'))
            {
                InvokeImmichRestMethod -Method DELETE -RelativePath "/user/$PSItem" -ImmichSession:$Session -Body $Body
            }
        }
    }

}
#endregion
#EndRegion './Public/User/Remove-IMUser.ps1' 56
#Region './Public/User/Restore-IMUser.ps1' -1

function Restore-IMUser
{
    <#
    .DESCRIPTION
        Restore Immich user
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines the user id to update
    .EXAMPLE
        Restore-IMUser -id <userid>

        Restore Immich user
    #>


    [CmdletBinding()]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id
    )


    PROCESS
    {
        $id | ForEach-Object {
            InvokeImmichRestMethod -Method POST -RelativePath "/user/$PSItem/restore" -ImmichSession:$Session
        }
    }

}
#endregion
#EndRegion './Public/User/Restore-IMUser.ps1' 40
#Region './Public/User/Set-IMUser.ps1' -1

function Set-IMUser
{
    <#
    .DESCRIPTION
        Set Immich user
    .PARAMETER Session
        Optionally define a immich session object to use. This is useful when you are connected to more than one immich instance.

        -Session $Session
    .PARAMETER id
        Defines the user id to update
    .PARAMETER IsAdmin
        Defines if the user should be admin
    .PARAMETER AvatarColor
        Defines the avatar color for the user
    .PARAMETER email
        Defines a specific user id to be retreived
    .PARAMETER MemoriesEnabled
        Should Memories enabled. Enabled by default
    .PARAMETER Name
        Defines the name of the user
    .PARAMETER Password
        Defines the password for the user
    .PARAMETER QuotaSizeInBytes
        Defines quota for the user
    .PARAMETER ShouldChangePassword
        Defines that the user must change password on the next login
    .PARAMETER StorageLabel
        Defines the users storage label
    .EXAMPLE
        Set-IMUser -id <userid> -Name 'John Smith'

        Set Immich user
    #>


    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter()]
        [ImmichSession]
        $Session = $null,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)]
        [ValidatePattern('^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$')]
        [string[]]
        $id,

        [Parameter()]
        [string]
        $Email,

        [Parameter()]
        [ValidateSet('primary', 'pink', 'red', 'yellow', 'blue', 'green', 'purple', 'orange', 'gray', 'amber')]
        [string]
        $AvatarColor,

        [Parameter()]
        [boolean]
        $MemoriesEnabled = $true,

        [Parameter()]
        [string]
        $Name,

        [Parameter()]
        [securestring]
        $Password,

        [Parameter()]
        [int64]
        $QuotaSizeInBytes,

        [Parameter()]
        [boolean]
        $ShouldChangePassword,

        [Parameter()]
        [string]
        $StorageLabel,

        [Parameter()]
        [boolean]
        $IsAdmin
    )

    BEGIN
    {
        $Body = @{}
        $Body += (SelectBinding -Binding $PSBoundParameters -SelectProperty 'IsAdmin', 'AvatarColor', 'Email', 'MemoriesEnabled', 'Name', 'Password', 'QuotaSizeInBytes', 'ShouldChangePassword', 'StorageLabel' -NameMapping @{
                Email                = 'email'
                MemoriesEnabled      = 'memoriesEnabled'
                Name                 = 'name'
                Password             = 'password'
                QuotaSizeInBytes     = 'quotaSizeInBytes'
                ShouldChangePassword = 'shouldChangePassword'
                StorageLabel         = 'storageLabel'
                AvatarColor          = 'avatarColor'
                IsAdmin              = 'isAdmin'
            })
    }

    PROCESS
    {
        $id | ForEach-Object {
            if ($PSCmdlet.ShouldProcess($PSItem,'Set')) {
                $Body.id = $PSItem
                InvokeImmichRestMethod -Method PUT -RelativePath '/user' -ImmichSession:$Session -Body $Body
            }
        }
    }

}
#endregion
#EndRegion './Public/User/Set-IMUser.ps1' 113
#Region './suffix.ps1' -1

# The content of this file will be appended to the top of the psm1 module file. This is useful for custom procesedures after all module functions are loaded.
#EndRegion './suffix.ps1' 2