Returns api call instance

@param String api call name
@return object
186839
public static function getTransactionTypeByName($transType) {
    switch ($transType) {
      //credit card apis
      case 'creditCardTransaction':
        return new GiroCheckout_SDK_CreditCardTransaction();
      case 'creditCardCapture':
        return new GiroCheckout_SDK_CreditCardCapture();
      case 'creditCardRefund':
        return new GiroCheckout_SDK_CreditCardRefund();
      case 'creditCardGetPKN':
        return new GiroCheckout_SDK_CreditCardGetPKN();
      case 'creditCardRecurringTransaction':
        return new GiroCheckout_SDK_CreditCardRecurringTransaction();
      case 'creditCardVoid':
        return new GiroCheckout_SDK_CreditCardVoid();

      //direct debit apis
      case 'directDebitTransaction':
        return new GiroCheckout_SDK_DirectDebitTransaction();
      case 'directDebitGetPKN':
        return new GiroCheckout_SDK_DirectDebitGetPKN();
      case 'directDebitTransactionWithPaymentPage':
        return new GiroCheckout_SDK_DirectDebitTransactionWithPaymentPage();
      case 'directDebitCapture':
        return new GiroCheckout_SDK_DirectDebitCapture();
      case 'directDebitRefund':
        return new GiroCheckout_SDK_DirectDebitRefund();
      case 'directDebitVoid':
        return new GiroCheckout_SDK_DirectDebitVoid();

      //giropay apis
      case 'giropayBankstatus':
        return new GiroCheckout_SDK_GiropayBankstatus();
      case 'giropayIDCheck':
        return new GiroCheckout_SDK_GiropayIDCheck();
      case 'giropayTransaction':
        return new GiroCheckout_SDK_GiropayTransaction();
      case 'giropayIssuerList':
        return new GiroCheckout_SDK_GiropayIssuerList();

      //iDEAL apis
      case 'idealIssuerList':
        return new GiroCheckout_SDK_IdealIssuerList();
      case 'idealPayment':
        return new GiroCheckout_SDK_IdealPayment();
      case 'idealRefund':
        return new GiroCheckout_SDK_IdealPaymentRefund();

      //PayPal apis
      case 'paypalTransaction':
        return new GiroCheckout_SDK_PaypalTransaction();

      //eps apis
      case 'epsBankstatus':
        return new GiroCheckout_SDK_EpsBankstatus();
      case 'epsTransaction':
        return new GiroCheckout_SDK_EpsTransaction();
      case 'epsIssuerList':
        return new GiroCheckout_SDK_EpsIssuerList();

      //tools apis
      case 'getTransactionTool':
        return new GiroCheckout_SDK_Tools_GetTransaction();

      //GiroCode apis
      case 'giroCodeCreatePayment':
        return new GiroCheckout_SDK_GiroCodeCreatePayment();
      case 'giroCodeCreateEpc':
        return new GiroCheckout_SDK_GiroCodeCreateEpc();
      case 'giroCodeGetEpc':
        return new GiroCheckout_SDK_GiroCodeGetEpc();

      //Paydirekt apis
      case 'paydirektTransaction':
        return new GiroCheckout_SDK_PaydirektTransaction();
      case 'paydirektCapture':
        return new GiroCheckout_SDK_PaydirektCapture();
      case 'paydirektRefund':
        return new GiroCheckout_SDK_PaydirektRefund();
      case 'paydirektVoid':
        return new GiroCheckout_SDK_PaydirektVoid();

      //Sofort apis
      case 'sofortuwTransaction':
        return new GiroCheckout_SDK_SofortUwTransaction();

      //BlueCode apis
      case 'blueCodeTransaction':
        return new GiroCheckout_SDK_BlueCodeTransaction();

      //Payment page apis
      case 'paypageTransaction':
        return new GiroCheckout_SDK_PaypageTransaction();
      case 'paypageProjects':
        return new GiroCheckout_SDK_PaypageProjects();

      //Maestro apis
      case 'maestroTransaction':
        return new GiroCheckout_SDK_MaestroTransaction();
      case 'maestroCapture':
        return new GiroCheckout_SDK_MaestroCapture();
      case 'maestroRefund':
        return new GiroCheckout_SDK_MaestroRefund();
    }

    return null;
  }
1196934
public static function getInstance($secret, $apiHost)
    {
        if (!isset(self::$instances[$secret][$apiHost])) {
            self::$instances[$secret][$apiHost] = new self(
                new Entity\Factory(
                    new Client\Curl($secret, $apiHost)
                )
            );
        }

        return self::$instances[$secret][$apiHost];
    }
855862
public function get(string $name, ...$params) {
        if ($this->created->containsKey($name)) return $this->created->getNodeByKey($name)->getValue();
        if ($this->instances->containsKey($name)) return $this->fromInstances($name, $params);

        try {
            $reflectionClass = new ReflectionClass($name);
            $constructor = $reflectionClass->getConstructor();
            $parameters = [];

            if (null !== $constructor) {
                /** @var ReflectionParameter $parameter */
                foreach ($constructor->getParameters() as $parameter) {
                    $className = $parameter->getClass()->getName();
                    $class = $this->get($className);
                    if (null === $class) throw new ClassNotFoundException();
                    $parameters[] = $class;
                }
            }
            $clazz = $reflectionClass->newInstanceArgs($parameters + $params);
            $this->created->add($name, $clazz);
            return $clazz;
        } catch (Exception $exception) {
            return null;
        }
    }
541714
public function get($name, array $parameters = [])
    {
        // Shared services are preserved through whole request
        if (isset($this->shared[$name])) {
            return $this->shared[$name];
        }

        if (!$this->has($name)) {
            throw new NotFoundException('No definition found for service "' . $name . '".');
        }

        $definition = $this->definitions[$name];

        // Alias is a link to another definition
        if (isset($definition['alias'])) {
            return $this->get($definition['alias']);
        }

        // "Init" directive is a function that returns instance of service
        if (isset($definition['init'])) {
            $service_class = call_user_func($definition['init'], $this, $parameters);

            if ($service_class === false) {
                throw new NotFoundException('"Init" directive for service "' . $name . '" did not produced any object.');
            }
        } else {
            $arguments = [];

            // Array of arguments which are given to constructor method
            if (isset($definition['arguments'])) {
                $arguments = $this->resolveArrayOfArguments($definition['arguments'], $parameters);
            }

            // Service is made by static method
            if (isset($definition['static'])) {
                $service_class = call_user_func_array([$definition['class'], $definition['static']], $arguments);

                if ($service_class === false) {
                    throw new NotFoundException('Class "' . $definition['class'] . '" for service "' . $name . '" was not found.');
                }
            } else {
                // Service is made by normal constructor
                try {
                    $reflection_class = new \ReflectionClass($definition['class']);
                } catch (\ReflectionException $e) {
                    throw new NotFoundException('Class "' . $definition['class'] . '" for service "' . $name . '" was not found.');
                }

                $service_class = $reflection_class->newInstanceArgs($arguments);
            }
        }

        // "After" directive is a function that is called after instantiation of service object
        if (isset($definition['after'])) {
            call_user_func($definition['after'], $this, $service_class, $parameters);
        }

        // Preserve shared service
        if (isset($definition['shared']) && $definition['shared'] === true) {
            $this->shared[$name] = $service_class;
        }

        return $service_class;
    }
695497
public function api($name)
    {
        if (!is_string($name) || $name === '') {
            throw new \InvalidArgumentException('No child specified.');
        }

        /** @var Api $child */
        $class = '\\Bitbucket\\API\\'.$name;

        if (!class_exists($class)) {
            throw new \InvalidArgumentException(sprintf('No such child class [%s].', $name));
        }

        $child = new $class();
        $child->setClient($this->getClient());

        if ($this->getClient()->hasListeners()) {
            $child->getClient()->setListeners($this->getClient()->getListeners());
        }

        return $child;
    }
1207378
def get_api(self, name=None):
        """"""
        if name is None:
            try:
                return self.conf.get("api").copy()
            except:  # NOQA
                raise Exception(f"Couldn't find the API configuration")
1115029
public static function getInstance(string $name)
    {
        if (!isset(self::$instances[$name]) || empty(self::$instances[$name])) {
            new static($name);
        }
        return (self::$instances[$name]);
    }
287952
public static function instance($name = null)
	{
		if ($name !== null)
		{
			if ( ! array_key_exists($name, static::$_instances))
			{
				return false;
			}

			return static::$_instances[$name];
		}

		if (static::$_instance === null)
		{
			static::$_instance = static::forge();
		}

		return static::$_instance;
	}
545121
public function getApi($class, $object = NULL)
    {
        $absoluteClass = "\\OntraportAPI\\" . $class;

        // For custom objects
        if ($object)
        {
            // Generate a unique name so that wrong object id is not stored with instantiated class
            $class = $class . "." . $object;
            if (!array_key_exists($class, $this->_apiInstances))
            {
                $this->_apiInstances[$class] = new $absoluteClass($this, $object);
            }
        }

        else
        {
            if (!array_key_exists($class, $this->_apiInstances))
            {
                $this->_apiInstances[$class] = new $absoluteClass($this);
            }
        }

        return $this->_apiInstances[$class];
    }
1219841
public ApiResponse<InlineResponse200> getCallsWithHttpInfo() throws ApiException {
        com.squareup.okhttp.Call call = getCallsValidateBeforeCall(null, null);
        Type localVarReturnType = new TypeToken<InlineResponse200>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
40583
public function get($name, $throwAway = false)
    {
        $client = parent::get($name, $throwAway);

        if ($client instanceof ApiKeyClientInterface) {
            $client->setApiKey(self::$apiKey);
        }

        return $client;
    }
1138473
public static function getInstance($name)
  {
    $key = self::_instanceKey($name);
    if (!isset(self::$_instances[$key])) {

      $dataSource = self::getDataAdapter();
      if (is_null($dataSource)) {
        $data = array();
      } else {
        $data = $dataSource->load($key);
      }
      
      $config = new self($data);
      /* @var $config Config */
      $config->_root = $config;
      $config->_key = $key;

      self::$_instances[$key] = $config;
    }
    return self::$_instances[$key];
  }
423348
public function getUrl($name, $params = array())
	{
		return static::API_DOMAIN . $name . (empty($params) ? '' : ('?' . $this->http_build_query($params)));
	}
1210994
def invoke_api_call(api_call)
      url = URI.parse(api_call[:url])
      http = Net::HTTP.new(url.host, url.port)
      http.use_ssl = true
			http.verify_mode = OpenSSL::SSL::VERIFY_NONE

      # Concatenate parameters to form data
      data = api_call[:params].to_a.map{|pair| pair.map{|x| URI.escape(x.to_s)}.join '='}.join('&')
      headers = {
        'Content-Type' => 'application/x-www-form-urlencoded'
      }

      RubyDesk.logger.info "URL: #{api_call[:url]}"
      RubyDesk.logger.info "method: #{api_call[:method]}"
      RubyDesk.logger.info "Params: #{data}"

      case api_call[:method]
        when :get, 'get' then
          resp, data = http.request(Net::HTTP::Get.new(url.path+"?"+data, headers))
        when :post, 'post' then
          resp, data = http.request(Net::HTTP::Post.new(url.path, headers), data)
        when :delete, 'delete' then
          resp, data = http.request(Net::HTTP::Delete.new(url.path, headers), data)
      end

      RubyDesk.logger.info "Response code: #{resp.code}"
      RubyDesk.logger.info "Returned data: #{data}"

      case resp.code
        when "200" then return data
        when "400" then raise RubyDesk::BadRequest, data
        when "401", "403" then raise RubyDesk::UnauthorizedError, data
        when "404" then raise RubyDesk::PageNotFound, data
        when "500" then raise RubyDesk::ServerError, data
        else raise RubyDesk::Error, data
      end

    end
1258930
public function getChannelByName($name)
    {
        return $this->getChannels()->then(function (array $channels) use ($name) {
            foreach ($channels as $channel) {
                if ($channel->getName() === $name) {
                    return $channel;
                }
            }

            throw new ApiException('Channel ' . $name . ' not found.');
        });
    }
408892
public function callExtension($name, array $params = [])
    {
        $extension = $this->getExtension($name);

        // call_user_func_array seems to be slow
        switch (count($params)) {
            case 0:
                $result = call_user_func($extension);
                break;
            case 1:
                $result = call_user_func($extension, $params[0]);
                break;
            case 2:
                $result = call_user_func($extension, $params[0], $params[1]);
                break;
            case 3:
                $result = call_user_func($extension, $params[0], $params[1], $params[2]);
                break;
            case 4:
                $result = call_user_func($extension, $params[0], $params[1], $params[2], $params[3]);
                break;
            default:
                $result = call_user_func_array($extension, $params);
                break;
        }

        $this->callListeners($name, $result);

        return $result;
    }
1311247
public static function callObjectMethod($object, $name, Array $args = NULL) {
    $args = (array) $args;

    /* funky switch da wir performance wollen */
    switch (count($args)) {
      case 0:
        return $object->$name();

      case 1:
        return $object->$name($args[0]);
        
      case 2:
        return $object->$name($args[0],$args[1]);

      case 3:
        return $object->$name($args[0],$args[1],$args[2]);

      case 4:
        return $object->$name($args[0],$args[1],$args[2],$args[3]);

      case 5:
        return $object->$name($args[0],$args[1],$args[2],$args[3],$args[4]);

      case 6:
        return $object->$name($args[0],$args[1],$args[2],$args[3],$args[4],$args[5]);

      case 7:
        return $object->$name($args[0],$args[1],$args[2],$args[3],$args[4],$args[5],$args[6]);

      case 8:
        return $object->$name($args[0],$args[1],$args[2],$args[3],$args[4],$args[5],$args[6],$args[7]);

      default: 
        // use call_user_func_array evil
        return call_user_func_array(array($object,$name),$args);
    }
  }