/** * @param array $config * @throws \Exception */ public function __construct(array $config = []) { // Apply some defaults. $config = array_merge($config, ['max_retries' => 3]); // Create the client. parent::__construct($this->getHttpClientFromConfig($config), $this->getDescriptionFromConfig($config), $config); }
/** * @param HttpClientInterface $client * @param ServiceDescriptionInterface $description */ public function __construct(HttpClientInterface $client, ServiceDescriptionInterface $description) { $config = array('process' => false); parent::__construct($client, $description, $config); $emitter = $this->getEmitter(); $emitter->attach(new Subscriber\ProcessResponse($description)); }
/** * @param array $config * @param string $env * @throws \Exception */ public function __construct(array $config = [], $env = self::ENV_PROD) { /* * Make sure ENV is valid */ if (!in_array($env, [self::ENV_PROD, self::ENV_STAGE, self::ENV_MOCK])) { throw new \Exception('Invalid environment', 1462566788); } /* * Check that consumerId and privateKey are set */ if (!isset($config['consumerId']) || !isset($config['privateKey'])) { throw new \Exception('Configuration missing consumerId or privateKey', 1466965269); } // Set ENV $this->env = $env; // Apply some defaults. $config = array_merge_recursive($config, ['max_retries' => 3, 'http_client_options' => ['defaults' => ['auth' => [$config['consumerId'], $config['privateKey']]]]]); // If an override base url is not provided, determine proper baseurl from env if (!isset($config['description_override']['baseUrl'])) { $config = array_merge_recursive($config, ['description_override' => ['baseUrl' => $this->getEnvBaseUrl($env)]]); } // Create the client. parent::__construct($this->getHttpClientFromConfig($config), $this->getDescriptionFromConfig($config), $config); // Ensure that ApiVersion is set. $this->setConfig('defaults/ApiVersion', $this->getDescription()->getApiVersion()); }
/** * @param ClientInterface $client * @param DescriptionInterface $description * @param array $responseClasses * @param Serializer $serializer * @param array $config */ public function __construct(ClientInterface $client, DescriptionInterface $description, array $responseClasses, Serializer $serializer, array $config = []) { $this->client = $client; $this->responseClasses = $responseClasses; $this->serializer = $serializer; parent::__construct($client, $description, $config); }
/** * @param array $config */ public function __construct(array $config = []) { // Apply some defaults. $config += ['max_retries' => 3]; // Create the Smartsheet client. parent::__construct($this->getHttpClientFromConfig($config), $this->getDescriptionFromConfig($config), $config); // Ensure that the credentials are set. $this->applyCredentials($config); }
/** * Class constructor. * * @param string|null $apiKey API key (optional). * @param \GuzzleHttp\ClientInterface|null $httpClient Alternative Guzzle HTTP client (optional). */ public function __construct($apiKey = null, GuzzleHttp_ClientInterface $httpClient = null) { // Embed.ly API description $description = json_decode(file_get_contents(__DIR__ . '/description.json'), true); parent::__construct($httpClient ?: new GuzzleHttp_Client(), new Description($description)); $this->setApiKey($apiKey); $this->getHttpClient()->getEmitter()->once('before', function (BeforeEvent $event) { $this->getBeforeEvent($event); }); }
/** * @param HttpClientInterface $client * @param ServiceDescriptionInterface $description * @param JobBuilderInterface $jobBuilder */ public function __construct(HttpClientInterface $client, ServiceDescriptionInterface $description, JobBuilderInterface $jobBuilder = null) { $config = array('process' => false); parent::__construct($client, $description, $config); if ($jobBuilder !== null) { $this->setJobBuilder($jobBuilder); } $emitter = $this->getEmitter(); $emitter->attach(new Subscriber\Command\PrepareRequest($description)); $emitter->attach(new Subscriber\Command\ProcessResponse($description)); }
/** * @param array $config */ public function __construct(array $config = []) { $this->config = new \ArrayObject(array_merge($this->config, $config)); $client = new BaseClient(['base_url' => $this->config['baseUrl'], 'defaults' => array_filter(['timeout' => $this->config['timeout'], 'connect_timeout' => $this->config['connectTimeout'], 'proxy' => $this->config['proxy']]), 'defaults' => ['verify' => $this->config['verify']]]); $operations = array_merge(TouristicObjects::$operations, Metadata::$operations, Exports::$operations, Search::$operations, Agenda::$operations, Reference::$operations, Sso::$operations, User::$operations); $descriptionData = ['baseUrl' => $this->config['baseUrl'], 'operations' => $operations, 'models' => ['getResponse' => ['type' => 'object', 'additionalProperties' => ['location' => 'json']]]]; $description = new Description($descriptionData); parent::__construct($client, $description, []); $this->getEmitter()->attach(new AuthenticationSubscriber($description, $this->config, $this->getHttpClient())); $this->getEmitter()->attach(new ObjectsGlobalConfigSubscriber($description, $this->config)); }
/** * @param array $config */ public function __construct(array $config = []) { // Apply some defaults. $config += ['max_retries' => 3, 'description_path' => __DIR__ . '/jira-api.php']; // Create the Jira client. parent::__construct($this->getHttpClientFromConfig($config), $this->getDescriptionFromConfig($config), $config); // Ensure that the credentials are set. $this->applyCredentials($config); // Ensure that ApiVersion is set. $this->setConfig('defaults/ApiVersion', $this->getDescription()->getApiVersion()); }
public function __construct(array $config = []) { $resolver = new OptionsResolver(); $this->configureOptionResolver($resolver); // Params validation $options = $resolver->resolve($config); // initialisation du client standard Guzzle $client = new Client(["defaults" => ["auth" => [$options["username"], $options["password"]]], "base_url" => $options["base_url"], "debug" => $options["debug"]]); // $client->getEmitter()->attach(new LogSubscriber()); $description = new Description(json_decode(file_get_contents(__DIR__ . '/../Resources/config/client.json'), true)); parent::__construct($client, $description); }
/** * @param array $config */ public function __construct(array $config = []) { // Apply some defaults. $config += ['max_retries' => 3]; // Create the client. parent::__construct($this->getHttpClientFromConfig($config), $this->getDescriptionFromConfig($config), $config); // Ensure that the credentials are set. $this->applyCredentials($config); // Apply the data type (if provided). $this->applyDataType($config); // Ensure that ApiVersion is set. $this->setConfig('defaults/ApiVersion', $this->getDescription()->getApiVersion()); }
/** * @param string $username registered username * @param string $lang language code for responses * @param string|null $baseUrl override default base url */ public function __construct($username, $lang = 'en', $baseUrl = null) { $client = new Client(); // load description config file $descriptionConfig = (require __DIR__ . '/resources/config.php'); // overwrite default base url if ($baseUrl !== null) { $descriptionConfig['baseUrl'] = $baseUrl; } // create description $description = new Description($descriptionConfig); // init client and set default values parent::__construct($client, $description, ['defaults' => ['username' => $username, 'lang' => $lang]]); }
/** * @param string $pApiKey * @param \GuzzleHttp\Command\Guzzle\Description|string $pSubscription * * @throws InvalidArgumentException */ public function __construct($pApiKey, $pSubscription = Enum\Subscription::KEY_DEVELOPER) { if (empty($pApiKey)) { throw new InvalidArgumentException("API key must not be empty."); } if (false === Enum\Subscription::IsValid($pSubscription)) { throw new InvalidArgumentException("Subscription provided '{$pSubscription}' is invalid."); } $service_config = (require 'Resources/fantasy_data_api.php'); $description = new Description($service_config); $client = $this->CreateHttpClient(); parent::__construct($client, $description); $this->setConfig('defaults/Subscription', $pSubscription); $this->setConfig('defaults/key', $pApiKey); }
/** * @param string $baseUri TelecomsCloud API base URI, usually https://api.telecomscloud.com * @param bool $proxy optional http proxy address for development & testing */ public function __construct($baseUri, $proxy = false) { $config = []; if ($proxy) { $config['default']['proxy'] = $proxy; $config['default']['debug'] = true; } $serviceDescription = json_decode(file_get_contents(__DIR__ . '/tc-service.json'), true); $description = new Description($serviceDescription); $client = new GuzClient(['base_url' => $baseUri]); $client->setDefaultOption('allow_redirects', false); if ($proxy) { $client->setDefaultOption('proxy', $proxy); } $this->guzzleClient = $client; parent::__construct($client, $description, $config); }
/** * @param ClientInterface $client * @param DescriptionInterface $description * @param array $config */ public function __construct(ClientInterface $client = null, DescriptionInterface $description = null, array $config = []) { $client = $client instanceof ClientInterface ? $client : new Client(); $description = $description instanceof DescriptionInterface ? $description : new Description(); parent::__construct($client, $description, $config); $cachedResponse = new Response(200); $this->getHttpClient()->getEmitter()->on('complete', function (CompleteEvent $e) use($cachedResponse) { $array1 = explode(PHP_EOL, trim((string) $e->getResponse()->getBody())); $result = array(); foreach ($array1 as $key => $value) { $array2 = explode(':', $value); $result[$array2[0]] = isset($array2[1]) ? trim($array2[1]) : ''; } $stream = Stream::factory(json_encode($result)); $cachedResponse->setBody($stream); $e->intercept($cachedResponse); }); }
/** * {@inheritDoc} * * The additional array keys and values are available config options: * - base_url: Base URL of web service * - customer_id: a default customerID to use */ public function __construct(Client $client, $config = array()) { $descriptionJson = json_decode(file_get_contents(__DIR__ . '/service.json'), true); if (empty($config['base_url'])) { $config['base_url'] = 'https://www.eway.com.au/gateway_cvn/xmlpayment.asp'; } $descriptionJson['baseUrl'] = $config['base_url']; $description = new Description($descriptionJson); parent::__construct($client, $description, $config); if (!empty($config['customer_id'])) { $this->getEmitter()->on('prepare', function (PrepareEvent $event) use($config) { $command = $event->getCommand(); if (empty($command['customerID'])) { $command['customerID'] = $config['customer_id']; } }, 'first'); } }
/** * @param array $config * @param string $env * @throws \Exception */ public function __construct(array $config = [], $env = self::ENV_PROD) { if (!in_array($env, [self::ENV_PROD, self::ENV_MOCK])) { throw new \Exception('Invalid environment', 1462566788); } $this->env = $env; // Apply some defaults. $config = array_merge_recursive($config, ['max_retries' => 3]); // If an override base url is not provided, determine proper baseurl from env if (!isset($config['description_override']['baseUrl'])) { $config = array_merge_recursive($config, ['description_override' => ['baseUrl' => $this->getEnvBaseUrl($env)]]); } // Create the client. parent::__construct($this->getHttpClientFromConfig($config), $this->getDescriptionFromConfig($config), $config); // Add auth header $this->applyCredentials($config); // Ensure that ApiVersion is set. $this->setConfig('defaults/ApiVersion', $this->getDescription()->getApiVersion()); }
/** * @param string $appId * @param string $appCode * @param string $apiVersion * @param bool $demo Whether to use demo or production endpoints * @param string|null $baseUrl Overwrites default demo or production base url */ public function __construct($appId, $appCode, $apiVersion = "6.2", $demo = false, $baseUrl = null) { $client = new Client(); // load description config file $filename = __DIR__ . '/resources/reversegeocoder-' . $apiVersion . '.php'; if (!file_exists($filename)) { throw new \RuntimeException("API version " . $apiVersion . " not supported."); } $descriptionConfig = (require $filename); // set demo base url if ($demo) { $descriptionConfig['baseUrl'] = $descriptionConfig['baseDemoUrl']; } // overwrite default base url if ($baseUrl) { $descriptionConfig['baseUrl'] = $baseUrl; } // create description $description = new Description($descriptionConfig); // init client and set default values parent::__construct($client, $description, ['defaults' => ['app_id' => $appId, 'app_code' => $appCode]]); }
/** * @param array $config * @param ClientInterface|null $client * @param DescriptionInterface|null $description */ public function __construct(array $config = [], ClientInterface $client = null, DescriptionInterface $description = null) { $mandatoryAttributes = ['api_token']; // unless a definition is explicitly provided, the base url is mandatory. if (!$description) { $mandatory[] = 'base_url'; } // Create a collection object with defaults and required params set $config = Collection::fromConfig($config, ['max_retries' => 3], $mandatoryAttributes); if (!$client) { $client = $this->loadHttpClient($config); } if (!$description) { $description = $this->loadDescription($config); } // KLUDGE // hold on to the authentication subscriber // so we can update the JWT on it later in case // refreshApiToken() gets run. // TODO: look for a more elegant solution to this problem. // [ST 2015/07/24] $this->auth = $this->attachAuthenticationSubscriber($client, $config->get('api_token')); parent::__construct($client, $description, $config->toArray()); }
/** * Constructor * * @param array $config */ public function __construct(array $config = []) { $defaults = ['write_key' => null, 'version' => 'v1', 'batching' => 'request', 'log_file' => null, 'max_queue_size' => 10000, 'batch_size' => 100]; // Create Configuration $config = Collection::fromConfig($config, $defaults, ['write_key', 'version', 'batching']); // Load versioned Service Description $description = $this->loadServiceDescription(__DIR__ . '/Description/segment.io.%s.php', $config->get('version')); // Allow the Adapter to be set $httpConfig = $config->hasKey('adapter') ? ['adapter' => $config->get('adapter')] : []; // Create the Client parent::__construct(new HttpClient($httpConfig), $description, $config->toArray()); // Set Basic Auth $this->getHttpClient()->setDefaultOption('auth', [$config->get('write_key'), null]); // Set the content type header to use "application/json" for all requests $this->getHttpClient()->setDefaultOption('headers', array('Content-Type' => 'application/json')); // Default the Version $this->setConfig('defaults/version', $this->getDescription()->getApiVersion()); if ($config->get('batching') == 'request') { $this->getEmitter()->attach(new BatchRequestSubscriber($this->getDescription(), ['max_queue_size' => $config->get('max_queue_size'), 'batch_size' => $config->get('batch_size')])); } if ($config->get('batching') == 'file') { $this->getEmitter()->attach(new BatchFileSubscriber($this->getDescription(), ['filename' => $config->get('log_file')])); } }
/** * @param ClientInterface $client HTTP client to use. * @param DescriptionInterface $description Guzzle service description * @param array $config Configuration options */ public function __construct__(ClientInterface $client, DescriptionInterface $description, array $config = []) { parent::__construct($client, $config); $this->processConfig($config); }
/** * @param ClientInterface $client * @param DescriptionInterface $description * @param array $config * @see factory use the static factory method to retrieve a fully configured gitlab GitlabClient */ public function __construct(ClientInterface $client, DescriptionInterface $description, array $config = []) { parent::__construct($client, $description, $config); }
/** * @param ClientInterface $client * @param DescriptionInterface $description * @param array $config */ public function __construct(ClientInterface $client, DescriptionInterface $description = null, array $config = []) { $description = $description instanceof DescriptionInterface ? $description : new Description(); parent::__construct($client, $description, $config); $this->getHttpClient()->setDefaultOption('headers', ['Content-Type' => 'application/json; charset=utf-8']); }
public function __construct($baseUrl) { $client = new Client(['defaults' => ['headers' => ['Content-type' => 'application/json']], 'base_url' => [$baseUrl]]); $description = new Description(['name' => 'Pasteque', 'description' => 'Cash register management API', 'operations' => ['getAttribute' => ['httpMethod' => 'GET', 'uri' => 'attribute/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getAllAttribute' => ['httpMethod' => 'GET', 'uri' => 'attribute/getAll.json', 'responseModel' => 'jsonResponse'], 'createAttribute' => ['httpMethod' => 'POST', 'uri' => 'attribute/create.json', 'responseModel' => 'jsonResponse'], 'updateAttribute' => ['httpMethod' => 'PUT', 'uri' => 'attribute/update/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'deleteAttribute' => ['httpMethod' => 'DELETE', 'uri' => 'attribute/delete/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getCash' => ['httpMethod' => 'GET', 'uri' => 'cash/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'searchCash' => ['httpMethod' => 'GET', 'uri' => 'cash/search/{cashRegisterId}/{dateStart}/{dateStop}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['cashRegisterId' => ['required' => false, 'location' => 'uri'], 'dateStart' => ['required' => false, 'location' => 'uri'], 'dateStop' => ['required' => false, 'location' => 'uri']]], 'getCashRegister' => ['httpMethod' => 'GET', 'uri' => 'cashRegister/get/{type}/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['type' => ['required' => true, 'location' => 'uri'], 'id' => ['required' => true, 'location' => 'uri']]], 'zticketCash' => ['httpMethod' => 'GET', 'uri' => 'cash/zticket/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'moveCashMovement' => ['httpMethod' => 'GET', 'uri' => 'cashMovement/move/{id}/{date}/{payment}/{note}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri'], 'date' => ['required' => true, 'location' => 'uri'], 'payment' => ['required' => true, 'location' => 'uri'], 'note' => ['required' => true, 'location' => 'uri']]], 'getAllCashRegister' => ['httpMethod' => 'GET', 'uri' => 'cashRegister/getAll.json', 'responseModel' => 'jsonResponse'], 'createCash' => ['httpMethod' => 'POST', 'uri' => 'cash/create.json', 'responseModel' => 'jsonResponse'], 'updateCash' => ['httpMethod' => 'PUT', 'uri' => 'cash/update/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'deleteCash' => ['httpMethod' => 'DELETE', 'uri' => 'cash/delete/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getCategory' => ['httpMethod' => 'GET', 'uri' => 'category/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getChildrenCategory' => ['httpMethod' => 'GET', 'uri' => 'category/getChildren/{parentId}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['parentId' => ['required' => true, 'location' => 'uri']]], 'getAllCategory' => ['httpMethod' => 'GET', 'uri' => 'category/getAll.json', 'responseModel' => 'jsonResponse'], 'createCategory' => ['httpMethod' => 'POST', 'uri' => 'category/create.json', 'responseModel' => 'jsonResponse'], 'updateCategory' => ['httpMethod' => 'PUT', 'uri' => 'category/update/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'deleteCategory' => ['httpMethod' => 'DELETE', 'uri' => 'category/delete/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getCurrency' => ['httpMethod' => 'GET', 'uri' => 'currency/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getMainCurrency' => ['httpMethod' => 'GET', 'uri' => 'currency/getMain.json', 'responseModel' => 'jsonResponse'], 'getAllCurrency' => ['httpMethod' => 'GET', 'uri' => 'currency/getAll.json', 'responseModel' => 'jsonResponse'], 'createCurrency' => ['httpMethod' => 'POST', 'uri' => 'currency/create.json', 'responseModel' => 'jsonResponse'], 'updateCurrency' => ['httpMethod' => 'PUT', 'uri' => 'currency/update/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'deleteCurrency' => ['httpMethod' => 'DELETE', 'uri' => 'currency/delete/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getCustomer' => ['httpMethod' => 'GET', 'uri' => 'customer/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getAllCustomer' => ['httpMethod' => 'GET', 'uri' => 'customer/getAll.json', 'responseModel' => 'jsonResponse'], 'getTopCustomer' => ['httpMethod' => 'GET', 'uri' => 'customer/getTop/{limit}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['limit' => ['required' => true, 'location' => 'uri']]], 'addPrepaidCustomer' => ['httpMethod' => 'PUT', 'uri' => 'customer/addPrepaid/{id}/{amount}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri'], 'amount' => ['required' => true, 'location' => 'uri']]], 'createCustomer' => ['httpMethod' => 'POST', 'uri' => 'customer/create.json', 'responseModel' => 'jsonResponse'], 'updateCustomer' => ['httpMethod' => 'PUT', 'uri' => 'customer/update/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'deleteCustomer' => ['httpMethod' => 'DELETE', 'uri' => 'customer/delete/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getDiscount' => ['httpMethod' => 'GET', 'uri' => 'discount/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getAllDiscount' => ['httpMethod' => 'GET', 'uri' => 'discount/getAll.json', 'responseModel' => 'jsonResponse'], 'getAllDiscountProfile' => ['httpMethod' => 'GET', 'uri' => 'discountProfile/getAll.json', 'responseModel' => 'jsonResponse'], 'createDiscount' => ['httpMethod' => 'POST', 'uri' => 'discount/create.json', 'responseModel' => 'jsonResponse'], 'updateDiscount' => ['httpMethod' => 'PUT', 'uri' => 'discount/update/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'deleteDiscount' => ['httpMethod' => 'DELETE', 'uri' => 'discount/delete/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getFloor' => ['httpMethod' => 'GET', 'uri' => 'floor/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getAllFloor' => ['httpMethod' => 'GET', 'uri' => 'floor/getAll.json', 'responseModel' => 'jsonResponse'], 'createFloor' => ['httpMethod' => 'POST', 'uri' => 'floor/create.json', 'responseModel' => 'jsonResponse'], 'updateFloor' => ['httpMethod' => 'PUT', 'uri' => 'floor/update/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'deleteFloor' => ['httpMethod' => 'DELETE', 'uri' => 'floor/delete/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getAllGroup' => ['httpMethod' => 'GET', 'uri' => 'group/getAll.json', 'responseModel' => 'jsonResponse'], 'createGroup' => ['httpMethod' => 'POST', 'uri' => 'group/create.json', 'responseModel' => 'jsonResponse'], 'updateGroup' => ['httpMethod' => 'PUT', 'uri' => 'group/update/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'deleteGroup' => ['httpMethod' => 'DELETE', 'uri' => 'group/delete/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getLocation' => ['httpMethod' => 'GET', 'uri' => 'location/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getAllLocation' => ['httpMethod' => 'GET', 'uri' => 'location/getAll.json', 'responseModel' => 'jsonResponse'], 'createLocation' => ['httpMethod' => 'POST', 'uri' => 'location/create.json', 'responseModel' => 'jsonResponse'], 'updateLocation' => ['httpMethod' => 'PUT', 'uri' => 'location/update/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'deleteLocation' => ['httpMethod' => 'DELETE', 'uri' => 'location/delete/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getAllPayment' => ['httpMethod' => 'GET', 'uri' => 'payment/getAll.json', 'responseModel' => 'jsonResponse'], 'createPayment' => ['httpMethod' => 'POST', 'uri' => 'payment/create.json', 'responseModel' => 'jsonResponse'], 'updatePayment' => ['httpMethod' => 'PUT', 'uri' => 'payment/update/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'deletePayment' => ['httpMethod' => 'DELETE', 'uri' => 'payment/delete/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getProduct' => ['httpMethod' => 'GET', 'uri' => 'product/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getAllProduct' => ['httpMethod' => 'GET', 'uri' => 'product/getAll.json', 'responseModel' => 'jsonResponse'], 'getCategoryProduct' => ['httpMethod' => 'GET', 'uri' => 'product/getCategory/{categoryId}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['categoryId' => ['required' => true, 'location' => 'uri']]], 'createProduct' => ['httpMethod' => 'POST', 'uri' => 'product/create.json', 'responseModel' => 'jsonResponse'], 'updateProduct' => ['httpMethod' => 'PUT', 'uri' => 'product/update/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'deleteProduct' => ['httpMethod' => 'DELETE', 'uri' => 'product/delete/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getProvider' => ['httpMethod' => 'GET', 'uri' => 'provider/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getAllProvider' => ['httpMethod' => 'GET', 'uri' => 'provider/getAll.json', 'responseModel' => 'jsonResponse'], 'createProvider' => ['httpMethod' => 'POST', 'uri' => 'provider/create.json', 'responseModel' => 'jsonResponse'], 'updateProvider' => ['httpMethod' => 'PUT', 'uri' => 'provider/update/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'deleteProvider' => ['httpMethod' => 'DELETE', 'uri' => 'provider/delete/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getResource' => ['httpMethod' => 'GET', 'uri' => 'resource/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'createResource' => ['httpMethod' => 'POST', 'uri' => 'resource/create.json', 'responseModel' => 'jsonResponse'], 'updateResource' => ['httpMethod' => 'PUT', 'uri' => 'resource/update/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'deleteResource' => ['httpMethod' => 'DELETE', 'uri' => 'resource/delete/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getRole' => ['httpMethod' => 'GET', 'uri' => 'role/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getAllRole' => ['httpMethod' => 'GET', 'uri' => 'role/getAll.json', 'responseModel' => 'jsonResponse'], 'getAllStock' => ['httpMethod' => 'GET', 'uri' => 'stock/getAll/{locationId}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['locationId' => ['required' => true, 'location' => 'uri']]], 'getTariffArea' => ['httpMethod' => 'GET', 'uri' => 'tariffArea/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getAllTariffArea' => ['httpMethod' => 'GET', 'uri' => 'tariffArea/getAll.json', 'responseModel' => 'jsonResponse'], 'getTax' => ['httpMethod' => 'GET', 'uri' => 'tax/get/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getAllTax' => ['httpMethod' => 'GET', 'uri' => 'tax/getAll.json', 'responseModel' => 'jsonResponse'], 'getSharedTicket' => ['httpMethod' => 'GET', 'uri' => 'ticket/getShared/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'getAllSharedTicket' => ['httpMethod' => 'GET', 'uri' => 'ticket/getAllShared.json', 'responseModel' => 'jsonResponse'], 'delSharedTicket' => ['httpMethod' => 'DELETE', 'uri' => 'ticket/delShared/{id}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['id' => ['required' => true, 'location' => 'uri']]], 'shareTicket' => ['httpMethod' => 'POST', 'uri' => 'ticket/share/{ticket}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['ticket' => ['required' => true]]], 'saveTicket' => ['httpMethod' => 'POST', 'uri' => 'ticket/save/{cashId}/{ticket}/{tickets}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['cashId' => ['required' => true], 'ticket' => ['required' => true], 'tickets' => ['required' => true]]], 'getOpenTicket' => ['httpMethod' => 'GET', 'uri' => 'ticket/getOpen.json', 'responseModel' => 'jsonResponse', 'additionalParameters' => ['location' => 'query']], 'searchTicket' => ['httpMethod' => 'GET', 'uri' => 'ticket/search/{ticketId}/{ticketType}/{cashId}/{dateStart}/{dateStop}/{customerId}/{userId}/{limit}.json', 'responseModel' => 'jsonResponse', 'parameters' => ['ticketId' => ['required' => false, 'location' => 'uri'], 'ticketType' => ['required' => false, 'location' => 'uri'], 'cashId' => ['required' => false, 'location' => 'uri'], 'dateStart' => ['required' => false, 'location' => 'uri'], 'dateStop' => ['required' => false, 'location' => 'uri'], 'customerId' => ['required' => false, 'location' => 'uri'], 'userId' => ['required' => false, 'location' => 'uri'], 'limit' => ['required' => false, 'location' => 'uri']]]], 'models' => ['jsonResponse' => ['type' => 'object', 'additionalProperties' => ['location' => 'json']]]]); parent::__construct($client, $description); }
public function __construct(GuzzleClient $guzzleClient = NULL) { $guzzleClient = is_null($guzzleClient) ? new GuzzleClient() : $guzzleClient; $hipchatDescription = new GuzzleServiceDescription(['baseUrl' => 'https://api.hipchat.com/v1/', 'operations' => ['createRoom' => ['httpMethod' => 'POST', 'uri' => 'rooms/create', 'responseModel' => 'getResponse', 'parameters' => ['auth_token' => ['type' => 'string', 'required' => true, 'location' => 'postField'], 'name' => ['type' => 'string', 'required' => true, 'location' => 'postField'], 'owner_user_id' => ['type' => 'string', 'required' => true, 'location' => 'postField'], 'privacy' => ['type' => 'string', 'required' => false, 'location' => 'postField', 'default' => 'public', 'enum' => ['public', 'private']], 'topic' => ['type' => 'string', 'required' => false, 'location' => 'postField'], 'guest_access' => ['type' => 'integer', 'required' => false, 'default' => 0, 'enum' => [0, 1], 'location' => 'postField']]], 'deleteRoom' => ['httpMethod' => 'POST', 'uri' => 'rooms/delete', 'responseModel' => 'getResponse', 'parameters' => ['auth_token' => ['type' => 'string', 'required' => true, 'location' => 'postField'], 'room_id' => ['type' => 'string', 'required' => true, 'location' => 'postField']]], 'historyRoom' => ['httpMethod' => 'GET', 'uri' => 'rooms/history', 'responseModel' => 'getResponse', 'parameters' => ['auth_token' => ['type' => 'string', 'required' => true, 'location' => 'query'], 'room_id' => ['type' => 'string', 'required' => true, 'location' => 'query'], 'date' => ['type' => 'string', 'required' => false, 'location' => 'query', 'default' => 'recent'], 'timezone' => ['type' => 'string', 'required' => false, 'location' => 'query', 'default' => 'UTC']]], 'listRoom' => ['httpMethod' => 'GET', 'uri' => 'rooms/list', 'responseModel' => 'getResponse', 'parameters' => ['auth_token' => ['type' => 'string', 'required' => true, 'location' => 'query']]], 'sendMessage' => ['httpMethod' => 'POST', 'uri' => 'rooms/message', 'responseModel' => 'getResponse', 'parameters' => ['auth_token' => ['type' => 'string', 'required' => true, 'location' => 'postField'], 'room_id' => ['type' => 'string', 'location' => 'postField', 'required' => true], 'from' => ['type' => 'string', 'location' => 'postField', 'required' => true, 'maxLength' => 15], 'message' => ['type' => 'string', 'location' => 'postField', 'required' => true, 'maxLength' => 10000], 'message_format' => ['type' => 'string', 'location' => 'postField', 'required' => false, 'default' => 'html', 'enum' => ['html', 'text']], 'notify' => ['type' => 'integer', 'location' => 'postField', 'default' => 0, 'required' => false, 'enum' => [0, 1]], 'color' => ['type' => 'string', 'location' => 'postField', 'default' => 'yellow', 'required' => false, 'enum' => ["yellow", "red", "green", "purple", "gray", "random"]]]], 'topicRoom' => ['httpMethod' => 'POST', 'uri' => 'rooms/topic', 'responseModel' => 'getResponse', 'parameters' => ['auth_token' => ['type' => 'string', 'required' => true, 'location' => 'postField'], 'room_id' => ['type' => 'string', 'location' => 'postField', 'required' => true], 'topic' => ['type' => 'string', 'location' => 'postField', 'required' => true, 'maxLength' => 250], 'from' => ['type' => 'string', 'location' => 'postField', 'required' => false, 'default' => 'API']]], 'showRoom' => ['httpMethod' => 'GET', 'uri' => 'rooms/show', 'responseModel' => 'getResponse', 'parameters' => ['auth_token' => ['type' => 'string', 'required' => true, 'location' => 'query'], 'room_id' => ['type' => 'string', 'location' => 'query', 'required' => true]]], 'createUser' => ['httpMethod' => 'POST', 'uri' => 'users/create', 'responseModel' => 'getResponse', 'parameters' => ['auth_token' => ['type' => 'string', 'required' => true, 'location' => 'postField'], 'email' => ['type' => 'string', 'location' => 'postField', 'required' => true], 'name' => ['type' => 'string', 'location' => 'postField', 'required' => true], 'mention_name' => ['type' => 'string', 'location' => 'postField', 'required' => false], 'title' => ['type' => 'string', 'location' => 'postField', 'required' => false], 'is_group_admin' => ['type' => 'integer', 'location' => 'postField', 'required' => false, 'default' => 0, 'enum' => [0, 1]], 'password' => ['type' => 'string', 'location' => 'postField', 'required' => false], 'timezone' => ['type' => 'string', 'location' => 'postField', 'required' => false, 'default' => 'UTC']]], 'deleteUser' => ['httpMethod' => 'POST', 'uri' => 'users/delete', 'responseModel' => 'getResponse', 'parameters' => ['auth_token' => ['type' => 'string', 'required' => true, 'location' => 'postField'], 'user_id' => ['type' => 'string', 'location' => 'postField', 'required' => true]]], 'listUser' => ['httpMethod' => 'GET', 'uri' => 'users/list', 'responseModel' => 'getResponse', 'parameters' => ['auth_token' => ['type' => 'string', 'required' => true, 'location' => 'query'], 'include_deleted' => ['type' => 'integer', 'location' => 'query', 'required' => false, 'default' => 0, 'enum' => [0, 1]]]], 'showUser' => ['httpMethod' => 'GET', 'uri' => 'users/show', 'responseModel' => 'getResponse', 'parameters' => ['auth_token' => ['type' => 'string', 'required' => true, 'location' => 'query'], 'user_id' => ['type' => 'string', 'location' => 'query', 'required' => true]]], 'undeleteUser' => ['httpMethod' => 'POST', 'uri' => 'users/undelete', 'responseModel' => 'getResponse', 'parameters' => ['auth_token' => ['type' => 'string', 'required' => true, 'location' => 'postField'], 'user_id' => ['type' => 'string', 'location' => 'postField', 'required' => true]]], 'updateUser' => ['httpMethod' => 'POST', 'uri' => 'users/update', 'responseModel' => 'getResponse', 'parameters' => ['auth_token' => ['type' => 'string', 'required' => true, 'location' => 'postField'], 'user_id' => ['type' => 'string', 'location' => 'postField', 'required' => true], 'email' => ['type' => 'string', 'location' => 'postField', 'required' => false], 'name' => ['type' => 'string', 'location' => 'postField', 'required' => false], 'mention_name' => ['type' => 'string', 'location' => 'postField', 'required' => false], 'title' => ['type' => 'string', 'location' => 'postField', 'required' => false], 'is_group_admin' => ['type' => 'integer', 'location' => 'postField', 'required' => false, 'default' => 0, 'enum' => [0, 1]], 'password' => ['type' => 'string', 'location' => 'postField', 'required' => false], 'timezone' => ['type' => 'string', 'location' => 'postField', 'required' => false, 'default' => 'UTC']]]], 'models' => ['getResponse' => ['type' => 'object', 'properties' => ['statusCode' => ['location' => 'statusCode'], 'reason' => ['location' => 'reasonPhrase'], 'ratelimit-limit' => ['location' => 'header', 'sentAs' => 'x-ratelimit-limit'], 'ratelimit-remaining' => ['location' => 'header', 'sentAs' => 'x-ratelimit-remaining'], 'ratelimit-reset' => ['location' => 'header', 'sentAs' => 'x-ratelimit-reset']], 'additionalProperties' => ['location' => 'json']]]]); return parent::__construct($guzzleClient, $hipchatDescription); }
public function __construct(Client $client, $config = []) { $description = new Description(json_decode(file_get_contents(__DIR__ . '/service.json'), true)); parent::__construct($client, $description, $config); }
/** * Instantiates an abstract API client. * * @param array $config */ public function __construct(array $config = []) { $this->parseConfig(array_merge($this->apiConfig, $config)); parent::__construct($this->initializeClient(), $this->resolveApiDescription()); }