Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
wp-content
/
plugins
/
google-listings-and-ads
/
src
/
API
/
Site
/
Controllers
/
MerchantCenter
:
ConnectionController.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php declare( strict_types=1 ); namespace Automattic\WooCommerce\GoogleListingsAndAds\API\Site\Controllers\MerchantCenter; use Automattic\WooCommerce\GoogleListingsAndAds\API\Site\Controllers\BaseController; use Automattic\WooCommerce\GoogleListingsAndAds\API\TransportMethods; defined( 'ABSPATH' ) || exit; /** * Class ConnectionController * * @package Automattic\WooCommerce\GoogleListingsAndAds\API\Site\Controllers\MerchantCenter */ class ConnectionController extends BaseController { /** * Register rest routes with WordPress. */ public function register_routes(): void { $this->register_route( 'mc/connect', [ [ 'methods' => TransportMethods::READABLE, 'callback' => $this->get_connect_callback(), 'permission_callback' => $this->get_permission_callback(), ], 'schema' => $this->get_api_response_schema_callback(), ] ); } /** * Get the callback function for the connection request. * * @return callable */ protected function get_connect_callback(): callable { return function() { return [ 'url' => 'example.com', ]; }; } /** * Get the schema for settings endpoints. * * @return array */ protected function get_schema_properties(): array { return [ 'url' => [ 'description' => __( 'Action that should be completed after connection.', 'google-listings-and-ads' ), 'type' => 'string', 'context' => [ 'view', 'edit' ], 'readonly' => true, ], ]; } /** * Get the item schema name for the controller. * * Used for building the API response schema. * * @return string */ protected function get_schema_title(): string { return 'merchant_center_connection'; } }