reminder-escalations/src/PSSailpoint.ReminderEscalations/Api/ReminderEscalationsApi.ps1

#
# SailPoint Identity Security API - Reminder Escalations
# Use these APIs to interact with the SailPoint Identity Security platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs.
# Version: v1
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

Create Reminder Escalation Tenant Config

.DESCRIPTION

Creates the default reminder and escalation ruleset for a domain object type in the authenticated tenant. A tenant has one default per domain object type. Creating the same type again returns 409.

.PARAMETER XSailPointExperimental
Use this header to enable this experimental API.

.PARAMETER Reminderescalationtenantconfigcreate
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

Reminderescalationtenantconfig
#>

function New-ReminderEscalationTenantConfigV1 {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        $XSailPointExperimental = "true",
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [PSCustomObject]
        ${Reminderescalationtenantconfigcreate},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: New-ReminderEscalationTenantConfigV1' | 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 = '/reminder-escalations/v1/config/tenants'

        if (!$XSailPointExperimental) {
            throw "Error! The required parameter `XSailPointExperimental` missing when calling createReminderEscalationTenantConfigV1."
        }
        $LocalVarHeaderParameters['X-SailPoint-Experimental'] = $XSailPointExperimental

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

        if ($LocalVarContentTypes.Contains('application/json-patch+json') -or ($Reminderescalationtenantconfigcreate -is [array])) {
            $LocalVarBodyParameter = $Reminderescalationtenantconfigcreate | ConvertTo-Json -AsArray -Depth 100
        } else {
            $LocalVarBodyParameter = $Reminderescalationtenantconfigcreate | 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-ApiClient -Method 'POST' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "Reminderescalationtenantconfig" `
                                -IsBodyNullable $false

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

<#
.SYNOPSIS

Delete Reminder Escalation Tenant Config

.DESCRIPTION

Deletes the tenant-default ruleset for a domain object type in the authenticated tenant.

.PARAMETER DomainObjectType
Domain object type key.

.PARAMETER XSailPointExperimental
Use this header to enable this experimental API.

.PARAMETER WithHttpInfo

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

.OUTPUTS

None
#>

function Remove-ReminderEscalationTenantConfigV1 {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [ValidateSet("PERSONAL_ACCESS_TOKEN", "CERTIFICATION")]
        [String]
        ${DomainObjectType},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        $XSailPointExperimental = "true",
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Remove-ReminderEscalationTenantConfigV1' | 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 = '/reminder-escalations/v1/config/tenants/{domainObjectType}'
        if (!$DomainObjectType) {
            throw "Error! The required parameter `DomainObjectType` missing when calling deleteReminderEscalationTenantConfigV1."
        }
        $LocalVarUri = $LocalVarUri.replace('{domainObjectType}', [System.Web.HTTPUtility]::UrlEncode($DomainObjectType))

        if (!$XSailPointExperimental) {
            throw "Error! The required parameter `XSailPointExperimental` missing when calling deleteReminderEscalationTenantConfigV1."
        }
        $LocalVarHeaderParameters['X-SailPoint-Experimental'] = $XSailPointExperimental

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

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

<#
.SYNOPSIS

Get Reminder Escalation Tenant Config

.DESCRIPTION

Returns the tenant-default reminder and escalation ruleset for a domain object type in the authenticated tenant.

.PARAMETER DomainObjectType
Domain object type key.

.PARAMETER XSailPointExperimental
Use this header to enable this experimental API.

.PARAMETER WithHttpInfo

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

.OUTPUTS

Reminderescalationtenantconfig
#>

function Get-ReminderEscalationTenantConfigV1 {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [ValidateSet("PERSONAL_ACCESS_TOKEN", "CERTIFICATION")]
        [String]
        ${DomainObjectType},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        $XSailPointExperimental = "true",
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Get-ReminderEscalationTenantConfigV1' | 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 = '/reminder-escalations/v1/config/tenants/{domainObjectType}'
        if (!$DomainObjectType) {
            throw "Error! The required parameter `DomainObjectType` missing when calling getReminderEscalationTenantConfigV1."
        }
        $LocalVarUri = $LocalVarUri.replace('{domainObjectType}', [System.Web.HTTPUtility]::UrlEncode($DomainObjectType))

        if (!$XSailPointExperimental) {
            throw "Error! The required parameter `XSailPointExperimental` missing when calling getReminderEscalationTenantConfigV1."
        }
        $LocalVarHeaderParameters['X-SailPoint-Experimental'] = $XSailPointExperimental

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

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

<#
.SYNOPSIS

Update Reminder Escalation Tenant Config

.DESCRIPTION

Replaces the tenant-default ruleset for a domain object type. Send the `revision` from the latest read. A stale revision returns 409.

.PARAMETER DomainObjectType
Domain object type key.

.PARAMETER XSailPointExperimental
Use this header to enable this experimental API.

.PARAMETER Reminderescalationtenantconfigupdate
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

Reminderescalationtenantconfig
#>

function Send-ReminderEscalationTenantConfigV1 {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [ValidateSet("PERSONAL_ACCESS_TOKEN", "CERTIFICATION")]
        [String]
        ${DomainObjectType},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [String]
        $XSailPointExperimental = "true",
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $false)]
        [PSCustomObject]
        ${Reminderescalationtenantconfigupdate},
        [Switch]
        $WithHttpInfo
    )

    Process {
        'Calling method: Send-ReminderEscalationTenantConfigV1' | 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 = '/reminder-escalations/v1/config/tenants/{domainObjectType}'
        if (!$DomainObjectType) {
            throw "Error! The required parameter `DomainObjectType` missing when calling putReminderEscalationTenantConfigV1."
        }
        $LocalVarUri = $LocalVarUri.replace('{domainObjectType}', [System.Web.HTTPUtility]::UrlEncode($DomainObjectType))

        if (!$XSailPointExperimental) {
            throw "Error! The required parameter `XSailPointExperimental` missing when calling putReminderEscalationTenantConfigV1."
        }
        $LocalVarHeaderParameters['X-SailPoint-Experimental'] = $XSailPointExperimental

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

        if ($LocalVarContentTypes.Contains('application/json-patch+json') -or ($Reminderescalationtenantconfigupdate -is [array])) {
            $LocalVarBodyParameter = $Reminderescalationtenantconfigupdate | ConvertTo-Json -AsArray -Depth 100
        } else {
            $LocalVarBodyParameter = $Reminderescalationtenantconfigupdate | 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-ApiClient -Method 'PUT' `
                                -Uri $LocalVarUri `
                                -Accepts $LocalVarAccepts `
                                -ContentTypes $LocalVarContentTypes `
                                -Body $LocalVarBodyParameter `
                                -HeaderParameters $LocalVarHeaderParameters `
                                -QueryParameters $LocalVarQueryParameters `
                                -FormParameters $LocalVarFormParameters `
                                -CookieParameters $LocalVarCookieParameters `
                                -ReturnType "Reminderescalationtenantconfig" `
                                -IsBodyNullable $false

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