PSChipotle.psm1

#Region Add-ObjectDetail

Function Add-ObjectDetail() {
    <#
    .SYNOPSIS
        Decorate an object with
            - A TypeName
            - New properties
            - Default parameters

    .DESCRIPTION
        Helper function to decorate an object with
            - A TypeName
            - New properties
            - Default parameters

    .PARAMETER InputObject
        Object to decorate. Accepts pipeline input.

    .PARAMETER TypeName
        Typename to insert.
        
        This will show up when you use Get-Member against the resulting object.
        
    .PARAMETER PropertyToAdd
        Add these noteproperties.
        
        Format is a hashtable with Key (Property Name) = Value (Property Value).

        Example to add a One and Date property:

            -PropertyToAdd @{
                One = 1
                Date = (Get-Date)
            }

    .PARAMETER DefaultProperties
        Change the default properties that show up

    .PARAMETER Passthru
        Whether to pass the resulting object on. Defaults to true

    .EXAMPLE
        #
        # Create an object to work with
        $Object = [PSCustomObject]@{
            First = 'Cookie'
            Last = 'Monster'
            Account = 'CMonster'
        }

        #Add a type name and a random property
        Add-ObjectDetail -InputObject $Object -TypeName 'ApplicationX.Account' -PropertyToAdd @{ AnotherProperty = 5 }

            # First Last Account AnotherProperty
            # ----- ---- ------- ---------------
            # Cookie Monster CMonster 5

        #Verify that get-member shows us the right type
        $Object | Get-Member

            # TypeName: ApplicationX.Account ...

    .EXAMPLE
        #
        # Create an object to work with
        $Object = [PSCustomObject]@{
            First = 'Cookie'
            Last = 'Monster'
            Account = 'CMonster'
        }

        #Add a random property, set a default property set so we only see two props by default
        Add-ObjectDetail -InputObject $Object -PropertyToAdd @{ AnotherProperty = 5 } -DefaultProperties Account, AnotherProperty

            # Account AnotherProperty
            # ------- ---------------
            # CMonster 5

        #Verify that the other properties are around
        $Object | Select -Property *

            # First Last Account AnotherProperty
            # ----- ---- ------- ---------------
            # Cookie Monster CMonster 5

    .NOTES
        This breaks the 'do one thing' rule from certain perspectives...
        The goal is to decorate an object all in one shot
   
        This abstraction simplifies decorating an object, with a slight trade-off in performance. For example:

        10,000 objects, add a property and typename:
            Add-ObjectDetail: ~4.6 seconds
            Add-Member + PSObject.TypeNames.Insert: ~3 seconds

        Initial code borrowed from Shay Levy:
        http://blogs.microsoft.co.il/scriptfanatic/2012/04/13/custom-objects-default-display-in-powershell-30/
    .LINK
        https://raw.githubusercontent.com/RamblingCookieMonster/PSStash/master/PSStash/Private/Add-ObjectDetail.ps1
    #>

    [CmdletBinding()] 
    Param(
           [Parameter( Mandatory = $false,
                       Position=0,
                       ValueFromPipeline=$true )]
           [PSObject[]]$InputObject,

           [Parameter( Mandatory = $false,
                       Position=1)]
           [System.String] $TypeName,

           [Parameter( Mandatory = $false,
                       Position=2)]    
           [System.Collections.Hashtable] $PropertyToAdd,

           [Parameter( Mandatory = $false,
                       Position=3)]
           [ValidateNotNullOrEmpty()]
           [Alias('dp')]
           [System.String[]] $DefaultProperties,

           [boolean]$PassThru = $True
    )
    
    Begin {
        If ($PSBoundParameters.ContainsKey('DefaultProperties')) {
            # define a subset of properties
            $ddps = New-Object System.Management.Automation.PSPropertySet DefaultDisplayPropertySet,$DefaultProperties
            $PSStandardMembers = [System.Management.Automation.PSMemberInfo[]]$ddps
        }
    }

    Process {
        ForEach ($Object in $InputObject) {
            switch ($PSBoundParameters.Keys) {
                'PropertyToAdd' {
                    ForEach ($Key in $PropertyToAdd.Keys) {
                        #Add some noteproperties. Slightly faster than Add-Member.
                        $Object.PSObject.Properties.Add( ( New-Object PSNoteProperty($Key, $PropertyToAdd[$Key]) ) )  
                    }
                }
                'TypeName' {
                    #Add specified type
                    [void]$Object.PSObject.TypeNames.Insert(0,$TypeName)
                }
                'DefaultProperties' {
                    # Attach default display property set
                    Add-Member -InputObject $Object -MemberType MemberSet -Name PSStandardMembers -Value $PSStandardMembers
                }
            }
            If ($Passthru) {
                $Object
            }
        }
    }
}
#EndRegion Add-ObjectDetail
#Region Get-ChipotleAccount

<#
.SYNOPSIS
    Get Chipotle account information given credentials.
.DESCRIPTION
.EXAMPLE
    Some Syntax Here
.NOTES
    Author: matthewjdegarmo
    GitHub: https://github.com/matthewjdegarmo
#>

Function Get-ChipotleAccount() {
    [CmdletBinding()]
    Param()

    Begin {}

    Process {
        Try {

        } Catch {

        }
    }

    End {}
}
#EndRegion Get-ChipotleAccount
#Region Get-ChipotleMeals

<#
.SYNOPSIS

.DESCRIPTION

.EXAMPLE
    Some Syntax Here
.NOTES
    Author: matthewjdegarmo
    GitHub: https://github.com/matthewjdegarmo
    API IRU: https://lt-services.chipotle.com/menuinnovation/v1/restaurants/{restaurantId}/onlinemeals[?channelId][&includeUnavailableItems]
.LINK
    https://lt-servicesportal.chipotle.com/docs/services/3a753a58f40945adb56ce4b621b9d6f6/operations/GetOnlineMealsByRestaurantId
#>

Function Get-ChipotleMeals() {
    [CmdletBinding()]
    Param()

    Begin {}

    Process {
        Try {

        } Catch {
            Throw $_
        }
    }

    End {}
}
#EndRegion Get-ChipotleMeals
#Region New-ChipotleSession

<#
.SYNOPSIS

.DESCRIPTION

.EXAMPLE
    Some Syntax Here
.NOTES
    Author: matthewjdegarmo
    GitHub: https://github.com/matthewjdegarmo
    See The F5-LTM session for guidance. I like how they handle the scoping of the session.
    https://github.com/joel74/POSH-LTM-Rest/blob/master/F5-LTM/Public/New-F5Session.ps1
    [Microsoft.PowerShell.Commands.WebRequestSession]
#>

Function New-ChipotleSession() {
    [CmdletBinding()]
    Param()

    Begin {}

    Process {
        Try {

        } Catch {
            Throw $_
        }
    }

    End {}
}
#EndRegion New-ChipotleSession