create and buy a batch

@param mixed  $params
@param string $apiKey
@return mixed
970533
public static function create_and_buy($params = null, $apiKey = null)
    {
        $class = get_class();
        if (!isset($params['batch']) || !is_array($params['batch'])) {
            $clone = $params;
            unset($params);
            $params['batch'] = $clone;
        }

        $requestor = new Requestor($apiKey);
        $url = self::classUrl($class);
        list($response, $apiKey) = $requestor->request('post', $url.'/create_and_buy', $params);

        return Util::convertToEasyPostObject($response, $apiKey);
    }
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
        );
    }
370692
public static function &factory($key, array $params = [], $store = true) {
        if (static::has($key)) {
            return static::get($key);
        }

        $namespace = Path::toNamespace($key);
        $reflection = new ReflectionClass($namespace);
        $object = $reflection->newInstanceArgs($params);

        if ($store) {
            $object = static::set($object, $key);
        }

        return $object;
    }
865052
private function assertReqParameters($keys, $params = null)
    {
        if (!empty($keys['args']['req'])) {
            if (!$params) {
                $msg = 'No parameters provided. (HINT: Reference the $keys '
                     . 'property at the top of the API class file for '
                     . 'required and optional parameters.)';
                throw new ApiException($msg);
            }

            foreach ($keys['args']['req'] as $k) {
                if (!isset($params[$k])) {
                    $msg = 'Required parameter `'.$k.'` not provided. '
                         . '(HINT: Reference the $keys '
                         . 'property at the top of the API class file for '
                         . 'required and optional parameters.)';
                    throw new ApiException($msg);
                }
            }
        }
    }
764822
protected function select($key, $params)
    {
        $select = $selectValue = '';
        $options = $params['options'];
        unset($params['options']);

        $selected = null;
        if (isset($params['selected'])) {
            $selected = $params['selected'];
            unset($params['selected']);
        }

        list($elClass, $params) = $this->highlightErrorElement($key, $params);

        $select .= '<select'." name='".$key."' ".$this->attributes($params).' '.$elClass.'>'.PHP_EOL;

        /*
         | Build select box options and return as string
         |
         */
        $select .= $this->getSelectOptions($options, $selected);
        $select .= '</select>'.PHP_EOL;

        $this->elements[static::$formHolder[static::$formName]][$key] = $select;

        return $this;
    }
967128
public static function translate($key, array $params = [], $default = '')
    {
        $result = Application::$instance->getComponent('i18n')->translate($key,
            $params);

        return empty($result) ? self::prepareValueS($default, $params) : $result;
    }
1205491
public static function batchConfirm($params = null, $options = null)
    {
        $url = static::appBaseUrl().'/batch_withdrawals';
        return static::_directRequest('post', $url, $params, $options);
    }
741806
public function createBinaryBatch(Api\MtBatchBinarySmsCreate $batch)
    {
        $json = Serialize::binaryBatch($batch);
        $result = $this->_post($this->_url('/batches'), $json);
        return Deserialize::batchResponse($result);
    }
364135
public function create($methodName, $params)
    {
        $newInstance = clone $this->injectorPrototype;

        if (!is_array($params)) {
            $params = array($params);
        }

        return $newInstance->setMethodName($methodName)->setParams($params);
    }
153557
public function create($params, $optParams = [])
    {
        if (!$params instanceof SuperBackup) {
            throw new InvalidParamException(SuperBackup::class.' is required!');
        }
        if(!isset($optParams['cloud'])){
            $optParams['cloud'] = [];
        }
        $optParams['cloud']['id'] = $params->cloud->id;

        return $this->sendRequest([], [
            'restAction' => 'create',
            'uri' => '/c/<cloud.id>',
            'postParams' => $params->toArray(),
            'getParams' => $optParams,
        ], function ($response) {
            return isset($response->data) ? new SuperBackup($response->data) : $response;
        });
    }
1284468
public static function build($apiKey)
    {
        self::$apiKey          = $apiKey;
        static::$cachedFactory = new ServiceBuilderLoader();

        return parent::factory(__DIR__.'/Resources/clients.json');
    }
1114777
static function create($apikey, array $conf = []) {
        $clnt = new YunpianClient();
        $clnt->conf->init()->with($apikey, $conf);
        $clnt->initHttp($clnt->conf); // YunpianGuzzle->initHttp
        return $clnt;
    }
386532
public static function get_shipping_rates($params = null, $apiKey = null)
    {
        $class = get_class();
        $id = $params['id'];
        return self::_scopedGet($class, $id, $params, $apiKey = null);
    }
1283548
public function create_scan_form($params = null)
    {
        $requestor = new Requestor($this->_apiKey);
        $url = $this->instanceUrl() . '/scan_form';

        list($response, $apiKey) = $requestor->request('post', $url, $params);

        return Util::convertToEasyPostObject($response, $apiKey);
    }
1020662
public function show(string $key, array $params = [])
    {
        $path = $this->buildBuildPath(...explode('/', $key));

        return $this->get($path, $params);
    }
293915
public function generateAppCredentials($apiKey, $apiSecret)
    {
        $apiKey = urlencode($apiKey);
        $apiSecret = urlencode($apiSecret);
        $credentials = base64_encode("{$apiKey}:{$apiSecret}");

        return $credentials;
    }
905664
public function getService($apiKey)
    {
        ValidationUtility::ensureStringOrInteger('$apiKey', $apiKey);

        return $this->callServiceOwnerGetApi(
            '\Authlete\Dto\Service::fromJson',
            self::$SERVICE_GET_API_PATH . $apiKey);
    }