webberzone.dev Recent

Webhook_Handler class Pro only

Webhook_Handler

Webhook Handler class.

Namespace: WebberZone\Knowledge_Base\Pro\GitHub
Since: 3.1.0
Source: includes/github/class-webhook-handler.php line 24

Methods

__construct()

Constructor.

Since: 3.1.0
Line: 49

public function __construct( API $api );
TypeNameDescription
API$apiGitHub API instance.

register_routes()

Register the webhook REST endpoint.

Since: 3.1.0
Line: 60

public function register_routes(  ): void;

Returns: void

handle_webhook()

Handle incoming webhook POST request.

Since: 3.1.0
Line: 92

public function handle_webhook( WP_REST_Request $request ): \WP_REST_Response|\WP_Error;
TypeNameDescription
\WP_REST_Request$requestThe incoming REST request.

Returns: \WP_REST_Response|\WP_Error

process_queued_job()

Process a queued webhook job in bounded, self-rescheduling chunks.

Each invocation handles up to wzkb_github_webhook_chunk_size operations, then either re-schedules itself for the remainder (persisting progress in the job option) or, when the queue is drained, logs the aggregate result, rebuilds the link path map, and deletes the job option. Operations that error are re-queued up to 3 attempts before being recorded as a permanent failure. The remaining operations list itself acts as the progress cursor.

Since: 3.1.0
Line: 335

public function process_queued_job( string $delivery_id ): void;
TypeNameDescription
string$delivery_idDelivery identifier used to look up the job option.

Returns: void

handle_validate()

Validate GitHub connection (PAT + repository access).

Admin-only endpoint. Tests the GitHub PAT and verifies the configured repository exists and is accessible.

Accepts an optional pat query parameter. When provided, that token is used instead of the saved global setting — used by the per-mapping “Verify Token” button before settings are saved.

Since: 3.1.0
Line: 510

public function handle_validate( WP_REST_Request $request ): WP_REST_Response;
TypeNameDescription
\WP_REST_Request$requestThe incoming REST request.

Returns: WP_REST_Response