Builds a request based on the service and request name, with the given parameters

@param string $serviceKey
@param string $requestKey
@param array  $parameters

@return Request
181736
public function create($serviceKey, $requestKey, array $parameters = [])
    {
        $config       = $this->getParamOrFail($this->config, $serviceKey);
        $service      = $this->getServiceParams($config);
        $request      = $this->getRequestParams($config, $requestKey, $service);
        $uri          = $this->buildUri($service['endpoint'], $request['path'], $request['query']);

        list($optionalParameters, $placeholders) = $this->separateParameters($request['body'], $parameters);

        $values       = array_values($parameters);
        $body         = $this->buildBody($request['body'], $request['headers'], $placeholders, $values, $optionalParameters);

        return $this->buildRequest(
            $request['method'],
            $this->replace($uri, $placeholders, $values),
            $this->replaceAll($request['headers'], $placeholders, $values),
            $body,
            $request['version'],
            $request['retries'],
            $request['options'],
            $serviceKey,
            $requestKey
        );
    }
1064442
public function createServicePhoneChannel($serviceId, $body)
    {
        list($response) = $this->createServicePhoneChannelWithHttpInfo($serviceId, $body);
        return $response;
    }
1244357
def create_service_key(self, service_name, key_name):
        
        if self.has_key(service_name, key_name):
            logging.warning("Reusing existing service key %s" % (key_name))
            return self.get_service_key(service_name, key_name)

        body = {
            'service_instance_guid': self.get_instance_guid(service_name),
            'name': key_name
            }

        return self.api.post('/v2/service_keys', body)
364688
public function getByKey($key, array $queryParams = [])
    {
        $response = $this->client->get($this->uri($key), [
            'query' => $queryParams,
        ]);

        return $this->handleResponse($response);
    }
1355560
public function getClient($key)
    {
        if (!isset($this->serviceMap[$key])) {
            throw new \InvalidArgumentException(sprintf(
                'There is no OAuth2 client called "%s". Available are: %s',
                $key,
                implode(', ', array_keys($this->serviceMap))
            ));
        }

        return $this->container->get($this->serviceMap[$key]);
    }
858410
public function bundleCommand(string $packageKey, string $serverScript = null, string $clientScript = null)
    {
        $start = microtime(true);
        $filePathResolver = new FilePathResolver();
        /** @var Package $package */
        $package = $this->packageManager->getPackage($packageKey);
        if ($serverScript !== null) {
            $serverScript = $filePathResolver->resolveFilePath($serverScript);
        } else {
            $serverScript = str_replace('@packageResourcesPath', rtrim($package->getResourcesPath(), '/'), $this->reactServerFilePattern);
        }

        if ($clientScript !== null) {
            $clientScript = $filePathResolver->resolveFilePath($clientScript);
        } else {
            $clientScript = str_replace('@packageResourcesPath', rtrim($package->getResourcesPath(), '/'), $this->reactClientFilePattern);
        }

        $identifier = md5($serverScript);

        $request = new ActionRequest(Request::createFromEnvironment());
        $uriBuilder = new UriBuilder();
        $uriBuilder->setRequest($request);

        $controllerContext = new ControllerContext($request, new Response(), new Arguments(), $uriBuilder);

        $unit = new Unit($controllerContext);

        $unit->work(function (App $app) use ($clientScript, $serverScript, $identifier) {
            $this->outputLine();
            $this->output('Transpiling... ');

            $transpiler = new Transpiler($app);
            $transpiler->transpile($identifier, $serverScript, $clientScript)->done(function () use ($app) {
                $this->outputLine('<success>done</success>');
                $app->end();
            });
        });

        $bundler = new Bundler($controllerContext);
        $this->output('Bundling module... ');
        $bundler->bundle($identifier);
        $this->outputLine('<success>done</success>');

        $this->outputLine();
        $elapsed = round(microtime(true) - $start, 2);
        $this->outputLine('Bundled <success>%s</success> in <success>%s seconds</success>.', [$package->getPackageKey(), $elapsed]);
        $this->outputLine();
    }
623156
private function getClient($serverKey) {
    if (!isset($this->clients[$serverKey])) {
      $config = ObjectFactory::getInstance('configuration');
      $serverDef = $config->getValue($serverKey, 'remoteserver');
      // get remote the user
      $user = $this->getRemoteUser($serverKey);

      $client = null;
      if (strpos($serverDef, 'http://') === 0 || strpos($serverDef, 'https://') === 0) {
        $client = new HTTPClient($serverDef, $user);
      }
      else {
        $client = new RPCClient($serverDef, $user);
      }
      $this->clients[$serverKey] = $client;
    }
    return $this->clients[$serverKey];
  }
401190
public function createServiceWithName(ServiceLocatorInterface $services, $name, $requestedName)
    {
        $config = $this->getConfig($services);
        return AdapterServiceFactory::factory($config[$requestedName]);
    }
972617
public static function make(string $apiKey, ?string $signatureKey = null)
    {
        return new static(Discovery::client(), $apiKey, $signatureKey);
    }
398414
final protected function api($serviceName = null)
    {
        if ($serviceName !== null) {
            return $this->api->service($serviceName);
        }

        return $this->api;
    }
935216
protected function callCustom($key, array $parameters = [])
    {
        return $this->app->call($this->customCreators[$key], $parameters);
    }
1121600
public static function getRequired(
        array $params,
        string $key,
        $context = null
    ) {
        self::assertHas($params, $key, $context);

        return $params[$key];
    }
415984
protected function createAuthCode($userkey, $applicationkey) {
        $payload = $userkey . "@" . strtolower($this->serverhostname) . "|" . strtolower($applicationkey);
        return strtoupper(sha1($payload));
    }
985031
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $serviceName, $requestedName)
    {
        if (!isset($this->allowedServiceNames[$requestedName])) {
            throw new Exception\InvalidServiceNameException('Service "' . $requestedName . '" is not whitelisted');
        }


        if ($serviceLocator instanceof AbstractPluginManager) {
            /* @var $serviceLocator AbstractPluginManager */
            $this->serviceLocator = $serviceLocator->getServiceLocator();
        } else {
            $this->serviceLocator = $serviceLocator;
        }

        return parent::get($requestedName);
    }
265412
public function create($streamKey)
    {
        $url = $this->_baseURL . "/streams";
        $params['key'] = $streamKey;
        $body = json_encode($params);
        try {
            $this->_transport->send(HttpRequest::POST, $url, $body);
        } catch (\Exception $e) {
            return $e;
        }

        return new Stream($this->_transport, $this->_hub, $streamKey);
    }
1075302
public function buildQueryString(array $parameters, array $initialQueryParameters = [], $previousKey = null)
    {
        $queryParameters = $initialQueryParameters;

        foreach ($parameters as $key => $value) {
            if (null !== $previousKey) {
                $key = "{$previousKey}[{$key}]";
            }

            if (is_array($value)) {
                $queryParameters = $this->buildQueryString($value, $queryParameters, $key);
            } else {
                $queryParameters[] = "{$key}={$value}";
            }
        }

        return null !== $previousKey ? $queryParameters : implode('&', $queryParameters);
    }
273320
public ServiceException addRequestParameter(String key, String value) {
        this.fault.addRequestParam(key, value);
        return this;
    }