Developer Center

Fixed Functions and Return

The function names which are mandatory in the module class are: create, terminate, suspend, unsuspend

All of these 4 functions run similarly, they can run both manually and automatically, each of which must return a success or error response.

Response Usage

All other functions except "create" function must return response in boolean data type.

If the function fails, the error message you specify must be a message that can be understood by user.

You should assign the error message to $this->error variable in the class.

"create" Response Example

The return value from the function must be an array. Received value is saved to users_products.options field in the database of service.


Example:

public function create($order_options=[]){

    /*
     * $order_options --> users_products.options
     * Here are the codes to be sent to the API...
    */

    $api_result             = "OK|101";
    /* Error Result:
     * $api_result             = "Failed to create server, something went wrong.";
    */

    if(substr($api_result,0,2) == 'OK')
        return [
            'ip'                => '192.168.1.1',
            'assigned_ips'      => ['192.168.1.2','192.168.1.3'],
            'login' => [
                'username' => 'root',
                'password' => 'test123',
            ],
            'config' => [$this->entity_id_name => substr($api_result,3)],
        ];
    else
    {
        $this->error = $api_result;
        return false;
    }
}
 
Parameters Single Sign-On

Do you have any questions?

Feel free to contact us
Contact Us
Copyright © 2024. All Rights Reserved.
Join Our Discord Channel
Top