Skip to content

Commit 7de1574

Browse files
feat(api): manual updates
1 parent 1b83bad commit 7de1574

110 files changed

Lines changed: 8934 additions & 1494 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 38
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c1b6ca84f9bec1b1936cebb61f058924c3d7a5f6977e4cd76cf0544c4c7d8737.yml
1+
configured_endpoints: 40
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-e2ba5381de3010ee53f27388aa6727ad567eb18e4b0b4eb1c4c66402bfea64cc.yml
33
openapi_spec_hash: 141bfa8430ddccfb5a37c4bd703d163b
4-
config_hash: bff282047fafdad771fb7ec685f56944
4+
config_hash: 920678668dd2da6f8966fbf1b8fde4e2

src/Batch/BatchDeleteResponse.php

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ContextDev\Batch;
6+
7+
use ContextDev\Batch\BatchDeleteResponse\KeyMetadata;
8+
use ContextDev\Core\Attributes\Optional;
9+
use ContextDev\Core\Concerns\SdkModel;
10+
use ContextDev\Core\Contracts\BaseModel;
11+
12+
/**
13+
* @phpstan-import-type KeyMetadataShape from \ContextDev\Batch\BatchDeleteResponse\KeyMetadata
14+
*
15+
* @phpstan-type BatchDeleteResponseShape = array{
16+
* id?: string|null,
17+
* deleted?: bool|null,
18+
* keyMetadata?: null|KeyMetadata|KeyMetadataShape,
19+
* }
20+
*/
21+
final class BatchDeleteResponse implements BaseModel
22+
{
23+
/** @use SdkModel<BatchDeleteResponseShape> */
24+
use SdkModel;
25+
26+
/**
27+
* ID of the deleted batch.
28+
*/
29+
#[Optional]
30+
public ?string $id;
31+
32+
/**
33+
* Always true on success.
34+
*/
35+
#[Optional]
36+
public ?bool $deleted;
37+
38+
/**
39+
* Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
40+
*/
41+
#[Optional('key_metadata')]
42+
public ?KeyMetadata $keyMetadata;
43+
44+
public function __construct()
45+
{
46+
$this->initialize();
47+
}
48+
49+
/**
50+
* Construct an instance from the required parameters.
51+
*
52+
* You must use named parameters to construct any parameters with a default value.
53+
*
54+
* @param KeyMetadata|KeyMetadataShape|null $keyMetadata
55+
*/
56+
public static function with(
57+
?string $id = null,
58+
?bool $deleted = null,
59+
KeyMetadata|array|null $keyMetadata = null,
60+
): self {
61+
$self = new self;
62+
63+
null !== $id && $self['id'] = $id;
64+
null !== $deleted && $self['deleted'] = $deleted;
65+
null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata;
66+
67+
return $self;
68+
}
69+
70+
/**
71+
* ID of the deleted batch.
72+
*/
73+
public function withID(string $id): self
74+
{
75+
$self = clone $this;
76+
$self['id'] = $id;
77+
78+
return $self;
79+
}
80+
81+
/**
82+
* Always true on success.
83+
*/
84+
public function withDeleted(bool $deleted): self
85+
{
86+
$self = clone $this;
87+
$self['deleted'] = $deleted;
88+
89+
return $self;
90+
}
91+
92+
/**
93+
* Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
94+
*
95+
* @param KeyMetadata|KeyMetadataShape $keyMetadata
96+
*/
97+
public function withKeyMetadata(KeyMetadata|array $keyMetadata): self
98+
{
99+
$self = clone $this;
100+
$self['keyMetadata'] = $keyMetadata;
101+
102+
return $self;
103+
}
104+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ContextDev\Batch\BatchDeleteResponse;
6+
7+
use ContextDev\Core\Attributes\Required;
8+
use ContextDev\Core\Concerns\SdkModel;
9+
use ContextDev\Core\Contracts\BaseModel;
10+
11+
/**
12+
* Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
13+
*
14+
* @phpstan-type KeyMetadataShape = array{
15+
* creditsConsumed: int, creditsRemaining: int
16+
* }
17+
*/
18+
final class KeyMetadata implements BaseModel
19+
{
20+
/** @use SdkModel<KeyMetadataShape> */
21+
use SdkModel;
22+
23+
/**
24+
* The number of credits consumed by this request.
25+
*/
26+
#[Required('credits_consumed')]
27+
public int $creditsConsumed;
28+
29+
/**
30+
* The number of credits remaining for your organization after this request.
31+
*/
32+
#[Required('credits_remaining')]
33+
public int $creditsRemaining;
34+
35+
/**
36+
* `new KeyMetadata()` is missing required properties by the API.
37+
*
38+
* To enforce required parameters use
39+
* ```
40+
* KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...)
41+
* ```
42+
*
43+
* Otherwise ensure the following setters are called
44+
*
45+
* ```
46+
* (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...)
47+
* ```
48+
*/
49+
public function __construct()
50+
{
51+
$this->initialize();
52+
}
53+
54+
/**
55+
* Construct an instance from the required parameters.
56+
*
57+
* You must use named parameters to construct any parameters with a default value.
58+
*/
59+
public static function with(
60+
int $creditsConsumed,
61+
int $creditsRemaining
62+
): self {
63+
$self = new self;
64+
65+
$self['creditsConsumed'] = $creditsConsumed;
66+
$self['creditsRemaining'] = $creditsRemaining;
67+
68+
return $self;
69+
}
70+
71+
/**
72+
* The number of credits consumed by this request.
73+
*/
74+
public function withCreditsConsumed(int $creditsConsumed): self
75+
{
76+
$self = clone $this;
77+
$self['creditsConsumed'] = $creditsConsumed;
78+
79+
return $self;
80+
}
81+
82+
/**
83+
* The number of credits remaining for your organization after this request.
84+
*/
85+
public function withCreditsRemaining(int $creditsRemaining): self
86+
{
87+
$self = clone $this;
88+
$self['creditsRemaining'] = $creditsRemaining;
89+
90+
return $self;
91+
}
92+
}

src/Batch/BatchSubmitParams.php

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,28 @@
44

55
namespace ContextDev\Batch;
66

7-
use ContextDev\Batch\BatchSubmitParams\Identifiers;
7+
use ContextDev\Batch\BatchSubmitParams\Input;
8+
use ContextDev\Batch\BatchSubmitParams\Input\Crawl;
9+
use ContextDev\Batch\BatchSubmitParams\Input\Scrape;
810
use ContextDev\Core\Attributes\Optional;
911
use ContextDev\Core\Attributes\Required;
1012
use ContextDev\Core\Concerns\SdkModel;
1113
use ContextDev\Core\Concerns\SdkParams;
1214
use ContextDev\Core\Contracts\BaseModel;
1315

1416
/**
15-
* Retrieve and normalize a person profile from identifiers.
17+
* Scrape 25K URLs or crawl large websites asynchronously.
1618
*
1719
* @see ContextDev\Services\BatchService::submit()
1820
*
19-
* @phpstan-import-type IdentifiersShape from \ContextDev\Batch\BatchSubmitParams\Identifiers
21+
* @phpstan-import-type InputVariants from \ContextDev\Batch\BatchSubmitParams\Input
22+
* @phpstan-import-type InputShape from \ContextDev\Batch\BatchSubmitParams\Input
2023
*
2124
* @phpstan-type BatchSubmitParamsShape = array{
22-
* identifiers: Identifiers|IdentifiersShape,
25+
* input: InputShape,
2326
* tags?: list<string>|null,
24-
* timeoutMs?: int|null,
27+
* webhookURL?: string|null,
28+
* idempotencyKey?: string|null,
2529
* }
2630
*/
2731
final class BatchSubmitParams implements BaseModel
@@ -31,37 +35,45 @@ final class BatchSubmitParams implements BaseModel
3135
use SdkParams;
3236

3337
/**
34-
* Known identifiers for the person. At least one identifier is required.
38+
* Choose a URL list or a site crawl.
39+
*
40+
* @var InputVariants $input
3541
*/
36-
#[Required]
37-
public Identifiers $identifiers;
42+
#[Required(union: Input::class)]
43+
public Scrape|Crawl $input;
3844

3945
/**
40-
* Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
46+
* Tags stored on the batch. Filter the batch list by them later.
4147
*
4248
* @var list<string>|null $tags
4349
*/
4450
#[Optional(list: 'string')]
4551
public ?array $tags;
4652

4753
/**
48-
* Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).
54+
* URL notified when the batch finishes.
55+
*/
56+
#[Optional('webhookUrl')]
57+
public ?string $webhookURL;
58+
59+
/**
60+
* Any string unique to this submission. Retries with the same key return the original batch.
4961
*/
50-
#[Optional('timeoutMS')]
51-
public ?int $timeoutMs;
62+
#[Optional]
63+
public ?string $idempotencyKey;
5264

5365
/**
5466
* `new BatchSubmitParams()` is missing required properties by the API.
5567
*
5668
* To enforce required parameters use
5769
* ```
58-
* BatchSubmitParams::with(identifiers: ...)
70+
* BatchSubmitParams::with(input: ...)
5971
* ```
6072
*
6173
* Otherwise ensure the following setters are called
6274
*
6375
* ```
64-
* (new BatchSubmitParams)->withIdentifiers(...)
76+
* (new BatchSubmitParams)->withInput(...)
6577
* ```
6678
*/
6779
public function __construct()
@@ -74,39 +86,41 @@ public function __construct()
7486
*
7587
* You must use named parameters to construct any parameters with a default value.
7688
*
77-
* @param Identifiers|IdentifiersShape $identifiers
89+
* @param InputShape $input
7890
* @param list<string>|null $tags
7991
*/
8092
public static function with(
81-
Identifiers|array $identifiers,
93+
Scrape|array|Crawl $input,
8294
?array $tags = null,
83-
?int $timeoutMs = null
95+
?string $webhookURL = null,
96+
?string $idempotencyKey = null,
8497
): self {
8598
$self = new self;
8699

87-
$self['identifiers'] = $identifiers;
100+
$self['input'] = $input;
88101

89102
null !== $tags && $self['tags'] = $tags;
90-
null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs;
103+
null !== $webhookURL && $self['webhookURL'] = $webhookURL;
104+
null !== $idempotencyKey && $self['idempotencyKey'] = $idempotencyKey;
91105

92106
return $self;
93107
}
94108

95109
/**
96-
* Known identifiers for the person. At least one identifier is required.
110+
* Choose a URL list or a site crawl.
97111
*
98-
* @param Identifiers|IdentifiersShape $identifiers
112+
* @param InputShape $input
99113
*/
100-
public function withIdentifiers(Identifiers|array $identifiers): self
114+
public function withInput(Scrape|array|Crawl $input): self
101115
{
102116
$self = clone $this;
103-
$self['identifiers'] = $identifiers;
117+
$self['input'] = $input;
104118

105119
return $self;
106120
}
107121

108122
/**
109-
* Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
123+
* Tags stored on the batch. Filter the batch list by them later.
110124
*
111125
* @param list<string> $tags
112126
*/
@@ -119,12 +133,23 @@ public function withTags(array $tags): self
119133
}
120134

121135
/**
122-
* Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).
136+
* URL notified when the batch finishes.
137+
*/
138+
public function withWebhookURL(string $webhookURL): self
139+
{
140+
$self = clone $this;
141+
$self['webhookURL'] = $webhookURL;
142+
143+
return $self;
144+
}
145+
146+
/**
147+
* Any string unique to this submission. Retries with the same key return the original batch.
123148
*/
124-
public function withTimeoutMs(int $timeoutMs): self
149+
public function withIdempotencyKey(string $idempotencyKey): self
125150
{
126151
$self = clone $this;
127-
$self['timeoutMs'] = $timeoutMs;
152+
$self['idempotencyKey'] = $idempotencyKey;
128153

129154
return $self;
130155
}

0 commit comments

Comments
 (0)