ConvertTo-APITCGRateLimit

SYNOPSIS

Converts the rate limit headers of a response into a rate limit object

SYNTAX

__AllParameterSets

ConvertTo-APITCGRateLimit [[-Headers] <Object>]

ALIASES

This cmdlet has the following aliases,

  • None

DESCRIPTION

The ConvertTo-APITCGRateLimit cmdlet reads the RateLimit & RateLimit-Policy headers that the APITCG API returns with every response & converts them into an object

Each IP address can make 300 requests per minute

RateLimit-Policy: 300;w=60
RateLimit: limit=300, remaining=292, reset=28

$null is returned when the response does not have a RateLimit header

This is an internal helper function that is used by Invoke-APITCGRequest & Test-APITCGAPIKey

EXAMPLES

EXAMPLE 1

ConvertTo-APITCGRateLimit -Headers $WebResponse.Headers

Returns an object with the Limit, Remaining, ResetSeconds, Policy, ResetAt, & RetrievedAt properties

PARAMETERS

-Headers

The headers object of a web response, both Windows PowerShell & PowerShell 7+ shapes are supported

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Management.Automation.PSObject

NOTES

N/A