<?php
/**
 * WARNING: Do not edit by hand, this file was generated by Crank:
 *
 * https://github.com/gocardless/crank
 */

namespace GoCardlessPro\Services;

use \GoCardlessPro\Core\Paginator;
use \GoCardlessPro\Core\Util;
use \GoCardlessPro\Core\ListResponse;
use \GoCardlessPro\Resources\BillingRequestWithAction;
use \GoCardlessPro\Core\Exception\InvalidStateException;


/**
 * Service that provides access to the BillingRequestWithAction
 * endpoints of the API
 */
class BillingRequestWithActionsService extends BaseService
{

    protected $envelope_key   = 'billing_request_with_actions';
    protected $resource_class = '\GoCardlessPro\Resources\BillingRequestWithAction';


    /**
     * Create a Billing Request with Actions
     *
     * Example URL: /billing_requests/create_with_actions
     *
     * @param  array<string, mixed> $params An associative array for any params
     * @return BillingRequestWithAction
     **/
    public function createWithActions($params = array())
    {
        $path = "/billing_requests/create_with_actions";
        if(isset($params['params'])) { 
            $params['body'] = json_encode(array($this->envelope_key => (object)$params['params']));
        
            unset($params['params']);
        }

        
        $response = $this->api_client->post($path, $params);
        

        return $this->getResourceForResponse($response);
    }

}
