@@ -80,6 +80,9 @@ function Invoke-GHRestMethod
8080 If specified, this will save the result to a temporary file and return the FileInfo of that
8181 temporary file.
8282
83+ . PARAMETER ApiVersion
84+ Indicates the version of this API that should be used. Format is: 'yyyy-MM-dd'.
85+
8386 . PARAMETER AccessToken
8487 If provided, this will be used as the AccessToken for authentication with the
8588 REST Api as opposed to requesting a new one.
@@ -145,6 +148,9 @@ function Invoke-GHRestMethod
145148
146149 [switch ] $Save ,
147150
151+ [ValidatePattern (' ^\d{4}-\d{2}-\d{2}$' )]
152+ [string ] $ApiVersion = " 2022-11-28" ,
153+
148154 [string ] $AccessToken ,
149155
150156 [string ] $TelemetryEventName = $null ,
@@ -232,6 +238,7 @@ function Invoke-GHRestMethod
232238 $headers = @ {
233239 ' Accept' = $AcceptHeader
234240 ' User-Agent' = ' PowerShellForGitHub'
241+ ' X-GitHub-Api-Version' = $ApiVersion
235242 }
236243
237244 # Add any additional headers
@@ -609,6 +616,9 @@ function Invoke-GHRestMethodMultipleResult
609616 Allows the caller to specify any number of additional headers that should be added to
610617 all of the requests made.
611618
619+ . PARAMETER ApiVersion
620+ Indicates the version of this API that should be used. Format is: 'yyyy-MM-dd'.
621+
612622 . PARAMETER AccessToken
613623 If provided, this will be used as the AccessToken for authentication with the
614624 REST Api as opposed to requesting a new one.
@@ -660,6 +670,9 @@ function Invoke-GHRestMethodMultipleResult
660670
661671 [hashtable ] $AdditionalHeader = @ {},
662672
673+ [ValidatePattern (' ^\d{4}-\d{2}-\d{2}$' )]
674+ [string ] $ApiVersion = " 2022-11-28" ,
675+
663676 [string ] $AccessToken ,
664677
665678 [string ] $TelemetryEventName = $null ,
@@ -700,6 +713,7 @@ function Invoke-GHRestMethodMultipleResult
700713 ' AcceptHeader' = $AcceptHeader
701714 ' AdditionalHeader' = $AdditionalHeader
702715 ' ExtendedResult' = $true
716+ ' ApiVersion' = $ApiVersion
703717 ' AccessToken' = $AccessToken
704718 ' TelemetryProperties' = $telemetryProperties
705719 ' TelemetryExceptionBucket' = $errorBucket
0 commit comments