Skip to content

Commit

Permalink
!deploy v2.26.1 to fix #172,#173,#174
Browse files Browse the repository at this point in the history
## 2.26.1

* [Issue #172](#172)
  * Fixed: `New-GoogleService` now using `New-Object` to prevent `[Google.Apis.Util.Store.FileDataStore]::new()` constructor issues in PowerShell 4.
* [Issue #173](#173)
  * Added: `FolderColorRgb` parameter to `New-GSDriveFile` and `Update-GSDriveFile` to enable setting the color of a folder in Drive - _Thanks, [@WJurecki](https://github.com/WJurecki)!_
* [PR #174](#174) - _Thanks, [@WJurecki](https://github.com/WJurecki)!_
  * Fixed: `Get-GSDriveFileList` filter concatenation so it joins multiple filters with ` and ` instead of just a space ` `.
  • Loading branch information
scrthq authored Apr 7, 2019
2 parents ee93651 + 4dbfb43 commit 1416c90
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 27 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

* [Changelog](#changelog)
* [2.26.1](#2261)
* [2.26.0](#2260)
* [2.25.3](#2253)
* [2.25.2](#2252)
Expand Down Expand Up @@ -82,6 +83,15 @@

***

## 2.26.1

* [Issue #172](https://github.com/scrthq/PSGSuite/issues/172)
* Fixed: `New-GoogleService` now using `New-Object` to prevent `[Google.Apis.Util.Store.FileDataStore]::new()` constructor issues in PowerShell 4.
* [Issue #173](https://github.com/scrthq/PSGSuite/issues/173)
* Added: `FolderColorRgb` parameter to `New-GSDriveFile` and `Update-GSDriveFile` to enable setting the color of a folder in Drive - _Thanks, [@WJurecki](https://github.com/WJurecki)!_
* [PR #174](https://github.com/scrthq/PSGSuite/pull/174) - _Thanks, [@WJurecki](https://github.com/WJurecki)!_
* Fixed: `Get-GSDriveFileList` filter concatenation so it joins multiple filters with ` and ` instead of just a space ` `.

## 2.26.0

* [Issue #169](https://github.com/scrthq/PSGSuite/issues/169)
Expand Down
2 changes: 1 addition & 1 deletion PSGSuite/PSGSuite.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PSGSuite.psm1'

# Version number of this module.
ModuleVersion = '2.26.0'
ModuleVersion = '2.26.1'

# ID used to uniquely identify this module
GUID = '9d751152-e83e-40bb-a6db-4c329092aaec'
Expand Down
2 changes: 1 addition & 1 deletion PSGSuite/Public/Authentication/New-GoogleService.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function New-GoogleService {
[string[]]$ClientSecretsScopes,
$User,
[System.Threading.CancellationToken]::None,
[Google.Apis.Util.Store.FileDataStore]::new($credPath,$true),
$(New-Object 'Google.Apis.Util.Store.FileDataStore' -ArgumentList $credPath,$true),
$(if ($PSVersionTable.PSVersion.Major -gt 5) {
New-Object 'Google.Apis.Auth.OAuth2.PromptCodeReceiver'
}
Expand Down
11 changes: 6 additions & 5 deletions PSGSuite/Public/Drive/Get-GSDriveFileList.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ function Get-GSDriveFileList {
if ($Filter) {
$Filter += "'$ParentFolderId' in parents"
$PSBoundParameters['Filter'] += "'$ParentFolderId' in parents"
}
else {
$Filter = @("'$ParentFolderId' in parents")
$PSBoundParameters['Filter'] = @("'$ParentFolderId' in parents")
Expand Down Expand Up @@ -119,8 +120,8 @@ function Get-GSDriveFileList {
foreach ($key in $PSBoundParameters.Keys) {
switch ($key) {
Filter {
$FilterFmt = $PSBoundParameters[$key] -replace " -eq ","=" -replace " -like ",":" -replace " -match ",":" -replace " -contains ",":" -creplace "'True'","True" -creplace "'False'","False" -replace " -in "," in " -replace " -le ",'<=' -replace " -ge ",">=" -replace " -gt ",'>' -replace " -lt ",'<' -replace " -ne ","!=" -replace " -and "," and " -replace " -or "," or " -replace " -not "," not "
$request.Q = $($FilterFmt -join " and ")
$FilterFmt = ($PSBoundParameters[$key] -join " and ") -replace " -eq ","=" -replace " -like ",":" -replace " -match ",":" -replace " -contains ",":" -creplace "'True'","True" -creplace "'False'","False" -replace " -in "," in " -replace " -le ",'<=' -replace " -ge ",">=" -replace " -gt ",'>' -replace " -lt ",'<' -replace " -ne ","!=" -replace " -and "," and " -replace " -or "," or " -replace " -not "," not "
$request.Q = $FilterFmt
}
Spaces {
$request.$key = $($PSBoundParameters[$key] -join ",")
Expand All @@ -132,11 +133,11 @@ function Get-GSDriveFileList {
}
}
}
if ($Filter) {
Write-Verbose "Getting all Drive Files matching filter '$Filter' for user '$User'"
if ($FilterFmt) {
Write-Verbose "Getting all Drive Files for User '$User' matching Filter: $FilterFmt"
}
else {
Write-Verbose "Getting all Drive Files for user '$User'"
Write-Verbose "Getting all Drive Files for User '$User'"
}
[int]$i = 1
do {
Expand Down
71 changes: 71 additions & 0 deletions PSGSuite/Public/Drive/New-GSDriveFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,38 @@ function New-GSDriveFile {
.PARAMETER Name
The name of the new Drive file
.PARAMETER Description
The description of the Drive file
.PARAMETER FolderColorRgb
The color for a folder as an RGB hex string.
Available values are:
* "ChocolateIceCream"
* "OldBrickRed"
* "Cardinal"
* "WildStrawberries"
* "MarsOrange"
* "YellowCab"
* "Spearmint"
* "VernFern"
* "Asparagus"
* "SlimeGreen"
* "DesertSand"
* "Macaroni"
* "SeaFoam"
* "Pool"
* "Denim"
* "RainySky"
* "BlueVelvet"
* "PurpleDino"
* "Mouse"
* "MountainGrey"
* "Earthworm"
* "BubbleGum"
* "PurpleRain"
* "ToyEggplant"
.PARAMETER Parents
The parent folder Id of the new Drive file
Expand Down Expand Up @@ -69,6 +101,13 @@ function New-GSDriveFile {
[String]
$Name,
[parameter(Mandatory = $false)]
[String]
$Description,
[parameter(Mandatory = $false)]
[ValidateSet('ChocolateIceCream','OldBrickRed','Cardinal','WildStrawberries','MarsOrange','YellowCab','Spearmint','VernFern','Asparagus','SlimeGreen','DesertSand','Macaroni','SeaFoam','Pool','Denim','RainySky','BlueVelvet','PurpleDino','Mouse','MountainGrey','Earthworm','BubbleGum','PurpleRain','ToyEggplant')]
[string]
$FolderColorRgb,
[parameter(Mandatory = $false)]
[Alias('ParentId')]
[String[]]
$Parents,
Expand All @@ -91,6 +130,32 @@ function New-GSDriveFile {
$Fields
)
Begin {
$colorDictionary = @{
ChocolateIceCream = '#ac725e'
OldBrickRed = '#d06b64'
Cardinal = '#f83a22'
WildStrawberries = '#fa573c'
MarsOrange = '#ff7537'
YellowCab = '#ffad46'
Spearmint = '#42d692'
VernFern = '#16a765'
Asparagus = '#7bd148'
SlimeGreen = '#b3dc6c'
DesertSand = '#fbe983'
Macaroni = '#fad165'
SeaFoam = '#92e1c0'
Pool = '#9fe1e7'
Denim = '#9fc6e7'
RainySky = '#4986e7'
BlueVelvet = '#9a9cff'
PurpleDino = '#b99aff'
Mouse = '#8f8f8f'
MountainGrey = '#cabdbf'
Earthworm = '#cca6ac'
BubbleGum = '#f691b2'
PurpleRain = '#cd74e6'
ToyEggplant = '#a47ae2'
}
$mimeHash = @{
Audio = "application/vnd.google-apps.audio"
Docs = "application/vnd.google-apps.document"
Expand Down Expand Up @@ -146,6 +211,12 @@ function New-GSDriveFile {
elseif ($CustomMimeType) {
$body.MimeType = $CustomMimeType
}
if ($Description) {
$body.Description = $Description
}
if ($FolderColorRgb) {
$body.FolderColorRgb = $ColorDictionary[$FolderColorRgb]
}
if ($Name) {
$body.Name = [String]$Name
}
Expand Down
68 changes: 65 additions & 3 deletions PSGSuite/Public/Drive/Update-GSDriveFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,39 @@ function Update-GSDriveFile {
The path to the local file whose content you would like to upload to Drive.
.PARAMETER Name
The new name of the Drive file
The name of the Drive file
.PARAMETER Description
The new description of the Drive file
The description of the Drive file
.PARAMETER FolderColorRgb
The color for a folder as an RGB hex string.
Available values are:
* "ChocolateIceCream"
* "OldBrickRed"
* "Cardinal"
* "WildStrawberries"
* "MarsOrange"
* "YellowCab"
* "Spearmint"
* "VernFern"
* "Asparagus"
* "SlimeGreen"
* "DesertSand"
* "Macaroni"
* "SeaFoam"
* "Pool"
* "Denim"
* "RainySky"
* "BlueVelvet"
* "PurpleDino"
* "Mouse"
* "MountainGrey"
* "Earthworm"
* "BubbleGum"
* "PurpleRain"
* "ToyEggplant"
.PARAMETER AddParents
The parent Ids to add
Expand Down Expand Up @@ -58,7 +87,7 @@ function Update-GSDriveFile {
[String]
$FileId,
[parameter(Mandatory = $false,Position = 1)]
[ValidateScript({Test-Path $_})]
[ValidateScript( { Test-Path $_ })]
[String]
$Path,
[parameter(Mandatory = $false)]
Expand All @@ -68,6 +97,10 @@ function Update-GSDriveFile {
[String]
$Description,
[parameter(Mandatory = $false)]
[ValidateSet('ChocolateIceCream','OldBrickRed','Cardinal','WildStrawberries','MarsOrange','YellowCab','Spearmint','VernFern','Asparagus','SlimeGreen','DesertSand','Macaroni','SeaFoam','Pool','Denim','RainySky','BlueVelvet','PurpleDino','Mouse','MountainGrey','Earthworm','BubbleGum','PurpleRain','ToyEggplant')]
[string]
$FolderColorRgb,
[parameter(Mandatory = $false)]
[String[]]
$AddParents,
[parameter(Mandatory = $false)]
Expand All @@ -88,6 +121,32 @@ function Update-GSDriveFile {
$User = $Script:PSGSuite.AdminEmail
)
Begin {
$colorDictionary = @{
ChocolateIceCream = '#ac725e'
OldBrickRed = '#d06b64'
Cardinal = '#f83a22'
WildStrawberries = '#fa573c'
MarsOrange = '#ff7537'
YellowCab = '#ffad46'
Spearmint = '#42d692'
VernFern = '#16a765'
Asparagus = '#7bd148'
SlimeGreen = '#b3dc6c'
DesertSand = '#fbe983'
Macaroni = '#fad165'
SeaFoam = '#92e1c0'
Pool = '#9fe1e7'
Denim = '#9fc6e7'
RainySky = '#4986e7'
BlueVelvet = '#9a9cff'
PurpleDino = '#b99aff'
Mouse = '#8f8f8f'
MountainGrey = '#cabdbf'
Earthworm = '#cca6ac'
BubbleGum = '#f691b2'
PurpleRain = '#cd74e6'
ToyEggplant = '#a47ae2'
}
if ($Projection) {
$fs = switch ($Projection) {
Standard {
Expand Down Expand Up @@ -126,6 +185,9 @@ function Update-GSDriveFile {
if ($Description) {
$body.Description = $Description
}
if ($FolderColorRgb) {
$body.FolderColorRgb = $ColorDictionary[$FolderColorRgb]
}
if ($PSBoundParameters.Keys -contains 'Path') {
$ioFile = Get-Item $Path
$contentType = Get-MimeType $ioFile
Expand Down
Binary file modified PSGSuite/lib/net45/Google.Apis.Drive.v3.dll
Binary file not shown.
Binary file modified PSGSuite/lib/netstandard1.3/Google.Apis.Drive.v3.dll
Binary file not shown.
26 changes: 9 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ Update-GSSheetValue Export-GSSheet

[Full CHANGELOG here](https://github.com/scrthq/PSGSuite/blob/master/CHANGELOG.md)

#### 2.26.1

* [Issue #172](https://github.com/scrthq/PSGSuite/issues/172)
* Fixed: `New-GoogleService` now using `New-Object` to prevent `[Google.Apis.Util.Store.FileDataStore]::new()` constructor issues in PowerShell 4.
* [Issue #173](https://github.com/scrthq/PSGSuite/issues/173)
* Added: `FolderColorRgb` parameter to `New-GSDriveFile` and `Update-GSDriveFile` to enable setting the color of a folder in Drive - _Thanks, [@WJurecki](https://github.com/WJurecki)!_
* [PR #174](https://github.com/scrthq/PSGSuite/pull/174) - _Thanks, [@WJurecki](https://github.com/WJurecki)!_
* Fixed: `Get-GSDriveFileList` filter concatenation so it joins multiple filters with ` and ` instead of just a space ` `.

#### 2.26.0

* [Issue #169](https://github.com/scrthq/PSGSuite/issues/169)
Expand All @@ -152,20 +161,3 @@ Update-GSSheetValue Export-GSSheet
* Updated: `New-GSUser` and `Update-GSUser` to add in Location support
* Miscellaneous
* Improved pipeline support for the `User` parameter across all pertinent functions, i.e. Drive, Calendar, Gmail, Sheets & Tasks APIs.

#### 2.25.3

* Miscellaneous
* Added: Pipeline support for `Remove-GSCalendarEvent`

#### 2.25.2

* [Issue #167](https://github.com/scrthq/PSGSuite/issues/167)
* Fixed: `Switch-PSGSuiteConfig -SetToDefault` failing with invalid scope errors

#### 2.25.1

* [PR #165](https://github.com/scrthq/PSGSuite/pull/165) - _Thanks, [@scv-m](https://github.com/scv-m)!_
* Updated: `Get-GSCourseParticipant` now supports pipeline input for CourseId to enable piping `Get-GSCourse` into it.
* [Issue #166](https://github.com/scrthq/PSGSuite/issues/166)
* Fixed: `Update-GSUser` would fail to update user phones due to incorrect variable name in the Process block, effectively skipping it.

0 comments on commit 1416c90

Please sign in to comment.