Public/Copy-GhostPost.ps1

function Copy-GhostPost {
    <#
    .SYNOPSIS
        Copies a post to a new draft.

    .DESCRIPTION
        Duplicates a post and returns the copy. The copy is a draft, whatever the status of the original, and
        Ghost adds (Copy) to its title.

    .EXAMPLE
        Copy-GhostPost -Id '5b7ada404f87d200b5b1f9c8'

        Creates a draft that is a copy of the post.

    .EXAMPLE
        Get-GhostPost -Slug 'monthly-template' | Copy-GhostPost | Set-GhostPost -Title 'Monthly update: June'

        Starts a new post from a template post.

    .LINK
        https://docs.ghost.org/admin-api/posts/copying-a-post
    #>

    [CmdletBinding(SupportsShouldProcess)]
    [OutputType('Ghost.Post')]
    param(
        # Id of the post to copy.
        [Parameter(Mandatory, Position = 0, ValueFromPipelineByPropertyName)]
        [ValidateNotNullOrEmpty()]
        [string] $Id
    )

    begin {
        Test-GhostConnection
        $resources = Get-GhostAPIData -Endpoint $MyInvocation.MyCommand.Name
    }

    process {
        try {
            $uri = New-URIString -Endpoint $resources.URI -Parameters $PSBoundParameters

            if ($PSCmdlet.ShouldProcess($Id, $resources.Description)) {
                $result = Submit-Request -Uri $uri -Method $resources.Method -Success $resources.Success
                $result = Test-ReturnFormat -Result $result -Location $resources.Result

                Set-ObjectTypeName -InputObject $result -TypeName $resources.TypeName
            }
        }
        catch {
            $PSCmdlet.ThrowTerminatingError($_)
        }
    }
}