Trigger a POST request

@param array $resource Mailjet Resource/Action pair
@param array $args     Request arguments
@param array $options

@return Response
168076
public function post($resource, array $args = [], array $options = [])
    {
        $response = $this->client->post($resource, $args, $options);
        if (!$response->success()) {
            $this->throwError("MailjetService:post() failed", $response);
        }
        return $response;
    }
461765
public function postAction( $resource )
	{
		$response = $this->createAdmin( $resource )->post( $this->getPsrRequest(), new Response() );
		return $this->setPsrResponse( $response );
	}
1229502
public function execute(ResourceNode $resourceNode, string $actionName, array $options = [], array $content = null, array $files = null): Response
    {
        $resourceAction = $this->get($resourceNode, $actionName);
        $resource = $this->resourceManager->getResourceFromNode($resourceNode);

        /** @var ResourceActionEvent $event */
        $event = $this->dispatcher->dispatch(
            static::eventName($actionName, $resourceAction->getResourceType()),
            ResourceActionEvent::class,
            [$resource, $options, $content, $files, $resourceNode]
        );

        return $event->getResponse();
    }
1139883
private base_resource[] post_request(nitro_service service, options option)  throws Exception
	{
		return add_resource(service, option);
	}
232045
public function request($args) {
		$c = curl_init();
		
		curl_setopt($c, CURLOPT_TIMEOUT, 4);
		curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
		curl_setopt($c, CURLOPT_USERAGENT, 'groupmeClient/0.1');
		curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($c, CURLOPT_CUSTOMREQUEST, $args['method']);
		
		$curlurl = $this->url . $args['url'] . $this->buildQueryString($args['query']);
		curl_setopt($c, CURLOPT_URL, $curlurl );
		
		if($args['method'] == "POST"){
			if ( isset($args['payload']) ) {
				$payload = "";
				if ( isset($args['payload']['file']) ) {
					$payload = $args['payload'];
				}
				else {
					$payload = json_encode($args['payload']);
					curl_setopt($c, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
				}
								
				curl_setopt($c, CURLOPT_POSTFIELDS, $payload );
			}
		}
		$info = curl_getinfo($c);
		$response = curl_exec($c);
		curl_close($c);
		return $response;
	}
523123
private function _call($method, $resource, $action, $args)
    {
        $args = array_merge(
                [
            'id' => '',
            'actionid' => '',
            'filters' => [],
            'body' => $method == 'GET' ? null : '{}',
                ], array_change_key_case($args)
        );

        $url = $this->buildURL($resource, $action, $args['id'], $args['actionid']);

        $contentType = ($action == 'csvdata/text:plain' || $action == 'csverror/text:csv') ? 'text/plain' : 'application/json';

        $isBasicAuth = $this->isBasicAuthentication($this->apikey, $this->apisecret);
        $auth = $isBasicAuth ? [$this->apikey, $this->apisecret] : [$this->apitoken];

        $request = new Request(
                $auth, $method, $url, $args['filters'], $args['body'], $contentType, $this->requestOptions
        );
        return $request->call($this->call);
    }
896631
public function post($url, $data = [], array $options = [])
    {
        $options = $this->_mergeOptions($options);
        $url = $this->buildUrl($url, [], $options);

        return $this->_doRequest(Request::METHOD_POST, $url, $data, $options);
    }
99689
public function controller($route, ...$args) {
		// Sanitize the call
		$route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route);

		// Keep the original trigger
		$trigger = $route;

		// Trigger the pre events
		$result = $this->registry->get('event')->trigger('controller/' . $trigger . '/before', array(&$route, &$args));

		// Make sure its only the last event that returns an output if required.
		if ($result != null && !$result instanceof Exception) {
			$output = $result;
		} else {
			$action = new Action($route);
			$output = $action->execute($this->registry, $args);
		}

		// Trigger the post events
		$result = $this->registry->get('event')->trigger('controller/' . $trigger . '/after', array(&$route, &$args, &$output));

		if ($result && !$result instanceof Exception) {
			$output = $result;
		}

		if (!$output instanceof Exception) {
			return $output;
		}
	}
1265693
public function execute(array $args, array $options = [])
    {
        $this->bootstrap($args, $options);

        // get the seed path from the config
        $path = $this->getConfig()->getSeedPath();

        if (!file_exists($path)) {
            $ask = new Dialog();
            if ($ask->confirm(Colour::colour('Create seeds directory?', [Colour::RED, Colour::HIGHLIGHT]))) {
                mkdir($path, 0755, true);
            }
        }

        $this->verifySeedDirectory($path);
        $path = realpath($path);

        $className = $args[0];

        if (!Util::isValidPhinxClassName($className)) {
            throw new \InvalidArgumentException(sprintf(
                'The seed class name "%s" is invalid. Please use CamelCase format',
                $className
            ));
        }

        // Compute the file path
        $filePath = $path . DIRECTORY_SEPARATOR . $className . '.php';

        if (is_file($filePath)) {
            throw new \InvalidArgumentException(sprintf(
                'The file "%s" already exists',
                basename($filePath)
            ));
        }

        // inject the class names appropriate to this seeder
        $contents = file_get_contents($this->getSeedTemplateFilename());
        $classes = [
            '$useClassName' => 'Phinx\Seed\AbstractSeed',
            '$className' => $className,
            '$baseClassName' => 'AbstractSeed',
        ];
        $contents = strtr($contents, $classes);

        if (false === file_put_contents($filePath, $contents)) {
            throw new \RuntimeException(sprintf(
                'The file "%s" could not be written to',
                $path
            ));
        }

        Output::writeln('using seed base class ' . $classes['$useClassName']);
        Output::writeln('created ' . str_replace(Cml::getApplicationDir('secure_src'), '{secure_src}', $filePath));
    }
775866
public function trigger(EventInterface $event, array $args = []){
        return call_user_func_array($this->callback, array_merge([$event], $args));
    }
667618
public function trigger($event, $args = array())
	{
		if (!($event instanceof Event))
		{
			if (isset($this->events[$event]))
			{
				$event = $this->events[$event];
			}
			else
			{
				$event = new Event($event);
			}
		}

		// If a listener group was specified
		// lazy load the listeners.
		if ($group = $event->getGroup())
		{
			$this->addListeners($group);
		}

		// Attach any incoming aruments
		foreach ((array) $args as $name => $arg)
		{
			$event->addArgument($name, $arg);
		}

		// Are there any listeners for this event?
		if (isset($this->listeners[$event->getName()]))
		{
			foreach ($this->listeners[$event->getName()] as $listener)
			{
				// Call the event listener
				if ($listener instanceof Closure)
				{
					$response = call_user_func($listener, $event);
				}
				else
				{
					$response = call_user_func(array($listener, $event->getName()), $event);
				}

				// Attach response
				if (!is_null($response))
				{
					$event->addResponse($response);
				}

				// Is propagation stopped?
				if ($event->isStopped())
				{
					break;
				}
			}
		}

		return $event->getResponse();
	}
825237
public function publish($topic, $arguments = null, $argumentsKw = null, $options = null)
    {
        return $this->getClient()->getSession()
            ->publish($this->prefix . $topic, $arguments, $argumentsKw, $options);
    }
88245
private function buildUrl($resource, $args)
    {
        //Merge args(apiKey, Format, noJsonCallback)
        $args = array_merge($args, $this->args);
        $query = http_build_query($args);

        $url = $this->url;
        $url .= $resource . '?' . $query;

        return $url;
    }
1083601
protected function handleRequest($method, $resource, $options)
    {
        $response = null;
        try
        {
            $response = $this->handleResponse($this->getHttpClient()->request($method, $resource, $options));
        }
        catch (RequestException $e)
        {
            $this->handleException($e);
        }

        return $response;
    }
726391
public function execute(array $args = [], array $options = [])
    {
        $d     = new Service\DebugService();
        $infos = $d->describe();
        $max   = 0;

        foreach ($infos as $section => $data) {
            foreach ($data as $k => $v) {
                $len = strlen($k);
                $max = $max < $len ? $len : $max;
            }
        }

        foreach ($infos as $section => $data) {
            echo sprintf('[%s]', strtoupper($section)).PHP_EOL.PHP_EOL;
            foreach ($data as $k => $v) {
                echo sprintf(' %'.((int) $max).'s:  %s', ucwords(str_replace('_', ' ', $k)), is_array($v) ? join(' ', $v) : (is_bool($v) ? ($v ? 'true' : 'false') : $v)).PHP_EOL;
            }
            echo PHP_EOL;
        }
    }
997680
public function execute(array $args = [], array $options = [])
    {
        $argv = $_SERVER['argv'];
        array_shift($argv);
        array_shift($argv);

        $argvString = '';
        foreach ($argv as $arg) {
            $argvString .= ($argvString ? ' ' : '').'"'.str_replace('"', '\\"', $arg).'"';
        }
        $found = null;
        foreach ($this->getConfig()->get('_shell_scripts_dirs', []) as $dir) {
            $path = sprintf('%s/%s', $dir, $this->script);
            if (!is_file($path)) {
                continue;
            }
            $found = $path;
        }
        if (null === $found) {
            throw new \RuntimeException(sprintf("Unknown shell script '%s'", $this->script), 412);
        }

        $this->executeShellCommand(sprintf('%s %s', $found, $argvString), $options);
    }
819599
public function execute(array $args = [], array $options = [])
    {
        if (!$this->evaluate($this->condition)) {
            return;
        }

        $this->command->execute($args, $options);
    }