MySLP_REST_API
in package
Coordinate REST endpoint groups, shared helpers, and API settings.
Table of Contents
Constants
- ACCOUNT_ENDPOINT : string = 'account'
- REST_NAMESPACE : string = 'myslp-signup/v2'
- SITE_ARCHITECT_ENDPOINT : string = 'site-architect'
- API_REST_NAMESPACE : string = 'myslp/v2'
- ENDPOINT_CLASSES : array<string|int, mixed> = ['Account' => \MySLP_REST_API_Account::class, '...
- All route groups; adding an entry also enables its registration.
Properties
- $coordinator : MySLP_REST_API|null
- The manager used by endpoint groups for compatibility calls.
- $myslp : MySLP
- $slplus : SLPlus
- $DSIGN_key : mixed
- $endpoints : array<string, MySLP_REST_API_Endpoint>
- $paypal_options : array<string|int, mixed>
Methods
- __construct() : mixed
- Default things to do/load when running this plugin
- activate() : void
- Plugin activation function.
- add_account() : WP_REST_Response
- Delegate to the account group for existing PHP callers.
- add_hooks() : void
- Adding hooks
- admin_script() : void
- Include scripts/style for this plugin
- bulk_action_customers() : array<string|int, mixed>|WP_Error
- Delegate to the customers group for existing PHP callers.
- can_manage_accounting() : bool
- Delegate to the accounting group for existing PHP callers.
- create_accounting_key() : WP_REST_Response|WP_Error
- Delegate to the accounting group for existing PHP callers.
- create_accounting_monthly_history() : WP_REST_Response|WP_Error
- Delegate to the accounting group for existing PHP callers.
- delete_accounting_key() : WP_REST_Response|WP_Error
- Delegate to the accounting group for existing PHP callers.
- delete_accounting_monthly_history() : WP_REST_Response|WP_Error
- Delegate to the accounting group for existing PHP callers.
- delete_location() : WP_Error|array<string|int, mixed>
- Delegate to the locations group for existing PHP callers.
- edit_account() : WP_Error|bool|string
- Delegate to the account group for existing PHP callers.
- edit_location() : WP_Error|WP_REST_Response
- Delegate to the locations group for existing PHP callers.
- flush_customer_cache() : WP_REST_Response|WP_Error
- Delegate to the customers group for existing PHP callers.
- generate_api_key() : string
- Generate randomize string for an API key
- get_account_plan() : array<string|int, mixed>
- Get Site Architect levels from the current network, including on customer blogs.
- get_accounting_keys() : WP_REST_Response
- Delegate to the accounting group for existing PHP callers.
- get_accounting_monthly_history() : WP_REST_Response
- Delegate to the accounting group for existing PHP callers.
- get_accounting_monthly_history_keys() : WP_REST_Response
- Delegate to the accounting group for existing PHP callers.
- get_accounting_monthly_matrix() : WP_REST_Response
- Delegate to the accounting group for existing PHP callers.
- get_accounting_revenue_series() : WP_REST_Response
- Delegate to the accounting group for existing PHP callers.
- get_active_customer_stats() : WP_REST_Response
- Delegate to the customers group for existing PHP callers.
- get_customer_details() : array<string|int, mixed>|WP_Error
- Delegate to the customers group for existing PHP callers.
- get_customer_history() : WP_REST_Response|WP_Error
- Delegate to the history group for existing PHP callers.
- get_customer_monthly_views_report() : WP_REST_Response|WP_Error
- Delegate to the customers group for existing PHP callers.
- get_customer_overages() : array<string|int, mixed>|WP_Error
- Delegate to the customers group for existing PHP callers.
- get_customer_subscriptions() : WP_REST_Response|WP_Error
- Delegate to the subscription group for existing PHP callers.
- get_customers() : array<string|int, mixed>
- Delegate to the customers group for existing PHP callers.
- get_endpoint() : string
- Get Endpoint
- get_invoices() : WP_Error|array<string|int, mixed>
- Delegate to the invoices group for existing PHP callers.
- get_locations() : WP_Error|StdClass
- Delegate to the locations group for existing PHP callers.
- get_locations_limit() : WP_Error|WP_REST_Response
- Delegate to the locations group for existing PHP callers.
- get_map_options() : StdClass
- Delegate to the locations group for existing PHP callers.
- get_payment_meta() : WP_Error|array<string|int, mixed>
- Delegate to the account group for existing PHP callers.
- get_signup_endpoint_url() : string
- Return the sign-up REST endpoint URL.
- get_site_architect_endpoint_url() : string
- Return the Site Architect REST endpoint URL.
- get_subscription_customer() : WP_REST_Response|WP_Error
- Delegate to the subscription group for existing PHP callers.
- get_subscription_details() : WP_REST_Response|WP_Error
- Delegate to the subscription group for existing PHP callers.
- get_subscription_invoice() : WP_REST_Response|WP_Error
- Delegate to the subscription group for existing PHP callers.
- get_user_account_info() : array<string|int, mixed>
- Delegate to the accounts group for existing PHP callers.
- myslp_get_base_email() : array<string|int, mixed>|string
- Delegate to the account group for existing PHP callers.
- register_dsra_routes() : void
- Retain the signup and Site Architect registration entry point for PHP callers.
- register_routes() : void
- Register every endpoint group at the existing rest_api_init hook.
- remote_add_location() : WP_Error|WP_REST_Response
- Create a location using the core location save pipeline.
- render_rest_endpoints() : void
- Render the REST endpoint settings panel with explicit view data.
- rest_api_options() : void
- Network admin page for generating an API key
- run_database_management_action() : array<string|int, mixed>|WP_Error
- Delegate to the database management group for existing PHP callers.
- search_map() : WP_Error|StdClass
- Delegate to the locations group for existing PHP callers.
- system_settings() : void
- API setting page
- update_accounting_key() : WP_REST_Response|WP_Error
- Delegate to the accounting group for existing PHP callers.
- update_accounting_monthly_history() : WP_REST_Response|WP_Error
- Delegate to the accounting group for existing PHP callers.
- get_endpoint_controller() : MySLP_REST_API_Endpoint
- Load each endpoint group once and share the existing application context.
- has_valid_api_key() : bool
- Return true if the specified API key is valid.
- send_error() : WP_Error
- Send back an error.
- get_api_key() : mixed
- Return our API key (and cache it).
- get_aws_api_key() : string
- Get AWS Location Services API key.
- get_aws_region() : string
- Return the configured AWS Location Services region.
- save_setting() : void
- Save an admin tab setting.
Constants
ACCOUNT_ENDPOINT
public
string
ACCOUNT_ENDPOINT
= 'account'
REST_NAMESPACE
public
string
REST_NAMESPACE
= 'myslp-signup/v2'
SITE_ARCHITECT_ENDPOINT
public
string
SITE_ARCHITECT_ENDPOINT
= 'site-architect'
API_REST_NAMESPACE
protected
string
API_REST_NAMESPACE
= 'myslp/v2'
ENDPOINT_CLASSES
All route groups; adding an entry also enables its registration.
private
array<string|int, mixed>
ENDPOINT_CLASSES
= ['Account' => \MySLP_REST_API_Account::class, 'Site_Architect' => \MySLP_REST_API_Site_Architect::class, 'Accounts' => \MySLP_REST_API_Accounts::class, 'Invoices' => \MySLP_REST_API_Invoices::class, 'Subscription' => \MySLP_REST_API_Subscription::class, 'Locations' => \MySLP_REST_API_Locations::class, 'Database_Management' => \MySLP_REST_API_Database_Management::class, 'Customers' => \MySLP_REST_API_Customers::class, 'History' => \MySLP_REST_API_History::class, 'Accounting' => \MySLP_REST_API_Accounting::class]
Properties
$coordinator
The manager used by endpoint groups for compatibility calls.
protected
MySLP_REST_API|null
$coordinator
= \null
$myslp
protected
MySLP
$myslp
$slplus
protected
SLPlus
$slplus
$DSIGN_key
private
mixed
$DSIGN_key
= \null
$endpoints
private
array<string, MySLP_REST_API_Endpoint>
$endpoints
= []
Endpoint groups loaded on demand.
$paypal_options
private
array<string|int, mixed>
$paypal_options
= array('api_username' => '', 'api_password' => '', 'api_signature' => '', 'use_ec_sandbox' => '', 'version' => '', 'sbncode' => '', 'use_proxy' => '', 'proxy_host' => '', 'proxy_port' => '')
Methods
__construct()
Default things to do/load when running this plugin
public
__construct() : mixed
activate()
Plugin activation function.
public
static activate() : void
add_account()
Delegate to the account group for existing PHP callers.
public
add_account(WP_REST_Request $request) : WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Responseadd_hooks()
Adding hooks
public
add_hooks() : void
admin_script()
Include scripts/style for this plugin
public
admin_script(mixed $hook) : void
Parameters
- $hook : mixed
bulk_action_customers()
Delegate to the customers group for existing PHP callers.
public
bulk_action_customers(WP_REST_Request $request) : array<string|int, mixed>|WP_Error
Parameters
- $request : WP_REST_Request
Return values
array<string|int, mixed>|WP_Errorcan_manage_accounting()
Delegate to the accounting group for existing PHP callers.
public
can_manage_accounting() : bool
Return values
boolcreate_accounting_key()
Delegate to the accounting group for existing PHP callers.
public
create_accounting_key(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errorcreate_accounting_monthly_history()
Delegate to the accounting group for existing PHP callers.
public
create_accounting_monthly_history(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errordelete_accounting_key()
Delegate to the accounting group for existing PHP callers.
public
delete_accounting_key(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errordelete_accounting_monthly_history()
Delegate to the accounting group for existing PHP callers.
public
delete_accounting_monthly_history(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errordelete_location()
Delegate to the locations group for existing PHP callers.
public
delete_location(mixed $data) : WP_Error|array<string|int, mixed>
Parameters
- $data : mixed
Return values
WP_Error|array<string|int, mixed>edit_account()
Delegate to the account group for existing PHP callers.
public
edit_account(WP_REST_Request $request) : WP_Error|bool|string
Parameters
- $request : WP_REST_Request
Return values
WP_Error|bool|stringedit_location()
Delegate to the locations group for existing PHP callers.
public
edit_location(mixed $data) : WP_Error|WP_REST_Response
Parameters
- $data : mixed
Return values
WP_Error|WP_REST_Responseflush_customer_cache()
Delegate to the customers group for existing PHP callers.
public
flush_customer_cache() : WP_REST_Response|WP_Error
Return values
WP_REST_Response|WP_Errorgenerate_api_key()
Generate randomize string for an API key
public
generate_api_key() : string
Return values
stringget_account_plan()
Get Site Architect levels from the current network, including on customer blogs.
public
get_account_plan() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —The configured levels, or an empty array when unavailable.
get_accounting_keys()
Delegate to the accounting group for existing PHP callers.
public
get_accounting_keys(WP_REST_Request $request) : WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Responseget_accounting_monthly_history()
Delegate to the accounting group for existing PHP callers.
public
get_accounting_monthly_history(WP_REST_Request $request) : WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Responseget_accounting_monthly_history_keys()
Delegate to the accounting group for existing PHP callers.
public
get_accounting_monthly_history_keys() : WP_REST_Response
Return values
WP_REST_Responseget_accounting_monthly_matrix()
Delegate to the accounting group for existing PHP callers.
public
get_accounting_monthly_matrix() : WP_REST_Response
Return values
WP_REST_Responseget_accounting_revenue_series()
Delegate to the accounting group for existing PHP callers.
public
get_accounting_revenue_series(WP_REST_Request $request) : WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Responseget_active_customer_stats()
Delegate to the customers group for existing PHP callers.
public
get_active_customer_stats() : WP_REST_Response
Return values
WP_REST_Responseget_customer_details()
Delegate to the customers group for existing PHP callers.
public
get_customer_details(WP_REST_Request $request) : array<string|int, mixed>|WP_Error
Parameters
- $request : WP_REST_Request
Return values
array<string|int, mixed>|WP_Errorget_customer_history()
Delegate to the history group for existing PHP callers.
public
get_customer_history(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errorget_customer_monthly_views_report()
Delegate to the customers group for existing PHP callers.
public
get_customer_monthly_views_report(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errorget_customer_overages()
Delegate to the customers group for existing PHP callers.
public
get_customer_overages(WP_REST_Request $request) : array<string|int, mixed>|WP_Error
Parameters
- $request : WP_REST_Request
Return values
array<string|int, mixed>|WP_Errorget_customer_subscriptions()
Delegate to the subscription group for existing PHP callers.
public
get_customer_subscriptions(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errorget_customers()
Delegate to the customers group for existing PHP callers.
public
get_customers(WP_REST_Request $request) : array<string|int, mixed>
Parameters
- $request : WP_REST_Request
Return values
array<string|int, mixed>get_endpoint()
Get Endpoint
public
get_endpoint(string $endpoint) : string
Parameters
- $endpoint : string
Return values
stringget_invoices()
Delegate to the invoices group for existing PHP callers.
public
get_invoices() : WP_Error|array<string|int, mixed>
Return values
WP_Error|array<string|int, mixed>get_locations()
Delegate to the locations group for existing PHP callers.
public
get_locations(WP_REST_Request $request) : WP_Error|StdClass
Parameters
- $request : WP_REST_Request
Return values
WP_Error|StdClassget_locations_limit()
Delegate to the locations group for existing PHP callers.
public
get_locations_limit() : WP_Error|WP_REST_Response
Return values
WP_Error|WP_REST_Responseget_map_options()
Delegate to the locations group for existing PHP callers.
public
get_map_options(WP_REST_Request $request) : StdClass
Parameters
- $request : WP_REST_Request
Return values
StdClassget_payment_meta()
Delegate to the account group for existing PHP callers.
public
get_payment_meta(WP_REST_Request $request) : WP_Error|array<string|int, mixed>
Parameters
- $request : WP_REST_Request
Return values
WP_Error|array<string|int, mixed>get_signup_endpoint_url()
Return the sign-up REST endpoint URL.
public
get_signup_endpoint_url() : string
Return values
stringget_site_architect_endpoint_url()
Return the Site Architect REST endpoint URL.
public
get_site_architect_endpoint_url() : string
Return values
stringget_subscription_customer()
Delegate to the subscription group for existing PHP callers.
public
get_subscription_customer(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errorget_subscription_details()
Delegate to the subscription group for existing PHP callers.
public
get_subscription_details(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errorget_subscription_invoice()
Delegate to the subscription group for existing PHP callers.
public
get_subscription_invoice(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errorget_user_account_info()
Delegate to the accounts group for existing PHP callers.
public
get_user_account_info() : array<string|int, mixed>
Return values
array<string|int, mixed>myslp_get_base_email()
Delegate to the account group for existing PHP callers.
public
myslp_get_base_email(mixed $email) : array<string|int, mixed>|string
Parameters
- $email : mixed
Return values
array<string|int, mixed>|stringregister_dsra_routes()
Retain the signup and Site Architect registration entry point for PHP callers.
public
register_dsra_routes() : void
register_routes()
Register every endpoint group at the existing rest_api_init hook.
public
register_routes() : void
remote_add_location()
Create a location using the core location save pipeline.
public
remote_add_location(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_Error|WP_REST_Responserender_rest_endpoints()
Render the REST endpoint settings panel with explicit view data.
public
render_rest_endpoints([string|null $form_slug = null ][, string|null $current = null ]) : void
Parameters
- $form_slug : string|null = null
- $current : string|null = null
rest_api_options()
Network admin page for generating an API key
public
rest_api_options() : void
run_database_management_action()
Delegate to the database management group for existing PHP callers.
public
run_database_management_action(WP_REST_Request $request) : array<string|int, mixed>|WP_Error
Parameters
- $request : WP_REST_Request
Return values
array<string|int, mixed>|WP_Errorsearch_map()
Delegate to the locations group for existing PHP callers.
public
search_map(WP_REST_Request $request) : WP_Error|StdClass
Parameters
- $request : WP_REST_Request
Return values
WP_Error|StdClasssystem_settings()
API setting page
public
system_settings() : void
Tags
update_accounting_key()
Delegate to the accounting group for existing PHP callers.
public
update_accounting_key(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errorupdate_accounting_monthly_history()
Delegate to the accounting group for existing PHP callers.
public
update_accounting_monthly_history(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errorget_endpoint_controller()
Load each endpoint group once and share the existing application context.
protected
get_endpoint_controller(string $group) : MySLP_REST_API_Endpoint
Parameters
- $group : string
Return values
MySLP_REST_API_Endpointhas_valid_api_key()
Return true if the specified API key is valid.
protected
has_valid_api_key(string $key) : bool
Parameters
- $key : string
Return values
boolsend_error()
Send back an error.
protected
send_error() : WP_Error
Return values
WP_Errorget_api_key()
Return our API key (and cache it).
private
get_api_key() : mixed
get_aws_api_key()
Get AWS Location Services API key.
private
get_aws_api_key() : string
Return values
stringget_aws_region()
Return the configured AWS Location Services region.
private
get_aws_region() : string
Return values
stringsave_setting()
Save an admin tab setting.
private
save_setting(mixed $message) : void
Parameters
- $message : mixed