@@ -774,6 +774,74 @@ type PageBuildEvent struct {
774774 Installation * Installation `json:"installation,omitempty"`
775775}
776776
777+ // PersonalAccessTokenRequestEvent occurs when there is activity relating to a
778+ // request for a fine-grained personal access token to access resources that
779+ // belong to a resource owner that requires approval for token access.
780+ // The webhook event name is "personal_access_token_request".
781+ //
782+ // GitHub API docs: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#personal_access_token_request
783+ type PersonalAccessTokenRequestEvent struct {
784+ // Action is the action that was performed. Possible values are:
785+ // "approved", "cancelled", "created" or "denied"
786+ Action * string `json:"action,omitempty"`
787+ PersonalAccessTokenRequest * PersonalAccessTokenRequest `json:"personal_access_token_request,omitempty"`
788+ Org * Organization `json:"organization,omitempty"`
789+ Sender * User `json:"sender,omitempty"`
790+ Installation * Installation `json:"installation,omitempty"`
791+ }
792+
793+ // PersonalAccessTokenRequest contains the details of a PersonalAccessTokenRequestEvent.
794+ type PersonalAccessTokenRequest struct {
795+ // Unique identifier of the request for access via fine-grained personal
796+ // access token. Used as the pat_request_id parameter in the list and review
797+ // API calls.
798+ ID * int64 `json:"id,omitempty"`
799+ Owner * User `json:"owner,omitempty"`
800+
801+ // New requested permissions, categorized by type of permission.
802+ PermissionsAdded * PersonalAccessTokenPermissions `json:"permissions_added,omitempty"`
803+
804+ // Requested permissions that elevate access for a previously approved
805+ // request for access, categorized by type of permission.
806+ PermissionsUpgraded * PersonalAccessTokenPermissions `json:"permissions_upgraded,omitempty"`
807+
808+ // Permissions requested, categorized by type of permission.
809+ // This field incorporates permissions_added and permissions_upgraded.
810+ PermissionsResult * PersonalAccessTokenPermissions `json:"permissions_result,omitempty"`
811+
812+ // Type of repository selection requested. Possible values are:
813+ // "none", "all" or "subset"
814+ RepositorySelection * string `json:"repository_selection,omitempty"`
815+
816+ // The number of repositories the token is requesting access to.
817+ // This field is only populated when repository_selection is subset.
818+ RepositoryCount * int64 `json:"repository_count,omitempty"`
819+
820+ // An array of repository objects the token is requesting access to.
821+ // This field is only populated when repository_selection is subset.
822+ Repositories []* Repository `json:"repositories,omitempty"`
823+
824+ // Date and time when the request for access was created.
825+ CreatedAt * Timestamp `json:"created_at,omitempty"`
826+
827+ // Whether the associated fine-grained personal access token has expired.
828+ TokenExpired * bool `json:"token_expired,omitempty"`
829+
830+ // Date and time when the associated fine-grained personal access token expires.
831+ TokenExpiresAt * Timestamp `json:"token_expires_at,omitempty"`
832+
833+ // Date and time when the associated fine-grained personal access token was last used for authentication.
834+ TokenLastUsedAt * Timestamp `json:"token_last_used_at,omitempty"`
835+ }
836+
837+ // PersonalAccessTokenPermissions represents the original or newly requested
838+ // scope of permissions for a fine-grained personal access token within a PersonalAccessTokenRequest.
839+ type PersonalAccessTokenPermissions struct {
840+ Org map [string ]string `json:"organization,omitempty"`
841+ Repo map [string ]string `json:"repository,omitempty"`
842+ Other map [string ]string `json:"other,omitempty"`
843+ }
844+
777845// PingEvent is triggered when a Webhook is added to GitHub.
778846//
779847// GitHub API docs: https://developer.github.com/webhooks/#ping-event
0 commit comments