/** * Retrieves a person and company by email address. * * @param array $parameters { * @var string $email the person's email address * } * @param string $fetch Fetch mode (object or response) * * @return \Psr\Http\Message\ResponseInterface|\Clearbit\Generated\Model\Combined */ public function getCombined($parameters = array(), $fetch = self::FETCH_OBJECT) { $queryParam = new QueryParam(); $queryParam->setRequired('email'); $url = '/v2/combined/find'; $url = $url . ('?' . $queryParam->buildQueryString($parameters)); $headers = array_merge(array('Host' => 'person.clearbit.com'), $queryParam->buildHeaders($parameters)); $body = $queryParam->buildFormDataString($parameters); $request = $this->messageFactory->createRequest('GET', $url, $headers, $body); $response = $this->httpClient->sendRequest($request); if (self::FETCH_OBJECT == $fetch) { if ('200' == $response->getStatusCode()) { return $this->serializer->deserialize((string) $response->getBody(), 'Clearbit\\Generated\\Model\\Combined', 'json'); } } return $response; }
/** * Retrieves a person and company by email address. * * @param array $parameters { * @var string $email the person's email address * } * @param string $fetch Fetch mode (object or response) * @param array $options * * @return \Psr\Http\Message\ResponseInterface|\Clearbit\Generated\Model\Combined */ public function getCombined($parameters = [], $fetch = self::FETCH_OBJECT, $options = []) { $queryParam = new QueryParam(); $queryParam->setRequired('email'); $options = array_merge(['scheme' => 'https', 'host' => 'person.clearbit.com', 'path' => '/v2/combined/find'], $options); $url = sprintf('%s://%s%s?%s', $options['scheme'], $options['host'], $options['path'], $queryParam->buildQueryString($parameters)); $headers = array_merge(['Host' => $options['host']], $queryParam->buildHeaders($parameters)); $body = $queryParam->buildFormDataString($parameters); $request = $this->messageFactory->createRequest('GET', $url, $headers, $body); $response = $this->httpClient->sendRequest($request); $statusCode = $response->getStatusCode(); switch (true) { case 202 == $statusCode: throw new Exception\AsyncLookingException(); case 404 == $statusCode: throw new Exception\NotFoundException(); case 200 != $statusCode: throw new Exception\BadResponseException($response); } if (self::FETCH_OBJECT == $fetch) { return $this->serializer->deserialize($response->getBody()->getContents(), 'Clearbit\\Generated\\Model\\Combined', 'json'); } return $response; }
/** * Upload a tar archive to be extracted to a path in the filesystem of container id. * * @param string $id The container id or name * @param string $inputStream The input stream must be a tar archive compressed with one of the following algorithms: identity (no compression), gzip, bzip2, xz. * @param array $parameters { * * @var string $path Path to a directory in the container to extract the archive’s contents into. * @var string $noOverwriteDirNonDir If “1”, “true”, or “True” then it will be an error if unpacking the given content would cause an existing directory to be replaced with a non-directory and vice versa. * } * * @param string $fetch Fetch mode (object or response) * * @return \Psr\Http\Message\ResponseInterface */ public function putArchive($id, $inputStream, $parameters = [], $fetch = self::FETCH_OBJECT) { $queryParam = new QueryParam(); $queryParam->setRequired('path'); $queryParam->setDefault('noOverwriteDirNonDir', null); $url = '/containers/{id}/archive'; $url = str_replace('{id}', urlencode($id), $url); $url = $url . ('?' . $queryParam->buildQueryString($parameters)); $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); $body = $inputStream; $request = $this->messageFactory->createRequest('PUT', $url, $headers, $body); $response = $this->httpClient->sendRequest($request); return $response; }
/** * Push the image name on the registry. * * @param string $name Image name or id * @param array $parameters { * * @var string $tag The tag to associate with the image on the registry. * @var string $X-Registry-Auth A base64-encoded AuthConfig object * } * * @param string $fetch Fetch mode (object or response) * * @return \Psr\Http\Message\ResponseInterface */ public function push($name, $parameters = [], $fetch = self::FETCH_OBJECT) { $queryParam = new QueryParam(); $queryParam->setDefault('tag', null); $queryParam->setRequired('X-Registry-Auth'); $queryParam->setHeaderParameters(['X-Registry-Auth']); $url = '/images/{name}/push'; $url = str_replace('{name}', urlencode($name), $url); $url = $url . ('?' . $queryParam->buildQueryString($parameters)); $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); $body = $queryParam->buildFormDataString($parameters); $request = $this->messageFactory->createRequest('POST', $url, $headers, $body); $response = $this->httpClient->sendRequest($request); return $response; }
/** * @param array $parameters { * * @var string $testString * @var int $testInteger * @var float $testFloat * @var array $testArray * @var string $testRequired * @var string $testDefault * } * * @param string $fetch Fetch mode (object or response) * * @return \Psr\Http\Message\ResponseInterface */ public function testFormParameters($parameters = [], $fetch = self::FETCH_OBJECT) { $queryParam = new QueryParam(); $queryParam->setDefault('testString', null); $queryParam->setFormParameters(['testString']); $queryParam->setDefault('testInteger', null); $queryParam->setFormParameters(['testInteger']); $queryParam->setDefault('testFloat', null); $queryParam->setFormParameters(['testFloat']); $queryParam->setDefault('testArray', null); $queryParam->setFormParameters(['testArray']); $queryParam->setRequired('testRequired'); $queryParam->setFormParameters(['testRequired']); $queryParam->setDefault('testDefault', 'test'); $queryParam->setFormParameters(['testDefault']); $url = '/test-form'; $url = $url . ('?' . $queryParam->buildQueryString($parameters)); $headers = array_merge(['Host' => 'localhost'], $queryParam->buildHeaders($parameters)); $body = $queryParam->buildFormDataString($parameters); $request = $this->messageFactory->createRequest('POST', $url, $headers, $body); $response = $this->httpClient->sendRequest($request); return $response; }