internal/functions/Register-Workflow.ps1

function Register-Workflow
{
<#
    .SYNOPSIS
        Register workflows for presentation to users.
     
    .DESCRIPTION
        Register workflows for presentation to users.
        Unly used during import of the module within workflows.ps1.
     
    .PARAMETER Name
        The name of the set.
     
    .PARAMETER Commands
        List of commands associated with the workflow.
     
    .PARAMETER Scopes
        The graph scopes associated with this workflow.
        For delegate permissions.
     
    .PARAMETER ApplicationScopes
        The application scopes associated with this workflow.
        For application permissions.
     
    .PARAMETER Services
        What services are in use for this workflow.
        Graph, GraphBeta, ExchangeOnline, ...
     
    .PARAMETER Description
        A description for the workflow.
     
    .EXAMPLE
        PS C:\> Register-Workflow -Name TeamsExport -Scopes 'Chat.Read' -ApplicationScopes 'Chat.Read.All' -Services 'GraphBeta' -Description 'Exporting Teams data' -Commands 'Connect-C365Graph', 'Get-C365TeamsMessage', 'Get-C365TeamsAttachment'
     
        Registers the workflow "TeamsExport" with the specified settings.
#>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [string]
        $Name,
        
        [Parameter(Mandatory = $true)]
        [string[]]
        $Commands,
        
        [string[]]
        $Scopes = @(),
        
        [string[]]
        $ApplicationScopes = @(),
        
        [Parameter(Mandatory = $true)]
        [string[]]
        $Services,
        
        [Parameter(Mandatory = $true)]
        [string]
        $Description
    )
    
    process
    {
        $script:workflow_definitions[$Name] = [pscustomobject]@{
            PSTypeName  = 'Compliance365.Workflow'
            Name        = $Name
            Commands    = $Commands
            Scopes        = $Scopes
            AppScopes   = $ApplicationScopes
            Services    = $Services
            Description = $Description
        }
    }
}