diff --git a/Examples/Get-ZoomInactiveUsers.ps1 b/Examples/Get-ZoomInactiveUsers.ps1 index bede1ea..aa7efff 100644 --- a/Examples/Get-ZoomInactiveUsers.ps1 +++ b/Examples/Get-ZoomInactiveUsers.ps1 @@ -15,12 +15,6 @@ Default is 6 months from current day. .PARAMETER To The end date in 'yyyy-MM-dd' format. Default is the current date. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS .LINK diff --git a/Examples/New-CompanyZoomUser.ps1 b/Examples/New-CompanyZoomUser.ps1 index 309aca7..129e24d 100644 --- a/Examples/New-CompanyZoomUser.ps1 +++ b/Examples/New-CompanyZoomUser.ps1 @@ -75,12 +75,6 @@ with a single host and cannot be modified for these accounts. If the value is set to `true`, the meeting passcode will be encrypted and included in the join meeting link to allow participants to join with just one click without having to enter the passcode. -.PARAMETER ApiKey -The API key. - -.PARAMETER ApiSecret -THe API secret. - .OUTPUTS No output. Can use Passthru switch to pass UserId to output. @@ -225,17 +219,7 @@ function New-CompanyZoomUser { [Parameter(ValueFromPipelineByPropertyName = $True)] [Alias('embed_password_in_join_link')] - [bool]$EmbedPasswordInJoinLink, - - [Parameter(ParameterSetName = 'AdAccount')] - [Parameter(ParameterSetName = 'Manual')] - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [Parameter(ParameterSetName = 'AdAccount')] - [Parameter(ParameterSetName = 'Manual')] - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [bool]$EmbedPasswordInJoinLink ) process { @@ -281,101 +265,89 @@ function New-CompanyZoomUser { 'OfficeeName3' { 'Office 3' } } - $GroupID = ((Get-ZoomGroups) | where-object {$_ -match "$OfficeLocation"}).id + $GroupID = ((Get-ZoomGroups) | where-object { $_ -match "$OfficeLocation" }).id $params.Add('GroupId', $GroupId) - } - - if ($ApiKey) { - $params.Add('ApiKey', $ApiKey) - } - - if ($ApiKey) { - $params.Add('ApiSecret', $ApiSecret) - } - New-CompanyZoomUser @params - } elseif ($PSCmdlet.ParameterSetName -eq 'Manual') { - $creds = @{ - ApiKey = 'ApiKey' - ApiSecret = 'ApiSecret' - } - - if (Get-ZoomUser $Email -ErrorAction SilentlyContinue) { - throw "User already exists in Zoom." + New-CompanyZoomUser @params } + elseif ($PSCmdlet.ParameterSetName -eq 'Manual') { + if (Get-ZoomUser $Email -ErrorAction SilentlyContinue) { + throw "User already exists in Zoom." + } - #Create new user - $defaultNewUserParams = @{ - Action = $Action - Type = $Type - Email = $Email - } + #Create new user + $defaultNewUserParams = @{ + Action = $Action + Type = $Type + Email = $Email + } - function Remove-NonPsBoundParameters { - param ( - $Obj, - $Parameters = $PSBoundParameters - ) + function Remove-NonPsBoundParameters { + param ( + $Obj, + $Parameters = $PSBoundParameters + ) - process { - $NewObj = @{ } + process { + $NewObj = @{ } - foreach ($Key in $Obj.Keys) { - if ($Parameters.ContainsKey($Obj.$Key) -or -not [string]::IsNullOrWhiteSpace($Obj.Key)) { - $Newobj.Add($Key, (get-variable $Obj.$Key).value) + foreach ($Key in $Obj.Keys) { + if ($Parameters.ContainsKey($Obj.$Key) -or -not [string]::IsNullOrWhiteSpace($Obj.Key)) { + $Newobj.Add($Key, (get-variable $Obj.$Key).value) + } } - } - return $NewObj + return $NewObj + } } - } - $newUserParams = @{ - FirstName = 'FirstName' - LastName = 'LastName' - } + $newUserParams = @{ + FirstName = 'FirstName' + LastName = 'LastName' + } - $newUserParams = Remove-NonPsBoundParameters($newUserParams) + $newUserParams = Remove-NonPsBoundParameters($newUserParams) - New-ZoomUser @defaultNewUserParams @newUserParams @creds + New-ZoomUser @defaultNewUserParams @newUserParams @creds - #Update parameters that cant be entered with new user - $updateParams = @{ - UserId = 'Email' - HostKey = 'HostKey' - Pmi = 'Pmi' - Timezone = 'Timezone' - Language = 'Language' - Dept = 'Department' - VanityName = 'VanityName' - UsePmi = 'UsePmi' - } + #Update parameters that cant be entered with new user + $updateParams = @{ + UserId = 'Email' + HostKey = 'HostKey' + Pmi = 'Pmi' + Timezone = 'Timezone' + Language = 'Language' + Dept = 'Department' + VanityName = 'VanityName' + UsePmi = 'UsePmi' + } - $updateParams = Remove-NonPsBoundParameters($updateParams) + $updateParams = Remove-NonPsBoundParameters($updateParams) - Update-ZoomUser @updateParams @creds + Update-ZoomUser @updateParams @creds - #Update Zoom User Meeting Settings - $updateSettingParams = @{ - UserId = 'Email' - RequirePasswordForSchedulingNewMeetings = 'RequirePasswordForSchedulingNewMeetings' - RequirePasswordForPmiMeetings = 'RequirePasswordForPmiMeetings' - EmbedPasswordInJoinLink = 'EmbedPasswordInJoinLink' - } + #Update Zoom User Meeting Settings + $updateSettingParams = @{ + UserId = 'Email' + RequirePasswordForSchedulingNewMeetings = 'RequirePasswordForSchedulingNewMeetings' + RequirePasswordForPmiMeetings = 'RequirePasswordForPmiMeetings' + EmbedPasswordInJoinLink = 'EmbedPasswordInJoinLink' + } - $updateSettingParams = Remove-NonPsBoundParameters($updateSettingParams) + $updateSettingParams = Remove-NonPsBoundParameters($updateSettingParams) - Update-ZoomUserSettings @updateSettingParams @creds - #Add user to group - if ($GroupId) { - Add-ZoomGroupMember -groupid $GroupId -MemberEmail $email @creds - } + Update-ZoomUserSettings @updateSettingParams @creds + #Add user to group + if ($GroupId) { + Add-ZoomGroupMember -groupid $GroupId -MemberEmail $email @creds + } - #Add scheduling permission on behalf of Admin - if ($SchedulingAssistant) { - Add-ZoomUserAssistants -UserId $Email -AssistantEmail $SchedulingAssistant @creds + #Add scheduling permission on behalf of Admin + if ($SchedulingAssistant) { + Add-ZoomUserAssistants -UserId $Email -AssistantEmail $SchedulingAssistant @creds + } } } } -} +} \ No newline at end of file diff --git a/Examples/Sync-ZoomUsersWithAdGroup.ps1 b/Examples/Sync-ZoomUsersWithAdGroup.ps1 index 548c290..4778be1 100644 --- a/Examples/Sync-ZoomUsersWithAdGroup.ps1 +++ b/Examples/Sync-ZoomUsersWithAdGroup.ps1 @@ -30,13 +30,7 @@ $UserExceptions = @( $AdGroups = 'ZoomUsers' $TransferAccount = 'AVAdmin@deathstar.com' -Sync-ZoomUsersWithAdGroup -AdGroups $AdGroups -UserExceptions $UserExceptions -TransferAccount $TransferAccount -ApiKey $ZoomApiKey -ApiSecret $ZoomApiKey -Confirm -Verbose - -.PARAMETER ApiKey -The API key. - -.PARAMETER ApiSecret -The API secret. +Sync-ZoomUsersWithAdGroup -AdGroups $AdGroups -UserExceptions $UserExceptions -TransferAccount $TransferAccount -Confirm -Verbose #> @@ -63,11 +57,7 @@ function Sync-ZoomUsersWithAdGroup() { [switch]$Add = $False, - [switch]$Remove = $False, - - [string]$ApiKey, - - [string]$ApiSecret + [switch]$Remove = $False ) begin { if ($TransferAccount) { @@ -114,11 +104,6 @@ function Sync-ZoomUsersWithAdGroup() { $AdDiff = $AdZoomDiff | Where-Object -Property SideIndicator -eq '<=' | Select-Object -Property 'EmailAddress' - $params = @{ - ApiKey = $ApiKey - ApiSecret = $ApiSecret - } - #Add users to Zoom that are in the $AdGroup and not in $UserExceptions. if ($Add) { Write-Verbose "Adding missing users that are in $AdGroup to Zoom. Skipping users in UserExceptions." diff --git a/PSZoom/PSZoom.psd1 b/PSZoom/PSZoom.psd1 index a35d9c0..d3507ad 100644 --- a/PSZoom/PSZoom.psd1 +++ b/PSZoom/PSZoom.psd1 @@ -13,7 +13,7 @@ # Version number of this module. - ModuleVersion = '1.16.0.0' + ModuleVersion = '2.0.0.0' # Supported PSEditions # CompatiblePSEditions = @() @@ -28,7 +28,7 @@ CompanyName = 'Unknown' # Copyright statement for this module - Copyright = '(c) 2020 Joseph McEvoy. All rights reserved.' + Copyright = '(c) 2022 Joseph McEvoy. All rights reserved.' # Description of the functionality provided by this module Description = 'A collection of Powershell tools to interface with the Zoom Api.' diff --git a/PSZoom/Private/Get-ZoomApiCredentials.ps1 b/PSZoom/Private/Get-ZoomApiCredentials.ps1 deleted file mode 100644 index bcdbaf9..0000000 --- a/PSZoom/Private/Get-ZoomApiCredentials.ps1 +++ /dev/null @@ -1,66 +0,0 @@ -<# - -.SYNOPSIS -Gets a hashtable for a Zoom Api REST body that includes the API key and secret. - -.EXAMPLE -$ZoomApiCredentials = Get-ZoomApiCredentials - -.OUTPUTS -Hashtable - -.LINK -https://marketplace.zoom.us/docs/guides/authorization/jwt/jwt-with-zoom - -.LINK -https://github.com/nickrod518/PowerShell-Scripts/tree/master/Zoom - -#> - -function Get-ZoomApiCredentials { - [CmdletBinding()] - Param ( - [string]$ZoomApiKey, - [string]$ZoomApiSecret - ) - - try { - Write-Verbose -Message 'Retrieving Zoom API Credentials.' - - if (-not $Global:ZoomApiKey) { - if (-not [string]::IsNullOrWhiteSpace($ZoomApiKey)) { - $Global:ZoomApiKey = $ZoomApiKey - } else { - $Global:ZoomApiKey = if ($PSPrivateMetadata.JobId) { - Get-AutomationVariable -Name ZoomApiKey - } - else { - Read-Host 'Enter Zoom Api key (push ctrl + c to exit)' - } - } - } - - if (-not $Global:ZoomApiSecret) { - if (-not [string]::IsNullOrWhiteSpace($ZoomApiSecret)) { - $Global:ZoomApiSecret = $ZoomApiSecret - } else { - $Global:ZoomApiSecret = if ($PSPrivateMetadata.JobId) { - Get-AutomationVariable -Name ZoomApiSecret - } - else { - Read-Host 'Enter Zoom Api Secret (push ctrl + c to exit)' - } - } - } - - @{ - 'ApiKey' = $Global:ZoomApiKey - 'ApiSecret' = $Global:ZoomApiSecret - } - - Write-Verbose 'Retrieved API Credentials.' - } - catch { - Write-Error "Problem getting Zoom Api Authorization variables:`n$_" - } -} diff --git a/PSZoom/Private/New-Jwt.ps1 b/PSZoom/Private/New-Jwt.ps1 deleted file mode 100644 index a4ed418..0000000 --- a/PSZoom/Private/New-Jwt.ps1 +++ /dev/null @@ -1,64 +0,0 @@ -<# - -.DESCRIPTION -Encodes a JWT header, payload and signature. -.EXAMPLE -New-JWT -Algorithm 'HS256' -type 'JWT' -Issuer $api_key -SecretKey $api_secret -ValidforSeconds 30 -.EXAMPLE -$Token = New-JWT -Algorithm 'HS256' -type 'JWT' -Issuer 123 -SecretKey 456 -ValidforSeconds 30 -.LINK -https://marketplace.zoom.us/docs/guides/authorization/jwt/jwt-with-zoom - -#> - -function New-Jwt { - param ( - [Parameter(Mandatory = $True)] - [ValidateSet('HS256', 'HS384', 'HS512')] - [string]$Algorithm, - - $Type = $null, - - [Parameter(Mandatory = $True)] - [string]$Issuer, - - [int]$ValidforSeconds = $null, - - [Parameter(Mandatory = $True)] - [string]$SecretKey - ) - - Write-Verbose 'Generating JWT' - $Exp = [int][double]::parse((Get-Date -Date $((Get-Date).addseconds($ValidforSeconds).ToUniversalTime()) -UFormat %s)) # Grab Unix Epoch Timestamp and add desired expiration - - $Header = @{ - alg = $Algorithm - typ = $Type - } - - $Payload = @{ - iss = $Issuer - exp = $Exp - } - - $Headerjson = $Header | ConvertTo-Json -Compress - $Payloadjson = $Payload | ConvertTo-Json -Compress - - $Headerjsonbase64 = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($Headerjson)).Split('=')[0].Replace('+', '-').Replace('/', '_') - $Payloadjsonbase64 = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($Payloadjson)).Split('=')[0].Replace('+', '-').Replace('/', '_') - - $ToBeSigned = $Headerjsonbase64 + "." + $Payloadjsonbase64 - - $SigningAlgorithm = switch ($Algorithm) { - "HS256" { New-Object System.Security.Cryptography.HMACSHA256 } - "HS384" { New-Object System.Security.Cryptography.HMACSHA384 } - "HS512" { New-Object System.Security.Cryptography.HMACSHA512 } - } - - $SigningAlgorithm.Key = [System.Text.Encoding]::UTF8.GetBytes($SecretKey) - $Signature = [Convert]::ToBase64String($SigningAlgorithm.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($ToBeSigned))).Split('=')[0].Replace('+', '-').Replace('/', '_') - - $Token = "$Headerjsonbase64.$Payloadjsonbase64.$Signature" - - Write-Output $Token -} \ No newline at end of file diff --git a/PSZoom/Private/New-ZoomHeaders.ps1 b/PSZoom/Private/New-ZoomHeaders.ps1 index 819d054..c8f48d0 100644 --- a/PSZoom/Private/New-ZoomHeaders.ps1 +++ b/PSZoom/Private/New-ZoomHeaders.ps1 @@ -9,9 +9,6 @@ The Zoom API key. .PARAMETER ApiSecret The Zoom API secret. -.EXAMPLE -$Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - .EXAMPLE $Headers = New-ZoomHeaders -Token $Token @@ -22,19 +19,26 @@ Generic dictionary. function New-ZoomHeaders { param ( - [string]$ApiKey, - [string]$ApiSecret, - [string]$Token + [Parameter(Mandatory = $True)] + [securestring]$Token ) - - if (-not $Token) { - $Token = New-ZoomApiToken -ApiKey $ApiKey -ApiSecret $ApiSecret -ValidforSeconds 30 + + Write-Verbose 'Generating Headers' + if ($PSVersionTable.PSVersion.Major -ge 7) { + $tokenStr = ConvertFrom-SecureString -SecureString $Token -AsPlainText + } else { + $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Token) + $tokenStr = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) } - Write-Verbose 'Generating Headers' $Headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $Headers.Add('content-type' , 'application/json') - $Headers.Add('authorization', 'bearer ' + $Token) + $Headers.Add('authorization', 'bearer ' + $tokenStr) + + if ($PSVersionTable.PSVersion.Major -lt 7) { + # Clear plain string token. + [Runtime.InteropServices.Marshal]::ZeroFreeBSTR($BSTR) + } Write-Output $Headers } diff --git a/PSZoom/Private/Parse-JWTToken.ps1 b/PSZoom/Private/Parse-JWTToken.ps1 deleted file mode 100644 index f0d0846..0000000 --- a/PSZoom/Private/Parse-JWTToken.ps1 +++ /dev/null @@ -1,60 +0,0 @@ -function Parse-JWTtoken { - <# - .DESCRIPTION - Decodes a JWT token. This was taken from link below. Thanks to Vasil Michev. - .LINK - https://www.michev.info/Blog/Post/2140/decode-jwt-access-and-id-tokens-via-powershell - #> - [cmdletbinding()] - param( - [Parameter(Mandatory = $True)] - [string]$Token - ) - - #Validate as per https://tools.ietf.org/html/rfc7519 - #Access and ID tokens are fine, Refresh tokens will not work - if (-not $Token.Contains(".") -or -not $Token.StartsWith("eyJ")) { - Write-Error "Invalid token" -ErrorAction Stop - } - - #Header - $tokenheader = $Token.Split(".")[0].Replace('-', '+').Replace('_', '/') - - #Fix padding as needed, keep adding "=" until string length modulus 4 reaches 0 - while ($tokenheader.Length % 4) { - Write-Verbose "Invalid length for a Base-64 char array or string, adding =" - $tokenheader += "=" - } - - Write-Verbose "Base64 encoded (padded) header: $tokenheader" - - #Convert from Base64 encoded string to PSObject all at once - Write-Verbose "Decoded header:" - $header = ([System.Text.Encoding]::ASCII.GetString([system.convert]::FromBase64String($tokenheader)) | convertfrom-json) - - #Payload - $tokenPayload = $Token.Split(".")[1].Replace('-', '+').Replace('_', '/') - - #Fix padding as needed, keep adding "=" until string length modulus 4 reaches 0 - while ($tokenPayload.Length % 4) { - Write-Verbose "Invalid length for a Base-64 char array or string, adding =" - $tokenPayload += "=" - } - - Write-Verbose "Base64 encoded (padded) payoad: $tokenPayload" - - $tokenByteArray = [System.Convert]::FromBase64String($tokenPayload) - - - $tokenArray = ([System.Text.Encoding]::ASCII.GetString($tokenByteArray) | ConvertFrom-Json) - - #Converts $header and $tokenArray from PSCustomObject to Hashtable so they can be added together. - #I would like to use -AsHashTable in convertfrom-json. This works in pwsh 6 but for some reason Appveyor isnt running tests in pwsh 6. - $headerAsHash = @{} - $tokenArrayAsHash = @{} - $header.psobject.properties | ForEach-Object { $headerAsHash[$_.Name] = $_.Value } - $tokenArray.psobject.properties | ForEach-Object { $tokenArrayAsHash[$_.Name] = $_.Value } - $output = $headerAsHash + $tokenArrayAsHash - - Write-Output $output -} \ No newline at end of file diff --git a/PSZoom/Public/Account/Get-ZoomAccount.ps1 b/PSZoom/Public/Account/Get-ZoomAccount.ps1 index 3942363..f8966ee 100644 --- a/PSZoom/Public/Account/Get-ZoomAccount.ps1 +++ b/PSZoom/Public/Account/Get-ZoomAccount.ps1 @@ -9,12 +9,6 @@ Get the details of the account. You can only call this API if you have the appro .PARAMETER AccountId The Account ID. -.PARAMETER ApiKey -The API Key. - -.PARAMETER ApiSecret -The API Secret. - .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/accounts/accountsettings @@ -34,22 +28,12 @@ function Get-ZoomAccount { ValueFromPipelineByPropertyName = $True )] [Alias('id', 'account_id')] - [string]$AccountId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [string]$AccountId ) - begin { - #Generate Header with JWT (JSON Web Token) using the Api key/secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } process { $request = [System.UriBuilder]"https://api.zoom.us/v2/accounts/$id" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Account/Get-ZoomAccountSettings.ps1 b/PSZoom/Public/Account/Get-ZoomAccountSettings.ps1 index 773ee3c..6126232 100644 --- a/PSZoom/Public/Account/Get-ZoomAccountSettings.ps1 +++ b/PSZoom/Public/Account/Get-ZoomAccountSettings.ps1 @@ -6,12 +6,6 @@ Get the settings of an account. .DESCRIPTION Get the settings of an account. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/accounts/accountsettings @@ -23,21 +17,11 @@ Get-ZoomAccountSettings function Get-ZoomAccountSettings { [CmdletBinding()] - param ( - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) + param () - begin { - #Generate Header with JWT (JSON Web Token) using the Api key/secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } process { $request = [System.UriBuilder]"https://api.zoom.us/v2/accounts/me/settings" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Account/Get-ZoomAccounts.ps1 b/PSZoom/Public/Account/Get-ZoomAccounts.ps1 index 2fee268..55759e9 100644 --- a/PSZoom/Public/Account/Get-ZoomAccounts.ps1 +++ b/PSZoom/Public/Account/Get-ZoomAccounts.ps1 @@ -6,12 +6,6 @@ List sub accounts. .DESCRIPTION List sub accounts. You can only call this API if you have the approved partners permission to use a Master API. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/accounts/accounts @@ -30,19 +24,9 @@ function Get-ZoomAccounts { # The next page token is used to paginate through large result sets. A next page token will be returned whenever the set of available results exceeds the current page size. The expiration period for this token is 15 minutes. [Alias('next_page_token')] - [string]$NextPageToken, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) + [string]$NextPageToken + ) - begin { - #Generate Header with JWT (JSON Web Token) using the Api key/secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } process { $request = [System.UriBuilder]"https://api.zoom.us/v2/accounts" $query = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) @@ -53,7 +37,7 @@ function Get-ZoomAccounts { } $request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/CloudRecording/Get-ZoomAccountRecordings.ps1 b/PSZoom/Public/CloudRecording/Get-ZoomAccountRecordings.ps1 index e1cdd05..b060953 100644 --- a/PSZoom/Public/CloudRecording/Get-ZoomAccountRecordings.ps1 +++ b/PSZoom/Public/CloudRecording/Get-ZoomAccountRecordings.ps1 @@ -81,16 +81,6 @@ function Get-ZoomAccountRecordings { [ValidatePattern("([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))")] [string]$To, - [Parameter(ParameterSetName = 'Default')] - [Parameter(ParameterSetName = 'Trash')] - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [Parameter(ParameterSetName = 'Default')] - [Parameter(ParameterSetName = 'Trash')] - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, - [Parameter(ParameterSetName = 'Trash')] [bool]$Trash = $false, @@ -100,10 +90,6 @@ function Get-ZoomAccountRecordings { [string]$TrashType = 'meeting_recordings' ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/accounts/$AccountId/recordings" @@ -134,7 +120,7 @@ function Get-ZoomAccountRecordings { } $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/CloudRecording/Get-ZoomMeetingRecordings.ps1 b/PSZoom/Public/CloudRecording/Get-ZoomMeetingRecordings.ps1 index 51937be..d2c3cf2 100644 --- a/PSZoom/Public/CloudRecording/Get-ZoomMeetingRecordings.ps1 +++ b/PSZoom/Public/CloudRecording/Get-ZoomMeetingRecordings.ps1 @@ -21,7 +21,6 @@ Get-ZoomMeetingRecordings 123456789 .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/cloud-recording/recordingget - #> function Get-ZoomMeetingRecordings { @@ -34,24 +33,13 @@ function Get-ZoomMeetingRecordings { Position = 0 )] [Alias('meeting_id')] - [string]$MeetingId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$MeetingId + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/recordings" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/CloudRecording/Get-ZoomMeetingRecordingsSettings.ps1 b/PSZoom/Public/CloudRecording/Get-ZoomMeetingRecordingsSettings.ps1 index 624fcf9..93437c9 100644 --- a/PSZoom/Public/CloudRecording/Get-ZoomMeetingRecordingsSettings.ps1 +++ b/PSZoom/Public/CloudRecording/Get-ZoomMeetingRecordingsSettings.ps1 @@ -9,12 +9,6 @@ End a meeting by updating its status. .PARAMETER MeetingId The meeting ID. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/cloud-recording/recordingsettingupdate @@ -24,7 +18,7 @@ Get-ZoomMeetingRecordingsSettings -MeetingId 1234567890 #> function Get-ZoomMeetingRecordingsSettings { - [CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact='Medium')] + [CmdletBinding(ConfirmImpact='Medium')] param ( [Parameter( Mandatory = $True, @@ -33,19 +27,8 @@ function Get-ZoomMeetingRecordingsSettings { Position = 0 )] [Alias('meeting_id')] - [string]$MeetingId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$MeetingId + ) process { #Double Encode MeetingId in case UUID needs it. @@ -55,7 +38,7 @@ function Get-ZoomMeetingRecordingsSettings { $request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/recordings/settings" if ($pscmdlet.ShouldProcess) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/CloudRecording/Get-ZoomRecordings.ps1 b/PSZoom/Public/CloudRecording/Get-ZoomRecordings.ps1 index 13b7253..2514a27 100644 --- a/PSZoom/Public/CloudRecording/Get-ZoomRecordings.ps1 +++ b/PSZoom/Public/CloudRecording/Get-ZoomRecordings.ps1 @@ -87,19 +87,8 @@ function Get-ZoomRecordings { [string]$To, [ValidateSet('meeting_recordings', 'recording_file')] - [string]$TrashType = 'meeting_recordings', - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$TrashType = 'meeting_recordings' + ) process { foreach ($user in $Userid) { @@ -136,7 +125,7 @@ function Get-ZoomRecordings { $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/CloudRecording/Remove-ZoomMeetingRecordingFile.ps1 b/PSZoom/Public/CloudRecording/Remove-ZoomMeetingRecordingFile.ps1 index 325b666..efa2c3a 100644 --- a/PSZoom/Public/CloudRecording/Remove-ZoomMeetingRecordingFile.ps1 +++ b/PSZoom/Public/CloudRecording/Remove-ZoomMeetingRecordingFile.ps1 @@ -51,19 +51,8 @@ function Remove-ZoomMeetingRecordingFile { [string[]]$RecordingId, [ValidateSet('trash', 'delete')] - [string]$Action = 'trash', - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$Action = 'trash' + ) process { foreach($RecId in $RecordingId) { @@ -73,7 +62,7 @@ function Remove-ZoomMeetingRecordingFile { $Request.Query = $query.ToString() if ($PScmdlet.ShouldProcess($user, 'Remove')) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method DELETE -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method DELETE Write-Output $response } diff --git a/PSZoom/Public/CloudRecording/Remove-ZoomMeetingRecordings.ps1 b/PSZoom/Public/CloudRecording/Remove-ZoomMeetingRecordings.ps1 index d95b651..9501731 100644 --- a/PSZoom/Public/CloudRecording/Remove-ZoomMeetingRecordings.ps1 +++ b/PSZoom/Public/CloudRecording/Remove-ZoomMeetingRecordings.ps1 @@ -45,19 +45,8 @@ function Remove-ZoomMeetingRecordings { [string[]]$MeetingId, [ValidateSet('trash', 'delete')] - [string]$Action = 'trash', - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$Action = 'trash' + ) process { foreach($Id in $MeetingId) { @@ -67,7 +56,7 @@ function Remove-ZoomMeetingRecordings { $Request.Query = $query.ToString() if ($PScmdlet.ShouldProcess($user, 'Remove')) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method DELETE -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method DELETE Write-Output $response } diff --git a/PSZoom/Public/CloudRecording/Show-ZoomMeetingRecordings.ps1 b/PSZoom/Public/CloudRecording/Show-ZoomMeetingRecordings.ps1 index 2387ecc..51b3dca 100644 --- a/PSZoom/Public/CloudRecording/Show-ZoomMeetingRecordings.ps1 +++ b/PSZoom/Public/CloudRecording/Show-ZoomMeetingRecordings.ps1 @@ -21,7 +21,6 @@ Show-ZoomMeetingRecordings 123456789 .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/cloud-recording/recordingstatusupdate - #> function Show-ZoomMeetingRecordings { @@ -34,19 +33,8 @@ function Show-ZoomMeetingRecordings { Position = 0 )] [Alias('meeting_id')] - [string]$MeetingId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$MeetingId + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/recordings/status" @@ -56,7 +44,7 @@ function Show-ZoomMeetingRecordings { $requestBody.Add('action', 'recover') $requestBody = ConvertTo-Json $requestBody -Depth 10 - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method PUT -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method PUT Write-Output $response } diff --git a/PSZoom/Public/CloudRecording/Update-ZoomMeetingRecordingsSettings.ps1 b/PSZoom/Public/CloudRecording/Update-ZoomMeetingRecordingsSettings.ps1 index 42bf516..b0ae839 100644 --- a/PSZoom/Public/CloudRecording/Update-ZoomMeetingRecordingsSettings.ps1 +++ b/PSZoom/Public/CloudRecording/Update-ZoomMeetingRecordingsSettings.ps1 @@ -27,10 +27,6 @@ Send an email to host when someone registers to view the recording. This applies Show social share buttons on registration page. This applies for On-Demand recordings only. .PARAMETER Topic Name of the recording. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/cloud-recording/recordingsettingsupdate .EXAMPLE @@ -49,12 +45,6 @@ function Update-ZoomMeetingRecordingsSettings { [Alias('meeting_id')] [string]$MeetingId, - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, - [Parameter( HelpMessage = 'Share the recording.', ValueFromPipelineByPropertyName = $True @@ -135,11 +125,6 @@ function Update-ZoomMeetingRecordingsSettings { [string]$recTopic ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { #Double Encode MeetingId in case UUID needs it. $MeetingId = [uri]::EscapeDataString($MeetingId) @@ -195,7 +180,7 @@ function Update-ZoomMeetingRecordingsSettings { $requestBody = ConvertTo-Json $requestBody if ($pscmdlet.ShouldProcess) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PATCH -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PATCH Write-Output $response } diff --git a/PSZoom/Public/Groups/Add-ZoomGroupMember.ps1 b/PSZoom/Public/Groups/Add-ZoomGroupMember.ps1 index 20c9c48..9ab3585 100644 --- a/PSZoom/Public/Groups/Add-ZoomGroupMember.ps1 +++ b/PSZoom/Public/Groups/Add-ZoomGroupMember.ps1 @@ -16,12 +16,6 @@ Emails to be added to the group. .PARAMETER Id IDs to be added to the group. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS The Zoom response (an object). Example: ids added_at @@ -77,19 +71,10 @@ function Add-ZoomGroupMember { )] [Alias('memberids')] [string[]]$MemberId, - - [string]$ApiKey, - - [string]$ApiSecret, [switch]$Passthru ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $requestBody = @{} @@ -122,7 +107,7 @@ function Add-ZoomGroupMember { foreach ($Id in $GroupId) { $request = [System.UriBuilder]"https://api.zoom.us/v2/groups/$Id/members" if ($PScmdlet.ShouldProcess($members, 'Add')) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST if (-not $passthru) { Write-Output $response diff --git a/PSZoom/Public/Groups/Get-ZoomGroup.ps1 b/PSZoom/Public/Groups/Get-ZoomGroup.ps1 index 166108b..c516728 100644 --- a/PSZoom/Public/Groups/Get-ZoomGroup.ps1 +++ b/PSZoom/Public/Groups/Get-ZoomGroup.ps1 @@ -5,10 +5,7 @@ Get a group under your account. .DESCRIPTION Get a group under your account. Prerequisite: Pro, Business, or Education account -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS Zoom response as an object. .LINK @@ -26,22 +23,13 @@ function Get-ZoomGroup { Position = 0 )] [Alias('group_id', 'group', 'id')] - [string]$GroupId, - - [string]$ApiKey, - - [string]$ApiSecret + [string]$GroupId ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/groups/$GroupId" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response diff --git a/PSZoom/Public/Groups/Get-ZoomGroupLockSettings.ps1 b/PSZoom/Public/Groups/Get-ZoomGroupLockSettings.ps1 index cf37ef6..4c8262e 100644 --- a/PSZoom/Public/Groups/Get-ZoomGroupLockSettings.ps1 +++ b/PSZoom/Public/Groups/Get-ZoomGroupLockSettings.ps1 @@ -10,12 +10,6 @@ Prerequisite: Pro, Business, or Education account .PARAMETER GroupId The group ID. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS The Zoom response (an object). @@ -37,22 +31,13 @@ function Get-ZoomGroupLockSettings { Position = 0 )] [Alias('group_id', 'group', 'id')] - [string]$GroupId, - - [string]$ApiKey, - - [string]$ApiSecret + [string]$GroupId ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/groups/$GroupId/lock_settings" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response diff --git a/PSZoom/Public/Groups/Get-ZoomGroupMembers.ps1 b/PSZoom/Public/Groups/Get-ZoomGroupMembers.ps1 index a00300b..9ed7a1d 100644 --- a/PSZoom/Public/Groups/Get-ZoomGroupMembers.ps1 +++ b/PSZoom/Public/Groups/Get-ZoomGroupMembers.ps1 @@ -17,12 +17,6 @@ The number of records returned within a single API call. Default value is 30. Ma Token to return next page of results when greater than PageSize as returned from this function. (Zoom is depricating use of PageNumber so not going to implement that.) -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS Zoom response as an object. @@ -53,10 +47,6 @@ function Get-ZoomGroupMembers { [Alias('group_id', 'group', 'id')] [string]$GroupId, - [string]$ApiKey, - - [string]$ApiSecret, - [ValidateRange(1, 300)] [Alias('page_size')] [int]$PageSize = 30, @@ -65,18 +55,13 @@ function Get-ZoomGroupMembers { [String]$NextPageToken = "" ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $request = [System.UriBuilder]"https://api.zoom.us/v2/groups/$GroupId/members" $query = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) $query.Add('page_size', $PageSize) $query.Add('next_page_token', $NextPageToken) $request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Groups/Get-ZoomGroupSettings.ps1 b/PSZoom/Public/Groups/Get-ZoomGroupSettings.ps1 index 3cd1ad3..dc10f32 100644 --- a/PSZoom/Public/Groups/Get-ZoomGroupSettings.ps1 +++ b/PSZoom/Public/Groups/Get-ZoomGroupSettings.ps1 @@ -10,12 +10,6 @@ Prerequisite: Pro, Business, or Education account .PARAMETER GroupId The group ID. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS The Zoom response (an object). @@ -37,23 +31,12 @@ function Get-ZoomGroupSettings { Position = 0 )] [Alias('group_id', 'group', 'id')] - [string]$GroupId, - - [string]$ApiKey, - - [string]$ApiSecret + [string]$GroupId ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/groups/$GroupId/settings" - - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret - + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Groups/Get-ZoomGroups.ps1 b/PSZoom/Public/Groups/Get-ZoomGroups.ps1 index 99efbc5..d7600e9 100644 --- a/PSZoom/Public/Groups/Get-ZoomGroups.ps1 +++ b/PSZoom/Public/Groups/Get-ZoomGroups.ps1 @@ -14,12 +14,6 @@ total_records groups ------------- ------ 9 {@{id=..... -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS The key 'group' of the Zoom response (an object). Example: id name total_members @@ -47,23 +41,13 @@ Get-ZoomGroups -FullApiResponse function Get-ZoomGroups { [CmdletBinding()] param ( - [switch]$FullApiResponse, - - [string]$ApiKey, - - [string]$ApiSecret + [switch]$FullApiResponse ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/groups" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret - + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET if ($FullApiResponse) { Write-Output $response diff --git a/PSZoom/Public/Groups/New-ZoomGroup.ps1 b/PSZoom/Public/Groups/New-ZoomGroup.ps1 index 0075294..ed6153c 100644 --- a/PSZoom/Public/Groups/New-ZoomGroup.ps1 +++ b/PSZoom/Public/Groups/New-ZoomGroup.ps1 @@ -10,12 +10,6 @@ Prerequisite: Pro, Business, or Education account .PARAMETER Name The group name. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS The Zoom response (an object) .LINK @@ -24,6 +18,7 @@ https://marketplace.zoom.us/docs/api-reference/zoom-api/groups/groupcreate .EXAMPLE Create two groups. New-ZoomGroup -name 'Light Side', 'Dark Side' + #> function New-ZoomGroup { @@ -37,17 +32,10 @@ function New-ZoomGroup { [Alias('groupname', 'groupnames', 'names')] [string[]]$Name, - [string]$ApiKey, - - [string]$ApiSecret, - [switch]$Passthru ) begin { - #Generate Headers and JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - $Request = [System.UriBuilder]"https://api.zoom.us/v2/groups" } @@ -60,7 +48,7 @@ function New-ZoomGroup { $requestBody = $requestBody | ConvertTo-Json - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST Write-Verbose "Creating group $n." Write-Output $response diff --git a/PSZoom/Public/Groups/Remove-ZoomGroup.ps1 b/PSZoom/Public/Groups/Remove-ZoomGroup.ps1 index 2e372de..54e7f62 100644 --- a/PSZoom/Public/Groups/Remove-ZoomGroup.ps1 +++ b/PSZoom/Public/Groups/Remove-ZoomGroup.ps1 @@ -7,10 +7,7 @@ Delete a group under your account. Prerequisite: Pro, Business, or Education account. .PARAMETER GroupId The group ID. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS No output. .LINK @@ -34,25 +31,14 @@ function Remove-ZoomGroup { Position = 0 )] [Alias('group_id', 'group', 'id', 'groupids')] - [string[]]$GroupId, - - [string]$ApiKey, - - [string]$ApiSecret + [string[]]$GroupId ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { - foreach ($Id in $GroupID) { - #Need to add API rate limiting $Request = [System.UriBuilder]"https://api.zoom.us/v2/groups/$Id" if ($PSCmdlet.ShouldProcess($Id, "Remove")) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method DELETE -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method DELETE Write-Verbose "Group $Id deleted." Write-Output $response } diff --git a/PSZoom/Public/Groups/Remove-ZoomGroupMembers.ps1 b/PSZoom/Public/Groups/Remove-ZoomGroupMembers.ps1 index 49e385e..4bf4775 100644 --- a/PSZoom/Public/Groups/Remove-ZoomGroupMembers.ps1 +++ b/PSZoom/Public/Groups/Remove-ZoomGroupMembers.ps1 @@ -12,10 +12,7 @@ This is the ID of the group. Not to be confused with MemberId. This also has the This is for better pipeline support with other functions. Other aliases include 'group_id' and 'group'. .PARAMETER MemberIds This is the ID of the member. Not to be confused with the GroupId. MemberId is an alias. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS "Group member deleted." .LINK @@ -43,18 +40,9 @@ function Remove-ZoomGroupMembers { Position = 1 )] [Alias('memberid')] - [string[]]$MemberIds, - - [string]$ApiKey, - - [string]$ApiSecret + [string[]]$MemberIds ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { foreach ($GroupId in $GroupIDs) { #Need to add API rate limiting @@ -63,7 +51,7 @@ function Remove-ZoomGroupMembers { if ($PScmdlet.ShouldProcess) { Write-Verbose "Removing $MemberId from $GroupId." - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method DELETE -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method DELETE Write-Output $response } diff --git a/PSZoom/Public/Groups/Update-ZoomGroup.ps1 b/PSZoom/Public/Groups/Update-ZoomGroup.ps1 index ef7540e..54ac298 100644 --- a/PSZoom/Public/Groups/Update-ZoomGroup.ps1 +++ b/PSZoom/Public/Groups/Update-ZoomGroup.ps1 @@ -13,12 +13,6 @@ The group ID. .PARAMETER Name The group name. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS No output. @@ -47,18 +41,9 @@ function Update-ZoomGroup { Position = 0 )] [Alias('groupname')] - [string]$Name, - - [string]$ApiKey, - - [string]$ApiSecret + [string]$Name ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/groups/$GroupId" @@ -69,7 +54,7 @@ function Update-ZoomGroup { $requestBody = $requestBody | ConvertTo-Json if ($PScmdlet.ShouldProcess($GroupId, 'Update')) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PATCH -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PATCH Write-Verbose "Changed group name to $Name." Write-Output $response diff --git a/PSZoom/Public/Groups/Update-ZoomGroupLockSettings.ps1 b/PSZoom/Public/Groups/Update-ZoomGroupLockSettings.ps1 index ad1c1be..6a528f1 100644 --- a/PSZoom/Public/Groups/Update-ZoomGroupLockSettings.ps1 +++ b/PSZoom/Public/Groups/Update-ZoomGroupLockSettings.ps1 @@ -205,12 +205,6 @@ Allow users to join the meeting using the existing 3rd party audio configuration .PARAMETER AudioConferenceInfo -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS No output. @@ -434,18 +428,9 @@ function Update-ZoomGroupLockSettings { [Alias('audio_conference_info')] [string]$AudioConferenceInfo, - [string]$ApiKey, - - [string]$ApiSecret, - [switch]$Passthru ) - begin { - #Get Zoom Api Credentials - - } - process { $scheduleMeetingParams = @{ host_video = 'HostVideo' @@ -570,18 +555,9 @@ function Update-ZoomGroupLockSettings { $requestBody = $requestBody | ConvertTo-Json foreach ($id in $GroupId) { - - <# - Generate Headers and JWT (JSON Web Token). This is typically in the begin block. - It has been moved within the for loop as the JWT is set to expire after 30 seconds by default. - This way a new JWT is generated for each request and the JWT will not expire too soon. - #> - - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - $request = [System.UriBuilder]"https://api.zoom.us/v2/groups/$GroupId/lock_settings" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PATCH -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PATCH if (-not $Passthru) { Write-Output $response diff --git a/PSZoom/Public/Groups/Update-ZoomGroupSettings.ps1 b/PSZoom/Public/Groups/Update-ZoomGroupSettings.ps1 index 8f16d47..a24ed30 100644 --- a/PSZoom/Public/Groups/Update-ZoomGroupSettings.ps1 +++ b/PSZoom/Public/Groups/Update-ZoomGroupSettings.ps1 @@ -204,12 +204,6 @@ Allow users to join the meeting using the existing 3rd party audio configuration .PARAMETER AudioConferenceInfo -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS No output. @@ -433,18 +427,9 @@ function Update-ZoomGroupSettings { [Alias('audio_conference_info')] [string]$AudioConferenceInfo, - [string]$ApiKey, - - [string]$ApiSecret, - [switch]$Passthru ) - begin { - #Get Zoom Api Credentials - - } - process { $scheduleMeetingParams = @{ host_video = 'HostVideo' @@ -569,16 +554,9 @@ function Update-ZoomGroupSettings { $requestBody = $requestBody | ConvertTo-Json foreach ($id in $GroupId) { - <# - Generate Headers and JWT (JSON Web Token). This is typically in the begin block. - It has been moved within the for loop as the JWT is set to expire after 30 seconds by default. - This way a new JWT is generated for each request and the JWT will not expire too soon. - #> - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - $request = [System.UriBuilder]"https://api.zoom.us/v2/groups/$GroupId/settings" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PATCH -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PATCH if (-not $Passthru) { Write-Output $response diff --git a/PSZoom/Public/IMGroups/Add-ZoomIMDirectoryGroupMembers.ps1 b/PSZoom/Public/IMGroups/Add-ZoomIMDirectoryGroupMembers.ps1 index c598994..440752f 100644 --- a/PSZoom/Public/IMGroups/Add-ZoomIMDirectoryGroupMembers.ps1 +++ b/PSZoom/Public/IMGroups/Add-ZoomIMDirectoryGroupMembers.ps1 @@ -15,12 +15,6 @@ Emails to be added to the group. .PARAMETER MemberId IDs to be added to the group. -.PARAMETER ApiKey -The API Key. - -.PARAMETER ApiSecret -The API Secret. - #> function Add-ZoomIMDirectoryGroupMembers { @@ -47,19 +41,10 @@ function Add-ZoomIMDirectoryGroupMembers { )] [Alias('memberids')] [string[]]$MemberId, - - [string]$ApiKey, - - [string]$ApiSecret, [switch]$Passthru ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $requestBody = @{} @@ -92,7 +77,7 @@ function Add-ZoomIMDirectoryGroupMembers { foreach ($Id in $GroupId) { $request = [System.UriBuilder]"https://api.zoom.us/v2/im/groups/$Id/members" if ($PScmdlet.ShouldProcess($members, 'Add')) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST if (-not $passthru) { Write-Output $response diff --git a/PSZoom/Public/Meetings/Add-ZoomMeetingRegistrant.ps1 b/PSZoom/Public/Meetings/Add-ZoomMeetingRegistrant.ps1 index b522c43..83e8a6b 100644 --- a/PSZoom/Public/Meetings/Add-ZoomMeetingRegistrant.ps1 +++ b/PSZoom/Public/Meetings/Add-ZoomMeetingRegistrant.ps1 @@ -58,10 +58,7 @@ More than 10,000 The user's comments. .PARAMETER CustomQuestions The user's custom questions. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE @@ -156,18 +153,9 @@ function Add-ZoomMeetingRegistrant { [Parameter(ValueFromPipelineByPropertyName = $True)] [Alias('custom_questions')] - [hashtable]$CustomQuestions, - - [string]$ApiKey, - - [string]$ApiSecret + [hashtable]$CustomQuestion ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/registrants" @@ -222,7 +210,7 @@ function Add-ZoomMeetingRegistrant { } $requestBody = $requestBody | ConvertTo-Json - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST Write-Output $response diff --git a/PSZoom/Public/Meetings/Get-ZoomEndedMeetingInstances.ps1 b/PSZoom/Public/Meetings/Get-ZoomEndedMeetingInstances.ps1 index 8cff116..3397608 100644 --- a/PSZoom/Public/Meetings/Get-ZoomEndedMeetingInstances.ps1 +++ b/PSZoom/Public/Meetings/Get-ZoomEndedMeetingInstances.ps1 @@ -6,16 +6,12 @@ List of ended meeting instances List of ended meeting instances .PARAMETER MeetingId The meeting ID. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE Get-ZoomEndedMeetingInstances 123456789 - #> function Get-ZoomEndedMeetingInstances { @@ -28,23 +24,12 @@ function Get-ZoomEndedMeetingInstances { Position = 0 )] [Alias('meeting_id')] - [string]$MeetingId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$MeetingId + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/past_meetings/$MeetingId/instances" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/Meetings/Get-ZoomMeeting.ps1 b/PSZoom/Public/Meetings/Get-ZoomMeeting.ps1 index 2c7834b..0b7d69a 100644 --- a/PSZoom/Public/Meetings/Get-ZoomMeeting.ps1 +++ b/PSZoom/Public/Meetings/Get-ZoomMeeting.ps1 @@ -12,12 +12,6 @@ The meeting ID. .PARAMETER OcurrenceId The Occurrence ID. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS .LINK @@ -48,20 +42,8 @@ function Get-ZoomMeeting { Position=1 )] [Alias('ocurrence_id')] - [string]$OccurrenceId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$OccurrenceId + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId" @@ -71,7 +53,7 @@ function Get-ZoomMeeting { $query.Add('occurrence_id', $OccurrenceId) $Request.Query = $query.toString() } - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/Meetings/Get-ZoomMeetingInvitation.ps1 b/PSZoom/Public/Meetings/Get-ZoomMeetingInvitation.ps1 index 377fb8b..bdbc5b7 100644 --- a/PSZoom/Public/Meetings/Get-ZoomMeetingInvitation.ps1 +++ b/PSZoom/Public/Meetings/Get-ZoomMeetingInvitation.ps1 @@ -6,10 +6,7 @@ Retrieve the meeting invitation Retrieve the meeting invitation .PARAMETER MeetingId The meeting ID. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE @@ -27,24 +24,13 @@ function Get-ZoomMeetingInvitation { Position = 0 )] [Alias('meeting_id')] - [string]$MeetingId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$MeetingId + ) process { $Uri = "https://api.zoom.us/v2/meetings/$MeetingId/invitation" - $response = Invoke-ZoomRestMethod -Uri $Uri -Headers ([ref]$headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Meetings/Get-ZoomMeetingPoll.ps1 b/PSZoom/Public/Meetings/Get-ZoomMeetingPoll.ps1 index 980940f..2fe469f 100644 --- a/PSZoom/Public/Meetings/Get-ZoomMeetingPoll.ps1 +++ b/PSZoom/Public/Meetings/Get-ZoomMeetingPoll.ps1 @@ -8,16 +8,12 @@ Retrieve a meeting's poll. The meeting ID. .PARAMETER PollId The poll ID. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE Get-ZoomMeetingPoll 123456789 987654321 - #> function Get-ZoomMeetingPoll { @@ -38,24 +34,13 @@ function Get-ZoomMeetingPoll { Position=1 )] [Alias('poll_id')] - [string]$PollId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$PollId + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/polls/$PollId" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/Meetings/Get-ZoomMeetingPolls.ps1 b/PSZoom/Public/Meetings/Get-ZoomMeetingPolls.ps1 index 6dcad74..a5dbe7c 100644 --- a/PSZoom/Public/Meetings/Get-ZoomMeetingPolls.ps1 +++ b/PSZoom/Public/Meetings/Get-ZoomMeetingPolls.ps1 @@ -8,16 +8,12 @@ Host user must be in a Pro plan. Meeting must be a scheduled meeting. Instant meetings do not have polling features enabled. .PARAMETER MeetingId The meeting ID. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE Get-ZoomMeetingsPolls 123456789 - #> function Get-ZoomMeetingPolls { @@ -30,24 +26,13 @@ function Get-ZoomMeetingPolls { Position = 0 )] [Alias('meeting_id')] - [string]$MeetingId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$MeetingId + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/polls" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/Meetings/Get-ZoomMeetingRegistrants.ps1 b/PSZoom/Public/Meetings/Get-ZoomMeetingRegistrants.ps1 index f52df1b..8941d8e 100644 --- a/PSZoom/Public/Meetings/Get-ZoomMeetingRegistrants.ps1 +++ b/PSZoom/Public/Meetings/Get-ZoomMeetingRegistrants.ps1 @@ -17,15 +17,11 @@ Denied - Registrant's status is denied. The number of records returned within a single API call. Default value is 30. Maximum value is 300. .PARAMETER PageNumber The current page number of returned records. Default value is 1. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE Get-ZoomMeetingRegistrants 123456789 - #> function Get-ZoomMeetingRegistrants { @@ -48,22 +44,9 @@ function Get-ZoomMeetingRegistrants { [int]$PageSize = 30, [Alias('page_number')] - [int]$PageNumber = 1, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - - #Need to add an all switch + [int]$PageNumber = 1 ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/registrants" $query = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) @@ -73,7 +56,7 @@ function Get-ZoomMeetingRegistrants { $request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response diff --git a/PSZoom/Public/Meetings/Get-ZoomMeetings.ps1 b/PSZoom/Public/Meetings/Get-ZoomMeetings.ps1 index 5bc614a..99ab426 100644 --- a/PSZoom/Public/Meetings/Get-ZoomMeetings.ps1 +++ b/PSZoom/Public/Meetings/Get-ZoomMeetings.ps1 @@ -93,19 +93,8 @@ function Get-ZoomMeetings { [datetime]$To = (Get-Date), [ValidateSet('past','pastOne','live')] - [string]$Type = 'live', - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$Type = 'live' + ) process { if ($PsCmdlet.ParameterSetName -eq 'Default') { @@ -127,7 +116,7 @@ function Get-ZoomMeetings { $Request.Query = $query.ToString() try { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET } catch { Write-Error -Message "$($_.Exception.Message)" -ErrorId $_.Exception.Code -Category InvalidOperation } diff --git a/PSZoom/Public/Meetings/Get-ZoomMeetingsFromUser.ps1 b/PSZoom/Public/Meetings/Get-ZoomMeetingsFromUser.ps1 index e4967f6..d4c5566 100644 --- a/PSZoom/Public/Meetings/Get-ZoomMeetingsFromUser.ps1 +++ b/PSZoom/Public/Meetings/Get-ZoomMeetingsFromUser.ps1 @@ -14,10 +14,7 @@ Upcoming - All of the upcoming meetings. The number of records returned within a single API call. Default value is 30. Maximum value is 300. .PARAMETER PageNumber The current page number of returned records. Default value is 1. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE @@ -50,19 +47,8 @@ function Get-ZoomMeetingsFromUser { [int]$PageSize = 30, [Alias('page_number')] - [int]$PageNumber = 1, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [int]$PageNumber = 1 + ) process { #This makes the Type parameter a bit friendlier with other cmdlets and Zoom API responses @@ -76,7 +62,7 @@ function Get-ZoomMeetingsFromUser { $query.add('page_number', $PageNumber) $request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Meetings/Get-ZoomPastMeetingDetails.ps1 b/PSZoom/Public/Meetings/Get-ZoomPastMeetingDetails.ps1 index fd1ae34..1084139 100644 --- a/PSZoom/Public/Meetings/Get-ZoomPastMeetingDetails.ps1 +++ b/PSZoom/Public/Meetings/Get-ZoomPastMeetingDetails.ps1 @@ -6,16 +6,12 @@ Retrieve the details of a past meeting. Retrieve the details of a past meeting. .PARAMETER MeetingUuid The meeting UUID. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE Get-ZoomPastMeetingDetails 123456789 - #> function Get-ZoomPastMeetingDetails { @@ -28,24 +24,13 @@ function Get-ZoomPastMeetingDetails { ValueFromPipelineByPropertyName = $True )] [Alias('uuid')] - [string]$MeetingUuid, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$MeetingUuid + ) process { $Uri = "https://api.zoom.us/v2/past_meetings/$MeetingUuid" - $response = Invoke-ZoomRestMethod -Uri $Uri -Headers ([ref]$headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Meetings/Get-ZoomPastMeetingParticipants.ps1 b/PSZoom/Public/Meetings/Get-ZoomPastMeetingParticipants.ps1 index f3da26d..598e4da 100644 --- a/PSZoom/Public/Meetings/Get-ZoomPastMeetingParticipants.ps1 +++ b/PSZoom/Public/Meetings/Get-ZoomPastMeetingParticipants.ps1 @@ -6,10 +6,7 @@ Retrieve participants from a past meeting. Retrieve participants from a past meeting. Note: Please double encode your UUID when using this API. .PARAMETER MeetingUuid The meeting UUID. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE @@ -36,19 +33,8 @@ function Get-ZoomPastMeetingParticipants { [Parameter(ValueFromPipelineByPropertyName = $True)] [Alias('next_page_token')] - [string]$NextPageToken, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$NextPageToken + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/past_meetings/$MeetingUuid/participants" @@ -61,7 +47,7 @@ function Get-ZoomPastMeetingParticipants { $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/Meetings/Get-ZoomPastMeetingParticipantsMetrics.ps1 b/PSZoom/Public/Meetings/Get-ZoomPastMeetingParticipantsMetrics.ps1 index dc32fac..3a3f6aa 100644 --- a/PSZoom/Public/Meetings/Get-ZoomPastMeetingParticipantsMetrics.ps1 +++ b/PSZoom/Public/Meetings/Get-ZoomPastMeetingParticipantsMetrics.ps1 @@ -15,12 +15,6 @@ The meeting type (live, past or pastone). .PARAMETER PageSize 1-300. Default = 300 -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/dashboards/dashboardmeetingparticipants @@ -51,19 +45,8 @@ function Get-ZoomPastMeetingParticipantsMetrics { [string]$NextPageToken, [ValidateSet('past','pastOne','live')] - [string]$Type = 'past', - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$Type = 'past' + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/metrics/meetings/$MeetingUuid/participants" @@ -77,7 +60,7 @@ function Get-ZoomPastMeetingParticipantsMetrics { $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/Meetings/Get-ZoomRegistrationQuestions.ps1 b/PSZoom/Public/Meetings/Get-ZoomRegistrationQuestions.ps1 index f01b7ac..70d654d 100644 --- a/PSZoom/Public/Meetings/Get-ZoomRegistrationQuestions.ps1 +++ b/PSZoom/Public/Meetings/Get-ZoomRegistrationQuestions.ps1 @@ -6,16 +6,12 @@ List registration questions that will be displayed to users while registering fo List registration questions that will be displayed to users while registering for a meeeting. .PARAMETER MeetingId The meeting ID. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE Get-ZoomRegistrationQuestions 123456789 - #> function Get-ZoomRegistrationQuestions { @@ -28,24 +24,13 @@ function Get-ZoomRegistrationQuestions { Position = 0 )] [Alias('meeting_id')] - [string]$MeetingId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$MeetingId + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/registrants/questions" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/Meetings/New-ZoomMeeting.ps1 b/PSZoom/Public/Meetings/New-ZoomMeeting.ps1 index 0368658..9743070 100644 --- a/PSZoom/Public/Meetings/New-ZoomMeeting.ps1 +++ b/PSZoom/Public/Meetings/New-ZoomMeeting.ps1 @@ -119,10 +119,7 @@ Meeting authentication option id. If user has configured "Sign into Zoom with Specified Domains" option, this will list the doamins that are authenticated. .PARAMETER AuthenticationName Authentication name set in the authentication profile. -.PARAMETER ApiKey -The API key. -.PARAMETER ApiSecret -The API secret. + .LINK https://github.com/JosephMcEvoy/New-ZoomMeeting .LINK @@ -226,8 +223,6 @@ New-ZoomMeeting @params @mandatoryParams @scheduleParams -Topic 'Test Topic' -Us -StartTime '2019-10-18T15:00:00Z' -Duration 60 -MonthlyWeek 'SecondWeek'` -MonthlyWeekDay 'Tuesday' -EndDateTime '2019-11-25T12:00:00Z' -RepeatInterval 2 - - #> function New-ZoomMeeting { @@ -610,25 +605,11 @@ function New-ZoomMeeting { [Parameter(ValueFromPipelineByPropertyName = $True)] [Alias('authentication_name')] - [string]$AuthenticationName, - - [string]$ApiKey, - - [string]$ApiSecret + [string]$AuthenticationName ) begin { $Uri = "https://api.zoom.us/v2/users/$userId/meetings" - - #Get Zoom Api Credentials - if (-not $ApiKey -or -not $ApiSecret) { - $ApiCredentials = Get-ZoomApiCredentials - $ApiKey = $ApiCredentials.ApiKey - $ApiSecret = $ApiCredentials.ApiSecret - } - - #Generate Headers with JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret } process { @@ -644,8 +625,6 @@ function New-ZoomMeeting { #The following parameters are added by default as they are requierd by all parameter sets so they are automatically added to the request body $requestBody = @{ - 'api_key' = $ApiKey - 'api_secret' = $ApiSecret 'topic' = $Topic 'type' = $Type } @@ -844,7 +823,7 @@ function New-ZoomMeeting { #### Misc Settings End ##### $requestBody = ConvertTo-Json $requestBody -Depth 10 - $response = Invoke-ZoomRestMethod -Uri $Uri -Headers ([ref]$Headers) -Body $requestBody -Method Post -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $Uri -Body $requestBody -Method Post Write-Output $response } diff --git a/PSZoom/Public/Meetings/New-ZoomMeetingPoll.ps1 b/PSZoom/Public/Meetings/New-ZoomMeetingPoll.ps1 index ccf2b3a..d53cc84 100644 --- a/PSZoom/Public/Meetings/New-ZoomMeetingPoll.ps1 +++ b/PSZoom/Public/Meetings/New-ZoomMeetingPoll.ps1 @@ -28,10 +28,7 @@ $Questions = @( (New-ZoomMeetingPollQuestion -Name 'Favorite Number?' -type 'multiple' -answers '1','2','3'), (New-ZoomMeetingPollQuestion -Name 'Favorite letter??' -type 'multiple' -answers 'a','b','c') ) -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .EXAMPLE $Questions = @( @{name = 'Favorite number?'; type = 'multiple'; answers = @('1', '2', '3')}, @@ -40,7 +37,6 @@ $Questions = @( New-ZoomMeetingPoll 123456789 -Title 'Favorite numbers and letters' -Questions $Questions - #> function New-ZoomMeetingPoll { @@ -59,20 +55,9 @@ function New-ZoomMeetingPoll { [string]$Title, [Parameter(ValueFromPipelineByPropertyName = $True)] - [System.Collections.IDictionary[]]$Questions, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [System.Collections.IDictionary[]]$Questions ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/polls" $RequestBody = @{} @@ -93,7 +78,7 @@ function New-ZoomMeetingPoll { } $RequestBody = $RequestBody | ConvertTo-Json -Depth 10 - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST Write-Output $response } diff --git a/PSZoom/Public/Meetings/New-ZoomMeetingPollQuestion.ps1 b/PSZoom/Public/Meetings/New-ZoomMeetingPollQuestion.ps1 index 8395ce7..18b94c6 100644 --- a/PSZoom/Public/Meetings/New-ZoomMeetingPollQuestion.ps1 +++ b/PSZoom/Public/Meetings/New-ZoomMeetingPollQuestion.ps1 @@ -19,7 +19,6 @@ $Questions = @( New-ZoomMeetingPoll 123456789 -Title 'Favorite numbers and letters' -Questions $Questions - #> function New-ZoomMeetingPollQuestion { [OutputType([Hashtable])] diff --git a/PSZoom/Public/Meetings/Remove-ZoomMeeting.ps1 b/PSZoom/Public/Meetings/Remove-ZoomMeeting.ps1 index 9ce732e..17b1bda 100644 --- a/PSZoom/Public/Meetings/Remove-ZoomMeeting.ps1 +++ b/PSZoom/Public/Meetings/Remove-ZoomMeeting.ps1 @@ -8,10 +8,7 @@ Delete a meeting. The meeting ID. .PARAMETER OcurrenceId The Occurrence ID. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .EXAMPLE Remove-ZoomMeeting 123456789 @@ -43,20 +40,9 @@ function Remove-ZoomMeeting { [Alias('schedule_for_reminder')] [string]$ScheduleForReminder, - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, - [switch]$Passthru ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId" @@ -74,7 +60,7 @@ function Remove-ZoomMeeting { $Request.Query = $query.ToString() } - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method DELETE -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method DELETE if (-not $Passthru) { Write-Output $response diff --git a/PSZoom/Public/Meetings/Remove-ZoomMeetingPoll.ps1 b/PSZoom/Public/Meetings/Remove-ZoomMeetingPoll.ps1 index c6d2939..c1e10fc 100644 --- a/PSZoom/Public/Meetings/Remove-ZoomMeetingPoll.ps1 +++ b/PSZoom/Public/Meetings/Remove-ZoomMeetingPoll.ps1 @@ -8,10 +8,7 @@ Delete a meeting's poll. The meeting ID. .PARAMETER PollId The poll ID. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE @@ -37,23 +34,12 @@ function Remove-ZoomMeetingPoll { Position=1 )] [Alias('poll_id')] - [string]$PollId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$PollId + ) process { $request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/polls/$PollId" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method DELETE -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method DELETE Write-Output $response } diff --git a/PSZoom/Public/Meetings/Update-ZoomMeeting.ps1 b/PSZoom/Public/Meetings/Update-ZoomMeeting.ps1 index 435b2a0..a091154 100644 --- a/PSZoom/Public/Meetings/Update-ZoomMeeting.ps1 +++ b/PSZoom/Public/Meetings/Update-ZoomMeeting.ps1 @@ -146,10 +146,7 @@ authenticated. Authentication name set in the authentication profile. .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingupdate -.PARAMETER ApiKey -The API key. -.PARAMETER ApiSecret -The API secret. + #> function Update-ZoomMeeting { @@ -343,23 +340,9 @@ function Update-ZoomMeeting { [Parameter(ValueFromPipelineByPropertyName = $True)] [Alias('authentication_domains')] - [string]$AuthenticationDomains, - - [Parameter(ValueFromPipelineByPropertyName = $True)] - [Alias('authentication_name')] - [string]$AuthenticationName, - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [string]$AuthenticationDomains ) - - begin { - #Generate Headers with JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - + process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId" @@ -378,12 +361,6 @@ function Update-ZoomMeeting { } } - #The following parameters are added by default and are added to the request body - $requestBody = @{ - 'api_key' = $ApiKey - 'api_secret' = $ApiSecret - } - #These are optional meeting parameters. $OptionalParameters = @{ 'schedule_for' = 'ScheduleFor' @@ -543,7 +520,7 @@ function Update-ZoomMeeting { } $requestBody = ConvertTo-Json $requestBody -Depth 10 - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PATCH -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PATCH Write-Output $response } diff --git a/PSZoom/Public/Meetings/Update-ZoomMeetingLiveStream.ps1 b/PSZoom/Public/Meetings/Update-ZoomMeetingLiveStream.ps1 index cef122b..b508b59 100644 --- a/PSZoom/Public/Meetings/Update-ZoomMeetingLiveStream.ps1 +++ b/PSZoom/Public/Meetings/Update-ZoomMeetingLiveStream.ps1 @@ -6,10 +6,7 @@ Update a meeting’s live stream. Update a meeting’s live stream. .PARAMETER MeetingId The meeting ID. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE @@ -48,19 +45,8 @@ function Update-ZoomMeetingLiveStream { [Parameter(ValueFromPipelineByPropertyName = $True)] [ValidateLength(0, 1024)] [Alias('page_url')] - [string]$PageUrl, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$PageUrl + ) process { $uri = "https://api.zoom.us/v2/meetings/$MeetingId/livestream" @@ -75,7 +61,7 @@ function Update-ZoomMeetingLiveStream { $requestBody = ConvertTo-Json $requestBody - $response = Invoke-ZoomRestMethod -Uri $uri -Headers ([ref]$Headers) -Body $requestBody -Method PATCH -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $uri -Body $requestBody -Method PATCH Write-Output $response } diff --git a/PSZoom/Public/Meetings/Update-ZoomMeetingLiveStreamStatus.ps1 b/PSZoom/Public/Meetings/Update-ZoomMeetingLiveStreamStatus.ps1 index 345a137..28adba6 100644 --- a/PSZoom/Public/Meetings/Update-ZoomMeetingLiveStreamStatus.ps1 +++ b/PSZoom/Public/Meetings/Update-ZoomMeetingLiveStreamStatus.ps1 @@ -6,16 +6,12 @@ Update a meeting’s live stream. Update a meeting’s live stream. .PARAMETER MeetingId The meeting ID. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE -Update-ZoomMeetingLiveStream 123456789 +Update-ZoomMeetingLiveStream 123456789 -22 #> function Update-ZoomMeetingLiveStreamStatus { @@ -43,19 +39,8 @@ function Update-ZoomMeetingLiveStreamStatus { [Parameter(ValueFromPipelineByPropertyName = $True)] [ValidateLength(0, 1024)] [Alias('page_url')] - [string]$PageUrl, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$PageUrl + ) process { $Uri = "https://api.zoom.us/v2/meetings/$MeetingId/livestream/status" @@ -75,7 +60,7 @@ function Update-ZoomMeetingLiveStreamStatus { $requestBody = $requestBody | ConvertTo-Json - $response = Invoke-ZoomRestMethod -Uri $uri -Headers ([ref]$Headers) -Body $requestBody -Method PATCH -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $uri -Body $requestBody -Method PATCH Write-Output $response } diff --git a/PSZoom/Public/Meetings/Update-ZoomMeetingPoll.ps1 b/PSZoom/Public/Meetings/Update-ZoomMeetingPoll.ps1 index 5663ae2..77e1dfb 100644 --- a/PSZoom/Public/Meetings/Update-ZoomMeetingPoll.ps1 +++ b/PSZoom/Public/Meetings/Update-ZoomMeetingPoll.ps1 @@ -29,10 +29,7 @@ $Questions = @( (New-ZoomMeetingPollQuestion -Name 'Favorite Number?' -type 'multiple' -answers '1','2','3'), (New-ZoomMeetingPollQuestion -Name 'Favorite letter??' -type 'multiple' -answers 'a','b','c') ) -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .EXAMPLE $Questions = @( (New-ZoomMeetingPollQuestion -Name 'Favorite Number?' -type 'multiple' -answers '1','2','3'), @@ -41,7 +38,6 @@ $Questions = @( Update-ZoomMeetingPoll 123456789 -PollId zKbEaqMKeU3soLJ7noFBR8 -Title 'Favorite numbers and letters' -Questions $Questions - #> function Update-ZoomMeetingPoll { @@ -69,20 +65,9 @@ function Update-ZoomMeetingPoll { [string]$Title, [Parameter(ValueFromPipelineByPropertyName = $True)] - [System.Collections.IDictionary[]]$Questions, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [System.Collections.IDictionary[]]$Questions ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/polls/$PollId" $requestBody = @{} @@ -104,7 +89,7 @@ function Update-ZoomMeetingPoll { $requestBody = ConvertTo-Json $requestBody -Depth 10 #Uses -Depth because the questions.answers array is flattened without it. - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PUT -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PUT Write-Output $response } diff --git a/PSZoom/Public/Meetings/Update-ZoomMeetingRegistrantStatus.ps1 b/PSZoom/Public/Meetings/Update-ZoomMeetingRegistrantStatus.ps1 index e7a6cac..e49888f 100644 --- a/PSZoom/Public/Meetings/Update-ZoomMeetingRegistrantStatus.ps1 +++ b/PSZoom/Public/Meetings/Update-ZoomMeetingRegistrantStatus.ps1 @@ -6,16 +6,12 @@ Update a meeting registrant’s status. Update a meeting registrant’s status. .PARAMETER MeetingId The meeting ID. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE Update-ZoomMeetingRegistrantStatus 123456789 - #> function Update-ZoomMeetingRegistrantStatus { @@ -49,19 +45,8 @@ function Update-ZoomMeetingRegistrantStatus { ValueFromPipelineByPropertyName = $True, Position=3 )] - [hashtable[]]$Registrants, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [hashtable[]]$Registrants + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/registrants/status" @@ -82,7 +67,7 @@ function Update-ZoomMeetingRegistrantStatus { $requestBody = $requestBody | ConvertTo-Json - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PUT -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PUT Write-Output $response } diff --git a/PSZoom/Public/Meetings/Update-ZoomMeetingRegistrationQuestions.ps1 b/PSZoom/Public/Meetings/Update-ZoomMeetingRegistrationQuestions.ps1 index b564a2f..cd87327 100644 --- a/PSZoom/Public/Meetings/Update-ZoomMeetingRegistrationQuestions.ps1 +++ b/PSZoom/Public/Meetings/Update-ZoomMeetingRegistrationQuestions.ps1 @@ -23,17 +23,12 @@ Answers Valid types are 'short' and 'single'. Answers can only be used with 'short' type. Can also use New-ZoomRegistrantCustomQuestion. Example: $CustomQuestions = (New-ZoomRegistrantCustomQuestion -Title 'Favorite Color' -Type Short -Required $True -Answers 'Blue','Red','Green') -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS .LINK .EXAMPLE $params = @{ MeetingId = $MeetingId - ApiKey = $ApiKey - ApiSecret = $ApiSecret Questions = @( @{'FieldName' = 'Address'}, @{'FieldName' = 'City'} @@ -73,19 +68,10 @@ function Update-ZoomMeetingRegistrationQuestions { [hashtable[]]$Questions, [Alias('custom_question', 'customquestion')] - [hashtable[]]$CustomQuestions, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [hashtable[]]$CustomQuestions ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/registrants/questions" $requestBody = @{} @@ -99,72 +85,8 @@ function Update-ZoomMeetingRegistrationQuestions { } $requestBody = $requestBody | ConvertTo-Json - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PATCH -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PATCH Write-Output $response } -} - -<# -I would like to make these into classes that can be referenced from some sort -of classes file. Not sure how this works or if its feasible. - -EXAMPLE -Update-ZoomRegistrationQuestions 123456789 -questions (New-ZoomRegistrantQuestion -FieldName 'Address'),(New-ZoomRegistrantQuestion -FieldName 'City') - -EXAMPLE -Update-ZoomRegistrationQuestions 123456789 -customquestions (New-ZoomRegistrantCustomQuestion -title 'Title' -type 'single' -required $True -answers 'Mr','Ms'),` -(New-ZoomRegistrantCustomQuestion -title 'Favorite Color' -type 'single' -required $True -answers 'Blue','Red') - -function New-ZoomRegistrantQuestion { - param ( - [Parameter(Mandatory = $True)] - [ValidateSet('address', 'city', 'country', 'zip', 'state', 'phone', 'industry', 'org', 'job_title', - 'purchasing_time_frame', 'role_in_purchase_process', 'no_of_employees', 'comments')] - [Alias('field_name')] - [string]$FieldName, - - [Parameter(Mandatory = $True)] - [bool]$Required - ) - - $Question = @{ - 'field_name' = $FieldName - 'required' = $Required - } - - Write-Output $Question -} - -function New-ZoomRegistrantCustomQuestion { - param ( - [Parameter(Mandatory = $True)] - [string]$Title, - - [Parameter(Mandatory = $True)] - [ValidateSet('short', 'single')] - [string]$Type, - - [Parameter(Mandatory = $True)] - [bool]$Required, - - [string[]]$Answers - ) - - $CustomQuestion = @{ - 'title' = $Title - 'type' = $Type - 'required' = $Required - } - - if ($PSBoundParameters.ContainsKey('Answers')) { - if ($Type -eq 'single') { - throw 'Answers parameter requires type to be set to "short".' - } else { - $CustomQuestion.Add('answers', $Answers) - } - } - - Write-Output $CustomQuestion -} -#> \ No newline at end of file +} \ No newline at end of file diff --git a/PSZoom/Public/Meetings/Update-ZoomMeetingStatus.ps1 b/PSZoom/Public/Meetings/Update-ZoomMeetingStatus.ps1 index 9fb36d6..9e9c998 100644 --- a/PSZoom/Public/Meetings/Update-ZoomMeetingStatus.ps1 +++ b/PSZoom/Public/Meetings/Update-ZoomMeetingStatus.ps1 @@ -8,10 +8,7 @@ End a meeting by updating its status. The meeting ID. .PARAMETER Action The update action. Available actions: end. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingstatus .EXAMPLE @@ -37,20 +34,9 @@ function Update-ZoomMeetingStatus { Position = 1 )] [ValidateSet('end')] - [string]$Action = 'end', - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [string]$Action = 'end' ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $request = [System.UriBuilder]"https://api.zoom.us/v2/meetings/$MeetingId/status" @@ -60,7 +46,7 @@ function Update-ZoomMeetingStatus { $requestBody = $requestBody | ConvertTo-Json - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PUT -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PUT Write-Output $response } diff --git a/PSZoom/Public/Phone/Get-ZoomPhoneCallingPlans.ps1 b/PSZoom/Public/Phone/Get-ZoomPhoneCallingPlans.ps1 index d1d4cf3..ca75b78 100644 --- a/PSZoom/Public/Phone/Get-ZoomPhoneCallingPlans.ps1 +++ b/PSZoom/Public/Phone/Get-ZoomPhoneCallingPlans.ps1 @@ -6,11 +6,6 @@ List all Zoom Phone calling plans that are enabled for Account. .DESCRIPTION List all Zoom Phone calling plans that are enabled for Account. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/phone/listcallingplans @@ -18,26 +13,15 @@ https://marketplace.zoom.us/docs/api-reference/zoom-api/phone/listcallingplans .EXAMPLE Return the list of all Calling plans. Get-ZoomPhoneCallingPlans - #> function Get-ZoomPhoneCallingPlans { [CmdletBinding()] - param ( - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) + param () - begin { - #Generate Header with JWT (JSON Web Token) using the Api key/secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } process { $request = [System.UriBuilder]"https://api.zoom.us/v2/phone/calling_plans" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Phone/Get-ZoomPhoneSettingTemplate.ps1 b/PSZoom/Public/Phone/Get-ZoomPhoneSettingTemplate.ps1 index b69df7f..38bbedf 100644 --- a/PSZoom/Public/Phone/Get-ZoomPhoneSettingTemplate.ps1 +++ b/PSZoom/Public/Phone/Get-ZoomPhoneSettingTemplate.ps1 @@ -9,12 +9,6 @@ View the details of the Zoom Phone setting template. .PARAMETER TemplateId The TemplateID. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS An object with the Zoom API response. @@ -38,25 +32,14 @@ function Get-ZoomPhoneSettingTemplate { ValueFromPipelineByPropertyName = $True )] [Alias('id', 'template_id')] - [string[]]$TemplateId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string[]]$TemplateId + ) process { foreach ($id in $TemplateId) { $request = [System.UriBuilder]"https://api.zoom.us/v2/phone/setting_templates/$id" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Phone/Get-ZoomPhoneSettingTemplates.ps1 b/PSZoom/Public/Phone/Get-ZoomPhoneSettingTemplates.ps1 index 7dae5b6..3475d32 100644 --- a/PSZoom/Public/Phone/Get-ZoomPhoneSettingTemplates.ps1 +++ b/PSZoom/Public/Phone/Get-ZoomPhoneSettingTemplates.ps1 @@ -19,12 +19,6 @@ of available results exceeds the current page size. The expiration period for th .PARAMETER Full When using -Full switch, receive the full JSON Response to see the next_page_token. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/phone/listsettingtemplates @@ -40,7 +34,6 @@ Get-ZoomPhoneSettingTemplates Return the first page of Phone setting templates for SiteId, refer to Get-ZoomPhoneSites to find SiteId Get-ZoomPhoneSettingTemplates -Full Get-ZoomPhoneSettingTemplates -SiteId ###### -Full - #> function Get-ZoomPhoneSettingTemplates { @@ -63,19 +56,8 @@ function Get-ZoomPhoneSettingTemplates { # The next page token is used to paginate through large result sets. A next page token will be returned whenever the set of available results exceeds the current page size. The expiration period for this token is 15 minutes. [Alias('next_page_token')] - [string]$NextPageToken, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api key/secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$NextPageToken + ) process { $request = [System.UriBuilder]'https://api.zoom.us/v2/phone/setting_templates/' @@ -89,7 +71,7 @@ function Get-ZoomPhoneSettingTemplates { $request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET if ($Full) { Write-Output $response diff --git a/PSZoom/Public/Phone/Get-ZoomPhoneUser.ps1 b/PSZoom/Public/Phone/Get-ZoomPhoneUser.ps1 index 0ad306f..a78b6e7 100644 --- a/PSZoom/Public/Phone/Get-ZoomPhoneUser.ps1 +++ b/PSZoom/Public/Phone/Get-ZoomPhoneUser.ps1 @@ -9,11 +9,6 @@ View specific user Zoom Phone account. .PARAMETER UserId The user ID or email address. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. .OUTPUTS An object with the Zoom API response. @@ -37,25 +32,14 @@ function Get-ZoomPhoneUser { ValueFromPipelineByPropertyName = $True )] [Alias('email', 'emailaddress', 'id', 'user_id', 'ids', 'userids', 'emails', 'emailaddresses')] - [string[]]$UserId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string[]]$UserId + ) process { foreach ($id in $UserId) { $request = [System.UriBuilder]"https://api.zoom.us/v2/phone/users/$id" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Phone/Get-ZoomPhoneUserSettings.ps1 b/PSZoom/Public/Phone/Get-ZoomPhoneUserSettings.ps1 index 88f0ed9..ec47cf1 100644 --- a/PSZoom/Public/Phone/Get-ZoomPhoneUserSettings.ps1 +++ b/PSZoom/Public/Phone/Get-ZoomPhoneUserSettings.ps1 @@ -9,12 +9,6 @@ View specific user Zoom Phone profile settings. .PARAMETER UserId The user ID or email address. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS An object with the Zoom API response. @@ -37,25 +31,14 @@ function Get-ZoomPhoneUserSettings { ValueFromPipelineByPropertyName = $True )] [Alias('email', 'emailaddress', 'id', 'user_id', 'ids', 'userids', 'emails', 'emailaddresses', 'host_id')] - [string[]]$UserId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string[]]$UserId + ) process { foreach ($id in $UserId) { $request = [System.UriBuilder]"https://api.zoom.us/v2/phone/users/$id/settings" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Phone/Get-ZoomPhoneUsers.ps1 b/PSZoom/Public/Phone/Get-ZoomPhoneUsers.ps1 index 7e168c4..4133c98 100644 --- a/PSZoom/Public/Phone/Get-ZoomPhoneUsers.ps1 +++ b/PSZoom/Public/Phone/Get-ZoomPhoneUsers.ps1 @@ -19,12 +19,6 @@ of available results exceeds the current page size. The expiration period for th .PARAMETER Full When using -Full switch, receive the full JSON Response to see the next_page_token. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/phone/listphoneusers @@ -63,19 +57,8 @@ function Get-ZoomPhoneUsers { # The next page token is used to paginate through large result sets. A next page token will be returned whenever the set of available results exceeds the current page size. The expiration period for this token is 15 minutes. [Alias('next_page_token')] - [string]$NextPageToken, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api key/secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$NextPageToken + ) process { $request = [System.UriBuilder]'https://api.zoom.us/v2/phone/users/' @@ -89,7 +72,7 @@ function Get-ZoomPhoneUsers { $request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET if ($Full) { Write-Output $response diff --git a/PSZoom/Public/PhoneSite/Get-ZoomPhoneSite.ps1 b/PSZoom/Public/PhoneSite/Get-ZoomPhoneSite.ps1 index 6783b71..f9d5214 100644 --- a/PSZoom/Public/PhoneSite/Get-ZoomPhoneSite.ps1 +++ b/PSZoom/Public/PhoneSite/Get-ZoomPhoneSite.ps1 @@ -9,12 +9,6 @@ View specific site information in the Zoom Phone account. .PARAMETER SiteId The site ID. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS An object with the Zoom API response. @@ -37,25 +31,14 @@ function Get-ZoomPhoneSite { ValueFromPipelineByPropertyName = $True )] [Alias('id', 'site_id')] - [string[]]$SiteId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string[]]$SiteId + ) process { foreach ($id in $SiteId) { $request = [System.UriBuilder]"https://api.zoom.us/v2/phone/sites/$id" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/PhoneSite/Get-ZoomPhoneSites.ps1 b/PSZoom/Public/PhoneSite/Get-ZoomPhoneSites.ps1 index 739ab2e..2ebc9f5 100644 --- a/PSZoom/Public/PhoneSite/Get-ZoomPhoneSites.ps1 +++ b/PSZoom/Public/PhoneSite/Get-ZoomPhoneSites.ps1 @@ -16,11 +16,6 @@ of available results exceeds the current page size. The expiration period for th .PARAMETER Full When using -Full switch, receive the full JSON Response to see the next_page_token. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/phone-site/listphonesites @@ -55,7 +50,6 @@ Get-ZoomPhoneSites .EXAMPLE Return all Zoom phone sites with next page tokens. Get-ZoomPhoneSites -Full - #> function Get-ZoomPhoneSites { @@ -69,19 +63,9 @@ function Get-ZoomPhoneSites { # The next page token is used to paginate through large result sets. A next page token will be returned whenever the set of available results exceeds the current page size. The expiration period for this token is 15 minutes. [Alias('next_page_token')] - [string]$NextPageToken, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [string]$NextPageToken ) - begin { - #Generate Header with JWT (JSON Web Token) using the Api key/secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } process { $request = [System.UriBuilder]"https://api.zoom.us/v2/phone/sites" $query = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) @@ -91,7 +75,7 @@ function Get-ZoomPhoneSites { } $request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET if ($Full) { Write-Output $response diff --git a/PSZoom/Public/Reports/Get-ZoomActiveInactiveHostReports.ps1 b/PSZoom/Public/Reports/Get-ZoomActiveInactiveHostReports.ps1 index 42e991d..05b2eee 100644 --- a/PSZoom/Public/Reports/Get-ZoomActiveInactiveHostReports.ps1 +++ b/PSZoom/Public/Reports/Get-ZoomActiveInactiveHostReports.ps1 @@ -34,12 +34,6 @@ each page into the Users field of each report. The page size is set automaticall The next page token is used to paginate through large result sets. A next page token will be returned whenever the set of available results exceeds the current page size. The expiration period for this token is 15 minutes. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .EXAMPLE Get first page of inactive users in July of 2019. Get-ZoomActiveInactiveHostReports -from '2019-07-01' -to '2019-07-31' -page 1 -pagesize 300 @@ -118,16 +112,10 @@ function Get-ZoomActiveInactiveHostReports { [Parameter(ParameterSetName = 'Default')] [Parameter(ParameterSetName = 'CombineAllPages')] [Parameter(ParameterSetName = 'LastSixMonths')] - [string]$NextPageToken, - - [string]$ApiKey, - - [string]$ApiSecret + [string]$NextPageToken ) begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret [string]$From = $From.ToString('yyyy-MM-dd') [string]$To = $To.ToString('yyyy-MM-dd') } @@ -148,7 +136,7 @@ function Get-ZoomActiveInactiveHostReports { $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Reports/Get-ZoomCloudRecordingReport.ps1 b/PSZoom/Public/Reports/Get-ZoomCloudRecordingReport.ps1 index e538af9..d59e1a6 100644 --- a/PSZoom/Public/Reports/Get-ZoomCloudRecordingReport.ps1 +++ b/PSZoom/Public/Reports/Get-ZoomCloudRecordingReport.ps1 @@ -39,19 +39,8 @@ function Get-ZoomCloudRecordingReport { [string]$From, [ValidatePattern("([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))")] - [string]$To, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$To + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/report/cloud_recording" @@ -66,7 +55,7 @@ function Get-ZoomCloudRecordingReport { } $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/Reports/Get-ZoomDailyUsageReport.ps1 b/PSZoom/Public/Reports/Get-ZoomDailyUsageReport.ps1 index cf6da7b..85ce0da 100644 --- a/PSZoom/Public/Reports/Get-ZoomDailyUsageReport.ps1 +++ b/PSZoom/Public/Reports/Get-ZoomDailyUsageReport.ps1 @@ -13,11 +13,6 @@ The month. .PARAMETER Year The year. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. .EXAMPLE Get-ZoomDailyUsageReport -Year 2019 -Month 2 @@ -40,18 +35,9 @@ function Get-ZoomDailyUsageReport { Mandatory = $True, ValueFromPipelineByPropertyName = $True )] - [int]$Month, - - [string]$ApiKey, - - [string]$ApiSecret + [int]$Month ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/report/daily" @@ -71,7 +57,7 @@ function Get-ZoomDailyUsageReport { $Request.Query = $query.ToString() } - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Reports/Get-ZoomMeetingParticipantsReport.ps1 b/PSZoom/Public/Reports/Get-ZoomMeetingParticipantsReport.ps1 index 0a2aaac..d36a141 100644 --- a/PSZoom/Public/Reports/Get-ZoomMeetingParticipantsReport.ps1 +++ b/PSZoom/Public/Reports/Get-ZoomMeetingParticipantsReport.ps1 @@ -20,12 +20,6 @@ If a report has multiple pages this will loop through all pages automatically an each page into the Participants field of the report generated. The page size is set automatically to 300. The next page token is automatically passed from page to page. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .EXAMPLE Tabulate through each page with NextPageToken and export participants to CSV. @@ -70,18 +64,9 @@ function Get-ZoomMeetingParticipantsReport { [Parameter( ParameterSetName = 'CombineAllPages' )] - [switch]$CombineAllPages, - - [string]$ApiKey, - - [string]$ApiSecret + [switch]$CombineAllPages ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { if ($PsCmdlet.ParameterSetName -eq 'Default') { foreach ($id in $MeetingId) { @@ -91,7 +76,7 @@ function Get-ZoomMeetingParticipantsReport { $query.Add('next_page_token', $NextPageToken) $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Reports/Get-ZoomTelephoneReports.ps1 b/PSZoom/Public/Reports/Get-ZoomTelephoneReports.ps1 index 4df90d3..d09397f 100644 --- a/PSZoom/Public/Reports/Get-ZoomTelephoneReports.ps1 +++ b/PSZoom/Public/Reports/Get-ZoomTelephoneReports.ps1 @@ -28,12 +28,6 @@ from each page into the telephony_usage field of the report generated. The page Audio types: 1 - Toll-free Call-in & Call-out. The only option is 1. This defaults to 1. Note that Zoom documents this as a request parameter so it is included here. However it has no practical use at the moment. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .EXAMPLE Get-ZoomTelephoneReports -from '2019-07-01' -to '2019-07-31' -page 1 -pagesize 300 Get-ZoomTelephoneReports -ytd @@ -90,16 +84,10 @@ function Get-ZoomTelephoneReports { [Parameter(ParameterSetName = 'YearToDate')] [Alias('ytd')] - [switch]$YearToDate, - - [string]$ApiKey, - - [string]$ApiSecret + [switch]$YearToDate ) begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret if ($From) { [string]$From = $From.ToString('yyyy-MM-dd') } @@ -139,7 +127,7 @@ function Get-ZoomTelephoneReports { $query.Add('page_number', $PageNumber) $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Reports/Get-ZoomWebinarDetailsReport.ps1 b/PSZoom/Public/Reports/Get-ZoomWebinarDetailsReport.ps1 index 5fa9cd4..1df601e 100644 --- a/PSZoom/Public/Reports/Get-ZoomWebinarDetailsReport.ps1 +++ b/PSZoom/Public/Reports/Get-ZoomWebinarDetailsReport.ps1 @@ -9,12 +9,6 @@ Retrieve a report containing past webinar details. .PARAMETER WebinarId The webinar ID. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .EXAMPLE Get-ZoomWebinarDetailsReport 1234567890 @@ -33,23 +27,14 @@ function Get-ZoomWebinarDetailsReport { Position = 0 )] [Alias('id')] - [string[]]$WebinarId, - - [string]$ApiKey, - - [string]$ApiSecret + [string[]]$WebinarId ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { foreach ($id in $WebinarId) { $Request = [System.UriBuilder]"https://api.zoom.us/v2/report/webinars/$WebinarId" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Reports/Get-ZoomWebinarParticipantsReport.ps1 b/PSZoom/Public/Reports/Get-ZoomWebinarParticipantsReport.ps1 index 552be64..c66bb9b 100644 --- a/PSZoom/Public/Reports/Get-ZoomWebinarParticipantsReport.ps1 +++ b/PSZoom/Public/Reports/Get-ZoomWebinarParticipantsReport.ps1 @@ -13,12 +13,6 @@ The number of records returned within a single API call. The next page token is used to paginate through large result sets. A next page token will be returned whenever the set of available results exceeds the current page size. The expiration period for this token is 15 minutes. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .EXAMPLE Get-ZoomWebinarParticipantsReport 1234567890 @@ -49,18 +43,9 @@ function Get-ZoomWebinarParticipantsReport { [ValidateRange(1,300)] [int]$PageSize = 30, - [string]$NextPageToken, - - [string]$ApiKey, - - [string]$ApiSecret + [string]$NextPageToken ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { foreach ($id in $WebinarId) { $Request = [System.UriBuilder]"https://api.zoom.us/v2/report/webinars/$WebinarId/participants" @@ -73,7 +58,7 @@ function Get-ZoomWebinarParticipantsReport { $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Rooms/Connect-ZoomRoomMeeting.ps1 b/PSZoom/Public/Rooms/Connect-ZoomRoomMeeting.ps1 index 9fb46d9..d6a599a 100644 --- a/PSZoom/Public/Rooms/Connect-ZoomRoomMeeting.ps1 +++ b/PSZoom/Public/Rooms/Connect-ZoomRoomMeeting.ps1 @@ -30,12 +30,6 @@ Context-Type is "application/json" payload is {"request_id": 123, "meeting_numbe .PARAMETER JsonRPC A string specifying the version of the JSON-RPC protocol. Default is 2.0. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS JSON object that looks like: { @@ -98,19 +92,8 @@ function Connect-ZoomRoomMeeting { [string]$JsonRPC = '2.0', - [string]$Method = 'join', - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$Method = 'join' + ) process { foreach ($id in $RoomId) { @@ -139,7 +122,7 @@ function Connect-ZoomRoomMeeting { } $requestBody = ConvertTo-Json $requestBody -Depth 2 - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST Write-Output $response } diff --git a/PSZoom/Public/Rooms/Disconnect-ZoomRoomMeeting.ps1 b/PSZoom/Public/Rooms/Disconnect-ZoomRoomMeeting.ps1 index 7ced5e9..3f28285 100644 --- a/PSZoom/Public/Rooms/Disconnect-ZoomRoomMeeting.ps1 +++ b/PSZoom/Public/Rooms/Disconnect-ZoomRoomMeeting.ps1 @@ -14,12 +14,6 @@ The ID of the room that is leaving the meeting. .PARAMETER JsonRPC A string specifying the version of the JSON-RPC protocol. Default is 2.0. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS JSON object that looks like: { @@ -39,7 +33,6 @@ Disconnect-ZoomRoomMeeting dEaS6ZJZTOCBKL1oeyc9rA .EXAMPLE Disconnect-ZoomRoomMeeting -RoomId dEaS6ZJZTOCBKL1oeyc9rA - #> function Disconnect-ZoomRoomMeeting { @@ -56,19 +49,8 @@ function Disconnect-ZoomRoomMeeting { [string]$JsonRPC = '2.0', - [string]$Method = 'leave', - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$Method = 'leave' + ) process { foreach ($id in $RoomId) { @@ -80,7 +62,7 @@ function Disconnect-ZoomRoomMeeting { } $requestBody = ConvertTo-Json $requestBody -Depth 2 - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST Write-Output $response } diff --git a/PSZoom/Public/Rooms/Get-ZoomRoomDevices.ps1 b/PSZoom/Public/Rooms/Get-ZoomRoomDevices.ps1 index 4decb0d..553c2c3 100644 --- a/PSZoom/Public/Rooms/Get-ZoomRoomDevices.ps1 +++ b/PSZoom/Public/Rooms/Get-ZoomRoomDevices.ps1 @@ -9,12 +9,6 @@ Retrieve the ID, Room Name, Device Type, App Version, App Target Version Device .PARAMETER RoomID The Unique Identifier of the zoom room. This can be retrived from (List-ZoomRooms).id -.PARAMETER ApiKey -The API Key. - -.PARAMETER ApiSecret -The API Secret. - .OUTPUTS [ { @@ -41,6 +35,7 @@ https://marketplace.zoom.us/docs/api-reference/zoom-api/rooms/listzrdevices .EXAMPLE Get-ZoomRoomDevices -RoomID 'V5-1Nno-Sf-gtHn_k-GaRw' + #> function Get-ZoomRoomDevices { @@ -48,25 +43,14 @@ function Get-ZoomRoomDevices { param ( # The status of the Zoom Room [Parameter(Mandatory = $True)] - [string]$RoomID, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$RoomID + ) process { $request = [System.UriBuilder]"https://api.zoom.us/v2/rooms/$($RoomID)/devices" try { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers $headers -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers $headers -Method GET } catch { Write-Error -Message "$($_.Exception.Message)" -ErrorId $_.Exception.Code -Category InvalidOperation diff --git a/PSZoom/Public/Rooms/Get-ZoomRoomLocations.ps1 b/PSZoom/Public/Rooms/Get-ZoomRoomLocations.ps1 index d26fee5..e044e3b 100644 --- a/PSZoom/Public/Rooms/Get-ZoomRoomLocations.ps1 +++ b/PSZoom/Public/Rooms/Get-ZoomRoomLocations.ps1 @@ -18,11 +18,6 @@ The number of records returned within a single API call (Min 30 - MAX 300). The next page token is used to paginate through large result sets. A next page token will be returned whenever the set of available results exceeds the current page size. The expiration period for this token is 15 minutes. -.PARAMETER ApiKey -The API Key. - -.PARAMETER ApiSecret -The API Secret. .OUTPUTS When using -Full switch, receives JSON Response that looks like: @@ -44,6 +39,8 @@ https://marketplace.zoom.us/docs/api-reference/zoom-api/rooms-location/listzrloc .EXAMPLE Get-ZoomRoomLocations + +.EXAMPLE Get-ZoomRoomLocations -ParentLocationId "_AFlXw-FTwGS7BrO1QupVA" #> @@ -69,19 +66,8 @@ function Get-ZoomRoomLocations { [Alias('next_page_token')] [string]$NextPageToken, - [switch]$Full = $False, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [switch]$Full = $False + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/rooms/locations" @@ -98,7 +84,7 @@ function Get-ZoomRoomLocations { $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET if ($Full) { Write-Output $response diff --git a/PSZoom/Public/Rooms/Get-ZoomRooms.ps1 b/PSZoom/Public/Rooms/Get-ZoomRooms.ps1 index b4d243f..a8f1bf1 100644 --- a/PSZoom/Public/Rooms/Get-ZoomRooms.ps1 +++ b/PSZoom/Public/Rooms/Get-ZoomRooms.ps1 @@ -26,12 +26,6 @@ of available results exceeds the current page size. The expiration period for th .PARAMETER LocationID Parent location ID of the Zoom Room -.PARAMETER ApiKey -The API Key. - -.PARAMETER ApiSecret -The API Secret. - .OUTPUTS When using -Full switch, receives JSON Response that looks like: { @@ -72,11 +66,13 @@ When not using -Full, a JSON response that looks like: "status": "Available" } ] + .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/rooms/listzoomrooms .EXAMPLE List-ZoomRooms + #> function Get-ZoomRooms { @@ -113,19 +109,8 @@ function Get-ZoomRooms { [Alias('location_id')] [string]$LocationId, - [switch]$Full = $False, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [switch]$Full = $False + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/rooms" @@ -147,7 +132,7 @@ function Get-ZoomRooms { $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET if ($Full) { Write-Output $response diff --git a/PSZoom/Public/Rooms/Get-ZoomRoomsDashboard.ps1 b/PSZoom/Public/Rooms/Get-ZoomRoomsDashboard.ps1 index af7c364..fa46add 100644 --- a/PSZoom/Public/Rooms/Get-ZoomRoomsDashboard.ps1 +++ b/PSZoom/Public/Rooms/Get-ZoomRoomsDashboard.ps1 @@ -13,12 +13,6 @@ The number of records returned within a single API call (Min 30 - MAX 300) The next page token is used to paginate through large result sets. A next page token will be returned whenever the set of available results exceeds the current page size. The expiration period for this token is 15 minutes. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS { "page_count": 1, @@ -87,19 +81,8 @@ function Get-ZoomRoomsDashboard { [Alias('next_page_token')] [string]$NextPageToken, - [switch]$Full = $False, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [switch]$Full = $False + ) process { $request = [System.UriBuilder]"https://api.zoom.us/v2/metrics/zoomrooms" @@ -113,7 +96,7 @@ function Get-ZoomRoomsDashboard { $request.Query = $query.ToString() try { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers $headers -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers $headers -Method GET } catch { Write-Error -Message "$($_.Exception.Message)" -ErrorId $_.Exception.Code -Category InvalidOperation } diff --git a/PSZoom/Public/Rooms/New-ZoomRoomInvite.ps1 b/PSZoom/Public/Rooms/New-ZoomRoomInvite.ps1 index fcd23e5..c54e434 100644 --- a/PSZoom/Public/Rooms/New-ZoomRoomInvite.ps1 +++ b/PSZoom/Public/Rooms/New-ZoomRoomInvite.ps1 @@ -16,12 +16,6 @@ For example ["kYAJ5yMfTCe0npL2_w3agw","jAXKRO6yRZWkdkZxbUuI_Q"] .PARAMETER JsonRPC A string specifying the version of the JSON-RPC protocol. Default is 2.0. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS JSON object that looks like: { @@ -73,19 +67,8 @@ function New-ZoomRoomInvite { [string]$JsonRPC = '2.0', - [string]$Method = 'restart', - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$Method = 'restart' + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/rooms/$RoomId/zrclient" @@ -97,7 +80,7 @@ function New-ZoomRoomInvite { } $requestBody = ConvertTo-Json $requestBody -Depth 2 - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST Write-Output $response } diff --git a/PSZoom/Public/Rooms/New-ZoomRoomMeeting.ps1 b/PSZoom/Public/Rooms/New-ZoomRoomMeeting.ps1 index 47fac5d..d7a5513 100644 --- a/PSZoom/Public/Rooms/New-ZoomRoomMeeting.ps1 +++ b/PSZoom/Public/Rooms/New-ZoomRoomMeeting.ps1 @@ -37,12 +37,6 @@ Context-Type is "application/json" payload is {"request_id": 123, "meeting_numbe .PARAMETER JsonRPC A string specifying the version of the JSON-RPC protocol. Default is 2.0. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS JSON object that looks like: { @@ -111,19 +105,8 @@ function New-ZoomRoomMeeting { [string]$JsonRPC = '2.0', - [string]$Method = 'meetingSchedule', - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$Method = 'meetingSchedule' + ) process { foreach ($id in $RoomId) { @@ -158,7 +141,7 @@ function New-ZoomRoomMeeting { } $requestBody = ConvertTo-Json $requestBody -Depth 2 - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST Write-Output $response } diff --git a/PSZoom/Public/Rooms/Remove-ZoomRoomMeeting.ps1 b/PSZoom/Public/Rooms/Remove-ZoomRoomMeeting.ps1 index d712c2e..c744538 100644 --- a/PSZoom/Public/Rooms/Remove-ZoomRoomMeeting.ps1 +++ b/PSZoom/Public/Rooms/Remove-ZoomRoomMeeting.ps1 @@ -45,12 +45,6 @@ Context-Type is "application/json" payload is {"request_id": 123, "meeting_numbe .PARAMETER JsonRPC A string specifying the version of the JSON-RPC protocol. Default is 2.0. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS JSON object that looks like: { @@ -118,19 +112,8 @@ function Remove-ZoomRoomMeeting { [string]$JsonRPC = '2.0', - [string]$Method = 'meetingCancel', - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$Method = 'meetingCancel' + ) process { foreach ($Number in $MeetingNumber) { @@ -154,7 +137,7 @@ function Remove-ZoomRoomMeeting { } $requestBody = ConvertTo-Json $requestBody -Depth 2 - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST Write-Output $response } diff --git a/PSZoom/Public/Rooms/Restart-ZoomRoom.ps1 b/PSZoom/Public/Rooms/Restart-ZoomRoom.ps1 index ccf6182..1156a41 100644 --- a/PSZoom/Public/Rooms/Restart-ZoomRoom.ps1 +++ b/PSZoom/Public/Rooms/Restart-ZoomRoom.ps1 @@ -12,12 +12,6 @@ The ID of the room that is restarting. .PARAMETER JsonRPC A string specifying the version of the JSON-RPC protocol. Default is 2.0. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS JSON object that looks like: { @@ -58,19 +52,8 @@ function Restart-ZoomRoom { [string]$JsonRPC = '2.0', - [string]$Method = 'restart', - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$Method = 'restart' + ) process { foreach ($id in $RoomId) { @@ -82,7 +65,7 @@ function Restart-ZoomRoom { } $requestBody = ConvertTo-Json $requestBody -Depth 2 - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST Write-Output $response } diff --git a/PSZoom/Public/Rooms/Stop-ZoomRoomMeeting.ps1 b/PSZoom/Public/Rooms/Stop-ZoomRoomMeeting.ps1 index 0a626d5..8d32b5a 100644 --- a/PSZoom/Public/Rooms/Stop-ZoomRoomMeeting.ps1 +++ b/PSZoom/Public/Rooms/Stop-ZoomRoomMeeting.ps1 @@ -12,12 +12,6 @@ The ID of the room that is restarting. .PARAMETER JsonRPC A string specifying the version of the JSON-RPC protocol. Default is 2.0. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS JSON object that looks like: { @@ -56,19 +50,8 @@ function Stop-ZoomRoomMeeting { [string]$JsonRPC = '2.0', - [string]$Method = 'end', - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Headers and JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$Method = 'end' + ) process { foreach ($id in $RoomId) { @@ -80,7 +63,7 @@ function Stop-ZoomRoomMeeting { } $requestBody = ConvertTo-Json $requestBody -Depth 2 - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST Write-Output $response } diff --git a/PSZoom/Public/Users/Add-ZoomUserAssistants.ps1 b/PSZoom/Public/Users/Add-ZoomUserAssistants.ps1 index 1c0483c..9f34692 100644 --- a/PSZoom/Public/Users/Add-ZoomUserAssistants.ps1 +++ b/PSZoom/Public/Users/Add-ZoomUserAssistants.ps1 @@ -15,12 +15,6 @@ The ID of the assistant. If using an assistant's ID, an email is not needed. .PARAMETER AssistantEmail The email of the assistant. If using an assistant's Email, an id is not needed. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .EXAMPLE Add an assistant to a user. Add-ZoomUserAssistants -UserId 'dsidious@thesith.com' -AssistantEmail 'dmaul@thesith.com' @@ -61,20 +55,9 @@ function Add-ZoomUserAssistants { [Alias('assistantids')] [string[]]$AssistantId, - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, - [switch]$Passthru ) - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { foreach ($Id in $UserId) { $request = [System.UriBuilder]"https://api.zoom.us/v2/users/$Id/assistants" @@ -94,7 +77,7 @@ function Add-ZoomUserAssistants { } $requestBody = $requestBody | ConvertTo-Json - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST if ($Passthru) { diff --git a/PSZoom/Public/Users/Get-ZoomPersonalMeetingRoomName.ps1 b/PSZoom/Public/Users/Get-ZoomPersonalMeetingRoomName.ps1 index 0453aca..996b82c 100644 --- a/PSZoom/Public/Users/Get-ZoomPersonalMeetingRoomName.ps1 +++ b/PSZoom/Public/Users/Get-ZoomPersonalMeetingRoomName.ps1 @@ -9,12 +9,6 @@ Check if the user’s personal meeting room name exists. .PARAMETER VanityName Personal meeting room name. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS An object with the Zoom API response. @@ -24,7 +18,6 @@ Get-ZoomPersonalMeetingRoomName 'Joes Room' .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/users/uservanityname - #> function Get-ZoomPersonalMeetingRoomName { @@ -37,19 +30,8 @@ function Get-ZoomPersonalMeetingRoomName { ValueFromPipelineByPropertyName = $True )] [Alias('vanity_name', 'vanitynames')] - [string[]]$VanityName, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string[]]$VanityName + ) process { foreach ($name in $VanityName) { @@ -60,7 +42,7 @@ function Get-ZoomPersonalMeetingRoomName { $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Users/Get-ZoomUser.ps1 b/PSZoom/Public/Users/Get-ZoomUser.ps1 index 8bdc7fd..d25479a 100644 --- a/PSZoom/Public/Users/Get-ZoomUser.ps1 +++ b/PSZoom/Public/Users/Get-ZoomUser.ps1 @@ -32,12 +32,6 @@ You can use the number or corresponding text (e.g. 'FacebookOauth' or '0'). Whether the email address passed for the $UserId value is an encrypted email address. Add the -EncryptedEmail switch to specify this is $True. -.PARAMETER ApiKey -The API Key. - -.PARAMETER ApiSecret -The API Secret. - .OUTPUTS An object with the Zoom API response. @@ -52,7 +46,6 @@ Get-ZoomMeeting 123456789 | Select-Object host_id | Get-ZoomUser .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/users/user - #> function Get-ZoomUser { @@ -71,20 +64,9 @@ function Get-ZoomUser { [string]$LoginType, [Alias('encrypted_email')] - [switch]$EncryptedEmail, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [switch]$EncryptedEmail ) - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { foreach ($id in $UserId) { $request = [System.UriBuilder]"https://api.zoom.us/v2/users/$id" @@ -100,7 +82,7 @@ function Get-ZoomUser { } $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Users/Get-ZoomUserAssistants.ps1 b/PSZoom/Public/Users/Get-ZoomUserAssistants.ps1 index b7b28d7..c8b7c9f 100644 --- a/PSZoom/Public/Users/Get-ZoomUserAssistants.ps1 +++ b/PSZoom/Public/Users/Get-ZoomUserAssistants.ps1 @@ -9,19 +9,12 @@ List user assistants. .PARAMETER UserId The user ID or email address. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .EXAMPLE Get-ZoomUserAssistants jmcevoy@lawfirm.com .OUTPUTS A hastable with the Zoom API response. - #> function Get-ZoomUserAssistants { @@ -34,25 +27,14 @@ function Get-ZoomUserAssistants { ValueFromPipelineByPropertyName = $True )] [Alias('Email', 'EmailAddress', 'Id', 'user_id', 'userids', 'ids', 'emailaddresses','emails')] - [string[]]$UserId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string[]]$UserId + ) process { foreach ($id in $UserId) { $Request = [System.UriBuilder]"https://api.zoom.us/v2/users/$Id/assistants" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Users/Get-ZoomUserEmailStatus.ps1 b/PSZoom/Public/Users/Get-ZoomUserEmailStatus.ps1 index c653c27..c51d30a 100644 --- a/PSZoom/Public/Users/Get-ZoomUserEmailStatus.ps1 +++ b/PSZoom/Public/Users/Get-ZoomUserEmailStatus.ps1 @@ -9,12 +9,6 @@ Verify if a user’s email is registered with Zoom. .PARAMETER Email The email address to be verified. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .EXAMPLE Get-ZoomUserEmailStatus jsmith@lawfirm.com @@ -24,7 +18,6 @@ https://marketplace.zoom.us/docs/api-reference/zoom-api/users/useremail .OUTPUTS A hastable with the Zoom API response. - #> function Get-ZoomUserEmailStatus { @@ -36,28 +29,15 @@ function Get-ZoomUserEmailStatus { ValueFromPipeline = $True )] [Alias('EmailAddress', 'Id', 'UserId')] - [string]$Email, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$Email + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/users/email" $query = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) $query.Add('email', $Email) $Request.Query = $query.ToString() - - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret - + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Users/Get-ZoomUserPermissions.ps1 b/PSZoom/Public/Users/Get-ZoomUserPermissions.ps1 index 0578027..102afa2 100644 --- a/PSZoom/Public/Users/Get-ZoomUserPermissions.ps1 +++ b/PSZoom/Public/Users/Get-ZoomUserPermissions.ps1 @@ -9,11 +9,6 @@ Retrieve a user’s permissions. .PARAMETER UserId The user ID or email address. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. .OUTPUTS A hastable with the Zoom API response. @@ -23,7 +18,6 @@ Get-ZoomUserPermissions jsmith@lawfirm.com .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/users/userpermission - #> function Get-ZoomUserPermissions { @@ -36,25 +30,12 @@ function Get-ZoomUserPermissions { ValueFromPipelineByPropertyName = $True )] [Alias('Email', 'EmailAddress', 'Id', 'user_id')] - [string]$UserId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$UserId + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/users/$UserId/permissions" - - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret - + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Users/Get-ZoomUserSchedulers.ps1 b/PSZoom/Public/Users/Get-ZoomUserSchedulers.ps1 index 43dc89f..70765ce 100644 --- a/PSZoom/Public/Users/Get-ZoomUserSchedulers.ps1 +++ b/PSZoom/Public/Users/Get-ZoomUserSchedulers.ps1 @@ -9,12 +9,6 @@ List user schedulers. .PARAMETER UserId The user ID or email address. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS A hastable with the Zoom API response. @@ -36,25 +30,12 @@ function Get-ZoomUserSchedulers { ValueFromPipelineByPropertyName = $True )] [Alias('Email', 'EmailAddress', 'Id', 'user_id')] - [string]$UserId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [string]$UserId ) - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/users/$UserId/schedulers" - - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret - + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Users/Get-ZoomUserSettings.ps1 b/PSZoom/Public/Users/Get-ZoomUserSettings.ps1 index 046feba..0111004 100644 --- a/PSZoom/Public/Users/Get-ZoomUserSettings.ps1 +++ b/PSZoom/Public/Users/Get-ZoomUserSettings.ps1 @@ -28,12 +28,6 @@ The following login methods are only available in China: You can use the number or corresponding text (e.g. 'FacebookOauth' or '0'). -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS A hastable with the Zoom API response. @@ -43,7 +37,6 @@ Get-ZoomUserSettings jsmith@lawfirm.com .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/users/usersettings - #> function Get-ZoomUserSettings { @@ -60,19 +53,8 @@ function Get-ZoomUserSettings { [Parameter(ValueFromPipelineByPropertyName = $True)] [Alias('login_type')] - [string]$LoginType, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$LoginType + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/users/$UserId/settings" @@ -84,7 +66,7 @@ function Get-ZoomUserSettings { $Request.Query = $query.ToString() } - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response } diff --git a/PSZoom/Public/Users/Get-ZoomUserToken.ps1 b/PSZoom/Public/Users/Get-ZoomUserToken.ps1 index bd5bd44..8ecbba4 100644 --- a/PSZoom/Public/Users/Get-ZoomUserToken.ps1 +++ b/PSZoom/Public/Users/Get-ZoomUserToken.ps1 @@ -14,12 +14,6 @@ Token - Used for starting meeting with client SDK. ZPK - Used for generating the start meeting url. (Deprecated) ZAP - Used for generating the start meeting url. The expiration time is two hours. For API users, the expiration time is 90 days. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS A hastable with the Zoom API response. @@ -45,19 +39,8 @@ function Get-ZoomUserToken { [Parameter(ValueFromPipelineByPropertyName = $True)] [ValidateSet('token', 'zpk', 'zap')] - [string]$Type, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string]$Type + ) process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/users/$UserId/token" @@ -68,7 +51,7 @@ function Get-ZoomUserToken { $Request.Query = $query.ToString() } - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET Write-Output $response diff --git a/PSZoom/Public/Users/Get-ZoomUsers.ps1 b/PSZoom/Public/Users/Get-ZoomUsers.ps1 index 0619799..ccec6f9 100644 --- a/PSZoom/Public/Users/Get-ZoomUsers.ps1 +++ b/PSZoom/Public/Users/Get-ZoomUsers.ps1 @@ -27,12 +27,6 @@ Returns all pages. The default API response returns the first page of users. Thi and puts them together then returns all of the results. This only returns the inputted status (ie, only active, inactive or pending). -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/users/users @@ -55,6 +49,7 @@ Get-ZoomUsers -AllPages .EXAMPLE Return all inactive users. Get-ZoomUsers -Status Inactive -AllPages + #> function Get-ZoomUsers { @@ -131,19 +126,8 @@ function Get-ZoomUsers { ParameterSetName = 'All', Mandatory = $True )] - [switch]$AllPages, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api key/secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [switch]$AllPages + ) process { $Request = [System.UriBuilder]'https://api.zoom.us/v2/users/' @@ -158,7 +142,7 @@ function Get-ZoomUsers { $Request.Query = $query.ToString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method GET if ($FullApiResponse) { diff --git a/PSZoom/Public/Users/New-ZoomUser.ps1 b/PSZoom/Public/Users/New-ZoomUser.ps1 index acc8dba..56a906d 100644 --- a/PSZoom/Public/Users/New-ZoomUser.ps1 +++ b/PSZoom/Public/Users/New-ZoomUser.ps1 @@ -34,17 +34,11 @@ User password. Only used for the "autoCreate" function. The password has to have It must have at least one letter (a, b, c..), at least one number (1, 2, 3...) and include both uppercase and lowercase letters. It should not contain only one identical character repeatedly ('11111111' or 'aaaaaaaa') and it cannot contain consecutive characters ('12345678' or 'abcdefgh'). -.PARAMETER ApiKey -The API key. - -.PARAMETER ApiSecret -THe API secret. - .OUTPUTS An object with the Zoom API response. .EXAMPLE -New-ZoomUser -Action ssoCreate -Email jsmith@lawfirm.com -Type Pro -FirstName Joseph -LastName Smith -ApiKey $ApiKey -ApiSecret $ApiSecret +New-ZoomUser -Action ssoCreate -Email jsmith@lawfirm.com -Type Pro -FirstName Joseph -LastName Smith .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/users/usercreate @@ -89,20 +83,9 @@ function New-ZoomUser { [Parameter(ValueFromPipelineByPropertyName = $True)] [string]$Password, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, [switch]$Passthru ) - - begin { - #Generate Headers with JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } process { $request = [System.UriBuilder]'https://api.zoom.us/v2/users' @@ -164,7 +147,7 @@ function New-ZoomUser { $requestBody = $requestBody | ConvertTo-Json if ($PScmdlet.ShouldProcess) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method POST if ($passthru) { Write-Output $Email diff --git a/PSZoom/Public/Users/Remove-ZoomSpecificUserAssistant.ps1 b/PSZoom/Public/Users/Remove-ZoomSpecificUserAssistant.ps1 index 3ef70e9..48f5fc8 100644 --- a/PSZoom/Public/Users/Remove-ZoomSpecificUserAssistant.ps1 +++ b/PSZoom/Public/Users/Remove-ZoomSpecificUserAssistant.ps1 @@ -9,12 +9,6 @@ Delete a specific assistant. Assistants are the users to whom the current user h .PARAMETER UserId The user ID or email address. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS A hastable with the Zoom API response. @@ -44,25 +38,14 @@ function Remove-ZoomSpecificUserAssistant { ValueFromPipelineByPropertyName = $True )] [Alias('assistant_id')] - [string[]]$AssistantId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret - ) - - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + [string[]]$AssistantId + ) process { foreach ($id in $UserId) { foreach ($aid in $AssistantId) { $request = [System.UriBuilder]"https://api.zoom.us/v2/users/$id/assistants/$aid" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method DELETE -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method DELETE Write-Output $response } diff --git a/PSZoom/Public/Users/Remove-ZoomSpecificUserScheduler.ps1 b/PSZoom/Public/Users/Remove-ZoomSpecificUserScheduler.ps1 index 825dab2..0f96674 100644 --- a/PSZoom/Public/Users/Remove-ZoomSpecificUserScheduler.ps1 +++ b/PSZoom/Public/Users/Remove-ZoomSpecificUserScheduler.ps1 @@ -12,12 +12,6 @@ The user ID or email address. .PARAMETER SchedulerId The scheduler ID or email address. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS No output. Can use Passthru switch to pass UserId to output. @@ -49,27 +43,16 @@ function Remove-ZoomSpecificUserScheduler { [Alias('scheduler_id')] [string[]]$SchedulerId, - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, - [switch]$Passthru ) - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { foreach ($user in $UserId) { foreach ($scheduler in $schedulerId) { if ($PScmdlet.ShouldProcess($user, "Remove $scheduler")) { $request = [System.UriBuilder]"https://api.zoom.us/v2/users/$user/schedulers/$scheduler" - Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method DELETE -ApiKey $ApiKey -ApiSecret $ApiSecret + Invoke-ZoomRestMethod -Uri $request.Uri -Method DELETE if ($Passthru) { Write-Output $UserId diff --git a/PSZoom/Public/Users/Remove-ZoomUser.ps1 b/PSZoom/Public/Users/Remove-ZoomUser.ps1 index 4a3320c..3635861 100644 --- a/PSZoom/Public/Users/Remove-ZoomUser.ps1 +++ b/PSZoom/Public/Users/Remove-ZoomUser.ps1 @@ -24,12 +24,6 @@ Transfer webinar. .PARAMETER TransferRecording Transfer recording. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS No output. Can use Passthru switch to pass UserId to output. @@ -73,20 +67,9 @@ function Remove-ZoomUser { [Alias('transfer_recording')] [switch]$TransferRecording, - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, - [switch]$Passthru ) - begin { - #Generate Headers with JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { foreach ($user in $UserId) { $request = [System.UriBuilder]"https://api.zoom.us/v2/users/$user" @@ -112,7 +95,7 @@ function Remove-ZoomUser { $request.Query = $query.ToString().ToLower() if ($PScmdlet.ShouldProcess($user, 'Remove')) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method DELETE -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method DELETE if ($Passthru) { Write-Output $UserId diff --git a/PSZoom/Public/Users/Remove-ZoomUserAssistants.ps1 b/PSZoom/Public/Users/Remove-ZoomUserAssistants.ps1 index f6a76dc..fa861c8 100644 --- a/PSZoom/Public/Users/Remove-ZoomUserAssistants.ps1 +++ b/PSZoom/Public/Users/Remove-ZoomUserAssistants.ps1 @@ -9,12 +9,6 @@ Delete all user assistants. Assistants are the users to whom the current user ha .PARAMETER UserId The user ID or email address. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS No output. Can use Passthru switch to pass UserId to output. @@ -38,25 +32,14 @@ function Remove-ZoomUserAssistants { [Alias('Email', 'EmailAddress', 'Id', 'user_id')] [string[]]$UserId, - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, - [switch]$Passthru ) - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { foreach ($user in $UserId) { $Request = [System.UriBuilder]"https://api.zoom.us/v2/users/$user/assistants" - Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method DELETE -ApiKey $ApiKey -ApiSecret $ApiSecret + Invoke-ZoomRestMethod -Uri $request.Uri -Method DELETE if ($Passthru) { Write-Output $UserId diff --git a/PSZoom/Public/Users/Remove-ZoomUserSchedulers.ps1 b/PSZoom/Public/Users/Remove-ZoomUserSchedulers.ps1 index e73b001..404154b 100644 --- a/PSZoom/Public/Users/Remove-ZoomUserSchedulers.ps1 +++ b/PSZoom/Public/Users/Remove-ZoomUserSchedulers.ps1 @@ -9,12 +9,6 @@ Delete all user schedulers. Schedulers are the users to whom the current user ha .PARAMETER UserId The user ID or email address. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS No output. Can use Passthru switch to pass UserId to output. @@ -24,7 +18,6 @@ Remove-ZoomUserSchedulers jmcevoy@lawfirm.com .LINK https://marketplace.zoom.us/docs/api-reference/zoom-api/users/userschedulersdelete - #> function Remove-ZoomUserSchedulers { @@ -39,25 +32,14 @@ function Remove-ZoomUserSchedulers { [Alias('Email', 'EmailAddress', 'Id', 'user_id')] [string[]]$UserId, - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, - [switch]$Passthru ) - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { foreach ($user in $UserId) { $Request = [System.UriBuilder]"https://api.zoom.us/v2/users/$user/schedulers" - Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method DELETE -ApiKey $ApiKey -ApiSecret $ApiSecret + Invoke-ZoomRestMethod -Uri $request.Uri -Method DELETE if ($Passthru) { Write-Output $UserId diff --git a/PSZoom/Public/Users/Revoke-ZoomUserSsoToken.ps1 b/PSZoom/Public/Users/Revoke-ZoomUserSsoToken.ps1 index cc6f92f..6f3a27c 100644 --- a/PSZoom/Public/Users/Revoke-ZoomUserSsoToken.ps1 +++ b/PSZoom/Public/Users/Revoke-ZoomUserSsoToken.ps1 @@ -9,12 +9,6 @@ Revoke a user’s SSO token. .PARAMETER UserId The user ID or email address. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS No output. Can use Passthru switch to pass UserId to output. @@ -37,25 +31,14 @@ function Revoke-ZoomUserSsoToken { )] [Alias('Email', 'EmailAddress', 'Id', 'user_id')] [string[]]$UserId, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, [switch]$Passthru ) - begin { - #Generate Header with JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { foreach ($user in $UserId) { $request = [System.UriBuilder]"https://api.zoom.us/v2/users/$user/token" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Method DELETE -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Method DELETE if ($Passthru) { Write-Output $UserId diff --git a/PSZoom/Public/Users/Update-ZoomProfilePicture.ps1 b/PSZoom/Public/Users/Update-ZoomProfilePicture.ps1 index e54acd2..ba0c8f4 100644 --- a/PSZoom/Public/Users/Update-ZoomProfilePicture.ps1 +++ b/PSZoom/Public/Users/Update-ZoomProfilePicture.ps1 @@ -8,10 +8,7 @@ Upload a user’s profile picture. The user ID or email address. .PARAMETER FileName The path to the file to be uploaded. -.PARAMETER ApiKey -The Api Key. -.PARAMETER ApiSecret -The Api Secret. + .OUTPUTS A hastable with the Zoom API response. .EXAMPLE @@ -39,20 +36,9 @@ function Update-ZoomProfilePicture { Position = 1 )] [ValidateScript({Test-Path -Path $_})] - [string]$FileName, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [string]$FileName ) - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { foreach ($user in $UserId) { $request = [System.UriBuilder]"https://api.zoom.us/v2/users/$user/picture" @@ -76,7 +62,7 @@ function Update-ZoomProfilePicture { "--$boundary--" ) -join $LF - $response = Invoke-ZoomRestMethod -Uri $request.Uri -ContentType "multipart/form-data; boundary=`"$boundary`"" -Headers ([ref]$headers) -Body $requestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -ContentType "multipart/form-data; boundary=`"$boundary`"" -Body $requestBody -Method POST Write-Output $response } diff --git a/PSZoom/Public/Users/Update-ZoomUser.ps1 b/PSZoom/Public/Users/Update-ZoomUser.ps1 index a4897a5..d676d70 100644 --- a/PSZoom/Public/Users/Update-ZoomUser.ps1 +++ b/PSZoom/Public/Users/Update-ZoomUser.ps1 @@ -72,18 +72,12 @@ Deprecated: Country ID of the phone number. eg. AU for Australia. .PARAMETER GroupID Unique identifier of the group that you would like to add a pending user to. -.PARAMETER ApiKey -The API key. - -.PARAMETER ApiSecret -THe API secret. - .OUTPUTS No output. Can use Passthru switch to pass UserId to output. .EXAMPLE Update a user's name. -Update-ZoomUser -UserId askywakler@thejedi.com -Type Pro -FirstName Anakin -LastName Skywalker -ApiKey $ApiKey -ApiSecret $ApiSecret +Update-ZoomUser -UserId askywakler@thejedi.com -Type Pro -FirstName Anakin -LastName Skywalker .EXAMPLE Update the host key of all users that have 'jedi' in their email. @@ -181,19 +175,10 @@ function Update-ZoomUser { [Alias('group_id')] [string]$GroupID, - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, - [switch]$PassThru ) - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + process { foreach ($user in $UserId) { @@ -249,7 +234,7 @@ function Update-ZoomUser { $RequestBody = $RequestBody | ConvertTo-Json if ($pscmdlet.ShouldProcess) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PATCH -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PATCH if (-not $PassThru) { Write-Output $response diff --git a/PSZoom/Public/Users/Update-ZoomUserEmail.ps1 b/PSZoom/Public/Users/Update-ZoomUserEmail.ps1 index 30f400e..d28686a 100644 --- a/PSZoom/Public/Users/Update-ZoomUserEmail.ps1 +++ b/PSZoom/Public/Users/Update-ZoomUserEmail.ps1 @@ -12,12 +12,6 @@ The user ID or email address. .PARAMETER Email User's email. The length should be less than 128 characters. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS No output. Can use Passthru switch to pass UserId to output. @@ -49,20 +43,9 @@ function Update-ZoomUserEmail { [ValidateLength(0,128)] [string]$Email, - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, - [switch]$Passthru ) - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $request = [System.UriBuilder]"https://api.zoom.us/v2/users/$UserId/email" @@ -72,7 +55,7 @@ function Update-ZoomUserEmail { $requestBody = $requestBody | ConvertTo-Json - Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PUT -ApiKey $ApiKey -ApiSecret $ApiSecret + Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PUT if ($Passthru) { Write-Output $UserId diff --git a/PSZoom/Public/Users/Update-ZoomUserPassword.ps1 b/PSZoom/Public/Users/Update-ZoomUserPassword.ps1 index b5f39fb..4fb4d5b 100644 --- a/PSZoom/Public/Users/Update-ZoomUserPassword.ps1 +++ b/PSZoom/Public/Users/Update-ZoomUserPassword.ps1 @@ -12,12 +12,6 @@ The user ID or email address. .PARAMETER Password User password. Minimum of 8 characters. Maximum of 31 characters. -.PARAMETER ApiKey -The API key. - -.PARAMETER ApiSecret -THe API secret. - .OUTPUTS No output. Can use Passthru switch to pass the UserId as an output. @@ -50,19 +44,10 @@ function Update-ZoomUserpassword { [ValidateLength(8,31)] [string]$Password, - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, - [switch]$PassThru ) - begin { - #Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } + process { foreach ($user in $UserId){ @@ -74,7 +59,7 @@ function Update-ZoomUserpassword { $requestBody = $requestBody | ConvertTo-Json if ($PSCmdlet.ShouldProcess) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PUT -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PUT if (-not $PassThru) { Write-Output $response diff --git a/PSZoom/Public/Users/Update-ZoomUserSettings.ps1 b/PSZoom/Public/Users/Update-ZoomUserSettings.ps1 index 5d7cdc4..0ef19e5 100644 --- a/PSZoom/Public/Users/Update-ZoomUserSettings.ps1 +++ b/PSZoom/Public/Users/Update-ZoomUserSettings.ps1 @@ -797,19 +797,8 @@ function Update-ZoomUserSettings { [Alias('feature_show_international_numbers_link_tsp')] [bool]$ShowInternationalNumbersLinkTsp, - [switch]$PassThru, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey + [switch]$PassThru ) - - begin { - # Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } process { foreach ($user in $UserId) { @@ -956,7 +945,7 @@ function Update-ZoomUserSettings { $requestBody = $requestBody | ConvertTo-Json if ($pscmdlet.ShouldProcess) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PATCH -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PATCH if (-not $PassThru) { Write-Output $response diff --git a/PSZoom/Public/Users/Update-ZoomUserStatus.ps1 b/PSZoom/Public/Users/Update-ZoomUserStatus.ps1 index 5c555aa..c58612d 100644 --- a/PSZoom/Public/Users/Update-ZoomUserStatus.ps1 +++ b/PSZoom/Public/Users/Update-ZoomUserStatus.ps1 @@ -14,12 +14,6 @@ The action types: Activate - Set user status to active. Deactivate - Set user status to inactive. -.PARAMETER ApiKey -The API key. - -.PARAMETER ApiSecret -THe API secret. - .OUTPUTS No output. Can use Passthru switch to pass the UserId as an output. @@ -52,19 +46,8 @@ function Update-ZoomUserStatus { [ValidateSet('activate', 'deactivate')] [string]$Action, - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret, - [switch]$PassThru ) - - begin { - # Generate Header with JWT (JSON Web Token) using the Api Key/Secret - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } process { foreach ($user in $UserId) { @@ -76,7 +59,7 @@ function Update-ZoomUserStatus { $requestBody = $requestBody | ConvertTo-Json if ($PScmdlet.ShouldProcess($user, $Action)) { - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PUT -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $requestBody -Method PUT if ($PassThru) { Write-Output $UserId diff --git a/PSZoom/Public/Utils/Connect-PSZoom.ps1 b/PSZoom/Public/Utils/Connect-PSZoom.ps1 new file mode 100644 index 0000000..4ce6a6b --- /dev/null +++ b/PSZoom/Public/Utils/Connect-PSZoom.ps1 @@ -0,0 +1,53 @@ +<# +.SYNOPSIS +Use this cmdlet to retrieve a token from Zoom. + +.DESCRIPTION +Assigns a token to the variable $Global:PSZoomToken which is used by all cmdlets when making requests to Zoom. + +.EXAMPLE +Connect-PSZoom -AccountID 'your_account_id' -ClientID 'your_client_id' -ClientSecret 'your_client_secret' + +#> + +function Connect-PSZoom { + [CmdletBinding()] + param ( + [Parameter( + Mandatory = $True, + Position = 0 + )] + [string]$AccountID, + + [Alias('APIKey')] + [Parameter( + Mandatory = $True, + Position = 1 + )] + [string]$ClientID, + + [Alias('APISecret')] + [Parameter( + Mandatory = $True, + Position = 2 + )] + [string]$ClientSecret + ) + + try { + $token = New-OAuthToken -AccountID $AccountID -ClientID $ClientID -ClientSecret $ClientSecret + $Global:PSZoomToken = $token + } catch { + if ($_.exception.Response) { + if ($PSVersionTable.PSVersion.Major -lt 6) { + $errorStreamReader = [System.IO.StreamReader]::new($_.exception.Response.GetResponseStream()) + $errorDetails = ConvertFrom-Json ($errorStreamReader.ReadToEnd()) + } + else { + $errorDetails = ConvertFrom-Json $_.errorDetails -AsHashtable + } + } + + Write-Error "Unable to retrieve token for account ID $AccountID. $($errorDetails.reason)" + } +} \ No newline at end of file diff --git a/PSZoom/Public/Utils/Invoke-ZoomRestMethod.ps1 b/PSZoom/Public/Utils/Invoke-ZoomRestMethod.ps1 index bacb033..bf5fc62 100644 --- a/PSZoom/Public/Utils/Invoke-ZoomRestMethod.ps1 +++ b/PSZoom/Public/Utils/Invoke-ZoomRestMethod.ps1 @@ -15,14 +15,14 @@ within PSZoom. See below. Get billing information. $accountId = 123456789 $request = [System.UriBuilder]"https://api.zoom.us/v2/accounts/$accountId/billing" -Invoke-ZoomRestMethod -Uri $request.Uri -ApiKey your_api_key -ApiSecret your_api_secret -Method GET +Invoke-ZoomRestMethod -Uri $request.Uri -Method GET #> function Invoke-ZoomRestMethod { [CmdletBinding(DefaultParameterSetName = 'Default')] param ( - [Microsoft.PowerShell.Commands.WebRequestMethod]$Method, + [string]$Method, [switch]$FollowRelLink, [int]$MaximumFollowRelLink, [string]$ResponseHeadersVariable, @@ -39,7 +39,7 @@ function Invoke-ZoomRestMethod { [x509Certificate]$Certificate, [switch]$SkipCertificateCheck, $SslProtocol, - [secureString]$Token, + [secureString]$Token = $PSZoomToken, [string]$UserAgent, [switch]$DisableKeepAlive, [int]$TimeoutSec, @@ -60,9 +60,7 @@ function Invoke-ZoomRestMethod { [switch]$Resume, [switch]$SkipHttpErrorCheck, [switch]$PreserveAuthorizationOnRedirect, - [switch]$SkipHeaderValidation, - [string]$ApiKey, - [string]$ApiSecret + [switch]$SkipHeaderValidation ) $params = @{ @@ -127,23 +125,15 @@ function Invoke-ZoomRestMethod { } $params = Remove-NonPsBoundParameters($params) - - if ($params.Headers -is [ref]) { - # Update the token if it has expired. - $TokenPayload = ($Headers.Value.authorization -split '\.')[1] - $TokenExpireTime = [int]((ConvertFrom-Json ([System.Text.Encoding]::UTF8.GetString( - [Convert]::FromBase64String($TokenPayload + '=' * @(0..3)[ - ($TokenPayload.Length % 4)])))).exp) - $CurrentUnixTime = ((Get-Date) - (Get-Date '1970/1/1 0:0:0 GMT')).TotalSeconds - if ($CurrentUnixTime -ge $TokenExpireTime) { - $Headers.Value = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - - $params.Headers = $Headers.Value - } - elseif ($null -eq $params.Headers) { - $params.Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret + + if (-not $Token) { + Write-Host "No token found. Use Connect-PSZoom to get a global token then try running the command again.`n" + } else { + $params.Headers = (New-ZoomHeaders -Token $Token) + Write-Verbose $params.Headers } + if ([string]::IsNullOrEmpty($params.ContentType)) { $params.ContentType = 'application/json; charset=utf-8' } diff --git a/PSZoom/Public/Utils/Join-ZoomPages.ps1 b/PSZoom/Public/Utils/Join-ZoomPages.ps1 index 1cb99b2..fb7c801 100644 --- a/PSZoom/Public/Utils/Join-ZoomPages.ps1 +++ b/PSZoom/Public/Utils/Join-ZoomPages.ps1 @@ -24,7 +24,6 @@ Join-ZoomPages -ZoomCommand $ZoomCommand -ZoomCommandSplat $ZoomCommandSplat .OUTPUTS API response results - #> function Join-ZoomPages { diff --git a/PSZoom/Private/New-OAuth.ps1 b/PSZoom/Public/Utils/New-OAuthToken.ps1 similarity index 73% rename from PSZoom/Private/New-OAuth.ps1 rename to PSZoom/Public/Utils/New-OAuthToken.ps1 index a8df60b..07f3ef4 100644 --- a/PSZoom/Private/New-OAuth.ps1 +++ b/PSZoom/Public/Utils/New-OAuthToken.ps1 @@ -1,10 +1,8 @@ -function New-OAuth { +function New-OAuthToken { <# .SYNOPSIS Retrieves the Zoom OAuth API token - .DESCRIPTION - Retrieves the Zoom OAuth API token .PARAMETER ClientID Client ID of the Zoom App @@ -39,25 +37,26 @@ function New-OAuth { .LINK https://marketplace.zoom.us/docs/guides/auth/oauth + #> [CmdletBinding()] param ( - [Parameter(valuefrompipeline = $true, mandatory = $true, HelpMessage = "Enter Zoom App Client ID:", Position = 0)] + [Parameter(valuefrompipeline = $true, mandatory = $true, HelpMessage = "Enter Zoom App Account ID", Position = 0)] [String] - $ClientID, + $AccountID, - [Parameter(valuefrompipeline = $true, mandatory = $true, HelpMessage = "Enter Zoom App Client Secret:", Position = 1)] + [Parameter(valuefrompipeline = $true, mandatory = $true, HelpMessage = "Enter Zoom App Client ID:", Position = 1)] [String] - $ClientSecret, + $ClientID, - [Parameter(valuefrompipeline = $true, mandatory = $true, HelpMessage = "Enter Zoom App Account ID", Position = 2)] + [Parameter(valuefrompipeline = $true, mandatory = $true, HelpMessage = "Enter Zoom App Client Secret:", Position = 2)] [String] - $AccountID - ) + $ClientSecret + ) - $Uri = "https://zoom.us/oauth/token?grant_type=account_credentials&account_id={0}" -f $AccountID + $uri = "https://zoom.us/oauth/token?grant_type=account_credentials&account_id={0}" -f $AccountID #Encoding of the client data $IDSecret = $ClientID + ":" + $ClientSecret @@ -68,10 +67,18 @@ function New-OAuth { } # Maybe add some error handling - $response = Invoke-WebRequest -uri $Uri -headers $headers -Method Post + try { + $response = Invoke-WebRequest -uri $uri -headers $headers -Method Post + } catch { + $_ + } - $token = ($response.content | ConvertFrom-Json).access_token + Write-Verbose 'Acquired token.' + + $token = ($response.content | ConvertFrom-Json).access_token - return $token + $token = ConvertTo-SecureString -String $token -AsPlainText -Force -} + + Write-Output $token +} \ No newline at end of file diff --git a/PSZoom/Public/Utils/New-ZoomApiToken.ps1 b/PSZoom/Public/Utils/New-ZoomApiToken.ps1 deleted file mode 100644 index b5de98e..0000000 --- a/PSZoom/Public/Utils/New-ZoomApiToken.ps1 +++ /dev/null @@ -1,62 +0,0 @@ -<# - -.SYNOPSIS -Generate a Zoom API access token. - -.PARAMETER ApiKey -The Zoom API key. - -.PARAMETER ApiSecret -The Zoom API secret. - -.PARAMETER ValidforSeconds -The length of time, in seconds, that the token is valid. - -.EXAMPLE -$Token = New-ZoomApiToken -ApiKey $ApiKey -ApiSecret $ApiSecret - -.OUTPUTS -Zoom API access token as a string. - -#> - -function New-ZoomApiToken { - [CmdletBinding()] - [OutputType([string])] - param ( - [Parameter()] - [string]$ApiKey, - - [Parameter()] - [string]$ApiSecret, - - [Parameter()] - [int]$ValidforSeconds = 30 - ) - - $Credentials = Get-ZoomApiCredentials -ZoomApiKey $ApiKey -ZoomApiSecret $ApiSecret - - if (-not $Global:ZoomAppType) { - - Write-Verbose "Creating new JWT Token" - $Token = New-Jwt -Algorithm 'HS256' -type 'JWT' -Issuer $Credentials.ApiKey -SecretKey $Credentials.ApiSecret -ValidforSeconds $ValidforSeconds - - } - elseif ($Global:ZoomAppType -eq "ServerOAuth") { - - if (-not $Global:ZoomAccountID) { - - throw "Global variable `"AccountID`" not defined" - - } - else { - - $Token = New-OAuth -ClientID $Credentials.ApiKey -ClientSecret $Credentials.ApiSecret -AccountID $Global:ZoomAccountID - - } - - } - - Write-Output $Token - -} diff --git a/PSZoom/Public/Webinars/Get-ZoomWebinar.ps1 b/PSZoom/Public/Webinars/Get-ZoomWebinar.ps1 index 68dac7a..23565f4 100644 --- a/PSZoom/Public/Webinars/Get-ZoomWebinar.ps1 +++ b/PSZoom/Public/Webinars/Get-ZoomWebinar.ps1 @@ -16,12 +16,6 @@ The Occurrence ID. Set the value of this field to `true` if you would like to view Webinar details of all previous occurrences of a recurring Webinar. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS .LINK @@ -55,21 +49,9 @@ function Get-ZoomWebinar { [string]$OccurrenceId, [ALias('show_previous_occurences')] - [bool]$ShowPreviousOccurences, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [bool]$ShowPreviousOccurences ) - begin { - - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $Request = [System.UriBuilder]"https://api.zoom.us/v2/webinars/$webinarId" $query = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) @@ -84,7 +66,7 @@ function Get-ZoomWebinar { } $Request.Query = $query.toString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/Webinars/Get-ZoomWebinarPanelists.ps1 b/PSZoom/Public/Webinars/Get-ZoomWebinarPanelists.ps1 index 91c4389..db57064 100644 --- a/PSZoom/Public/Webinars/Get-ZoomWebinarPanelists.ps1 +++ b/PSZoom/Public/Webinars/Get-ZoomWebinarPanelists.ps1 @@ -9,16 +9,6 @@ Use this API to list all the panelists of a Webinar. .PARAMETER WebinarId The webinar ID. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - -.OUTPUTS - -.LINK - .EXAMPLE Get-ZoomWebinarPanelists 1234567890 @@ -44,24 +34,12 @@ function Get-ZoomWebinarPanelists { [string]$OccurrenceId, [ALias('show_previous_occurences')] - [bool]$ShowPreviousOccurences, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [bool]$ShowPreviousOccurences ) - begin { - - #Generate Headers and JWT (JSON Web Token) - $headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { $request = [System.UriBuilder]"https://api.zoom.us/v2/webinars/$webinarId/panelists" - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/PSZoom/Public/Webinars/Get-ZoomWebinarsFromUser.ps1 b/PSZoom/Public/Webinars/Get-ZoomWebinarsFromUser.ps1 index 6ed6bec..7c54658 100644 --- a/PSZoom/Public/Webinars/Get-ZoomWebinarsFromUser.ps1 +++ b/PSZoom/Public/Webinars/Get-ZoomWebinarsFromUser.ps1 @@ -18,12 +18,6 @@ The number of records returned within a single API call. .PARAMETER PageNumber The current page number of returned records. -.PARAMETER ApiKey -The Api Key. - -.PARAMETER ApiSecret -The Api Secret. - .OUTPUTS Zoom API response. @@ -59,20 +53,9 @@ function Get-ZoomWebinarsFromUser { [int]$PageSize = 30, [ValidateRange(1,300)] - [int]$PageNumber = 1, - - [ValidateNotNullOrEmpty()] - [string]$ApiKey, - - [ValidateNotNullOrEmpty()] - [string]$ApiSecret + [int]$PageNumber = 1 ) - begin { - #Generate Headers and JWT (JSON Web Token) - $Headers = New-ZoomHeaders -ApiKey $ApiKey -ApiSecret $ApiSecret - } - process { foreach ($id in $UserId) { $request = [System.UriBuilder]"https://api.zoom.us/v2/users/$id/webinars" @@ -81,7 +64,7 @@ function Get-ZoomWebinarsFromUser { $query.Add('page_number', $PageNumber) $request.Query = $query.toString() $request.Query = $query.toString() - $response = Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $RequestBody -Method GET -ApiKey $ApiKey -ApiSecret $ApiSecret + $response = Invoke-ZoomRestMethod -Uri $request.Uri -Body $RequestBody -Method GET Write-Output $response } diff --git a/README.md b/README.md index 6ff1c10..823fac1 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ Import-Module PSZoom ``` # Using your API key and API secret # -All commands require an API key (ClientID) and API secret. Currently PSZoom uses JWT (which will deprecated on 6/1/2023) and Server-to-Server OAuth authorization. You can generate -the JWT or Server-to-Server OAuth key/secret from https://marketplace.zoom.us/develop/create, then click on 'Create' under JWT or Server-to-Server OAuth. Note that in -addition to the JWT key/secret, Zoom also provides an IM Chat History Token, this is not to be confused with the key/secret. +All commands require a Client ID and Client Secret. As of PSZoom 2.0, PSZoom only supports Server-to-Server OAuth authorization. You can generate the Server-to-Server OAuth key/secret from https://marketplace.zoom.us/develop/create, then click on 'Create' under Server-to-Server OAuth. + +JWT authorization is supported in versions prior to 2.0. If you are using JWT, you should update your code to support Server-To-Server Oauth. Zoom will be dropping support of JWT in June of 2023. For ease of use, each command looks for these variables automatically in the following order: In the global scope for ZoomApiKey and ZoomApiSecret @@ -43,11 +43,7 @@ For ease of use, each command looks for these variables automatically in the fol # Example script # ``` import-module PSZoom -$Global:ZoomApiKey = 'API_Key_Goes_Here' -$Global:ZoomApiSecret = 'API_Secret_Goes_Here' -$Global:ZoomAccountID = 'Account_ID_Goes_Here' -# Only if you want to use Server-to-Server OAuth -$Global:ZoomAppType = "ServerOAuth" +Connect-PSZoom -AccountID 'account_id' -ClientID 'client_id' -ClientSecret 'secret' Get-ZoomMeeting 123456789 ``` diff --git a/Test/PSZoom.Tests.ps1 b/Test/PSZoom.Tests.ps1 index 99c075e..8d1f827 100644 --- a/Test/PSZoom.Tests.ps1 +++ b/Test/PSZoom.Tests.ps1 @@ -56,6 +56,7 @@ Mock -ModuleName $ModuleName Invoke-RestMethod { #Additional variables to use when testing +$Global:PSZoomToken = ConvertTo-SecureString -String 'faketoken' -AsPlainText -Force $AssistantId = 'TestAssistantId' $AssistantId2 = 'TestAssistantId2' $UserEmail = 'TestEmail@test.com' @@ -71,66 +72,15 @@ $PollId = '987654321' $StreamUrl = 'http://www.streamurltest.com' $StreamKey = 'TestStreamKey' $PageUrl = 'http://www.pageurltest.com' -$ApiKeySecret = @{ - ApiKey = 'TestApiKey' - ApiSecret = 'TestApiSecret' -} Describe 'PSZoom Core Tests' { - It 'Should be the correct name' { - $Module.Name | Should Be $ModuleName - } -} - - - Describe 'New-JWT' { - It 'Should generate a JWT correctly' { - $token = (New-JWT -Algorithm 'HS256' -type 'JWT' -Issuer 123 -SecretKey 456 -ValidforSeconds 30) - $parsedToken = (Parse-JWTtoken -Token $token) - $parsedToken.'alg' | Should -Be 'HS256' - $parsedToken.'typ' | Should -Be 'JWT' - $parsedToken.'iss' | Should -Be '123' - $parsedToken.'exp' | Should -Not -BeNullOrEmpty - } - } - Describe 'New-ZoomHeaders' { It 'Should create the correct headers' { - $headers = New-ZoomHeaders @ApiKeySecret + $headers = New-ZoomHeaders -Token $Global:PSZoomToken $headers.'content-type' | Should -Be 'application/json' $headers.'authorization' | Should -BeLike '*bearer*' } } - - Describe 'Get-ZoomApiCredentials' {} - -InModuleScope $ModuleName { - Describe 'New-ZoomApiToken' { - Mock Get-ZoomApiCredentials { - return @{ - ApiKey = 'key' - ApiSecret = 'secret' - } - } - - Mock New-Jwt { - return 'token.token.token' - } - - $token = New-ZoomApiToken -ApiKey 'key' -ApiSecret 'secret' - - It 'Get-ZoomApiCredentials is called' { - Assert-MockCalled Get-ZoomApiCredentials -Exactly 1 - } - - It 'New-Jwt is called' { - Assert-MockCalled New-Jwt -Exactly 1 - } - - It 'Valid token returned' { - $token | Should -Be 'token.token.token' - } - } } Describe 'Get-DateRanges' { @@ -283,7 +233,7 @@ Describe 'Add-ZoomUserAssistant' { AssistantId = 'testid1', 'testid2' } - $request = Add-ZoomUserAssistants @params @ApiKeySecret + $request = Add-ZoomUserAssistants @params It 'Uses the correct method' { $request.Method | Should Be 'POST' @@ -300,7 +250,7 @@ Describe 'Add-ZoomUserAssistant' { Describe 'Get-ZoomPersonalMeetingRoomName' { $VanityName = 'Test' - $request = Get-ZoomPersonalMeetingRoomName -VanityName $VanityName @ApiKeySecret + $request = Get-ZoomPersonalMeetingRoomName -VanityName $VanityName It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -318,7 +268,7 @@ Describe 'Get-ZoomPersonalMeetingRoomName' { } Describe 'Get-ZoomUser' { - $request = Get-ZoomUser -UserId $UserId @ApiKeySecret + $request = Get-ZoomUser -UserId $UserId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -330,7 +280,7 @@ Describe 'Get-ZoomUser' { } Describe 'Get-ZoomUserAssistants' { - $request = Get-ZoomUserAssistants -UserId $UserId @ApiKeySecret + $request = Get-ZoomUserAssistants -UserId $UserId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -342,7 +292,7 @@ Describe 'Get-ZoomUserAssistants' { } Describe 'Get-ZoomUserEmailStatus' { - $request = Get-ZoomUserEmailStatus -UserId $UserId @ApiKeySecret + $request = Get-ZoomUserEmailStatus -UserId $UserId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -354,7 +304,7 @@ Describe 'Get-ZoomUserEmailStatus' { } Describe 'Get-ZoomUserPermissions' { - $request = Get-ZoomUserPermissions -UserId $UserId @ApiKeySecret + $request = Get-ZoomUserPermissions -UserId $UserId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -445,7 +395,7 @@ Describe 'New-ZoomUser' { Password = 'testpassword' } - $request = New-ZoomUser @params @ApiKeySecret + $request = New-ZoomUser @params It 'Uses the correct method' { $request.Method | Should Be 'POST' @@ -461,7 +411,7 @@ Describe 'New-ZoomUser' { } Describe 'Remove-ZoomSpecificUserAssistant' { - $request = Remove-ZoomSpecificUserAssistant -UserId $UserId -AssistantId $AssistantId @ApiKeySecret + $request = Remove-ZoomSpecificUserAssistant -UserId $UserId -AssistantId $AssistantId It 'Uses the correct method' { $request.Method | Should Be 'DELETE' @@ -472,23 +422,23 @@ Describe 'Remove-ZoomSpecificUserAssistant' { } It 'Invokes rest method for multiple user IDs' { - Remove-ZoomSpecificUserAssistant -UserId $UserId, $UserId2 -AssistantId $AssistantId @ApiKeySecret + Remove-ZoomSpecificUserAssistant -UserId $UserId, $UserId2 -AssistantId $AssistantId Assert-MockCalled -CommandName Invoke-RestMethod -Times 2 -Scope It -ModuleName $ModuleName } It 'Invokes rest method for multiple user schedulers' { - Remove-ZoomSpecificUserAssistant -UserId $UserId-AssistantId $AssistantId, $AssistantId2 @ApiKeySecret + Remove-ZoomSpecificUserAssistant -UserId $UserId-AssistantId $AssistantId, $AssistantId2 Assert-MockCalled -CommandName Invoke-RestMethod -Times 2 -Scope It -ModuleName $ModuleName } It 'Invokes rest method for multiple user IDs and schedulers at the same time' { - Remove-ZoomSpecificUserAssistant -UserId $UserId, $UserId2 -AssistantId $AssistantId, $AssistantId2 @ApiKeySecret + Remove-ZoomSpecificUserAssistant -UserId $UserId, $UserId2 -AssistantId $AssistantId, $AssistantId2 Assert-MockCalled -CommandName Invoke-RestMethod -Times 4 -Scope It -ModuleName $ModuleName } } Describe 'Remove-ZoomSpecificUserScheduler' { - $request = Remove-ZoomSpecificUserScheduler -UserId $UserId -SchedulerId $AssistantId @ApiKeySecret + $request = Remove-ZoomSpecificUserScheduler -UserId $UserId -SchedulerId $AssistantId It 'Uses the correct method' { $request.Method | Should Be 'DELETE' @@ -499,23 +449,23 @@ Describe 'Remove-ZoomSpecificUserScheduler' { } It 'Invokes rest method for multiple user IDs' { - Remove-ZoomSpecificUserAssistant -UserId $UserId, $UserId2 -AssistantId $AssistantId @ApiKeySecret + Remove-ZoomSpecificUserAssistant -UserId $UserId, $UserId2 -AssistantId $AssistantId Assert-MockCalled -CommandName Invoke-RestMethod -Times 2 -Scope It -ModuleName $ModuleName } It 'Invokes rest method for multiple user schedulers' { - Remove-ZoomSpecificUserAssistant -UserId $UserId-AssistantId $AssistantId, $AssistantId2 @ApiKeySecret + Remove-ZoomSpecificUserAssistant -UserId $UserId-AssistantId $AssistantId, $AssistantId2 Assert-MockCalled -CommandName Invoke-RestMethod -Times 2 -Scope It -ModuleName $ModuleName } It 'Invokes rest method for multiple user IDs and schedulers at the same time' { - Remove-ZoomSpecificUserScheduler -UserId $UserId, $UserId2 -SchedulerId $AssistantId, $AssistantId2 @ApiKeySecret + Remove-ZoomSpecificUserScheduler -UserId $UserId, $UserId2 -SchedulerId $AssistantId, $AssistantId2 Assert-MockCalled -CommandName Invoke-RestMethod -Times 4 -Scope It -ModuleName $ModuleName } } Describe 'Remove-ZoomUser' { - $request = Remove-ZoomUser -UserId $UserId -Action Delete -TransferEmail $UserId2 -TransferMeeting -TransferRecording @ApiKeySecret + $request = Remove-ZoomUser -UserId $UserId -Action Delete -TransferEmail $UserId2 -TransferMeeting -TransferRecording It 'Uses the correct method' { $request.Method | Should Be 'DELETE' @@ -535,13 +485,13 @@ Describe 'Remove-ZoomUser' { } It 'Invokes rest method for each user inputted' { - Remove-ZoomUser -UserId $UserId, $UserId2 @ApiKeySecret + Remove-ZoomUser -UserId $UserId, $UserId2 Assert-MockCalled -CommandName Invoke-RestMethod -Times 2 -Scope It -ModuleName $ModuleName } } Describe 'Remove-ZoomUserAssistants' { - $request = Remove-ZoomUserAssistants -UserId $UserId @ApiKeySecret + $request = Remove-ZoomUserAssistants -UserId $UserId It 'Uses the correct method' { $request.Method | Should Be 'DELETE' @@ -552,13 +502,13 @@ Describe 'Remove-ZoomUserAssistants' { } It 'Invokes rest method for each user inputted' { - Remove-ZoomUserAssistants -UserId $UserId, $UserId2 @ApiKeySecret + Remove-ZoomUserAssistants -UserId $UserId, $UserId2 Assert-MockCalled -CommandName Invoke-RestMethod -Times 2 -Scope It -ModuleName $ModuleName } } Describe 'Remove-ZoomUserSchedulers' { - $request = Remove-ZoomUserSchedulers -UserId $UserId @ApiKeySecret + $request = Remove-ZoomUserSchedulers -UserId $UserId It 'Uses the correct method' { $request.Method | Should Be 'DELETE' @@ -569,13 +519,13 @@ Describe 'Remove-ZoomUserSchedulers' { } It 'Invokes rest method for each user inputted' { - Remove-ZoomUserSchedulers -UserId $UserId, $UserId2 @ApiKeySecret + Remove-ZoomUserSchedulers -UserId $UserId, $UserId2 Assert-MockCalled -CommandName Invoke-RestMethod -Times 2 -Scope It -ModuleName $ModuleName } } Describe 'Revoke-ZoomUserSsoToken' { - $request = Revoke-ZoomUserSsoToken -UserId $UserId @ApiKeySecret + $request = Revoke-ZoomUserSsoToken -UserId $UserId It 'Uses the correct method' { $request.Method | Should Be 'DELETE' @@ -586,7 +536,7 @@ Describe 'Revoke-ZoomUserSsoToken' { } It 'Invokes rest method for each user inputted' { - Revoke-ZoomUserSsoToken -UserId $UserId, $UserId2 @ApiKeySecret + Revoke-ZoomUserSsoToken -UserId $UserId, $UserId2 Assert-MockCalled -CommandName Invoke-RestMethod -Times 2 -Scope It -ModuleName $ModuleName } } @@ -600,7 +550,7 @@ Describe 'Update-ZoomProfilePicture' { return $True } - $request = Update-ZoomProfilePicture -UserId $UserId -Filename 'testimg.jpg' @ApiKeySecret + $request = Update-ZoomProfilePicture -UserId $UserId -Filename 'testimg.jpg' It 'Uses the correct method' { $request.Method | Should Be 'POST' @@ -698,7 +648,7 @@ Describe 'Update-ZoomUser' { CmsUserId = '654321' } - $request = Update-ZoomUser @params @ApiKeySecret + $request = Update-ZoomUser @params It 'Uses the correct method' { $request.Method | Should Be 'PATCH' @@ -734,7 +684,7 @@ Describe 'Update-ZoomUserEmail' { ] }' - $request = Update-ZoomUserEmail -UserId $UserId -email $UserId2 @ApiKeySecret + $request = Update-ZoomUserEmail -UserId $UserId -email $UserId2 It 'Uses the correct method' { $request.Method | Should Be 'PUT' @@ -764,7 +714,7 @@ Describe 'Update-ZoomUserPassword' { ] }' - $request = Update-ZoomUserpassword -UserId $UserId -password 'testpassword' @ApiKeySecret + $request = Update-ZoomUserpassword -UserId $UserId -password 'testpassword' It 'Uses the correct method' { $request.Method | Should Be 'PUT' @@ -1229,7 +1179,7 @@ Describe 'Update-ZoomUserSettings' { ZoomPhone = $true } - $request = Update-ZoomUserSettings @params @ApiKeySecret + $request = Update-ZoomUserSettings @params It 'Uses the correct method' { $request.Method | Should Be 'PATCH' @@ -1267,7 +1217,7 @@ Describe 'Update-ZoomUserStatus' { ] }' - $request = Update-ZoomUserStatus -UserId $UserId -action deactivate @ApiKeySecret + $request = Update-ZoomUserStatus -UserId $UserId -action deactivate It 'Uses the correct method' { $request.Method | Should Be 'PUT' @@ -1333,7 +1283,7 @@ Describe 'Add-ZoomGroupMember' { } }' - $request = Add-ZoomGroupMember -GroupId $GroupId -MemberEmail $UserEmail @ApiKeySecret + $request = Add-ZoomGroupMember -GroupId $GroupId -MemberEmail $UserEmail It 'Uses the correct method' { $request.Method | Should Be 'POST' @@ -1349,7 +1299,7 @@ Describe 'Add-ZoomGroupMember' { } Describe 'Get-ZoomGroup' { - $request = Get-ZoomGroup -GroupId $GroupId -ApiKey 123 -ApiSecret 456 + $request = Get-ZoomGroup -GroupId $GroupId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -1361,7 +1311,7 @@ Describe 'Get-ZoomGroup' { } Describe 'Get-ZoomGroupLockSettings' { - $request = Get-ZoomGroupLockSettings -GroupId $GroupId @ApiKeySecret + $request = Get-ZoomGroupLockSettings -GroupId $GroupId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -1373,7 +1323,7 @@ Describe 'Get-ZoomGroupLockSettings' { } Describe 'Get-ZoomGroups' { - $request = Get-ZoomGroups -FullApiResponse @ApiKeySecret + $request = Get-ZoomGroups -FullApiResponse It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -1385,7 +1335,7 @@ Describe 'Get-ZoomGroups' { } Describe 'Get-ZoomGroupSettings' { - $request = Get-ZoomGroupSettings -GroupId $GroupId @ApiKeySecret + $request = Get-ZoomGroupSettings -GroupId $GroupId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -1407,7 +1357,7 @@ Describe 'New-ZoomGroup' { } }' - $request = New-ZoomGroup -Name 'TestGroupName' @ApiKeySecret + $request = New-ZoomGroup -Name 'TestGroupName' It 'Uses the correct method' { $request.Method | Should Be 'POST' @@ -1423,7 +1373,7 @@ Describe 'New-ZoomGroup' { } Describe 'Remove-ZoomGroup' { - $request = Remove-ZoomGroup -GroupId $GroupId @ApiKeySecret + $request = Remove-ZoomGroup -GroupId $GroupId It 'Uses the correct method' { $request.Method | Should Be 'DELETE' @@ -1445,7 +1395,7 @@ Describe 'Update-ZoomGroup' { } }' - $request = Update-ZoomGroup -GroupId $GroupId -Name 'NewName' @ApiKeySecret + $request = Update-ZoomGroup -GroupId $GroupId -Name 'NewName' It 'Uses the correct method' { $request.Method | Should Be 'PATCH' @@ -1776,7 +1726,7 @@ Describe 'Update-ZoomGroupLockSettings' -Verbose { } }' - $request = Update-ZoomGroupLockSettings -GroupId $GroupId @updateGroupParams @ApiKeySecret + $request = Update-ZoomGroupLockSettings -GroupId $GroupId @updateGroupParams Write-Verbose $request.body It 'Uses the correct method' { $request.Method | Should Be 'PATCH' @@ -1802,7 +1752,7 @@ Describe 'Update-ZoomGroupSettings' { } }' - $request = Update-ZoomGroupSettings -GroupId $GroupId @updateGroupParams @ApiKeySecret + $request = Update-ZoomGroupSettings -GroupId $GroupId @updateGroupParams It 'Uses the correct method' { $request.Method | Should Be 'PATCH' @@ -1864,7 +1814,7 @@ Describe 'Add-ZoomMeetingRegistrant' { Zip = 'Zip' } - $request = Add-ZoomMeetingRegistrant @params @ApiKeySecret + $request = Add-ZoomMeetingRegistrant @params It 'Uses the correct method' { $request.Method | Should Be 'POST' @@ -1880,7 +1830,7 @@ Describe 'Add-ZoomMeetingRegistrant' { } Describe 'Get-ZoomEndedMeetingInstances' { - $request = Get-ZoomEndedMeetingInstances -MeetingId $MeetingId @ApiKeySecret + $request = Get-ZoomEndedMeetingInstances -MeetingId $MeetingId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -1892,7 +1842,7 @@ Describe 'Get-ZoomEndedMeetingInstances' { } Describe 'Get-ZoomMeeting' { - $request = Get-ZoomMeeting -MeetingId $MeetingId -OccurrenceId $OccurrenceId @ApiKeySecret + $request = Get-ZoomMeeting -MeetingId $MeetingId -OccurrenceId $OccurrenceId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -1904,7 +1854,7 @@ Describe 'Get-ZoomMeeting' { } Describe 'Get-ZoomMeetingInvitation' { - $request = Get-ZoomMeetingInvitation -MeetingId $MeetingId @ApiKeySecret + $request = Get-ZoomMeetingInvitation -MeetingId $MeetingId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -1916,7 +1866,7 @@ Describe 'Get-ZoomMeetingInvitation' { } Describe 'Get-ZoomMeetingPoll' { - $request = Get-ZoomMeetingPoll -MeetingId $MeetingId -PollId $PollId @ApiKeySecret + $request = Get-ZoomMeetingPoll -MeetingId $MeetingId -PollId $PollId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -1928,7 +1878,7 @@ Describe 'Get-ZoomMeetingPoll' { } Describe 'Get-ZoomMeetingPolls' { - $request = Get-ZoomMeetingPolls -MeetingId $MeetingId @ApiKeySecret + $request = Get-ZoomMeetingPolls -MeetingId $MeetingId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -1947,7 +1897,7 @@ Describe 'Get-ZoomMeetingRegistrants' { PageNumber = $PageNumber } - $request = Get-ZoomMeetingRegistrants @params @ApiKeySecret + $request = Get-ZoomMeetingRegistrants @params It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -1969,7 +1919,7 @@ Describe 'Get-ZoomMeetingRegistrants' { Describe 'Get-ZoomMeetingsFromUser' { $Type = 'scheduled' - $request = Get-ZoomMeetingsFromUser -UserId $UserId -type $Type -PageSize $PageSize -PageNumber $PageNumber @ApiKeySecret + $request = Get-ZoomMeetingsFromUser -UserId $UserId -type $Type -PageSize $PageSize -PageNumber $PageNumber It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -1990,7 +1940,7 @@ Describe 'Get-ZoomMeetingsFromUser' { } Describe 'Get-ZoomPastMeetingDetails' { - $request = Get-ZoomPastMeetingDetails -MeetingUuid $MeetingUuid @ApiKeySecret + $request = Get-ZoomPastMeetingDetails -MeetingUuid $MeetingUuid It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -2003,7 +1953,7 @@ Describe 'Get-ZoomPastMeetingDetails' { Describe 'Get-ZoomPastMeetingParticipants' { $NextPageToken = 'NextPageTokenTest' - $request = Get-ZoomPastMeetingParticipants -MeetingUuid $MeetingUuid -PageSize $PageSize -NextPageToken $NextPageToken @ApiKeySecret + $request = Get-ZoomPastMeetingParticipants -MeetingUuid $MeetingUuid -PageSize $PageSize -NextPageToken $NextPageToken It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -2024,7 +1974,7 @@ Describe 'Get-ZoomPastMeetingParticipants' { } Describe 'Get-ZoomRegistrationQuestions' { - $request = Get-ZoomRegistrationQuestions -MeetingId $MeetingId @ApiKeySecret + $request = Get-ZoomRegistrationQuestions -MeetingId $MeetingId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -2457,7 +2407,7 @@ Describe 'New-ZoomMeeting' { } Context 'Instant Meeting' { - $request = New-ZoomMeeting @mandatoryParams @optionalparams @settingsparams @ApiKeySecret + $request = New-ZoomMeeting @mandatoryParams @optionalparams @settingsparams It 'Uses the correct method' { $request.Method | Should Be 'POST' @@ -2478,7 +2428,7 @@ Describe 'New-ZoomMeeting' { } Context 'Scheduled Meeting' { - $request = New-ZoomMeeting @mandatoryParams @optionalparams @settingsparams @scheduleParams @ApiKeySecret + $request = New-ZoomMeeting @mandatoryParams @optionalparams @settingsparams @scheduleParams It 'Validates against the JSON schema' { Test-Json -Json $request.Body -Schema $schema | Should Be $True @@ -2490,7 +2440,7 @@ Describe 'New-ZoomMeeting' { RecurrenceNoFixedTime = $True } - $request = New-ZoomMeeting @params @mandatoryParams @optionalparams @settingsparams @ApiKeySecret + $request = New-ZoomMeeting @params @mandatoryParams @optionalparams @settingsparams It 'Validates against the JSON schema' { Test-Json -Json $request.Body -Schema $schema | Should Be $True @@ -2504,7 +2454,7 @@ Describe 'New-ZoomMeeting' { RepeatInterval = 1 } - $request = New-ZoomMeeting @params @mandatoryParams @optionalparams @settingsparams @scheduleParams @ApiKeySecret + $request = New-ZoomMeeting @params @mandatoryParams @optionalparams @settingsparams @scheduleParams It 'Validates against the JSON schema' { Test-Json -Json $request.Body -Schema $schema | Should Be $True @@ -2518,7 +2468,7 @@ Describe 'New-ZoomMeeting' { RepeatInterval = 2 } - $request = New-ZoomMeeting @params @mandatoryParams @optionalparams @settingsparams @scheduleParams @ApiKeySecret + $request = New-ZoomMeeting @params @mandatoryParams @optionalparams @settingsparams @scheduleParams It 'Validates against the JSON schema' { Test-Json -Json $request.Body -Schema $schema | Should Be $True @@ -2533,7 +2483,7 @@ Describe 'New-ZoomMeeting' { RepeatInterval = 2 } - $request = New-ZoomMeeting @params @mandatoryParams @optionalparams @settingsparams @scheduleParams @ApiKeySecret + $request = New-ZoomMeeting @params @mandatoryParams @optionalparams @settingsparams @scheduleParams It 'Validates against the JSON schema' { Test-Json -Json $request.Body -Schema $schema | Should Be $True @@ -2543,7 +2493,7 @@ Describe 'New-ZoomMeeting' { Describe 'Remove-ZoomMeeting' { $ScheduleForReminder = 'TestReminder' - $request = Remove-ZoomMeeting -MeetingId $MeetingId -OccurrenceId $OccurrenceId -ScheduleForReminder $ScheduleForReminder @ApiKeySecret + $request = Remove-ZoomMeeting -MeetingId $MeetingId -OccurrenceId $OccurrenceId -ScheduleForReminder $ScheduleForReminder It 'Uses the correct method' { $request.Method | Should Be 'DELETE' @@ -2620,7 +2570,7 @@ Describe 'New-ZoomMeetingPoll' { ) } - $request = New-ZoomMeetingPoll @params @ApiKeySecret + $request = New-ZoomMeetingPoll @params It 'Uses the correct method' { $request.Method | Should Be 'POST' @@ -2657,7 +2607,7 @@ Describe 'New-ZoomMeetingPollQuestion' { Describe 'Remove-ZoomMeetingPoll' { $PollId = '123' - $request = Remove-ZoomMeetingPoll -MeetingId $MeetingId -PollId $PollId @ApiKeySecret + $request = Remove-ZoomMeetingPoll -MeetingId $MeetingId -PollId $PollId It 'Uses the correct method' { $request.Method | Should Be 'DELETE' @@ -3022,7 +2972,7 @@ Describe 'Update-ZoomMeeting' { OccurrenceId = $OccurrenceId } - $request = Update-ZoomMeeting @params @ApiKeySecret + $request = Update-ZoomMeeting @params It 'Uses the correct method' { $request.Method | Should Be 'PATCH' @@ -3081,7 +3031,7 @@ Describe 'Update-ZoomMeetingLiveStreamStatus' { PageUrl = $PageUrl } - $request = Update-ZoomMeetingLiveStreamStatus @params @ApiKeySecret + $request = Update-ZoomMeetingLiveStreamStatus @params It 'Uses the correct method' { $request.Method | Should Be 'PATCH' @@ -3131,7 +3081,7 @@ Describe 'Update-ZoomMeetingLiveStream' { PageUrl = $PageUrl } - $request = Update-ZoomMeetingLiveStream @params @ApiKeySecret + $request = Update-ZoomMeetingLiveStream @params It 'Uses the correct method' { $request.Method | Should Be 'PATCH' @@ -3204,7 +3154,7 @@ Describe 'Update-ZoomMeetingPoll' { ) } - $request = Update-ZoomMeetingPoll @params @ApiKeySecret + $request = Update-ZoomMeetingPoll @params It 'Uses the correct method' { $request.Method | Should Be 'PUT' @@ -3332,7 +3282,7 @@ Describe 'Update-ZoomMeetingRegistrationQuestions' { ) } - $request = Update-ZoomMeetingRegistrationQuestions @params @ApiKeySecret + $request = Update-ZoomMeetingRegistrationQuestions @params It 'Uses the correct method' { $request.Method | Should Be 'PATCH' @@ -3398,7 +3348,7 @@ Describe 'Update-ZoomMeetingRegistrantStatus' { ) } - $request = Update-ZoomMeetingRegistrantStatus @params @ApiKeySecret + $request = Update-ZoomMeetingRegistrantStatus @params It 'Uses the correct method' { $request.Method | Should Be 'PUT' @@ -3430,7 +3380,7 @@ Describe 'Update-ZoomMeetingStatus' { } }' - $request = Update-ZoomMeetingStatus -MeetingId $MeetingId @ApiKeySecret + $request = Update-ZoomMeetingStatus -MeetingId $MeetingId It 'Uses the correct method' { $request.Method | Should Be 'PUT' @@ -3461,7 +3411,7 @@ Describe 'Get-ZoomWebinar' { ] }' - $request = Get-ZoomWebinar -WebinarId $MeetingId @ApiKeySecret + $request = Get-ZoomWebinar -WebinarId $MeetingId It 'Uses the correct method' { $request.Method | Should Be 'GET' @@ -3487,7 +3437,7 @@ Describe 'Get-ZoomWebinarsFromUser' { ] }' - $request = Get-ZoomWebinarsFromUser -UserId $UserId @ApiKeySecret + $request = Get-ZoomWebinarsFromUser -UserId $UserId It 'Uses the correct method' { $request.Method | Should Be 'GET'