first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

View File

@@ -0,0 +1,115 @@
<?php
namespace KupShop\SellerBundle\Utils;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\HttpClient\HttpOptions;
class SellerGraphQLProvider
{
public const string GET_LOCATIONS = <<<'GRAPHQL'
query GetBranches($coordinatesA: CoordinatesInput, $coordinatesB: CoordinatesInput, $branchType: Int) {
branches(
coordinatesB: $coordinatesB
branchType: $branchType
country: "cz"
coordinatesA: $coordinatesA
) {
id
name
address
branchType {
id
}
coordinates {
latitude
longitude
}
box
card
wheelchair
}
}
GRAPHQL;
public const string SEARCH_BRANCHES = <<<'GRAPHQL'
query SearchBranches($search: String!, $branchType: Int) {
branches(search: $search, branchType: $branchType) {
address,
city,
coordinates {
latitude,
longitude
},
id,
name,
zip
}
}
GRAPHQL;
public const string GET_BRANCH_INFO = <<<'GRAPHQL'
query GetBranchInfo($id: Int!) {
branch(id: $id) {
address
city
coordinates {
latitude
longitude
}
country
id
name
openningHours {
monday
tuesday
wednesday
thursday
friday
saturday
sunday
}
zip
branchId
}
}
GRAPHQL;
public const string GET_CLUSTERS = <<<'GRAPHQL'
query ClusterQuery($coordinatesA: CoordinatesInput, $coordinatesB: CoordinatesInput, $branchType: Int, $zoom: Int!) {
clusters(coordinatesA: $coordinatesA, coordinatesB: $coordinatesB, branchType: $branchType, zoom: $zoom) {
id
coordinates {
latitude
longitude
}
clusterZoom
pointCount
cluster
}
}
GRAPHQL;
private $client;
private const ENDPOINT = 'https://widget.ltrk.dev/graphql';
public function __construct()
{
$this->client = HttpClient::create();
}
public function makeRequest($query, $variables = [])
{
$options = (new HttpOptions())
->setJson(['query' => $query, 'variables' => $variables])
->setHeaders([
'Content-Type' => 'application/json',
'User-Agent' => 'Symfony GraphQL client',
]);
return $this->client
->request('POST', self::ENDPOINT, $options->toArray())
->toArray();
}
}