public/helper/Send-TwitterMedia_SubtitlesDelete.ps1

function Send-TwitterMedia_SubtitlesDelete {
<#
.SYNOPSIS
    Upload media

.DESCRIPTION
    POST media/subtitles/delete
    
    Overview
    
    Use this endpoint to dissociate subtitles from a video and delete the subtitles. You can dissociate subtitles from a video before or after Tweeting.
    
    Request
    
    Requests should be HTTP POST with a JSON content body, and Content-Type application/json; charset=UTF-8
    
    Note: The domain for this endpoint is upload.twitter.com
    
    Response Codes
    
    This endpoint returns the following HTTP responses:
    
    Status Text Description
    200 OK The request to create the subtitle was successful.
    400 Bad Request Generally, this response occurs due to the presence of invalid JSON in the request, or where the request failed to send any JSON payload. In this case this error could indicate an invalid subtitle file.
    403 Unauthorized HTTP authentication failed due to invalid credentials. Check your OAuth keys and tokens.
    404 Not Found The resource was not found at the URL to which the request was sent, likely because an incorrect media_id
    500 Internal Server Error There was an error on Twitter's side. Retry your request using an exponential backoff pattern.
    503 Service Unavailable There was an error on Twitter's side. Retry your request using an exponential backoff pattern.


.NOTES
    This helper function was generated by the information provided here:
    https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-subtitles-delete

#>

    [CmdletBinding()]
    Param(
        
    )
    Begin {

        [hashtable]$Parameters = $PSBoundParameters
                   $CmdletBindingParameters | ForEach-Object { $Parameters.Remove($_) }

        [string]$Method      = 'POST'
        [string]$Resource    = '/media/subtitles/delete'
        [string]$ResourceUrl = 'https://upload.twitter.com/1.1/media/subtitles/delete.json'

    }
    Process {

        # Find & Replace any ResourceUrl parameters.
        $UrlParameters = [regex]::Matches($ResourceUrl, '(?<!\w):\w+')
        ForEach ($UrlParameter in $UrlParameters) {
            $UrlParameterValue = $Parameters["$($UrlParameter.Value.TrimStart(":"))"]
            $ResourceUrl = $ResourceUrl -Replace $UrlParameter.Value, $UrlParameterValue
        }

        $OAuthSettings = Get-TwitterOAuthSettings -Resource $Resource
        Invoke-TwitterAPI -Method $Method -ResourceUrl $ResourceUrl -Parameters $Parameters -OAuthSettings $OAuthSettings

    }
    End {

    }
}