Skip to content

Commit

Permalink
fix: serializaiton problem on sealed results
Browse files Browse the repository at this point in the history
  • Loading branch information
Orkuncakilkaya committed Aug 15, 2024
1 parent 66fe10d commit 29cb26c
Show file tree
Hide file tree
Showing 76 changed files with 265 additions and 252 deletions.
4 changes: 2 additions & 2 deletions scripts/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ fi
# Model file fix
if [ "$platform" = "Darwin" ]; then
sed -i '' 's/public function setData(RawDeviceAttributesResult $data): self/public function setData(array $data): self/' ./src/Model/SignalResponseRawDeviceAttributes.php
sed -i '' 's/public function getData(): RawDeviceAttributesResult/public function getData(): array/' ./src/Model/SignalResponseRawDeviceAttributes.php
sed -i '' 's/public function getData(): ?RawDeviceAttributesResult/public function getData(): array/' ./src/Model/SignalResponseRawDeviceAttributes.php
else
sed -i 's/public function setData(RawDeviceAttributesResult $data): self/public function setData(array $data): self/' ./src/Model/SignalResponseRawDeviceAttributes.php
sed -i 's/public function getData(): RawDeviceAttributesResult/public function getData(): array/' ./src/Model/SignalResponseRawDeviceAttributes.php
sed -i 's/public function getData(): ?RawDeviceAttributesResult/public function getData(): array/' ./src/Model/SignalResponseRawDeviceAttributes.php
fi
)

Expand Down
3 changes: 3 additions & 0 deletions sealed_results_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

require_once(__DIR__ . '/vendor/autoload.php');

$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->safeLoad();

$sealed_result = base64_decode($_ENV['BASE64_SEALED_RESULT'] ?? getenv('BASE64_SEALED_RESULT') ?? "");
$sealed_key = base64_decode($_ENV['BASE64_KEY'] ?? getenv('BASE64_KEY') ?? "");

Expand Down
6 changes: 3 additions & 3 deletions src/Model/ASN.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function valid(): bool
/**
* Gets asn.
*/
public function getAsn(): string
public function getAsn(): ?string
{
return $this->container['asn'];
}
Expand All @@ -235,7 +235,7 @@ public function setAsn(string $asn): self
/**
* Gets network.
*/
public function getNetwork(): string
public function getNetwork(): ?string
{
return $this->container['network'];
}
Expand All @@ -257,7 +257,7 @@ public function setNetwork(string $network): self
/**
* Gets name.
*/
public function getName(): string
public function getName(): ?string
{
return $this->container['name'];
}
Expand Down
4 changes: 2 additions & 2 deletions src/Model/BotdDetectionResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function valid(): bool
/**
* Gets result.
*/
public function getResult(): string
public function getResult(): ?string
{
return $this->container['result'];
}
Expand Down Expand Up @@ -261,7 +261,7 @@ public function setResult(string $result): self
/**
* Gets type.
*/
public function getType(): string
public function getType(): ?string
{
return $this->container['type'];
}
Expand Down
14 changes: 7 additions & 7 deletions src/Model/BotdResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public function valid(): bool
/**
* Gets ip.
*/
public function getIp(): string
public function getIp(): ?string
{
return $this->container['ip'];
}
Expand All @@ -273,7 +273,7 @@ public function setIp(string $ip): self
/**
* Gets time.
*/
public function getTime(): \DateTime
public function getTime(): ?\DateTime
{
return $this->container['time'];
}
Expand All @@ -295,7 +295,7 @@ public function setTime(\DateTime $time): self
/**
* Gets url.
*/
public function getUrl(): string
public function getUrl(): ?string
{
return $this->container['url'];
}
Expand All @@ -317,7 +317,7 @@ public function setUrl(string $url): self
/**
* Gets user_agent.
*/
public function getUserAgent(): string
public function getUserAgent(): ?string
{
return $this->container['user_agent'];
}
Expand All @@ -339,7 +339,7 @@ public function setUserAgent(string $user_agent): self
/**
* Gets request_id.
*/
public function getRequestId(): string
public function getRequestId(): ?string
{
return $this->container['request_id'];
}
Expand All @@ -361,7 +361,7 @@ public function setRequestId(string $request_id): self
/**
* Gets linked_id.
*/
public function getLinkedId(): string
public function getLinkedId(): ?string
{
return $this->container['linked_id'];
}
Expand All @@ -383,7 +383,7 @@ public function setLinkedId(string $linked_id): self
/**
* Gets bot.
*/
public function getBot(): BotdDetectionResult
public function getBot(): ?BotdDetectionResult
{
return $this->container['bot'];
}
Expand Down
16 changes: 8 additions & 8 deletions src/Model/BrowserDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public function valid(): bool
/**
* Gets browser_name.
*/
public function getBrowserName(): string
public function getBrowserName(): ?string
{
return $this->container['browser_name'];
}
Expand All @@ -280,7 +280,7 @@ public function setBrowserName(string $browser_name): self
/**
* Gets browser_major_version.
*/
public function getBrowserMajorVersion(): string
public function getBrowserMajorVersion(): ?string
{
return $this->container['browser_major_version'];
}
Expand All @@ -302,7 +302,7 @@ public function setBrowserMajorVersion(string $browser_major_version): self
/**
* Gets browser_full_version.
*/
public function getBrowserFullVersion(): string
public function getBrowserFullVersion(): ?string
{
return $this->container['browser_full_version'];
}
Expand All @@ -324,7 +324,7 @@ public function setBrowserFullVersion(string $browser_full_version): self
/**
* Gets os.
*/
public function getOs(): string
public function getOs(): ?string
{
return $this->container['os'];
}
Expand All @@ -346,7 +346,7 @@ public function setOs(string $os): self
/**
* Gets os_version.
*/
public function getOsVersion(): string
public function getOsVersion(): ?string
{
return $this->container['os_version'];
}
Expand All @@ -368,7 +368,7 @@ public function setOsVersion(string $os_version): self
/**
* Gets device.
*/
public function getDevice(): string
public function getDevice(): ?string
{
return $this->container['device'];
}
Expand All @@ -390,7 +390,7 @@ public function setDevice(string $device): self
/**
* Gets user_agent.
*/
public function getUserAgent(): string
public function getUserAgent(): ?string
{
return $this->container['user_agent'];
}
Expand All @@ -412,7 +412,7 @@ public function setUserAgent(string $user_agent): self
/**
* Gets bot_probability.
*/
public function getBotProbability(): int
public function getBotProbability(): ?int
{
return $this->container['bot_probability'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/ClonedAppResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function valid(): bool
/**
* Gets result.
*/
public function getResult(): bool
public function getResult(): ?bool
{
return $this->container['result'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Confidence.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function valid(): bool
/**
* Gets score.
*/
public function getScore(): float
public function getScore(): ?float
{
return $this->container['score'];
}
Expand Down
4 changes: 2 additions & 2 deletions src/Model/DataCenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function valid(): bool
/**
* Gets result.
*/
public function getResult(): bool
public function getResult(): ?bool
{
return $this->container['result'];
}
Expand All @@ -226,7 +226,7 @@ public function setResult(bool $result): self
/**
* Gets name.
*/
public function getName(): string
public function getName(): ?string
{
return $this->container['name'];
}
Expand Down
18 changes: 9 additions & 9 deletions src/Model/DeprecatedIPLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function valid(): bool
/**
* Gets accuracy_radius.
*/
public function getAccuracyRadius(): int
public function getAccuracyRadius(): ?int
{
return $this->container['accuracy_radius'];
}
Expand All @@ -264,7 +264,7 @@ public function setAccuracyRadius(int $accuracy_radius): self
/**
* Gets latitude.
*/
public function getLatitude(): float
public function getLatitude(): ?float
{
return $this->container['latitude'];
}
Expand All @@ -286,7 +286,7 @@ public function setLatitude(float $latitude): self
/**
* Gets longitude.
*/
public function getLongitude(): float
public function getLongitude(): ?float
{
return $this->container['longitude'];
}
Expand All @@ -308,7 +308,7 @@ public function setLongitude(float $longitude): self
/**
* Gets postal_code.
*/
public function getPostalCode(): string
public function getPostalCode(): ?string
{
return $this->container['postal_code'];
}
Expand All @@ -330,7 +330,7 @@ public function setPostalCode(string $postal_code): self
/**
* Gets timezone.
*/
public function getTimezone(): string
public function getTimezone(): ?string
{
return $this->container['timezone'];
}
Expand All @@ -352,7 +352,7 @@ public function setTimezone(string $timezone): self
/**
* Gets city.
*/
public function getCity(): DeprecatedIPLocationCity
public function getCity(): ?DeprecatedIPLocationCity
{
return $this->container['city'];
}
Expand All @@ -374,7 +374,7 @@ public function setCity(DeprecatedIPLocationCity $city): self
/**
* Gets country.
*/
public function getCountry(): Location
public function getCountry(): ?Location
{
return $this->container['country'];
}
Expand All @@ -396,7 +396,7 @@ public function setCountry(Location $country): self
/**
* Gets continent.
*/
public function getContinent(): Location
public function getContinent(): ?Location
{
return $this->container['continent'];
}
Expand All @@ -420,7 +420,7 @@ public function setContinent(Location $continent): self
*
* @return \Fingerprint\ServerAPI\Model\Subdivision[]
*/
public function getSubdivisions(): array
public function getSubdivisions(): ?array
{
return $this->container['subdivisions'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/DeprecatedIPLocationCity.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function valid(): bool
/**
* Gets name.
*/
public function getName(): string
public function getName(): ?string
{
return $this->container['name'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/EmulatorResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function valid(): bool
/**
* Gets result.
*/
public function getResult(): bool
public function getResult(): ?bool
{
return $this->container['result'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/ErrorEvent403Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function valid(): bool
/**
* Gets error.
*/
public function getError(): ErrorEvent403ResponseError
public function getError(): ?ErrorEvent403ResponseError
{
return $this->container['error'];
}
Expand Down
4 changes: 2 additions & 2 deletions src/Model/ErrorEvent403ResponseError.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public function valid(): bool
/**
* Gets code.
*/
public function getCode(): string
public function getCode(): ?string
{
return $this->container['code'];
}
Expand Down Expand Up @@ -265,7 +265,7 @@ public function setCode(string $code): self
/**
* Gets message.
*/
public function getMessage(): string
public function getMessage(): ?string
{
return $this->container['message'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/ErrorEvent404Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function valid(): bool
/**
* Gets error.
*/
public function getError(): ErrorEvent404ResponseError
public function getError(): ?ErrorEvent404ResponseError
{
return $this->container['error'];
}
Expand Down
4 changes: 2 additions & 2 deletions src/Model/ErrorEvent404ResponseError.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function valid(): bool
/**
* Gets code.
*/
public function getCode(): string
public function getCode(): ?string
{
return $this->container['code'];
}
Expand Down Expand Up @@ -259,7 +259,7 @@ public function setCode(string $code): self
/**
* Gets message.
*/
public function getMessage(): string
public function getMessage(): ?string
{
return $this->container['message'];
}
Expand Down
Loading

0 comments on commit 29cb26c

Please sign in to comment.