Skip to content

Commit

Permalink
!deploy v2.18.1 - added in fixes for #87, #111, and #53
Browse files Browse the repository at this point in the history
## 2.18.1

* [Issue #87](#87)
  * Added: Additional scopes during Service creation for `Get-GSCourseParticipant` and `Get-GSClassroomUserProfile` to enable pulling of full user profile information. - _Thanks, [@jdstanberry](https://github.com/jdstanberry)!_
* [Issue #111](#111)
  * Added: `DisableReminder` switch parameter to `New-GSCalendarEvent` and `Update-GSCalendarEvent` to remove Reminder inheritance from the calendar the event is on as well as any Reminder overload definitions.
* [Issue #53](#53)
  * Updated: `Get-GSContactList` and `Remove-GSContact` Token retrieval and overall cleanup
* Various/Other
  * Updated: `Get-GSToken` to align parameters more with `New-GoogleService`
  • Loading branch information
scrthq authored Nov 8, 2018
2 parents 11894d8 + 43996eb commit 2baa437
Show file tree
Hide file tree
Showing 10 changed files with 324 additions and 272 deletions.
122 changes: 67 additions & 55 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,76 @@
# Changelog

* [Changelog](#changelog)
* [2.18.0](#2180)
* [2.17.2](#2172)
* [2.17.1](#2171)
* [2.17.0](#2170)
* [2.16.1](#2161)
* [2.16.0](#2160)
* [2.15.4](#2154)
* [2.15.3](#2153)
* [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.18.1](#2181)
* [2.18.0](#2180)
* [2.17.2](#2172)
* [2.17.1](#2171)
* [2.17.0](#2170)
* [2.16.1](#2161)
* [2.16.0](#2160)
* [2.15.4](#2154)
* [2.15.3](#2153)
* [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.18.1

* [Issue #87](https://github.com/scrthq/PSGSuite/issues/87)
* Added: Additional scopes during Service creation for `Get-GSCourseParticipant` and `Get-GSClassroomUserProfile` to enable pulling of full user profile information. - _Thanks, [@jdstanberry](https://github.com/jdstanberry)!_
* [Issue #111](https://github.com/scrthq/PSGSuite/issues/111)
* Added: `DisableReminder` switch parameter to `New-GSCalendarEvent` and `Update-GSCalendarEvent` to remove Reminder inheritance from the calendar the event is on as well as any Reminder overload definitions.
* [Issue #53](https://github.com/scrthq/PSGSuite/issues/53)
* Updated: `Get-GSContactList` and `Remove-GSContact` Token retrieval and overall cleanup
* Various/Other
* Updated: `Get-GSToken` to align parameters more with `New-GoogleService`

## 2.18.0

* [Issue #87](https://github.com/scrthq/PSGSuite/issues/87)
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.18.0'
ModuleVersion = '2.18.1'

# ID used to uniquely identify this module
GUID = '9d751152-e83e-40bb-a6db-4c329092aaec'
Expand Down
15 changes: 10 additions & 5 deletions PSGSuite/Public/Authentication/Get-GSToken.ps1
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
function Get-GSToken {
<#
.Synopsis
Gets a Service Account Access Token from Google Apps
Requests an Access Token for REST API authentication. Defaults to 3600 seconds token expiration time.
.DESCRIPTION
Requests Access Token using Service Account and P12 key file, returns the token directly. Defaults to 3600 seconds token expiration time.
Requests an Access Token for REST API authentication. Defaults to 3600 seconds token expiration time.
.EXAMPLE
$token = Get-GSToken -P12KeyPath "C:\PSGoogle.p12" -Scopes "https://www.googleapis.com/auth/admin.directory.user" -AppEmail "psg@nf.iam.gserviceaccount.com" -AdminEmail "google.admin.account@domain.com"
.EXAMPLE
$token = Get-GSToken
$Token = Get-GSToken -Scopes 'https://www.google.com/m8/feeds' -AdminEmail $User
$headers = @{
Authorization = "Bearer $($Token)"
'GData-Version' = '3.0'
}
#>
Param
(
[parameter(Mandatory = $true)]
[Alias('Scope')]
[ValidateNotNullOrEmpty()]
[string[]]
$Scopes,
Expand Down
126 changes: 69 additions & 57 deletions PSGSuite/Public/Calendar/New-GSCalendarEvent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,65 @@ function New-GSCalendarEvent {
<#
.SYNOPSIS
Creates a new calendar event
.DESCRIPTION
Creates a new calendar event
.PARAMETER Summary
Event summary
.PARAMETER Description
Event description
.PARAMETER User
The primary email or UserID of the user. You can exclude the '@domain.com' to insert the Domain in the config or use the special 'me' to indicate the AdminEmail in the config.
The primary email or UserID of the user. You can exclude the '@domain.com' to insert the Domain in the config or use the special 'me' to indicate the AdminEmail in the config.
Defaults to the AdminEmail in the config.
.PARAMETER CalendarID
The calendar ID of the calendar you would like to list events from.
Defaults to the user's primary calendar.
.PARAMETER AttendeeEmails
The email addresses of the attendees to add.
The email addresses of the attendees to add.
NOTE: This performs simple adds without additional attendee options. If additional options are needed, use the Attendees parameter instead.
.PARAMETER Attendees
The EventAttendee object(s) to add. Use Add-GSEventAttendee with this parameter for best results.
.PARAMETER Location
Event location
.PARAMETER EventColor
Color of the event as seen in Calendar
.PARAMETER DisableReminder
When $true, disables inheritance of the default Reminders from the Calendar the event was created on.
.PARAMETER LocalStartDateTime
Start date and time of the event. Lowest precendence of the three StartDate parameters.
Defaults to the time the function is ran.
.PARAMETER LocalEndDateTime
End date and time of the event. Lowest precendence of the three EndDate parameters.
Defaults to 30 minutes after the time the function is ran.
.PARAMETER StartDate
String representation of the start date. Middle precendence of the three StartDate parameters.
.PARAMETER EndDate
String representation of the end date. Middle precendence of the three EndDate parameters.
.PARAMETER UTCStartDateTime
String representation of the start date in UTC. Highest precendence of the three StartDate parameters.
.PARAMETER UTCEndDateTime
String representation of the end date in UTC. Highest precendence of the three EndDate parameters.
.EXAMPLE
New-GSCalendarEvent "Go to the gym" -StartDate (Get-Date "21:00:00") -EndDate (Get-Date "22:00:00")
Expand Down Expand Up @@ -94,6 +97,9 @@ function New-GSCalendarEvent {
[String]
$EventColor,
[parameter(Mandatory = $false)]
[Switch]
$DisableReminder,
[parameter(Mandatory = $false)]
[DateTime]
$LocalStartDateTime = (Get-Date),
[parameter(Mandatory = $false)]
Expand Down Expand Up @@ -147,53 +153,59 @@ function New-GSCalendarEvent {
Add-GSEventAttendee -Email $_
}
}
foreach ($calId in $CalendarID) {
$body = New-Object 'Google.Apis.Calendar.v3.Data.Event'
if ($Attendees) {
$body.Attendees = [Google.Apis.Calendar.v3.Data.EventAttendee[]]$Attendees
}
foreach ($key in $PSBoundParameters.Keys) {
switch ($key) {
EventColor {
$body.ColorId = $colorHash[$EventColor]
$body = New-Object 'Google.Apis.Calendar.v3.Data.Event'
if ($Attendees) {
$body.Attendees = [Google.Apis.Calendar.v3.Data.EventAttendee[]]$Attendees
}
foreach ($key in $PSBoundParameters.Keys) {
switch ($key) {
EventColor {
$body.ColorId = $colorHash[$EventColor]
}
DisableReminder {
$reminder = New-Object 'Google.Apis.Calendar.v3.Data.Event+RemindersData' -Property @{
UseDefault = (-not $DisableReminder)
}
Default {
if ($body.PSObject.Properties.Name -contains $key) {
$body.$key = $PSBoundParameters[$key]
}
$body.Reminders = $reminder
}
Default {
if ($body.PSObject.Properties.Name -contains $key) {
$body.$key = $PSBoundParameters[$key]
}
}
}
$body.Start = if ($UTCStartDateTime) {
New-Object 'Google.Apis.Calendar.v3.Data.EventDateTime' -Property @{
DateTime = $UTCStartDateTime
}
}
$body.Start = if ($UTCStartDateTime) {
New-Object 'Google.Apis.Calendar.v3.Data.EventDateTime' -Property @{
DateTime = $UTCStartDateTime
}
elseif ($StartDate) {
New-Object 'Google.Apis.Calendar.v3.Data.EventDateTime' -Property @{
Date = (Get-Date $StartDate -Format "yyyy-MM-dd")
}
}
elseif ($StartDate) {
New-Object 'Google.Apis.Calendar.v3.Data.EventDateTime' -Property @{
Date = (Get-Date $StartDate -Format "yyyy-MM-dd")
}
else {
New-Object 'Google.Apis.Calendar.v3.Data.EventDateTime' -Property @{
DateTime = $LocalStartDateTime
}
}
else {
New-Object 'Google.Apis.Calendar.v3.Data.EventDateTime' -Property @{
DateTime = $LocalStartDateTime
}
$body.End = if ($UTCEndDateTime) {
New-Object 'Google.Apis.Calendar.v3.Data.EventDateTime' -Property @{
DateTime = $UTCEndDateTime
}
}
$body.End = if ($UTCEndDateTime) {
New-Object 'Google.Apis.Calendar.v3.Data.EventDateTime' -Property @{
DateTime = $UTCEndDateTime
}
elseif ($EndDate) {
New-Object 'Google.Apis.Calendar.v3.Data.EventDateTime' -Property @{
Date = (Get-Date $EndDate -Format "yyyy-MM-dd")
}
}
elseif ($EndDate) {
New-Object 'Google.Apis.Calendar.v3.Data.EventDateTime' -Property @{
Date = (Get-Date $EndDate -Format "yyyy-MM-dd")
}
else {
New-Object 'Google.Apis.Calendar.v3.Data.EventDateTime' -Property @{
DateTime = $LocalEndDateTime
}
}
else {
New-Object 'Google.Apis.Calendar.v3.Data.EventDateTime' -Property @{
DateTime = $LocalEndDateTime
}
}
foreach ($calId in $CalendarID) {
Write-Verbose "Creating Calendar Event '$($Summary)' on calendar '$calId' for user '$U'"
$request = $service.Events.Insert($body,$calId)
$request.Execute() | Add-Member -MemberType NoteProperty -Name 'User' -Value $U -PassThru | Add-Member -MemberType NoteProperty -Name 'CalendarId' -Value $calId -PassThru
Expand All @@ -209,4 +221,4 @@ function New-GSCalendarEvent {
}
}
}
}
}
Loading

0 comments on commit 2baa437

Please sign in to comment.