Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/versioning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Bumping release to ${{ steps.buildUpdate.outputs.v }}
branch: release
push_options: '--force'
Minor:
if: startsWith(github.head_ref, 'minor/') && github.event.pull_request.merged == true
outputs:
Expand All @@ -62,6 +64,7 @@ jobs:
with:
commit_message: Bumping release to ${{ steps.buildUpdate.outputs.v }}
branch: release
push_options: '--force'
Major:
if: startsWith(github.head_ref, 'major/') && github.event.pull_request.merged == true
outputs:
Expand All @@ -86,4 +89,5 @@ jobs:
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Bumping release to ${{ steps.buildUpdate.outputs.v }}
branch: release
branch: release
push_options: '--force'
46 changes: 42 additions & 4 deletions docs/function-documentation/Invoke-VerkadaFormCall.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@ Used to build an Invoke-RestMethod call for Verkada's private API enpoints that

## SYNTAX

### Default (Default)
```
Invoke-VerkadaFormCall [-url] <String> [-org_id] <String> [-form_params] <Object> [-method <String>]
-x_verkada_token <String> -x_verkada_auth <String> [-ProgressAction <ActionPreference>] [<CommonParameters>]
Invoke-VerkadaFormCall [-url] <String> [-org_id] <String> [-form_params] <Object> [-query_params <Object>]
[-method <String>] [-x_verkada_auth_api <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
```

### UnPwd
```
Invoke-VerkadaFormCall [-url] <String> [-org_id] <String> [-form_params] <Object> [-query_params <Object>]
[-method <String>] -x_verkada_token <String> -x_verkada_auth <String> [-ProgressAction <ActionPreference>]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -76,6 +84,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -query_params
Object containing the query parameters need that will be put into the query string of the uri

```yaml
Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -method
HTTP method required

Expand All @@ -96,7 +119,7 @@ The Verkada(CSRF) token of the user running the command

```yaml
Type: String
Parameter Sets: (All)
Parameter Sets: UnPwd
Aliases:

Required: True
Expand All @@ -111,7 +134,7 @@ The Verkada Auth(session auth) token of the user running the command

```yaml
Type: String
Parameter Sets: (All)
Parameter Sets: UnPwd
Aliases:

Required: True
Expand All @@ -121,6 +144,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -x_verkada_auth_api
The public API token obatined via the Login endpoint to be used for calls that hit the public API gateway

```yaml
Type: String
Parameter Sets: Default
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ProgressAction
{{ Fill ProgressAction Description }}

Expand Down
76 changes: 53 additions & 23 deletions docs/function-documentation/Set-VerkadaAccessUserProfilePicture.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ schema: 2.0.0
# Set-VerkadaAccessUserProfilePicture

## SYNOPSIS
Adds/replaces an Access user's profile picture in an organization.
Adds/replaces an Access user's profile picture in an organization using https://apidocs.verkada.com/reference/putprofilephotoviewv1

## SYNTAX

```
Set-VerkadaAccessUserProfilePicture [[-userId] <String>] [[-imagePath] <String>] [[-org_id] <String>]
[[-x_verkada_token] <String>] [[-x_verkada_auth] <String>] [[-usr] <String>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
Set-VerkadaAccessUserProfilePicture [[-userId] <String>] [[-externalId] <String>] [[-imagePath] <String>]
[[-overwrite] <Boolean>] [[-org_id] <String>] [[-x_verkada_auth_api] <String>] [[-region] <String>]
[-errorsToFile] [-ProgressAction <ActionPreference>] [<CommonParameters>]
```

## DESCRIPTION
This will set the Access user's, specified by the userId, profile picture.
This will set the Access user's, specified by the user_Id or external_ID, profile picture.
This must be a png or jpeg/jpg format image.
The org_id and reqired tokens can be directly submitted as parameters, but is much easier to use Connect-Verkada to cache this information ahead of time and for subsequent commands.
The org_id and reqired token can be directly submitted as parameters, but is much easier to use Connect-Verkada to cache this information ahead of time and for subsequent commands.

## EXAMPLES

Expand All @@ -33,8 +33,8 @@ This sets the Access user with userId 801c9551-b04c-4293-84ad-b0a6aa0588b3 to us

### EXAMPLE 2
```
Set-VerkadaAccessUserProfilePicture -userId '801c9551-b04c-4293-84ad-b0a6aa0588b3' -imagePath './myPicture.png' -org_id '7cd47706-f51b-4419-8675-3b9f0ce7c12d' -x_verkada_token 'a366ef47-2c20-4d35-a90a-10fd2aee113a' -x_verkada_auth 'auth-token-uuid-dscsdc' -usr 'a099bfe6-34ff-4976-9d53-ac68342d2b60'
This sets the Access user with userId 801c9551-b04c-4293-84ad-b0a6aa0588b3 to use the picture specified at path ./myPicture.png. The org_id and tokens are submitted as parameters in the call.
Set-VerkadaAccessUserProfilePicture -externalId 'newUserUPN@contoso.com' -imagePath './myPicture.png' -overwrite $true -org_id '7cd47706-f51b-4419-8675-3b9f0ce7c12d' -x_verkada_auth_api 'sd78ds-uuid-of-verkada-token'
This sets the Access user with externalId newUserUPN@contoso.com to use the picture specified at path ./myPicture.png and will overwrite the existing photo. The org_id and tokens are submitted as parameters in the call.
```

## PARAMETERS
Expand All @@ -54,6 +54,21 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -externalId
unique identifier managed externally provided by the consumer

```yaml
Type: String
Parameter Sets: (All)
Aliases: external_id

Required: False
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -imagePath
This is the path the image will be uploaded from

Expand All @@ -63,12 +78,27 @@ Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -overwrite
The flag that states whether to overwrite the existing profile photo

```yaml
Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: False
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -org_id
The UUID of the organization the user belongs to

Expand All @@ -78,53 +108,53 @@ Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Position: 5
Default value: $Global:verkadaConnection.org_id
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -x_verkada_token
The Verkada(CSRF) token of the user running the command
### -x_verkada_auth_api
The public API token obatined via the Login endpoint to be used for calls that hit the public API gateway

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: $Global:verkadaConnection.csrfToken
Position: 6
Default value: $Global:verkadaConnection.x_verkada_auth_api
Accept pipeline input: False
Accept wildcard characters: False
```

### -x_verkada_auth
The Verkada Auth(session auth) token of the user running the command
### -region
The region of the public API to be used

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: $Global:verkadaConnection.userToken
Position: 7
Default value: Api
Accept pipeline input: False
Accept wildcard characters: False
```

### -usr
The UUID of the user account making the request
### -errorsToFile
Switch to write errors to file

```yaml
Type: String
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: 6
Default value: $Global:verkadaConnection.usr
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
Expand Down
37 changes: 30 additions & 7 deletions verkadaModule/Private/Invoke-VerkadaFormCall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function Invoke-VerkadaFormCall
Private function to build Invoke-RestMethod calls for Verkada's private API enpoints that require a form
#>

[CmdletBinding(PositionalBinding = $true)]
[CmdletBinding(PositionalBinding = $true, DefaultParameterSetName = 'Default')]
Param(
#The url for the enpoint to be used
[Parameter(Mandatory = $true, Position = 0)]
Expand All @@ -20,24 +20,47 @@ function Invoke-VerkadaFormCall
#Object to pass form parameters to forms
[Parameter(Mandatory = $true,Position = 2)]
[Object]$form_params,
#Object containing the query parameters need that will be put into the query string of the uri
[Parameter()]
[Object]$query_params,
#HTTP method required
[Parameter()]
[String]$method = 'POST',
#The Verkada(CSRF) token of the user running the command
[Parameter(Mandatory = $true)]
[Parameter(Mandatory = $true, ParameterSetName = 'UnPwd')]
[ValidateNotNullOrEmpty()]
[ValidatePattern('^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$')]
[string]$x_verkada_token,
#The Verkada Auth(session auth) token of the user running the command
[Parameter(Mandatory = $true)]
[Parameter(Mandatory = $true, ParameterSetName = 'UnPwd')]
[ValidateNotNullOrEmpty()]
[string]$x_verkada_auth
[string]$x_verkada_auth,
#The public API token obatined via the Login endpoint to be used for calls that hit the public API gateway
[Parameter(ParameterSetName = 'Default')]
[String]$x_verkada_auth_api
)

Process {
$headers=@{
'x-verkada-token' = $x_verkada_token
'X-Verkada-Auth' = $x_verkada_auth
if ($PSCmdlet.ParameterSetName -eq 'UnPwd'){
$headers=@{
'x-verkada-token' = $x_verkada_token
'X-Verkada-Auth' = $x_verkada_auth
}
} else {
$headers=@{
'x-verkada-auth' = $x_verkada_auth_api
}
}

if($query_params){
$query = [System.Web.HttpUtility]::ParseQueryString([String]::Empty)
foreach ($qp in $query_params.GetEnumerator()) {
$query.add("$($qp.name)", "$($qp.value)")
}
$uri = [System.UriBuilder]"$url"
$uri.Query = $query.ToString()
$uri = $uri.Uri.OriginalString
$url = $uri
}

$uri = $url
Expand Down
Loading