rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -57,6 +57,20 @@ class Wincher_Route implements Route_Interface {
*/
const UNTRACK_KEYPHRASE_ROUTE = self::ROUTE_PREFIX . '/keyphrases/untrack';
/**
* The check limit route constant.
*
* @var string
*/
const CHECK_LIMIT_ROUTE = self::ROUTE_PREFIX . '/account/limit';
/**
* The upgrade campaign route constant.
*
* @var string
*/
const UPGRADE_CAMPAIGN_ROUTE = self::ROUTE_PREFIX . '/account/upgrade-campaign';
/**
* The login action.
*
@@ -171,6 +185,22 @@ class Wincher_Route implements Route_Interface {
];
\register_rest_route( Main::API_V1_NAMESPACE, self::UNTRACK_KEYPHRASE_ROUTE, $delete_keyphrase_route_args );
$check_limit_route_args = [
'methods' => 'GET',
'callback' => [ $this, 'check_limit' ],
'permission_callback' => [ $this, 'can_use_wincher' ],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::CHECK_LIMIT_ROUTE, $check_limit_route_args );
$get_upgrade_campaign_route_args = [
'methods' => 'GET',
'callback' => [ $this, 'get_upgrade_campaign' ],
'permission_callback' => [ $this, 'can_use_wincher' ],
];
\register_rest_route( Main::API_V1_NAMESPACE, self::UPGRADE_CAMPAIGN_ROUTE, $get_upgrade_campaign_route_args );
}
/**
@@ -244,6 +274,27 @@ class Wincher_Route implements Route_Interface {
return new WP_REST_Response( $data, $data->status );
}
/**
* Checks the account limit.
*
* @return WP_REST_Response The response.
*/
public function check_limit() {
$data = $this->account_action->check_limit();
return new WP_REST_Response( $data, $data->status );
}
/**
* Gets the upgrade campaign.
* If it's not a free user, no campaign is returned.
*
* @return WP_REST_Response The response.
*/
public function get_upgrade_campaign() {
$data = $this->account_action->get_upgrade_campaign();
return new WP_REST_Response( $data, $data->status );
}
/**
* Checks if a valid code was returned.
*