Skip to content

Commit

Permalink
add new requests
Browse files Browse the repository at this point in the history
  • Loading branch information
cevro committed Jan 10, 2024
1 parent 9a1618e commit 020b201
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Requests/EventRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public function getParams(): array

final public function getMethod(): string
{
return 'GetEvent';
return 'events/' . $this->eventId;
}
}
32 changes: 32 additions & 0 deletions src/Requests/ParticipantsRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Fykosak\FKSDBDownloaderCore\Requests;

class ParticipantsRequest implements Request
{
private int $eventId;

public function __construct(int $eventId)
{
$this->eventId = $eventId;
}

public function getMethod(): string
{
return 'events/' . $this->eventId . '/participants';
}

public function getParams(): array
{
return [
'eventId' => $this->eventId,
];
}

public function getCacheKey(): string
{
return sprintf('participant-list.%d', $this->eventId);
}
}
4 changes: 2 additions & 2 deletions src/Requests/StatsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(int $contestId, int $year)

public function getMethod(): string
{
return 'GetStats';
return 'contests/' . $this->contestId . '/years/' . $this->year . '/stats';
}

public function getParams(): array
Expand All @@ -30,6 +30,6 @@ public function getParams(): array

public function getCacheKey(): string
{
return sprintf('task.stats.%s.%s', $this->contestId, $this->year);
return sprintf('task-stats.%s.%s', $this->contestId, $this->year);
}
}
32 changes: 32 additions & 0 deletions src/Requests/TeamsRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Fykosak\FKSDBDownloaderCore\Requests;

class TeamsRequest implements Request
{
private int $eventId;

public function __construct(int $eventId)
{
$this->eventId = $eventId;
}

public function getMethod(): string
{
return 'events/' . $this->eventId . '/teams';
}

public function getParams(): array
{
return [
'eventId' => $this->eventId,
];
}

public function getCacheKey(): string
{
return sprintf('team-list.%d', $this->eventId);
}
}

0 comments on commit 020b201

Please sign in to comment.