-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
featureNew featureNew feature
Description
Description
Want to be able so say that a certain type of functions can only be called with JWT (App) some can only be called as a user, functions requires specific permissions... etc. Many things to be able to check... !
- Assert-GitHubContext -AuthType 'APP','IAT','UAT','PAT'
-
Implement in Invoke-GitHubAPI
function Invoke-GitHubAPI {
param(
# The requirements for the function call. This is used to determine if the context is valid for the API call.
# Keys:
# - name: AuthType
# description: The type of token required for the command.
# type: [string[]]
# allowedValues: ['UAT', 'PAT', 'App', 'IAT']
[Parameter()]
[hashtable] $Requires,
)
# Validate if the requirements for the API call are met
$callingFunction = (Get-PSCallStack)[1].Command
if ($callingFunction -ne '<ScriptBlock>' -and $PSBoundParameters.ContainsKey('Requires')) {
$check = @{
Command = $callingFunction
Requires = $Requires
Context = $Context
}
Assert-GitHubContext @check
}
}- Implement in functions
- Implement in functiontemplate
For functions:
$inputObject = @{
Context = $Context
APIEndpoint = '/app/installations'
Method = 'GET'
Requires = @{
AuthType = 'App'
}
}Metadata
Metadata
Assignees
Labels
featureNew featureNew feature
Type
Projects
Status
Done