Commands/Lexicons/com/atproto/moderation/Add-AtProtoModerationReport.ps1
function Add-AtProtoModerationReport { <# .Synopsis com.atproto.moderation.createReport .Description com.atproto.moderation.createReport .Link https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto/moderation/createReport.json #> [Alias('Add-AtProtocolModerationReport','atproto.moderation.createReport','com.atproto.moderation.createReport')] [CmdletBinding(SupportsShouldProcess)] param( [Parameter(ValueFromPipelineByPropertyName)] [ComponentModel.DefaultBindingProperty('reasonType')] [Management.Automation.PSObject] $ReasonType, [Parameter(ValueFromPipelineByPropertyName)] [ComponentModel.DefaultBindingProperty('reason')] [String] $Reason, [Parameter(ValueFromPipelineByPropertyName)] [ComponentModel.DefaultBindingProperty('subject')] [Management.Automation.PSObject] $Subject ) begin { $NamespaceID = 'com.atproto.moderation.createReport' $httpMethod = 'POST' $InvokeAtSplat = [Ordered]@{Method=$httpMethod} $InvokeAtSplat.DecorateProperty = [Ordered]@{ 'reasonType'='com.atproto.moderation.defs#reasonType' } $InvokeAtSplat["PSTypeName"] = $NamespaceID $parameterAliases = [Ordered]@{} $AsByte = $false :nextParameter foreach ($paramMetadata in ([Management.Automation.CommandMetadata]$MyInvocation.MyCommand).Parameters.Values) { foreach ($attr in $paramMetadata.Attributes) { if ($attr -is [ComponentModel.DefaultBindingPropertyAttribute]) { $parameterAliases[$paramMetadata.Name] = $attr.Name continue nextParameter } } } $parameterQueue = [Collections.Queue]::new() } process { $parameterQueue.Enqueue([Ordered]@{} + $PSBoundParameters) } end { $parameterQueue.ToArray() | Invoke-AtProtocol -Method $httpMethod -NamespaceID $NamespaceID -Parameter { $_ } -ParameterAlias $parameterAliases @InvokeAtSplat -ContentType $( if ($ContentType) { $ContentType } else { "application/json" } ) -AsByte:$AsByte -Property { $_ } -Cache:$( if ($cache) {$cache} else { $false } ) } } |