public function create($name, $enabled = null)
    {
        if (is_null($name)) {
            throw new PlivoValidationException(
                "Mandatory parameters cannot be null");
        }

        $data = [
            'name' => $name,
            'enabled' => $enabled
        ];

        $response = $this->client->update(
            $this->uri,
            $data
        );
        $responseContents = $response->getContent();
        if(!array_key_exists("error",$responseContents)){

            return new SubAccountCreateResponse(
                $responseContents['message'],
                $responseContents['auth_id'], 
                $responseContents['auth_token'], 
                $responseContents['api_id'],
                $response->getStatusCode()
            );
            
        } else {
            throw new PlivoResponseException(
                $responseContents['error'],
                0,
                null,
                $response->getContent(),
                $response->getStatusCode()

            );
        }
    }
public function create($name, $enabled = null)
    {
        if (is_null($name)) {
            throw new PlivoValidationException(
                "Mandatory parameters cannot be null");
        }

        $data = [
            'name' => $name,
            'enabled' => $enabled
        ];

        $response = $this->client->update(
            $this->uri,
            $data
        );
        $responseContents = $response->getContent();
        if(!array_key_exists("error",$responseContents)){

            return new SubAccountCreateResponse(
                $responseContents['message'],
                $responseContents['auth_id'], 
                $responseContents['auth_token'], 
                $responseContents['api_id'],
                $response->getStatusCode()
            );
            
        } else {
            throw new PlivoResponseException(
                $responseContents['error'],
                0,
                null,
                $response->getContent(),
                $response->getStatusCode()

            );
        }
    }
public function create ( $ name , $ enabled = null ) { if ( is_null ( $ name ) ) { throw new PlivoValidationException ( "Mandatory parameters cannot be null" ) ; } $ data = [ 'name' => $ name , 'enabled' => $ enabled ] ; $ response = $ this -> client -> update ( $ this -> uri , $ data ) ; $ responseContents = $ response -> getContent ( ) ; if ( ! array_key_exists ( "error" , $ responseContents ) ) { return new SubAccountCreateResponse ( $ responseContents [ 'message' ] , $ responseContents [ 'auth_id' ] , $ responseContents [ 'auth_token' ] , $ responseContents [ 'api_id' ] , $ response -> getStatusCode ( ) ) ; } else { throw new PlivoResponseException ( $ responseContents [ 'error' ] , 0 , null , $ response -> getContent ( ) , $ response -> getStatusCode ( ) ) ; } }
Create a new subaccount
@param string $name Name of the subaccount
@param boolean|null $enabled Specify if the subaccount should be enabled or
not. Takes a value of True or False. Defaults to False
@return JSON Output
Create a new subaccount