Return an image client.

@param string       $organization Organization name
@param string       $apiKey       API key
@param array|string $options      Options like api_base_url or proxy

@throws \RuntimeException

@return Image
962176
public static function getImageClient($organization, $apiKey, $options = [])
    {
        $baseUrl = BaseClient::DEFAULT_API_BASE_URL;
        if (!\is_array($options)) { // $options was introduced later, if that is an array, we're on the new sig, nothing to change
            if (\func_num_args() > 3) { // if more than 3 args, the 4th is the baseUrl
                $baseUrl = func_get_arg(3);
            } elseif (3 === \func_num_args()) { // if exactly 3 args
                //if $baseUrl doesn't start with http, it may be a secret from the old signature, remove that, it's not used anymore
                if ('http' !== substr($options, 0, 4)) {
                    $baseUrl = BaseClient::DEFAULT_API_BASE_URL;
                } else {
                    $baseUrl = $options;
                }
            }
            $options = [];
        } else {
            if (isset($options[self::API_BASE_URL])) {
                $baseUrl = $options[self::API_BASE_URL];
            }
        }

        $client = self::getGuzzleClient($baseUrl, $options);

        return new ImageClient($client, $organization, $apiKey);
    }
905664
public function getService($apiKey)
    {
        ValidationUtility::ensureStringOrInteger('$apiKey', $apiKey);

        return $this->callServiceOwnerGetApi(
            '\Authlete\Dto\Service::fromJson',
            self::$SERVICE_GET_API_PATH . $apiKey);
    }
345242
public function getOptions(ContainerInterface $container, $key, $name = null)
    {
        if ($name === null) {
            $name = $this->getName();
        }

        $options = $container->get('config');
        $options = $options['doctrine'];
        if ($mappingType = $this->getMappingType()) {
            $options = $options[$mappingType];
        }
        $options = isset($options[$key][$name]) ? $options[$key][$name] : null;

        if (null === $options) {
            throw new RuntimeException(
                sprintf(
                    'Options with name "%s" could not be found in "doctrine.%s".',
                    $name,
                    $key
                )
            );
        }

        $optionsClass = $this->getOptionsClass();

        return new $optionsClass($options);
    }
908683
public function request($url, $method = 'GET', $options = [])
    {
        $method = strtoupper($method);

        $options = array_merge(self::$defaults, $options);

        Log::debug('Client Request:', compact('url', 'method', 'options'));

        $options['handler'] = $this->getHandler();

        if (property_exists($this, 'baseUri') && !is_null($this->baseUri)) {
            $options['base_uri'] = $this->baseUri;
        }

        $response = $this->getClient()->request($method, $url, $options);

        Log::debug('API response:', [
            'Status' => $response->getStatusCode(),
            'Reason' => $response->getReasonPhrase(),
            'Headers' => $response->getHeaders(),
            'Body' => strval($response->getBody()),
        ]);

        return $response;
    }
87982
public function save($image, $options)
    {
        $image = $this->saveToString($image, $options);
        return $this->saveFromString($image, $options);
    }
76708
public function logoSearch($image, $options=array()){

        $data = array();
        
        $data['image'] = base64_encode($image);

        $data = array_merge($data, $options);

        return $this->request($this->logoSearchUrl, $data);
    }
123383
public function qrcode($image, $options=array()){

        $data = array();
        
        $data['image'] = base64_encode($image);

        $data = array_merge($data, $options);

        return $this->request($this->qrcodeUrl, $data);
    }
634447
public function createOrganizationAdminInvite($organizationUuid, $email)
    {
        $options = [
            'form_params' => [
                'email' => $email,
            ],
        ];

        return new OperationResponse(
            $this->connector->request('post', "/teams/${organizationUuid}/invites", $this->query, $options)
        );
    }
593409
def organization_organization_memberships(self, organization_id, **kwargs):
        ""
        api_path = "/api/v2/organizations/{organization_id}/organization_memberships.json"
        api_path = api_path.format(organization_id=organization_id)
        return self.call(api_path, **kwargs)
1013009
public function execute($method, array $options = [], array $arguments = []) {
        $params = [];

        if (count($options) > 0) {
            $params['options'] = $options;
        }

        if (count($arguments) > 0) {
            $params['arguments'] = $arguments;
        }

        $result = $this->api->request(
            $method,
            $params
        );

        if (!array_key_exists('success', $result)) {
            throw new RuntimeException('Missing success status');
        }

        if (!is_bool($result['success']) || $result['success'] === false) {
            throw new RuntimeException('Command failed');
        }

        if (!array_key_exists('output', $result)) {
            throw new RuntimeException('Missing output');
        }

        if (!is_array($result['output'])) {
            throw new RuntimeException('Invalid output');
        }

        return $result['output'];
    }
273221
public function getOrganisationField( $key )
	{
		if( !array_key_exists( $key, $this->types['org'] ) )
			throw new InvalidArgumentException( 'Organisation Key "'.$key.'" is invalid.' );
		return $this->types['org'][$key];
	}
56611
public function getIcon(AbstractResource $resource, Workspace $workspace = null)
    {
        $node = $resource->getResourceNode();
        $mimeElements = explode('/', $node->getMimeType());
        $ds = DIRECTORY_SEPARATOR;
        // if video or img => generate the thumbnail, otherwise find an existing one.
        if (($mimeElements[0] === 'video' || $mimeElements[0] === 'image')) {
            $this->om->startFlushSuite();
            $thumbnailPath = $this->createFromFile(
                $this->fileDir. $ds . $resource->getHashName(),
                $mimeElements[0],
                $workspace
            );

            if ($thumbnailPath !== null) {
                $thumbnailName = pathinfo($thumbnailPath, PATHINFO_BASENAME);

                if (is_null($workspace)) {
                    $relativeUrl = $this->basepath . "/{$thumbnailName}";
                } else {
                    $relativeUrl = $this->basepath .
                        $ds .
                        $workspace->getCode() .
                        $ds .
                        $thumbnailName;
                }
                $icon = $this->om->factory('Claroline\CoreBundle\Entity\Resource\ResourceIcon');
                $icon->setMimeType('custom');
                $icon->setRelativeUrl($relativeUrl);
                $icon->setShortcut(false);
                $this->om->persist($icon);
                $this->createShortcutIcon($icon, $workspace);
                $this->om->endFlushSuite();

                return $icon;
            }
            $this->om->endFlushSuite();
        }

        //default & fallback
        return $this->searchIcon($node->getMimeType());
    }
1120136
public function get($method, array $params, array $options = array())
    {
        $this->parseOptions($options);

        $params = array_merge($params, $this->apiKeys);

        $response = $this->httpAdapter->getContent(
            sprintf(self::API_ENDPOINT, $this->scheme, $this->outputFormat, $method .'?'. http_build_query($params)),
            $this->headers
        );

        return $this->responseHandler($response);
    }
1207309
private function getApiDoc(bool $collection, string $resourceClass, ResourceMetadata $resourceMetadata, string $operationName, array $resourceHydraDoc, array $entrypointHydraDoc = []): ApiDoc
    {
        if ($collection) {
            $method = $this->operationMethodResolver->getCollectionOperationMethod($resourceClass, $operationName);
            $route = $this->operationMethodResolver->getCollectionOperationRoute($resourceClass, $operationName);
            $operationHydraDoc = $this->getCollectionOperationHydraDoc($resourceMetadata->getShortName(), $method, $entrypointHydraDoc);
        } else {
            $method = $this->operationMethodResolver->getItemOperationMethod($resourceClass, $operationName);
            $route = $this->operationMethodResolver->getItemOperationRoute($resourceClass, $operationName);
            $operationHydraDoc = $this->getOperationHydraDoc($method, $resourceHydraDoc);
        }

        $data = [
            'resource' => $route->getPath(),
            'description' => $operationHydraDoc['hydra:title'] ?? '',
            'resourceDescription' => $resourceHydraDoc['hydra:title'] ?? '',
            'section' => $resourceHydraDoc['hydra:title'] ?? '',
        ];

        if (isset($operationHydraDoc['expects']) && 'owl:Nothing' !== $operationHydraDoc['expects']) {
            $data['input'] = sprintf('%s:%s:%s', ApiPlatformParser::IN_PREFIX, $resourceClass, $operationName);
        }

        if (isset($operationHydraDoc['returns']) && 'owl:Nothing' !== $operationHydraDoc['returns']) {
            $data['output'] = sprintf('%s:%s:%s', ApiPlatformParser::OUT_PREFIX, $resourceClass, $operationName);
        }

        if ($collection && 'GET' === $method) {
            $resourceFilters = $resourceMetadata->getCollectionOperationAttribute($operationName, 'filters', [], true);

            $data['filters'] = [];
            foreach ($resourceFilters as $filterId) {
                if ($filter = $this->getFilter($filterId)) {
                    foreach ($filter->getDescription($resourceClass) as $name => $definition) {
                        $data['filters'][] = ['name' => $name] + $definition;
                    }
                }
            }
        }

        $apiDoc = new ApiDoc($data);
        $apiDoc->setRoute($route);

        return $apiDoc;
    }
236596
public static function formatNameWithOrg($name, $organization = null)
    {
        if ($organization instanceof OrganizationInterface
                && false === strpos('__', $name)) {
            $name .= '__'.$organization->getName();
        }

        return $name;
    }
437888
public CollectionRequest<Team> findByOrganization(String organization) {
    
        String path = String.format("/organizations/%s/teams", organization);
        return new CollectionRequest<Team>(this, Team.class, path, "GET");
    }
490027
public function getSourceImageContents($hash, $organization = '')
    {
        $path = implode('/', [
            self::SOURCEIMAGE_RESOURCE,
            $this->getOrganizationName($organization),
            $hash,
            'download', ]
        );

        return $this
            ->call('GET', $path)
            ->getBody()
            ->getContents();
    }