IntegrationInterface.php
91 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Interface that should be implemented by all provider integrations. |
| 4 | * |
| 5 | * @package Automattic\WooCommerce\Internal\ProductFeed |
| 6 | */ |
| 7 | |
| 8 | declare(strict_types=1); |
| 9 | |
| 10 | namespace Automattic\WooCommerce\Internal\ProductFeed\Integrations; |
| 11 | |
| 12 | use Automattic\WooCommerce\Internal\ProductFeed\Feed\FeedInterface; |
| 13 | use Automattic\WooCommerce\Internal\ProductFeed\Feed\FeedValidatorInterface; |
| 14 | use Automattic\WooCommerce\Internal\ProductFeed\Feed\ProductMapperInterface; |
| 15 | |
| 16 | if ( ! defined( 'ABSPATH' ) ) { |
| 17 | exit; |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * IntegrationInterface |
| 22 | * |
| 23 | * @since 10.5.0 |
| 24 | */ |
| 25 | interface IntegrationInterface { |
| 26 | /** |
| 27 | * Get the ID of the provider. |
| 28 | * |
| 29 | * @return string The ID of the provider. |
| 30 | */ |
| 31 | public function get_id(): string; |
| 32 | |
| 33 | /** |
| 34 | * Register hooks for the integration. |
| 35 | * |
| 36 | * @return void |
| 37 | */ |
| 38 | public function register_hooks(): void; |
| 39 | |
| 40 | /** |
| 41 | * Activate the integration. |
| 42 | * |
| 43 | * This method is called when the plugin is activated. |
| 44 | * If there is ever a setting that controls active integrations, |
| 45 | * this method might also be called when the integration is activated. |
| 46 | * |
| 47 | * @return void |
| 48 | */ |
| 49 | public function activate(): void; |
| 50 | |
| 51 | /** |
| 52 | * Deactivate the integration. |
| 53 | * |
| 54 | * This method is called when the plugin is deactivated. |
| 55 | * If there is ever a setting that controls active integrations, |
| 56 | * this method might also be called when the integration is deactivated. |
| 57 | * |
| 58 | * @return void |
| 59 | */ |
| 60 | public function deactivate(): void; |
| 61 | |
| 62 | /** |
| 63 | * Get the query arguments for the product feed. |
| 64 | * |
| 65 | * @see wc_get_products() |
| 66 | * @return array The query arguments. |
| 67 | */ |
| 68 | public function get_product_feed_query_args(): array; |
| 69 | |
| 70 | /** |
| 71 | * Create a feed that is to be populated. |
| 72 | * |
| 73 | * @return FeedInterface The feed. |
| 74 | */ |
| 75 | public function create_feed(): FeedInterface; |
| 76 | |
| 77 | /** |
| 78 | * Get the product mapper for the provider. |
| 79 | * |
| 80 | * @return ProductMapperInterface The product mapper. |
| 81 | */ |
| 82 | public function get_product_mapper(): ProductMapperInterface; |
| 83 | |
| 84 | /** |
| 85 | * Get the feed validator for the provider. |
| 86 | * |
| 87 | * @return FeedValidatorInterface The feed validator. |
| 88 | */ |
| 89 | public function get_feed_validator(): FeedValidatorInterface; |
| 90 | } |
| 91 |