nerm/src/PSSailpoint.NERM/Api/NERMWorkflowSessionsApi.ps1

#
# NERM API
# The NERM API accesss and modifies resources in your environment.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

Find workflow session

.DESCRIPTION

Find workflow session by id

.PARAMETER Id
ID of the object to retrieve, update, or delete

.PARAMETER WithHttpInfo

A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response

.OUTPUTS

SubmitWorkflowSession200Response
#>

function Get-NERMWorkflowSession {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${Id},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Get-NERMWorkflowSession' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $LocalVarAccepts = @()
        $LocalVarContentTypes = @()
        $LocalVarQueryParameters = @{}
        $LocalVarHeaderParameters = @{}
        $LocalVarFormParameters = @{}
        $LocalVarPathParameters = @{}
        $LocalVarCookieParameters = @{}
        $LocalVarBodyParameter = $null

        # HTTP header 'Accept' (if needed)
        $LocalVarAccepts = @('application/json')

        $LocalVarUri = '/workflow_sessions/{id}'
        if (!$Id) {
            throw "Error! The required parameter `Id` missing when calling getWorkflowSession."
        }
        $LocalVarUri = $LocalVarUri.replace('{id}', [System.Web.HTTPUtility]::UrlEncode($Id))



        $LocalVarResult = Invoke-NERMApiClient -Method 'GET' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "SubmitWorkflowSession200Response" `
                                -IsBodyNullable $false

        if ($WithHttpInfo.IsPresent) {
            return $LocalVarResult
        } else {
            return $LocalVarResult["Response"]
        }
    }
}

<#
.SYNOPSIS

Retrieves workflow session attachment URL

.DESCRIPTION

Retrieves the URL of an attachment attribute value from a workflow session

.PARAMETER Id
ID of the object to retrieve, update, or delete

.PARAMETER AttributeId
The id of the attachment attribute

.PARAMETER WithHttpInfo

A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response

.OUTPUTS

Url
#>

function Get-NERMWorkflowSessionUpload {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${Id},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${AttributeId},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Get-NERMWorkflowSessionUpload' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $LocalVarAccepts = @()
        $LocalVarContentTypes = @()
        $LocalVarQueryParameters = @{}
        $LocalVarHeaderParameters = @{}
        $LocalVarFormParameters = @{}
        $LocalVarPathParameters = @{}
        $LocalVarCookieParameters = @{}
        $LocalVarBodyParameter = $null

        # HTTP header 'Accept' (if needed)
        $LocalVarAccepts = @('application/json')

        $LocalVarUri = '/workflow_sessions/{id}/upload/{attribute_id}'
        if (!$Id) {
            throw "Error! The required parameter `Id` missing when calling getWorkflowSessionUpload."
        }
        $LocalVarUri = $LocalVarUri.replace('{id}', [System.Web.HTTPUtility]::UrlEncode($Id))
        if (!$AttributeId) {
            throw "Error! The required parameter `AttributeId` missing when calling getWorkflowSessionUpload."
        }
        $LocalVarUri = $LocalVarUri.replace('{attribute_id}', [System.Web.HTTPUtility]::UrlEncode($AttributeId))



        $LocalVarResult = Invoke-NERMApiClient -Method 'GET' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "Url" `
                                -IsBodyNullable $false

        if ($WithHttpInfo.IsPresent) {
            return $LocalVarResult
        } else {
            return $LocalVarResult["Response"]
        }
    }
}

<#
.SYNOPSIS

Get workflow sessions

.DESCRIPTION

Get workflow sessions

.PARAMETER Limit
The maximum number of items to return.

.PARAMETER Offset
The number of items to skip before starting to collect the result set.

.PARAMETER Order
The field to order results by.

.PARAMETER ProfileId
Profile ID to filter by

.PARAMETER Uid
UID of the object to retrieve, update, or delete. A UID or ""specified identifier"" is a string typically in ""snake_case"" format that provides a human-readable description of the record. They are commonly used to ensure sandbox, qa, staging and production tenants have the identical configuration items loaded. Every record has a UID assigned when persisted. When not specified the system assigns one by default. A default value looks like a 32 character string of random hexadecimal characters.

.PARAMETER WorkflowId
Workflow ID for filtering

.PARAMETER RequesterId
Requester ID for filtering

.PARAMETER Status
filter by workflow session status

.PARAMETER Metadata
Returns batching metadata in the response. This includes `total` as the total quantity, `next` as the path of the following query url, `limit` and `after_id` (if requested) with the next following id (null if it is the last ""page"").

.PARAMETER WithHttpInfo

A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response

.OUTPUTS

GetWorkflowSessions200Response
#>

function Get-NERMWorkflowSessions {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [System.Nullable[Int32]]
        ${Limit},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [System.Nullable[Int32]]
        ${Offset},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${Order},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${ProfileId},
        [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${Uid},
        [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${WorkflowId},
        [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${RequesterId},
        [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [ValidateSet("waiting on workflow", "identity proofing completed", "new", "closing", "pending request", "requested", "pending approval", "approved", "pending notification", "notified", "pending review", "reviewed", "pending trigger", "stored procedure", "pending status change", "status changed", "pending update", "non employee updated", "non employee created", "pending creation", "rejected", "pending assignment", "assigned", "default", "failed", "un assigned", "auto assigned", "ldap provided", "pending ldap", "pending fulfillment", "pending stored procedure", "pending courion add", "fulfilled", "pending courion update", "courion add", "pending courion_extend", "courion update", "pending courion terminate", "courion extend", "pending profile select", "courion terminate", "batch completed", "profiles selected", "answered questions", "pending questions", "attempting to start workflow", "started workflow", "profile check complete", "completed", "processing", "pending set attribute", "invitation sent", "action skipped", "api request sent", "attribute set", "disabled", "duplicates resolved", "soap request sent", "checking for duplicates", "pending identity proofing", "closed", "workflow changed")]
        [String]
        ${Status},
        [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [System.Nullable[Boolean]]
        ${Metadata},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Get-NERMWorkflowSessions' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $LocalVarAccepts = @()
        $LocalVarContentTypes = @()
        $LocalVarQueryParameters = @{}
        $LocalVarHeaderParameters = @{}
        $LocalVarFormParameters = @{}
        $LocalVarPathParameters = @{}
        $LocalVarCookieParameters = @{}
        $LocalVarBodyParameter = $null

        # HTTP header 'Accept' (if needed)
        $LocalVarAccepts = @('application/json')

        $LocalVarUri = '/workflow_sessions'
        if (!$Uid) {
            throw "Error! The required parameter `Uid` missing when calling getWorkflowSessions."
        }
        $LocalVarUri = $LocalVarUri.replace('{uid}', [System.Web.HTTPUtility]::UrlEncode($Uid))

        if ($Limit) {
            $LocalVarQueryParameters['limit'] = $Limit
        }

        if ($Offset) {
            $LocalVarQueryParameters['offset'] = $Offset
        }

        if ($Order) {
            $LocalVarQueryParameters['order'] = $Order
        }

        if ($ProfileId) {
            $LocalVarQueryParameters['profile_id'] = $ProfileId
        }

        if ($WorkflowId) {
            $LocalVarQueryParameters['workflow_id'] = $WorkflowId
        }

        if ($RequesterId) {
            $LocalVarQueryParameters['requester_id'] = $RequesterId
        }

        if ($Status) {
            $LocalVarQueryParameters['status'] = $Status
        }

        if ($Metadata) {
            $LocalVarQueryParameters['metadata'] = $Metadata
        }



        $LocalVarResult = Invoke-NERMApiClient -Method 'GET' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "GetWorkflowSessions200Response" `
                                -IsBodyNullable $false

        if ($WithHttpInfo.IsPresent) {
            return $LocalVarResult
        } else {
            return $LocalVarResult["Response"]
        }
    }
}

<#
.SYNOPSIS

Update a workflow session

.DESCRIPTION

Update a workflow session by id

.PARAMETER Id
ID of the object to retrieve, update, or delete

.PARAMETER SubmitWorkflowSessionRequest
No description available.

.PARAMETER Run
Will run the created/updated workflow session if successful

.PARAMETER WithHttpInfo

A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response

.OUTPUTS

SubmitWorkflowSession200Response
#>

function Update-NERMWorkflowSession {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${Id},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [PSCustomObject]
        ${SubmitWorkflowSessionRequest},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [System.Nullable[Boolean]]
        ${Run},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Update-NERMWorkflowSession' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $LocalVarAccepts = @()
        $LocalVarContentTypes = @()
        $LocalVarQueryParameters = @{}
        $LocalVarHeaderParameters = @{}
        $LocalVarFormParameters = @{}
        $LocalVarPathParameters = @{}
        $LocalVarCookieParameters = @{}
        $LocalVarBodyParameter = $null

        # HTTP header 'Accept' (if needed)
        $LocalVarAccepts = @('application/json')

        # HTTP header 'Content-Type'
        $LocalVarContentTypes = @('application/json')

        $LocalVarUri = '/workflow_sessions/{id}'
        if (!$Id) {
            throw "Error! The required parameter `Id` missing when calling patchWorkflowSession."
        }
        $LocalVarUri = $LocalVarUri.replace('{id}', [System.Web.HTTPUtility]::UrlEncode($Id))

        if ($Run) {
            $LocalVarQueryParameters['run'] = $Run
        }

        if (!$SubmitWorkflowSessionRequest) {
            throw "Error! The required parameter `SubmitWorkflowSessionRequest` missing when calling patchWorkflowSession."
        }

        if ($LocalVarContentTypes.Contains('application/json-patch+json') -or ($SubmitWorkflowSessionRequest -is [array])) {
            $LocalVarBodyParameter = $SubmitWorkflowSessionRequest | ConvertTo-Json -AsArray -Depth 100
        } else {
            $LocalVarBodyParameter = $SubmitWorkflowSessionRequest | ForEach-Object {
            # Get array of names of object properties that can be cast to boolean TRUE
            # PSObject.Properties - https://msdn.microsoft.com/en-us/library/system.management.automation.psobject.properties.aspx
            $NonEmptyProperties = $_.psobject.Properties | Where-Object {$null -ne $_.Value} | Select-Object -ExpandProperty Name
        
            # Convert object to JSON with only non-empty properties
            $_ | Select-Object -Property $NonEmptyProperties | ConvertTo-Json -Depth 100
            }
        }



        $LocalVarResult = Invoke-NERMApiClient -Method 'PATCH' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "SubmitWorkflowSession200Response" `
                                -IsBodyNullable $false

        if ($WithHttpInfo.IsPresent) {
            return $LocalVarResult
        } else {
            return $LocalVarResult["Response"]
        }
    }
}

<#
.SYNOPSIS

Create a workflow session

.DESCRIPTION

Create a workflow session

.PARAMETER SubmitWorkflowSessionRequest
No description available.

.PARAMETER Run
Will run the created/updated workflow session if successful

.PARAMETER WithHttpInfo

A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response

.OUTPUTS

SubmitWorkflowSession200Response
#>

function Submit-NERMWorkflowSession {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [PSCustomObject]
        ${SubmitWorkflowSessionRequest},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [System.Nullable[Boolean]]
        ${Run},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Submit-NERMWorkflowSession' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $LocalVarAccepts = @()
        $LocalVarContentTypes = @()
        $LocalVarQueryParameters = @{}
        $LocalVarHeaderParameters = @{}
        $LocalVarFormParameters = @{}
        $LocalVarPathParameters = @{}
        $LocalVarCookieParameters = @{}
        $LocalVarBodyParameter = $null

        # HTTP header 'Accept' (if needed)
        $LocalVarAccepts = @('application/json')

        # HTTP header 'Content-Type'
        $LocalVarContentTypes = @('application/json')

        $LocalVarUri = '/workflow_sessions'

        if ($Run) {
            $LocalVarQueryParameters['run'] = $Run
        }

        if (!$SubmitWorkflowSessionRequest) {
            throw "Error! The required parameter `SubmitWorkflowSessionRequest` missing when calling submitWorkflowSession."
        }

        if ($LocalVarContentTypes.Contains('application/json-patch+json') -or ($SubmitWorkflowSessionRequest -is [array])) {
            $LocalVarBodyParameter = $SubmitWorkflowSessionRequest | ConvertTo-Json -AsArray -Depth 100
        } else {
            $LocalVarBodyParameter = $SubmitWorkflowSessionRequest | ForEach-Object {
            # Get array of names of object properties that can be cast to boolean TRUE
            # PSObject.Properties - https://msdn.microsoft.com/en-us/library/system.management.automation.psobject.properties.aspx
            $NonEmptyProperties = $_.psobject.Properties | Where-Object {$null -ne $_.Value} | Select-Object -ExpandProperty Name
        
            # Convert object to JSON with only non-empty properties
            $_ | Select-Object -Property $NonEmptyProperties | ConvertTo-Json -Depth 100
            }
        }



        $LocalVarResult = Invoke-NERMApiClient -Method 'POST' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "SubmitWorkflowSession200Response" `
                                -IsBodyNullable $false

        if ($WithHttpInfo.IsPresent) {
            return $LocalVarResult
        } else {
            return $LocalVarResult["Response"]
        }
    }
}

<#
.SYNOPSIS

Uploads workflow session attachment

.DESCRIPTION

Uploads a new attachment attribute value to a workflow session. The upload must be a FORM data type; this is not a JSON API. The upload must include the binary content of the payload under the 'file' named form element. The upload must not attempt to include the file name or its content type as a other form or JSON as parameters. The upload must not attempt to upload the file body as the POST body payload; it has to arrive as a FORM parameter. Do not use a `File/Binary` payload type for the POST operation in your API client.

.PARAMETER Id
ID of the object to retrieve, update, or delete

.PARAMETER AttributeId
The id of the attachment attribute

.PARAMETER File
No description available.

.PARAMETER WithHttpInfo

A switch when turned on will return a hash table of Response, StatusCode and Headers instead of just the Response

.OUTPUTS

Url
#>

function Submit-NERMWorkflowSessionUpload {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${Id},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        ${AttributeId},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [System.IO.FileInfo]
        ${File},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Submit-NERMWorkflowSessionUpload' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $LocalVarAccepts = @()
        $LocalVarContentTypes = @()
        $LocalVarQueryParameters = @{}
        $LocalVarHeaderParameters = @{}
        $LocalVarFormParameters = @{}
        $LocalVarPathParameters = @{}
        $LocalVarCookieParameters = @{}
        $LocalVarBodyParameter = $null

        # HTTP header 'Accept' (if needed)
        $LocalVarAccepts = @('application/json')

        # HTTP header 'Content-Type'
        $LocalVarContentTypes = @('multipart/form-data')

        $LocalVarUri = '/workflow_sessions/{id}/upload/{attribute_id}'
        if (!$Id) {
            throw "Error! The required parameter `Id` missing when calling submitWorkflowSessionUpload."
        }
        $LocalVarUri = $LocalVarUri.replace('{id}', [System.Web.HTTPUtility]::UrlEncode($Id))
        if (!$AttributeId) {
            throw "Error! The required parameter `AttributeId` missing when calling submitWorkflowSessionUpload."
        }
        $LocalVarUri = $LocalVarUri.replace('{attribute_id}', [System.Web.HTTPUtility]::UrlEncode($AttributeId))

        if ($File) {
            $LocalVarFormParameters['file'] = $File | Foreach-Object { [System.IO.FileInfo]$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($_) }
        }



        $LocalVarResult = Invoke-NERMApiClient -Method 'POST' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "Url" `
                                -IsBodyNullable $false

        if ($WithHttpInfo.IsPresent) {
            return $LocalVarResult
        } else {
            return $LocalVarResult["Response"]
        }
    }
}