Skip to content

Commit

Permalink
!deploy v2.15.2 with Gmail additions/improvements
Browse files Browse the repository at this point in the history
## 2.15.2

* [Pull Request #94](#94) **Thanks, [@dwrusse](https://github.com/dwrusse)!**
  * Added `Update-GSGmailLabel` to enable updating of Gmail label properties
  * Added `Update-GSGmailMessageLabel` enable updating of labels attached to Gmail messages
* [Issue #93](#93)
  * Updated `Remove-GSGmailMessage` to include a `-Filter` parameter to allow removal of messages matching a filter in a single command
  * Improved pipeline support for `Remove-GSGmailMessage`
  • Loading branch information
scrthq authored Oct 9, 2018
2 parents 09a70b9 + 4ef79ae commit 7248bc0
Show file tree
Hide file tree
Showing 6 changed files with 434 additions and 83 deletions.
119 changes: 62 additions & 57 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,61 @@
# Changelog

<!-- TOC -->

- [Changelog](#changelog)
- [2.15.1](#2151)
- [2.15.0](#2150)
- [2.14.1](#2141)
- [2.14.0](#2140)
- [2.13.2](#2132)
- [2.13.1](#2131)
- [2.13.0](#2130)
- [2.12.1](#2121)
- [2.12.0](#2120)
- [2.11.0](#2110)
- [2.10.2](#2102)
- [2.10.1](#2101)
- [2.10.0](#2100)
- [2.9.0](#290)
- [2.8.1](#281)
- [2.8.0](#280)
- [2.7.2](#272)
- [2.7.1](#271)
- [2.7.0](#270)
- [2.6.3](#263)
- [2.6.2](#262)
- [2.6.1](#261)
- [2.6.0](#260)
- [2.5.4](#254)
- [2.5.3](#253)
- [2.5.2](#252)
- [2.5.1](#251)
- [2.5.0](#250)
- [2.4.0](#240)
- [2.3.0](#230)
- [2.2.1](#221)
- [2.2.0](#220)
- [2.1.5](#215)
- [2.1.3 / 2.1.4](#213--214)
- [2.1.2](#212)
- [2.1.1](#211)
- [2.1.0](#210)
- [2.0.3](#203)
- [2.0.2](#202)
- [2.0.1](#201)
- [2.0.0](#200)
- [New Functionality](#new-functionality)
- [Breaking Changes in 2.0.0](#breaking-changes-in-200)
- [Gmail Delegation Management Removed](#gmail-delegation-management-removed)
- [Functions Removed](#functions-removed)
- [Functions Aliased](#functions-aliased)

<!-- /TOC -->
# Changelog <!-- omit in toc -->

* [2.15.2](#2152)
* [2.15.1](#2151)
* [2.15.0](#2150)
* [2.14.1](#2141)
* [2.14.0](#2140)
* [2.13.2](#2132)
* [2.13.1](#2131)
* [2.13.0](#2130)
* [2.12.1](#2121)
* [2.12.0](#2120)
* [2.11.0](#2110)
* [2.10.2](#2102)
* [2.10.1](#2101)
* [2.10.0](#2100)
* [2.9.0](#290)
* [2.8.1](#281)
* [2.8.0](#280)
* [2.7.2](#272)
* [2.7.1](#271)
* [2.7.0](#270)
* [2.6.3](#263)
* [2.6.2](#262)
* [2.6.1](#261)
* [2.6.0](#260)
* [2.5.4](#254)
* [2.5.3](#253)
* [2.5.2](#252)
* [2.5.1](#251)
* [2.5.0](#250)
* [2.4.0](#240)
* [2.3.0](#230)
* [2.2.1](#221)
* [2.2.0](#220)
* [2.1.5](#215)
* [2.1.3 / 2.1.4](#213--214)
* [2.1.2](#212)
* [2.1.1](#211)
* [2.1.0](#210)
* [2.0.3](#203)
* [2.0.2](#202)
* [2.0.1](#201)
* [2.0.0](#200)
* [New Functionality](#new-functionality)
* [Breaking Changes in 2.0.0](#breaking-changes-in-200)
* [Gmail Delegation Management Removed](#gmail-delegation-management-removed)
* [Functions Removed](#functions-removed)
* [Functions Aliased](#functions-aliased)

## 2.15.2

* [Pull Request #94](https://github.com/scrthq/PSGSuite/pull/94) **Thanks, [@dwrusse](https://github.com/dwrusse)!**
* Added `Update-GSGmailLabel` to enable updating of Gmail label properties
* Added `Update-GSGmailMessageLabel` enable updating of labels attached to Gmail messages
* [Issue #93](https://github.com/scrthq/PSGSuite/issues/93)
* Updated `Remove-GSGmailMessage` to include a `-Filter` parameter to allow removal of messages matching a filter in a single command
* Improved pipeline support for `Remove-GSGmailMessage`

## 2.15.1

Expand All @@ -62,10 +67,10 @@

## 2.15.0

- Updated Gmail Delegation functions to use the .NET SDK after Google announced delegation support for the Gmail API
- Cleaned up `Get-GSGmailDelegates` by removing the trailing `s` (now `Get-GSGmailDelegate`). Added the original function as an alias to the new function for backwards compatibility with scripts.
- Removed the `Raw` parameter from `Get-GSGmailDelegate` since it's no longer applicable.
- Enabled `Get-GSGmailDelegate` to perform both Get and List requests (previously only performed List requests)
* Updated Gmail Delegation functions to use the .NET SDK after Google announced delegation support for the Gmail API
* Cleaned up `Get-GSGmailDelegates` by removing the trailing `s` (now `Get-GSGmailDelegate`). Added the original function as an alias to the new function for backwards compatibility with scripts.
* Removed the `Raw` parameter from `Get-GSGmailDelegate` since it's no longer applicable.
* Enabled `Get-GSGmailDelegate` to perform both Get and List requests (previously only performed List requests)

## 2.14.1

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.15.1'
ModuleVersion = '2.15.2'

# ID used to uniquely identify this module
GUID = '9d751152-e83e-40bb-a6db-4c329092aaec'
Expand Down
55 changes: 34 additions & 21 deletions PSGSuite/Public/Gmail/Remove-GSGmailMessage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ function Remove-GSGmailMessage {
<#
.SYNOPSIS
Removes a Gmail message from the user
.DESCRIPTION
Removes a Gmail message from the user
.PARAMETER User
The primary email of the user to remove the message from
Defaults to the AdminEmail user
.PARAMETER Id
The Id of the message to remove
.PARAMETER Filter
The Gmail query to pull the list of messages to remove instead of passing the MessageId directly
.PARAMETER Method
The method used to delete the message
Expand All @@ -22,29 +20,38 @@ function Remove-GSGmailMessage {
* "Delete": permanently deletes the message (NON-RECOVERABLE!)
Default value is 'Trash'
.PARAMETER User
The primary email of the user to remove the message from
Defaults to the AdminEmail user
.EXAMPLE
Remove-GSGmailMessage -User joe -Id 161622d7b76b7e1e,1616227c34d435f2
Moves the 2 message Id's from Joe's inbox into their TRASH after confirmation
#>
[cmdletbinding(SupportsShouldProcess = $true,ConfirmImpact = "High")]
[cmdletbinding(SupportsShouldProcess = $true,ConfirmImpact = "High",DefaultParameterSetName = "MessageId")]
Param
(
[parameter(Mandatory = $false,ValueFromPipelineByPropertyName = $true)]
[Alias("PrimaryEmail","UserKey","Mail")]
[string]
$User = $Script:PSGSuite.AdminEmail,
[parameter(Mandatory = $true,ValueFromPipelineByPropertyName = $true)]
[Alias('MessageID')]
[parameter(Mandatory = $true,ValueFromPipelineByPropertyName = $true,ParameterSetName = "MessageId")]
[Alias('MessageId')]
[String[]]
$Id,
[parameter(Mandatory = $true, ParameterSetName = "Filter")]
[Alias('Query')]
[string]
$Filter,
[parameter(Mandatory = $false)]
[ValidateSet('Trash','Delete')]
[String]
$Method = 'Trash'
$Method = 'Trash',
[parameter(Mandatory = $false,ValueFromPipelineByPropertyName = $true)]
[Alias("PrimaryEmail","UserKey","Mail")]
[string]
$User = $Script:PSGSuite.AdminEmail
)
Begin {
Process {
if ($MyInvocation.InvocationName -eq 'Move-GSGmailMessageToTrash') {
$Method = 'Trash'
}
Expand All @@ -59,11 +66,17 @@ function Remove-GSGmailMessage {
ServiceType = 'Google.Apis.Gmail.v1.GmailService'
User = $User
}
$msgId = switch ($PSCmdlet.ParameterSetName) {
MessageId {
$Id
}
Filter {
(Get-GSGmailMessageList -Filter $Filter -User $User).Id
}
}
$service = New-GoogleService @serviceParams
}
Process {
try {
foreach ($mId in $Id) {
foreach ($mId in $msgId) {
$request = switch ($Method) {
Trash {
$service.Users.Messages.Trash($User,$mId)
Expand Down Expand Up @@ -93,4 +106,4 @@ function Remove-GSGmailMessage {
}
}
}
}
}
Loading

0 comments on commit 7248bc0

Please sign in to comment.