Skip to content

Commit ccf46ce

Browse files
author
stlc-bot
committed
feat(monitors): filter monitor credit usage by tag (#3077)
fix(scrape): read google play ratings from the storefront that offers the app (#3084) Stainless-Generated-From: 3f1ca88341bc4ec872092d8128c5113212c68c65
1 parent 9cd4a86 commit ccf46ce

10 files changed

Lines changed: 43 additions & 16 deletions

File tree

‎src/Batch/BatchSubmitParams/Input/Crawl/Data/ParseParams/UnionMember1.php‎

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

‎src/Batch/BatchSubmitParams/Input/Crawl/Data/ParseParams/UnionMember1/Parser.php‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎src/Batch/BatchSubmitParams/Input/Scrape/Data/ParseParams/UnionMember1.php‎

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

‎src/Batch/BatchSubmitParams/Input/Scrape/Data/ParseParams/UnionMember1/Parser.php‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎src/Monitors/MonitorGetCreditUsageParams.php‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
use ContextDev\Core\Contracts\BaseModel;
1111

1212
/**
13-
* Return usage per monitor, highest first, for up to the 10,000 most recent runs in the requested window.
13+
* Return usage per monitor, highest first, for up to the 10,000 most recent runs in the requested window. Pass `tag` to report only the monitors that carry that tag, such as one customer’s monitors.
1414
*
1515
* @see ContextDev\Services\MonitorsService::getCreditUsage()
1616
*
1717
* @phpstan-type MonitorGetCreditUsageParamsShape = array{
18-
* since?: \DateTimeInterface|null, until?: \DateTimeInterface|null
18+
* since?: \DateTimeInterface|null,
19+
* tag?: string|null,
20+
* until?: \DateTimeInterface|null,
1921
* }
2022
*/
2123
final class MonitorGetCreditUsageParams implements BaseModel
@@ -30,6 +32,12 @@ final class MonitorGetCreditUsageParams implements BaseModel
3032
#[Optional]
3133
public ?\DateTimeInterface $since;
3234

35+
/**
36+
* Only include monitors that currently have this tag. Deleted monitors are left out.
37+
*/
38+
#[Optional]
39+
public ?string $tag;
40+
3341
/**
3442
* Only include items before this ISO 8601 timestamp.
3543
*/
@@ -48,11 +56,13 @@ public function __construct()
4856
*/
4957
public static function with(
5058
?\DateTimeInterface $since = null,
51-
?\DateTimeInterface $until = null
59+
?string $tag = null,
60+
?\DateTimeInterface $until = null,
5261
): self {
5362
$self = new self;
5463

5564
null !== $since && $self['since'] = $since;
65+
null !== $tag && $self['tag'] = $tag;
5666
null !== $until && $self['until'] = $until;
5767

5868
return $self;
@@ -69,6 +79,17 @@ public function withSince(\DateTimeInterface $since): self
6979
return $self;
7080
}
7181

82+
/**
83+
* Only include monitors that currently have this tag. Deleted monitors are left out.
84+
*/
85+
public function withTag(string $tag): self
86+
{
87+
$self = clone $this;
88+
$self['tag'] = $tag;
89+
90+
return $self;
91+
}
92+
7293
/**
7394
* Only include items before this ISO 8601 timestamp.
7495
*/

‎src/ServiceContracts/MonitorsContract.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,15 @@ public function delete(
166166
* @api
167167
*
168168
* @param \DateTimeInterface $since only include items at or after this ISO 8601 timestamp
169+
* @param string $tag Only include monitors that currently have this tag. Deleted monitors are left out.
169170
* @param \DateTimeInterface $until only include items before this ISO 8601 timestamp
170171
* @param RequestOpts|null $requestOptions
171172
*
172173
* @throws APIException
173174
*/
174175
public function getCreditUsage(
175176
?\DateTimeInterface $since = null,
177+
?string $tag = null,
176178
?\DateTimeInterface $until = null,
177179
RequestOptions|array|null $requestOptions = null,
178180
): MonitorGetCreditUsageResponse;

‎src/Services/MonitorsRawService.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,10 @@ public function delete(
249249
/**
250250
* @api
251251
*
252-
* Return usage per monitor, highest first, for up to the 10,000 most recent runs in the requested window.
252+
* Return usage per monitor, highest first, for up to the 10,000 most recent runs in the requested window. Pass `tag` to report only the monitors that carry that tag, such as one customer’s monitors.
253253
*
254254
* @param array{
255-
* since?: \DateTimeInterface, until?: \DateTimeInterface
255+
* since?: \DateTimeInterface, tag?: string, until?: \DateTimeInterface
256256
* }|MonitorGetCreditUsageParams $params
257257
* @param RequestOpts|null $requestOptions
258258
*

‎src/Services/MonitorsService.php‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,20 +259,24 @@ public function delete(
259259
/**
260260
* @api
261261
*
262-
* Return usage per monitor, highest first, for up to the 10,000 most recent runs in the requested window.
262+
* Return usage per monitor, highest first, for up to the 10,000 most recent runs in the requested window. Pass `tag` to report only the monitors that carry that tag, such as one customer’s monitors.
263263
*
264264
* @param \DateTimeInterface $since only include items at or after this ISO 8601 timestamp
265+
* @param string $tag Only include monitors that currently have this tag. Deleted monitors are left out.
265266
* @param \DateTimeInterface $until only include items before this ISO 8601 timestamp
266267
* @param RequestOpts|null $requestOptions
267268
*
268269
* @throws APIException
269270
*/
270271
public function getCreditUsage(
271272
?\DateTimeInterface $since = null,
273+
?string $tag = null,
272274
?\DateTimeInterface $until = null,
273275
RequestOptions|array|null $requestOptions = null,
274276
): MonitorGetCreditUsageResponse {
275-
$params = Util::removeNulls(['since' => $since, 'until' => $until]);
277+
$params = Util::removeNulls(
278+
['since' => $since, 'tag' => $tag, 'until' => $until]
279+
);
276280

277281
// @phpstan-ignore-next-line argument.type
278282
$response = $this->raw->getCreditUsage(params: $params, requestOptions: $requestOptions);

‎src/Web/WebScrapeParams/ParseParams/UnionMember1.php‎

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

‎src/Web/WebScrapeParams/ParseParams/UnionMember1/Parser.php‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)