public static function post(string $endpoint, array $data): array
    {
        /*
        // Create the cURL session.
        $curl = self::curl($endpoint);

        // Set any additional options.
        curl_setopt($curl, CURLOPT_POST, true);

        // Set the data to be provided to the endpoint.
        curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data, self::JSON_OPTIONS));

        // Execute the request and capture the response.
        $response = curl_exec($curl);

        // Check to see if there were any errors...
        if(!$response)
            throw new \Exception("[MVQN\REST\ResClient] The REST request failed with the following error(s): ".curl_error($curl));

        // Close the cURL session.
        curl_close($curl);
        */

        $response = (string)self::client()->post(ltrim($endpoint, "/"), [ "json" => $data ] )->getBody();

        // Finally, return the resulting associative array!
        return json_decode($response, true);
    }
public static function post(string $endpoint, array $data): array
    {
        /*
        // Create the cURL session.
        $curl = self::curl($endpoint);

        // Set any additional options.
        curl_setopt($curl, CURLOPT_POST, true);

        // Set the data to be provided to the endpoint.
        curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data, self::JSON_OPTIONS));

        // Execute the request and capture the response.
        $response = curl_exec($curl);

        // Check to see if there were any errors...
        if(!$response)
            throw new \Exception("[MVQN\REST\ResClient] The REST request failed with the following error(s): ".curl_error($curl));

        // Close the cURL session.
        curl_close($curl);
        */

        $response = (string)self::client()->post(ltrim($endpoint, "/"), [ "json" => $data ] )->getBody();

        // Finally, return the resulting associative array!
        return json_decode($response, true);
    }
public static function post ( string $ endpoint , array $ data ) : array { /*
        // Create the cURL session.
        $curl = self::curl($endpoint);

        // Set any additional options.
        curl_setopt($curl, CURLOPT_POST, true);

        // Set the data to be provided to the endpoint.
        curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data, self::JSON_OPTIONS));

        // Execute the request and capture the response.
        $response = curl_exec($curl);

        // Check to see if there were any errors...
        if(!$response)
            throw new \Exception("[MVQN\REST\ResClient] The REST request failed with the following error(s): ".curl_error($curl));

        // Close the cURL session.
        curl_close($curl);
        */ $ response = ( string ) self :: client ( ) -> post ( ltrim ( $ endpoint , "/" ) , [ "json" => $ data ] ) -> getBody ( ) ; // Finally, return the resulting associative array! return json_decode ( $ response , true ) ; }
Sends a HTTP POST Requests to the specified endpoint of the base URL.

@param string $endpoint The endpoint at which to make the request.
@param array $data A JSON encoded string of data to provide to the endpoint.
@return array Returns an associative array of the JSON result.
@throws \Exception Throws an exception if there were errors during the REST request/response phase.
Sends a HTTP POST Requests to the specified endpoint of the base URL .