Properties

$api_version

$api_version : string

Protected variable to hold the API version.

Type

string — API version

$instance

$instance : mixed

Protected static variable to hold the single instance of the class.

Type

mixed — Default null

Methods

instance()

instance() : \MainWP\Dashboard\Module\CostTracker\self::$instance

Method instance()

Create public static instance.

Returns

\MainWP\Dashboard\Module\CostTracker\self::$instance

init()

init() 

Method init()

Adds an action to create the rest API endpoints if activated in the plugin settings.

init_rest_api()

init_rest_api() 

Method init_rest_api()

Adds an action to create the rest API endpoints if activated in the plugin settings.

mainwp_register_routes()

mainwp_register_routes() 

Method mainwp_rest_api_init()

Creates the necessary endpoints for the api. Note, for a request to be successful the URL query parameters consumer_key and consumer_secret need to be set and correct.

mainwp_authentication_error()

mainwp_authentication_error() : array

Method mainwp_authentication_error()

Common error message when consumer key and secret are wrong.

Returns

array —

$response Array with an error message explaining that the credentials are wrong.

mainwp_missing_data_error()

mainwp_missing_data_error() : array

Method mainwp_missing_data_error()

Common error message when data is missing from the request.

Returns

array —

$response Array with an error message explaining details are missing.

mainwp_invalid_data_error()

mainwp_invalid_data_error() : array

Method mainwp_invalid_data_error()

Common error message when data in request is ivalid.

Returns

array —

$response Array with an error message explaining details are missing.

cost_tracker_rest_api_get_all_costs_callback()

cost_tracker_rest_api_get_all_costs_callback(array  $request) : object

Method cost_tracker_rest_api_get_all_costs_callback()

Callback function for managing the response to API requests made for the endpoint: cost-tracker Can be accessed via a request like: https://yourdomain.com/wp-json/mainwp/v1/cost-tracker/get-all-costs API Method: GET

Parameters

array $request

The request made in the API call which includes all parameters.

Returns

object —

$response An object that contains the return data and status of the API request.

cost_tracker_rest_api_get_client_costs_callback()

cost_tracker_rest_api_get_client_costs_callback(array  $request) : object

Method cost_tracker_rest_api_get_client_costs_callback()

Callback function for managing the response to API requests made for the endpoint: cost-tracker Can be accessed via a request like: https://yourdomain.com/wp-json/mainwp/v1/cost-tracker/get-client-costs API Method: GET

Parameters

array $request

The request made in the API call which includes all parameters.

Returns

object —

$response An object that contains the return data and status of the API request.

cost_tracker_rest_api_get_site_costs_callback()

cost_tracker_rest_api_get_site_costs_callback(array  $request) : object

Method cost_tracker_rest_api_get_site_costs_callback()

Callback function for managing the response to API requests made for the endpoint: cost-tracker Can be accessed via a request like: https://yourdomain.com/wp-json/mainwp/v1/cost-tracker/get-site-costs API Method: GET

Parameters

array $request

The request made in the API call which includes all parameters.

Returns

object —

$response An object that contains the return data and status of the API request.

cost_tracker_rest_api_get_costs_callback()

cost_tracker_rest_api_get_costs_callback(array  $request) : object

Method cost_tracker_rest_api_get_costs_callback()

Callback function for managing the response to API requests made for the endpoint: cost-tracker Can be accessed via a request like: https://yourdomain.com/wp-json/mainwp/v1/cost-tracker/get-costs API Method: GET

Parameters

array $request

The request made in the API call which includes all parameters.

Returns

object —

$response An object that contains the return data and status of the API request.