Class: ContextDev::Models::BatchListResponse::Data

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/context_dev/models/batch_list_response.rb,
sig/context_dev/models/batch_list_response.rbs

Defined Under Namespace

Modules: Format, Mode, Status Classes: Credits, Progress, Results, Timing

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(bytes:, items:, url:) ⇒ Object

Parameters:

  • bytes (Integer)

    Compressed file size in bytes.

  • items (Integer)

    Results in this file.

  • url (String)

    Temporary URL for a gzipped NDJSON file.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/context_dev/models/batch_list_response.rb', line 44

class Data < ContextDev::Internal::Type::BaseModel
  # @!attribute id
  #   Batch ID used to retrieve or cancel the job.
  #
  #   @return [String]
  required :id, String

  # @!attribute crawl
  #   The crawl controls as submitted, so the limits requested can be compared against
  #   what the crawl reached.
  #
  #   @return [ContextDev::Models::CrawlControls, nil]
  required :crawl, -> { ContextDev::CrawlControls }, nil?: true

  # @!attribute credits
  #   What this batch has done to your credit balance.
  #
  #   @return [ContextDev::Models::BatchListResponse::Data::Credits]
  required :credits, -> { ContextDev::Models::BatchListResponse::Data::Credits }

  # @!attribute failure
  #   A failure of the batch as a whole, distinct from the per-page failures in
  #   `page_errors`.
  #
  #   @return [ContextDev::Models::Failure, nil]
  required :failure, -> { ContextDev::Failure }, nil?: true

  # @!attribute format_
  #   What each page is returned as. Matches `input.data.format` on the submit
  #   request.
  #
  #   @return [Symbol, ContextDev::Models::BatchListResponse::Data::Format]
  required :format_, enum: -> { ContextDev::Models::BatchListResponse::Data::Format }, api_name: :format

  # @!attribute input
  #   What submission took in, and what it charged for.
  #
  #   @return [ContextDev::Models::Intake]
  required :input, -> { ContextDev::Intake }

  # @!attribute mode
  #   How pages were selected. Matches `input.mode` on the submit request.
  #
  #   @return [Symbol, ContextDev::Models::BatchListResponse::Data::Mode]
  required :mode, enum: -> { ContextDev::Models::BatchListResponse::Data::Mode }

  # @!attribute page_errors
  #   Individual page failures grouped by error code, sorted by count. Unrelated to
  #   `failure`, which is the batch itself failing.
  #
  #   @return [Array<ContextDev::Models::PageErrorCount>]
  required :page_errors, -> { ContextDev::Internal::Type::ArrayOf[ContextDev::PageErrorCount] }

  # @!attribute progress
  #   Pages attempted so far. Use `status` to check completion.
  #
  #   @return [ContextDev::Models::BatchListResponse::Data::Progress]
  required :progress, -> { ContextDev::Models::BatchListResponse::Data::Progress }

  # @!attribute results
  #   Download links, available once the batch reaches a final status and null before
  #   then. GET /batch/{batch_id}/results serves the same records as paginated JSON.
  #
  #   @return [ContextDev::Models::BatchListResponse::Data::Results, nil]
  required :results, -> { ContextDev::Models::BatchListResponse::Data::Results }, nil?: true

  # @!attribute status
  #   Current state. `completed`, `cancelled`, and `failed` are final.
  #
  #   @return [Symbol, ContextDev::Models::BatchListResponse::Data::Status]
  required :status, enum: -> { ContextDev::Models::BatchListResponse::Data::Status }

  # @!attribute tags
  #   Tags stored on the batch at submission.
  #
  #   @return [Array<String>]
  required :tags, ContextDev::Internal::Type::ArrayOf[String]

  # @!attribute timing
  #
  #   @return [ContextDev::Models::BatchListResponse::Data::Timing]
  required :timing, -> { ContextDev::Models::BatchListResponse::Data::Timing }

  # @!method initialize(id:, crawl:, credits:, failure:, format_:, input:, mode:, page_errors:, progress:, results:, status:, tags:, timing:)
  #   Some parameter documentations has been truncated, see
  #   {ContextDev::Models::BatchListResponse::Data} for more details.
  #
  #   An asynchronous web scraping job.
  #
  #   @param id [String] Batch ID used to retrieve or cancel the job.
  #
  #   @param crawl [ContextDev::Models::CrawlControls, nil] The crawl controls as submitted, so the limits requested can be compared against
  #
  #   @param credits [ContextDev::Models::BatchListResponse::Data::Credits] What this batch has done to your credit balance.
  #
  #   @param failure [ContextDev::Models::Failure, nil] A failure of the batch as a whole, distinct from the per-page failures in
  #   `page\_
  #
  #   @param format_ [Symbol, ContextDev::Models::BatchListResponse::Data::Format] What each page is returned as. Matches `input.data.format` on the submit request
  #
  #   @param input [ContextDev::Models::Intake] What submission took in, and what it charged for.
  #
  #   @param mode [Symbol, ContextDev::Models::BatchListResponse::Data::Mode] How pages were selected. Matches `input.mode` on the submit request.
  #
  #   @param page_errors [Array<ContextDev::Models::PageErrorCount>] Individual page failures grouped by error code, sorted by count. Unrelated to `f
  #
  #   @param progress [ContextDev::Models::BatchListResponse::Data::Progress] Pages attempted so far. Use `status` to check completion.
  #
  #   @param results [ContextDev::Models::BatchListResponse::Data::Results, nil] Download links, available once the batch reaches a final status and null before
  #
  #   @param status [Symbol, ContextDev::Models::BatchListResponse::Data::Status] Current state. `completed`, `cancelled`, and `failed` are final.
  #
  #   @param tags [Array<String>] Tags stored on the batch at submission.
  #
  #   @param timing [ContextDev::Models::BatchListResponse::Data::Timing]

  # @see ContextDev::Models::BatchListResponse::Data#credits
  class Credits < ContextDev::Internal::Type::BaseModel
    # @!attribute net
    #   `reserved` minus `refunded` — what the batch has cost so far. Equal to
    #   `reserved` until the batch settles.
    #
    #   @return [Integer]
    required :net, Integer

    # @!attribute refunded
    #   Credits returned for pages that did not succeed. Stays 0 until the batch reaches
    #   a final status, then settles in one movement.
    #
    #   @return [Integer]
    required :refunded, Integer

    # @!attribute reserved
    #   Credits debited from your balance the moment the batch was accepted. This is a
    #   charge, not a forecast — the whole amount leaves the balance up front.
    #
    #   @return [Integer]
    required :reserved, Integer

    # @!method initialize(net:, refunded:, reserved:)
    #   Some parameter documentations has been truncated, see
    #   {ContextDev::Models::BatchListResponse::Data::Credits} for more details.
    #
    #   What this batch has done to your credit balance.
    #
    #   @param net [Integer] `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved
    #
    #   @param refunded [Integer] Credits returned for pages that did not succeed. Stays 0 until the batch reaches
    #
    #   @param reserved [Integer] Credits debited from your balance the moment the batch was accepted. This is a c
  end

  # What each page is returned as. Matches `input.data.format` on the submit
  # request.
  #
  # @see ContextDev::Models::BatchListResponse::Data#format_
  module Format
    extend ContextDev::Internal::Type::Enum

    MARKDOWN = :markdown
    HTML = :html

    # @!method self.values
    #   @return [Array<Symbol>]
  end

  # How pages were selected. Matches `input.mode` on the submit request.
  #
  # @see ContextDev::Models::BatchListResponse::Data#mode
  module Mode
    extend ContextDev::Internal::Type::Enum

    SCRAPE = :scrape
    CRAWL = :crawl

    # @!method self.values
    #   @return [Array<Symbol>]
  end

  # @see ContextDev::Models::BatchListResponse::Data#progress
  class Progress < ContextDev::Internal::Type::BaseModel
    # @!attribute failed
    #   Pages that could not be scraped.
    #
    #   @return [Integer]
    required :failed, Integer

    # @!attribute pending
    #   Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it
    #   never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once
    #   final, because its unspent budget was never real pages.
    #
    #   @return [Integer]
    required :pending, Integer

    # @!attribute succeeded
    #   Pages scraped successfully.
    #
    #   @return [Integer]
    required :succeeded, Integer

    # @!method initialize(failed:, pending:, succeeded:)
    #   Some parameter documentations has been truncated, see
    #   {ContextDev::Models::BatchListResponse::Data::Progress} for more details.
    #
    #   Pages attempted so far. Use `status` to check completion.
    #
    #   @param failed [Integer] Pages that could not be scraped.
    #
    #   @param pending [Integer] Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it
    #
    #   @param succeeded [Integer] Pages scraped successfully.
  end

  # @see ContextDev::Models::BatchListResponse::Data#results
  class Results < ContextDev::Internal::Type::BaseModel
    # @!attribute expires_at
    #   When the download URLs expire.
    #
    #   @return [String]
    required :expires_at, String

    # @!attribute files
    #   Result files. Order is not guaranteed.
    #
    #   @return [Array<ContextDev::Models::BatchListResponse::Data::Results::File>]
    required :files,
             -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchListResponse::Data::Results::File] }

    # @!method initialize(expires_at:, files:)
    #   Download links, available once the batch reaches a final status and null before
    #   then. GET /batch/{batch_id}/results serves the same records as paginated JSON.
    #
    #   @param expires_at [String] When the download URLs expire.
    #
    #   @param files [Array<ContextDev::Models::BatchListResponse::Data::Results::File>] Result files. Order is not guaranteed.

    class File < ContextDev::Internal::Type::BaseModel
      # @!attribute bytes
      #   Compressed file size in bytes.
      #
      #   @return [Integer]
      required :bytes, Integer

      # @!attribute items
      #   Results in this file.
      #
      #   @return [Integer]
      required :items, Integer

      # @!attribute url
      #   Temporary URL for a gzipped NDJSON file.
      #
      #   @return [String]
      required :url, String

      # @!method initialize(bytes:, items:, url:)
      #   @param bytes [Integer] Compressed file size in bytes.
      #
      #   @param items [Integer] Results in this file.
      #
      #   @param url [String] Temporary URL for a gzipped NDJSON file.
    end
  end

  # Current state. `completed`, `cancelled`, and `failed` are final.
  #
  # @see ContextDev::Models::BatchListResponse::Data#status
  module Status
    extend ContextDev::Internal::Type::Enum

    QUEUED = :queued
    RUNNING = :running
    CANCELLING = :cancelling
    COMPLETED = :completed
    CANCELLED = :cancelled
    FAILED = :failed

    # @!method self.values
    #   @return [Array<Symbol>]
  end

  # @see ContextDev::Models::BatchListResponse::Data#timing
  class Timing < ContextDev::Internal::Type::BaseModel
    # @!attribute completed_at
    #   When processing finished. Null while active.
    #
    #   @return [String, nil]
    required :completed_at, String, nil?: true

    # @!attribute created_at
    #   When the batch was created.
    #
    #   @return [String]
    required :created_at, String

    # @!attribute started_at
    #   When processing started. Null while queued.
    #
    #   @return [String, nil]
    required :started_at, String, nil?: true

    # @!method initialize(completed_at:, created_at:, started_at:)
    #   @param completed_at [String, nil] When processing finished. Null while active.
    #
    #   @param created_at [String] When the batch was created.
    #
    #   @param started_at [String, nil] When processing started. Null while queued.
  end
end

Instance Attribute Details

#crawlContextDev::Models::CrawlControls?

The crawl controls as submitted, so the limits requested can be compared against what the crawl reached.

Parameters:

Returns:



56
# File 'lib/context_dev/models/batch_list_response.rb', line 56

required :crawl, -> { ContextDev::CrawlControls }, nil?: true

#creditsContextDev::Models::BatchListResponse::Data::Credits

What this batch has done to your credit balance.



62
# File 'lib/context_dev/models/batch_list_response.rb', line 62

required :credits, -> { ContextDev::Models::BatchListResponse::Data::Credits }

#failureContextDev::Models::Failure?

A failure of the batch as a whole, distinct from the per-page failures in page_errors.

Parameters:

Returns:



69
# File 'lib/context_dev/models/batch_list_response.rb', line 69

required :failure, -> { ContextDev::Failure }, nil?: true

#format_Symbol, ContextDev::Models::BatchListResponse::Data::Format

What each page is returned as. Matches input.data.format on the submit request.

Parameters:

  • value (ContextDev::Models::BatchListResponse::Data::format_)

Returns:



76
# File 'lib/context_dev/models/batch_list_response.rb', line 76

required :format_, enum: -> { ContextDev::Models::BatchListResponse::Data::Format }, api_name: :format

#idString

Batch ID used to retrieve or cancel the job.

Parameters:

  • value (String)

Returns:

  • (String)


49
# File 'lib/context_dev/models/batch_list_response.rb', line 49

required :id, String

#inputContextDev::Models::Intake

What submission took in, and what it charged for.

Parameters:

Returns:



82
# File 'lib/context_dev/models/batch_list_response.rb', line 82

required :input, -> { ContextDev::Intake }

#modeSymbol, ContextDev::Models::BatchListResponse::Data::Mode

How pages were selected. Matches input.mode on the submit request.

Parameters:

  • value (ContextDev::Models::BatchListResponse::Data::mode)

Returns:



88
# File 'lib/context_dev/models/batch_list_response.rb', line 88

required :mode, enum: -> { ContextDev::Models::BatchListResponse::Data::Mode }

#page_errorsArray<ContextDev::Models::PageErrorCount>

Individual page failures grouped by error code, sorted by count. Unrelated to failure, which is the batch itself failing.

Parameters:

Returns:



95
# File 'lib/context_dev/models/batch_list_response.rb', line 95

required :page_errors, -> { ContextDev::Internal::Type::ArrayOf[ContextDev::PageErrorCount] }

#progressContextDev::Models::BatchListResponse::Data::Progress

Pages attempted so far. Use status to check completion.



101
# File 'lib/context_dev/models/batch_list_response.rb', line 101

required :progress, -> { ContextDev::Models::BatchListResponse::Data::Progress }

#resultsContextDev::Models::BatchListResponse::Data::Results?

Download links, available once the batch reaches a final status and null before then. GET /batch/batch_id/results serves the same records as paginated JSON.



108
# File 'lib/context_dev/models/batch_list_response.rb', line 108

required :results, -> { ContextDev::Models::BatchListResponse::Data::Results }, nil?: true

#statusSymbol, ContextDev::Models::BatchListResponse::Data::Status

Current state. completed, cancelled, and failed are final.

Parameters:

  • value (ContextDev::Models::BatchListResponse::Data::status)

Returns:



114
# File 'lib/context_dev/models/batch_list_response.rb', line 114

required :status, enum: -> { ContextDev::Models::BatchListResponse::Data::Status }

#tagsArray<String>

Tags stored on the batch at submission.

Parameters:

  • value (::Array[String])

Returns:

  • (Array<String>)


120
# File 'lib/context_dev/models/batch_list_response.rb', line 120

required :tags, ContextDev::Internal::Type::ArrayOf[String]

#timingContextDev::Models::BatchListResponse::Data::Timing



125
# File 'lib/context_dev/models/batch_list_response.rb', line 125

required :timing, -> { ContextDev::Models::BatchListResponse::Data::Timing }

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/context_dev/models/batch_list_response.rb', line 206

Instance Method Details

#to_hash{

Returns:

  • ({)


104
# File 'sig/context_dev/models/batch_list_response.rbs', line 104

def to_hash: -> {