id = 'thinkrank/get-seo-analyzer'; $this->label = __( 'Get Site SEO Analyzer Audit', 'thinkrank' ); $this->description = __( 'Retrieve the latest whole-site SEO audit (Site SEO Analyzer): overall 0-100 score, letter grade, summary counts, and per-check results across Basic, Advanced, Content, Performance, and Security. Returns the cached audit (refreshed hourly); use run-seo-analyzer for a fresh run.', 'thinkrank' ); } /** * {@inheritDoc} * * @return array */ public function get_annotations() { return [ 'readonly' => true, 'destructive' => false, 'idempotent' => true, 'priority' => 1.0, 'openWorldHint' => false, ]; } /** * {@inheritDoc} * * @return array */ public function get_input_schema() { return [ 'type' => 'object', 'additionalProperties' => false, 'properties' => self::empty_properties(), ]; } /** * {@inheritDoc} * * @return array */ public function get_output_schema() { return $this->audit_output_schema(); } /** * Execute ability. * * @param array $input Ability input payload. * @return array */ public function execute( $input ) { $analyzer = new SEO_Analyzer(); return $analyzer->run( false ); } /** * Shared output schema for the audit payload. * * @return array */ protected function audit_output_schema() { return [ 'type' => 'object', 'additionalProperties' => true, 'properties' => [ 'overall_score' => [ 'type' => 'integer' ], 'grade' => [ 'type' => 'string' ], 'summary' => [ 'type' => 'object', 'additionalProperties' => true, ], 'categories' => [ 'type' => 'array', 'items' => [ 'type' => 'object', 'additionalProperties' => true, ], ], 'checks' => [ 'type' => 'array', 'items' => [ 'type' => 'object', 'additionalProperties' => true, ], ], 'generated_at' => [ 'type' => 'string' ], ], ]; } }