function add(\CharlotteDunois\Yasmin\HTTP\APIRequest $apirequest) {
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($apirequest) {
            $apirequest->deferred = new \React\Promise\Deferred();
            $apirequest->deferred->promise()->done($resolve, $reject);
            
            $endpoint = $this->getRatelimitEndpoint($apirequest);
            if(!empty($endpoint)) {
                $this->client->emit('debug', 'Adding request "'.$apirequest->getEndpoint().'" to ratelimit bucket');
                $bucket = $this->getRatelimitBucket($endpoint);
                
                $bucket->push($apirequest);
                $this->queue[] = $bucket;
            } else {
                $this->client->emit('debug', 'Adding request "'.$apirequest->getEndpoint().'" to global queue');
                $this->queue[] = $apirequest;
            }
            
            $this->processFuture();
        }));
    }
function add(\CharlotteDunois\Yasmin\HTTP\APIRequest $apirequest) {
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($apirequest) {
            $apirequest->deferred = new \React\Promise\Deferred();
            $apirequest->deferred->promise()->done($resolve, $reject);
            
            $endpoint = $this->getRatelimitEndpoint($apirequest);
            if(!empty($endpoint)) {
                $this->client->emit('debug', 'Adding request "'.$apirequest->getEndpoint().'" to ratelimit bucket');
                $bucket = $this->getRatelimitBucket($endpoint);
                
                $bucket->push($apirequest);
                $this->queue[] = $bucket;
            } else {
                $this->client->emit('debug', 'Adding request "'.$apirequest->getEndpoint().'" to global queue');
                $this->queue[] = $apirequest;
            }
            
            $this->processFuture();
        }));
    }
function add ( \ CharlotteDunois \ Yasmin \ HTTP \ APIRequest $ apirequest ) { return ( new \ React \ Promise \ Promise ( function ( callable $ resolve , callable $ reject ) use ( $ apirequest ) { $ apirequest -> deferred = new \ React \ Promise \ Deferred ( ) ; $ apirequest -> deferred -> promise ( ) -> done ( $ resolve , $ reject ) ; $ endpoint = $ this -> getRatelimitEndpoint ( $ apirequest ) ; if ( ! empty ( $ endpoint ) ) { $ this -> client -> emit ( 'debug' , 'Adding request "' . $ apirequest -> getEndpoint ( ) . '" to ratelimit bucket' ) ; $ bucket = $ this -> getRatelimitBucket ( $ endpoint ) ; $ bucket -> push ( $ apirequest ) ; $ this -> queue [ ] = $ bucket ; } else { $ this -> client -> emit ( 'debug' , 'Adding request "' . $ apirequest -> getEndpoint ( ) . '" to global queue' ) ; $ this -> queue [ ] = $ apirequest ; } $ this -> processFuture ( ) ; } ) ) ; }
Adds an APIRequest to the queue.
@param \CharlotteDunois\Yasmin\HTTP\APIRequest  $apirequest
@return \React\Promise\ExtendedPromiseInterface
Adds an APIRequest to the queue .