Skip to content

Commit

Permalink
v2.33.1 ready for release
Browse files Browse the repository at this point in the history
## 2.33.1 - 2019-10-06

* [Issue #235](#235)
    * Removed: `Name` parameter from `Start-GSDriveFileUpload` as it was unused in the function and doesn
  • Loading branch information
scrthq committed Oct 6, 2019
1 parent 4427363 commit 0a1c343
Show file tree
Hide file tree
Showing 8 changed files with 338 additions and 186 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* [PSGSuite - ChangeLog](#psgsuite---changelog)
* [2.33.1 - 2019-10-06](#2331---2019-10-06)
* [2.33.0 - 2019-09-26](#2330---2019-09-26)
* [2.32.3 - 2019-09-18](#2323---2019-09-18)
* [2.32.2 - 2019-09-15](#2322---2019-09-15)
Expand Down Expand Up @@ -101,6 +102,21 @@

# PSGSuite - ChangeLog

## 2.33.1 - 2019-10-06

* [Issue #235](https://github.com/scrthq/PSGSuite/issues/235)
* Removed: `Name` parameter from `Start-GSDriveFileUpload` as it was unused in the function and doesn't make sense when uploading an array of files.
* [Issue #238](https://github.com/scrthq/PSGSuite/issues/238)
* Added: `Get-GSDataTransfer` to Get/List current Data Transfers
* [Issue #239](https://github.com/scrthq/PSGSuite/issues/239)
* Removed: `Update-GSResource` `Id` parameter as it was non-applicable (duplicate of `ResourceId` and not writable per API docs)
* Cleaned up function help and examples to match changes
* [Issue #240](https://github.com/scrthq/PSGSuite/issues/240)
* Fixed: `Get-GSCalendar` now properly resolves single calendar metadata retrieval and passes List requests to `Get-GSCalendarSubscription` since the `Calendars` service does not support List requests.
* Miscellaneous
* Updated Google .NET SDKs to latest versions
* Cleaned up build.ps1 script

## 2.33.0 - 2019-09-26

* [Issue #236](https://github.com/scrthq/PSGSuite/issues/236)
Expand Down
23 changes: 13 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
<!-- TOC -->

* [Contributing to PSGSuite](#contributing-to-psgsuite)
* [Git and Pull requests](#git-and-pull-requests)
* [Overview](#overview)
* [Step by Step (High-Level)](#step-by-step-high-level)
* [Contributing Guidelines](#contributing-guidelines)
* [Updating the Wiki](#updating-the-wiki)
* [Getting Started](#getting-started)
* [Enabling Debug Mode](#enabling-debug-mode)
* [Google .NET SDK Documentation](#google-net-sdk-documentation)
* [.NET/API Documentation Links](#netapi-documentation-links)
* [Keeping in Touch](#keeping-in-touch)
* [Git and Pull requests](#git-and-pull-requests)
* [Overview](#overview)
* [Step by Step (High-Level)](#step-by-step-high-level)
* [Contributing Guidelines](#contributing-guidelines)
* [Updating the Wiki](#updating-the-wiki)
* [Getting Started](#getting-started)
* [Enabling Debug Mode](#enabling-debug-mode)
* [Google .NET SDK Documentation](#google-net-sdk-documentation)
* [.NET/API Documentation Links](#netapi-documentation-links)
* [Keeping in Touch](#keeping-in-touch)

<!-- /TOC -->

Expand Down Expand Up @@ -129,6 +129,9 @@ Here are some links to the most commonly used SDK's and API's in PSGSuite:
* **Contacts API - To be replaced soon with People API**
* [.NET SDK Documentation](https://developers.google.com/resources/api-libraries/documentation/contacts/v1/csharp/latest/)
* [API Documentation](https://developers.google.com/contacts/v3/reference)
* **Data Transfer API**
* [.NET SDK Documentation](https://developers.google.com/resources/api-libraries/documentation/admin/datatransfer_v1/csharp/latest/)
* [API Documentation](https://developers.google.com/admin-sdk/data-transfer/v1/reference)
* **Drive Activity API v2**
* [.NET SDK Documentation](https://developers.google.com/resources/api-libraries/documentation/driveactivity/v2/csharp/latest/)
* [API Documentation](https://developers.google.com/drive/activity/v2/reference/rest/)
Expand Down
95 changes: 26 additions & 69 deletions PSGSuite/Public/Calendar/Get-GSCalendar.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
function Get-GSCalendar {
<#
.SYNOPSIS
Gets the calendars for a user
Returns metadata for a calendar. If no calendar ID is specified, returns the list of calendar subscriptions via Get-GSCalendarSubscription
.DESCRIPTION
Gets the calendars for a user
Returns metadata for a calendar. If no calendar ID is specified, returns the list of calendar subscriptions via Get-GSCalendarSubscription
.PARAMETER CalendarId
The Id of the calendar you would like to get.
Expand Down Expand Up @@ -49,19 +49,19 @@ function Get-GSCalendar {
https://psgsuite.io/Function%20Help/Calendar/Get-GSCalendar/
.LINK
https://developers.google.com/calendar/v3/reference/calendarList/get
https://developers.google.com/calendar/v3/reference/calendars/get
.LINK
https://developers.google.com/calendar/v3/reference/calendarList/list
#>
[OutputType('Google.Apis.Calendar.v3.Data.CalendarListEntry')]
[OutputType('Google.Apis.Calendar.v3.Data.Calendar')]
[cmdletbinding(DefaultParameterSetName = "List")]
Param
(
[parameter(Mandatory = $true,Position = 0,ParameterSetName = "Get")]
Param (
[parameter(Mandatory,Position = 0,ValueFromPipelineByPropertyName,ParameterSetName = "Get")]
[Alias('Id')]
[String[]]
$CalendarId,
[parameter(Mandatory = $false,ValueFromPipeline = $true,ValueFromPipelineByPropertyName = $true)]
[parameter(ValueFromPipelineByPropertyName)]
[Alias("PrimaryEmail","UserKey","Mail")]
[ValidateNotNullOrEmpty()]
[String[]]
Expand Down Expand Up @@ -89,21 +89,21 @@ function Get-GSCalendar {
$SyncToken
)
Process {
foreach ($U in $User) {
if ($U -ceq 'me') {
$U = $Script:PSGSuite.AdminEmail
}
elseif ($U -notlike "*@*.*") {
$U = "$($U)@$($Script:PSGSuite.Domain)"
}
$serviceParams = @{
Scope = 'https://www.googleapis.com/auth/calendar'
ServiceType = 'Google.Apis.Calendar.v3.CalendarService'
User = $U
}
$service = New-GoogleService @serviceParams
switch ($PSCmdlet.ParameterSetName) {
Get {
switch ($PSCmdlet.ParameterSetName) {
Get {
foreach ($U in $User) {
if ($U -ceq 'me') {
$U = $Script:PSGSuite.AdminEmail
}
elseif ($U -notlike "*@*.*") {
$U = "$($U)@$($Script:PSGSuite.Domain)"
}
$serviceParams = @{
Scope = 'https://www.googleapis.com/auth/calendar'
ServiceType = 'Google.Apis.Calendar.v3.CalendarService'
User = $U
}
$service = New-GoogleService @serviceParams
foreach ($calId in $CalendarId) {
try {
$request = $service.Calendars.Get($calId)
Expand All @@ -120,52 +120,9 @@ function Get-GSCalendar {
}
}
}
List {
try {
$request = $service.Calendars.List()
foreach ($key in $PSBoundParameters.Keys | Where-Object {$_ -ne 'CalendarId'}) {
if ($request.PSObject.Properties.Name -contains $key) {
$request.$key = $PSBoundParameters[$key]
}
}
if ($Limit -gt 0 -and $PageSize -gt $Limit) {
Write-Verbose ("Reducing PageSize from {0} to {1} to meet limit with first page" -f $PageSize,$Limit)
$PageSize = $Limit
}
$request.MaxResults = $PageSize
Write-Verbose "Getting Calendars for user '$U'"
[int]$i = 1
$overLimit = $false
do {
$result = $request.Execute()
$result.Items | Add-Member -MemberType NoteProperty -Name 'User' -Value $U -PassThru
if ($result.NextPageToken) {
$request.PageToken = $result.NextPageToken
}
[int]$retrieved = ($i + $result.Items.Count) - 1
Write-Verbose "Retrieved $retrieved Calendars..."
if ($Limit -gt 0 -and $retrieved -eq $Limit) {
Write-Verbose "Limit reached: $Limit"
$overLimit = $true
}
elseif ($Limit -gt 0 -and ($retrieved + $PageSize) -gt $Limit) {
$newPS = $Limit - $retrieved
Write-Verbose ("Reducing PageSize from {0} to {1} to meet limit with next page" -f $PageSize,$newPS)
$request.MaxResults = $newPS
}
[int]$i = $i + $result.Items.Count
}
until ($overLimit -or !$result.NextPageToken)
}
catch {
if ($ErrorActionPreference -eq 'Stop') {
$PSCmdlet.ThrowTerminatingError($_)
}
else {
Write-Error $_
}
}
}
}
List {
Get-GSCalendarSubscription @PSBoundParameters
}
}
}
Expand Down
Loading

0 comments on commit 0a1c343

Please sign in to comment.