ProduktInShop.psm1
function Set-ProduktInShop { [CmdletBinding()] param( [Parameter(Mandatory, HelpMessage = "Uid des Shops")] $ShopUid, [Parameter(Mandatory, HelpMessage = "Uid des Produkts")] $ProduktUid, [Parameter(HelpMessage = "Zweistelliger Sprachcode (ISO 639-1), z.B. fr, en oder it")] [string]$Sprache, [string]$InfoText, [string]$KundenUrl ) process { $Body = [PSCustomObject]@{ type = "ProduktInShop"; }; $ConvertedShopUid = ConvertTo-WeeduGuid $ShopUid; $ConvertedProduktUid = ConvertTo-WeeduGuid $ProduktUid; if ($PSBoundParameters.ContainsKey("InfoText")) { $Body | Add-Member -MemberType NoteProperty -Name "InfoText" -Value $InfoText; } if ($PSBoundParameters.ContainsKey("KundenUrl")) { $Body | Add-Member -MemberType NoteProperty -Name "KundensichtUrl" -Value $KundenUrl; } if ($PSBoundParameters.ContainsKey("Sprache")) { $res = Invoke-Weedu -Uri "/rest/shops/{0}/produkte/{1}/{2}" -UriParams @($ConvertedShopUid, $ConvertedProduktUid, $Sprache) -Method PUT -Body $Body; } else { $res = Invoke-Weedu -Uri "/rest/shops/{0}/produkte/{1}" -UriParams @($ConvertedShopUid, $ConvertedProduktUid) -Method PUT -Body $Body; } return $res; } } function Remove-ProduktInShop { [CmdletBinding()] param( [Parameter(Mandatory, HelpMessage = "Uid des Shops")] $ShopUid, [Parameter(Mandatory, HelpMessage = "Uid des Produkts")] $ProduktUid, [Parameter(HelpMessage = "Zweistelliger Sprachcode (ISO 639-1), z.B. fr, en oder it")] [string]$Sprache ) process { $ConvertedShopUid = ConvertTo-WeeduGuid $ShopUid; $ConvertedProduktUid = ConvertTo-WeeduGuid $ProduktUid; if ($PSBoundParameters.ContainsKey("Sprache")) { $res = Invoke-Weedu -Uri "/rest/shops/{0}/produkte/{1}/{2}" -UriParams @($ConvertedShopUid, $ConvertedProduktUid, $Sprache) -Method DELETE; } else { $res = Invoke-Weedu -Uri "/rest/shops/{0}/produkte/{1}" -UriParams @($ConvertedShopUid, $ConvertedProduktUid) -Method DELETE; } return $res; } } Export-ModuleMember -function Set-ProduktInShop Export-ModuleMember -function Remove-ProduktInShop |