<commit_before><#
    .SYNOPSIS
       Add a synopsis here to explain the PSScript. 

    .Description
        Give a description of the Script.

#>
Param(

)
$ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop
$CompletedParameters = Write-StartingMessage -CommandName Save-NestThermostatData

$GlobalVars = Get-BatchAutomationVariable -Prefix 'zzGlobal' `
                                          -Name 'WorkspaceId'

$NestVars = Get-BatchAutomationVariable -Prefix 'Nest' `
                                        -Name 'ClientID',
                                              'ClientSecret'

$NestPinCodeCred = Get-AutomationPSCredential -Name Nest-PinCode
$PinCode = $NestPinCodeCred.GetNetworkCredential().Password

Try
{
    $accessToken = Invoke-RestMethod -Method Post -Uri "https://api.home.nest.com/oauth2/access_token?client_id=$($NestVars.ClientID)&code=$($PinCode)&client_secret=$($NestVars.ClientSecret)&grant_type=authorization_code"
    $Devices = Invoke-RestMethod -Uri "https://developer-api.nest.com/devices?auth=$($accessToken.access_token)"
    <commit_msg>custom push<commit_after><#
    .SYNOPSIS
       Add a synopsis here to explain the PSScript. 

    .Description
        Give a description of the Script

#>
Param(

)
$ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop
$CompletedParameters = Write-StartingMessage -CommandName Save-NestThermostatData

$GlobalVars = Get-BatchAutomationVariable -Prefix 'zzGlobal' `
                                          -Name 'WorkspaceId'

$NestVars = Get-BatchAutomationVariable -Prefix 'Nest' `
                                        -Name 'ClientID',
                                              'ClientSecret'

$NestPinCodeCred = Get-AutomationPSCredential -Name Nest-PinCode
$PinCode = $NestPinCodeCred.GetNetworkCredential().Password

Try
{
    $accessToken = Invoke-RestMethod -Method Post -Uri "https://api.home.nest.com/oauth2/access_token?client_id=$($NestVars.ClientID)&code=$($PinCode)&client_secret=$($NestVars.ClientSecret)&grant_type=authorization_code"
    $Devices = Invoke-RestMethod -Uri "https://developer-api.nest.com/devices?auth=$($accessToken.access_token)"
    
{'fraction_non_alphanumeric': 0.1080958842152872, 'fraction_numerical': 0.0009045680687471732, 'mean_word_length': 2.942959001782531, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3217924', 'n_tokens_mistral': 639, 'n_tokens_neox': 628, 'n_words': 109}