Skip to content

Commit 17848b3

Browse files
feat(api): api update
1 parent 4db7386 commit 17848b3

5 files changed

Lines changed: 90 additions & 462 deletions

File tree

‎.stats.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 37
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-838f03b1c3584485eeded993459e6bbae058da9f6df16b7967980fbba98cc748.yml
3-
openapi_spec_hash: 4a9db9cd9eac4ae4e2694b3d835a772f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-21a0195dcea548066fd6c227d634217b897900a6732a688e41c83344c2e92c94.yml
3+
openapi_spec_hash: 388f5780dc9bf205c04b6a6214e4fafc
44
config_hash: 2bea1743c84d63bd61f8501a6ea63065

‎lib/context_dev/models/batch_cancel_response.rb‎

Lines changed: 38 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Models
55
# @see ContextDev::Resources::Batch#cancel
66
class BatchCancelResponse < ContextDev::Internal::Type::BaseModel
77
# @!attribute id
8-
# Batch ID used to retrieve or cancel the job.
8+
# Batch ID.
99
#
1010
# @return [String]
1111
required :id, String
@@ -18,21 +18,13 @@ class BatchCancelResponse < ContextDev::Internal::Type::BaseModel
1818
required :crawl, -> { ContextDev::CrawlControls }, nil?: true
1919

2020
# @!attribute credits
21-
# What this batch has done to your credit balance.
21+
# What this batch cost so far.
2222
#
2323
# @return [ContextDev::Models::BatchCancelResponse::Credits]
2424
required :credits, -> { ContextDev::Models::BatchCancelResponse::Credits }
2525

26-
# @!attribute failure
27-
# A failure of the batch as a whole, distinct from the per-page failures in
28-
# `page_errors`.
29-
#
30-
# @return [ContextDev::Models::Failure, nil]
31-
required :failure, -> { ContextDev::Failure }, nil?: true
32-
3326
# @!attribute format_
34-
# What each page is returned as. Matches `input.data.format` on the submit
35-
# request.
27+
# What each page is returned as.
3628
#
3729
# @return [Symbol, ContextDev::Models::BatchCancelResponse::Format]
3830
required :format_, enum: -> { ContextDev::Models::BatchCancelResponse::Format }, api_name: :format
@@ -44,33 +36,26 @@ class BatchCancelResponse < ContextDev::Internal::Type::BaseModel
4436
required :input, -> { ContextDev::Intake }
4537

4638
# @!attribute mode
47-
# How pages were selected. Matches `input.mode` on the submit request.
39+
# How pages were selected.
4840
#
4941
# @return [Symbol, ContextDev::Models::BatchCancelResponse::Mode]
5042
required :mode, enum: -> { ContextDev::Models::BatchCancelResponse::Mode }
5143

5244
# @!attribute page_errors
53-
# Individual page failures grouped by error code, sorted by count. Unrelated to
54-
# `failure`, which is the batch itself failing.
45+
# Page failures so far, grouped by error code and sorted by count.
5546
#
5647
# @return [Array<ContextDev::Models::PageErrorCount>]
5748
required :page_errors, -> { ContextDev::Internal::Type::ArrayOf[ContextDev::PageErrorCount] }
5849

5950
# @!attribute progress
60-
# Pages attempted so far. Use `status` to check completion.
51+
# How far the batch got before cancellation.
6152
#
6253
# @return [ContextDev::Models::BatchCancelResponse::Progress]
6354
required :progress, -> { ContextDev::Models::BatchCancelResponse::Progress }
6455

65-
# @!attribute results
66-
# Download links, available once the batch reaches a final status and null before
67-
# then. GET /batch/{batch_id}/results serves the same records as paginated JSON.
68-
#
69-
# @return [ContextDev::Models::BatchCancelResponse::Results, nil]
70-
required :results, -> { ContextDev::Models::BatchCancelResponse::Results }, nil?: true
71-
7256
# @!attribute status
73-
# Current state. `completed`, `cancelled`, and `failed` are final.
57+
# Always `cancelling`. Work already in flight finishes; the batch reaches
58+
# `cancelled` shortly after.
7459
#
7560
# @return [Symbol, ContextDev::Models::BatchCancelResponse::Status]
7661
required :status, enum: -> { ContextDev::Models::BatchCancelResponse::Status }
@@ -82,6 +67,7 @@ class BatchCancelResponse < ContextDev::Internal::Type::BaseModel
8267
required :tags, ContextDev::Internal::Type::ArrayOf[String]
8368

8469
# @!attribute timing
70+
# There is no finish time yet — the batch is still winding down.
8571
#
8672
# @return [ContextDev::Models::BatchCancelResponse::Timing]
8773
required :timing, -> { ContextDev::Models::BatchCancelResponse::Timing }
@@ -92,77 +78,53 @@ class BatchCancelResponse < ContextDev::Internal::Type::BaseModel
9278
# @return [ContextDev::Models::BatchCancelResponse::KeyMetadata, nil]
9379
optional :key_metadata, -> { ContextDev::Models::BatchCancelResponse::KeyMetadata }
9480

95-
# @!method initialize(id:, crawl:, credits:, failure:, format_:, input:, mode:, page_errors:, progress:, results:, status:, tags:, timing:, key_metadata: nil)
81+
# @!method initialize(id:, crawl:, credits:, format_:, input:, mode:, page_errors:, progress:, status:, tags:, timing:, key_metadata: nil)
9682
# Some parameter documentations has been truncated, see
9783
# {ContextDev::Models::BatchCancelResponse} for more details.
9884
#
99-
# @param id [String] Batch ID used to retrieve or cancel the job.
85+
# @param id [String] Batch ID.
10086
#
10187
# @param crawl [ContextDev::Models::CrawlControls, nil] The crawl controls as submitted, so the limits requested can be compared against
10288
#
103-
# @param credits [ContextDev::Models::BatchCancelResponse::Credits] What this batch has done to your credit balance.
89+
# @param credits [ContextDev::Models::BatchCancelResponse::Credits] What this batch cost so far.
10490
#
105-
# @param failure [ContextDev::Models::Failure, nil] A failure of the batch as a whole, distinct from the per-page failures in
106-
# `page\_
107-
#
108-
# @param format_ [Symbol, ContextDev::Models::BatchCancelResponse::Format] What each page is returned as. Matches `input.data.format` on the submit request
91+
# @param format_ [Symbol, ContextDev::Models::BatchCancelResponse::Format] What each page is returned as.
10992
#
11093
# @param input [ContextDev::Models::Intake] What submission took in, and what it charged for.
11194
#
112-
# @param mode [Symbol, ContextDev::Models::BatchCancelResponse::Mode] How pages were selected. Matches `input.mode` on the submit request.
113-
#
114-
# @param page_errors [Array<ContextDev::Models::PageErrorCount>] Individual page failures grouped by error code, sorted by count. Unrelated to `f
95+
# @param mode [Symbol, ContextDev::Models::BatchCancelResponse::Mode] How pages were selected.
11596
#
116-
# @param progress [ContextDev::Models::BatchCancelResponse::Progress] Pages attempted so far. Use `status` to check completion.
97+
# @param page_errors [Array<ContextDev::Models::PageErrorCount>] Page failures so far, grouped by error code and sorted by count.
11798
#
118-
# @param results [ContextDev::Models::BatchCancelResponse::Results, nil] Download links, available once the batch reaches a final status and null before
99+
# @param progress [ContextDev::Models::BatchCancelResponse::Progress] How far the batch got before cancellation.
119100
#
120-
# @param status [Symbol, ContextDev::Models::BatchCancelResponse::Status] Current state. `completed`, `cancelled`, and `failed` are final.
101+
# @param status [Symbol, ContextDev::Models::BatchCancelResponse::Status] Always `cancelling`. Work already in flight finishes; the batch reaches `cancell
121102
#
122103
# @param tags [Array<String>] Tags stored on the batch at submission.
123104
#
124-
# @param timing [ContextDev::Models::BatchCancelResponse::Timing]
105+
# @param timing [ContextDev::Models::BatchCancelResponse::Timing] There is no finish time yet — the batch is still winding down.
125106
#
126107
# @param key_metadata [ContextDev::Models::BatchCancelResponse::KeyMetadata] API key usage for this request.
127108

128109
# @see ContextDev::Models::BatchCancelResponse#credits
129110
class Credits < ContextDev::Internal::Type::BaseModel
130-
# @!attribute net
131-
# `reserved` minus `refunded` — what the batch has cost so far. Equal to
132-
# `reserved` until the batch settles.
133-
#
134-
# @return [Integer]
135-
required :net, Integer
136-
137-
# @!attribute refunded
138-
# Credits returned for pages that did not succeed. Stays 0 until the batch reaches
139-
# a final status, then settles in one movement.
140-
#
141-
# @return [Integer]
142-
required :refunded, Integer
143-
144111
# @!attribute reserved
145-
# Credits debited from your balance the moment the batch was accepted. This is a
146-
# charge, not a forecast — the whole amount leaves the balance up front.
112+
# Credits debited at submission. The unspent remainder is refunded once the batch
113+
# settles — read `credits.refunded` from GET /batch/{batch_id} then.
147114
#
148115
# @return [Integer]
149116
required :reserved, Integer
150117

151-
# @!method initialize(net:, refunded:, reserved:)
118+
# @!method initialize(reserved:)
152119
# Some parameter documentations has been truncated, see
153120
# {ContextDev::Models::BatchCancelResponse::Credits} for more details.
154121
#
155-
# What this batch has done to your credit balance.
156-
#
157-
# @param net [Integer] `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved
158-
#
159-
# @param refunded [Integer] Credits returned for pages that did not succeed. Stays 0 until the batch reaches
122+
# What this batch cost so far.
160123
#
161-
# @param reserved [Integer] Credits debited from your balance the moment the batch was accepted. This is a c
124+
# @param reserved [Integer] Credits debited at submission. The unspent remainder is refunded once the batch
162125
end
163126

164-
# What each page is returned as. Matches `input.data.format` on the submit
165-
# request.
127+
# What each page is returned as.
166128
#
167129
# @see ContextDev::Models::BatchCancelResponse#format_
168130
module Format
@@ -175,7 +137,7 @@ module Format
175137
# @return [Array<Symbol>]
176138
end
177139

178-
# How pages were selected. Matches `input.mode` on the submit request.
140+
# How pages were selected.
179141
#
180142
# @see ContextDev::Models::BatchCancelResponse#mode
181143
module Mode
@@ -191,132 +153,66 @@ module Mode
191153
# @see ContextDev::Models::BatchCancelResponse#progress
192154
class Progress < ContextDev::Internal::Type::BaseModel
193155
# @!attribute failed
194-
# Pages that could not be scraped.
156+
# Pages that could not be scraped before the request landed.
195157
#
196158
# @return [Integer]
197159
required :failed, Integer
198160

199161
# @!attribute pending
200-
# Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it
201-
# never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once
202-
# final, because its unspent budget was never real pages.
162+
# Reserved pages that will now be skipped, and refunded when the batch settles.
203163
#
204164
# @return [Integer]
205165
required :pending, Integer
206166

207167
# @!attribute succeeded
208-
# Pages scraped successfully.
168+
# Pages scraped successfully before the request landed.
209169
#
210170
# @return [Integer]
211171
required :succeeded, Integer
212172

213173
# @!method initialize(failed:, pending:, succeeded:)
214-
# Some parameter documentations has been truncated, see
215-
# {ContextDev::Models::BatchCancelResponse::Progress} for more details.
216-
#
217-
# Pages attempted so far. Use `status` to check completion.
218-
#
219-
# @param failed [Integer] Pages that could not be scraped.
220-
#
221-
# @param pending [Integer] Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it
222-
#
223-
# @param succeeded [Integer] Pages scraped successfully.
224-
end
225-
226-
# @see ContextDev::Models::BatchCancelResponse#results
227-
class Results < ContextDev::Internal::Type::BaseModel
228-
# @!attribute expires_at
229-
# When the download URLs expire.
174+
# How far the batch got before cancellation.
230175
#
231-
# @return [String]
232-
required :expires_at, String
233-
234-
# @!attribute files
235-
# Result files. Order is not guaranteed.
236-
#
237-
# @return [Array<ContextDev::Models::BatchCancelResponse::Results::File>]
238-
required :files,
239-
-> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchCancelResponse::Results::File] }
240-
241-
# @!method initialize(expires_at:, files:)
242-
# Download links, available once the batch reaches a final status and null before
243-
# then. GET /batch/{batch_id}/results serves the same records as paginated JSON.
176+
# @param failed [Integer] Pages that could not be scraped before the request landed.
244177
#
245-
# @param expires_at [String] When the download URLs expire.
178+
# @param pending [Integer] Reserved pages that will now be skipped, and refunded when the batch settles.
246179
#
247-
# @param files [Array<ContextDev::Models::BatchCancelResponse::Results::File>] Result files. Order is not guaranteed.
248-
249-
class File < ContextDev::Internal::Type::BaseModel
250-
# @!attribute bytes
251-
# Compressed file size in bytes.
252-
#
253-
# @return [Integer]
254-
required :bytes, Integer
255-
256-
# @!attribute items
257-
# Results in this file.
258-
#
259-
# @return [Integer]
260-
required :items, Integer
261-
262-
# @!attribute url
263-
# Temporary URL for a gzipped NDJSON file.
264-
#
265-
# @return [String]
266-
required :url, String
267-
268-
# @!method initialize(bytes:, items:, url:)
269-
# @param bytes [Integer] Compressed file size in bytes.
270-
#
271-
# @param items [Integer] Results in this file.
272-
#
273-
# @param url [String] Temporary URL for a gzipped NDJSON file.
274-
end
180+
# @param succeeded [Integer] Pages scraped successfully before the request landed.
275181
end
276182

277-
# Current state. `completed`, `cancelled`, and `failed` are final.
183+
# Always `cancelling`. Work already in flight finishes; the batch reaches
184+
# `cancelled` shortly after.
278185
#
279186
# @see ContextDev::Models::BatchCancelResponse#status
280187
module Status
281188
extend ContextDev::Internal::Type::Enum
282189

283-
QUEUED = :queued
284-
RUNNING = :running
285190
CANCELLING = :cancelling
286-
COMPLETED = :completed
287-
CANCELLED = :cancelled
288-
FAILED = :failed
289191

290192
# @!method self.values
291193
# @return [Array<Symbol>]
292194
end
293195

294196
# @see ContextDev::Models::BatchCancelResponse#timing
295197
class Timing < ContextDev::Internal::Type::BaseModel
296-
# @!attribute completed_at
297-
# When processing finished. Null while active.
298-
#
299-
# @return [String, nil]
300-
required :completed_at, String, nil?: true
301-
302198
# @!attribute created_at
303199
# When the batch was created.
304200
#
305201
# @return [String]
306202
required :created_at, String
307203

308204
# @!attribute started_at
309-
# When processing started. Null while queued.
205+
# When processing started. Null if it was cancelled while still queued.
310206
#
311207
# @return [String, nil]
312208
required :started_at, String, nil?: true
313209

314-
# @!method initialize(completed_at:, created_at:, started_at:)
315-
# @param completed_at [String, nil] When processing finished. Null while active.
210+
# @!method initialize(created_at:, started_at:)
211+
# There is no finish time yet — the batch is still winding down.
316212
#
317213
# @param created_at [String] When the batch was created.
318214
#
319-
# @param started_at [String, nil] When processing started. Null while queued.
215+
# @param started_at [String, nil] When processing started. Null if it was cancelled while still queued.
320216
end
321217

322218
# @see ContextDev::Models::BatchCancelResponse#key_metadata

0 commit comments

Comments
 (0)