From 99bdfb24af9adfac64ee68ca714fb1176c1d61c0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 25 Jul 2026 07:13:06 +0000 Subject: [PATCH 01/11] feat(api): api update --- .stats.yml | 4 +- .../models/monitor_create_params.rb | 248 ++++----- .../models/monitor_create_response.rb | 16 +- lib/context_dev/resources/monitors.rb | 10 +- .../models/monitor_create_params.rbi | 493 +++++++++--------- .../models/monitor_create_response.rbi | 16 +- rbi/context_dev/resources/monitors.rbi | 24 +- .../models/monitor_create_params.rbs | 200 +++---- .../models/monitor_create_response.rbs | 5 + sig/context_dev/resources/monitors.rbs | 4 +- test/context_dev/resources/monitors_test.rb | 3 +- 11 files changed, 535 insertions(+), 488 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0ac1eb3a..6da46828 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-242450ea46eb8c3e843fd6c4bf87e73192b5f62f6da697cd091d13c6aa7a991b.yml -openapi_spec_hash: c1c561976de1abcacede71fd5ab9b3d9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2bf2b44f6593c44b2948683469bbb2b09cd8e90c97b12057fac6220cf0d2eee7.yml +openapi_spec_hash: ae8b5109ec997cac8d3e6ec96040f6c8 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 diff --git a/lib/context_dev/models/monitor_create_params.rb b/lib/context_dev/models/monitor_create_params.rb index 0f80b661..ee369bd4 100644 --- a/lib/context_dev/models/monitor_create_params.rb +++ b/lib/context_dev/models/monitor_create_params.rb @@ -7,31 +7,23 @@ class MonitorCreateParams < ContextDev::Internal::Type::BaseModel extend ContextDev::Internal::Type::RequestParameters::Converter include ContextDev::Internal::Type::RequestParameters - # @!attribute change_detection - # Discriminated union describing how changes are detected. - # - # @return [ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic] - required :change_detection, union: -> { ContextDev::MonitorCreateParams::ChangeDetection } - # @!attribute name # # @return [String] required :name, String - # @!attribute schedule - # Run the monitor on a fixed interval defined by a frequency and a unit, e.g. - # every 6 hours or every 2 days. The total interval (frequency × unit) must be - # between 10 minutes and 1 year. - # - # @return [ContextDev::Models::MonitorCreateParams::Schedule] - required :schedule, -> { ContextDev::MonitorCreateParams::Schedule } - # @!attribute target # Discriminated union describing what the monitor watches. # # @return [ContextDev::Models::MonitorCreateParams::Target::Page, ContextDev::Models::MonitorCreateParams::Target::Sitemap, ContextDev::Models::MonitorCreateParams::Target::Extract] required :target, union: -> { ContextDev::MonitorCreateParams::Target } + # @!attribute change_detection + # Discriminated union describing how changes are detected. + # + # @return [ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic, nil] + optional :change_detection, union: -> { ContextDev::MonitorCreateParams::ChangeDetection } + # @!attribute mode # Top-level monitor category. Always `web` today; the concrete behavior is # described by `target` and `change_detection`. @@ -39,6 +31,14 @@ class MonitorCreateParams < ContextDev::Internal::Type::BaseModel # @return [Symbol, ContextDev::Models::MonitorCreateParams::Mode, nil] optional :mode, enum: -> { ContextDev::MonitorCreateParams::Mode } + # @!attribute schedule + # Run the monitor on a fixed interval defined by a frequency and a unit, e.g. + # every 6 hours or every 2 days. The total interval (frequency × unit) must be + # between 10 minutes and 1 year. + # + # @return [ContextDev::Models::MonitorCreateParams::Schedule, nil] + optional :schedule, -> { ContextDev::MonitorCreateParams::Schedule } + # @!attribute tags # User-defined tags for grouping and filtering monitors and their changes. # Duplicates are removed. @@ -51,131 +51,26 @@ class MonitorCreateParams < ContextDev::Internal::Type::BaseModel # @return [ContextDev::Models::MonitorCreateParams::Webhook, nil] optional :webhook, -> { ContextDev::MonitorCreateParams::Webhook }, nil?: true - # @!method initialize(change_detection:, name:, schedule:, target:, mode: nil, tags: nil, webhook: nil, request_options: {}) + # @!method initialize(name:, target:, change_detection: nil, mode: nil, schedule: nil, tags: nil, webhook: nil, request_options: {}) # Some parameter documentations has been truncated, see # {ContextDev::Models::MonitorCreateParams} for more details. # - # @param change_detection [ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic] Discriminated union describing how changes are detected. - # # @param name [String] # - # @param schedule [ContextDev::Models::MonitorCreateParams::Schedule] Run the monitor on a fixed interval defined by a frequency and a unit, e.g. ever - # # @param target [ContextDev::Models::MonitorCreateParams::Target::Page, ContextDev::Models::MonitorCreateParams::Target::Sitemap, ContextDev::Models::MonitorCreateParams::Target::Extract] Discriminated union describing what the monitor watches. # + # @param change_detection [ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic] Discriminated union describing how changes are detected. + # # @param mode [Symbol, ContextDev::Models::MonitorCreateParams::Mode] Top-level monitor category. Always `web` today; the concrete behavior is describ # + # @param schedule [ContextDev::Models::MonitorCreateParams::Schedule] Run the monitor on a fixed interval defined by a frequency and a unit, e.g. ever + # # @param tags [Array] User-defined tags for grouping and filtering monitors and their changes. Duplica # # @param webhook [ContextDev::Models::MonitorCreateParams::Webhook, nil] # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] - # Discriminated union describing how changes are detected. - module ChangeDetection - extend ContextDev::Internal::Type::Union - - discriminator :type - - # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - variant :exact, -> { ContextDev::MonitorCreateParams::ChangeDetection::Exact } - - # Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). - variant :semantic, -> { ContextDev::MonitorCreateParams::ChangeDetection::Semantic } - - class Exact < ContextDev::Internal::Type::BaseModel - # @!attribute type - # - # @return [Symbol, :exact] - required :type, const: :exact - - # @!method initialize(type: :exact) - # Detect exact changes. For page targets, this means visible text diffs. For - # sitemap targets, this means URL additions and removals. - # - # @param type [Symbol, :exact] - end - - class Semantic < ContextDev::Internal::Type::BaseModel - # @!attribute type - # - # @return [Symbol, :semantic] - required :type, const: :semantic - - # @!attribute confidence_threshold - # - # @return [Float, nil] - optional :confidence_threshold, Float - - # @!method initialize(confidence_threshold: nil, type: :semantic) - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). - # - # @param confidence_threshold [Float] - # @param type [Symbol, :semantic] - end - - # @!method self.variants - # @return [Array(ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic)] - end - - class Schedule < ContextDev::Internal::Type::BaseModel - # @!attribute frequency - # Number of units between runs. The resulting interval (frequency × unit) must be - # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; - # maximum 365 when unit is days). - # - # @return [Integer] - required :frequency, Integer - - # @!attribute type - # - # @return [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Type] - required :type, enum: -> { ContextDev::MonitorCreateParams::Schedule::Type } - - # @!attribute unit - # - # @return [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Unit] - required :unit, enum: -> { ContextDev::MonitorCreateParams::Schedule::Unit } - - # @!method initialize(frequency:, type:, unit:) - # Some parameter documentations has been truncated, see - # {ContextDev::Models::MonitorCreateParams::Schedule} for more details. - # - # Run the monitor on a fixed interval defined by a frequency and a unit, e.g. - # every 6 hours or every 2 days. The total interval (frequency × unit) must be - # between 10 minutes and 1 year. - # - # @param frequency [Integer] Number of units between runs. The resulting interval (frequency × unit) must be - # - # @param type [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Type] - # - # @param unit [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Unit] - - # @see ContextDev::Models::MonitorCreateParams::Schedule#type - module Type - extend ContextDev::Internal::Type::Enum - - INTERVAL = :interval - - # @!method self.values - # @return [Array] - end - - # @see ContextDev::Models::MonitorCreateParams::Schedule#unit - module Unit - extend ContextDev::Internal::Type::Enum - - MINUTES = :minutes - HOURS = :hours - DAYS = :days - - # @!method self.values - # @return [Array] - end - end - # Discriminated union describing what the monitor watches. module Target extend ContextDev::Internal::Type::Union @@ -344,6 +239,55 @@ class Extract < ContextDev::Internal::Type::BaseModel # @return [Array(ContextDev::Models::MonitorCreateParams::Target::Page, ContextDev::Models::MonitorCreateParams::Target::Sitemap, ContextDev::Models::MonitorCreateParams::Target::Extract)] end + # Discriminated union describing how changes are detected. + module ChangeDetection + extend ContextDev::Internal::Type::Union + + discriminator :type + + # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + variant :exact, -> { ContextDev::MonitorCreateParams::ChangeDetection::Exact } + + # Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). + variant :semantic, -> { ContextDev::MonitorCreateParams::ChangeDetection::Semantic } + + class Exact < ContextDev::Internal::Type::BaseModel + # @!attribute type + # + # @return [Symbol, :exact] + required :type, const: :exact + + # @!method initialize(type: :exact) + # Detect exact changes. For page targets, this means visible text diffs. For + # sitemap targets, this means URL additions and removals. + # + # @param type [Symbol, :exact] + end + + class Semantic < ContextDev::Internal::Type::BaseModel + # @!attribute type + # + # @return [Symbol, :semantic] + required :type, const: :semantic + + # @!attribute confidence_threshold + # + # @return [Float, nil] + optional :confidence_threshold, Float + + # @!method initialize(confidence_threshold: nil, type: :semantic) + # Detect meaning-level changes to tracked page content, ignoring cosmetic or + # paraphrase-only differences. Which changes are meaningful is judged against the + # extract target's `instructions` (and `schema`, when provided). + # + # @param confidence_threshold [Float] + # @param type [Symbol, :semantic] + end + + # @!method self.variants + # @return [Array(ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic)] + end + # Top-level monitor category. Always `web` today; the concrete behavior is # described by `target` and `change_detection`. module Mode @@ -355,6 +299,62 @@ module Mode # @return [Array] end + class Schedule < ContextDev::Internal::Type::BaseModel + # @!attribute frequency + # Number of units between runs. The resulting interval (frequency × unit) must be + # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; + # maximum 365 when unit is days). + # + # @return [Integer] + required :frequency, Integer + + # @!attribute type + # + # @return [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Type] + required :type, enum: -> { ContextDev::MonitorCreateParams::Schedule::Type } + + # @!attribute unit + # + # @return [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Unit] + required :unit, enum: -> { ContextDev::MonitorCreateParams::Schedule::Unit } + + # @!method initialize(frequency:, type:, unit:) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::MonitorCreateParams::Schedule} for more details. + # + # Run the monitor on a fixed interval defined by a frequency and a unit, e.g. + # every 6 hours or every 2 days. The total interval (frequency × unit) must be + # between 10 minutes and 1 year. + # + # @param frequency [Integer] Number of units between runs. The resulting interval (frequency × unit) must be + # + # @param type [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Type] + # + # @param unit [Symbol, ContextDev::Models::MonitorCreateParams::Schedule::Unit] + + # @see ContextDev::Models::MonitorCreateParams::Schedule#type + module Type + extend ContextDev::Internal::Type::Enum + + INTERVAL = :interval + + # @!method self.values + # @return [Array] + end + + # @see ContextDev::Models::MonitorCreateParams::Schedule#unit + module Unit + extend ContextDev::Internal::Type::Enum + + MINUTES = :minutes + HOURS = :hours + DAYS = :days + + # @!method self.values + # @return [Array] + end + end + class Webhook < ContextDev::Internal::Type::BaseModel # @!attribute url # Webhook URL events are delivered to. diff --git a/lib/context_dev/models/monitor_create_response.rb b/lib/context_dev/models/monitor_create_response.rb index 168c3a02..94a7f763 100644 --- a/lib/context_dev/models/monitor_create_response.rb +++ b/lib/context_dev/models/monitor_create_response.rb @@ -20,6 +20,14 @@ class MonitorCreateResponse < ContextDev::Internal::Type::BaseModel # @return [Time] required :created_at, Time + # @!attribute initial_run_id + # The baseline run queued by this create call, or null if it could not be queued + # immediately (in which case the baseline runs on the next scheduled tick). Poll + # GET /monitors/{monitor_id}/runs/{run_id}. + # + # @return [String, nil] + required :initial_run_id, String, nil?: true + # @!attribute mode # Top-level monitor category. Always `web` today; the concrete behavior is # described by `target` and `change_detection`. @@ -112,12 +120,12 @@ class MonitorCreateResponse < ContextDev::Internal::Type::BaseModel # @return [ContextDev::Models::MonitorCreateResponse::WebhookFailure, nil] optional :webhook_failure, -> { ContextDev::Models::MonitorCreateResponse::WebhookFailure }, nil?: true - # @!method initialize(id:, change_detection:, created_at:, mode:, name:, schedule:, status:, target:, updated_at:, baseline: nil, last_change_at: nil, last_error: nil, last_run_at: nil, next_run_at: nil, tags: nil, webhook: nil, webhook_failure: nil) + # @!method initialize(id:, change_detection:, created_at:, initial_run_id:, mode:, name:, schedule:, status:, target:, updated_at:, baseline: nil, last_change_at: nil, last_error: nil, last_run_at: nil, next_run_at: nil, tags: nil, webhook: nil, webhook_failure: nil) # Some parameter documentations has been truncated, see # {ContextDev::Models::MonitorCreateResponse} for more details. # - # A web monitor. `mode` is the constant `web`; behavior is described by `target` - # (page/sitemap/extract) and `change_detection` (exact/semantic). + # A newly created monitor plus `initial_run_id`, the id of the baseline run queued + # at creation. # # @param id [String] # @@ -125,6 +133,8 @@ class MonitorCreateResponse < ContextDev::Internal::Type::BaseModel # # @param created_at [Time] # + # @param initial_run_id [String, nil] The baseline run queued by this create call, or null if it could not be queued i + # # @param mode [Symbol, ContextDev::Models::MonitorCreateResponse::Mode] Top-level monitor category. Always `web` today; the concrete behavior is describ # # @param name [String] diff --git a/lib/context_dev/resources/monitors.rb b/lib/context_dev/resources/monitors.rb index 5f860309..9ae9bb55 100644 --- a/lib/context_dev/resources/monitors.rb +++ b/lib/context_dev/resources/monitors.rb @@ -14,18 +14,18 @@ class Monitors # detection combinations. The monitor runs immediately after creation to create # its initial baseline. # - # @overload create(change_detection:, name:, schedule:, target:, mode: nil, tags: nil, webhook: nil, request_options: {}) - # - # @param change_detection [ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic] Discriminated union describing how changes are detected. + # @overload create(name:, target:, change_detection: nil, mode: nil, schedule: nil, tags: nil, webhook: nil, request_options: {}) # # @param name [String] # - # @param schedule [ContextDev::Models::MonitorCreateParams::Schedule] Run the monitor on a fixed interval defined by a frequency and a unit, e.g. ever - # # @param target [ContextDev::Models::MonitorCreateParams::Target::Page, ContextDev::Models::MonitorCreateParams::Target::Sitemap, ContextDev::Models::MonitorCreateParams::Target::Extract] Discriminated union describing what the monitor watches. # + # @param change_detection [ContextDev::Models::MonitorCreateParams::ChangeDetection::Exact, ContextDev::Models::MonitorCreateParams::ChangeDetection::Semantic] Discriminated union describing how changes are detected. + # # @param mode [Symbol, ContextDev::Models::MonitorCreateParams::Mode] Top-level monitor category. Always `web` today; the concrete behavior is describ # + # @param schedule [ContextDev::Models::MonitorCreateParams::Schedule] Run the monitor on a fixed interval defined by a frequency and a unit, e.g. ever + # # @param tags [Array] User-defined tags for grouping and filtering monitors and their changes. Duplica # # @param webhook [ContextDev::Models::MonitorCreateParams::Webhook, nil] diff --git a/rbi/context_dev/models/monitor_create_params.rbi b/rbi/context_dev/models/monitor_create_params.rbi index 04e76352..78ee5ee1 100644 --- a/rbi/context_dev/models/monitor_create_params.rbi +++ b/rbi/context_dev/models/monitor_create_params.rbi @@ -11,31 +11,9 @@ module ContextDev T.any(ContextDev::MonitorCreateParams, ContextDev::Internal::AnyHash) end - # Discriminated union describing how changes are detected. - sig do - returns( - T.any( - ContextDev::MonitorCreateParams::ChangeDetection::Exact, - ContextDev::MonitorCreateParams::ChangeDetection::Semantic - ) - ) - end - attr_accessor :change_detection - sig { returns(String) } attr_accessor :name - # Run the monitor on a fixed interval defined by a frequency and a unit, e.g. - # every 6 hours or every 2 days. The total interval (frequency × unit) must be - # between 10 minutes and 1 year. - sig { returns(ContextDev::MonitorCreateParams::Schedule) } - attr_reader :schedule - - sig do - params(schedule: ContextDev::MonitorCreateParams::Schedule::OrHash).void - end - attr_writer :schedule - # Discriminated union describing what the monitor watches. sig do returns( @@ -48,6 +26,30 @@ module ContextDev end attr_accessor :target + # Discriminated union describing how changes are detected. + sig do + returns( + T.nilable( + T.any( + ContextDev::MonitorCreateParams::ChangeDetection::Exact, + ContextDev::MonitorCreateParams::ChangeDetection::Semantic + ) + ) + ) + end + attr_reader :change_detection + + sig do + params( + change_detection: + T.any( + ContextDev::MonitorCreateParams::ChangeDetection::Exact::OrHash, + ContextDev::MonitorCreateParams::ChangeDetection::Semantic::OrHash + ) + ).void + end + attr_writer :change_detection + # Top-level monitor category. Always `web` today; the concrete behavior is # described by `target` and `change_detection`. sig do @@ -58,6 +60,17 @@ module ContextDev sig { params(mode: ContextDev::MonitorCreateParams::Mode::OrSymbol).void } attr_writer :mode + # Run the monitor on a fixed interval defined by a frequency and a unit, e.g. + # every 6 hours or every 2 days. The total interval (frequency × unit) must be + # between 10 minutes and 1 year. + sig { returns(T.nilable(ContextDev::MonitorCreateParams::Schedule)) } + attr_reader :schedule + + sig do + params(schedule: ContextDev::MonitorCreateParams::Schedule::OrHash).void + end + attr_writer :schedule + # User-defined tags for grouping and filtering monitors and their changes. # Duplicates are removed. sig { returns(T.nilable(T::Array[String])) } @@ -78,38 +91,38 @@ module ContextDev sig do params( - change_detection: - T.any( - ContextDev::MonitorCreateParams::ChangeDetection::Exact::OrHash, - ContextDev::MonitorCreateParams::ChangeDetection::Semantic::OrHash - ), name: String, - schedule: ContextDev::MonitorCreateParams::Schedule::OrHash, target: T.any( ContextDev::MonitorCreateParams::Target::Page::OrHash, ContextDev::MonitorCreateParams::Target::Sitemap::OrHash, ContextDev::MonitorCreateParams::Target::Extract::OrHash ), + change_detection: + T.any( + ContextDev::MonitorCreateParams::ChangeDetection::Exact::OrHash, + ContextDev::MonitorCreateParams::ChangeDetection::Semantic::OrHash + ), mode: ContextDev::MonitorCreateParams::Mode::OrSymbol, + schedule: ContextDev::MonitorCreateParams::Schedule::OrHash, tags: T::Array[String], webhook: T.nilable(ContextDev::MonitorCreateParams::Webhook::OrHash), request_options: ContextDev::RequestOptions::OrHash ).returns(T.attached_class) end def self.new( - # Discriminated union describing how changes are detected. - change_detection:, name:, - # Run the monitor on a fixed interval defined by a frequency and a unit, e.g. - # every 6 hours or every 2 days. The total interval (frequency × unit) must be - # between 10 minutes and 1 year. - schedule:, # Discriminated union describing what the monitor watches. target:, + # Discriminated union describing how changes are detected. + change_detection: nil, # Top-level monitor category. Always `web` today; the concrete behavior is # described by `target` and `change_detection`. mode: nil, + # Run the monitor on a fixed interval defined by a frequency and a unit, e.g. + # every 6 hours or every 2 days. The total interval (frequency × unit) must be + # between 10 minutes and 1 year. + schedule: nil, # User-defined tags for grouping and filtering monitors and their changes. # Duplicates are removed. tags: nil, @@ -121,20 +134,20 @@ module ContextDev sig do override.returns( { - change_detection: - T.any( - ContextDev::MonitorCreateParams::ChangeDetection::Exact, - ContextDev::MonitorCreateParams::ChangeDetection::Semantic - ), name: String, - schedule: ContextDev::MonitorCreateParams::Schedule, target: T.any( ContextDev::MonitorCreateParams::Target::Page, ContextDev::MonitorCreateParams::Target::Sitemap, ContextDev::MonitorCreateParams::Target::Extract ), + change_detection: + T.any( + ContextDev::MonitorCreateParams::ChangeDetection::Exact, + ContextDev::MonitorCreateParams::ChangeDetection::Semantic + ), mode: ContextDev::MonitorCreateParams::Mode::OrSymbol, + schedule: ContextDev::MonitorCreateParams::Schedule, tags: T::Array[String], webhook: T.nilable(ContextDev::MonitorCreateParams::Webhook), request_options: ContextDev::RequestOptions @@ -144,206 +157,6 @@ module ContextDev def to_hash end - # Discriminated union describing how changes are detected. - module ChangeDetection - extend ContextDev::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - ContextDev::MonitorCreateParams::ChangeDetection::Exact, - ContextDev::MonitorCreateParams::ChangeDetection::Semantic - ) - end - - class Exact < ContextDev::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - ContextDev::MonitorCreateParams::ChangeDetection::Exact, - ContextDev::Internal::AnyHash - ) - end - - sig { returns(Symbol) } - attr_accessor :type - - # Detect exact changes. For page targets, this means visible text diffs. For - # sitemap targets, this means URL additions and removals. - sig { params(type: Symbol).returns(T.attached_class) } - def self.new(type: :exact) - end - - sig { override.returns({ type: Symbol }) } - def to_hash - end - end - - class Semantic < ContextDev::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - ContextDev::MonitorCreateParams::ChangeDetection::Semantic, - ContextDev::Internal::AnyHash - ) - end - - sig { returns(Symbol) } - attr_accessor :type - - sig { returns(T.nilable(Float)) } - attr_reader :confidence_threshold - - sig { params(confidence_threshold: Float).void } - attr_writer :confidence_threshold - - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). - sig do - params(confidence_threshold: Float, type: Symbol).returns( - T.attached_class - ) - end - def self.new(confidence_threshold: nil, type: :semantic) - end - - sig do - override.returns({ type: Symbol, confidence_threshold: Float }) - end - def to_hash - end - end - - sig do - override.returns( - T::Array[ContextDev::MonitorCreateParams::ChangeDetection::Variants] - ) - end - def self.variants - end - end - - class Schedule < ContextDev::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - ContextDev::MonitorCreateParams::Schedule, - ContextDev::Internal::AnyHash - ) - end - - # Number of units between runs. The resulting interval (frequency × unit) must be - # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; - # maximum 365 when unit is days). - sig { returns(Integer) } - attr_accessor :frequency - - sig do - returns(ContextDev::MonitorCreateParams::Schedule::Type::OrSymbol) - end - attr_accessor :type - - sig do - returns(ContextDev::MonitorCreateParams::Schedule::Unit::OrSymbol) - end - attr_accessor :unit - - # Run the monitor on a fixed interval defined by a frequency and a unit, e.g. - # every 6 hours or every 2 days. The total interval (frequency × unit) must be - # between 10 minutes and 1 year. - sig do - params( - frequency: Integer, - type: ContextDev::MonitorCreateParams::Schedule::Type::OrSymbol, - unit: ContextDev::MonitorCreateParams::Schedule::Unit::OrSymbol - ).returns(T.attached_class) - end - def self.new( - # Number of units between runs. The resulting interval (frequency × unit) must be - # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; - # maximum 365 when unit is days). - frequency:, - type:, - unit: - ) - end - - sig do - override.returns( - { - frequency: Integer, - type: ContextDev::MonitorCreateParams::Schedule::Type::OrSymbol, - unit: ContextDev::MonitorCreateParams::Schedule::Unit::OrSymbol - } - ) - end - def to_hash - end - - module Type - extend ContextDev::Internal::Type::Enum - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::MonitorCreateParams::Schedule::Type) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - INTERVAL = - T.let( - :interval, - ContextDev::MonitorCreateParams::Schedule::Type::TaggedSymbol - ) - - sig do - override.returns( - T::Array[ - ContextDev::MonitorCreateParams::Schedule::Type::TaggedSymbol - ] - ) - end - def self.values - end - end - - module Unit - extend ContextDev::Internal::Type::Enum - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::MonitorCreateParams::Schedule::Unit) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - MINUTES = - T.let( - :minutes, - ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol - ) - HOURS = - T.let( - :hours, - ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol - ) - DAYS = - T.let( - :days, - ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol - ) - - sig do - override.returns( - T::Array[ - ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol - ] - ) - end - def self.values - end - end - end - # Discriminated union describing what the monitor watches. module Target extend ContextDev::Internal::Type::Union @@ -604,6 +417,86 @@ module ContextDev end end + # Discriminated union describing how changes are detected. + module ChangeDetection + extend ContextDev::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + ContextDev::MonitorCreateParams::ChangeDetection::Exact, + ContextDev::MonitorCreateParams::ChangeDetection::Semantic + ) + end + + class Exact < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::MonitorCreateParams::ChangeDetection::Exact, + ContextDev::Internal::AnyHash + ) + end + + sig { returns(Symbol) } + attr_accessor :type + + # Detect exact changes. For page targets, this means visible text diffs. For + # sitemap targets, this means URL additions and removals. + sig { params(type: Symbol).returns(T.attached_class) } + def self.new(type: :exact) + end + + sig { override.returns({ type: Symbol }) } + def to_hash + end + end + + class Semantic < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::MonitorCreateParams::ChangeDetection::Semantic, + ContextDev::Internal::AnyHash + ) + end + + sig { returns(Symbol) } + attr_accessor :type + + sig { returns(T.nilable(Float)) } + attr_reader :confidence_threshold + + sig { params(confidence_threshold: Float).void } + attr_writer :confidence_threshold + + # Detect meaning-level changes to tracked page content, ignoring cosmetic or + # paraphrase-only differences. Which changes are meaningful is judged against the + # extract target's `instructions` (and `schema`, when provided). + sig do + params(confidence_threshold: Float, type: Symbol).returns( + T.attached_class + ) + end + def self.new(confidence_threshold: nil, type: :semantic) + end + + sig do + override.returns({ type: Symbol, confidence_threshold: Float }) + end + def to_hash + end + end + + sig do + override.returns( + T::Array[ContextDev::MonitorCreateParams::ChangeDetection::Variants] + ) + end + def self.variants + end + end + # Top-level monitor category. Always `web` today; the concrete behavior is # described by `target` and `change_detection`. module Mode @@ -624,6 +517,126 @@ module ContextDev end end + class Schedule < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::MonitorCreateParams::Schedule, + ContextDev::Internal::AnyHash + ) + end + + # Number of units between runs. The resulting interval (frequency × unit) must be + # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; + # maximum 365 when unit is days). + sig { returns(Integer) } + attr_accessor :frequency + + sig do + returns(ContextDev::MonitorCreateParams::Schedule::Type::OrSymbol) + end + attr_accessor :type + + sig do + returns(ContextDev::MonitorCreateParams::Schedule::Unit::OrSymbol) + end + attr_accessor :unit + + # Run the monitor on a fixed interval defined by a frequency and a unit, e.g. + # every 6 hours or every 2 days. The total interval (frequency × unit) must be + # between 10 minutes and 1 year. + sig do + params( + frequency: Integer, + type: ContextDev::MonitorCreateParams::Schedule::Type::OrSymbol, + unit: ContextDev::MonitorCreateParams::Schedule::Unit::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Number of units between runs. The resulting interval (frequency × unit) must be + # at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; + # maximum 365 when unit is days). + frequency:, + type:, + unit: + ) + end + + sig do + override.returns( + { + frequency: Integer, + type: ContextDev::MonitorCreateParams::Schedule::Type::OrSymbol, + unit: ContextDev::MonitorCreateParams::Schedule::Unit::OrSymbol + } + ) + end + def to_hash + end + + module Type + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::MonitorCreateParams::Schedule::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INTERVAL = + T.let( + :interval, + ContextDev::MonitorCreateParams::Schedule::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::MonitorCreateParams::Schedule::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + + module Unit + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::MonitorCreateParams::Schedule::Unit) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MINUTES = + T.let( + :minutes, + ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol + ) + HOURS = + T.let( + :hours, + ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol + ) + DAYS = + T.let( + :days, + ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::MonitorCreateParams::Schedule::Unit::TaggedSymbol + ] + ) + end + def self.values + end + end + end + class Webhook < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do diff --git a/rbi/context_dev/models/monitor_create_response.rbi b/rbi/context_dev/models/monitor_create_response.rbi index c75c7668..9b7d9d0d 100644 --- a/rbi/context_dev/models/monitor_create_response.rbi +++ b/rbi/context_dev/models/monitor_create_response.rbi @@ -25,6 +25,12 @@ module ContextDev sig { returns(Time) } attr_accessor :created_at + # The baseline run queued by this create call, or null if it could not be queued + # immediately (in which case the baseline runs on the next scheduled tick). Poll + # GET /monitors/{monitor_id}/runs/{run_id}. + sig { returns(T.nilable(String)) } + attr_accessor :initial_run_id + # Top-level monitor category. Always `web` today; the concrete behavior is # described by `target` and `change_detection`. sig do @@ -149,8 +155,8 @@ module ContextDev end attr_writer :webhook_failure - # A web monitor. `mode` is the constant `web`; behavior is described by `target` - # (page/sitemap/extract) and `change_detection` (exact/semantic). + # A newly created monitor plus `initial_run_id`, the id of the baseline run queued + # at creation. sig do params( id: String, @@ -160,6 +166,7 @@ module ContextDev ContextDev::Models::MonitorCreateResponse::ChangeDetection::Semantic::OrHash ), created_at: Time, + initial_run_id: T.nilable(String), mode: ContextDev::Models::MonitorCreateResponse::Mode::OrSymbol, name: String, schedule: ContextDev::Models::MonitorCreateResponse::Schedule::OrHash, @@ -202,6 +209,10 @@ module ContextDev # Discriminated union describing how changes are detected. change_detection:, created_at:, + # The baseline run queued by this create call, or null if it could not be queued + # immediately (in which case the baseline runs on the next scheduled tick). Poll + # GET /monitors/{monitor_id}/runs/{run_id}. + initial_run_id:, # Top-level monitor category. Always `web` today; the concrete behavior is # described by `target` and `change_detection`. mode:, @@ -248,6 +259,7 @@ module ContextDev change_detection: ContextDev::Models::MonitorCreateResponse::ChangeDetection::Variants, created_at: Time, + initial_run_id: T.nilable(String), mode: ContextDev::Models::MonitorCreateResponse::Mode::TaggedSymbol, name: String, schedule: ContextDev::Models::MonitorCreateResponse::Schedule, diff --git a/rbi/context_dev/resources/monitors.rbi b/rbi/context_dev/resources/monitors.rbi index cf0a3cd3..f359d547 100644 --- a/rbi/context_dev/resources/monitors.rbi +++ b/rbi/context_dev/resources/monitors.rbi @@ -12,38 +12,38 @@ module ContextDev # its initial baseline. sig do params( - change_detection: - T.any( - ContextDev::MonitorCreateParams::ChangeDetection::Exact::OrHash, - ContextDev::MonitorCreateParams::ChangeDetection::Semantic::OrHash - ), name: String, - schedule: ContextDev::MonitorCreateParams::Schedule::OrHash, target: T.any( ContextDev::MonitorCreateParams::Target::Page::OrHash, ContextDev::MonitorCreateParams::Target::Sitemap::OrHash, ContextDev::MonitorCreateParams::Target::Extract::OrHash ), + change_detection: + T.any( + ContextDev::MonitorCreateParams::ChangeDetection::Exact::OrHash, + ContextDev::MonitorCreateParams::ChangeDetection::Semantic::OrHash + ), mode: ContextDev::MonitorCreateParams::Mode::OrSymbol, + schedule: ContextDev::MonitorCreateParams::Schedule::OrHash, tags: T::Array[String], webhook: T.nilable(ContextDev::MonitorCreateParams::Webhook::OrHash), request_options: ContextDev::RequestOptions::OrHash ).returns(ContextDev::Models::MonitorCreateResponse) end def create( - # Discriminated union describing how changes are detected. - change_detection:, name:, - # Run the monitor on a fixed interval defined by a frequency and a unit, e.g. - # every 6 hours or every 2 days. The total interval (frequency × unit) must be - # between 10 minutes and 1 year. - schedule:, # Discriminated union describing what the monitor watches. target:, + # Discriminated union describing how changes are detected. + change_detection: nil, # Top-level monitor category. Always `web` today; the concrete behavior is # described by `target` and `change_detection`. mode: nil, + # Run the monitor on a fixed interval defined by a frequency and a unit, e.g. + # every 6 hours or every 2 days. The total interval (frequency × unit) must be + # between 10 minutes and 1 year. + schedule: nil, # User-defined tags for grouping and filtering monitors and their changes. # Duplicates are removed. tags: nil, diff --git a/sig/context_dev/models/monitor_create_params.rbs b/sig/context_dev/models/monitor_create_params.rbs index c49a4169..e81c7ce8 100644 --- a/sig/context_dev/models/monitor_create_params.rbs +++ b/sig/context_dev/models/monitor_create_params.rbs @@ -2,11 +2,11 @@ module ContextDev module Models type monitor_create_params = { - change_detection: ContextDev::Models::MonitorCreateParams::change_detection, name: String, - schedule: ContextDev::MonitorCreateParams::Schedule, target: ContextDev::Models::MonitorCreateParams::target, + change_detection: ContextDev::Models::MonitorCreateParams::change_detection, mode: ContextDev::Models::MonitorCreateParams::mode, + schedule: ContextDev::MonitorCreateParams::Schedule, tags: ::Array[String], webhook: ContextDev::MonitorCreateParams::Webhook? } @@ -16,20 +16,28 @@ module ContextDev extend ContextDev::Internal::Type::RequestParameters::Converter include ContextDev::Internal::Type::RequestParameters - attr_accessor change_detection: ContextDev::Models::MonitorCreateParams::change_detection - attr_accessor name: String - attr_accessor schedule: ContextDev::MonitorCreateParams::Schedule - attr_accessor target: ContextDev::Models::MonitorCreateParams::target + attr_reader change_detection: ContextDev::Models::MonitorCreateParams::change_detection? + + def change_detection=: ( + ContextDev::Models::MonitorCreateParams::change_detection + ) -> ContextDev::Models::MonitorCreateParams::change_detection + attr_reader mode: ContextDev::Models::MonitorCreateParams::mode? def mode=: ( ContextDev::Models::MonitorCreateParams::mode ) -> ContextDev::Models::MonitorCreateParams::mode + attr_reader schedule: ContextDev::MonitorCreateParams::Schedule? + + def schedule=: ( + ContextDev::MonitorCreateParams::Schedule + ) -> ContextDev::MonitorCreateParams::Schedule + attr_reader tags: ::Array[String]? def tags=: (::Array[String]) -> ::Array[String] @@ -37,113 +45,27 @@ module ContextDev attr_accessor webhook: ContextDev::MonitorCreateParams::Webhook? def initialize: ( - change_detection: ContextDev::Models::MonitorCreateParams::change_detection, name: String, - schedule: ContextDev::MonitorCreateParams::Schedule, target: ContextDev::Models::MonitorCreateParams::target, + ?change_detection: ContextDev::Models::MonitorCreateParams::change_detection, ?mode: ContextDev::Models::MonitorCreateParams::mode, + ?schedule: ContextDev::MonitorCreateParams::Schedule, ?tags: ::Array[String], ?webhook: ContextDev::MonitorCreateParams::Webhook?, ?request_options: ContextDev::request_opts ) -> void def to_hash: -> { - change_detection: ContextDev::Models::MonitorCreateParams::change_detection, name: String, - schedule: ContextDev::MonitorCreateParams::Schedule, target: ContextDev::Models::MonitorCreateParams::target, + change_detection: ContextDev::Models::MonitorCreateParams::change_detection, mode: ContextDev::Models::MonitorCreateParams::mode, + schedule: ContextDev::MonitorCreateParams::Schedule, tags: ::Array[String], webhook: ContextDev::MonitorCreateParams::Webhook?, request_options: ContextDev::RequestOptions } - type change_detection = - ContextDev::MonitorCreateParams::ChangeDetection::Exact - | ContextDev::MonitorCreateParams::ChangeDetection::Semantic - - module ChangeDetection - extend ContextDev::Internal::Type::Union - - type exact = { type: :exact } - - class Exact < ContextDev::Internal::Type::BaseModel - attr_accessor type: :exact - - def initialize: (?type: :exact) -> void - - def to_hash: -> { type: :exact } - end - - type semantic = { type: :semantic, confidence_threshold: Float } - - class Semantic < ContextDev::Internal::Type::BaseModel - attr_accessor type: :semantic - - attr_reader confidence_threshold: Float? - - def confidence_threshold=: (Float) -> Float - - def initialize: ( - ?confidence_threshold: Float, - ?type: :semantic - ) -> void - - def to_hash: -> { type: :semantic, confidence_threshold: Float } - end - - def self?.variants: -> ::Array[ContextDev::Models::MonitorCreateParams::change_detection] - end - - type schedule = - { - frequency: Integer, - type: ContextDev::Models::MonitorCreateParams::Schedule::type_, - unit: ContextDev::Models::MonitorCreateParams::Schedule::unit - } - - class Schedule < ContextDev::Internal::Type::BaseModel - attr_accessor frequency: Integer - - attr_accessor type: ContextDev::Models::MonitorCreateParams::Schedule::type_ - - attr_accessor unit: ContextDev::Models::MonitorCreateParams::Schedule::unit - - def initialize: ( - frequency: Integer, - type: ContextDev::Models::MonitorCreateParams::Schedule::type_, - unit: ContextDev::Models::MonitorCreateParams::Schedule::unit - ) -> void - - def to_hash: -> { - frequency: Integer, - type: ContextDev::Models::MonitorCreateParams::Schedule::type_, - unit: ContextDev::Models::MonitorCreateParams::Schedule::unit - } - - type type_ = :interval - - module Type - extend ContextDev::Internal::Type::Enum - - INTERVAL: :interval - - def self?.values: -> ::Array[ContextDev::Models::MonitorCreateParams::Schedule::type_] - end - - type unit = :minutes | :hours | :days - - module Unit - extend ContextDev::Internal::Type::Enum - - MINUTES: :minutes - HOURS: :hours - DAYS: :days - - def self?.values: -> ::Array[ContextDev::Models::MonitorCreateParams::Schedule::unit] - end - end - type target = ContextDev::MonitorCreateParams::Target::Page | ContextDev::MonitorCreateParams::Target::Sitemap @@ -277,6 +199,43 @@ module ContextDev def self?.variants: -> ::Array[ContextDev::Models::MonitorCreateParams::target] end + type change_detection = + ContextDev::MonitorCreateParams::ChangeDetection::Exact + | ContextDev::MonitorCreateParams::ChangeDetection::Semantic + + module ChangeDetection + extend ContextDev::Internal::Type::Union + + type exact = { type: :exact } + + class Exact < ContextDev::Internal::Type::BaseModel + attr_accessor type: :exact + + def initialize: (?type: :exact) -> void + + def to_hash: -> { type: :exact } + end + + type semantic = { type: :semantic, confidence_threshold: Float } + + class Semantic < ContextDev::Internal::Type::BaseModel + attr_accessor type: :semantic + + attr_reader confidence_threshold: Float? + + def confidence_threshold=: (Float) -> Float + + def initialize: ( + ?confidence_threshold: Float, + ?type: :semantic + ) -> void + + def to_hash: -> { type: :semantic, confidence_threshold: Float } + end + + def self?.variants: -> ::Array[ContextDev::Models::MonitorCreateParams::change_detection] + end + type mode = :web module Mode @@ -287,6 +246,55 @@ module ContextDev def self?.values: -> ::Array[ContextDev::Models::MonitorCreateParams::mode] end + type schedule = + { + frequency: Integer, + type: ContextDev::Models::MonitorCreateParams::Schedule::type_, + unit: ContextDev::Models::MonitorCreateParams::Schedule::unit + } + + class Schedule < ContextDev::Internal::Type::BaseModel + attr_accessor frequency: Integer + + attr_accessor type: ContextDev::Models::MonitorCreateParams::Schedule::type_ + + attr_accessor unit: ContextDev::Models::MonitorCreateParams::Schedule::unit + + def initialize: ( + frequency: Integer, + type: ContextDev::Models::MonitorCreateParams::Schedule::type_, + unit: ContextDev::Models::MonitorCreateParams::Schedule::unit + ) -> void + + def to_hash: -> { + frequency: Integer, + type: ContextDev::Models::MonitorCreateParams::Schedule::type_, + unit: ContextDev::Models::MonitorCreateParams::Schedule::unit + } + + type type_ = :interval + + module Type + extend ContextDev::Internal::Type::Enum + + INTERVAL: :interval + + def self?.values: -> ::Array[ContextDev::Models::MonitorCreateParams::Schedule::type_] + end + + type unit = :minutes | :hours | :days + + module Unit + extend ContextDev::Internal::Type::Enum + + MINUTES: :minutes + HOURS: :hours + DAYS: :days + + def self?.values: -> ::Array[ContextDev::Models::MonitorCreateParams::Schedule::unit] + end + end + type webhook = { url: String, diff --git a/sig/context_dev/models/monitor_create_response.rbs b/sig/context_dev/models/monitor_create_response.rbs index 799e2e71..e3e31e73 100644 --- a/sig/context_dev/models/monitor_create_response.rbs +++ b/sig/context_dev/models/monitor_create_response.rbs @@ -5,6 +5,7 @@ module ContextDev id: String, change_detection: ContextDev::Models::MonitorCreateResponse::change_detection, created_at: Time, + initial_run_id: String?, mode: ContextDev::Models::MonitorCreateResponse::mode, name: String, schedule: ContextDev::Models::MonitorCreateResponse::Schedule, @@ -28,6 +29,8 @@ module ContextDev attr_accessor created_at: Time + attr_accessor initial_run_id: String? + attr_accessor mode: ContextDev::Models::MonitorCreateResponse::mode attr_accessor name: String @@ -62,6 +65,7 @@ module ContextDev id: String, change_detection: ContextDev::Models::MonitorCreateResponse::change_detection, created_at: Time, + initial_run_id: String?, mode: ContextDev::Models::MonitorCreateResponse::mode, name: String, schedule: ContextDev::Models::MonitorCreateResponse::Schedule, @@ -82,6 +86,7 @@ module ContextDev id: String, change_detection: ContextDev::Models::MonitorCreateResponse::change_detection, created_at: Time, + initial_run_id: String?, mode: ContextDev::Models::MonitorCreateResponse::mode, name: String, schedule: ContextDev::Models::MonitorCreateResponse::Schedule, diff --git a/sig/context_dev/resources/monitors.rbs b/sig/context_dev/resources/monitors.rbs index 8a439864..3b0295cd 100644 --- a/sig/context_dev/resources/monitors.rbs +++ b/sig/context_dev/resources/monitors.rbs @@ -2,11 +2,11 @@ module ContextDev module Resources class Monitors def create: ( - change_detection: ContextDev::Models::MonitorCreateParams::change_detection, name: String, - schedule: ContextDev::MonitorCreateParams::Schedule, target: ContextDev::Models::MonitorCreateParams::target, + ?change_detection: ContextDev::Models::MonitorCreateParams::change_detection, ?mode: ContextDev::Models::MonitorCreateParams::mode, + ?schedule: ContextDev::MonitorCreateParams::Schedule, ?tags: ::Array[String], ?webhook: ContextDev::MonitorCreateParams::Webhook?, ?request_options: ContextDev::request_opts diff --git a/test/context_dev/resources/monitors_test.rb b/test/context_dev/resources/monitors_test.rb index c3c39bdf..b4c804e0 100644 --- a/test/context_dev/resources/monitors_test.rb +++ b/test/context_dev/resources/monitors_test.rb @@ -8,9 +8,7 @@ def test_create_required_params response = @context_dev.monitors.create( - change_detection: {type: :exact}, name: "Acme pricing page", - schedule: {frequency: 6, type: :interval, unit: :hours}, target: {type: :page, url: "https://acme.com/pricing"} ) @@ -23,6 +21,7 @@ def test_create_required_params id: String, change_detection: ContextDev::Models::MonitorCreateResponse::ChangeDetection, created_at: Time, + initial_run_id: String | nil, mode: ContextDev::Models::MonitorCreateResponse::Mode, name: String, schedule: ContextDev::Models::MonitorCreateResponse::Schedule, From 6cfd0e80f3860cfbddd595ac4c72461075775415 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 06:43:36 +0000 Subject: [PATCH 02/11] feat(api): api update --- .stats.yml | 4 +-- .../models/monitor_create_params.rb | 28 +++++++++++++----- .../models/monitor_create_response.rb | 28 +++++++++++++----- .../models/monitor_list_response.rb | 28 +++++++++++++----- .../models/monitor_retrieve_response.rb | 28 +++++++++++++----- .../models/monitor_update_params.rb | 28 +++++++++++++----- .../models/monitor_update_response.rb | 28 +++++++++++++----- .../models/monitor_create_params.rbi | 29 +++++++++++++++---- .../models/monitor_create_response.rbi | 29 +++++++++++++++---- .../models/monitor_list_response.rbi | 29 +++++++++++++++---- .../models/monitor_retrieve_response.rbi | 29 +++++++++++++++---- .../models/monitor_update_params.rbi | 29 +++++++++++++++---- .../models/monitor_update_response.rbi | 29 +++++++++++++++---- .../models/monitor_create_params.rbs | 14 ++++++++- .../models/monitor_create_response.rbs | 14 ++++++++- .../models/monitor_list_response.rbs | 14 ++++++++- .../models/monitor_retrieve_response.rbs | 14 ++++++++- .../models/monitor_update_params.rbs | 14 ++++++++- .../models/monitor_update_response.rbs | 14 ++++++++- 19 files changed, 350 insertions(+), 80 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6da46828..3f4cd2e0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2bf2b44f6593c44b2948683469bbb2b09cd8e90c97b12057fac6220cf0d2eee7.yml -openapi_spec_hash: ae8b5109ec997cac8d3e6ec96040f6c8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-91f4286859fc23813c5255b877395c87dd81520c3913fdfdae3cfa343e1a4873.yml +openapi_spec_hash: 71746b5b65f20617ee021e071d5f7f92 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 diff --git a/lib/context_dev/models/monitor_create_params.rb b/lib/context_dev/models/monitor_create_params.rb index ee369bd4..b0dff8e7 100644 --- a/lib/context_dev/models/monitor_create_params.rb +++ b/lib/context_dev/models/monitor_create_params.rb @@ -77,7 +77,7 @@ module Target discriminator :type - # Watch a single web page. + # Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`. variant :page, -> { ContextDev::MonitorCreateParams::Target::Page } # Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps. @@ -97,17 +97,30 @@ class Page < ContextDev::Internal::Type::BaseModel # @return [String] required :url, String + # @!attribute instructions + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + # + # @return [String, nil] + optional :instructions, String + # @!attribute normalize_whitespace # Normalize whitespace before comparing or analyzing text. # # @return [Boolean, nil] optional :normalize_whitespace, ContextDev::Internal::Type::Boolean - # @!method initialize(url:, normalize_whitespace: nil, type: :page) - # Watch a single web page. + # @!method initialize(url:, instructions: nil, normalize_whitespace: nil, type: :page) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::MonitorCreateParams::Target::Page} for more details. + # + # Watch a single web page. Exact detection reports visible-text diffs; semantic + # detection judges confirmed stable diffs against `instructions`. # # @param url [String] # + # @param instructions [String] Plain-language goal describing which page changes matter. When provided without + # # @param normalize_whitespace [Boolean] Normalize whitespace before comparing or analyzing text. # # @param type [Symbol, :page] @@ -248,7 +261,7 @@ module ChangeDetection # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. variant :exact, -> { ContextDev::MonitorCreateParams::ChangeDetection::Exact } - # Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided). variant :semantic, -> { ContextDev::MonitorCreateParams::ChangeDetection::Semantic } class Exact < ContextDev::Internal::Type::BaseModel @@ -276,9 +289,10 @@ class Semantic < ContextDev::Internal::Type::BaseModel optional :confidence_threshold, Float # @!method initialize(confidence_threshold: nil, type: :semantic) - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or + # instruction-irrelevant differences. Which changes are meaningful is judged + # against the page or extract target's `instructions` (and an extract target's + # `schema`, when provided). # # @param confidence_threshold [Float] # @param type [Symbol, :semantic] diff --git a/lib/context_dev/models/monitor_create_response.rb b/lib/context_dev/models/monitor_create_response.rb index 94a7f763..b762fec7 100644 --- a/lib/context_dev/models/monitor_create_response.rb +++ b/lib/context_dev/models/monitor_create_response.rb @@ -174,7 +174,7 @@ module ChangeDetection # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. variant :exact, -> { ContextDev::Models::MonitorCreateResponse::ChangeDetection::Exact } - # Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided). variant :semantic, -> { ContextDev::Models::MonitorCreateResponse::ChangeDetection::Semantic } class Exact < ContextDev::Internal::Type::BaseModel @@ -202,9 +202,10 @@ class Semantic < ContextDev::Internal::Type::BaseModel optional :confidence_threshold, Float # @!method initialize(confidence_threshold: nil, type: :semantic) - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or + # instruction-irrelevant differences. Which changes are meaningful is judged + # against the page or extract target's `instructions` (and an extract target's + # `schema`, when provided). # # @param confidence_threshold [Float] # @param type [Symbol, :semantic] @@ -310,7 +311,7 @@ module Target discriminator :type - # Watch a single web page. + # Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`. variant :page, -> { ContextDev::Models::MonitorCreateResponse::Target::Page } # Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps. @@ -330,17 +331,30 @@ class Page < ContextDev::Internal::Type::BaseModel # @return [String] required :url, String + # @!attribute instructions + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + # + # @return [String, nil] + optional :instructions, String + # @!attribute normalize_whitespace # Normalize whitespace before comparing or analyzing text. # # @return [Boolean, nil] optional :normalize_whitespace, ContextDev::Internal::Type::Boolean - # @!method initialize(url:, normalize_whitespace: nil, type: :page) - # Watch a single web page. + # @!method initialize(url:, instructions: nil, normalize_whitespace: nil, type: :page) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::MonitorCreateResponse::Target::Page} for more details. + # + # Watch a single web page. Exact detection reports visible-text diffs; semantic + # detection judges confirmed stable diffs against `instructions`. # # @param url [String] # + # @param instructions [String] Plain-language goal describing which page changes matter. When provided without + # # @param normalize_whitespace [Boolean] Normalize whitespace before comparing or analyzing text. # # @param type [Symbol, :page] diff --git a/lib/context_dev/models/monitor_list_response.rb b/lib/context_dev/models/monitor_list_response.rb index a5df5a10..ed92c381 100644 --- a/lib/context_dev/models/monitor_list_response.rb +++ b/lib/context_dev/models/monitor_list_response.rb @@ -187,7 +187,7 @@ module ChangeDetection # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. variant :exact, -> { ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Exact } - # Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided). variant :semantic, -> { ContextDev::Models::MonitorListResponse::Data::ChangeDetection::Semantic } class Exact < ContextDev::Internal::Type::BaseModel @@ -215,9 +215,10 @@ class Semantic < ContextDev::Internal::Type::BaseModel optional :confidence_threshold, Float # @!method initialize(confidence_threshold: nil, type: :semantic) - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or + # instruction-irrelevant differences. Which changes are meaningful is judged + # against the page or extract target's `instructions` (and an extract target's + # `schema`, when provided). # # @param confidence_threshold [Float] # @param type [Symbol, :semantic] @@ -323,7 +324,7 @@ module Target discriminator :type - # Watch a single web page. + # Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`. variant :page, -> { ContextDev::Models::MonitorListResponse::Data::Target::Page } # Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps. @@ -343,17 +344,30 @@ class Page < ContextDev::Internal::Type::BaseModel # @return [String] required :url, String + # @!attribute instructions + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + # + # @return [String, nil] + optional :instructions, String + # @!attribute normalize_whitespace # Normalize whitespace before comparing or analyzing text. # # @return [Boolean, nil] optional :normalize_whitespace, ContextDev::Internal::Type::Boolean - # @!method initialize(url:, normalize_whitespace: nil, type: :page) - # Watch a single web page. + # @!method initialize(url:, instructions: nil, normalize_whitespace: nil, type: :page) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::MonitorListResponse::Data::Target::Page} for more details. + # + # Watch a single web page. Exact detection reports visible-text diffs; semantic + # detection judges confirmed stable diffs against `instructions`. # # @param url [String] # + # @param instructions [String] Plain-language goal describing which page changes matter. When provided without + # # @param normalize_whitespace [Boolean] Normalize whitespace before comparing or analyzing text. # # @param type [Symbol, :page] diff --git a/lib/context_dev/models/monitor_retrieve_response.rb b/lib/context_dev/models/monitor_retrieve_response.rb index e77d1f0b..f8780cee 100644 --- a/lib/context_dev/models/monitor_retrieve_response.rb +++ b/lib/context_dev/models/monitor_retrieve_response.rb @@ -164,7 +164,7 @@ module ChangeDetection # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. variant :exact, -> { ContextDev::Models::MonitorRetrieveResponse::ChangeDetection::Exact } - # Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided). variant :semantic, -> { ContextDev::Models::MonitorRetrieveResponse::ChangeDetection::Semantic } class Exact < ContextDev::Internal::Type::BaseModel @@ -192,9 +192,10 @@ class Semantic < ContextDev::Internal::Type::BaseModel optional :confidence_threshold, Float # @!method initialize(confidence_threshold: nil, type: :semantic) - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or + # instruction-irrelevant differences. Which changes are meaningful is judged + # against the page or extract target's `instructions` (and an extract target's + # `schema`, when provided). # # @param confidence_threshold [Float] # @param type [Symbol, :semantic] @@ -300,7 +301,7 @@ module Target discriminator :type - # Watch a single web page. + # Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`. variant :page, -> { ContextDev::Models::MonitorRetrieveResponse::Target::Page } # Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps. @@ -320,17 +321,30 @@ class Page < ContextDev::Internal::Type::BaseModel # @return [String] required :url, String + # @!attribute instructions + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + # + # @return [String, nil] + optional :instructions, String + # @!attribute normalize_whitespace # Normalize whitespace before comparing or analyzing text. # # @return [Boolean, nil] optional :normalize_whitespace, ContextDev::Internal::Type::Boolean - # @!method initialize(url:, normalize_whitespace: nil, type: :page) - # Watch a single web page. + # @!method initialize(url:, instructions: nil, normalize_whitespace: nil, type: :page) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::MonitorRetrieveResponse::Target::Page} for more details. + # + # Watch a single web page. Exact detection reports visible-text diffs; semantic + # detection judges confirmed stable diffs against `instructions`. # # @param url [String] # + # @param instructions [String] Plain-language goal describing which page changes matter. When provided without + # # @param normalize_whitespace [Boolean] Normalize whitespace before comparing or analyzing text. # # @param type [Symbol, :page] diff --git a/lib/context_dev/models/monitor_update_params.rb b/lib/context_dev/models/monitor_update_params.rb index 395abeb4..7fa91919 100644 --- a/lib/context_dev/models/monitor_update_params.rb +++ b/lib/context_dev/models/monitor_update_params.rb @@ -86,7 +86,7 @@ module ChangeDetection # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. variant :exact, -> { ContextDev::MonitorUpdateParams::ChangeDetection::Exact } - # Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided). variant :semantic, -> { ContextDev::MonitorUpdateParams::ChangeDetection::Semantic } class Exact < ContextDev::Internal::Type::BaseModel @@ -114,9 +114,10 @@ class Semantic < ContextDev::Internal::Type::BaseModel optional :confidence_threshold, Float # @!method initialize(confidence_threshold: nil, type: :semantic) - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or + # instruction-irrelevant differences. Which changes are meaningful is judged + # against the page or extract target's `instructions` (and an extract target's + # `schema`, when provided). # # @param confidence_threshold [Float] # @param type [Symbol, :semantic] @@ -198,7 +199,7 @@ module Target discriminator :type - # Watch a single web page. + # Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`. variant :page, -> { ContextDev::MonitorUpdateParams::Target::Page } # Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps. @@ -218,17 +219,30 @@ class Page < ContextDev::Internal::Type::BaseModel # @return [String] required :url, String + # @!attribute instructions + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + # + # @return [String, nil] + optional :instructions, String + # @!attribute normalize_whitespace # Normalize whitespace before comparing or analyzing text. # # @return [Boolean, nil] optional :normalize_whitespace, ContextDev::Internal::Type::Boolean - # @!method initialize(url:, normalize_whitespace: nil, type: :page) - # Watch a single web page. + # @!method initialize(url:, instructions: nil, normalize_whitespace: nil, type: :page) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::MonitorUpdateParams::Target::Page} for more details. + # + # Watch a single web page. Exact detection reports visible-text diffs; semantic + # detection judges confirmed stable diffs against `instructions`. # # @param url [String] # + # @param instructions [String] Plain-language goal describing which page changes matter. When provided without + # # @param normalize_whitespace [Boolean] Normalize whitespace before comparing or analyzing text. # # @param type [Symbol, :page] diff --git a/lib/context_dev/models/monitor_update_response.rb b/lib/context_dev/models/monitor_update_response.rb index 996bfd0e..ea143672 100644 --- a/lib/context_dev/models/monitor_update_response.rb +++ b/lib/context_dev/models/monitor_update_response.rb @@ -164,7 +164,7 @@ module ChangeDetection # Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. variant :exact, -> { ContextDev::Models::MonitorUpdateResponse::ChangeDetection::Exact } - # Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided). variant :semantic, -> { ContextDev::Models::MonitorUpdateResponse::ChangeDetection::Semantic } class Exact < ContextDev::Internal::Type::BaseModel @@ -192,9 +192,10 @@ class Semantic < ContextDev::Internal::Type::BaseModel optional :confidence_threshold, Float # @!method initialize(confidence_threshold: nil, type: :semantic) - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or + # instruction-irrelevant differences. Which changes are meaningful is judged + # against the page or extract target's `instructions` (and an extract target's + # `schema`, when provided). # # @param confidence_threshold [Float] # @param type [Symbol, :semantic] @@ -300,7 +301,7 @@ module Target discriminator :type - # Watch a single web page. + # Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`. variant :page, -> { ContextDev::Models::MonitorUpdateResponse::Target::Page } # Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps. @@ -320,17 +321,30 @@ class Page < ContextDev::Internal::Type::BaseModel # @return [String] required :url, String + # @!attribute instructions + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + # + # @return [String, nil] + optional :instructions, String + # @!attribute normalize_whitespace # Normalize whitespace before comparing or analyzing text. # # @return [Boolean, nil] optional :normalize_whitespace, ContextDev::Internal::Type::Boolean - # @!method initialize(url:, normalize_whitespace: nil, type: :page) - # Watch a single web page. + # @!method initialize(url:, instructions: nil, normalize_whitespace: nil, type: :page) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::MonitorUpdateResponse::Target::Page} for more details. + # + # Watch a single web page. Exact detection reports visible-text diffs; semantic + # detection judges confirmed stable diffs against `instructions`. # # @param url [String] # + # @param instructions [String] Plain-language goal describing which page changes matter. When provided without + # # @param normalize_whitespace [Boolean] Normalize whitespace before comparing or analyzing text. # # @param type [Symbol, :page] diff --git a/rbi/context_dev/models/monitor_create_params.rbi b/rbi/context_dev/models/monitor_create_params.rbi index 78ee5ee1..88af69d7 100644 --- a/rbi/context_dev/models/monitor_create_params.rbi +++ b/rbi/context_dev/models/monitor_create_params.rbi @@ -185,6 +185,14 @@ module ContextDev sig { returns(String) } attr_accessor :url + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + sig { returns(T.nilable(String)) } + attr_reader :instructions + + sig { params(instructions: String).void } + attr_writer :instructions + # Normalize whitespace before comparing or analyzing text. sig { returns(T.nilable(T::Boolean)) } attr_reader :normalize_whitespace @@ -192,16 +200,21 @@ module ContextDev sig { params(normalize_whitespace: T::Boolean).void } attr_writer :normalize_whitespace - # Watch a single web page. + # Watch a single web page. Exact detection reports visible-text diffs; semantic + # detection judges confirmed stable diffs against `instructions`. sig do params( url: String, + instructions: String, normalize_whitespace: T::Boolean, type: Symbol ).returns(T.attached_class) end def self.new( url:, + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + instructions: nil, # Normalize whitespace before comparing or analyzing text. normalize_whitespace: nil, type: :page @@ -210,7 +223,12 @@ module ContextDev sig do override.returns( - { type: Symbol, url: String, normalize_whitespace: T::Boolean } + { + type: Symbol, + url: String, + instructions: String, + normalize_whitespace: T::Boolean + } ) end def to_hash @@ -470,9 +488,10 @@ module ContextDev sig { params(confidence_threshold: Float).void } attr_writer :confidence_threshold - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or + # instruction-irrelevant differences. Which changes are meaningful is judged + # against the page or extract target's `instructions` (and an extract target's + # `schema`, when provided). sig do params(confidence_threshold: Float, type: Symbol).returns( T.attached_class diff --git a/rbi/context_dev/models/monitor_create_response.rbi b/rbi/context_dev/models/monitor_create_response.rbi index 9b7d9d0d..c74b8da1 100644 --- a/rbi/context_dev/models/monitor_create_response.rbi +++ b/rbi/context_dev/models/monitor_create_response.rbi @@ -342,9 +342,10 @@ module ContextDev sig { params(confidence_threshold: Float).void } attr_writer :confidence_threshold - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or + # instruction-irrelevant differences. Which changes are meaningful is judged + # against the page or extract target's `instructions` (and an extract target's + # `schema`, when provided). sig do params(confidence_threshold: Float, type: Symbol).returns( T.attached_class @@ -602,6 +603,14 @@ module ContextDev sig { returns(String) } attr_accessor :url + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + sig { returns(T.nilable(String)) } + attr_reader :instructions + + sig { params(instructions: String).void } + attr_writer :instructions + # Normalize whitespace before comparing or analyzing text. sig { returns(T.nilable(T::Boolean)) } attr_reader :normalize_whitespace @@ -609,16 +618,21 @@ module ContextDev sig { params(normalize_whitespace: T::Boolean).void } attr_writer :normalize_whitespace - # Watch a single web page. + # Watch a single web page. Exact detection reports visible-text diffs; semantic + # detection judges confirmed stable diffs against `instructions`. sig do params( url: String, + instructions: String, normalize_whitespace: T::Boolean, type: Symbol ).returns(T.attached_class) end def self.new( url:, + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + instructions: nil, # Normalize whitespace before comparing or analyzing text. normalize_whitespace: nil, type: :page @@ -627,7 +641,12 @@ module ContextDev sig do override.returns( - { type: Symbol, url: String, normalize_whitespace: T::Boolean } + { + type: Symbol, + url: String, + instructions: String, + normalize_whitespace: T::Boolean + } ) end def to_hash diff --git a/rbi/context_dev/models/monitor_list_response.rbi b/rbi/context_dev/models/monitor_list_response.rbi index 2bb0f64f..49adf9ac 100644 --- a/rbi/context_dev/models/monitor_list_response.rbi +++ b/rbi/context_dev/models/monitor_list_response.rbi @@ -391,9 +391,10 @@ module ContextDev sig { params(confidence_threshold: Float).void } attr_writer :confidence_threshold - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or + # instruction-irrelevant differences. Which changes are meaningful is judged + # against the page or extract target's `instructions` (and an extract target's + # `schema`, when provided). sig do params(confidence_threshold: Float, type: Symbol).returns( T.attached_class @@ -654,6 +655,14 @@ module ContextDev sig { returns(String) } attr_accessor :url + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + sig { returns(T.nilable(String)) } + attr_reader :instructions + + sig { params(instructions: String).void } + attr_writer :instructions + # Normalize whitespace before comparing or analyzing text. sig { returns(T.nilable(T::Boolean)) } attr_reader :normalize_whitespace @@ -661,16 +670,21 @@ module ContextDev sig { params(normalize_whitespace: T::Boolean).void } attr_writer :normalize_whitespace - # Watch a single web page. + # Watch a single web page. Exact detection reports visible-text diffs; semantic + # detection judges confirmed stable diffs against `instructions`. sig do params( url: String, + instructions: String, normalize_whitespace: T::Boolean, type: Symbol ).returns(T.attached_class) end def self.new( url:, + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + instructions: nil, # Normalize whitespace before comparing or analyzing text. normalize_whitespace: nil, type: :page @@ -679,7 +693,12 @@ module ContextDev sig do override.returns( - { type: Symbol, url: String, normalize_whitespace: T::Boolean } + { + type: Symbol, + url: String, + instructions: String, + normalize_whitespace: T::Boolean + } ) end def to_hash diff --git a/rbi/context_dev/models/monitor_retrieve_response.rbi b/rbi/context_dev/models/monitor_retrieve_response.rbi index 09f6757b..c9b79699 100644 --- a/rbi/context_dev/models/monitor_retrieve_response.rbi +++ b/rbi/context_dev/models/monitor_retrieve_response.rbi @@ -338,9 +338,10 @@ module ContextDev sig { params(confidence_threshold: Float).void } attr_writer :confidence_threshold - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or + # instruction-irrelevant differences. Which changes are meaningful is judged + # against the page or extract target's `instructions` (and an extract target's + # `schema`, when provided). sig do params(confidence_threshold: Float, type: Symbol).returns( T.attached_class @@ -598,6 +599,14 @@ module ContextDev sig { returns(String) } attr_accessor :url + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + sig { returns(T.nilable(String)) } + attr_reader :instructions + + sig { params(instructions: String).void } + attr_writer :instructions + # Normalize whitespace before comparing or analyzing text. sig { returns(T.nilable(T::Boolean)) } attr_reader :normalize_whitespace @@ -605,16 +614,21 @@ module ContextDev sig { params(normalize_whitespace: T::Boolean).void } attr_writer :normalize_whitespace - # Watch a single web page. + # Watch a single web page. Exact detection reports visible-text diffs; semantic + # detection judges confirmed stable diffs against `instructions`. sig do params( url: String, + instructions: String, normalize_whitespace: T::Boolean, type: Symbol ).returns(T.attached_class) end def self.new( url:, + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + instructions: nil, # Normalize whitespace before comparing or analyzing text. normalize_whitespace: nil, type: :page @@ -623,7 +637,12 @@ module ContextDev sig do override.returns( - { type: Symbol, url: String, normalize_whitespace: T::Boolean } + { + type: Symbol, + url: String, + instructions: String, + normalize_whitespace: T::Boolean + } ) end def to_hash diff --git a/rbi/context_dev/models/monitor_update_params.rbi b/rbi/context_dev/models/monitor_update_params.rbi index fb9240b0..1d0532af 100644 --- a/rbi/context_dev/models/monitor_update_params.rbi +++ b/rbi/context_dev/models/monitor_update_params.rbi @@ -233,9 +233,10 @@ module ContextDev sig { params(confidence_threshold: Float).void } attr_writer :confidence_threshold - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or + # instruction-irrelevant differences. Which changes are meaningful is judged + # against the page or extract target's `instructions` (and an extract target's + # `schema`, when provided). sig do params(confidence_threshold: Float, type: Symbol).returns( T.attached_class @@ -431,6 +432,14 @@ module ContextDev sig { returns(String) } attr_accessor :url + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + sig { returns(T.nilable(String)) } + attr_reader :instructions + + sig { params(instructions: String).void } + attr_writer :instructions + # Normalize whitespace before comparing or analyzing text. sig { returns(T.nilable(T::Boolean)) } attr_reader :normalize_whitespace @@ -438,16 +447,21 @@ module ContextDev sig { params(normalize_whitespace: T::Boolean).void } attr_writer :normalize_whitespace - # Watch a single web page. + # Watch a single web page. Exact detection reports visible-text diffs; semantic + # detection judges confirmed stable diffs against `instructions`. sig do params( url: String, + instructions: String, normalize_whitespace: T::Boolean, type: Symbol ).returns(T.attached_class) end def self.new( url:, + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + instructions: nil, # Normalize whitespace before comparing or analyzing text. normalize_whitespace: nil, type: :page @@ -456,7 +470,12 @@ module ContextDev sig do override.returns( - { type: Symbol, url: String, normalize_whitespace: T::Boolean } + { + type: Symbol, + url: String, + instructions: String, + normalize_whitespace: T::Boolean + } ) end def to_hash diff --git a/rbi/context_dev/models/monitor_update_response.rbi b/rbi/context_dev/models/monitor_update_response.rbi index 823d0515..679acd7a 100644 --- a/rbi/context_dev/models/monitor_update_response.rbi +++ b/rbi/context_dev/models/monitor_update_response.rbi @@ -330,9 +330,10 @@ module ContextDev sig { params(confidence_threshold: Float).void } attr_writer :confidence_threshold - # Detect meaning-level changes to tracked page content, ignoring cosmetic or - # paraphrase-only differences. Which changes are meaningful is judged against the - # extract target's `instructions` (and `schema`, when provided). + # Detect meaning-level changes to page content, ignoring cosmetic or + # instruction-irrelevant differences. Which changes are meaningful is judged + # against the page or extract target's `instructions` (and an extract target's + # `schema`, when provided). sig do params(confidence_threshold: Float, type: Symbol).returns( T.attached_class @@ -590,6 +591,14 @@ module ContextDev sig { returns(String) } attr_accessor :url + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + sig { returns(T.nilable(String)) } + attr_reader :instructions + + sig { params(instructions: String).void } + attr_writer :instructions + # Normalize whitespace before comparing or analyzing text. sig { returns(T.nilable(T::Boolean)) } attr_reader :normalize_whitespace @@ -597,16 +606,21 @@ module ContextDev sig { params(normalize_whitespace: T::Boolean).void } attr_writer :normalize_whitespace - # Watch a single web page. + # Watch a single web page. Exact detection reports visible-text diffs; semantic + # detection judges confirmed stable diffs against `instructions`. sig do params( url: String, + instructions: String, normalize_whitespace: T::Boolean, type: Symbol ).returns(T.attached_class) end def self.new( url:, + # Plain-language goal describing which page changes matter. When provided without + # change_detection, semantic detection is inferred. + instructions: nil, # Normalize whitespace before comparing or analyzing text. normalize_whitespace: nil, type: :page @@ -615,7 +629,12 @@ module ContextDev sig do override.returns( - { type: Symbol, url: String, normalize_whitespace: T::Boolean } + { + type: Symbol, + url: String, + instructions: String, + normalize_whitespace: T::Boolean + } ) end def to_hash diff --git a/sig/context_dev/models/monitor_create_params.rbs b/sig/context_dev/models/monitor_create_params.rbs index e81c7ce8..03eb8530 100644 --- a/sig/context_dev/models/monitor_create_params.rbs +++ b/sig/context_dev/models/monitor_create_params.rbs @@ -74,19 +74,30 @@ module ContextDev module Target extend ContextDev::Internal::Type::Union - type page = { type: :page, url: String, normalize_whitespace: bool } + type page = + { + type: :page, + url: String, + instructions: String, + normalize_whitespace: bool + } class Page < ContextDev::Internal::Type::BaseModel attr_accessor type: :page attr_accessor url: String + attr_reader instructions: String? + + def instructions=: (String) -> String + attr_reader normalize_whitespace: bool? def normalize_whitespace=: (bool) -> bool def initialize: ( url: String, + ?instructions: String, ?normalize_whitespace: bool, ?type: :page ) -> void @@ -94,6 +105,7 @@ module ContextDev def to_hash: -> { type: :page, url: String, + instructions: String, normalize_whitespace: bool } end diff --git a/sig/context_dev/models/monitor_create_response.rbs b/sig/context_dev/models/monitor_create_response.rbs index e3e31e73..9f40facb 100644 --- a/sig/context_dev/models/monitor_create_response.rbs +++ b/sig/context_dev/models/monitor_create_response.rbs @@ -219,19 +219,30 @@ module ContextDev module Target extend ContextDev::Internal::Type::Union - type page = { type: :page, url: String, normalize_whitespace: bool } + type page = + { + type: :page, + url: String, + instructions: String, + normalize_whitespace: bool + } class Page < ContextDev::Internal::Type::BaseModel attr_accessor type: :page attr_accessor url: String + attr_reader instructions: String? + + def instructions=: (String) -> String + attr_reader normalize_whitespace: bool? def normalize_whitespace=: (bool) -> bool def initialize: ( url: String, + ?instructions: String, ?normalize_whitespace: bool, ?type: :page ) -> void @@ -239,6 +250,7 @@ module ContextDev def to_hash: -> { type: :page, url: String, + instructions: String, normalize_whitespace: bool } end diff --git a/sig/context_dev/models/monitor_list_response.rbs b/sig/context_dev/models/monitor_list_response.rbs index 4867b274..a82ef1c9 100644 --- a/sig/context_dev/models/monitor_list_response.rbs +++ b/sig/context_dev/models/monitor_list_response.rbs @@ -240,19 +240,30 @@ module ContextDev module Target extend ContextDev::Internal::Type::Union - type page = { type: :page, url: String, normalize_whitespace: bool } + type page = + { + type: :page, + url: String, + instructions: String, + normalize_whitespace: bool + } class Page < ContextDev::Internal::Type::BaseModel attr_accessor type: :page attr_accessor url: String + attr_reader instructions: String? + + def instructions=: (String) -> String + attr_reader normalize_whitespace: bool? def normalize_whitespace=: (bool) -> bool def initialize: ( url: String, + ?instructions: String, ?normalize_whitespace: bool, ?type: :page ) -> void @@ -260,6 +271,7 @@ module ContextDev def to_hash: -> { type: :page, url: String, + instructions: String, normalize_whitespace: bool } end diff --git a/sig/context_dev/models/monitor_retrieve_response.rbs b/sig/context_dev/models/monitor_retrieve_response.rbs index 4838d7bf..f19d8fd0 100644 --- a/sig/context_dev/models/monitor_retrieve_response.rbs +++ b/sig/context_dev/models/monitor_retrieve_response.rbs @@ -214,19 +214,30 @@ module ContextDev module Target extend ContextDev::Internal::Type::Union - type page = { type: :page, url: String, normalize_whitespace: bool } + type page = + { + type: :page, + url: String, + instructions: String, + normalize_whitespace: bool + } class Page < ContextDev::Internal::Type::BaseModel attr_accessor type: :page attr_accessor url: String + attr_reader instructions: String? + + def instructions=: (String) -> String + attr_reader normalize_whitespace: bool? def normalize_whitespace=: (bool) -> bool def initialize: ( url: String, + ?instructions: String, ?normalize_whitespace: bool, ?type: :page ) -> void @@ -234,6 +245,7 @@ module ContextDev def to_hash: -> { type: :page, url: String, + instructions: String, normalize_whitespace: bool } end diff --git a/sig/context_dev/models/monitor_update_params.rbs b/sig/context_dev/models/monitor_update_params.rbs index d709e609..42772793 100644 --- a/sig/context_dev/models/monitor_update_params.rbs +++ b/sig/context_dev/models/monitor_update_params.rbs @@ -182,19 +182,30 @@ module ContextDev module Target extend ContextDev::Internal::Type::Union - type page = { type: :page, url: String, normalize_whitespace: bool } + type page = + { + type: :page, + url: String, + instructions: String, + normalize_whitespace: bool + } class Page < ContextDev::Internal::Type::BaseModel attr_accessor type: :page attr_accessor url: String + attr_reader instructions: String? + + def instructions=: (String) -> String + attr_reader normalize_whitespace: bool? def normalize_whitespace=: (bool) -> bool def initialize: ( url: String, + ?instructions: String, ?normalize_whitespace: bool, ?type: :page ) -> void @@ -202,6 +213,7 @@ module ContextDev def to_hash: -> { type: :page, url: String, + instructions: String, normalize_whitespace: bool } end diff --git a/sig/context_dev/models/monitor_update_response.rbs b/sig/context_dev/models/monitor_update_response.rbs index 2009d7a3..0d42df58 100644 --- a/sig/context_dev/models/monitor_update_response.rbs +++ b/sig/context_dev/models/monitor_update_response.rbs @@ -214,19 +214,30 @@ module ContextDev module Target extend ContextDev::Internal::Type::Union - type page = { type: :page, url: String, normalize_whitespace: bool } + type page = + { + type: :page, + url: String, + instructions: String, + normalize_whitespace: bool + } class Page < ContextDev::Internal::Type::BaseModel attr_accessor type: :page attr_accessor url: String + attr_reader instructions: String? + + def instructions=: (String) -> String + attr_reader normalize_whitespace: bool? def normalize_whitespace=: (bool) -> bool def initialize: ( url: String, + ?instructions: String, ?normalize_whitespace: bool, ?type: :page ) -> void @@ -234,6 +245,7 @@ module ContextDev def to_hash: -> { type: :page, url: String, + instructions: String, normalize_whitespace: bool } end From eba38091bad75756c9a4b853c6ee068622752545 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 07:19:14 +0000 Subject: [PATCH 03/11] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3f4cd2e0..6183d03e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-91f4286859fc23813c5255b877395c87dd81520c3913fdfdae3cfa343e1a4873.yml -openapi_spec_hash: 71746b5b65f20617ee021e071d5f7f92 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-9ee1d9a454772b4cd978d5e0ad8ead21d732fa559686130daf0540084b5f6be5.yml +openapi_spec_hash: fb66e1f80fb2aad8adc4ae37d69bdc02 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 From d7a46695c2ba5ec1f54eaedec751bfd1d1559c4b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 07:57:55 +0000 Subject: [PATCH 04/11] feat(api): manual updates --- .stats.yml | 6 +- lib/context_dev.rb | 11 + lib/context_dev/client.rb | 4 + lib/context_dev/models.rb | 10 + lib/context_dev/models/batch_cancel_params.rb | 35 + .../models/batch_cancel_response.rb | 369 +++++ .../models/batch_get_results_params.rb | 52 + .../models/batch_get_results_response.rb | 463 ++++++ lib/context_dev/models/batch_list_params.rb | 66 + lib/context_dev/models/batch_list_response.rb | 403 +++++ .../models/batch_retrieve_params.rb | 35 + .../models/batch_retrieve_response.rb | 405 +++++ lib/context_dev/models/batch_submit_params.rb | 56 + .../models/batch_submit_response.rb | 614 ++++++++ lib/context_dev/resources/batch.rb | 169 +++ rbi/context_dev/client.rbi | 3 + rbi/context_dev/models.rbi | 10 + .../models/batch_cancel_params.rbi | 58 + .../models/batch_cancel_response.rbi | 673 +++++++++ .../models/batch_get_results_params.rbi | 85 ++ .../models/batch_get_results_response.rbi | 848 +++++++++++ rbi/context_dev/models/batch_list_params.rbi | 113 ++ .../models/batch_list_response.rbi | 783 ++++++++++ .../models/batch_retrieve_params.rbi | 58 + .../models/batch_retrieve_response.rbi | 742 +++++++++ .../models/batch_submit_params.rbi | 105 ++ .../models/batch_submit_response.rbi | 1330 +++++++++++++++++ rbi/context_dev/resources/batch.rbi | 129 ++ sig/context_dev/client.rbs | 2 + sig/context_dev/models.rbs | 10 + .../models/batch_cancel_params.rbs | 30 + .../models/batch_cancel_response.rbs | 273 ++++ .../models/batch_get_results_params.rbs | 47 + .../models/batch_get_results_response.rbs | 399 +++++ sig/context_dev/models/batch_list_params.rbs | 67 + .../models/batch_list_response.rbs | 311 ++++ .../models/batch_retrieve_params.rbs | 30 + .../models/batch_retrieve_response.rbs | 297 ++++ .../models/batch_submit_params.rbs | 52 + .../models/batch_submit_response.rbs | 542 +++++++ sig/context_dev/resources/batch.rbs | 42 + test/context_dev/resources/batch_test.rb | 119 ++ 42 files changed, 9853 insertions(+), 3 deletions(-) create mode 100644 lib/context_dev/models/batch_cancel_params.rb create mode 100644 lib/context_dev/models/batch_cancel_response.rb create mode 100644 lib/context_dev/models/batch_get_results_params.rb create mode 100644 lib/context_dev/models/batch_get_results_response.rb create mode 100644 lib/context_dev/models/batch_list_params.rb create mode 100644 lib/context_dev/models/batch_list_response.rb create mode 100644 lib/context_dev/models/batch_retrieve_params.rb create mode 100644 lib/context_dev/models/batch_retrieve_response.rb create mode 100644 lib/context_dev/models/batch_submit_params.rb create mode 100644 lib/context_dev/models/batch_submit_response.rb create mode 100644 lib/context_dev/resources/batch.rb create mode 100644 rbi/context_dev/models/batch_cancel_params.rbi create mode 100644 rbi/context_dev/models/batch_cancel_response.rbi create mode 100644 rbi/context_dev/models/batch_get_results_params.rbi create mode 100644 rbi/context_dev/models/batch_get_results_response.rbi create mode 100644 rbi/context_dev/models/batch_list_params.rbi create mode 100644 rbi/context_dev/models/batch_list_response.rbi create mode 100644 rbi/context_dev/models/batch_retrieve_params.rbi create mode 100644 rbi/context_dev/models/batch_retrieve_response.rbi create mode 100644 rbi/context_dev/models/batch_submit_params.rbi create mode 100644 rbi/context_dev/models/batch_submit_response.rbi create mode 100644 rbi/context_dev/resources/batch.rbi create mode 100644 sig/context_dev/models/batch_cancel_params.rbs create mode 100644 sig/context_dev/models/batch_cancel_response.rbs create mode 100644 sig/context_dev/models/batch_get_results_params.rbs create mode 100644 sig/context_dev/models/batch_get_results_response.rbs create mode 100644 sig/context_dev/models/batch_list_params.rbs create mode 100644 sig/context_dev/models/batch_list_response.rbs create mode 100644 sig/context_dev/models/batch_retrieve_params.rbs create mode 100644 sig/context_dev/models/batch_retrieve_response.rbs create mode 100644 sig/context_dev/models/batch_submit_params.rbs create mode 100644 sig/context_dev/models/batch_submit_response.rbs create mode 100644 sig/context_dev/resources/batch.rbs create mode 100644 test/context_dev/resources/batch_test.rb diff --git a/.stats.yml b/.stats.yml index 6183d03e..a173ebea 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-9ee1d9a454772b4cd978d5e0ad8ead21d732fa559686130daf0540084b5f6be5.yml +configured_endpoints: 37 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-6dfc33639ef5ad1fd0fa05f9f00fcdd59940188ef625252c6ee9db85c6f8fc59.yml openapi_spec_hash: fb66e1f80fb2aad8adc4ae37d69bdc02 -config_hash: 70e7e80b5e87f94981bee396c6cd41e8 +config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/lib/context_dev.rb b/lib/context_dev.rb index db04657e..c019087a 100644 --- a/lib/context_dev.rb +++ b/lib/context_dev.rb @@ -56,6 +56,16 @@ require_relative "context_dev/models/ai_extract_product_response" require_relative "context_dev/models/ai_extract_products_params" require_relative "context_dev/models/ai_extract_products_response" +require_relative "context_dev/models/batch_cancel_params" +require_relative "context_dev/models/batch_cancel_response" +require_relative "context_dev/models/batch_get_results_params" +require_relative "context_dev/models/batch_get_results_response" +require_relative "context_dev/models/batch_list_params" +require_relative "context_dev/models/batch_list_response" +require_relative "context_dev/models/batch_retrieve_params" +require_relative "context_dev/models/batch_retrieve_response" +require_relative "context_dev/models/batch_submit_params" +require_relative "context_dev/models/batch_submit_response" require_relative "context_dev/models/brand_retrieve_params" require_relative "context_dev/models/brand_retrieve_response" require_relative "context_dev/models/brand_retrieve_simplified_params" @@ -119,6 +129,7 @@ require_relative "context_dev/models/web_web_scrape_sitemap_response" require_relative "context_dev/models" require_relative "context_dev/resources/ai" +require_relative "context_dev/resources/batch" require_relative "context_dev/resources/brand" require_relative "context_dev/resources/industry" require_relative "context_dev/resources/monitors" diff --git a/lib/context_dev/client.rb b/lib/context_dev/client.rb index c7135c38..0bbba0d3 100644 --- a/lib/context_dev/client.rb +++ b/lib/context_dev/client.rb @@ -43,6 +43,9 @@ class Client < ContextDev::Internal::Transport::BaseClient # @return [ContextDev::Resources::Monitors] attr_reader :monitors + # @return [ContextDev::Resources::Batch] + attr_reader :batch + # @api private # # @return [Hash{String=>String}] @@ -111,6 +114,7 @@ def initialize( @industry = ContextDev::Resources::Industry.new(client: self) @utility = ContextDev::Resources::Utility.new(client: self) @monitors = ContextDev::Resources::Monitors.new(client: self) + @batch = ContextDev::Resources::Batch.new(client: self) end end end diff --git a/lib/context_dev/models.rb b/lib/context_dev/models.rb index 1fba5578..7e8287ab 100644 --- a/lib/context_dev/models.rb +++ b/lib/context_dev/models.rb @@ -43,6 +43,16 @@ module ContextDev AIExtractProductsParams = ContextDev::Models::AIExtractProductsParams + BatchCancelParams = ContextDev::Models::BatchCancelParams + + BatchGetResultsParams = ContextDev::Models::BatchGetResultsParams + + BatchListParams = ContextDev::Models::BatchListParams + + BatchRetrieveParams = ContextDev::Models::BatchRetrieveParams + + BatchSubmitParams = ContextDev::Models::BatchSubmitParams + BrandRetrieveParams = ContextDev::Models::BrandRetrieveParams BrandRetrieveSimplifiedParams = ContextDev::Models::BrandRetrieveSimplifiedParams diff --git a/lib/context_dev/models/batch_cancel_params.rb b/lib/context_dev/models/batch_cancel_params.rb new file mode 100644 index 00000000..0a888d0a --- /dev/null +++ b/lib/context_dev/models/batch_cancel_params.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::Batch#cancel + class BatchCancelParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + # @!attribute batch_id + # ID of the batch to retrieve or cancel. + # + # @return [String] + required :batch_id, String + + # @!attribute tags + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + # + # @return [Array, nil] + optional :tags, ContextDev::Internal::Type::ArrayOf[String] + + # @!method initialize(batch_id:, tags: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchCancelParams} for more details. + # + # @param batch_id [String] ID of the batch to retrieve or cancel. + # + # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/context_dev/models/batch_cancel_response.rb b/lib/context_dev/models/batch_cancel_response.rb new file mode 100644 index 00000000..dbd82958 --- /dev/null +++ b/lib/context_dev/models/batch_cancel_response.rb @@ -0,0 +1,369 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::Batch#cancel + class BatchCancelResponse < ContextDev::Internal::Type::BaseModel + # @!attribute id + # Batch ID used to retrieve or cancel the job. + # + # @return [String] + required :id, String + + # @!attribute credits + # Reserved and used credits. + # + # @return [ContextDev::Models::BatchCancelResponse::Credits] + required :credits, -> { ContextDev::Models::BatchCancelResponse::Credits } + + # @!attribute error + # Batch-level error. Null unless `status` is `failed`. + # + # @return [ContextDev::Models::BatchCancelResponse::Error, nil] + required :error, -> { ContextDev::Models::BatchCancelResponse::Error }, nil?: true + + # @!attribute errors + # Page failures grouped by error code. + # + # @return [Array] + required :errors, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchCancelResponse::Error] } + + # @!attribute input + # Submission counts. + # + # @return [ContextDev::Models::BatchCancelResponse::Input] + required :input, -> { ContextDev::Models::BatchCancelResponse::Input } + + # @!attribute mode + # How pages are selected. + # + # @return [Symbol, ContextDev::Models::BatchCancelResponse::Mode] + required :mode, enum: -> { ContextDev::Models::BatchCancelResponse::Mode } + + # @!attribute progress + # Current processing counts. Use `status` to check completion. + # + # @return [ContextDev::Models::BatchCancelResponse::Progress] + required :progress, -> { ContextDev::Models::BatchCancelResponse::Progress } + + # @!attribute results + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + # + # @return [ContextDev::Models::BatchCancelResponse::Results, nil] + required :results, -> { ContextDev::Models::BatchCancelResponse::Results }, nil?: true + + # @!attribute status + # Current state. `completed`, `cancelled`, and `failed` are final. + # + # @return [Symbol, ContextDev::Models::BatchCancelResponse::Status] + required :status, enum: -> { ContextDev::Models::BatchCancelResponse::Status } + + # @!attribute timing + # + # @return [ContextDev::Models::BatchCancelResponse::Timing] + required :timing, -> { ContextDev::Models::BatchCancelResponse::Timing } + + # @!attribute type + # Output format. + # + # @return [Symbol, ContextDev::Models::BatchCancelResponse::Type] + required :type, enum: -> { ContextDev::Models::BatchCancelResponse::Type } + + # @!attribute key_metadata + # API key usage for this request. + # + # @return [ContextDev::Models::BatchCancelResponse::KeyMetadata, nil] + optional :key_metadata, -> { ContextDev::Models::BatchCancelResponse::KeyMetadata } + + # @!method initialize(id:, credits:, error:, errors:, input:, mode:, progress:, results:, status:, timing:, type:, key_metadata: nil) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchCancelResponse} for more details. + # + # @param id [String] Batch ID used to retrieve or cancel the job. + # + # @param credits [ContextDev::Models::BatchCancelResponse::Credits] Reserved and used credits. + # + # @param error [ContextDev::Models::BatchCancelResponse::Error, nil] Batch-level error. Null unless `status` is `failed`. + # + # @param errors [Array] Page failures grouped by error code. + # + # @param input [ContextDev::Models::BatchCancelResponse::Input] Submission counts. + # + # @param mode [Symbol, ContextDev::Models::BatchCancelResponse::Mode] How pages are selected. + # + # @param progress [ContextDev::Models::BatchCancelResponse::Progress] Current processing counts. Use `status` to check completion. + # + # @param results [ContextDev::Models::BatchCancelResponse::Results, nil] Download links available when the batch finishes. GET /batch/{batch_id}/results + # + # @param status [Symbol, ContextDev::Models::BatchCancelResponse::Status] Current state. `completed`, `cancelled`, and `failed` are final. + # + # @param timing [ContextDev::Models::BatchCancelResponse::Timing] + # + # @param type [Symbol, ContextDev::Models::BatchCancelResponse::Type] Output format. + # + # @param key_metadata [ContextDev::Models::BatchCancelResponse::KeyMetadata] API key usage for this request. + + # @see ContextDev::Models::BatchCancelResponse#credits + class Credits < ContextDev::Internal::Type::BaseModel + # @!attribute charged + # Credits used by successful pages. + # + # @return [Integer] + required :charged, Integer + + # @!attribute estimated + # Credits reserved when the batch was accepted. + # + # @return [Integer] + required :estimated, Integer + + # @!method initialize(charged:, estimated:) + # Reserved and used credits. + # + # @param charged [Integer] Credits used by successful pages. + # + # @param estimated [Integer] Credits reserved when the batch was accepted. + end + + # @see ContextDev::Models::BatchCancelResponse#error + class Error < ContextDev::Internal::Type::BaseModel + # @!attribute code + # Batch error code. + # + # @return [String] + required :code, String + + # @!attribute message + # Batch error message. + # + # @return [String] + required :message, String + + # @!method initialize(code:, message:) + # Batch-level error. Null unless `status` is `failed`. + # + # @param code [String] Batch error code. + # + # @param message [String] Batch error message. + end + + # @see ContextDev::Models::BatchCancelResponse#input + class Input < ContextDev::Internal::Type::BaseModel + # @!attribute accepted + # Pages accepted, or the crawl page limit. Credits are reserved for this count. + # + # @return [Integer] + required :accepted, Integer + + # @!attribute duplicates + # Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + # + # @return [Integer] + required :duplicates, Integer + + # @!attribute invalid + # Pages rejected during validation. + # + # @return [Integer] + required :invalid, Integer + + # @!attribute submitted + # Pages submitted before validation. For a crawl, the page limit. + # + # @return [Integer] + required :submitted, Integer + + # @!method initialize(accepted:, duplicates:, invalid:, submitted:) + # Submission counts. + # + # @param accepted [Integer] Pages accepted, or the crawl page limit. Credits are reserved for this count. + # + # @param duplicates [Integer] Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + # + # @param invalid [Integer] Pages rejected during validation. + # + # @param submitted [Integer] Pages submitted before validation. For a crawl, the page limit. + end + + # How pages are selected. + # + # @see ContextDev::Models::BatchCancelResponse#mode + module Mode + extend ContextDev::Internal::Type::Enum + + SCRAPE = :scrape + CRAWL = :crawl + + # @!method self.values + # @return [Array] + end + + # @see ContextDev::Models::BatchCancelResponse#progress + class Progress < ContextDev::Internal::Type::BaseModel + # @!attribute failed + # Pages that could not be scraped. + # + # @return [Integer] + required :failed, Integer + + # @!attribute pending + # Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can + # finish under its page limit when the site has no more reachable 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::BatchCancelResponse::Progress} for more details. + # + # Current processing counts. Use `status` to check completion. + # + # @param failed [Integer] Pages that could not be scraped. + # + # @param pending [Integer] Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can + # + # @param succeeded [Integer] Pages scraped successfully. + end + + # @see ContextDev::Models::BatchCancelResponse#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] + required :files, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchCancelResponse::Results::File] } + + # @!method initialize(expires_at:, files:) + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + # + # @param expires_at [String] When the download URLs expire. + # + # @param files [Array] 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::BatchCancelResponse#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] + end + + # @see ContextDev::Models::BatchCancelResponse#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 + + # Output format. + # + # @see ContextDev::Models::BatchCancelResponse#type + module Type + extend ContextDev::Internal::Type::Enum + + MARKDOWN = :markdown + HTML = :html + + # @!method self.values + # @return [Array] + end + + # @see ContextDev::Models::BatchCancelResponse#key_metadata + class KeyMetadata < ContextDev::Internal::Type::BaseModel + # @!attribute credits_consumed + # The number of credits consumed by this request. + # + # @return [Integer] + required :credits_consumed, Integer + + # @!attribute credits_remaining + # The number of credits remaining for your organization after this request. + # + # @return [Integer] + required :credits_remaining, Integer + + # @!method initialize(credits_consumed:, credits_remaining:) + # API key usage for this request. + # + # @param credits_consumed [Integer] The number of credits consumed by this request. + # + # @param credits_remaining [Integer] The number of credits remaining for your organization after this request. + end + end + end +end diff --git a/lib/context_dev/models/batch_get_results_params.rb b/lib/context_dev/models/batch_get_results_params.rb new file mode 100644 index 00000000..08636146 --- /dev/null +++ b/lib/context_dev/models/batch_get_results_params.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::Batch#get_results + class BatchGetResultsParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + # @!attribute batch_id + # ID of the batch to retrieve or cancel. + # + # @return [String] + required :batch_id, String + + # @!attribute cursor + # next_cursor from the previous page. + # + # @return [String, nil] + optional :cursor, String + + # @!attribute limit + # Records per page. Defaults to 25. A page can close early so its payload stays + # under ~8 MB; rely on next_cursor rather than counting records. + # + # @return [Integer, nil] + optional :limit, Integer + + # @!attribute tags + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + # + # @return [Array, nil] + optional :tags, ContextDev::Internal::Type::ArrayOf[String] + + # @!method initialize(batch_id:, cursor: nil, limit: nil, tags: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchGetResultsParams} for more details. + # + # @param batch_id [String] ID of the batch to retrieve or cancel. + # + # @param cursor [String] next_cursor from the previous page. + # + # @param limit [Integer] Records per page. Defaults to 25. A page can close early so its payload stays un + # + # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/context_dev/models/batch_get_results_response.rb b/lib/context_dev/models/batch_get_results_response.rb new file mode 100644 index 00000000..e87ded0b --- /dev/null +++ b/lib/context_dev/models/batch_get_results_response.rb @@ -0,0 +1,463 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::Batch#get_results + class BatchGetResultsResponse < ContextDev::Internal::Type::BaseModel + # @!attribute data + # Result records on this page. + # + # @return [Array, nil] + optional :data, + -> { ContextDev::Internal::Type::ArrayOf[union: ContextDev::Models::BatchGetResultsResponse::Data] } + + # @!attribute has_more + # Whether another page is available. + # + # @return [Boolean, nil] + optional :has_more, ContextDev::Internal::Type::Boolean + + # @!attribute key_metadata + # 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. + # + # @return [ContextDev::Models::BatchGetResultsResponse::KeyMetadata, nil] + optional :key_metadata, -> { ContextDev::Models::BatchGetResultsResponse::KeyMetadata } + + # @!attribute next_cursor + # Cursor for the next page. + # + # @return [String, nil] + optional :next_cursor, String, nil?: true + + # @!method initialize(data: nil, has_more: nil, key_metadata: nil, next_cursor: nil) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchGetResultsResponse} for more details. + # + # @param data [Array] Result records on this page. + # + # @param has_more [Boolean] Whether another page is available. + # + # @param key_metadata [ContextDev::Models::BatchGetResultsResponse::KeyMetadata] Metadata about the API key used for the request. Included in every response when + # + # @param next_cursor [String, nil] Cursor for the next page. + + # One page outcome from a finished batch. + module Data + extend ContextDev::Internal::Type::Union + + discriminator :status + + # A page the batch fetched successfully. + variant :ok, -> { ContextDev::Models::BatchGetResultsResponse::Data::Ok } + + # A page the batch could not fetch. + variant :error, -> { ContextDev::Models::BatchGetResultsResponse::Data::Error } + + class Ok < ContextDev::Internal::Type::BaseModel + # @!attribute final_url + # URL the content was read from, after redirects. + # + # @return [String] + required :final_url, String + + # @!attribute http_status + # HTTP status of the final response, when known. + # + # @return [Integer, nil] + required :http_status, Integer, nil?: true + + # @!attribute metadata + # Metadata extracted from the scraped page HTML. + # + # @return [ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata] + required :metadata, -> { ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata } + + # @!attribute status + # The page was scraped. + # + # @return [Symbol, :ok] + required :status, const: :ok + + # @!attribute url + # URL as submitted, or as discovered by the crawl. + # + # @return [String] + required :url, String + + # @!attribute html + # Raw page HTML. Present on html batches. + # + # @return [String, nil] + optional :html, String + + # @!attribute item_id + # Caller-supplied identifier echoed from submission. + # + # @return [String, nil] + optional :item_id, String, api_name: :itemId + + # @!attribute markdown + # Page content as Markdown. Present on markdown batches. + # + # @return [String, nil] + optional :markdown, String + + # @!attribute meta + # Caller-supplied metadata echoed from submission. + # + # @return [Hash{Symbol=>Object}, nil] + optional :meta, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown] + + # @!method initialize(final_url:, http_status:, metadata:, url:, html: nil, item_id: nil, markdown: nil, meta: nil, status: :ok) + # A page the batch fetched successfully. + # + # @param final_url [String] URL the content was read from, after redirects. + # + # @param http_status [Integer, nil] HTTP status of the final response, when known. + # + # @param metadata [ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata] Metadata extracted from the scraped page HTML. + # + # @param url [String] URL as submitted, or as discovered by the crawl. + # + # @param html [String] Raw page HTML. Present on html batches. + # + # @param item_id [String] Caller-supplied identifier echoed from submission. + # + # @param markdown [String] Page content as Markdown. Present on markdown batches. + # + # @param meta [Hash{Symbol=>Object}] Caller-supplied metadata echoed from submission. + # + # @param status [Symbol, :ok] The page was scraped. + + # @see ContextDev::Models::BatchGetResultsResponse::Data::Ok#metadata + class Metadata < ContextDev::Internal::Type::BaseModel + # @!attribute final_url + # Final URL scraped after redirects or scraper fallback, when known. Falls back to + # sourceUrl when unavailable. + # + # @return [String] + required :final_url, String, api_name: :finalUrl + + # @!attribute source_url + # Original URL requested by the caller. + # + # @return [String] + required :source_url, String, api_name: :sourceUrl + + # @!attribute additional_meta + # Additional non-social meta tags not promoted to top-level metadata fields. + # + # @return [Hash{Symbol=>String, Array}, nil] + optional :additional_meta, + -> { ContextDev::Internal::Type::HashOf[union: ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::AdditionalMeta] }, + api_name: :additionalMeta + + # @!attribute alternates + # Resolved alternate links from link rel=alternate tags. + # + # @return [Array, nil] + optional :alternates, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Alternate] } + + # @!attribute author + # Author metadata, when present. + # + # @return [String, nil] + optional :author, String + + # @!attribute canonical_url + # Resolved canonical URL, when present. + # + # @return [String, nil] + optional :canonical_url, String, api_name: :canonicalUrl + + # @!attribute description + # Best description extracted from standard, Open Graph, or Twitter metadata. + # + # @return [String, nil] + optional :description, String + + # @!attribute favicon + # Resolved favicon URL, when present. + # + # @return [String, nil] + optional :favicon, String + + # @!attribute image + # Primary resolved preview image from Open Graph, Twitter, or image metadata. + # + # @return [String, nil] + optional :image, String + + # @!attribute json_ld + # JSON-LD structured data blocks parsed from the page. + # + # @return [ArrayObject}>, nil] + optional :json_ld, + ContextDev::Internal::Type::ArrayOf[ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]], + api_name: :jsonLd + + # @!attribute keywords + # Keywords extracted from the page's keywords meta tag. + # + # @return [Array, nil] + optional :keywords, ContextDev::Internal::Type::ArrayOf[String] + + # @!attribute language + # Language extracted from html lang or language meta tags. + # + # @return [String, nil] + optional :language, String + + # @!attribute modified_time + # Modified timestamp/date from page metadata, when present. + # + # @return [String, nil] + optional :modified_time, String, api_name: :modifiedTime + + # @!attribute open_graph + # Open Graph metadata with the og: prefix removed and keys camel-cased. + # + # @return [Hash{Symbol=>String, Array}, nil] + optional :open_graph, + -> { ContextDev::Internal::Type::HashOf[union: ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::OpenGraph] }, + api_name: :openGraph + + # @!attribute published_time + # Published timestamp/date from page metadata, when present. + # + # @return [String, nil] + optional :published_time, String, api_name: :publishedTime + + # @!attribute robots + # Robots meta directive, when present. + # + # @return [String, nil] + optional :robots, String + + # @!attribute site_name + # Site or application name from page metadata. + # + # @return [String, nil] + optional :site_name, String, api_name: :siteName + + # @!attribute title + # Best title extracted from the page. + # + # @return [String, nil] + optional :title, String + + # @!attribute twitter + # Twitter card metadata with the twitter: prefix removed and keys camel-cased. + # + # @return [Hash{Symbol=>String, Array}, nil] + optional :twitter, + -> { ContextDev::Internal::Type::HashOf[union: ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Twitter] } + + # @!method initialize(final_url:, source_url:, additional_meta: nil, alternates: nil, author: nil, canonical_url: nil, description: nil, favicon: nil, image: nil, json_ld: nil, keywords: nil, language: nil, modified_time: nil, open_graph: nil, published_time: nil, robots: nil, site_name: nil, title: nil, twitter: nil) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata} for more + # details. + # + # Metadata extracted from the scraped page HTML. + # + # @param final_url [String] Final URL scraped after redirects or scraper fallback, when known. Falls back to + # + # @param source_url [String] Original URL requested by the caller. + # + # @param additional_meta [Hash{Symbol=>String, Array}] Additional non-social meta tags not promoted to top-level metadata fields. + # + # @param alternates [Array] Resolved alternate links from link rel=alternate tags. + # + # @param author [String] Author metadata, when present. + # + # @param canonical_url [String] Resolved canonical URL, when present. + # + # @param description [String] Best description extracted from standard, Open Graph, or Twitter metadata. + # + # @param favicon [String] Resolved favicon URL, when present. + # + # @param image [String] Primary resolved preview image from Open Graph, Twitter, or image metadata. + # + # @param json_ld [ArrayObject}>] JSON-LD structured data blocks parsed from the page. + # + # @param keywords [Array] Keywords extracted from the page's keywords meta tag. + # + # @param language [String] Language extracted from html lang or language meta tags. + # + # @param modified_time [String] Modified timestamp/date from page metadata, when present. + # + # @param open_graph [Hash{Symbol=>String, Array}] Open Graph metadata with the og: prefix removed and keys camel-cased. + # + # @param published_time [String] Published timestamp/date from page metadata, when present. + # + # @param robots [String] Robots meta directive, when present. + # + # @param site_name [String] Site or application name from page metadata. + # + # @param title [String] Best title extracted from the page. + # + # @param twitter [Hash{Symbol=>String, Array}] Twitter card metadata with the twitter: prefix removed and keys camel-cased. + + module AdditionalMeta + extend ContextDev::Internal::Type::Union + + variant String + + variant -> { ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::AdditionalMeta::StringArray } + + # @!method self.variants + # @return [Array(String, Array)] + + # @type [ContextDev::Internal::Type::Converter] + StringArray = ContextDev::Internal::Type::ArrayOf[String] + end + + class Alternate < ContextDev::Internal::Type::BaseModel + # @!attribute href + # Resolved alternate URL. + # + # @return [String] + required :href, String + + # @!attribute hreflang + # Language or locale for the alternate URL, when present. + # + # @return [String, nil] + optional :hreflang, String + + # @!attribute title + # Alternate resource title, when present. + # + # @return [String, nil] + optional :title, String + + # @!attribute type + # Alternate resource MIME type, when present. + # + # @return [String, nil] + optional :type, String + + # @!method initialize(href:, hreflang: nil, title: nil, type: nil) + # @param href [String] Resolved alternate URL. + # + # @param hreflang [String] Language or locale for the alternate URL, when present. + # + # @param title [String] Alternate resource title, when present. + # + # @param type [String] Alternate resource MIME type, when present. + end + + module OpenGraph + extend ContextDev::Internal::Type::Union + + variant String + + variant -> { ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::OpenGraph::StringArray } + + # @!method self.variants + # @return [Array(String, Array)] + + # @type [ContextDev::Internal::Type::Converter] + StringArray = ContextDev::Internal::Type::ArrayOf[String] + end + + module Twitter + extend ContextDev::Internal::Type::Union + + variant String + + variant -> { ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Twitter::StringArray } + + # @!method self.variants + # @return [Array(String, Array)] + + # @type [ContextDev::Internal::Type::Converter] + StringArray = ContextDev::Internal::Type::ArrayOf[String] + end + end + end + + class Error < ContextDev::Internal::Type::BaseModel + # @!attribute error_code + # Why the page failed. + # + # @return [String] + required :error_code, String + + # @!attribute message + # Human-readable failure detail. + # + # @return [String] + required :message, String + + # @!attribute status + # The page could not be scraped. + # + # @return [Symbol, :error] + required :status, const: :error + + # @!attribute url + # URL as submitted, or as discovered by the crawl. + # + # @return [String] + required :url, String + + # @!attribute item_id + # Caller-supplied identifier echoed from submission. + # + # @return [String, nil] + optional :item_id, String, api_name: :itemId + + # @!attribute meta + # Caller-supplied metadata echoed from submission. + # + # @return [Hash{Symbol=>Object}, nil] + optional :meta, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown] + + # @!method initialize(error_code:, message:, url:, item_id: nil, meta: nil, status: :error) + # A page the batch could not fetch. + # + # @param error_code [String] Why the page failed. + # + # @param message [String] Human-readable failure detail. + # + # @param url [String] URL as submitted, or as discovered by the crawl. + # + # @param item_id [String] Caller-supplied identifier echoed from submission. + # + # @param meta [Hash{Symbol=>Object}] Caller-supplied metadata echoed from submission. + # + # @param status [Symbol, :error] The page could not be scraped. + end + + # @!method self.variants + # @return [Array(ContextDev::Models::BatchGetResultsResponse::Data::Ok, ContextDev::Models::BatchGetResultsResponse::Data::Error)] + end + + # @see ContextDev::Models::BatchGetResultsResponse#key_metadata + class KeyMetadata < ContextDev::Internal::Type::BaseModel + # @!attribute credits_consumed + # The number of credits consumed by this request. + # + # @return [Integer] + required :credits_consumed, Integer + + # @!attribute credits_remaining + # The number of credits remaining for your organization after this request. + # + # @return [Integer] + required :credits_remaining, Integer + + # @!method initialize(credits_consumed:, credits_remaining:) + # 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. + # + # @param credits_consumed [Integer] The number of credits consumed by this request. + # + # @param credits_remaining [Integer] The number of credits remaining for your organization after this request. + end + end + end +end diff --git a/lib/context_dev/models/batch_list_params.rb b/lib/context_dev/models/batch_list_params.rb new file mode 100644 index 00000000..f5c743c6 --- /dev/null +++ b/lib/context_dev/models/batch_list_params.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::Batch#list + class BatchListParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + # @!attribute cursor + # Cursor from the previous page. + # + # @return [String, nil] + optional :cursor, String + + # @!attribute limit + # Batches per page. Defaults to 25. + # + # @return [Integer, nil] + optional :limit, Integer + + # @!attribute status + # Filter by status. + # + # @return [Symbol, ContextDev::Models::BatchListParams::Status, nil] + optional :status, enum: -> { ContextDev::BatchListParams::Status } + + # @!attribute tags + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + # + # @return [Array, nil] + optional :tags, ContextDev::Internal::Type::ArrayOf[String] + + # @!method initialize(cursor: nil, limit: nil, status: nil, tags: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchListParams} for more details. + # + # @param cursor [String] Cursor from the previous page. + # + # @param limit [Integer] Batches per page. Defaults to 25. + # + # @param status [Symbol, ContextDev::Models::BatchListParams::Status] Filter by status. + # + # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] + + # Filter by 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] + end + end + end +end diff --git a/lib/context_dev/models/batch_list_response.rb b/lib/context_dev/models/batch_list_response.rb new file mode 100644 index 00000000..c2cdd197 --- /dev/null +++ b/lib/context_dev/models/batch_list_response.rb @@ -0,0 +1,403 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::Batch#list + class BatchListResponse < ContextDev::Internal::Type::BaseModel + # @!attribute data + # Batches on this page. + # + # @return [Array, nil] + optional :data, -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchListResponse::Data] } + + # @!attribute has_more + # Whether another page is available. + # + # @return [Boolean, nil] + optional :has_more, ContextDev::Internal::Type::Boolean + + # @!attribute key_metadata + # 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. + # + # @return [ContextDev::Models::BatchListResponse::KeyMetadata, nil] + optional :key_metadata, -> { ContextDev::Models::BatchListResponse::KeyMetadata } + + # @!attribute next_cursor + # Cursor for the next page. + # + # @return [String, nil] + optional :next_cursor, String, nil?: true + + # @!method initialize(data: nil, has_more: nil, key_metadata: nil, next_cursor: nil) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchListResponse} for more details. + # + # @param data [Array] Batches on this page. + # + # @param has_more [Boolean] Whether another page is available. + # + # @param key_metadata [ContextDev::Models::BatchListResponse::KeyMetadata] Metadata about the API key used for the request. Included in every response when + # + # @param next_cursor [String, nil] Cursor for the next page. + + class Data < ContextDev::Internal::Type::BaseModel + # @!attribute id + # Batch ID used to retrieve or cancel the job. + # + # @return [String] + required :id, String + + # @!attribute credits + # Reserved and used credits. + # + # @return [ContextDev::Models::BatchListResponse::Data::Credits] + required :credits, -> { ContextDev::Models::BatchListResponse::Data::Credits } + + # @!attribute error + # Batch-level error. Null unless `status` is `failed`. + # + # @return [ContextDev::Models::BatchListResponse::Data::Error, nil] + required :error, -> { ContextDev::Models::BatchListResponse::Data::Error }, nil?: true + + # @!attribute errors + # Page failures grouped by error code. + # + # @return [Array] + required :errors, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchListResponse::Data::Error] } + + # @!attribute input + # Submission counts. + # + # @return [ContextDev::Models::BatchListResponse::Data::Input] + required :input, -> { ContextDev::Models::BatchListResponse::Data::Input } + + # @!attribute mode + # How pages are selected. + # + # @return [Symbol, ContextDev::Models::BatchListResponse::Data::Mode] + required :mode, enum: -> { ContextDev::Models::BatchListResponse::Data::Mode } + + # @!attribute progress + # Current processing counts. Use `status` to check completion. + # + # @return [ContextDev::Models::BatchListResponse::Data::Progress] + required :progress, -> { ContextDev::Models::BatchListResponse::Data::Progress } + + # @!attribute results + # Download links available when the batch finishes. 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 timing + # + # @return [ContextDev::Models::BatchListResponse::Data::Timing] + required :timing, -> { ContextDev::Models::BatchListResponse::Data::Timing } + + # @!attribute type + # Output format. + # + # @return [Symbol, ContextDev::Models::BatchListResponse::Data::Type] + required :type, enum: -> { ContextDev::Models::BatchListResponse::Data::Type } + + # @!method initialize(id:, credits:, error:, errors:, input:, mode:, progress:, results:, status:, timing:, type:) + # 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 credits [ContextDev::Models::BatchListResponse::Data::Credits] Reserved and used credits. + # + # @param error [ContextDev::Models::BatchListResponse::Data::Error, nil] Batch-level error. Null unless `status` is `failed`. + # + # @param errors [Array] Page failures grouped by error code. + # + # @param input [ContextDev::Models::BatchListResponse::Data::Input] Submission counts. + # + # @param mode [Symbol, ContextDev::Models::BatchListResponse::Data::Mode] How pages are selected. + # + # @param progress [ContextDev::Models::BatchListResponse::Data::Progress] Current processing counts. Use `status` to check completion. + # + # @param results [ContextDev::Models::BatchListResponse::Data::Results, nil] Download links available when the batch finishes. GET /batch/{batch_id}/results + # + # @param status [Symbol, ContextDev::Models::BatchListResponse::Data::Status] Current state. `completed`, `cancelled`, and `failed` are final. + # + # @param timing [ContextDev::Models::BatchListResponse::Data::Timing] + # + # @param type [Symbol, ContextDev::Models::BatchListResponse::Data::Type] Output format. + + # @see ContextDev::Models::BatchListResponse::Data#credits + class Credits < ContextDev::Internal::Type::BaseModel + # @!attribute charged + # Credits used by successful pages. + # + # @return [Integer] + required :charged, Integer + + # @!attribute estimated + # Credits reserved when the batch was accepted. + # + # @return [Integer] + required :estimated, Integer + + # @!method initialize(charged:, estimated:) + # Reserved and used credits. + # + # @param charged [Integer] Credits used by successful pages. + # + # @param estimated [Integer] Credits reserved when the batch was accepted. + end + + # @see ContextDev::Models::BatchListResponse::Data#error + class Error < ContextDev::Internal::Type::BaseModel + # @!attribute code + # Batch error code. + # + # @return [String] + required :code, String + + # @!attribute message + # Batch error message. + # + # @return [String] + required :message, String + + # @!method initialize(code:, message:) + # Batch-level error. Null unless `status` is `failed`. + # + # @param code [String] Batch error code. + # + # @param message [String] Batch error message. + end + + # @see ContextDev::Models::BatchListResponse::Data#input + class Input < ContextDev::Internal::Type::BaseModel + # @!attribute accepted + # Pages accepted, or the crawl page limit. Credits are reserved for this count. + # + # @return [Integer] + required :accepted, Integer + + # @!attribute duplicates + # Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + # + # @return [Integer] + required :duplicates, Integer + + # @!attribute invalid + # Pages rejected during validation. + # + # @return [Integer] + required :invalid, Integer + + # @!attribute submitted + # Pages submitted before validation. For a crawl, the page limit. + # + # @return [Integer] + required :submitted, Integer + + # @!method initialize(accepted:, duplicates:, invalid:, submitted:) + # Submission counts. + # + # @param accepted [Integer] Pages accepted, or the crawl page limit. Credits are reserved for this count. + # + # @param duplicates [Integer] Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + # + # @param invalid [Integer] Pages rejected during validation. + # + # @param submitted [Integer] Pages submitted before validation. For a crawl, the page limit. + end + + # How pages are selected. + # + # @see ContextDev::Models::BatchListResponse::Data#mode + module Mode + extend ContextDev::Internal::Type::Enum + + SCRAPE = :scrape + CRAWL = :crawl + + # @!method self.values + # @return [Array] + 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 + # Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can + # finish under its page limit when the site has no more reachable 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. + # + # Current processing counts. Use `status` to check completion. + # + # @param failed [Integer] Pages that could not be scraped. + # + # @param pending [Integer] Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can + # + # @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] + required :files, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchListResponse::Data::Results::File] } + + # @!method initialize(expires_at:, files:) + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + # + # @param expires_at [String] When the download URLs expire. + # + # @param files [Array] 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] + 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 + + # Output format. + # + # @see ContextDev::Models::BatchListResponse::Data#type + module Type + extend ContextDev::Internal::Type::Enum + + MARKDOWN = :markdown + HTML = :html + + # @!method self.values + # @return [Array] + end + end + + # @see ContextDev::Models::BatchListResponse#key_metadata + class KeyMetadata < ContextDev::Internal::Type::BaseModel + # @!attribute credits_consumed + # The number of credits consumed by this request. + # + # @return [Integer] + required :credits_consumed, Integer + + # @!attribute credits_remaining + # The number of credits remaining for your organization after this request. + # + # @return [Integer] + required :credits_remaining, Integer + + # @!method initialize(credits_consumed:, credits_remaining:) + # 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. + # + # @param credits_consumed [Integer] The number of credits consumed by this request. + # + # @param credits_remaining [Integer] The number of credits remaining for your organization after this request. + end + end + end +end diff --git a/lib/context_dev/models/batch_retrieve_params.rb b/lib/context_dev/models/batch_retrieve_params.rb new file mode 100644 index 00000000..c906a5f8 --- /dev/null +++ b/lib/context_dev/models/batch_retrieve_params.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::Batch#retrieve + class BatchRetrieveParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + # @!attribute batch_id + # ID of the batch to retrieve or cancel. + # + # @return [String] + required :batch_id, String + + # @!attribute tags + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + # + # @return [Array, nil] + optional :tags, ContextDev::Internal::Type::ArrayOf[String] + + # @!method initialize(batch_id:, tags: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchRetrieveParams} for more details. + # + # @param batch_id [String] ID of the batch to retrieve or cancel. + # + # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/context_dev/models/batch_retrieve_response.rb b/lib/context_dev/models/batch_retrieve_response.rb new file mode 100644 index 00000000..95827820 --- /dev/null +++ b/lib/context_dev/models/batch_retrieve_response.rb @@ -0,0 +1,405 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::Batch#retrieve + class BatchRetrieveResponse < ContextDev::Internal::Type::BaseModel + # @!attribute id + # Batch ID used to retrieve or cancel the job. + # + # @return [String] + required :id, String + + # @!attribute credits + # Reserved and used credits. + # + # @return [ContextDev::Models::BatchRetrieveResponse::Credits] + required :credits, -> { ContextDev::Models::BatchRetrieveResponse::Credits } + + # @!attribute error + # Batch-level error. Null unless `status` is `failed`. + # + # @return [ContextDev::Models::BatchRetrieveResponse::Error, nil] + required :error, -> { ContextDev::Models::BatchRetrieveResponse::Error }, nil?: true + + # @!attribute errors + # Page failures grouped by error code. + # + # @return [Array] + required :errors, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchRetrieveResponse::Error] } + + # @!attribute input + # Submission counts. + # + # @return [ContextDev::Models::BatchRetrieveResponse::Input] + required :input, -> { ContextDev::Models::BatchRetrieveResponse::Input } + + # @!attribute invalid_urls + # Rejected URLs, up to 100. These are not charged. + # + # @return [Array] + required :invalid_urls, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchRetrieveResponse::InvalidURL] } + + # @!attribute mode + # How pages are selected. + # + # @return [Symbol, ContextDev::Models::BatchRetrieveResponse::Mode] + required :mode, enum: -> { ContextDev::Models::BatchRetrieveResponse::Mode } + + # @!attribute progress + # Current processing counts. Use `status` to check completion. + # + # @return [ContextDev::Models::BatchRetrieveResponse::Progress] + required :progress, -> { ContextDev::Models::BatchRetrieveResponse::Progress } + + # @!attribute results + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + # + # @return [ContextDev::Models::BatchRetrieveResponse::Results, nil] + required :results, -> { ContextDev::Models::BatchRetrieveResponse::Results }, nil?: true + + # @!attribute status + # Current state. `completed`, `cancelled`, and `failed` are final. + # + # @return [Symbol, ContextDev::Models::BatchRetrieveResponse::Status] + required :status, enum: -> { ContextDev::Models::BatchRetrieveResponse::Status } + + # @!attribute timing + # + # @return [ContextDev::Models::BatchRetrieveResponse::Timing] + required :timing, -> { ContextDev::Models::BatchRetrieveResponse::Timing } + + # @!attribute type + # Output format. + # + # @return [Symbol, ContextDev::Models::BatchRetrieveResponse::Type] + required :type, enum: -> { ContextDev::Models::BatchRetrieveResponse::Type } + + # @!attribute key_metadata + # API key usage for this request. + # + # @return [ContextDev::Models::BatchRetrieveResponse::KeyMetadata, nil] + optional :key_metadata, -> { ContextDev::Models::BatchRetrieveResponse::KeyMetadata } + + # @!attribute webhook_secret + # Webhook signing secret. Also returned by GET /batch/{batch_id}. + # + # @return [String, nil] + optional :webhook_secret, String + + # @!method initialize(id:, credits:, error:, errors:, input:, invalid_urls:, mode:, progress:, results:, status:, timing:, type:, key_metadata: nil, webhook_secret: nil) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchRetrieveResponse} for more details. + # + # @param id [String] Batch ID used to retrieve or cancel the job. + # + # @param credits [ContextDev::Models::BatchRetrieveResponse::Credits] Reserved and used credits. + # + # @param error [ContextDev::Models::BatchRetrieveResponse::Error, nil] Batch-level error. Null unless `status` is `failed`. + # + # @param errors [Array] Page failures grouped by error code. + # + # @param input [ContextDev::Models::BatchRetrieveResponse::Input] Submission counts. + # + # @param invalid_urls [Array] Rejected URLs, up to 100. These are not charged. + # + # @param mode [Symbol, ContextDev::Models::BatchRetrieveResponse::Mode] How pages are selected. + # + # @param progress [ContextDev::Models::BatchRetrieveResponse::Progress] Current processing counts. Use `status` to check completion. + # + # @param results [ContextDev::Models::BatchRetrieveResponse::Results, nil] Download links available when the batch finishes. GET /batch/{batch_id}/results + # + # @param status [Symbol, ContextDev::Models::BatchRetrieveResponse::Status] Current state. `completed`, `cancelled`, and `failed` are final. + # + # @param timing [ContextDev::Models::BatchRetrieveResponse::Timing] + # + # @param type [Symbol, ContextDev::Models::BatchRetrieveResponse::Type] Output format. + # + # @param key_metadata [ContextDev::Models::BatchRetrieveResponse::KeyMetadata] API key usage for this request. + # + # @param webhook_secret [String] Webhook signing secret. Also returned by GET /batch/{batch_id}. + + # @see ContextDev::Models::BatchRetrieveResponse#credits + class Credits < ContextDev::Internal::Type::BaseModel + # @!attribute charged + # Credits used by successful pages. + # + # @return [Integer] + required :charged, Integer + + # @!attribute estimated + # Credits reserved when the batch was accepted. + # + # @return [Integer] + required :estimated, Integer + + # @!method initialize(charged:, estimated:) + # Reserved and used credits. + # + # @param charged [Integer] Credits used by successful pages. + # + # @param estimated [Integer] Credits reserved when the batch was accepted. + end + + # @see ContextDev::Models::BatchRetrieveResponse#error + class Error < ContextDev::Internal::Type::BaseModel + # @!attribute code + # Batch error code. + # + # @return [String] + required :code, String + + # @!attribute message + # Batch error message. + # + # @return [String] + required :message, String + + # @!method initialize(code:, message:) + # Batch-level error. Null unless `status` is `failed`. + # + # @param code [String] Batch error code. + # + # @param message [String] Batch error message. + end + + # @see ContextDev::Models::BatchRetrieveResponse#input + class Input < ContextDev::Internal::Type::BaseModel + # @!attribute accepted + # Pages accepted, or the crawl page limit. Credits are reserved for this count. + # + # @return [Integer] + required :accepted, Integer + + # @!attribute duplicates + # Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + # + # @return [Integer] + required :duplicates, Integer + + # @!attribute invalid + # Pages rejected during validation. + # + # @return [Integer] + required :invalid, Integer + + # @!attribute submitted + # Pages submitted before validation. For a crawl, the page limit. + # + # @return [Integer] + required :submitted, Integer + + # @!method initialize(accepted:, duplicates:, invalid:, submitted:) + # Submission counts. + # + # @param accepted [Integer] Pages accepted, or the crawl page limit. Credits are reserved for this count. + # + # @param duplicates [Integer] Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + # + # @param invalid [Integer] Pages rejected during validation. + # + # @param submitted [Integer] Pages submitted before validation. For a crawl, the page limit. + end + + class InvalidURL < ContextDev::Internal::Type::BaseModel + # @!attribute reason + # Why it was rejected. + # + # @return [String] + required :reason, String + + # @!attribute url + # Rejected URL. + # + # @return [String] + required :url, String + + # @!method initialize(reason:, url:) + # @param reason [String] Why it was rejected. + # + # @param url [String] Rejected URL. + end + + # How pages are selected. + # + # @see ContextDev::Models::BatchRetrieveResponse#mode + module Mode + extend ContextDev::Internal::Type::Enum + + SCRAPE = :scrape + CRAWL = :crawl + + # @!method self.values + # @return [Array] + end + + # @see ContextDev::Models::BatchRetrieveResponse#progress + class Progress < ContextDev::Internal::Type::BaseModel + # @!attribute failed + # Pages that could not be scraped. + # + # @return [Integer] + required :failed, Integer + + # @!attribute pending + # Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can + # finish under its page limit when the site has no more reachable 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::BatchRetrieveResponse::Progress} for more details. + # + # Current processing counts. Use `status` to check completion. + # + # @param failed [Integer] Pages that could not be scraped. + # + # @param pending [Integer] Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can + # + # @param succeeded [Integer] Pages scraped successfully. + end + + # @see ContextDev::Models::BatchRetrieveResponse#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] + required :files, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchRetrieveResponse::Results::File] } + + # @!method initialize(expires_at:, files:) + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + # + # @param expires_at [String] When the download URLs expire. + # + # @param files [Array] 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::BatchRetrieveResponse#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] + end + + # @see ContextDev::Models::BatchRetrieveResponse#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 + + # Output format. + # + # @see ContextDev::Models::BatchRetrieveResponse#type + module Type + extend ContextDev::Internal::Type::Enum + + MARKDOWN = :markdown + HTML = :html + + # @!method self.values + # @return [Array] + end + + # @see ContextDev::Models::BatchRetrieveResponse#key_metadata + class KeyMetadata < ContextDev::Internal::Type::BaseModel + # @!attribute credits_consumed + # The number of credits consumed by this request. + # + # @return [Integer] + required :credits_consumed, Integer + + # @!attribute credits_remaining + # The number of credits remaining for your organization after this request. + # + # @return [Integer] + required :credits_remaining, Integer + + # @!method initialize(credits_consumed:, credits_remaining:) + # API key usage for this request. + # + # @param credits_consumed [Integer] The number of credits consumed by this request. + # + # @param credits_remaining [Integer] The number of credits remaining for your organization after this request. + end + end + end +end diff --git a/lib/context_dev/models/batch_submit_params.rb b/lib/context_dev/models/batch_submit_params.rb new file mode 100644 index 00000000..c731f4d8 --- /dev/null +++ b/lib/context_dev/models/batch_submit_params.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::Batch#submit + class BatchSubmitParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + # @!attribute identifiers + # Known identifiers for the person. At least one identifier is required. + # + # @return [ContextDev::Models::BatchSubmitParams::Identifiers] + required :identifiers, -> { ContextDev::BatchSubmitParams::Identifiers } + + # @!attribute tags + # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + # + # @return [Array, nil] + optional :tags, ContextDev::Internal::Type::ArrayOf[String] + + # @!attribute timeout_ms + # 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). + # + # @return [Integer, nil] + optional :timeout_ms, Integer, api_name: :timeoutMS + + # @!method initialize(identifiers:, tags: nil, timeout_ms: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchSubmitParams} for more details. + # + # @param identifiers [ContextDev::Models::BatchSubmitParams::Identifiers] Known identifiers for the person. At least one identifier is required. + # + # @param tags [Array] Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] + + class Identifiers < ContextDev::Internal::Type::BaseModel + # @!attribute linkedin_url + # LinkedIn profile URL, e.g. https://www.linkedin.com/in/yahia-bakour/. + # + # @return [String, nil] + optional :linkedin_url, String, api_name: :linkedinUrl + + # @!method initialize(linkedin_url: nil) + # Known identifiers for the person. At least one identifier is required. + # + # @param linkedin_url [String] LinkedIn profile URL, e.g. https://www.linkedin.com/in/yahia-bakour/. + end + end + end +end diff --git a/lib/context_dev/models/batch_submit_response.rb b/lib/context_dev/models/batch_submit_response.rb new file mode 100644 index 00000000..717e1887 --- /dev/null +++ b/lib/context_dev/models/batch_submit_response.rb @@ -0,0 +1,614 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::Batch#submit + class BatchSubmitResponse < ContextDev::Internal::Type::BaseModel + # @!attribute code + # HTTP status code. + # + # @return [Integer, ContextDev::Models::BatchSubmitResponse::Code] + required :code, enum: -> { ContextDev::Models::BatchSubmitResponse::Code } + + # @!attribute metadata + # Additional response details. + # + # @return [ContextDev::Models::BatchSubmitResponse::Metadata] + required :metadata, -> { ContextDev::Models::BatchSubmitResponse::Metadata } + + # @!attribute person + # Retrieved person profile. + # + # @return [ContextDev::Models::BatchSubmitResponse::Person] + required :person, -> { ContextDev::Models::BatchSubmitResponse::Person } + + # @!attribute status + # Response status. + # + # @return [Symbol, ContextDev::Models::BatchSubmitResponse::Status] + required :status, enum: -> { ContextDev::Models::BatchSubmitResponse::Status } + + # @!attribute key_metadata + # 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. + # + # @return [ContextDev::Models::BatchSubmitResponse::KeyMetadata, nil] + optional :key_metadata, -> { ContextDev::Models::BatchSubmitResponse::KeyMetadata } + + # @!method initialize(code:, metadata:, person:, status:, key_metadata: nil) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchSubmitResponse} for more details. + # + # @param code [Integer, ContextDev::Models::BatchSubmitResponse::Code] HTTP status code. + # + # @param metadata [ContextDev::Models::BatchSubmitResponse::Metadata] Additional response details. + # + # @param person [ContextDev::Models::BatchSubmitResponse::Person] Retrieved person profile. + # + # @param status [Symbol, ContextDev::Models::BatchSubmitResponse::Status] Response status. + # + # @param key_metadata [ContextDev::Models::BatchSubmitResponse::KeyMetadata] Metadata about the API key used for the request. Included in every response when + + # HTTP status code. + # + # @see ContextDev::Models::BatchSubmitResponse#code + module Code + extend ContextDev::Internal::Type::Enum + + CODE_200 = 200 + + # @!method self.values + # @return [Array] + end + + # @see ContextDev::Models::BatchSubmitResponse#metadata + class Metadata < ContextDev::Internal::Type::BaseModel + # @!attribute identifiers + # Identifiers returned for the person. + # + # @return [ContextDev::Models::BatchSubmitResponse::Metadata::Identifiers] + required :identifiers, -> { ContextDev::Models::BatchSubmitResponse::Metadata::Identifiers } + + # @!attribute sources_attempted + # Source categories checked. + # + # @return [Array] + required :sources_attempted, + -> { ContextDev::Internal::Type::ArrayOf[enum: ContextDev::Models::BatchSubmitResponse::Metadata::SourcesAttempted] }, + api_name: :sourcesAttempted + + # @!attribute sources_succeeded + # Source categories with data. + # + # @return [Array] + required :sources_succeeded, + -> { ContextDev::Internal::Type::ArrayOf[enum: ContextDev::Models::BatchSubmitResponse::Metadata::SourcesSucceeded] }, + api_name: :sourcesSucceeded + + # @!attribute urls_analyzed + # URLs reviewed for this profile. + # + # @return [Array] + required :urls_analyzed, ContextDev::Internal::Type::ArrayOf[String], api_name: :urlsAnalyzed + + # @!attribute personal_website_url + # Personal website URL, when found. + # + # @return [String, nil] + optional :personal_website_url, String, api_name: :personalWebsiteUrl + + # @!method initialize(identifiers:, sources_attempted:, sources_succeeded:, urls_analyzed:, personal_website_url: nil) + # Additional response details. + # + # @param identifiers [ContextDev::Models::BatchSubmitResponse::Metadata::Identifiers] Identifiers returned for the person. + # + # @param sources_attempted [Array] Source categories checked. + # + # @param sources_succeeded [Array] Source categories with data. + # + # @param urls_analyzed [Array] URLs reviewed for this profile. + # + # @param personal_website_url [String] Personal website URL, when found. + + # @see ContextDev::Models::BatchSubmitResponse::Metadata#identifiers + class Identifiers < ContextDev::Internal::Type::BaseModel + # @!attribute linkedin_url + # LinkedIn profile URL. + # + # @return [String, nil] + optional :linkedin_url, String, api_name: :linkedinUrl + + # @!method initialize(linkedin_url: nil) + # Identifiers returned for the person. + # + # @param linkedin_url [String] LinkedIn profile URL. + end + + module SourcesAttempted + extend ContextDev::Internal::Type::Enum + + LINKEDIN = :linkedin + CV = :cv + MANUAL = :manual + GITHUB = :github + OTHER = :other + + # @!method self.values + # @return [Array] + end + + module SourcesSucceeded + extend ContextDev::Internal::Type::Enum + + LINKEDIN = :linkedin + CV = :cv + MANUAL = :manual + GITHUB = :github + OTHER = :other + + # @!method self.values + # @return [Array] + end + end + + # @see ContextDev::Models::BatchSubmitResponse#person + class Person < ContextDev::Internal::Type::BaseModel + # @!attribute education + # Education history. + # + # @return [Array] + required :education, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchSubmitResponse::Person::Education] } + + # @!attribute experience + # Work history. + # + # @return [Array] + required :experience, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchSubmitResponse::Person::Experience] } + + # @!attribute profile + # Core profile details. + # + # @return [ContextDev::Models::BatchSubmitResponse::Person::Profile] + required :profile, -> { ContextDev::Models::BatchSubmitResponse::Person::Profile } + + # @!attribute skills + # Listed skills. + # + # @return [Array] + required :skills, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchSubmitResponse::Person::Skill] } + + # @!method initialize(education:, experience:, profile:, skills:) + # Retrieved person profile. + # + # @param education [Array] Education history. + # + # @param experience [Array] Work history. + # + # @param profile [ContextDev::Models::BatchSubmitResponse::Person::Profile] Core profile details. + # + # @param skills [Array] Listed skills. + + class Education < ContextDev::Internal::Type::BaseModel + # @!attribute institution + # School or institution name. + # + # @return [ContextDev::Models::BatchSubmitResponse::Person::Education::Institution] + required :institution, -> { ContextDev::Models::BatchSubmitResponse::Person::Education::Institution } + + # @!attribute dates + # Education dates. + # + # @return [ContextDev::Models::BatchSubmitResponse::Person::Education::Dates, nil] + optional :dates, -> { ContextDev::Models::BatchSubmitResponse::Person::Education::Dates } + + # @!attribute description + # Additional education details. + # + # @return [String, nil] + optional :description, String + + # @!attribute field_of_study + # Area of study. + # + # @return [String, nil] + optional :field_of_study, String, api_name: :fieldOfStudy + + # @!attribute qualification + # Degree, certificate, or credential. + # + # @return [String, nil] + optional :qualification, String + + # @!method initialize(institution:, dates: nil, description: nil, field_of_study: nil, qualification: nil) + # @param institution [ContextDev::Models::BatchSubmitResponse::Person::Education::Institution] School or institution name. + # + # @param dates [ContextDev::Models::BatchSubmitResponse::Person::Education::Dates] Education dates. + # + # @param description [String] Additional education details. + # + # @param field_of_study [String] Area of study. + # + # @param qualification [String] Degree, certificate, or credential. + + # @see ContextDev::Models::BatchSubmitResponse::Person::Education#institution + class Institution < ContextDev::Internal::Type::BaseModel + # @!attribute display_ + # Display name. + # + # @return [String] + required :display_, String, api_name: :display + + # @!attribute normalized + # Standardized name, when available. + # + # @return [String, nil] + optional :normalized, String + + # @!method initialize(display_:, normalized: nil) + # School or institution name. + # + # @param display_ [String] Display name. + # + # @param normalized [String] Standardized name, when available. + end + + # @see ContextDev::Models::BatchSubmitResponse::Person::Education#dates + class Dates < ContextDev::Internal::Type::BaseModel + # @!attribute end_date + # End date, when known. + # + # @return [ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate, nil] + optional :end_date, + -> { ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate }, + api_name: :endDate + + # @!attribute is_current + # Whether the entry is current. + # + # @return [Boolean, nil] + optional :is_current, ContextDev::Internal::Type::Boolean, api_name: :isCurrent + + # @!attribute start_date + # Start date, when known. + # + # @return [ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate, nil] + optional :start_date, + -> { ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate }, + api_name: :startDate + + # @!method initialize(end_date: nil, is_current: nil, start_date: nil) + # Education dates. + # + # @param end_date [ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate] End date, when known. + # + # @param is_current [Boolean] Whether the entry is current. + # + # @param start_date [ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate] Start date, when known. + + # @see ContextDev::Models::BatchSubmitResponse::Person::Education::Dates#end_date + class EndDate < ContextDev::Internal::Type::BaseModel + # @!attribute year + # Year value. + # + # @return [Integer] + required :year, Integer + + # @!attribute day + # Day value, when known. + # + # @return [Integer, nil] + optional :day, Integer + + # @!attribute month + # Month value, when known. + # + # @return [Integer, nil] + optional :month, Integer + + # @!method initialize(year:, day: nil, month: nil) + # End date, when known. + # + # @param year [Integer] Year value. + # + # @param day [Integer] Day value, when known. + # + # @param month [Integer] Month value, when known. + end + + # @see ContextDev::Models::BatchSubmitResponse::Person::Education::Dates#start_date + class StartDate < ContextDev::Internal::Type::BaseModel + # @!attribute year + # Year value. + # + # @return [Integer] + required :year, Integer + + # @!attribute day + # Day value, when known. + # + # @return [Integer, nil] + optional :day, Integer + + # @!attribute month + # Month value, when known. + # + # @return [Integer, nil] + optional :month, Integer + + # @!method initialize(year:, day: nil, month: nil) + # Start date, when known. + # + # @param year [Integer] Year value. + # + # @param day [Integer] Day value, when known. + # + # @param month [Integer] Month value, when known. + end + end + end + + class Experience < ContextDev::Internal::Type::BaseModel + # @!attribute company + # Company or organization name. + # + # @return [ContextDev::Models::BatchSubmitResponse::Person::Experience::Company] + required :company, -> { ContextDev::Models::BatchSubmitResponse::Person::Experience::Company } + + # @!attribute title + # Role or job title. + # + # @return [String] + required :title, String + + # @!attribute dates + # Role dates. + # + # @return [ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates, nil] + optional :dates, -> { ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates } + + # @!attribute description + # Role description. + # + # @return [String, nil] + optional :description, String + + # @!method initialize(company:, title:, dates: nil, description: nil) + # @param company [ContextDev::Models::BatchSubmitResponse::Person::Experience::Company] Company or organization name. + # + # @param title [String] Role or job title. + # + # @param dates [ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates] Role dates. + # + # @param description [String] Role description. + + # @see ContextDev::Models::BatchSubmitResponse::Person::Experience#company + class Company < ContextDev::Internal::Type::BaseModel + # @!attribute display_ + # Display name. + # + # @return [String] + required :display_, String, api_name: :display + + # @!attribute normalized + # Standardized name, when available. + # + # @return [String, nil] + optional :normalized, String + + # @!method initialize(display_:, normalized: nil) + # Company or organization name. + # + # @param display_ [String] Display name. + # + # @param normalized [String] Standardized name, when available. + end + + # @see ContextDev::Models::BatchSubmitResponse::Person::Experience#dates + class Dates < ContextDev::Internal::Type::BaseModel + # @!attribute end_date + # End date, when known. + # + # @return [ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate, nil] + optional :end_date, + -> { ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate }, + api_name: :endDate + + # @!attribute is_current + # Whether the entry is current. + # + # @return [Boolean, nil] + optional :is_current, ContextDev::Internal::Type::Boolean, api_name: :isCurrent + + # @!attribute start_date + # Start date, when known. + # + # @return [ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate, nil] + optional :start_date, + -> { ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate }, + api_name: :startDate + + # @!method initialize(end_date: nil, is_current: nil, start_date: nil) + # Role dates. + # + # @param end_date [ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate] End date, when known. + # + # @param is_current [Boolean] Whether the entry is current. + # + # @param start_date [ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate] Start date, when known. + + # @see ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates#end_date + class EndDate < ContextDev::Internal::Type::BaseModel + # @!attribute year + # Year value. + # + # @return [Integer] + required :year, Integer + + # @!attribute day + # Day value, when known. + # + # @return [Integer, nil] + optional :day, Integer + + # @!attribute month + # Month value, when known. + # + # @return [Integer, nil] + optional :month, Integer + + # @!method initialize(year:, day: nil, month: nil) + # End date, when known. + # + # @param year [Integer] Year value. + # + # @param day [Integer] Day value, when known. + # + # @param month [Integer] Month value, when known. + end + + # @see ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates#start_date + class StartDate < ContextDev::Internal::Type::BaseModel + # @!attribute year + # Year value. + # + # @return [Integer] + required :year, Integer + + # @!attribute day + # Day value, when known. + # + # @return [Integer, nil] + optional :day, Integer + + # @!attribute month + # Month value, when known. + # + # @return [Integer, nil] + optional :month, Integer + + # @!method initialize(year:, day: nil, month: nil) + # Start date, when known. + # + # @param year [Integer] Year value. + # + # @param day [Integer] Day value, when known. + # + # @param month [Integer] Month value, when known. + end + end + end + + # @see ContextDev::Models::BatchSubmitResponse::Person#profile + class Profile < ContextDev::Internal::Type::BaseModel + # @!attribute full_name + # Person's full name. + # + # @return [String, nil] + optional :full_name, String, api_name: :fullName + + # @!attribute headline + # Short professional headline. + # + # @return [String, nil] + optional :headline, String + + # @!attribute location + # Person's listed location. + # + # @return [String, nil] + optional :location, String + + # @!attribute profile_picture_url + # Profile image URL. + # + # @return [String, nil] + optional :profile_picture_url, String, api_name: :profilePictureUrl + + # @!attribute summary + # Brief profile summary. + # + # @return [String, nil] + optional :summary, String + + # @!method initialize(full_name: nil, headline: nil, location: nil, profile_picture_url: nil, summary: nil) + # Core profile details. + # + # @param full_name [String] Person's full name. + # + # @param headline [String] Short professional headline. + # + # @param location [String] Person's listed location. + # + # @param profile_picture_url [String] Profile image URL. + # + # @param summary [String] Brief profile summary. + end + + class Skill < ContextDev::Internal::Type::BaseModel + # @!attribute name + # Skill name. + # + # @return [String] + required :name, String + + # @!attribute normalized + # Standardized skill name, when available. + # + # @return [String, nil] + optional :normalized, String + + # @!attribute proficiency + # Skill proficiency, when available. + # + # @return [String, nil] + optional :proficiency, String + + # @!method initialize(name:, normalized: nil, proficiency: nil) + # @param name [String] Skill name. + # + # @param normalized [String] Standardized skill name, when available. + # + # @param proficiency [String] Skill proficiency, when available. + end + end + + # Response status. + # + # @see ContextDev::Models::BatchSubmitResponse#status + module Status + extend ContextDev::Internal::Type::Enum + + OK = :ok + + # @!method self.values + # @return [Array] + end + + # @see ContextDev::Models::BatchSubmitResponse#key_metadata + class KeyMetadata < ContextDev::Internal::Type::BaseModel + # @!attribute credits_consumed + # The number of credits consumed by this request. + # + # @return [Integer] + required :credits_consumed, Integer + + # @!attribute credits_remaining + # The number of credits remaining for your organization after this request. + # + # @return [Integer] + required :credits_remaining, Integer + + # @!method initialize(credits_consumed:, credits_remaining:) + # 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. + # + # @param credits_consumed [Integer] The number of credits consumed by this request. + # + # @param credits_remaining [Integer] The number of credits remaining for your organization after this request. + end + end + end +end diff --git a/lib/context_dev/resources/batch.rb b/lib/context_dev/resources/batch.rb new file mode 100644 index 00000000..5b9c1d1f --- /dev/null +++ b/lib/context_dev/resources/batch.rb @@ -0,0 +1,169 @@ +# frozen_string_literal: true + +module ContextDev + module Resources + class Batch + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchRetrieveParams} for more details. + # + # Check progress and get download links when the batch finishes. Also returns the + # rejected-URL list and webhook signing secret from submission, so nothing is lost + # if the submit response was dropped. + # + # @overload retrieve(batch_id, tags: nil, request_options: {}) + # + # @param batch_id [String] ID of the batch to retrieve or cancel. + # + # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [ContextDev::Models::BatchRetrieveResponse] + # + # @see ContextDev::Models::BatchRetrieveParams + def retrieve(batch_id, params = {}) + parsed, options = ContextDev::BatchRetrieveParams.dump_request(params) + query = ContextDev::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: ["batch/%1$s", batch_id], + query: query, + model: ContextDev::Models::BatchRetrieveResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchListParams} for more details. + # + # List your batches from newest to oldest. Filter by status or continue with a + # cursor. + # + # @overload list(cursor: nil, limit: nil, status: nil, tags: nil, request_options: {}) + # + # @param cursor [String] Cursor from the previous page. + # + # @param limit [Integer] Batches per page. Defaults to 25. + # + # @param status [Symbol, ContextDev::Models::BatchListParams::Status] Filter by status. + # + # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [ContextDev::Models::BatchListResponse] + # + # @see ContextDev::Models::BatchListParams + def list(params = {}) + parsed, options = ContextDev::BatchListParams.dump_request(params) + query = ContextDev::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: "batch/list", + query: query, + model: ContextDev::Models::BatchListResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchCancelParams} for more details. + # + # Stop a batch from starting new pages. In-progress pages finish, and unused + # credits are refunded. + # + # @overload cancel(batch_id, tags: nil, request_options: {}) + # + # @param batch_id [String] ID of the batch to retrieve or cancel. + # + # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [ContextDev::Models::BatchCancelResponse] + # + # @see ContextDev::Models::BatchCancelParams + def cancel(batch_id, params = {}) + parsed, options = ContextDev::BatchCancelParams.dump_request(params) + query = ContextDev::Internal::Util.encode_query_params(parsed) + @client.request( + method: :post, + path: ["batch/%1$s/cancel", batch_id], + query: query, + model: ContextDev::Models::BatchCancelResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchGetResultsParams} for more details. + # + # Page through the result records of a finished batch as JSON, in the same order + # as the downloadable result files. Use this instead of downloading and parsing + # the NDJSON files yourself. + # + # @overload get_results(batch_id, cursor: nil, limit: nil, tags: nil, request_options: {}) + # + # @param batch_id [String] ID of the batch to retrieve or cancel. + # + # @param cursor [String] next_cursor from the previous page. + # + # @param limit [Integer] Records per page. Defaults to 25. A page can close early so its payload stays un + # + # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [ContextDev::Models::BatchGetResultsResponse] + # + # @see ContextDev::Models::BatchGetResultsParams + def get_results(batch_id, params = {}) + parsed, options = ContextDev::BatchGetResultsParams.dump_request(params) + query = ContextDev::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: ["batch/%1$s/results", batch_id], + query: query, + model: ContextDev::Models::BatchGetResultsResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {ContextDev::Models::BatchSubmitParams} for more details. + # + # Retrieve and normalize a person profile from identifiers. + # + # @overload submit(identifiers:, tags: nil, timeout_ms: nil, request_options: {}) + # + # @param identifiers [ContextDev::Models::BatchSubmitParams::Identifiers] Known identifiers for the person. At least one identifier is required. + # + # @param tags [Array] Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [ContextDev::Models::BatchSubmitResponse] + # + # @see ContextDev::Models::BatchSubmitParams + def submit(params) + parsed, options = ContextDev::BatchSubmitParams.dump_request(params) + @client.request( + method: :post, + path: "people/retrieve", + body: parsed, + model: ContextDev::Models::BatchSubmitResponse, + options: options + ) + end + + # @api private + # + # @param client [ContextDev::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/rbi/context_dev/client.rbi b/rbi/context_dev/client.rbi index 92268a1a..cca08589 100644 --- a/rbi/context_dev/client.rbi +++ b/rbi/context_dev/client.rbi @@ -38,6 +38,9 @@ module ContextDev sig { returns(ContextDev::Resources::Monitors) } attr_reader :monitors + sig { returns(ContextDev::Resources::Batch) } + attr_reader :batch + # @api private sig { override.returns(T::Hash[String, String]) } private def auth_headers diff --git a/rbi/context_dev/models.rbi b/rbi/context_dev/models.rbi index fe3d2d12..eee8b9c7 100644 --- a/rbi/context_dev/models.rbi +++ b/rbi/context_dev/models.rbi @@ -5,6 +5,16 @@ module ContextDev AIExtractProductsParams = ContextDev::Models::AIExtractProductsParams + BatchCancelParams = ContextDev::Models::BatchCancelParams + + BatchGetResultsParams = ContextDev::Models::BatchGetResultsParams + + BatchListParams = ContextDev::Models::BatchListParams + + BatchRetrieveParams = ContextDev::Models::BatchRetrieveParams + + BatchSubmitParams = ContextDev::Models::BatchSubmitParams + BrandRetrieveParams = ContextDev::Models::BrandRetrieveParams BrandRetrieveSimplifiedParams = diff --git a/rbi/context_dev/models/batch_cancel_params.rbi b/rbi/context_dev/models/batch_cancel_params.rbi new file mode 100644 index 00000000..c0e4dfbd --- /dev/null +++ b/rbi/context_dev/models/batch_cancel_params.rbi @@ -0,0 +1,58 @@ +# typed: strong + +module ContextDev + module Models + class BatchCancelParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(ContextDev::BatchCancelParams, ContextDev::Internal::AnyHash) + end + + # ID of the batch to retrieve or cancel. + sig { returns(String) } + attr_accessor :batch_id + + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :tags + + sig { params(tags: T::Array[String]).void } + attr_writer :tags + + sig do + params( + batch_id: String, + tags: T::Array[String], + request_options: ContextDev::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # ID of the batch to retrieve or cancel. + batch_id:, + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + tags: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + batch_id: String, + tags: T::Array[String], + request_options: ContextDev::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/context_dev/models/batch_cancel_response.rbi b/rbi/context_dev/models/batch_cancel_response.rbi new file mode 100644 index 00000000..c20f8353 --- /dev/null +++ b/rbi/context_dev/models/batch_cancel_response.rbi @@ -0,0 +1,673 @@ +# typed: strong + +module ContextDev + module Models + class BatchCancelResponse < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchCancelResponse, + ContextDev::Internal::AnyHash + ) + end + + # Batch ID used to retrieve or cancel the job. + sig { returns(String) } + attr_accessor :id + + # Reserved and used credits. + sig { returns(ContextDev::Models::BatchCancelResponse::Credits) } + attr_reader :credits + + sig do + params( + credits: ContextDev::Models::BatchCancelResponse::Credits::OrHash + ).void + end + attr_writer :credits + + # Batch-level error. Null unless `status` is `failed`. + sig { returns(T.nilable(ContextDev::Models::BatchCancelResponse::Error)) } + attr_reader :error + + sig do + params( + error: + T.nilable(ContextDev::Models::BatchCancelResponse::Error::OrHash) + ).void + end + attr_writer :error + + # Page failures grouped by error code. + sig { returns(T::Array[ContextDev::Models::BatchCancelResponse::Error]) } + attr_accessor :errors + + # Submission counts. + sig { returns(ContextDev::Models::BatchCancelResponse::Input) } + attr_reader :input + + sig do + params( + input: ContextDev::Models::BatchCancelResponse::Input::OrHash + ).void + end + attr_writer :input + + # How pages are selected. + sig do + returns(ContextDev::Models::BatchCancelResponse::Mode::TaggedSymbol) + end + attr_accessor :mode + + # Current processing counts. Use `status` to check completion. + sig { returns(ContextDev::Models::BatchCancelResponse::Progress) } + attr_reader :progress + + sig do + params( + progress: ContextDev::Models::BatchCancelResponse::Progress::OrHash + ).void + end + attr_writer :progress + + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + sig do + returns(T.nilable(ContextDev::Models::BatchCancelResponse::Results)) + end + attr_reader :results + + sig do + params( + results: + T.nilable(ContextDev::Models::BatchCancelResponse::Results::OrHash) + ).void + end + attr_writer :results + + # Current state. `completed`, `cancelled`, and `failed` are final. + sig do + returns(ContextDev::Models::BatchCancelResponse::Status::TaggedSymbol) + end + attr_accessor :status + + sig { returns(ContextDev::Models::BatchCancelResponse::Timing) } + attr_reader :timing + + sig do + params( + timing: ContextDev::Models::BatchCancelResponse::Timing::OrHash + ).void + end + attr_writer :timing + + # Output format. + sig do + returns(ContextDev::Models::BatchCancelResponse::Type::TaggedSymbol) + end + attr_accessor :type + + # API key usage for this request. + sig do + returns(T.nilable(ContextDev::Models::BatchCancelResponse::KeyMetadata)) + end + attr_reader :key_metadata + + sig do + params( + key_metadata: + ContextDev::Models::BatchCancelResponse::KeyMetadata::OrHash + ).void + end + attr_writer :key_metadata + + sig do + params( + id: String, + credits: ContextDev::Models::BatchCancelResponse::Credits::OrHash, + error: + T.nilable(ContextDev::Models::BatchCancelResponse::Error::OrHash), + errors: + T::Array[ContextDev::Models::BatchCancelResponse::Error::OrHash], + input: ContextDev::Models::BatchCancelResponse::Input::OrHash, + mode: ContextDev::Models::BatchCancelResponse::Mode::OrSymbol, + progress: ContextDev::Models::BatchCancelResponse::Progress::OrHash, + results: + T.nilable(ContextDev::Models::BatchCancelResponse::Results::OrHash), + status: ContextDev::Models::BatchCancelResponse::Status::OrSymbol, + timing: ContextDev::Models::BatchCancelResponse::Timing::OrHash, + type: ContextDev::Models::BatchCancelResponse::Type::OrSymbol, + key_metadata: + ContextDev::Models::BatchCancelResponse::KeyMetadata::OrHash + ).returns(T.attached_class) + end + def self.new( + # Batch ID used to retrieve or cancel the job. + id:, + # Reserved and used credits. + credits:, + # Batch-level error. Null unless `status` is `failed`. + error:, + # Page failures grouped by error code. + errors:, + # Submission counts. + input:, + # How pages are selected. + mode:, + # Current processing counts. Use `status` to check completion. + progress:, + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + results:, + # Current state. `completed`, `cancelled`, and `failed` are final. + status:, + timing:, + # Output format. + type:, + # API key usage for this request. + key_metadata: nil + ) + end + + sig do + override.returns( + { + id: String, + credits: ContextDev::Models::BatchCancelResponse::Credits, + error: T.nilable(ContextDev::Models::BatchCancelResponse::Error), + errors: T::Array[ContextDev::Models::BatchCancelResponse::Error], + input: ContextDev::Models::BatchCancelResponse::Input, + mode: ContextDev::Models::BatchCancelResponse::Mode::TaggedSymbol, + progress: ContextDev::Models::BatchCancelResponse::Progress, + results: + T.nilable(ContextDev::Models::BatchCancelResponse::Results), + status: + ContextDev::Models::BatchCancelResponse::Status::TaggedSymbol, + timing: ContextDev::Models::BatchCancelResponse::Timing, + type: ContextDev::Models::BatchCancelResponse::Type::TaggedSymbol, + key_metadata: ContextDev::Models::BatchCancelResponse::KeyMetadata + } + ) + end + def to_hash + end + + class Credits < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchCancelResponse::Credits, + ContextDev::Internal::AnyHash + ) + end + + # Credits used by successful pages. + sig { returns(Integer) } + attr_accessor :charged + + # Credits reserved when the batch was accepted. + sig { returns(Integer) } + attr_accessor :estimated + + # Reserved and used credits. + sig do + params(charged: Integer, estimated: Integer).returns(T.attached_class) + end + def self.new( + # Credits used by successful pages. + charged:, + # Credits reserved when the batch was accepted. + estimated: + ) + end + + sig { override.returns({ charged: Integer, estimated: Integer }) } + def to_hash + end + end + + class Error < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchCancelResponse::Error, + ContextDev::Internal::AnyHash + ) + end + + # Batch error code. + sig { returns(String) } + attr_accessor :code + + # Batch error message. + sig { returns(String) } + attr_accessor :message + + # Batch-level error. Null unless `status` is `failed`. + sig { params(code: String, message: String).returns(T.attached_class) } + def self.new( + # Batch error code. + code:, + # Batch error message. + message: + ) + end + + sig { override.returns({ code: String, message: String }) } + def to_hash + end + end + + class Input < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchCancelResponse::Input, + ContextDev::Internal::AnyHash + ) + end + + # Pages accepted, or the crawl page limit. Credits are reserved for this count. + sig { returns(Integer) } + attr_accessor :accepted + + # Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + sig { returns(Integer) } + attr_accessor :duplicates + + # Pages rejected during validation. + sig { returns(Integer) } + attr_accessor :invalid + + # Pages submitted before validation. For a crawl, the page limit. + sig { returns(Integer) } + attr_accessor :submitted + + # Submission counts. + sig do + params( + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + ).returns(T.attached_class) + end + def self.new( + # Pages accepted, or the crawl page limit. Credits are reserved for this count. + accepted:, + # Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + duplicates:, + # Pages rejected during validation. + invalid:, + # Pages submitted before validation. For a crawl, the page limit. + submitted: + ) + end + + sig do + override.returns( + { + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + } + ) + end + def to_hash + end + end + + # How pages are selected. + module Mode + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::Models::BatchCancelResponse::Mode) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SCRAPE = + T.let( + :scrape, + ContextDev::Models::BatchCancelResponse::Mode::TaggedSymbol + ) + CRAWL = + T.let( + :crawl, + ContextDev::Models::BatchCancelResponse::Mode::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchCancelResponse::Mode::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Progress < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchCancelResponse::Progress, + ContextDev::Internal::AnyHash + ) + end + + # Pages that could not be scraped. + sig { returns(Integer) } + attr_accessor :failed + + # Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can + # finish under its page limit when the site has no more reachable pages. + sig { returns(Integer) } + attr_accessor :pending + + # Pages scraped successfully. + sig { returns(Integer) } + attr_accessor :succeeded + + # Current processing counts. Use `status` to check completion. + sig do + params(failed: Integer, pending: Integer, succeeded: Integer).returns( + T.attached_class + ) + end + def self.new( + # Pages that could not be scraped. + failed:, + # Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can + # finish under its page limit when the site has no more reachable pages. + pending:, + # Pages scraped successfully. + succeeded: + ) + end + + sig do + override.returns( + { failed: Integer, pending: Integer, succeeded: Integer } + ) + end + def to_hash + end + end + + class Results < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchCancelResponse::Results, + ContextDev::Internal::AnyHash + ) + end + + # When the download URLs expire. + sig { returns(String) } + attr_accessor :expires_at + + # Result files. Order is not guaranteed. + sig do + returns( + T::Array[ContextDev::Models::BatchCancelResponse::Results::File] + ) + end + attr_accessor :files + + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + sig do + params( + expires_at: String, + files: + T::Array[ + ContextDev::Models::BatchCancelResponse::Results::File::OrHash + ] + ).returns(T.attached_class) + end + def self.new( + # When the download URLs expire. + expires_at:, + # Result files. Order is not guaranteed. + files: + ) + end + + sig do + override.returns( + { + expires_at: String, + files: + T::Array[ContextDev::Models::BatchCancelResponse::Results::File] + } + ) + end + def to_hash + end + + class File < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchCancelResponse::Results::File, + ContextDev::Internal::AnyHash + ) + end + + # Compressed file size in bytes. + sig { returns(Integer) } + attr_accessor :bytes + + # Results in this file. + sig { returns(Integer) } + attr_accessor :items + + # Temporary URL for a gzipped NDJSON file. + sig { returns(String) } + attr_accessor :url + + sig do + params(bytes: Integer, items: Integer, url: String).returns( + T.attached_class + ) + end + def self.new( + # Compressed file size in bytes. + bytes:, + # Results in this file. + items:, + # Temporary URL for a gzipped NDJSON file. + url: + ) + end + + sig do + override.returns({ bytes: Integer, items: Integer, url: String }) + end + def to_hash + end + end + end + + # Current state. `completed`, `cancelled`, and `failed` are final. + module Status + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::Models::BatchCancelResponse::Status) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + QUEUED = + T.let( + :queued, + ContextDev::Models::BatchCancelResponse::Status::TaggedSymbol + ) + RUNNING = + T.let( + :running, + ContextDev::Models::BatchCancelResponse::Status::TaggedSymbol + ) + CANCELLING = + T.let( + :cancelling, + ContextDev::Models::BatchCancelResponse::Status::TaggedSymbol + ) + COMPLETED = + T.let( + :completed, + ContextDev::Models::BatchCancelResponse::Status::TaggedSymbol + ) + CANCELLED = + T.let( + :cancelled, + ContextDev::Models::BatchCancelResponse::Status::TaggedSymbol + ) + FAILED = + T.let( + :failed, + ContextDev::Models::BatchCancelResponse::Status::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchCancelResponse::Status::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Timing < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchCancelResponse::Timing, + ContextDev::Internal::AnyHash + ) + end + + # When processing finished. Null while active. + sig { returns(T.nilable(String)) } + attr_accessor :completed_at + + # When the batch was created. + sig { returns(String) } + attr_accessor :created_at + + # When processing started. Null while queued. + sig { returns(T.nilable(String)) } + attr_accessor :started_at + + sig do + params( + completed_at: T.nilable(String), + created_at: String, + started_at: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + # When processing finished. Null while active. + completed_at:, + # When the batch was created. + created_at:, + # When processing started. Null while queued. + started_at: + ) + end + + sig do + override.returns( + { + completed_at: T.nilable(String), + created_at: String, + started_at: T.nilable(String) + } + ) + end + def to_hash + end + end + + # Output format. + module Type + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::Models::BatchCancelResponse::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MARKDOWN = + T.let( + :markdown, + ContextDev::Models::BatchCancelResponse::Type::TaggedSymbol + ) + HTML = + T.let( + :html, + ContextDev::Models::BatchCancelResponse::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchCancelResponse::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + + class KeyMetadata < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchCancelResponse::KeyMetadata, + ContextDev::Internal::AnyHash + ) + end + + # The number of credits consumed by this request. + sig { returns(Integer) } + attr_accessor :credits_consumed + + # The number of credits remaining for your organization after this request. + sig { returns(Integer) } + attr_accessor :credits_remaining + + # API key usage for this request. + sig do + params(credits_consumed: Integer, credits_remaining: Integer).returns( + T.attached_class + ) + end + def self.new( + # The number of credits consumed by this request. + credits_consumed:, + # The number of credits remaining for your organization after this request. + credits_remaining: + ) + end + + sig do + override.returns( + { credits_consumed: Integer, credits_remaining: Integer } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/context_dev/models/batch_get_results_params.rbi b/rbi/context_dev/models/batch_get_results_params.rbi new file mode 100644 index 00000000..9c6288d4 --- /dev/null +++ b/rbi/context_dev/models/batch_get_results_params.rbi @@ -0,0 +1,85 @@ +# typed: strong + +module ContextDev + module Models + class BatchGetResultsParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + ContextDev::BatchGetResultsParams, + ContextDev::Internal::AnyHash + ) + end + + # ID of the batch to retrieve or cancel. + sig { returns(String) } + attr_accessor :batch_id + + # next_cursor from the previous page. + sig { returns(T.nilable(String)) } + attr_reader :cursor + + sig { params(cursor: String).void } + attr_writer :cursor + + # Records per page. Defaults to 25. A page can close early so its payload stays + # under ~8 MB; rely on next_cursor rather than counting records. + sig { returns(T.nilable(Integer)) } + attr_reader :limit + + sig { params(limit: Integer).void } + attr_writer :limit + + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :tags + + sig { params(tags: T::Array[String]).void } + attr_writer :tags + + sig do + params( + batch_id: String, + cursor: String, + limit: Integer, + tags: T::Array[String], + request_options: ContextDev::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # ID of the batch to retrieve or cancel. + batch_id:, + # next_cursor from the previous page. + cursor: nil, + # Records per page. Defaults to 25. A page can close early so its payload stays + # under ~8 MB; rely on next_cursor rather than counting records. + limit: nil, + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + tags: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + batch_id: String, + cursor: String, + limit: Integer, + tags: T::Array[String], + request_options: ContextDev::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/context_dev/models/batch_get_results_response.rbi b/rbi/context_dev/models/batch_get_results_response.rbi new file mode 100644 index 00000000..8bff0cf0 --- /dev/null +++ b/rbi/context_dev/models/batch_get_results_response.rbi @@ -0,0 +1,848 @@ +# typed: strong + +module ContextDev + module Models + class BatchGetResultsResponse < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchGetResultsResponse, + ContextDev::Internal::AnyHash + ) + end + + # Result records on this page. + sig do + returns( + T.nilable( + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Variants + ] + ) + ) + end + attr_reader :data + + sig do + params( + data: + T::Array[ + T.any( + ContextDev::Models::BatchGetResultsResponse::Data::Ok::OrHash, + ContextDev::Models::BatchGetResultsResponse::Data::Error::OrHash + ) + ] + ).void + end + attr_writer :data + + # Whether another page is available. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :has_more + + sig { params(has_more: T::Boolean).void } + attr_writer :has_more + + # 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. + sig do + returns( + T.nilable(ContextDev::Models::BatchGetResultsResponse::KeyMetadata) + ) + end + attr_reader :key_metadata + + sig do + params( + key_metadata: + ContextDev::Models::BatchGetResultsResponse::KeyMetadata::OrHash + ).void + end + attr_writer :key_metadata + + # Cursor for the next page. + sig { returns(T.nilable(String)) } + attr_accessor :next_cursor + + sig do + params( + data: + T::Array[ + T.any( + ContextDev::Models::BatchGetResultsResponse::Data::Ok::OrHash, + ContextDev::Models::BatchGetResultsResponse::Data::Error::OrHash + ) + ], + has_more: T::Boolean, + key_metadata: + ContextDev::Models::BatchGetResultsResponse::KeyMetadata::OrHash, + next_cursor: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + # Result records on this page. + data: nil, + # Whether another page is available. + has_more: nil, + # 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. + key_metadata: nil, + # Cursor for the next page. + next_cursor: nil + ) + end + + sig do + override.returns( + { + data: + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Variants + ], + has_more: T::Boolean, + key_metadata: + ContextDev::Models::BatchGetResultsResponse::KeyMetadata, + next_cursor: T.nilable(String) + } + ) + end + def to_hash + end + + # One page outcome from a finished batch. + module Data + extend ContextDev::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + ContextDev::Models::BatchGetResultsResponse::Data::Ok, + ContextDev::Models::BatchGetResultsResponse::Data::Error + ) + end + + class Ok < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchGetResultsResponse::Data::Ok, + ContextDev::Internal::AnyHash + ) + end + + # URL the content was read from, after redirects. + sig { returns(String) } + attr_accessor :final_url + + # HTTP status of the final response, when known. + sig { returns(T.nilable(Integer)) } + attr_accessor :http_status + + # Metadata extracted from the scraped page HTML. + sig do + returns( + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata + ) + end + attr_reader :metadata + + sig do + params( + metadata: + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::OrHash + ).void + end + attr_writer :metadata + + # The page was scraped. + sig { returns(Symbol) } + attr_accessor :status + + # URL as submitted, or as discovered by the crawl. + sig { returns(String) } + attr_accessor :url + + # Raw page HTML. Present on html batches. + sig { returns(T.nilable(String)) } + attr_reader :html + + sig { params(html: String).void } + attr_writer :html + + # Caller-supplied identifier echoed from submission. + sig { returns(T.nilable(String)) } + attr_reader :item_id + + sig { params(item_id: String).void } + attr_writer :item_id + + # Page content as Markdown. Present on markdown batches. + sig { returns(T.nilable(String)) } + attr_reader :markdown + + sig { params(markdown: String).void } + attr_writer :markdown + + # Caller-supplied metadata echoed from submission. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :meta + + sig { params(meta: T::Hash[Symbol, T.anything]).void } + attr_writer :meta + + # A page the batch fetched successfully. + sig do + params( + final_url: String, + http_status: T.nilable(Integer), + metadata: + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::OrHash, + url: String, + html: String, + item_id: String, + markdown: String, + meta: T::Hash[Symbol, T.anything], + status: Symbol + ).returns(T.attached_class) + end + def self.new( + # URL the content was read from, after redirects. + final_url:, + # HTTP status of the final response, when known. + http_status:, + # Metadata extracted from the scraped page HTML. + metadata:, + # URL as submitted, or as discovered by the crawl. + url:, + # Raw page HTML. Present on html batches. + html: nil, + # Caller-supplied identifier echoed from submission. + item_id: nil, + # Page content as Markdown. Present on markdown batches. + markdown: nil, + # Caller-supplied metadata echoed from submission. + meta: nil, + # The page was scraped. + status: :ok + ) + end + + sig do + override.returns( + { + final_url: String, + http_status: T.nilable(Integer), + metadata: + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata, + status: Symbol, + url: String, + html: String, + item_id: String, + markdown: String, + meta: T::Hash[Symbol, T.anything] + } + ) + end + def to_hash + end + + class Metadata < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata, + ContextDev::Internal::AnyHash + ) + end + + # Final URL scraped after redirects or scraper fallback, when known. Falls back to + # sourceUrl when unavailable. + sig { returns(String) } + attr_accessor :final_url + + # Original URL requested by the caller. + sig { returns(String) } + attr_accessor :source_url + + # Additional non-social meta tags not promoted to top-level metadata fields. + sig do + returns( + T.nilable( + T::Hash[ + Symbol, + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::AdditionalMeta::Variants + ] + ) + ) + end + attr_reader :additional_meta + + sig do + params( + additional_meta: + T::Hash[ + Symbol, + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::AdditionalMeta::Variants + ] + ).void + end + attr_writer :additional_meta + + # Resolved alternate links from link rel=alternate tags. + sig do + returns( + T.nilable( + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Alternate + ] + ) + ) + end + attr_reader :alternates + + sig do + params( + alternates: + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Alternate::OrHash + ] + ).void + end + attr_writer :alternates + + # Author metadata, when present. + sig { returns(T.nilable(String)) } + attr_reader :author + + sig { params(author: String).void } + attr_writer :author + + # Resolved canonical URL, when present. + sig { returns(T.nilable(String)) } + attr_reader :canonical_url + + sig { params(canonical_url: String).void } + attr_writer :canonical_url + + # Best description extracted from standard, Open Graph, or Twitter metadata. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + # Resolved favicon URL, when present. + sig { returns(T.nilable(String)) } + attr_reader :favicon + + sig { params(favicon: String).void } + attr_writer :favicon + + # Primary resolved preview image from Open Graph, Twitter, or image metadata. + sig { returns(T.nilable(String)) } + attr_reader :image + + sig { params(image: String).void } + attr_writer :image + + # JSON-LD structured data blocks parsed from the page. + sig { returns(T.nilable(T::Array[T::Hash[Symbol, T.anything]])) } + attr_reader :json_ld + + sig { params(json_ld: T::Array[T::Hash[Symbol, T.anything]]).void } + attr_writer :json_ld + + # Keywords extracted from the page's keywords meta tag. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :keywords + + sig { params(keywords: T::Array[String]).void } + attr_writer :keywords + + # Language extracted from html lang or language meta tags. + sig { returns(T.nilable(String)) } + attr_reader :language + + sig { params(language: String).void } + attr_writer :language + + # Modified timestamp/date from page metadata, when present. + sig { returns(T.nilable(String)) } + attr_reader :modified_time + + sig { params(modified_time: String).void } + attr_writer :modified_time + + # Open Graph metadata with the og: prefix removed and keys camel-cased. + sig do + returns( + T.nilable( + T::Hash[ + Symbol, + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::OpenGraph::Variants + ] + ) + ) + end + attr_reader :open_graph + + sig do + params( + open_graph: + T::Hash[ + Symbol, + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::OpenGraph::Variants + ] + ).void + end + attr_writer :open_graph + + # Published timestamp/date from page metadata, when present. + sig { returns(T.nilable(String)) } + attr_reader :published_time + + sig { params(published_time: String).void } + attr_writer :published_time + + # Robots meta directive, when present. + sig { returns(T.nilable(String)) } + attr_reader :robots + + sig { params(robots: String).void } + attr_writer :robots + + # Site or application name from page metadata. + sig { returns(T.nilable(String)) } + attr_reader :site_name + + sig { params(site_name: String).void } + attr_writer :site_name + + # Best title extracted from the page. + sig { returns(T.nilable(String)) } + attr_reader :title + + sig { params(title: String).void } + attr_writer :title + + # Twitter card metadata with the twitter: prefix removed and keys camel-cased. + sig do + returns( + T.nilable( + T::Hash[ + Symbol, + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Twitter::Variants + ] + ) + ) + end + attr_reader :twitter + + sig do + params( + twitter: + T::Hash[ + Symbol, + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Twitter::Variants + ] + ).void + end + attr_writer :twitter + + # Metadata extracted from the scraped page HTML. + sig do + params( + final_url: String, + source_url: String, + additional_meta: + T::Hash[ + Symbol, + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::AdditionalMeta::Variants + ], + alternates: + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Alternate::OrHash + ], + author: String, + canonical_url: String, + description: String, + favicon: String, + image: String, + json_ld: T::Array[T::Hash[Symbol, T.anything]], + keywords: T::Array[String], + language: String, + modified_time: String, + open_graph: + T::Hash[ + Symbol, + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::OpenGraph::Variants + ], + published_time: String, + robots: String, + site_name: String, + title: String, + twitter: + T::Hash[ + Symbol, + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Twitter::Variants + ] + ).returns(T.attached_class) + end + def self.new( + # Final URL scraped after redirects or scraper fallback, when known. Falls back to + # sourceUrl when unavailable. + final_url:, + # Original URL requested by the caller. + source_url:, + # Additional non-social meta tags not promoted to top-level metadata fields. + additional_meta: nil, + # Resolved alternate links from link rel=alternate tags. + alternates: nil, + # Author metadata, when present. + author: nil, + # Resolved canonical URL, when present. + canonical_url: nil, + # Best description extracted from standard, Open Graph, or Twitter metadata. + description: nil, + # Resolved favicon URL, when present. + favicon: nil, + # Primary resolved preview image from Open Graph, Twitter, or image metadata. + image: nil, + # JSON-LD structured data blocks parsed from the page. + json_ld: nil, + # Keywords extracted from the page's keywords meta tag. + keywords: nil, + # Language extracted from html lang or language meta tags. + language: nil, + # Modified timestamp/date from page metadata, when present. + modified_time: nil, + # Open Graph metadata with the og: prefix removed and keys camel-cased. + open_graph: nil, + # Published timestamp/date from page metadata, when present. + published_time: nil, + # Robots meta directive, when present. + robots: nil, + # Site or application name from page metadata. + site_name: nil, + # Best title extracted from the page. + title: nil, + # Twitter card metadata with the twitter: prefix removed and keys camel-cased. + twitter: nil + ) + end + + sig do + override.returns( + { + final_url: String, + source_url: String, + additional_meta: + T::Hash[ + Symbol, + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::AdditionalMeta::Variants + ], + alternates: + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Alternate + ], + author: String, + canonical_url: String, + description: String, + favicon: String, + image: String, + json_ld: T::Array[T::Hash[Symbol, T.anything]], + keywords: T::Array[String], + language: String, + modified_time: String, + open_graph: + T::Hash[ + Symbol, + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::OpenGraph::Variants + ], + published_time: String, + robots: String, + site_name: String, + title: String, + twitter: + T::Hash[ + Symbol, + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Twitter::Variants + ] + } + ) + end + def to_hash + end + + module AdditionalMeta + extend ContextDev::Internal::Type::Union + + Variants = T.type_alias { T.any(String, T::Array[String]) } + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::AdditionalMeta::Variants + ] + ) + end + def self.variants + end + + StringArray = + T.let( + ContextDev::Internal::Type::ArrayOf[String], + ContextDev::Internal::Type::Converter + ) + end + + class Alternate < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Alternate, + ContextDev::Internal::AnyHash + ) + end + + # Resolved alternate URL. + sig { returns(String) } + attr_accessor :href + + # Language or locale for the alternate URL, when present. + sig { returns(T.nilable(String)) } + attr_reader :hreflang + + sig { params(hreflang: String).void } + attr_writer :hreflang + + # Alternate resource title, when present. + sig { returns(T.nilable(String)) } + attr_reader :title + + sig { params(title: String).void } + attr_writer :title + + # Alternate resource MIME type, when present. + sig { returns(T.nilable(String)) } + attr_reader :type + + sig { params(type: String).void } + attr_writer :type + + sig do + params( + href: String, + hreflang: String, + title: String, + type: String + ).returns(T.attached_class) + end + def self.new( + # Resolved alternate URL. + href:, + # Language or locale for the alternate URL, when present. + hreflang: nil, + # Alternate resource title, when present. + title: nil, + # Alternate resource MIME type, when present. + type: nil + ) + end + + sig do + override.returns( + { + href: String, + hreflang: String, + title: String, + type: String + } + ) + end + def to_hash + end + end + + module OpenGraph + extend ContextDev::Internal::Type::Union + + Variants = T.type_alias { T.any(String, T::Array[String]) } + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::OpenGraph::Variants + ] + ) + end + def self.variants + end + + StringArray = + T.let( + ContextDev::Internal::Type::ArrayOf[String], + ContextDev::Internal::Type::Converter + ) + end + + module Twitter + extend ContextDev::Internal::Type::Union + + Variants = T.type_alias { T.any(String, T::Array[String]) } + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Twitter::Variants + ] + ) + end + def self.variants + end + + StringArray = + T.let( + ContextDev::Internal::Type::ArrayOf[String], + ContextDev::Internal::Type::Converter + ) + end + end + end + + class Error < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchGetResultsResponse::Data::Error, + ContextDev::Internal::AnyHash + ) + end + + # Why the page failed. + sig { returns(String) } + attr_accessor :error_code + + # Human-readable failure detail. + sig { returns(String) } + attr_accessor :message + + # The page could not be scraped. + sig { returns(Symbol) } + attr_accessor :status + + # URL as submitted, or as discovered by the crawl. + sig { returns(String) } + attr_accessor :url + + # Caller-supplied identifier echoed from submission. + sig { returns(T.nilable(String)) } + attr_reader :item_id + + sig { params(item_id: String).void } + attr_writer :item_id + + # Caller-supplied metadata echoed from submission. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :meta + + sig { params(meta: T::Hash[Symbol, T.anything]).void } + attr_writer :meta + + # A page the batch could not fetch. + sig do + params( + error_code: String, + message: String, + url: String, + item_id: String, + meta: T::Hash[Symbol, T.anything], + status: Symbol + ).returns(T.attached_class) + end + def self.new( + # Why the page failed. + error_code:, + # Human-readable failure detail. + message:, + # URL as submitted, or as discovered by the crawl. + url:, + # Caller-supplied identifier echoed from submission. + item_id: nil, + # Caller-supplied metadata echoed from submission. + meta: nil, + # The page could not be scraped. + status: :error + ) + end + + sig do + override.returns( + { + error_code: String, + message: String, + status: Symbol, + url: String, + item_id: String, + meta: T::Hash[Symbol, T.anything] + } + ) + end + def to_hash + end + end + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchGetResultsResponse::Data::Variants + ] + ) + end + def self.variants + end + end + + class KeyMetadata < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchGetResultsResponse::KeyMetadata, + ContextDev::Internal::AnyHash + ) + end + + # The number of credits consumed by this request. + sig { returns(Integer) } + attr_accessor :credits_consumed + + # The number of credits remaining for your organization after this request. + sig { returns(Integer) } + attr_accessor :credits_remaining + + # 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. + sig do + params(credits_consumed: Integer, credits_remaining: Integer).returns( + T.attached_class + ) + end + def self.new( + # The number of credits consumed by this request. + credits_consumed:, + # The number of credits remaining for your organization after this request. + credits_remaining: + ) + end + + sig do + override.returns( + { credits_consumed: Integer, credits_remaining: Integer } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/context_dev/models/batch_list_params.rbi b/rbi/context_dev/models/batch_list_params.rbi new file mode 100644 index 00000000..565f51ca --- /dev/null +++ b/rbi/context_dev/models/batch_list_params.rbi @@ -0,0 +1,113 @@ +# typed: strong + +module ContextDev + module Models + class BatchListParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(ContextDev::BatchListParams, ContextDev::Internal::AnyHash) + end + + # Cursor from the previous page. + sig { returns(T.nilable(String)) } + attr_reader :cursor + + sig { params(cursor: String).void } + attr_writer :cursor + + # Batches per page. Defaults to 25. + sig { returns(T.nilable(Integer)) } + attr_reader :limit + + sig { params(limit: Integer).void } + attr_writer :limit + + # Filter by status. + sig { returns(T.nilable(ContextDev::BatchListParams::Status::OrSymbol)) } + attr_reader :status + + sig { params(status: ContextDev::BatchListParams::Status::OrSymbol).void } + attr_writer :status + + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :tags + + sig { params(tags: T::Array[String]).void } + attr_writer :tags + + sig do + params( + cursor: String, + limit: Integer, + status: ContextDev::BatchListParams::Status::OrSymbol, + tags: T::Array[String], + request_options: ContextDev::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Cursor from the previous page. + cursor: nil, + # Batches per page. Defaults to 25. + limit: nil, + # Filter by status. + status: nil, + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + tags: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + cursor: String, + limit: Integer, + status: ContextDev::BatchListParams::Status::OrSymbol, + tags: T::Array[String], + request_options: ContextDev::RequestOptions + } + ) + end + def to_hash + end + + # Filter by status. + module Status + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, ContextDev::BatchListParams::Status) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + QUEUED = + T.let(:queued, ContextDev::BatchListParams::Status::TaggedSymbol) + RUNNING = + T.let(:running, ContextDev::BatchListParams::Status::TaggedSymbol) + CANCELLING = + T.let(:cancelling, ContextDev::BatchListParams::Status::TaggedSymbol) + COMPLETED = + T.let(:completed, ContextDev::BatchListParams::Status::TaggedSymbol) + CANCELLED = + T.let(:cancelled, ContextDev::BatchListParams::Status::TaggedSymbol) + FAILED = + T.let(:failed, ContextDev::BatchListParams::Status::TaggedSymbol) + + sig do + override.returns( + T::Array[ContextDev::BatchListParams::Status::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/context_dev/models/batch_list_response.rbi b/rbi/context_dev/models/batch_list_response.rbi new file mode 100644 index 00000000..5330fe55 --- /dev/null +++ b/rbi/context_dev/models/batch_list_response.rbi @@ -0,0 +1,783 @@ +# typed: strong + +module ContextDev + module Models + class BatchListResponse < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchListResponse, + ContextDev::Internal::AnyHash + ) + end + + # Batches on this page. + sig do + returns( + T.nilable(T::Array[ContextDev::Models::BatchListResponse::Data]) + ) + end + attr_reader :data + + sig do + params( + data: T::Array[ContextDev::Models::BatchListResponse::Data::OrHash] + ).void + end + attr_writer :data + + # Whether another page is available. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :has_more + + sig { params(has_more: T::Boolean).void } + attr_writer :has_more + + # 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. + sig do + returns(T.nilable(ContextDev::Models::BatchListResponse::KeyMetadata)) + end + attr_reader :key_metadata + + sig do + params( + key_metadata: + ContextDev::Models::BatchListResponse::KeyMetadata::OrHash + ).void + end + attr_writer :key_metadata + + # Cursor for the next page. + sig { returns(T.nilable(String)) } + attr_accessor :next_cursor + + sig do + params( + data: T::Array[ContextDev::Models::BatchListResponse::Data::OrHash], + has_more: T::Boolean, + key_metadata: + ContextDev::Models::BatchListResponse::KeyMetadata::OrHash, + next_cursor: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + # Batches on this page. + data: nil, + # Whether another page is available. + has_more: nil, + # 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. + key_metadata: nil, + # Cursor for the next page. + next_cursor: nil + ) + end + + sig do + override.returns( + { + data: T::Array[ContextDev::Models::BatchListResponse::Data], + has_more: T::Boolean, + key_metadata: ContextDev::Models::BatchListResponse::KeyMetadata, + next_cursor: T.nilable(String) + } + ) + end + def to_hash + end + + class Data < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchListResponse::Data, + ContextDev::Internal::AnyHash + ) + end + + # Batch ID used to retrieve or cancel the job. + sig { returns(String) } + attr_accessor :id + + # Reserved and used credits. + sig { returns(ContextDev::Models::BatchListResponse::Data::Credits) } + attr_reader :credits + + sig do + params( + credits: + ContextDev::Models::BatchListResponse::Data::Credits::OrHash + ).void + end + attr_writer :credits + + # Batch-level error. Null unless `status` is `failed`. + sig do + returns(T.nilable(ContextDev::Models::BatchListResponse::Data::Error)) + end + attr_reader :error + + sig do + params( + error: + T.nilable( + ContextDev::Models::BatchListResponse::Data::Error::OrHash + ) + ).void + end + attr_writer :error + + # Page failures grouped by error code. + sig do + returns(T::Array[ContextDev::Models::BatchListResponse::Data::Error]) + end + attr_accessor :errors + + # Submission counts. + sig { returns(ContextDev::Models::BatchListResponse::Data::Input) } + attr_reader :input + + sig do + params( + input: ContextDev::Models::BatchListResponse::Data::Input::OrHash + ).void + end + attr_writer :input + + # How pages are selected. + sig do + returns( + ContextDev::Models::BatchListResponse::Data::Mode::TaggedSymbol + ) + end + attr_accessor :mode + + # Current processing counts. Use `status` to check completion. + sig { returns(ContextDev::Models::BatchListResponse::Data::Progress) } + attr_reader :progress + + sig do + params( + progress: + ContextDev::Models::BatchListResponse::Data::Progress::OrHash + ).void + end + attr_writer :progress + + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + sig do + returns( + T.nilable(ContextDev::Models::BatchListResponse::Data::Results) + ) + end + attr_reader :results + + sig do + params( + results: + T.nilable( + ContextDev::Models::BatchListResponse::Data::Results::OrHash + ) + ).void + end + attr_writer :results + + # Current state. `completed`, `cancelled`, and `failed` are final. + sig do + returns( + ContextDev::Models::BatchListResponse::Data::Status::TaggedSymbol + ) + end + attr_accessor :status + + sig { returns(ContextDev::Models::BatchListResponse::Data::Timing) } + attr_reader :timing + + sig do + params( + timing: ContextDev::Models::BatchListResponse::Data::Timing::OrHash + ).void + end + attr_writer :timing + + # Output format. + sig do + returns( + ContextDev::Models::BatchListResponse::Data::Type::TaggedSymbol + ) + end + attr_accessor :type + + # An asynchronous web scraping job. + sig do + params( + id: String, + credits: + ContextDev::Models::BatchListResponse::Data::Credits::OrHash, + error: + T.nilable( + ContextDev::Models::BatchListResponse::Data::Error::OrHash + ), + errors: + T::Array[ + ContextDev::Models::BatchListResponse::Data::Error::OrHash + ], + input: ContextDev::Models::BatchListResponse::Data::Input::OrHash, + mode: ContextDev::Models::BatchListResponse::Data::Mode::OrSymbol, + progress: + ContextDev::Models::BatchListResponse::Data::Progress::OrHash, + results: + T.nilable( + ContextDev::Models::BatchListResponse::Data::Results::OrHash + ), + status: + ContextDev::Models::BatchListResponse::Data::Status::OrSymbol, + timing: ContextDev::Models::BatchListResponse::Data::Timing::OrHash, + type: ContextDev::Models::BatchListResponse::Data::Type::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Batch ID used to retrieve or cancel the job. + id:, + # Reserved and used credits. + credits:, + # Batch-level error. Null unless `status` is `failed`. + error:, + # Page failures grouped by error code. + errors:, + # Submission counts. + input:, + # How pages are selected. + mode:, + # Current processing counts. Use `status` to check completion. + progress:, + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + results:, + # Current state. `completed`, `cancelled`, and `failed` are final. + status:, + timing:, + # Output format. + type: + ) + end + + sig do + override.returns( + { + id: String, + credits: ContextDev::Models::BatchListResponse::Data::Credits, + error: + T.nilable(ContextDev::Models::BatchListResponse::Data::Error), + errors: + T::Array[ContextDev::Models::BatchListResponse::Data::Error], + input: ContextDev::Models::BatchListResponse::Data::Input, + mode: + ContextDev::Models::BatchListResponse::Data::Mode::TaggedSymbol, + progress: ContextDev::Models::BatchListResponse::Data::Progress, + results: + T.nilable(ContextDev::Models::BatchListResponse::Data::Results), + status: + ContextDev::Models::BatchListResponse::Data::Status::TaggedSymbol, + timing: ContextDev::Models::BatchListResponse::Data::Timing, + type: + ContextDev::Models::BatchListResponse::Data::Type::TaggedSymbol + } + ) + end + def to_hash + end + + class Credits < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchListResponse::Data::Credits, + ContextDev::Internal::AnyHash + ) + end + + # Credits used by successful pages. + sig { returns(Integer) } + attr_accessor :charged + + # Credits reserved when the batch was accepted. + sig { returns(Integer) } + attr_accessor :estimated + + # Reserved and used credits. + sig do + params(charged: Integer, estimated: Integer).returns( + T.attached_class + ) + end + def self.new( + # Credits used by successful pages. + charged:, + # Credits reserved when the batch was accepted. + estimated: + ) + end + + sig { override.returns({ charged: Integer, estimated: Integer }) } + def to_hash + end + end + + class Error < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchListResponse::Data::Error, + ContextDev::Internal::AnyHash + ) + end + + # Batch error code. + sig { returns(String) } + attr_accessor :code + + # Batch error message. + sig { returns(String) } + attr_accessor :message + + # Batch-level error. Null unless `status` is `failed`. + sig do + params(code: String, message: String).returns(T.attached_class) + end + def self.new( + # Batch error code. + code:, + # Batch error message. + message: + ) + end + + sig { override.returns({ code: String, message: String }) } + def to_hash + end + end + + class Input < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchListResponse::Data::Input, + ContextDev::Internal::AnyHash + ) + end + + # Pages accepted, or the crawl page limit. Credits are reserved for this count. + sig { returns(Integer) } + attr_accessor :accepted + + # Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + sig { returns(Integer) } + attr_accessor :duplicates + + # Pages rejected during validation. + sig { returns(Integer) } + attr_accessor :invalid + + # Pages submitted before validation. For a crawl, the page limit. + sig { returns(Integer) } + attr_accessor :submitted + + # Submission counts. + sig do + params( + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + ).returns(T.attached_class) + end + def self.new( + # Pages accepted, or the crawl page limit. Credits are reserved for this count. + accepted:, + # Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + duplicates:, + # Pages rejected during validation. + invalid:, + # Pages submitted before validation. For a crawl, the page limit. + submitted: + ) + end + + sig do + override.returns( + { + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + } + ) + end + def to_hash + end + end + + # How pages are selected. + module Mode + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::Models::BatchListResponse::Data::Mode) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SCRAPE = + T.let( + :scrape, + ContextDev::Models::BatchListResponse::Data::Mode::TaggedSymbol + ) + CRAWL = + T.let( + :crawl, + ContextDev::Models::BatchListResponse::Data::Mode::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchListResponse::Data::Mode::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Progress < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchListResponse::Data::Progress, + ContextDev::Internal::AnyHash + ) + end + + # Pages that could not be scraped. + sig { returns(Integer) } + attr_accessor :failed + + # Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can + # finish under its page limit when the site has no more reachable pages. + sig { returns(Integer) } + attr_accessor :pending + + # Pages scraped successfully. + sig { returns(Integer) } + attr_accessor :succeeded + + # Current processing counts. Use `status` to check completion. + sig do + params( + failed: Integer, + pending: Integer, + succeeded: Integer + ).returns(T.attached_class) + end + def self.new( + # Pages that could not be scraped. + failed:, + # Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can + # finish under its page limit when the site has no more reachable pages. + pending:, + # Pages scraped successfully. + succeeded: + ) + end + + sig do + override.returns( + { failed: Integer, pending: Integer, succeeded: Integer } + ) + end + def to_hash + end + end + + class Results < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchListResponse::Data::Results, + ContextDev::Internal::AnyHash + ) + end + + # When the download URLs expire. + sig { returns(String) } + attr_accessor :expires_at + + # Result files. Order is not guaranteed. + sig do + returns( + T::Array[ + ContextDev::Models::BatchListResponse::Data::Results::File + ] + ) + end + attr_accessor :files + + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + sig do + params( + expires_at: String, + files: + T::Array[ + ContextDev::Models::BatchListResponse::Data::Results::File::OrHash + ] + ).returns(T.attached_class) + end + def self.new( + # When the download URLs expire. + expires_at:, + # Result files. Order is not guaranteed. + files: + ) + end + + sig do + override.returns( + { + expires_at: String, + files: + T::Array[ + ContextDev::Models::BatchListResponse::Data::Results::File + ] + } + ) + end + def to_hash + end + + class File < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchListResponse::Data::Results::File, + ContextDev::Internal::AnyHash + ) + end + + # Compressed file size in bytes. + sig { returns(Integer) } + attr_accessor :bytes + + # Results in this file. + sig { returns(Integer) } + attr_accessor :items + + # Temporary URL for a gzipped NDJSON file. + sig { returns(String) } + attr_accessor :url + + sig do + params(bytes: Integer, items: Integer, url: String).returns( + T.attached_class + ) + end + def self.new( + # Compressed file size in bytes. + bytes:, + # Results in this file. + items:, + # Temporary URL for a gzipped NDJSON file. + url: + ) + end + + sig do + override.returns({ bytes: Integer, items: Integer, url: String }) + end + def to_hash + end + end + end + + # Current state. `completed`, `cancelled`, and `failed` are final. + module Status + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::Models::BatchListResponse::Data::Status) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + QUEUED = + T.let( + :queued, + ContextDev::Models::BatchListResponse::Data::Status::TaggedSymbol + ) + RUNNING = + T.let( + :running, + ContextDev::Models::BatchListResponse::Data::Status::TaggedSymbol + ) + CANCELLING = + T.let( + :cancelling, + ContextDev::Models::BatchListResponse::Data::Status::TaggedSymbol + ) + COMPLETED = + T.let( + :completed, + ContextDev::Models::BatchListResponse::Data::Status::TaggedSymbol + ) + CANCELLED = + T.let( + :cancelled, + ContextDev::Models::BatchListResponse::Data::Status::TaggedSymbol + ) + FAILED = + T.let( + :failed, + ContextDev::Models::BatchListResponse::Data::Status::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchListResponse::Data::Status::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Timing < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchListResponse::Data::Timing, + ContextDev::Internal::AnyHash + ) + end + + # When processing finished. Null while active. + sig { returns(T.nilable(String)) } + attr_accessor :completed_at + + # When the batch was created. + sig { returns(String) } + attr_accessor :created_at + + # When processing started. Null while queued. + sig { returns(T.nilable(String)) } + attr_accessor :started_at + + sig do + params( + completed_at: T.nilable(String), + created_at: String, + started_at: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + # When processing finished. Null while active. + completed_at:, + # When the batch was created. + created_at:, + # When processing started. Null while queued. + started_at: + ) + end + + sig do + override.returns( + { + completed_at: T.nilable(String), + created_at: String, + started_at: T.nilable(String) + } + ) + end + def to_hash + end + end + + # Output format. + module Type + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::Models::BatchListResponse::Data::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MARKDOWN = + T.let( + :markdown, + ContextDev::Models::BatchListResponse::Data::Type::TaggedSymbol + ) + HTML = + T.let( + :html, + ContextDev::Models::BatchListResponse::Data::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchListResponse::Data::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class KeyMetadata < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchListResponse::KeyMetadata, + ContextDev::Internal::AnyHash + ) + end + + # The number of credits consumed by this request. + sig { returns(Integer) } + attr_accessor :credits_consumed + + # The number of credits remaining for your organization after this request. + sig { returns(Integer) } + attr_accessor :credits_remaining + + # 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. + sig do + params(credits_consumed: Integer, credits_remaining: Integer).returns( + T.attached_class + ) + end + def self.new( + # The number of credits consumed by this request. + credits_consumed:, + # The number of credits remaining for your organization after this request. + credits_remaining: + ) + end + + sig do + override.returns( + { credits_consumed: Integer, credits_remaining: Integer } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/context_dev/models/batch_retrieve_params.rbi b/rbi/context_dev/models/batch_retrieve_params.rbi new file mode 100644 index 00000000..6ca170d1 --- /dev/null +++ b/rbi/context_dev/models/batch_retrieve_params.rbi @@ -0,0 +1,58 @@ +# typed: strong + +module ContextDev + module Models + class BatchRetrieveParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(ContextDev::BatchRetrieveParams, ContextDev::Internal::AnyHash) + end + + # ID of the batch to retrieve or cancel. + sig { returns(String) } + attr_accessor :batch_id + + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :tags + + sig { params(tags: T::Array[String]).void } + attr_writer :tags + + sig do + params( + batch_id: String, + tags: T::Array[String], + request_options: ContextDev::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # ID of the batch to retrieve or cancel. + batch_id:, + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + tags: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + batch_id: String, + tags: T::Array[String], + request_options: ContextDev::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/context_dev/models/batch_retrieve_response.rbi b/rbi/context_dev/models/batch_retrieve_response.rbi new file mode 100644 index 00000000..6c358eb2 --- /dev/null +++ b/rbi/context_dev/models/batch_retrieve_response.rbi @@ -0,0 +1,742 @@ +# typed: strong + +module ContextDev + module Models + class BatchRetrieveResponse < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchRetrieveResponse, + ContextDev::Internal::AnyHash + ) + end + + # Batch ID used to retrieve or cancel the job. + sig { returns(String) } + attr_accessor :id + + # Reserved and used credits. + sig { returns(ContextDev::Models::BatchRetrieveResponse::Credits) } + attr_reader :credits + + sig do + params( + credits: ContextDev::Models::BatchRetrieveResponse::Credits::OrHash + ).void + end + attr_writer :credits + + # Batch-level error. Null unless `status` is `failed`. + sig do + returns(T.nilable(ContextDev::Models::BatchRetrieveResponse::Error)) + end + attr_reader :error + + sig do + params( + error: + T.nilable(ContextDev::Models::BatchRetrieveResponse::Error::OrHash) + ).void + end + attr_writer :error + + # Page failures grouped by error code. + sig do + returns(T::Array[ContextDev::Models::BatchRetrieveResponse::Error]) + end + attr_accessor :errors + + # Submission counts. + sig { returns(ContextDev::Models::BatchRetrieveResponse::Input) } + attr_reader :input + + sig do + params( + input: ContextDev::Models::BatchRetrieveResponse::Input::OrHash + ).void + end + attr_writer :input + + # Rejected URLs, up to 100. These are not charged. + sig do + returns(T::Array[ContextDev::Models::BatchRetrieveResponse::InvalidURL]) + end + attr_accessor :invalid_urls + + # How pages are selected. + sig do + returns(ContextDev::Models::BatchRetrieveResponse::Mode::TaggedSymbol) + end + attr_accessor :mode + + # Current processing counts. Use `status` to check completion. + sig { returns(ContextDev::Models::BatchRetrieveResponse::Progress) } + attr_reader :progress + + sig do + params( + progress: ContextDev::Models::BatchRetrieveResponse::Progress::OrHash + ).void + end + attr_writer :progress + + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + sig do + returns(T.nilable(ContextDev::Models::BatchRetrieveResponse::Results)) + end + attr_reader :results + + sig do + params( + results: + T.nilable( + ContextDev::Models::BatchRetrieveResponse::Results::OrHash + ) + ).void + end + attr_writer :results + + # Current state. `completed`, `cancelled`, and `failed` are final. + sig do + returns(ContextDev::Models::BatchRetrieveResponse::Status::TaggedSymbol) + end + attr_accessor :status + + sig { returns(ContextDev::Models::BatchRetrieveResponse::Timing) } + attr_reader :timing + + sig do + params( + timing: ContextDev::Models::BatchRetrieveResponse::Timing::OrHash + ).void + end + attr_writer :timing + + # Output format. + sig do + returns(ContextDev::Models::BatchRetrieveResponse::Type::TaggedSymbol) + end + attr_accessor :type + + # API key usage for this request. + sig do + returns( + T.nilable(ContextDev::Models::BatchRetrieveResponse::KeyMetadata) + ) + end + attr_reader :key_metadata + + sig do + params( + key_metadata: + ContextDev::Models::BatchRetrieveResponse::KeyMetadata::OrHash + ).void + end + attr_writer :key_metadata + + # Webhook signing secret. Also returned by GET /batch/{batch_id}. + sig { returns(T.nilable(String)) } + attr_reader :webhook_secret + + sig { params(webhook_secret: String).void } + attr_writer :webhook_secret + + sig do + params( + id: String, + credits: ContextDev::Models::BatchRetrieveResponse::Credits::OrHash, + error: + T.nilable(ContextDev::Models::BatchRetrieveResponse::Error::OrHash), + errors: + T::Array[ContextDev::Models::BatchRetrieveResponse::Error::OrHash], + input: ContextDev::Models::BatchRetrieveResponse::Input::OrHash, + invalid_urls: + T::Array[ + ContextDev::Models::BatchRetrieveResponse::InvalidURL::OrHash + ], + mode: ContextDev::Models::BatchRetrieveResponse::Mode::OrSymbol, + progress: ContextDev::Models::BatchRetrieveResponse::Progress::OrHash, + results: + T.nilable( + ContextDev::Models::BatchRetrieveResponse::Results::OrHash + ), + status: ContextDev::Models::BatchRetrieveResponse::Status::OrSymbol, + timing: ContextDev::Models::BatchRetrieveResponse::Timing::OrHash, + type: ContextDev::Models::BatchRetrieveResponse::Type::OrSymbol, + key_metadata: + ContextDev::Models::BatchRetrieveResponse::KeyMetadata::OrHash, + webhook_secret: String + ).returns(T.attached_class) + end + def self.new( + # Batch ID used to retrieve or cancel the job. + id:, + # Reserved and used credits. + credits:, + # Batch-level error. Null unless `status` is `failed`. + error:, + # Page failures grouped by error code. + errors:, + # Submission counts. + input:, + # Rejected URLs, up to 100. These are not charged. + invalid_urls:, + # How pages are selected. + mode:, + # Current processing counts. Use `status` to check completion. + progress:, + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + results:, + # Current state. `completed`, `cancelled`, and `failed` are final. + status:, + timing:, + # Output format. + type:, + # API key usage for this request. + key_metadata: nil, + # Webhook signing secret. Also returned by GET /batch/{batch_id}. + webhook_secret: nil + ) + end + + sig do + override.returns( + { + id: String, + credits: ContextDev::Models::BatchRetrieveResponse::Credits, + error: T.nilable(ContextDev::Models::BatchRetrieveResponse::Error), + errors: T::Array[ContextDev::Models::BatchRetrieveResponse::Error], + input: ContextDev::Models::BatchRetrieveResponse::Input, + invalid_urls: + T::Array[ContextDev::Models::BatchRetrieveResponse::InvalidURL], + mode: ContextDev::Models::BatchRetrieveResponse::Mode::TaggedSymbol, + progress: ContextDev::Models::BatchRetrieveResponse::Progress, + results: + T.nilable(ContextDev::Models::BatchRetrieveResponse::Results), + status: + ContextDev::Models::BatchRetrieveResponse::Status::TaggedSymbol, + timing: ContextDev::Models::BatchRetrieveResponse::Timing, + type: ContextDev::Models::BatchRetrieveResponse::Type::TaggedSymbol, + key_metadata: + ContextDev::Models::BatchRetrieveResponse::KeyMetadata, + webhook_secret: String + } + ) + end + def to_hash + end + + class Credits < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchRetrieveResponse::Credits, + ContextDev::Internal::AnyHash + ) + end + + # Credits used by successful pages. + sig { returns(Integer) } + attr_accessor :charged + + # Credits reserved when the batch was accepted. + sig { returns(Integer) } + attr_accessor :estimated + + # Reserved and used credits. + sig do + params(charged: Integer, estimated: Integer).returns(T.attached_class) + end + def self.new( + # Credits used by successful pages. + charged:, + # Credits reserved when the batch was accepted. + estimated: + ) + end + + sig { override.returns({ charged: Integer, estimated: Integer }) } + def to_hash + end + end + + class Error < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchRetrieveResponse::Error, + ContextDev::Internal::AnyHash + ) + end + + # Batch error code. + sig { returns(String) } + attr_accessor :code + + # Batch error message. + sig { returns(String) } + attr_accessor :message + + # Batch-level error. Null unless `status` is `failed`. + sig { params(code: String, message: String).returns(T.attached_class) } + def self.new( + # Batch error code. + code:, + # Batch error message. + message: + ) + end + + sig { override.returns({ code: String, message: String }) } + def to_hash + end + end + + class Input < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchRetrieveResponse::Input, + ContextDev::Internal::AnyHash + ) + end + + # Pages accepted, or the crawl page limit. Credits are reserved for this count. + sig { returns(Integer) } + attr_accessor :accepted + + # Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + sig { returns(Integer) } + attr_accessor :duplicates + + # Pages rejected during validation. + sig { returns(Integer) } + attr_accessor :invalid + + # Pages submitted before validation. For a crawl, the page limit. + sig { returns(Integer) } + attr_accessor :submitted + + # Submission counts. + sig do + params( + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + ).returns(T.attached_class) + end + def self.new( + # Pages accepted, or the crawl page limit. Credits are reserved for this count. + accepted:, + # Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + duplicates:, + # Pages rejected during validation. + invalid:, + # Pages submitted before validation. For a crawl, the page limit. + submitted: + ) + end + + sig do + override.returns( + { + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + } + ) + end + def to_hash + end + end + + class InvalidURL < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchRetrieveResponse::InvalidURL, + ContextDev::Internal::AnyHash + ) + end + + # Why it was rejected. + sig { returns(String) } + attr_accessor :reason + + # Rejected URL. + sig { returns(String) } + attr_accessor :url + + sig { params(reason: String, url: String).returns(T.attached_class) } + def self.new( + # Why it was rejected. + reason:, + # Rejected URL. + url: + ) + end + + sig { override.returns({ reason: String, url: String }) } + def to_hash + end + end + + # How pages are selected. + module Mode + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::Models::BatchRetrieveResponse::Mode) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SCRAPE = + T.let( + :scrape, + ContextDev::Models::BatchRetrieveResponse::Mode::TaggedSymbol + ) + CRAWL = + T.let( + :crawl, + ContextDev::Models::BatchRetrieveResponse::Mode::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchRetrieveResponse::Mode::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Progress < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchRetrieveResponse::Progress, + ContextDev::Internal::AnyHash + ) + end + + # Pages that could not be scraped. + sig { returns(Integer) } + attr_accessor :failed + + # Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can + # finish under its page limit when the site has no more reachable pages. + sig { returns(Integer) } + attr_accessor :pending + + # Pages scraped successfully. + sig { returns(Integer) } + attr_accessor :succeeded + + # Current processing counts. Use `status` to check completion. + sig do + params(failed: Integer, pending: Integer, succeeded: Integer).returns( + T.attached_class + ) + end + def self.new( + # Pages that could not be scraped. + failed:, + # Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can + # finish under its page limit when the site has no more reachable pages. + pending:, + # Pages scraped successfully. + succeeded: + ) + end + + sig do + override.returns( + { failed: Integer, pending: Integer, succeeded: Integer } + ) + end + def to_hash + end + end + + class Results < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchRetrieveResponse::Results, + ContextDev::Internal::AnyHash + ) + end + + # When the download URLs expire. + sig { returns(String) } + attr_accessor :expires_at + + # Result files. Order is not guaranteed. + sig do + returns( + T::Array[ContextDev::Models::BatchRetrieveResponse::Results::File] + ) + end + attr_accessor :files + + # Download links available when the batch finishes. GET /batch/{batch_id}/results + # serves the same records as paginated JSON. + sig do + params( + expires_at: String, + files: + T::Array[ + ContextDev::Models::BatchRetrieveResponse::Results::File::OrHash + ] + ).returns(T.attached_class) + end + def self.new( + # When the download URLs expire. + expires_at:, + # Result files. Order is not guaranteed. + files: + ) + end + + sig do + override.returns( + { + expires_at: String, + files: + T::Array[ + ContextDev::Models::BatchRetrieveResponse::Results::File + ] + } + ) + end + def to_hash + end + + class File < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchRetrieveResponse::Results::File, + ContextDev::Internal::AnyHash + ) + end + + # Compressed file size in bytes. + sig { returns(Integer) } + attr_accessor :bytes + + # Results in this file. + sig { returns(Integer) } + attr_accessor :items + + # Temporary URL for a gzipped NDJSON file. + sig { returns(String) } + attr_accessor :url + + sig do + params(bytes: Integer, items: Integer, url: String).returns( + T.attached_class + ) + end + def self.new( + # Compressed file size in bytes. + bytes:, + # Results in this file. + items:, + # Temporary URL for a gzipped NDJSON file. + url: + ) + end + + sig do + override.returns({ bytes: Integer, items: Integer, url: String }) + end + def to_hash + end + end + end + + # Current state. `completed`, `cancelled`, and `failed` are final. + module Status + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::Models::BatchRetrieveResponse::Status) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + QUEUED = + T.let( + :queued, + ContextDev::Models::BatchRetrieveResponse::Status::TaggedSymbol + ) + RUNNING = + T.let( + :running, + ContextDev::Models::BatchRetrieveResponse::Status::TaggedSymbol + ) + CANCELLING = + T.let( + :cancelling, + ContextDev::Models::BatchRetrieveResponse::Status::TaggedSymbol + ) + COMPLETED = + T.let( + :completed, + ContextDev::Models::BatchRetrieveResponse::Status::TaggedSymbol + ) + CANCELLED = + T.let( + :cancelled, + ContextDev::Models::BatchRetrieveResponse::Status::TaggedSymbol + ) + FAILED = + T.let( + :failed, + ContextDev::Models::BatchRetrieveResponse::Status::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchRetrieveResponse::Status::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Timing < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchRetrieveResponse::Timing, + ContextDev::Internal::AnyHash + ) + end + + # When processing finished. Null while active. + sig { returns(T.nilable(String)) } + attr_accessor :completed_at + + # When the batch was created. + sig { returns(String) } + attr_accessor :created_at + + # When processing started. Null while queued. + sig { returns(T.nilable(String)) } + attr_accessor :started_at + + sig do + params( + completed_at: T.nilable(String), + created_at: String, + started_at: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + # When processing finished. Null while active. + completed_at:, + # When the batch was created. + created_at:, + # When processing started. Null while queued. + started_at: + ) + end + + sig do + override.returns( + { + completed_at: T.nilable(String), + created_at: String, + started_at: T.nilable(String) + } + ) + end + def to_hash + end + end + + # Output format. + module Type + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::Models::BatchRetrieveResponse::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MARKDOWN = + T.let( + :markdown, + ContextDev::Models::BatchRetrieveResponse::Type::TaggedSymbol + ) + HTML = + T.let( + :html, + ContextDev::Models::BatchRetrieveResponse::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchRetrieveResponse::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + + class KeyMetadata < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchRetrieveResponse::KeyMetadata, + ContextDev::Internal::AnyHash + ) + end + + # The number of credits consumed by this request. + sig { returns(Integer) } + attr_accessor :credits_consumed + + # The number of credits remaining for your organization after this request. + sig { returns(Integer) } + attr_accessor :credits_remaining + + # API key usage for this request. + sig do + params(credits_consumed: Integer, credits_remaining: Integer).returns( + T.attached_class + ) + end + def self.new( + # The number of credits consumed by this request. + credits_consumed:, + # The number of credits remaining for your organization after this request. + credits_remaining: + ) + end + + sig do + override.returns( + { credits_consumed: Integer, credits_remaining: Integer } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/context_dev/models/batch_submit_params.rbi b/rbi/context_dev/models/batch_submit_params.rbi new file mode 100644 index 00000000..99573653 --- /dev/null +++ b/rbi/context_dev/models/batch_submit_params.rbi @@ -0,0 +1,105 @@ +# typed: strong + +module ContextDev + module Models + class BatchSubmitParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(ContextDev::BatchSubmitParams, ContextDev::Internal::AnyHash) + end + + # Known identifiers for the person. At least one identifier is required. + sig { returns(ContextDev::BatchSubmitParams::Identifiers) } + attr_reader :identifiers + + sig do + params( + identifiers: ContextDev::BatchSubmitParams::Identifiers::OrHash + ).void + end + attr_writer :identifiers + + # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :tags + + sig { params(tags: T::Array[String]).void } + attr_writer :tags + + # 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). + sig { returns(T.nilable(Integer)) } + attr_reader :timeout_ms + + sig { params(timeout_ms: Integer).void } + attr_writer :timeout_ms + + sig do + params( + identifiers: ContextDev::BatchSubmitParams::Identifiers::OrHash, + tags: T::Array[String], + timeout_ms: Integer, + request_options: ContextDev::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Known identifiers for the person. At least one identifier is required. + identifiers:, + # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + tags: nil, + # 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). + timeout_ms: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + identifiers: ContextDev::BatchSubmitParams::Identifiers, + tags: T::Array[String], + timeout_ms: Integer, + request_options: ContextDev::RequestOptions + } + ) + end + def to_hash + end + + class Identifiers < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::BatchSubmitParams::Identifiers, + ContextDev::Internal::AnyHash + ) + end + + # LinkedIn profile URL, e.g. https://www.linkedin.com/in/yahia-bakour/. + sig { returns(T.nilable(String)) } + attr_reader :linkedin_url + + sig { params(linkedin_url: String).void } + attr_writer :linkedin_url + + # Known identifiers for the person. At least one identifier is required. + sig { params(linkedin_url: String).returns(T.attached_class) } + def self.new( + # LinkedIn profile URL, e.g. https://www.linkedin.com/in/yahia-bakour/. + linkedin_url: nil + ) + end + + sig { override.returns({ linkedin_url: String }) } + def to_hash + end + end + end + end +end diff --git a/rbi/context_dev/models/batch_submit_response.rbi b/rbi/context_dev/models/batch_submit_response.rbi new file mode 100644 index 00000000..fc97fc66 --- /dev/null +++ b/rbi/context_dev/models/batch_submit_response.rbi @@ -0,0 +1,1330 @@ +# typed: strong + +module ContextDev + module Models + class BatchSubmitResponse < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse, + ContextDev::Internal::AnyHash + ) + end + + # HTTP status code. + sig do + returns(ContextDev::Models::BatchSubmitResponse::Code::TaggedInteger) + end + attr_accessor :code + + # Additional response details. + sig { returns(ContextDev::Models::BatchSubmitResponse::Metadata) } + attr_reader :metadata + + sig do + params( + metadata: ContextDev::Models::BatchSubmitResponse::Metadata::OrHash + ).void + end + attr_writer :metadata + + # Retrieved person profile. + sig { returns(ContextDev::Models::BatchSubmitResponse::Person) } + attr_reader :person + + sig do + params( + person: ContextDev::Models::BatchSubmitResponse::Person::OrHash + ).void + end + attr_writer :person + + # Response status. + sig do + returns(ContextDev::Models::BatchSubmitResponse::Status::TaggedSymbol) + end + attr_accessor :status + + # 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. + sig do + returns(T.nilable(ContextDev::Models::BatchSubmitResponse::KeyMetadata)) + end + attr_reader :key_metadata + + sig do + params( + key_metadata: + ContextDev::Models::BatchSubmitResponse::KeyMetadata::OrHash + ).void + end + attr_writer :key_metadata + + sig do + params( + code: ContextDev::Models::BatchSubmitResponse::Code::OrInteger, + metadata: ContextDev::Models::BatchSubmitResponse::Metadata::OrHash, + person: ContextDev::Models::BatchSubmitResponse::Person::OrHash, + status: ContextDev::Models::BatchSubmitResponse::Status::OrSymbol, + key_metadata: + ContextDev::Models::BatchSubmitResponse::KeyMetadata::OrHash + ).returns(T.attached_class) + end + def self.new( + # HTTP status code. + code:, + # Additional response details. + metadata:, + # Retrieved person profile. + person:, + # Response status. + status:, + # 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. + key_metadata: nil + ) + end + + sig do + override.returns( + { + code: ContextDev::Models::BatchSubmitResponse::Code::TaggedInteger, + metadata: ContextDev::Models::BatchSubmitResponse::Metadata, + person: ContextDev::Models::BatchSubmitResponse::Person, + status: + ContextDev::Models::BatchSubmitResponse::Status::TaggedSymbol, + key_metadata: ContextDev::Models::BatchSubmitResponse::KeyMetadata + } + ) + end + def to_hash + end + + # HTTP status code. + module Code + extend ContextDev::Internal::Type::Enum + + TaggedInteger = + T.type_alias do + T.all(Integer, ContextDev::Models::BatchSubmitResponse::Code) + end + OrInteger = T.type_alias { Integer } + + CODE_200 = + T.let( + 200, + ContextDev::Models::BatchSubmitResponse::Code::TaggedInteger + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchSubmitResponse::Code::TaggedInteger + ] + ) + end + def self.values + end + end + + class Metadata < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Metadata, + ContextDev::Internal::AnyHash + ) + end + + # Identifiers returned for the person. + sig do + returns( + ContextDev::Models::BatchSubmitResponse::Metadata::Identifiers + ) + end + attr_reader :identifiers + + sig do + params( + identifiers: + ContextDev::Models::BatchSubmitResponse::Metadata::Identifiers::OrHash + ).void + end + attr_writer :identifiers + + # Source categories checked. + sig do + returns( + T::Array[ + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesAttempted::TaggedSymbol + ] + ) + end + attr_accessor :sources_attempted + + # Source categories with data. + sig do + returns( + T::Array[ + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesSucceeded::TaggedSymbol + ] + ) + end + attr_accessor :sources_succeeded + + # URLs reviewed for this profile. + sig { returns(T::Array[String]) } + attr_accessor :urls_analyzed + + # Personal website URL, when found. + sig { returns(T.nilable(String)) } + attr_reader :personal_website_url + + sig { params(personal_website_url: String).void } + attr_writer :personal_website_url + + # Additional response details. + sig do + params( + identifiers: + ContextDev::Models::BatchSubmitResponse::Metadata::Identifiers::OrHash, + sources_attempted: + T::Array[ + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesAttempted::OrSymbol + ], + sources_succeeded: + T::Array[ + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesSucceeded::OrSymbol + ], + urls_analyzed: T::Array[String], + personal_website_url: String + ).returns(T.attached_class) + end + def self.new( + # Identifiers returned for the person. + identifiers:, + # Source categories checked. + sources_attempted:, + # Source categories with data. + sources_succeeded:, + # URLs reviewed for this profile. + urls_analyzed:, + # Personal website URL, when found. + personal_website_url: nil + ) + end + + sig do + override.returns( + { + identifiers: + ContextDev::Models::BatchSubmitResponse::Metadata::Identifiers, + sources_attempted: + T::Array[ + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesAttempted::TaggedSymbol + ], + sources_succeeded: + T::Array[ + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesSucceeded::TaggedSymbol + ], + urls_analyzed: T::Array[String], + personal_website_url: String + } + ) + end + def to_hash + end + + class Identifiers < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Metadata::Identifiers, + ContextDev::Internal::AnyHash + ) + end + + # LinkedIn profile URL. + sig { returns(T.nilable(String)) } + attr_reader :linkedin_url + + sig { params(linkedin_url: String).void } + attr_writer :linkedin_url + + # Identifiers returned for the person. + sig { params(linkedin_url: String).returns(T.attached_class) } + def self.new( + # LinkedIn profile URL. + linkedin_url: nil + ) + end + + sig { override.returns({ linkedin_url: String }) } + def to_hash + end + end + + module SourcesAttempted + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesAttempted + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + LINKEDIN = + T.let( + :linkedin, + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesAttempted::TaggedSymbol + ) + CV = + T.let( + :cv, + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesAttempted::TaggedSymbol + ) + MANUAL = + T.let( + :manual, + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesAttempted::TaggedSymbol + ) + GITHUB = + T.let( + :github, + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesAttempted::TaggedSymbol + ) + OTHER = + T.let( + :other, + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesAttempted::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesAttempted::TaggedSymbol + ] + ) + end + def self.values + end + end + + module SourcesSucceeded + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesSucceeded + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + LINKEDIN = + T.let( + :linkedin, + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesSucceeded::TaggedSymbol + ) + CV = + T.let( + :cv, + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesSucceeded::TaggedSymbol + ) + MANUAL = + T.let( + :manual, + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesSucceeded::TaggedSymbol + ) + GITHUB = + T.let( + :github, + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesSucceeded::TaggedSymbol + ) + OTHER = + T.let( + :other, + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesSucceeded::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchSubmitResponse::Metadata::SourcesSucceeded::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Person < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Person, + ContextDev::Internal::AnyHash + ) + end + + # Education history. + sig do + returns( + T::Array[ContextDev::Models::BatchSubmitResponse::Person::Education] + ) + end + attr_accessor :education + + # Work history. + sig do + returns( + T::Array[ + ContextDev::Models::BatchSubmitResponse::Person::Experience + ] + ) + end + attr_accessor :experience + + # Core profile details. + sig do + returns(ContextDev::Models::BatchSubmitResponse::Person::Profile) + end + attr_reader :profile + + sig do + params( + profile: + ContextDev::Models::BatchSubmitResponse::Person::Profile::OrHash + ).void + end + attr_writer :profile + + # Listed skills. + sig do + returns( + T::Array[ContextDev::Models::BatchSubmitResponse::Person::Skill] + ) + end + attr_accessor :skills + + # Retrieved person profile. + sig do + params( + education: + T::Array[ + ContextDev::Models::BatchSubmitResponse::Person::Education::OrHash + ], + experience: + T::Array[ + ContextDev::Models::BatchSubmitResponse::Person::Experience::OrHash + ], + profile: + ContextDev::Models::BatchSubmitResponse::Person::Profile::OrHash, + skills: + T::Array[ + ContextDev::Models::BatchSubmitResponse::Person::Skill::OrHash + ] + ).returns(T.attached_class) + end + def self.new( + # Education history. + education:, + # Work history. + experience:, + # Core profile details. + profile:, + # Listed skills. + skills: + ) + end + + sig do + override.returns( + { + education: + T::Array[ + ContextDev::Models::BatchSubmitResponse::Person::Education + ], + experience: + T::Array[ + ContextDev::Models::BatchSubmitResponse::Person::Experience + ], + profile: ContextDev::Models::BatchSubmitResponse::Person::Profile, + skills: + T::Array[ContextDev::Models::BatchSubmitResponse::Person::Skill] + } + ) + end + def to_hash + end + + class Education < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Person::Education, + ContextDev::Internal::AnyHash + ) + end + + # School or institution name. + sig do + returns( + ContextDev::Models::BatchSubmitResponse::Person::Education::Institution + ) + end + attr_reader :institution + + sig do + params( + institution: + ContextDev::Models::BatchSubmitResponse::Person::Education::Institution::OrHash + ).void + end + attr_writer :institution + + # Education dates. + sig do + returns( + T.nilable( + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates + ) + ) + end + attr_reader :dates + + sig do + params( + dates: + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::OrHash + ).void + end + attr_writer :dates + + # Additional education details. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + # Area of study. + sig { returns(T.nilable(String)) } + attr_reader :field_of_study + + sig { params(field_of_study: String).void } + attr_writer :field_of_study + + # Degree, certificate, or credential. + sig { returns(T.nilable(String)) } + attr_reader :qualification + + sig { params(qualification: String).void } + attr_writer :qualification + + sig do + params( + institution: + ContextDev::Models::BatchSubmitResponse::Person::Education::Institution::OrHash, + dates: + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::OrHash, + description: String, + field_of_study: String, + qualification: String + ).returns(T.attached_class) + end + def self.new( + # School or institution name. + institution:, + # Education dates. + dates: nil, + # Additional education details. + description: nil, + # Area of study. + field_of_study: nil, + # Degree, certificate, or credential. + qualification: nil + ) + end + + sig do + override.returns( + { + institution: + ContextDev::Models::BatchSubmitResponse::Person::Education::Institution, + dates: + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates, + description: String, + field_of_study: String, + qualification: String + } + ) + end + def to_hash + end + + class Institution < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Person::Education::Institution, + ContextDev::Internal::AnyHash + ) + end + + # Display name. + sig { returns(String) } + attr_accessor :display_ + + # Standardized name, when available. + sig { returns(T.nilable(String)) } + attr_reader :normalized + + sig { params(normalized: String).void } + attr_writer :normalized + + # School or institution name. + sig do + params(display_: String, normalized: String).returns( + T.attached_class + ) + end + def self.new( + # Display name. + display_:, + # Standardized name, when available. + normalized: nil + ) + end + + sig { override.returns({ display_: String, normalized: String }) } + def to_hash + end + end + + class Dates < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates, + ContextDev::Internal::AnyHash + ) + end + + # End date, when known. + sig do + returns( + T.nilable( + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate + ) + ) + end + attr_reader :end_date + + sig do + params( + end_date: + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate::OrHash + ).void + end + attr_writer :end_date + + # Whether the entry is current. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_current + + sig { params(is_current: T::Boolean).void } + attr_writer :is_current + + # Start date, when known. + sig do + returns( + T.nilable( + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate + ) + ) + end + attr_reader :start_date + + sig do + params( + start_date: + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate::OrHash + ).void + end + attr_writer :start_date + + # Education dates. + sig do + params( + end_date: + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate::OrHash, + is_current: T::Boolean, + start_date: + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate::OrHash + ).returns(T.attached_class) + end + def self.new( + # End date, when known. + end_date: nil, + # Whether the entry is current. + is_current: nil, + # Start date, when known. + start_date: nil + ) + end + + sig do + override.returns( + { + end_date: + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate, + is_current: T::Boolean, + start_date: + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate + } + ) + end + def to_hash + end + + class EndDate < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate, + ContextDev::Internal::AnyHash + ) + end + + # Year value. + sig { returns(Integer) } + attr_accessor :year + + # Day value, when known. + sig { returns(T.nilable(Integer)) } + attr_reader :day + + sig { params(day: Integer).void } + attr_writer :day + + # Month value, when known. + sig { returns(T.nilable(Integer)) } + attr_reader :month + + sig { params(month: Integer).void } + attr_writer :month + + # End date, when known. + sig do + params(year: Integer, day: Integer, month: Integer).returns( + T.attached_class + ) + end + def self.new( + # Year value. + year:, + # Day value, when known. + day: nil, + # Month value, when known. + month: nil + ) + end + + sig do + override.returns( + { year: Integer, day: Integer, month: Integer } + ) + end + def to_hash + end + end + + class StartDate < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate, + ContextDev::Internal::AnyHash + ) + end + + # Year value. + sig { returns(Integer) } + attr_accessor :year + + # Day value, when known. + sig { returns(T.nilable(Integer)) } + attr_reader :day + + sig { params(day: Integer).void } + attr_writer :day + + # Month value, when known. + sig { returns(T.nilable(Integer)) } + attr_reader :month + + sig { params(month: Integer).void } + attr_writer :month + + # Start date, when known. + sig do + params(year: Integer, day: Integer, month: Integer).returns( + T.attached_class + ) + end + def self.new( + # Year value. + year:, + # Day value, when known. + day: nil, + # Month value, when known. + month: nil + ) + end + + sig do + override.returns( + { year: Integer, day: Integer, month: Integer } + ) + end + def to_hash + end + end + end + end + + class Experience < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Person::Experience, + ContextDev::Internal::AnyHash + ) + end + + # Company or organization name. + sig do + returns( + ContextDev::Models::BatchSubmitResponse::Person::Experience::Company + ) + end + attr_reader :company + + sig do + params( + company: + ContextDev::Models::BatchSubmitResponse::Person::Experience::Company::OrHash + ).void + end + attr_writer :company + + # Role or job title. + sig { returns(String) } + attr_accessor :title + + # Role dates. + sig do + returns( + T.nilable( + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates + ) + ) + end + attr_reader :dates + + sig do + params( + dates: + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::OrHash + ).void + end + attr_writer :dates + + # Role description. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + sig do + params( + company: + ContextDev::Models::BatchSubmitResponse::Person::Experience::Company::OrHash, + title: String, + dates: + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::OrHash, + description: String + ).returns(T.attached_class) + end + def self.new( + # Company or organization name. + company:, + # Role or job title. + title:, + # Role dates. + dates: nil, + # Role description. + description: nil + ) + end + + sig do + override.returns( + { + company: + ContextDev::Models::BatchSubmitResponse::Person::Experience::Company, + title: String, + dates: + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates, + description: String + } + ) + end + def to_hash + end + + class Company < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Person::Experience::Company, + ContextDev::Internal::AnyHash + ) + end + + # Display name. + sig { returns(String) } + attr_accessor :display_ + + # Standardized name, when available. + sig { returns(T.nilable(String)) } + attr_reader :normalized + + sig { params(normalized: String).void } + attr_writer :normalized + + # Company or organization name. + sig do + params(display_: String, normalized: String).returns( + T.attached_class + ) + end + def self.new( + # Display name. + display_:, + # Standardized name, when available. + normalized: nil + ) + end + + sig { override.returns({ display_: String, normalized: String }) } + def to_hash + end + end + + class Dates < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates, + ContextDev::Internal::AnyHash + ) + end + + # End date, when known. + sig do + returns( + T.nilable( + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate + ) + ) + end + attr_reader :end_date + + sig do + params( + end_date: + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate::OrHash + ).void + end + attr_writer :end_date + + # Whether the entry is current. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_current + + sig { params(is_current: T::Boolean).void } + attr_writer :is_current + + # Start date, when known. + sig do + returns( + T.nilable( + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate + ) + ) + end + attr_reader :start_date + + sig do + params( + start_date: + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate::OrHash + ).void + end + attr_writer :start_date + + # Role dates. + sig do + params( + end_date: + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate::OrHash, + is_current: T::Boolean, + start_date: + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate::OrHash + ).returns(T.attached_class) + end + def self.new( + # End date, when known. + end_date: nil, + # Whether the entry is current. + is_current: nil, + # Start date, when known. + start_date: nil + ) + end + + sig do + override.returns( + { + end_date: + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate, + is_current: T::Boolean, + start_date: + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate + } + ) + end + def to_hash + end + + class EndDate < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate, + ContextDev::Internal::AnyHash + ) + end + + # Year value. + sig { returns(Integer) } + attr_accessor :year + + # Day value, when known. + sig { returns(T.nilable(Integer)) } + attr_reader :day + + sig { params(day: Integer).void } + attr_writer :day + + # Month value, when known. + sig { returns(T.nilable(Integer)) } + attr_reader :month + + sig { params(month: Integer).void } + attr_writer :month + + # End date, when known. + sig do + params(year: Integer, day: Integer, month: Integer).returns( + T.attached_class + ) + end + def self.new( + # Year value. + year:, + # Day value, when known. + day: nil, + # Month value, when known. + month: nil + ) + end + + sig do + override.returns( + { year: Integer, day: Integer, month: Integer } + ) + end + def to_hash + end + end + + class StartDate < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate, + ContextDev::Internal::AnyHash + ) + end + + # Year value. + sig { returns(Integer) } + attr_accessor :year + + # Day value, when known. + sig { returns(T.nilable(Integer)) } + attr_reader :day + + sig { params(day: Integer).void } + attr_writer :day + + # Month value, when known. + sig { returns(T.nilable(Integer)) } + attr_reader :month + + sig { params(month: Integer).void } + attr_writer :month + + # Start date, when known. + sig do + params(year: Integer, day: Integer, month: Integer).returns( + T.attached_class + ) + end + def self.new( + # Year value. + year:, + # Day value, when known. + day: nil, + # Month value, when known. + month: nil + ) + end + + sig do + override.returns( + { year: Integer, day: Integer, month: Integer } + ) + end + def to_hash + end + end + end + end + + class Profile < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Person::Profile, + ContextDev::Internal::AnyHash + ) + end + + # Person's full name. + sig { returns(T.nilable(String)) } + attr_reader :full_name + + sig { params(full_name: String).void } + attr_writer :full_name + + # Short professional headline. + sig { returns(T.nilable(String)) } + attr_reader :headline + + sig { params(headline: String).void } + attr_writer :headline + + # Person's listed location. + sig { returns(T.nilable(String)) } + attr_reader :location + + sig { params(location: String).void } + attr_writer :location + + # Profile image URL. + sig { returns(T.nilable(String)) } + attr_reader :profile_picture_url + + sig { params(profile_picture_url: String).void } + attr_writer :profile_picture_url + + # Brief profile summary. + sig { returns(T.nilable(String)) } + attr_reader :summary + + sig { params(summary: String).void } + attr_writer :summary + + # Core profile details. + sig do + params( + full_name: String, + headline: String, + location: String, + profile_picture_url: String, + summary: String + ).returns(T.attached_class) + end + def self.new( + # Person's full name. + full_name: nil, + # Short professional headline. + headline: nil, + # Person's listed location. + location: nil, + # Profile image URL. + profile_picture_url: nil, + # Brief profile summary. + summary: nil + ) + end + + sig do + override.returns( + { + full_name: String, + headline: String, + location: String, + profile_picture_url: String, + summary: String + } + ) + end + def to_hash + end + end + + class Skill < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::Person::Skill, + ContextDev::Internal::AnyHash + ) + end + + # Skill name. + sig { returns(String) } + attr_accessor :name + + # Standardized skill name, when available. + sig { returns(T.nilable(String)) } + attr_reader :normalized + + sig { params(normalized: String).void } + attr_writer :normalized + + # Skill proficiency, when available. + sig { returns(T.nilable(String)) } + attr_reader :proficiency + + sig { params(proficiency: String).void } + attr_writer :proficiency + + sig do + params( + name: String, + normalized: String, + proficiency: String + ).returns(T.attached_class) + end + def self.new( + # Skill name. + name:, + # Standardized skill name, when available. + normalized: nil, + # Skill proficiency, when available. + proficiency: nil + ) + end + + sig do + override.returns( + { name: String, normalized: String, proficiency: String } + ) + end + def to_hash + end + end + end + + # Response status. + module Status + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::Models::BatchSubmitResponse::Status) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + OK = + T.let( + :ok, + ContextDev::Models::BatchSubmitResponse::Status::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::BatchSubmitResponse::Status::TaggedSymbol + ] + ) + end + def self.values + end + end + + class KeyMetadata < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::BatchSubmitResponse::KeyMetadata, + ContextDev::Internal::AnyHash + ) + end + + # The number of credits consumed by this request. + sig { returns(Integer) } + attr_accessor :credits_consumed + + # The number of credits remaining for your organization after this request. + sig { returns(Integer) } + attr_accessor :credits_remaining + + # 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. + sig do + params(credits_consumed: Integer, credits_remaining: Integer).returns( + T.attached_class + ) + end + def self.new( + # The number of credits consumed by this request. + credits_consumed:, + # The number of credits remaining for your organization after this request. + credits_remaining: + ) + end + + sig do + override.returns( + { credits_consumed: Integer, credits_remaining: Integer } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/context_dev/resources/batch.rbi b/rbi/context_dev/resources/batch.rbi new file mode 100644 index 00000000..d66eb762 --- /dev/null +++ b/rbi/context_dev/resources/batch.rbi @@ -0,0 +1,129 @@ +# typed: strong + +module ContextDev + module Resources + class Batch + # Check progress and get download links when the batch finishes. Also returns the + # rejected-URL list and webhook signing secret from submission, so nothing is lost + # if the submit response was dropped. + sig do + params( + batch_id: String, + tags: T::Array[String], + request_options: ContextDev::RequestOptions::OrHash + ).returns(ContextDev::Models::BatchRetrieveResponse) + end + def retrieve( + # ID of the batch to retrieve or cancel. + batch_id, + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + tags: nil, + request_options: {} + ) + end + + # List your batches from newest to oldest. Filter by status or continue with a + # cursor. + sig do + params( + cursor: String, + limit: Integer, + status: ContextDev::BatchListParams::Status::OrSymbol, + tags: T::Array[String], + request_options: ContextDev::RequestOptions::OrHash + ).returns(ContextDev::Models::BatchListResponse) + end + def list( + # Cursor from the previous page. + cursor: nil, + # Batches per page. Defaults to 25. + limit: nil, + # Filter by status. + status: nil, + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + tags: nil, + request_options: {} + ) + end + + # Stop a batch from starting new pages. In-progress pages finish, and unused + # credits are refunded. + sig do + params( + batch_id: String, + tags: T::Array[String], + request_options: ContextDev::RequestOptions::OrHash + ).returns(ContextDev::Models::BatchCancelResponse) + end + def cancel( + # ID of the batch to retrieve or cancel. + batch_id, + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + tags: nil, + request_options: {} + ) + end + + # Page through the result records of a finished batch as JSON, in the same order + # as the downloadable result files. Use this instead of downloading and parsing + # the NDJSON files yourself. + sig do + params( + batch_id: String, + cursor: String, + limit: Integer, + tags: T::Array[String], + request_options: ContextDev::RequestOptions::OrHash + ).returns(ContextDev::Models::BatchGetResultsResponse) + end + def get_results( + # ID of the batch to retrieve or cancel. + batch_id, + # next_cursor from the previous page. + cursor: nil, + # Records per page. Defaults to 25. A page can close early so its payload stays + # under ~8 MB; rely on next_cursor rather than counting records. + limit: nil, + # Optional comma-separated caller-defined tags for tracking this request. Tags are + # recorded on the request's usage log and can be used to filter usage on the + # dashboard usage page. Up to 20 tags, each 1-50 characters. + tags: nil, + request_options: {} + ) + end + + # Retrieve and normalize a person profile from identifiers. + sig do + params( + identifiers: ContextDev::BatchSubmitParams::Identifiers::OrHash, + tags: T::Array[String], + timeout_ms: Integer, + request_options: ContextDev::RequestOptions::OrHash + ).returns(ContextDev::Models::BatchSubmitResponse) + end + def submit( + # Known identifiers for the person. At least one identifier is required. + identifiers:, + # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + tags: nil, + # 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). + timeout_ms: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: ContextDev::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/sig/context_dev/client.rbs b/sig/context_dev/client.rbs index 396dd038..bab631ef 100644 --- a/sig/context_dev/client.rbs +++ b/sig/context_dev/client.rbs @@ -24,6 +24,8 @@ module ContextDev attr_reader monitors: ContextDev::Resources::Monitors + attr_reader batch: ContextDev::Resources::Batch + private def auth_headers: -> ::Hash[String, String] def initialize: ( diff --git a/sig/context_dev/models.rbs b/sig/context_dev/models.rbs index 835bb06b..378e6575 100644 --- a/sig/context_dev/models.rbs +++ b/sig/context_dev/models.rbs @@ -3,6 +3,16 @@ module ContextDev class AIExtractProductsParams = ContextDev::Models::AIExtractProductsParams + class BatchCancelParams = ContextDev::Models::BatchCancelParams + + class BatchGetResultsParams = ContextDev::Models::BatchGetResultsParams + + class BatchListParams = ContextDev::Models::BatchListParams + + class BatchRetrieveParams = ContextDev::Models::BatchRetrieveParams + + class BatchSubmitParams = ContextDev::Models::BatchSubmitParams + class BrandRetrieveParams = ContextDev::Models::BrandRetrieveParams class BrandRetrieveSimplifiedParams = ContextDev::Models::BrandRetrieveSimplifiedParams diff --git a/sig/context_dev/models/batch_cancel_params.rbs b/sig/context_dev/models/batch_cancel_params.rbs new file mode 100644 index 00000000..eea7c805 --- /dev/null +++ b/sig/context_dev/models/batch_cancel_params.rbs @@ -0,0 +1,30 @@ +module ContextDev + module Models + type batch_cancel_params = + { batch_id: String, tags: ::Array[String] } + & ContextDev::Internal::Type::request_parameters + + class BatchCancelParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + attr_accessor batch_id: String + + attr_reader tags: ::Array[String]? + + def tags=: (::Array[String]) -> ::Array[String] + + def initialize: ( + batch_id: String, + ?tags: ::Array[String], + ?request_options: ContextDev::request_opts + ) -> void + + def to_hash: -> { + batch_id: String, + tags: ::Array[String], + request_options: ContextDev::RequestOptions + } + end + end +end diff --git a/sig/context_dev/models/batch_cancel_response.rbs b/sig/context_dev/models/batch_cancel_response.rbs new file mode 100644 index 00000000..d611c8cf --- /dev/null +++ b/sig/context_dev/models/batch_cancel_response.rbs @@ -0,0 +1,273 @@ +module ContextDev + module Models + type batch_cancel_response = + { + id: String, + credits: ContextDev::Models::BatchCancelResponse::Credits, + error: ContextDev::Models::BatchCancelResponse::Error?, + errors: ::Array[ContextDev::Models::BatchCancelResponse::Error], + input: ContextDev::Models::BatchCancelResponse::Input, + mode: ContextDev::Models::BatchCancelResponse::mode, + progress: ContextDev::Models::BatchCancelResponse::Progress, + results: ContextDev::Models::BatchCancelResponse::Results?, + status: ContextDev::Models::BatchCancelResponse::status, + timing: ContextDev::Models::BatchCancelResponse::Timing, + type: ContextDev::Models::BatchCancelResponse::type_, + key_metadata: ContextDev::Models::BatchCancelResponse::KeyMetadata + } + + class BatchCancelResponse < ContextDev::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor credits: ContextDev::Models::BatchCancelResponse::Credits + + attr_accessor error: ContextDev::Models::BatchCancelResponse::Error? + + attr_accessor errors: ::Array[ContextDev::Models::BatchCancelResponse::Error] + + attr_accessor input: ContextDev::Models::BatchCancelResponse::Input + + attr_accessor mode: ContextDev::Models::BatchCancelResponse::mode + + attr_accessor progress: ContextDev::Models::BatchCancelResponse::Progress + + attr_accessor results: ContextDev::Models::BatchCancelResponse::Results? + + attr_accessor status: ContextDev::Models::BatchCancelResponse::status + + attr_accessor timing: ContextDev::Models::BatchCancelResponse::Timing + + attr_accessor type: ContextDev::Models::BatchCancelResponse::type_ + + attr_reader key_metadata: ContextDev::Models::BatchCancelResponse::KeyMetadata? + + def key_metadata=: ( + ContextDev::Models::BatchCancelResponse::KeyMetadata + ) -> ContextDev::Models::BatchCancelResponse::KeyMetadata + + def initialize: ( + id: String, + credits: ContextDev::Models::BatchCancelResponse::Credits, + error: ContextDev::Models::BatchCancelResponse::Error?, + errors: ::Array[ContextDev::Models::BatchCancelResponse::Error], + input: ContextDev::Models::BatchCancelResponse::Input, + mode: ContextDev::Models::BatchCancelResponse::mode, + progress: ContextDev::Models::BatchCancelResponse::Progress, + results: ContextDev::Models::BatchCancelResponse::Results?, + status: ContextDev::Models::BatchCancelResponse::status, + timing: ContextDev::Models::BatchCancelResponse::Timing, + type: ContextDev::Models::BatchCancelResponse::type_, + ?key_metadata: ContextDev::Models::BatchCancelResponse::KeyMetadata + ) -> void + + def to_hash: -> { + id: String, + credits: ContextDev::Models::BatchCancelResponse::Credits, + error: ContextDev::Models::BatchCancelResponse::Error?, + errors: ::Array[ContextDev::Models::BatchCancelResponse::Error], + input: ContextDev::Models::BatchCancelResponse::Input, + mode: ContextDev::Models::BatchCancelResponse::mode, + progress: ContextDev::Models::BatchCancelResponse::Progress, + results: ContextDev::Models::BatchCancelResponse::Results?, + status: ContextDev::Models::BatchCancelResponse::status, + timing: ContextDev::Models::BatchCancelResponse::Timing, + type: ContextDev::Models::BatchCancelResponse::type_, + key_metadata: ContextDev::Models::BatchCancelResponse::KeyMetadata + } + + type credits = { charged: Integer, estimated: Integer } + + class Credits < ContextDev::Internal::Type::BaseModel + attr_accessor charged: Integer + + attr_accessor estimated: Integer + + def initialize: (charged: Integer, estimated: Integer) -> void + + def to_hash: -> { charged: Integer, estimated: Integer } + end + + type error = { code: String, message: String } + + class Error < ContextDev::Internal::Type::BaseModel + attr_accessor code: String + + attr_accessor message: String + + def initialize: (code: String, message: String) -> void + + def to_hash: -> { code: String, message: String } + end + + type input = + { + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + } + + class Input < ContextDev::Internal::Type::BaseModel + attr_accessor accepted: Integer + + attr_accessor duplicates: Integer + + attr_accessor invalid: Integer + + attr_accessor submitted: Integer + + def initialize: ( + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + ) -> void + + def to_hash: -> { + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + } + end + + type mode = :scrape | :crawl + + module Mode + extend ContextDev::Internal::Type::Enum + + SCRAPE: :scrape + CRAWL: :crawl + + def self?.values: -> ::Array[ContextDev::Models::BatchCancelResponse::mode] + end + + type progress = { failed: Integer, pending: Integer, succeeded: Integer } + + class Progress < ContextDev::Internal::Type::BaseModel + attr_accessor failed: Integer + + attr_accessor pending: Integer + + attr_accessor succeeded: Integer + + def initialize: ( + failed: Integer, + pending: Integer, + succeeded: Integer + ) -> void + + def to_hash: -> { + failed: Integer, + pending: Integer, + succeeded: Integer + } + end + + type results = + { + expires_at: String, + files: ::Array[ContextDev::Models::BatchCancelResponse::Results::File] + } + + class Results < ContextDev::Internal::Type::BaseModel + attr_accessor expires_at: String + + attr_accessor files: ::Array[ContextDev::Models::BatchCancelResponse::Results::File] + + def initialize: ( + expires_at: String, + files: ::Array[ContextDev::Models::BatchCancelResponse::Results::File] + ) -> void + + def to_hash: -> { + expires_at: String, + files: ::Array[ContextDev::Models::BatchCancelResponse::Results::File] + } + + type file = { bytes: Integer, items: Integer, url: String } + + class File < ContextDev::Internal::Type::BaseModel + attr_accessor bytes: Integer + + attr_accessor items: Integer + + attr_accessor url: String + + def initialize: (bytes: Integer, items: Integer, url: String) -> void + + def to_hash: -> { bytes: Integer, items: Integer, url: String } + end + end + + type status = + :queued | :running | :cancelling | :completed | :cancelled | :failed + + module Status + extend ContextDev::Internal::Type::Enum + + QUEUED: :queued + RUNNING: :running + CANCELLING: :cancelling + COMPLETED: :completed + CANCELLED: :cancelled + FAILED: :failed + + def self?.values: -> ::Array[ContextDev::Models::BatchCancelResponse::status] + end + + type timing = + { completed_at: String?, created_at: String, started_at: String? } + + class Timing < ContextDev::Internal::Type::BaseModel + attr_accessor completed_at: String? + + attr_accessor created_at: String + + attr_accessor started_at: String? + + def initialize: ( + completed_at: String?, + created_at: String, + started_at: String? + ) -> void + + def to_hash: -> { + completed_at: String?, + created_at: String, + started_at: String? + } + end + + type type_ = :markdown | :html + + module Type + extend ContextDev::Internal::Type::Enum + + MARKDOWN: :markdown + HTML: :html + + def self?.values: -> ::Array[ContextDev::Models::BatchCancelResponse::type_] + end + + type key_metadata = + { credits_consumed: Integer, credits_remaining: Integer } + + class KeyMetadata < ContextDev::Internal::Type::BaseModel + attr_accessor credits_consumed: Integer + + attr_accessor credits_remaining: Integer + + def initialize: ( + credits_consumed: Integer, + credits_remaining: Integer + ) -> void + + def to_hash: -> { + credits_consumed: Integer, + credits_remaining: Integer + } + end + end + end +end diff --git a/sig/context_dev/models/batch_get_results_params.rbs b/sig/context_dev/models/batch_get_results_params.rbs new file mode 100644 index 00000000..5f532df0 --- /dev/null +++ b/sig/context_dev/models/batch_get_results_params.rbs @@ -0,0 +1,47 @@ +module ContextDev + module Models + type batch_get_results_params = + { + batch_id: String, + cursor: String, + limit: Integer, + tags: ::Array[String] + } + & ContextDev::Internal::Type::request_parameters + + class BatchGetResultsParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + attr_accessor batch_id: String + + attr_reader cursor: String? + + def cursor=: (String) -> String + + attr_reader limit: Integer? + + def limit=: (Integer) -> Integer + + attr_reader tags: ::Array[String]? + + def tags=: (::Array[String]) -> ::Array[String] + + def initialize: ( + batch_id: String, + ?cursor: String, + ?limit: Integer, + ?tags: ::Array[String], + ?request_options: ContextDev::request_opts + ) -> void + + def to_hash: -> { + batch_id: String, + cursor: String, + limit: Integer, + tags: ::Array[String], + request_options: ContextDev::RequestOptions + } + end + end +end diff --git a/sig/context_dev/models/batch_get_results_response.rbs b/sig/context_dev/models/batch_get_results_response.rbs new file mode 100644 index 00000000..5e51642a --- /dev/null +++ b/sig/context_dev/models/batch_get_results_response.rbs @@ -0,0 +1,399 @@ +module ContextDev + module Models + type batch_get_results_response = + { + data: ::Array[ContextDev::Models::BatchGetResultsResponse::data], + has_more: bool, + key_metadata: ContextDev::Models::BatchGetResultsResponse::KeyMetadata, + next_cursor: String? + } + + class BatchGetResultsResponse < ContextDev::Internal::Type::BaseModel + attr_reader data: ::Array[ContextDev::Models::BatchGetResultsResponse::data]? + + def data=: ( + ::Array[ContextDev::Models::BatchGetResultsResponse::data] + ) -> ::Array[ContextDev::Models::BatchGetResultsResponse::data] + + attr_reader has_more: bool? + + def has_more=: (bool) -> bool + + attr_reader key_metadata: ContextDev::Models::BatchGetResultsResponse::KeyMetadata? + + def key_metadata=: ( + ContextDev::Models::BatchGetResultsResponse::KeyMetadata + ) -> ContextDev::Models::BatchGetResultsResponse::KeyMetadata + + attr_accessor next_cursor: String? + + def initialize: ( + ?data: ::Array[ContextDev::Models::BatchGetResultsResponse::data], + ?has_more: bool, + ?key_metadata: ContextDev::Models::BatchGetResultsResponse::KeyMetadata, + ?next_cursor: String? + ) -> void + + def to_hash: -> { + data: ::Array[ContextDev::Models::BatchGetResultsResponse::data], + has_more: bool, + key_metadata: ContextDev::Models::BatchGetResultsResponse::KeyMetadata, + next_cursor: String? + } + + type data = + ContextDev::Models::BatchGetResultsResponse::Data::Ok + | ContextDev::Models::BatchGetResultsResponse::Data::Error + + module Data + extend ContextDev::Internal::Type::Union + + type ok = + { + final_url: String, + http_status: Integer?, + metadata: ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata, + status: :ok, + url: String, + html: String, + item_id: String, + markdown: String, + meta: ::Hash[Symbol, top] + } + + class Ok < ContextDev::Internal::Type::BaseModel + attr_accessor final_url: String + + attr_accessor http_status: Integer? + + attr_accessor metadata: ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata + + attr_accessor status: :ok + + attr_accessor url: String + + attr_reader html: String? + + def html=: (String) -> String + + attr_reader item_id: String? + + def item_id=: (String) -> String + + attr_reader markdown: String? + + def markdown=: (String) -> String + + attr_reader meta: ::Hash[Symbol, top]? + + def meta=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + def initialize: ( + final_url: String, + http_status: Integer?, + metadata: ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata, + url: String, + ?html: String, + ?item_id: String, + ?markdown: String, + ?meta: ::Hash[Symbol, top], + ?status: :ok + ) -> void + + def to_hash: -> { + final_url: String, + http_status: Integer?, + metadata: ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata, + status: :ok, + url: String, + html: String, + item_id: String, + markdown: String, + meta: ::Hash[Symbol, top] + } + + type metadata = + { + final_url: String, + source_url: String, + additional_meta: ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::additional_meta], + alternates: ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Alternate], + author: String, + canonical_url: String, + description: String, + favicon: String, + image: String, + json_ld: ::Array[::Hash[Symbol, top]], + keywords: ::Array[String], + language: String, + modified_time: String, + open_graph: ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::open_graph], + published_time: String, + robots: String, + site_name: String, + title: String, + twitter: ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::twitter] + } + + class Metadata < ContextDev::Internal::Type::BaseModel + attr_accessor final_url: String + + attr_accessor source_url: String + + attr_reader additional_meta: ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::additional_meta]? + + def additional_meta=: ( + ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::additional_meta] + ) -> ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::additional_meta] + + attr_reader alternates: ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Alternate]? + + def alternates=: ( + ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Alternate] + ) -> ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Alternate] + + attr_reader author: String? + + def author=: (String) -> String + + attr_reader canonical_url: String? + + def canonical_url=: (String) -> String + + attr_reader description: String? + + def description=: (String) -> String + + attr_reader favicon: String? + + def favicon=: (String) -> String + + attr_reader image: String? + + def image=: (String) -> String + + attr_reader json_ld: ::Array[::Hash[Symbol, top]]? + + def json_ld=: ( + ::Array[::Hash[Symbol, top]] + ) -> ::Array[::Hash[Symbol, top]] + + attr_reader keywords: ::Array[String]? + + def keywords=: (::Array[String]) -> ::Array[String] + + attr_reader language: String? + + def language=: (String) -> String + + attr_reader modified_time: String? + + def modified_time=: (String) -> String + + attr_reader open_graph: ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::open_graph]? + + def open_graph=: ( + ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::open_graph] + ) -> ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::open_graph] + + attr_reader published_time: String? + + def published_time=: (String) -> String + + attr_reader robots: String? + + def robots=: (String) -> String + + attr_reader site_name: String? + + def site_name=: (String) -> String + + attr_reader title: String? + + def title=: (String) -> String + + attr_reader twitter: ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::twitter]? + + def twitter=: ( + ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::twitter] + ) -> ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::twitter] + + def initialize: ( + final_url: String, + source_url: String, + ?additional_meta: ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::additional_meta], + ?alternates: ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Alternate], + ?author: String, + ?canonical_url: String, + ?description: String, + ?favicon: String, + ?image: String, + ?json_ld: ::Array[::Hash[Symbol, top]], + ?keywords: ::Array[String], + ?language: String, + ?modified_time: String, + ?open_graph: ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::open_graph], + ?published_time: String, + ?robots: String, + ?site_name: String, + ?title: String, + ?twitter: ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::twitter] + ) -> void + + def to_hash: -> { + final_url: String, + source_url: String, + additional_meta: ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::additional_meta], + alternates: ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Alternate], + author: String, + canonical_url: String, + description: String, + favicon: String, + image: String, + json_ld: ::Array[::Hash[Symbol, top]], + keywords: ::Array[String], + language: String, + modified_time: String, + open_graph: ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::open_graph], + published_time: String, + robots: String, + site_name: String, + title: String, + twitter: ::Hash[Symbol, ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::twitter] + } + + type additional_meta = String | ::Array[String] + + module AdditionalMeta + extend ContextDev::Internal::Type::Union + + def self?.variants: -> ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::additional_meta] + + StringArray: ContextDev::Internal::Type::Converter + end + + type alternate = + { href: String, hreflang: String, title: String, type: String } + + class Alternate < ContextDev::Internal::Type::BaseModel + attr_accessor href: String + + attr_reader hreflang: String? + + def hreflang=: (String) -> String + + attr_reader title: String? + + def title=: (String) -> String + + attr_reader type: String? + + def type=: (String) -> String + + def initialize: ( + href: String, + ?hreflang: String, + ?title: String, + ?type: String + ) -> void + + def to_hash: -> { + href: String, + hreflang: String, + title: String, + type: String + } + end + + type open_graph = String | ::Array[String] + + module OpenGraph + extend ContextDev::Internal::Type::Union + + def self?.variants: -> ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::open_graph] + + StringArray: ContextDev::Internal::Type::Converter + end + + type twitter = String | ::Array[String] + + module Twitter + extend ContextDev::Internal::Type::Union + + def self?.variants: -> ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::twitter] + + StringArray: ContextDev::Internal::Type::Converter + end + end + end + + type error = + { + error_code: String, + message: String, + status: :error, + url: String, + item_id: String, + meta: ::Hash[Symbol, top] + } + + class Error < ContextDev::Internal::Type::BaseModel + attr_accessor error_code: String + + attr_accessor message: String + + attr_accessor status: :error + + attr_accessor url: String + + attr_reader item_id: String? + + def item_id=: (String) -> String + + attr_reader meta: ::Hash[Symbol, top]? + + def meta=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + def initialize: ( + error_code: String, + message: String, + url: String, + ?item_id: String, + ?meta: ::Hash[Symbol, top], + ?status: :error + ) -> void + + def to_hash: -> { + error_code: String, + message: String, + status: :error, + url: String, + item_id: String, + meta: ::Hash[Symbol, top] + } + end + + def self?.variants: -> ::Array[ContextDev::Models::BatchGetResultsResponse::data] + end + + type key_metadata = + { credits_consumed: Integer, credits_remaining: Integer } + + class KeyMetadata < ContextDev::Internal::Type::BaseModel + attr_accessor credits_consumed: Integer + + attr_accessor credits_remaining: Integer + + def initialize: ( + credits_consumed: Integer, + credits_remaining: Integer + ) -> void + + def to_hash: -> { + credits_consumed: Integer, + credits_remaining: Integer + } + end + end + end +end diff --git a/sig/context_dev/models/batch_list_params.rbs b/sig/context_dev/models/batch_list_params.rbs new file mode 100644 index 00000000..31aeba31 --- /dev/null +++ b/sig/context_dev/models/batch_list_params.rbs @@ -0,0 +1,67 @@ +module ContextDev + module Models + type batch_list_params = + { + cursor: String, + limit: Integer, + status: ContextDev::Models::BatchListParams::status, + tags: ::Array[String] + } + & ContextDev::Internal::Type::request_parameters + + class BatchListParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + attr_reader cursor: String? + + def cursor=: (String) -> String + + attr_reader limit: Integer? + + def limit=: (Integer) -> Integer + + attr_reader status: ContextDev::Models::BatchListParams::status? + + def status=: ( + ContextDev::Models::BatchListParams::status + ) -> ContextDev::Models::BatchListParams::status + + attr_reader tags: ::Array[String]? + + def tags=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?cursor: String, + ?limit: Integer, + ?status: ContextDev::Models::BatchListParams::status, + ?tags: ::Array[String], + ?request_options: ContextDev::request_opts + ) -> void + + def to_hash: -> { + cursor: String, + limit: Integer, + status: ContextDev::Models::BatchListParams::status, + tags: ::Array[String], + request_options: ContextDev::RequestOptions + } + + type status = + :queued | :running | :cancelling | :completed | :cancelled | :failed + + module Status + extend ContextDev::Internal::Type::Enum + + QUEUED: :queued + RUNNING: :running + CANCELLING: :cancelling + COMPLETED: :completed + CANCELLED: :cancelled + FAILED: :failed + + def self?.values: -> ::Array[ContextDev::Models::BatchListParams::status] + end + end + end +end diff --git a/sig/context_dev/models/batch_list_response.rbs b/sig/context_dev/models/batch_list_response.rbs new file mode 100644 index 00000000..d8188cf4 --- /dev/null +++ b/sig/context_dev/models/batch_list_response.rbs @@ -0,0 +1,311 @@ +module ContextDev + module Models + type batch_list_response = + { + data: ::Array[ContextDev::Models::BatchListResponse::Data], + has_more: bool, + key_metadata: ContextDev::Models::BatchListResponse::KeyMetadata, + next_cursor: String? + } + + class BatchListResponse < ContextDev::Internal::Type::BaseModel + attr_reader data: ::Array[ContextDev::Models::BatchListResponse::Data]? + + def data=: ( + ::Array[ContextDev::Models::BatchListResponse::Data] + ) -> ::Array[ContextDev::Models::BatchListResponse::Data] + + attr_reader has_more: bool? + + def has_more=: (bool) -> bool + + attr_reader key_metadata: ContextDev::Models::BatchListResponse::KeyMetadata? + + def key_metadata=: ( + ContextDev::Models::BatchListResponse::KeyMetadata + ) -> ContextDev::Models::BatchListResponse::KeyMetadata + + attr_accessor next_cursor: String? + + def initialize: ( + ?data: ::Array[ContextDev::Models::BatchListResponse::Data], + ?has_more: bool, + ?key_metadata: ContextDev::Models::BatchListResponse::KeyMetadata, + ?next_cursor: String? + ) -> void + + def to_hash: -> { + data: ::Array[ContextDev::Models::BatchListResponse::Data], + has_more: bool, + key_metadata: ContextDev::Models::BatchListResponse::KeyMetadata, + next_cursor: String? + } + + type data = + { + id: String, + credits: ContextDev::Models::BatchListResponse::Data::Credits, + error: ContextDev::Models::BatchListResponse::Data::Error?, + errors: ::Array[ContextDev::Models::BatchListResponse::Data::Error], + input: ContextDev::Models::BatchListResponse::Data::Input, + mode: ContextDev::Models::BatchListResponse::Data::mode, + progress: ContextDev::Models::BatchListResponse::Data::Progress, + results: ContextDev::Models::BatchListResponse::Data::Results?, + status: ContextDev::Models::BatchListResponse::Data::status, + timing: ContextDev::Models::BatchListResponse::Data::Timing, + type: ContextDev::Models::BatchListResponse::Data::type_ + } + + class Data < ContextDev::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor credits: ContextDev::Models::BatchListResponse::Data::Credits + + attr_accessor error: ContextDev::Models::BatchListResponse::Data::Error? + + attr_accessor errors: ::Array[ContextDev::Models::BatchListResponse::Data::Error] + + attr_accessor input: ContextDev::Models::BatchListResponse::Data::Input + + attr_accessor mode: ContextDev::Models::BatchListResponse::Data::mode + + attr_accessor progress: ContextDev::Models::BatchListResponse::Data::Progress + + attr_accessor results: ContextDev::Models::BatchListResponse::Data::Results? + + attr_accessor status: ContextDev::Models::BatchListResponse::Data::status + + attr_accessor timing: ContextDev::Models::BatchListResponse::Data::Timing + + attr_accessor type: ContextDev::Models::BatchListResponse::Data::type_ + + def initialize: ( + id: String, + credits: ContextDev::Models::BatchListResponse::Data::Credits, + error: ContextDev::Models::BatchListResponse::Data::Error?, + errors: ::Array[ContextDev::Models::BatchListResponse::Data::Error], + input: ContextDev::Models::BatchListResponse::Data::Input, + mode: ContextDev::Models::BatchListResponse::Data::mode, + progress: ContextDev::Models::BatchListResponse::Data::Progress, + results: ContextDev::Models::BatchListResponse::Data::Results?, + status: ContextDev::Models::BatchListResponse::Data::status, + timing: ContextDev::Models::BatchListResponse::Data::Timing, + type: ContextDev::Models::BatchListResponse::Data::type_ + ) -> void + + def to_hash: -> { + id: String, + credits: ContextDev::Models::BatchListResponse::Data::Credits, + error: ContextDev::Models::BatchListResponse::Data::Error?, + errors: ::Array[ContextDev::Models::BatchListResponse::Data::Error], + input: ContextDev::Models::BatchListResponse::Data::Input, + mode: ContextDev::Models::BatchListResponse::Data::mode, + progress: ContextDev::Models::BatchListResponse::Data::Progress, + results: ContextDev::Models::BatchListResponse::Data::Results?, + status: ContextDev::Models::BatchListResponse::Data::status, + timing: ContextDev::Models::BatchListResponse::Data::Timing, + type: ContextDev::Models::BatchListResponse::Data::type_ + } + + type credits = { charged: Integer, estimated: Integer } + + class Credits < ContextDev::Internal::Type::BaseModel + attr_accessor charged: Integer + + attr_accessor estimated: Integer + + def initialize: (charged: Integer, estimated: Integer) -> void + + def to_hash: -> { charged: Integer, estimated: Integer } + end + + type error = { code: String, message: String } + + class Error < ContextDev::Internal::Type::BaseModel + attr_accessor code: String + + attr_accessor message: String + + def initialize: (code: String, message: String) -> void + + def to_hash: -> { code: String, message: String } + end + + type input = + { + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + } + + class Input < ContextDev::Internal::Type::BaseModel + attr_accessor accepted: Integer + + attr_accessor duplicates: Integer + + attr_accessor invalid: Integer + + attr_accessor submitted: Integer + + def initialize: ( + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + ) -> void + + def to_hash: -> { + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + } + end + + type mode = :scrape | :crawl + + module Mode + extend ContextDev::Internal::Type::Enum + + SCRAPE: :scrape + CRAWL: :crawl + + def self?.values: -> ::Array[ContextDev::Models::BatchListResponse::Data::mode] + end + + type progress = + { failed: Integer, pending: Integer, succeeded: Integer } + + class Progress < ContextDev::Internal::Type::BaseModel + attr_accessor failed: Integer + + attr_accessor pending: Integer + + attr_accessor succeeded: Integer + + def initialize: ( + failed: Integer, + pending: Integer, + succeeded: Integer + ) -> void + + def to_hash: -> { + failed: Integer, + pending: Integer, + succeeded: Integer + } + end + + type results = + { + expires_at: String, + files: ::Array[ContextDev::Models::BatchListResponse::Data::Results::File] + } + + class Results < ContextDev::Internal::Type::BaseModel + attr_accessor expires_at: String + + attr_accessor files: ::Array[ContextDev::Models::BatchListResponse::Data::Results::File] + + def initialize: ( + expires_at: String, + files: ::Array[ContextDev::Models::BatchListResponse::Data::Results::File] + ) -> void + + def to_hash: -> { + expires_at: String, + files: ::Array[ContextDev::Models::BatchListResponse::Data::Results::File] + } + + type file = { bytes: Integer, items: Integer, url: String } + + class File < ContextDev::Internal::Type::BaseModel + attr_accessor bytes: Integer + + attr_accessor items: Integer + + attr_accessor url: String + + def initialize: ( + bytes: Integer, + items: Integer, + url: String + ) -> void + + def to_hash: -> { bytes: Integer, items: Integer, url: String } + end + end + + type status = + :queued | :running | :cancelling | :completed | :cancelled | :failed + + module Status + extend ContextDev::Internal::Type::Enum + + QUEUED: :queued + RUNNING: :running + CANCELLING: :cancelling + COMPLETED: :completed + CANCELLED: :cancelled + FAILED: :failed + + def self?.values: -> ::Array[ContextDev::Models::BatchListResponse::Data::status] + end + + type timing = + { completed_at: String?, created_at: String, started_at: String? } + + class Timing < ContextDev::Internal::Type::BaseModel + attr_accessor completed_at: String? + + attr_accessor created_at: String + + attr_accessor started_at: String? + + def initialize: ( + completed_at: String?, + created_at: String, + started_at: String? + ) -> void + + def to_hash: -> { + completed_at: String?, + created_at: String, + started_at: String? + } + end + + type type_ = :markdown | :html + + module Type + extend ContextDev::Internal::Type::Enum + + MARKDOWN: :markdown + HTML: :html + + def self?.values: -> ::Array[ContextDev::Models::BatchListResponse::Data::type_] + end + end + + type key_metadata = + { credits_consumed: Integer, credits_remaining: Integer } + + class KeyMetadata < ContextDev::Internal::Type::BaseModel + attr_accessor credits_consumed: Integer + + attr_accessor credits_remaining: Integer + + def initialize: ( + credits_consumed: Integer, + credits_remaining: Integer + ) -> void + + def to_hash: -> { + credits_consumed: Integer, + credits_remaining: Integer + } + end + end + end +end diff --git a/sig/context_dev/models/batch_retrieve_params.rbs b/sig/context_dev/models/batch_retrieve_params.rbs new file mode 100644 index 00000000..ffe90b46 --- /dev/null +++ b/sig/context_dev/models/batch_retrieve_params.rbs @@ -0,0 +1,30 @@ +module ContextDev + module Models + type batch_retrieve_params = + { batch_id: String, tags: ::Array[String] } + & ContextDev::Internal::Type::request_parameters + + class BatchRetrieveParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + attr_accessor batch_id: String + + attr_reader tags: ::Array[String]? + + def tags=: (::Array[String]) -> ::Array[String] + + def initialize: ( + batch_id: String, + ?tags: ::Array[String], + ?request_options: ContextDev::request_opts + ) -> void + + def to_hash: -> { + batch_id: String, + tags: ::Array[String], + request_options: ContextDev::RequestOptions + } + end + end +end diff --git a/sig/context_dev/models/batch_retrieve_response.rbs b/sig/context_dev/models/batch_retrieve_response.rbs new file mode 100644 index 00000000..c9a525e2 --- /dev/null +++ b/sig/context_dev/models/batch_retrieve_response.rbs @@ -0,0 +1,297 @@ +module ContextDev + module Models + type batch_retrieve_response = + { + id: String, + credits: ContextDev::Models::BatchRetrieveResponse::Credits, + error: ContextDev::Models::BatchRetrieveResponse::Error?, + errors: ::Array[ContextDev::Models::BatchRetrieveResponse::Error], + input: ContextDev::Models::BatchRetrieveResponse::Input, + invalid_urls: ::Array[ContextDev::Models::BatchRetrieveResponse::InvalidURL], + mode: ContextDev::Models::BatchRetrieveResponse::mode, + progress: ContextDev::Models::BatchRetrieveResponse::Progress, + results: ContextDev::Models::BatchRetrieveResponse::Results?, + status: ContextDev::Models::BatchRetrieveResponse::status, + timing: ContextDev::Models::BatchRetrieveResponse::Timing, + type: ContextDev::Models::BatchRetrieveResponse::type_, + key_metadata: ContextDev::Models::BatchRetrieveResponse::KeyMetadata, + webhook_secret: String + } + + class BatchRetrieveResponse < ContextDev::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor credits: ContextDev::Models::BatchRetrieveResponse::Credits + + attr_accessor error: ContextDev::Models::BatchRetrieveResponse::Error? + + attr_accessor errors: ::Array[ContextDev::Models::BatchRetrieveResponse::Error] + + attr_accessor input: ContextDev::Models::BatchRetrieveResponse::Input + + attr_accessor invalid_urls: ::Array[ContextDev::Models::BatchRetrieveResponse::InvalidURL] + + attr_accessor mode: ContextDev::Models::BatchRetrieveResponse::mode + + attr_accessor progress: ContextDev::Models::BatchRetrieveResponse::Progress + + attr_accessor results: ContextDev::Models::BatchRetrieveResponse::Results? + + attr_accessor status: ContextDev::Models::BatchRetrieveResponse::status + + attr_accessor timing: ContextDev::Models::BatchRetrieveResponse::Timing + + attr_accessor type: ContextDev::Models::BatchRetrieveResponse::type_ + + attr_reader key_metadata: ContextDev::Models::BatchRetrieveResponse::KeyMetadata? + + def key_metadata=: ( + ContextDev::Models::BatchRetrieveResponse::KeyMetadata + ) -> ContextDev::Models::BatchRetrieveResponse::KeyMetadata + + attr_reader webhook_secret: String? + + def webhook_secret=: (String) -> String + + def initialize: ( + id: String, + credits: ContextDev::Models::BatchRetrieveResponse::Credits, + error: ContextDev::Models::BatchRetrieveResponse::Error?, + errors: ::Array[ContextDev::Models::BatchRetrieveResponse::Error], + input: ContextDev::Models::BatchRetrieveResponse::Input, + invalid_urls: ::Array[ContextDev::Models::BatchRetrieveResponse::InvalidURL], + mode: ContextDev::Models::BatchRetrieveResponse::mode, + progress: ContextDev::Models::BatchRetrieveResponse::Progress, + results: ContextDev::Models::BatchRetrieveResponse::Results?, + status: ContextDev::Models::BatchRetrieveResponse::status, + timing: ContextDev::Models::BatchRetrieveResponse::Timing, + type: ContextDev::Models::BatchRetrieveResponse::type_, + ?key_metadata: ContextDev::Models::BatchRetrieveResponse::KeyMetadata, + ?webhook_secret: String + ) -> void + + def to_hash: -> { + id: String, + credits: ContextDev::Models::BatchRetrieveResponse::Credits, + error: ContextDev::Models::BatchRetrieveResponse::Error?, + errors: ::Array[ContextDev::Models::BatchRetrieveResponse::Error], + input: ContextDev::Models::BatchRetrieveResponse::Input, + invalid_urls: ::Array[ContextDev::Models::BatchRetrieveResponse::InvalidURL], + mode: ContextDev::Models::BatchRetrieveResponse::mode, + progress: ContextDev::Models::BatchRetrieveResponse::Progress, + results: ContextDev::Models::BatchRetrieveResponse::Results?, + status: ContextDev::Models::BatchRetrieveResponse::status, + timing: ContextDev::Models::BatchRetrieveResponse::Timing, + type: ContextDev::Models::BatchRetrieveResponse::type_, + key_metadata: ContextDev::Models::BatchRetrieveResponse::KeyMetadata, + webhook_secret: String + } + + type credits = { charged: Integer, estimated: Integer } + + class Credits < ContextDev::Internal::Type::BaseModel + attr_accessor charged: Integer + + attr_accessor estimated: Integer + + def initialize: (charged: Integer, estimated: Integer) -> void + + def to_hash: -> { charged: Integer, estimated: Integer } + end + + type error = { code: String, message: String } + + class Error < ContextDev::Internal::Type::BaseModel + attr_accessor code: String + + attr_accessor message: String + + def initialize: (code: String, message: String) -> void + + def to_hash: -> { code: String, message: String } + end + + type input = + { + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + } + + class Input < ContextDev::Internal::Type::BaseModel + attr_accessor accepted: Integer + + attr_accessor duplicates: Integer + + attr_accessor invalid: Integer + + attr_accessor submitted: Integer + + def initialize: ( + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + ) -> void + + def to_hash: -> { + accepted: Integer, + duplicates: Integer, + invalid: Integer, + submitted: Integer + } + end + + type invalid_url = { reason: String, url: String } + + class InvalidURL < ContextDev::Internal::Type::BaseModel + attr_accessor reason: String + + attr_accessor url: String + + def initialize: (reason: String, url: String) -> void + + def to_hash: -> { reason: String, url: String } + end + + type mode = :scrape | :crawl + + module Mode + extend ContextDev::Internal::Type::Enum + + SCRAPE: :scrape + CRAWL: :crawl + + def self?.values: -> ::Array[ContextDev::Models::BatchRetrieveResponse::mode] + end + + type progress = { failed: Integer, pending: Integer, succeeded: Integer } + + class Progress < ContextDev::Internal::Type::BaseModel + attr_accessor failed: Integer + + attr_accessor pending: Integer + + attr_accessor succeeded: Integer + + def initialize: ( + failed: Integer, + pending: Integer, + succeeded: Integer + ) -> void + + def to_hash: -> { + failed: Integer, + pending: Integer, + succeeded: Integer + } + end + + type results = + { + expires_at: String, + files: ::Array[ContextDev::Models::BatchRetrieveResponse::Results::File] + } + + class Results < ContextDev::Internal::Type::BaseModel + attr_accessor expires_at: String + + attr_accessor files: ::Array[ContextDev::Models::BatchRetrieveResponse::Results::File] + + def initialize: ( + expires_at: String, + files: ::Array[ContextDev::Models::BatchRetrieveResponse::Results::File] + ) -> void + + def to_hash: -> { + expires_at: String, + files: ::Array[ContextDev::Models::BatchRetrieveResponse::Results::File] + } + + type file = { bytes: Integer, items: Integer, url: String } + + class File < ContextDev::Internal::Type::BaseModel + attr_accessor bytes: Integer + + attr_accessor items: Integer + + attr_accessor url: String + + def initialize: (bytes: Integer, items: Integer, url: String) -> void + + def to_hash: -> { bytes: Integer, items: Integer, url: String } + end + end + + type status = + :queued | :running | :cancelling | :completed | :cancelled | :failed + + module Status + extend ContextDev::Internal::Type::Enum + + QUEUED: :queued + RUNNING: :running + CANCELLING: :cancelling + COMPLETED: :completed + CANCELLED: :cancelled + FAILED: :failed + + def self?.values: -> ::Array[ContextDev::Models::BatchRetrieveResponse::status] + end + + type timing = + { completed_at: String?, created_at: String, started_at: String? } + + class Timing < ContextDev::Internal::Type::BaseModel + attr_accessor completed_at: String? + + attr_accessor created_at: String + + attr_accessor started_at: String? + + def initialize: ( + completed_at: String?, + created_at: String, + started_at: String? + ) -> void + + def to_hash: -> { + completed_at: String?, + created_at: String, + started_at: String? + } + end + + type type_ = :markdown | :html + + module Type + extend ContextDev::Internal::Type::Enum + + MARKDOWN: :markdown + HTML: :html + + def self?.values: -> ::Array[ContextDev::Models::BatchRetrieveResponse::type_] + end + + type key_metadata = + { credits_consumed: Integer, credits_remaining: Integer } + + class KeyMetadata < ContextDev::Internal::Type::BaseModel + attr_accessor credits_consumed: Integer + + attr_accessor credits_remaining: Integer + + def initialize: ( + credits_consumed: Integer, + credits_remaining: Integer + ) -> void + + def to_hash: -> { + credits_consumed: Integer, + credits_remaining: Integer + } + end + end + end +end diff --git a/sig/context_dev/models/batch_submit_params.rbs b/sig/context_dev/models/batch_submit_params.rbs new file mode 100644 index 00000000..f87d9269 --- /dev/null +++ b/sig/context_dev/models/batch_submit_params.rbs @@ -0,0 +1,52 @@ +module ContextDev + module Models + type batch_submit_params = + { + identifiers: ContextDev::BatchSubmitParams::Identifiers, + tags: ::Array[String], + timeout_ms: Integer + } + & ContextDev::Internal::Type::request_parameters + + class BatchSubmitParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + attr_accessor identifiers: ContextDev::BatchSubmitParams::Identifiers + + attr_reader tags: ::Array[String]? + + def tags=: (::Array[String]) -> ::Array[String] + + attr_reader timeout_ms: Integer? + + def timeout_ms=: (Integer) -> Integer + + def initialize: ( + identifiers: ContextDev::BatchSubmitParams::Identifiers, + ?tags: ::Array[String], + ?timeout_ms: Integer, + ?request_options: ContextDev::request_opts + ) -> void + + def to_hash: -> { + identifiers: ContextDev::BatchSubmitParams::Identifiers, + tags: ::Array[String], + timeout_ms: Integer, + request_options: ContextDev::RequestOptions + } + + type identifiers = { linkedin_url: String } + + class Identifiers < ContextDev::Internal::Type::BaseModel + attr_reader linkedin_url: String? + + def linkedin_url=: (String) -> String + + def initialize: (?linkedin_url: String) -> void + + def to_hash: -> { linkedin_url: String } + end + end + end +end diff --git a/sig/context_dev/models/batch_submit_response.rbs b/sig/context_dev/models/batch_submit_response.rbs new file mode 100644 index 00000000..5d71f18a --- /dev/null +++ b/sig/context_dev/models/batch_submit_response.rbs @@ -0,0 +1,542 @@ +module ContextDev + module Models + type batch_submit_response = + { + code: ContextDev::Models::BatchSubmitResponse::code, + metadata: ContextDev::Models::BatchSubmitResponse::Metadata, + person: ContextDev::Models::BatchSubmitResponse::Person, + status: ContextDev::Models::BatchSubmitResponse::status, + key_metadata: ContextDev::Models::BatchSubmitResponse::KeyMetadata + } + + class BatchSubmitResponse < ContextDev::Internal::Type::BaseModel + attr_accessor code: ContextDev::Models::BatchSubmitResponse::code + + attr_accessor metadata: ContextDev::Models::BatchSubmitResponse::Metadata + + attr_accessor person: ContextDev::Models::BatchSubmitResponse::Person + + attr_accessor status: ContextDev::Models::BatchSubmitResponse::status + + attr_reader key_metadata: ContextDev::Models::BatchSubmitResponse::KeyMetadata? + + def key_metadata=: ( + ContextDev::Models::BatchSubmitResponse::KeyMetadata + ) -> ContextDev::Models::BatchSubmitResponse::KeyMetadata + + def initialize: ( + code: ContextDev::Models::BatchSubmitResponse::code, + metadata: ContextDev::Models::BatchSubmitResponse::Metadata, + person: ContextDev::Models::BatchSubmitResponse::Person, + status: ContextDev::Models::BatchSubmitResponse::status, + ?key_metadata: ContextDev::Models::BatchSubmitResponse::KeyMetadata + ) -> void + + def to_hash: -> { + code: ContextDev::Models::BatchSubmitResponse::code, + metadata: ContextDev::Models::BatchSubmitResponse::Metadata, + person: ContextDev::Models::BatchSubmitResponse::Person, + status: ContextDev::Models::BatchSubmitResponse::status, + key_metadata: ContextDev::Models::BatchSubmitResponse::KeyMetadata + } + + type code = 200 + + module Code + extend ContextDev::Internal::Type::Enum + + CODE_200: 200 + + def self?.values: -> ::Array[ContextDev::Models::BatchSubmitResponse::code] + end + + type metadata = + { + identifiers: ContextDev::Models::BatchSubmitResponse::Metadata::Identifiers, + sources_attempted: ::Array[ContextDev::Models::BatchSubmitResponse::Metadata::sources_attempted], + sources_succeeded: ::Array[ContextDev::Models::BatchSubmitResponse::Metadata::sources_succeeded], + urls_analyzed: ::Array[String], + personal_website_url: String + } + + class Metadata < ContextDev::Internal::Type::BaseModel + attr_accessor identifiers: ContextDev::Models::BatchSubmitResponse::Metadata::Identifiers + + attr_accessor sources_attempted: ::Array[ContextDev::Models::BatchSubmitResponse::Metadata::sources_attempted] + + attr_accessor sources_succeeded: ::Array[ContextDev::Models::BatchSubmitResponse::Metadata::sources_succeeded] + + attr_accessor urls_analyzed: ::Array[String] + + attr_reader personal_website_url: String? + + def personal_website_url=: (String) -> String + + def initialize: ( + identifiers: ContextDev::Models::BatchSubmitResponse::Metadata::Identifiers, + sources_attempted: ::Array[ContextDev::Models::BatchSubmitResponse::Metadata::sources_attempted], + sources_succeeded: ::Array[ContextDev::Models::BatchSubmitResponse::Metadata::sources_succeeded], + urls_analyzed: ::Array[String], + ?personal_website_url: String + ) -> void + + def to_hash: -> { + identifiers: ContextDev::Models::BatchSubmitResponse::Metadata::Identifiers, + sources_attempted: ::Array[ContextDev::Models::BatchSubmitResponse::Metadata::sources_attempted], + sources_succeeded: ::Array[ContextDev::Models::BatchSubmitResponse::Metadata::sources_succeeded], + urls_analyzed: ::Array[String], + personal_website_url: String + } + + type identifiers = { linkedin_url: String } + + class Identifiers < ContextDev::Internal::Type::BaseModel + attr_reader linkedin_url: String? + + def linkedin_url=: (String) -> String + + def initialize: (?linkedin_url: String) -> void + + def to_hash: -> { linkedin_url: String } + end + + type sources_attempted = :linkedin | :cv | :manual | :github | :other + + module SourcesAttempted + extend ContextDev::Internal::Type::Enum + + LINKEDIN: :linkedin + CV: :cv + MANUAL: :manual + GITHUB: :github + OTHER: :other + + def self?.values: -> ::Array[ContextDev::Models::BatchSubmitResponse::Metadata::sources_attempted] + end + + type sources_succeeded = :linkedin | :cv | :manual | :github | :other + + module SourcesSucceeded + extend ContextDev::Internal::Type::Enum + + LINKEDIN: :linkedin + CV: :cv + MANUAL: :manual + GITHUB: :github + OTHER: :other + + def self?.values: -> ::Array[ContextDev::Models::BatchSubmitResponse::Metadata::sources_succeeded] + end + end + + type person = + { + education: ::Array[ContextDev::Models::BatchSubmitResponse::Person::Education], + experience: ::Array[ContextDev::Models::BatchSubmitResponse::Person::Experience], + profile: ContextDev::Models::BatchSubmitResponse::Person::Profile, + skills: ::Array[ContextDev::Models::BatchSubmitResponse::Person::Skill] + } + + class Person < ContextDev::Internal::Type::BaseModel + attr_accessor education: ::Array[ContextDev::Models::BatchSubmitResponse::Person::Education] + + attr_accessor experience: ::Array[ContextDev::Models::BatchSubmitResponse::Person::Experience] + + attr_accessor profile: ContextDev::Models::BatchSubmitResponse::Person::Profile + + attr_accessor skills: ::Array[ContextDev::Models::BatchSubmitResponse::Person::Skill] + + def initialize: ( + education: ::Array[ContextDev::Models::BatchSubmitResponse::Person::Education], + experience: ::Array[ContextDev::Models::BatchSubmitResponse::Person::Experience], + profile: ContextDev::Models::BatchSubmitResponse::Person::Profile, + skills: ::Array[ContextDev::Models::BatchSubmitResponse::Person::Skill] + ) -> void + + def to_hash: -> { + education: ::Array[ContextDev::Models::BatchSubmitResponse::Person::Education], + experience: ::Array[ContextDev::Models::BatchSubmitResponse::Person::Experience], + profile: ContextDev::Models::BatchSubmitResponse::Person::Profile, + skills: ::Array[ContextDev::Models::BatchSubmitResponse::Person::Skill] + } + + type education = + { + institution: ContextDev::Models::BatchSubmitResponse::Person::Education::Institution, + dates: ContextDev::Models::BatchSubmitResponse::Person::Education::Dates, + description: String, + field_of_study: String, + qualification: String + } + + class Education < ContextDev::Internal::Type::BaseModel + attr_accessor institution: ContextDev::Models::BatchSubmitResponse::Person::Education::Institution + + attr_reader dates: ContextDev::Models::BatchSubmitResponse::Person::Education::Dates? + + def dates=: ( + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates + ) -> ContextDev::Models::BatchSubmitResponse::Person::Education::Dates + + attr_reader description: String? + + def description=: (String) -> String + + attr_reader field_of_study: String? + + def field_of_study=: (String) -> String + + attr_reader qualification: String? + + def qualification=: (String) -> String + + def initialize: ( + institution: ContextDev::Models::BatchSubmitResponse::Person::Education::Institution, + ?dates: ContextDev::Models::BatchSubmitResponse::Person::Education::Dates, + ?description: String, + ?field_of_study: String, + ?qualification: String + ) -> void + + def to_hash: -> { + institution: ContextDev::Models::BatchSubmitResponse::Person::Education::Institution, + dates: ContextDev::Models::BatchSubmitResponse::Person::Education::Dates, + description: String, + field_of_study: String, + qualification: String + } + + type institution = { display_: String, normalized: String } + + class Institution < ContextDev::Internal::Type::BaseModel + attr_accessor display_: String + + attr_reader normalized: String? + + def normalized=: (String) -> String + + def initialize: (display_: String, ?normalized: String) -> void + + def to_hash: -> { display_: String, normalized: String } + end + + type dates = + { + end_date: ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate, + is_current: bool, + start_date: ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate + } + + class Dates < ContextDev::Internal::Type::BaseModel + attr_reader end_date: ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate? + + def end_date=: ( + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate + ) -> ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate + + attr_reader is_current: bool? + + def is_current=: (bool) -> bool + + attr_reader start_date: ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate? + + def start_date=: ( + ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate + ) -> ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate + + def initialize: ( + ?end_date: ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate, + ?is_current: bool, + ?start_date: ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate + ) -> void + + def to_hash: -> { + end_date: ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::EndDate, + is_current: bool, + start_date: ContextDev::Models::BatchSubmitResponse::Person::Education::Dates::StartDate + } + + type end_date = { year: Integer, day: Integer, month: Integer } + + class EndDate < ContextDev::Internal::Type::BaseModel + attr_accessor year: Integer + + attr_reader day: Integer? + + def day=: (Integer) -> Integer + + attr_reader month: Integer? + + def month=: (Integer) -> Integer + + def initialize: ( + year: Integer, + ?day: Integer, + ?month: Integer + ) -> void + + def to_hash: -> { year: Integer, day: Integer, month: Integer } + end + + type start_date = { year: Integer, day: Integer, month: Integer } + + class StartDate < ContextDev::Internal::Type::BaseModel + attr_accessor year: Integer + + attr_reader day: Integer? + + def day=: (Integer) -> Integer + + attr_reader month: Integer? + + def month=: (Integer) -> Integer + + def initialize: ( + year: Integer, + ?day: Integer, + ?month: Integer + ) -> void + + def to_hash: -> { year: Integer, day: Integer, month: Integer } + end + end + end + + type experience = + { + company: ContextDev::Models::BatchSubmitResponse::Person::Experience::Company, + title: String, + dates: ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates, + description: String + } + + class Experience < ContextDev::Internal::Type::BaseModel + attr_accessor company: ContextDev::Models::BatchSubmitResponse::Person::Experience::Company + + attr_accessor title: String + + attr_reader dates: ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates? + + def dates=: ( + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates + ) -> ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates + + attr_reader description: String? + + def description=: (String) -> String + + def initialize: ( + company: ContextDev::Models::BatchSubmitResponse::Person::Experience::Company, + title: String, + ?dates: ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates, + ?description: String + ) -> void + + def to_hash: -> { + company: ContextDev::Models::BatchSubmitResponse::Person::Experience::Company, + title: String, + dates: ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates, + description: String + } + + type company = { display_: String, normalized: String } + + class Company < ContextDev::Internal::Type::BaseModel + attr_accessor display_: String + + attr_reader normalized: String? + + def normalized=: (String) -> String + + def initialize: (display_: String, ?normalized: String) -> void + + def to_hash: -> { display_: String, normalized: String } + end + + type dates = + { + end_date: ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate, + is_current: bool, + start_date: ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate + } + + class Dates < ContextDev::Internal::Type::BaseModel + attr_reader end_date: ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate? + + def end_date=: ( + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate + ) -> ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate + + attr_reader is_current: bool? + + def is_current=: (bool) -> bool + + attr_reader start_date: ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate? + + def start_date=: ( + ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate + ) -> ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate + + def initialize: ( + ?end_date: ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate, + ?is_current: bool, + ?start_date: ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate + ) -> void + + def to_hash: -> { + end_date: ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::EndDate, + is_current: bool, + start_date: ContextDev::Models::BatchSubmitResponse::Person::Experience::Dates::StartDate + } + + type end_date = { year: Integer, day: Integer, month: Integer } + + class EndDate < ContextDev::Internal::Type::BaseModel + attr_accessor year: Integer + + attr_reader day: Integer? + + def day=: (Integer) -> Integer + + attr_reader month: Integer? + + def month=: (Integer) -> Integer + + def initialize: ( + year: Integer, + ?day: Integer, + ?month: Integer + ) -> void + + def to_hash: -> { year: Integer, day: Integer, month: Integer } + end + + type start_date = { year: Integer, day: Integer, month: Integer } + + class StartDate < ContextDev::Internal::Type::BaseModel + attr_accessor year: Integer + + attr_reader day: Integer? + + def day=: (Integer) -> Integer + + attr_reader month: Integer? + + def month=: (Integer) -> Integer + + def initialize: ( + year: Integer, + ?day: Integer, + ?month: Integer + ) -> void + + def to_hash: -> { year: Integer, day: Integer, month: Integer } + end + end + end + + type profile = + { + full_name: String, + headline: String, + location: String, + profile_picture_url: String, + summary: String + } + + class Profile < ContextDev::Internal::Type::BaseModel + attr_reader full_name: String? + + def full_name=: (String) -> String + + attr_reader headline: String? + + def headline=: (String) -> String + + attr_reader location: String? + + def location=: (String) -> String + + attr_reader profile_picture_url: String? + + def profile_picture_url=: (String) -> String + + attr_reader summary: String? + + def summary=: (String) -> String + + def initialize: ( + ?full_name: String, + ?headline: String, + ?location: String, + ?profile_picture_url: String, + ?summary: String + ) -> void + + def to_hash: -> { + full_name: String, + headline: String, + location: String, + profile_picture_url: String, + summary: String + } + end + + type skill = { name: String, normalized: String, proficiency: String } + + class Skill < ContextDev::Internal::Type::BaseModel + attr_accessor name: String + + attr_reader normalized: String? + + def normalized=: (String) -> String + + attr_reader proficiency: String? + + def proficiency=: (String) -> String + + def initialize: ( + name: String, + ?normalized: String, + ?proficiency: String + ) -> void + + def to_hash: -> { + name: String, + normalized: String, + proficiency: String + } + end + end + + type status = :ok + + module Status + extend ContextDev::Internal::Type::Enum + + OK: :ok + + def self?.values: -> ::Array[ContextDev::Models::BatchSubmitResponse::status] + end + + type key_metadata = + { credits_consumed: Integer, credits_remaining: Integer } + + class KeyMetadata < ContextDev::Internal::Type::BaseModel + attr_accessor credits_consumed: Integer + + attr_accessor credits_remaining: Integer + + def initialize: ( + credits_consumed: Integer, + credits_remaining: Integer + ) -> void + + def to_hash: -> { + credits_consumed: Integer, + credits_remaining: Integer + } + end + end + end +end diff --git a/sig/context_dev/resources/batch.rbs b/sig/context_dev/resources/batch.rbs new file mode 100644 index 00000000..af8dc081 --- /dev/null +++ b/sig/context_dev/resources/batch.rbs @@ -0,0 +1,42 @@ +module ContextDev + module Resources + class Batch + def retrieve: ( + String batch_id, + ?tags: ::Array[String], + ?request_options: ContextDev::request_opts + ) -> ContextDev::Models::BatchRetrieveResponse + + def list: ( + ?cursor: String, + ?limit: Integer, + ?status: ContextDev::Models::BatchListParams::status, + ?tags: ::Array[String], + ?request_options: ContextDev::request_opts + ) -> ContextDev::Models::BatchListResponse + + def cancel: ( + String batch_id, + ?tags: ::Array[String], + ?request_options: ContextDev::request_opts + ) -> ContextDev::Models::BatchCancelResponse + + def get_results: ( + String batch_id, + ?cursor: String, + ?limit: Integer, + ?tags: ::Array[String], + ?request_options: ContextDev::request_opts + ) -> ContextDev::Models::BatchGetResultsResponse + + def submit: ( + identifiers: ContextDev::BatchSubmitParams::Identifiers, + ?tags: ::Array[String], + ?timeout_ms: Integer, + ?request_options: ContextDev::request_opts + ) -> ContextDev::Models::BatchSubmitResponse + + def initialize: (client: ContextDev::Client) -> void + end + end +end diff --git a/test/context_dev/resources/batch_test.rb b/test/context_dev/resources/batch_test.rb new file mode 100644 index 00000000..120d434b --- /dev/null +++ b/test/context_dev/resources/batch_test.rb @@ -0,0 +1,119 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class ContextDev::Test::Resources::BatchTest < ContextDev::Test::ResourceTest + def test_retrieve + skip("Mock server tests are disabled") + + response = @context_dev.batch.retrieve("batch_9f2c8a") + + assert_pattern do + response => ContextDev::Models::BatchRetrieveResponse + end + + assert_pattern do + response => { + id: String, + credits: ContextDev::Models::BatchRetrieveResponse::Credits, + error: ContextDev::Models::BatchRetrieveResponse::Error | nil, + errors: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchRetrieveResponse::Error]), + input: ContextDev::Models::BatchRetrieveResponse::Input, + invalid_urls: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchRetrieveResponse::InvalidURL]), + mode: ContextDev::Models::BatchRetrieveResponse::Mode, + progress: ContextDev::Models::BatchRetrieveResponse::Progress, + results: ContextDev::Models::BatchRetrieveResponse::Results | nil, + status: ContextDev::Models::BatchRetrieveResponse::Status, + timing: ContextDev::Models::BatchRetrieveResponse::Timing, + type: ContextDev::Models::BatchRetrieveResponse::Type, + key_metadata: ContextDev::Models::BatchRetrieveResponse::KeyMetadata | nil, + webhook_secret: String | nil + } + end + end + + def test_list + skip("Mock server tests are disabled") + + response = @context_dev.batch.list + + assert_pattern do + response => ContextDev::Models::BatchListResponse + end + + assert_pattern do + response => { + data: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchListResponse::Data]) | nil, + has_more: ContextDev::Internal::Type::Boolean | nil, + key_metadata: ContextDev::Models::BatchListResponse::KeyMetadata | nil, + next_cursor: String | nil + } + end + end + + def test_cancel + skip("Mock server tests are disabled") + + response = @context_dev.batch.cancel("batch_9f2c8a") + + assert_pattern do + response => ContextDev::Models::BatchCancelResponse + end + + assert_pattern do + response => { + id: String, + credits: ContextDev::Models::BatchCancelResponse::Credits, + error: ContextDev::Models::BatchCancelResponse::Error | nil, + errors: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchCancelResponse::Error]), + input: ContextDev::Models::BatchCancelResponse::Input, + mode: ContextDev::Models::BatchCancelResponse::Mode, + progress: ContextDev::Models::BatchCancelResponse::Progress, + results: ContextDev::Models::BatchCancelResponse::Results | nil, + status: ContextDev::Models::BatchCancelResponse::Status, + timing: ContextDev::Models::BatchCancelResponse::Timing, + type: ContextDev::Models::BatchCancelResponse::Type, + key_metadata: ContextDev::Models::BatchCancelResponse::KeyMetadata | nil + } + end + end + + def test_get_results + skip("Mock server tests are disabled") + + response = @context_dev.batch.get_results("batch_9f2c8a") + + assert_pattern do + response => ContextDev::Models::BatchGetResultsResponse + end + + assert_pattern do + response => { + data: ^(ContextDev::Internal::Type::ArrayOf[union: ContextDev::Models::BatchGetResultsResponse::Data]) | nil, + has_more: ContextDev::Internal::Type::Boolean | nil, + key_metadata: ContextDev::Models::BatchGetResultsResponse::KeyMetadata | nil, + next_cursor: String | nil + } + end + end + + def test_submit_required_params + skip("Mock server tests are disabled") + + response = @context_dev.batch.submit(identifiers: {}) + + assert_pattern do + response => ContextDev::Models::BatchSubmitResponse + end + + assert_pattern do + response => { + code: ContextDev::Models::BatchSubmitResponse::Code, + metadata: ContextDev::Models::BatchSubmitResponse::Metadata, + person: ContextDev::Models::BatchSubmitResponse::Person, + status: ContextDev::Models::BatchSubmitResponse::Status, + key_metadata: ContextDev::Models::BatchSubmitResponse::KeyMetadata | nil + } + end + end +end From 7a5cc9aa3bd2c746d0e47a58fbc426453db3b8c7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 21:32:44 +0000 Subject: [PATCH 05/11] feat(api): api update --- .stats.yml | 4 +- lib/context_dev/models/batch_cancel_params.rb | 15 +--- .../models/batch_cancel_response.rb | 10 ++- .../models/batch_get_results_params.rb | 12 +-- lib/context_dev/models/batch_list_params.rb | 42 +++++++++-- lib/context_dev/models/batch_list_response.rb | 10 ++- .../models/batch_retrieve_params.rb | 15 +--- .../models/batch_retrieve_response.rb | 10 ++- lib/context_dev/resources/batch.rb | 36 +++------ .../models/batch_cancel_params.rbi | 20 +---- .../models/batch_cancel_response.rbi | 8 ++ .../models/batch_get_results_params.rbi | 15 ---- rbi/context_dev/models/batch_list_params.rbi | 73 ++++++++++++++++--- .../models/batch_list_response.rbi | 8 ++ .../models/batch_retrieve_params.rbi | 20 +---- .../models/batch_retrieve_response.rbi | 8 ++ rbi/context_dev/resources/batch.rbi | 29 +++----- .../models/batch_cancel_params.rbs | 9 +-- .../models/batch_cancel_response.rbs | 5 ++ .../models/batch_get_results_params.rbs | 13 +--- sig/context_dev/models/batch_list_params.rbs | 37 ++++++++-- .../models/batch_list_response.rbs | 5 ++ .../models/batch_retrieve_params.rbs | 9 +-- .../models/batch_retrieve_response.rbs | 5 ++ sig/context_dev/resources/batch.rbs | 7 +- test/context_dev/resources/batch_test.rb | 2 + 26 files changed, 232 insertions(+), 195 deletions(-) diff --git a/.stats.yml b/.stats.yml index a173ebea..86253ea2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-6dfc33639ef5ad1fd0fa05f9f00fcdd59940188ef625252c6ee9db85c6f8fc59.yml -openapi_spec_hash: fb66e1f80fb2aad8adc4ae37d69bdc02 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-cdff38301573d05fdad8416847402472ff6cb1ce75a9de9f99e8673ddec7c4a6.yml +openapi_spec_hash: 387fe6f53599abb0341764e00bcd0b26 config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/lib/context_dev/models/batch_cancel_params.rb b/lib/context_dev/models/batch_cancel_params.rb index 0a888d0a..52bcb528 100644 --- a/lib/context_dev/models/batch_cancel_params.rb +++ b/lib/context_dev/models/batch_cancel_params.rb @@ -13,22 +13,9 @@ class BatchCancelParams < ContextDev::Internal::Type::BaseModel # @return [String] required :batch_id, String - # @!attribute tags - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. - # - # @return [Array, nil] - optional :tags, ContextDev::Internal::Type::ArrayOf[String] - - # @!method initialize(batch_id:, tags: nil, request_options: {}) - # Some parameter documentations has been truncated, see - # {ContextDev::Models::BatchCancelParams} for more details. - # + # @!method initialize(batch_id:, request_options: {}) # @param batch_id [String] ID of the batch to retrieve or cancel. # - # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are - # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/context_dev/models/batch_cancel_response.rb b/lib/context_dev/models/batch_cancel_response.rb index dbd82958..f0a0b88d 100644 --- a/lib/context_dev/models/batch_cancel_response.rb +++ b/lib/context_dev/models/batch_cancel_response.rb @@ -60,6 +60,12 @@ class BatchCancelResponse < ContextDev::Internal::Type::BaseModel # @return [Symbol, ContextDev::Models::BatchCancelResponse::Status] required :status, enum: -> { ContextDev::Models::BatchCancelResponse::Status } + # @!attribute tags + # Tags stored on the batch at submission. + # + # @return [Array] + required :tags, ContextDev::Internal::Type::ArrayOf[String] + # @!attribute timing # # @return [ContextDev::Models::BatchCancelResponse::Timing] @@ -77,7 +83,7 @@ class BatchCancelResponse < ContextDev::Internal::Type::BaseModel # @return [ContextDev::Models::BatchCancelResponse::KeyMetadata, nil] optional :key_metadata, -> { ContextDev::Models::BatchCancelResponse::KeyMetadata } - # @!method initialize(id:, credits:, error:, errors:, input:, mode:, progress:, results:, status:, timing:, type:, key_metadata: nil) + # @!method initialize(id:, credits:, error:, errors:, input:, mode:, progress:, results:, status:, tags:, timing:, type:, key_metadata: nil) # Some parameter documentations has been truncated, see # {ContextDev::Models::BatchCancelResponse} for more details. # @@ -99,6 +105,8 @@ class BatchCancelResponse < ContextDev::Internal::Type::BaseModel # # @param status [Symbol, ContextDev::Models::BatchCancelResponse::Status] Current state. `completed`, `cancelled`, and `failed` are final. # + # @param tags [Array] Tags stored on the batch at submission. + # # @param timing [ContextDev::Models::BatchCancelResponse::Timing] # # @param type [Symbol, ContextDev::Models::BatchCancelResponse::Type] Output format. diff --git a/lib/context_dev/models/batch_get_results_params.rb b/lib/context_dev/models/batch_get_results_params.rb index 08636146..718473ec 100644 --- a/lib/context_dev/models/batch_get_results_params.rb +++ b/lib/context_dev/models/batch_get_results_params.rb @@ -26,15 +26,7 @@ class BatchGetResultsParams < ContextDev::Internal::Type::BaseModel # @return [Integer, nil] optional :limit, Integer - # @!attribute tags - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. - # - # @return [Array, nil] - optional :tags, ContextDev::Internal::Type::ArrayOf[String] - - # @!method initialize(batch_id:, cursor: nil, limit: nil, tags: nil, request_options: {}) + # @!method initialize(batch_id:, cursor: nil, limit: nil, request_options: {}) # Some parameter documentations has been truncated, see # {ContextDev::Models::BatchGetResultsParams} for more details. # @@ -44,8 +36,6 @@ class BatchGetResultsParams < ContextDev::Internal::Type::BaseModel # # @param limit [Integer] Records per page. Defaults to 25. A page can close early so its payload stays un # - # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are - # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/context_dev/models/batch_list_params.rb b/lib/context_dev/models/batch_list_params.rb index f5c743c6..32af65ea 100644 --- a/lib/context_dev/models/batch_list_params.rb +++ b/lib/context_dev/models/batch_list_params.rb @@ -19,6 +19,20 @@ class BatchListParams < ContextDev::Internal::Type::BaseModel # @return [Integer, nil] optional :limit, Integer + # @!attribute q + # Free-text search term, matched against the batch id, crawl source (start URL or + # sitemap domain), and tags. + # + # @return [String, nil] + optional :q, String + + # @!attribute search_type + # `prefix` for as-you-type prefix matching (default), `exact` for full-token + # matching. + # + # @return [Symbol, ContextDev::Models::BatchListParams::SearchType, nil] + optional :search_type, enum: -> { ContextDev::BatchListParams::SearchType } + # @!attribute status # Filter by status. # @@ -26,14 +40,12 @@ class BatchListParams < ContextDev::Internal::Type::BaseModel optional :status, enum: -> { ContextDev::BatchListParams::Status } # @!attribute tags - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. + # Comma-separated list of tags to filter by (matches batches having any of them). # - # @return [Array, nil] - optional :tags, ContextDev::Internal::Type::ArrayOf[String] + # @return [String, nil] + optional :tags, String - # @!method initialize(cursor: nil, limit: nil, status: nil, tags: nil, request_options: {}) + # @!method initialize(cursor: nil, limit: nil, q: nil, search_type: nil, status: nil, tags: nil, request_options: {}) # Some parameter documentations has been truncated, see # {ContextDev::Models::BatchListParams} for more details. # @@ -41,12 +53,28 @@ class BatchListParams < ContextDev::Internal::Type::BaseModel # # @param limit [Integer] Batches per page. Defaults to 25. # + # @param q [String] Free-text search term, matched against the batch id, crawl source (start URL or + # + # @param search_type [Symbol, ContextDev::Models::BatchListParams::SearchType] `prefix` for as-you-type prefix matching (default), `exact` for full-token match + # # @param status [Symbol, ContextDev::Models::BatchListParams::Status] Filter by status. # - # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are + # @param tags [String] Comma-separated list of tags to filter by (matches batches having any of them). # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] + # `prefix` for as-you-type prefix matching (default), `exact` for full-token + # matching. + module SearchType + extend ContextDev::Internal::Type::Enum + + EXACT = :exact + PREFIX = :prefix + + # @!method self.values + # @return [Array] + end + # Filter by status. module Status extend ContextDev::Internal::Type::Enum diff --git a/lib/context_dev/models/batch_list_response.rb b/lib/context_dev/models/batch_list_response.rb index c2cdd197..a3adbf9d 100644 --- a/lib/context_dev/models/batch_list_response.rb +++ b/lib/context_dev/models/batch_list_response.rb @@ -98,6 +98,12 @@ class Data < ContextDev::Internal::Type::BaseModel # @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] + required :tags, ContextDev::Internal::Type::ArrayOf[String] + # @!attribute timing # # @return [ContextDev::Models::BatchListResponse::Data::Timing] @@ -109,7 +115,7 @@ class Data < ContextDev::Internal::Type::BaseModel # @return [Symbol, ContextDev::Models::BatchListResponse::Data::Type] required :type, enum: -> { ContextDev::Models::BatchListResponse::Data::Type } - # @!method initialize(id:, credits:, error:, errors:, input:, mode:, progress:, results:, status:, timing:, type:) + # @!method initialize(id:, credits:, error:, errors:, input:, mode:, progress:, results:, status:, tags:, timing:, type:) # Some parameter documentations has been truncated, see # {ContextDev::Models::BatchListResponse::Data} for more details. # @@ -133,6 +139,8 @@ class Data < ContextDev::Internal::Type::BaseModel # # @param status [Symbol, ContextDev::Models::BatchListResponse::Data::Status] Current state. `completed`, `cancelled`, and `failed` are final. # + # @param tags [Array] Tags stored on the batch at submission. + # # @param timing [ContextDev::Models::BatchListResponse::Data::Timing] # # @param type [Symbol, ContextDev::Models::BatchListResponse::Data::Type] Output format. diff --git a/lib/context_dev/models/batch_retrieve_params.rb b/lib/context_dev/models/batch_retrieve_params.rb index c906a5f8..aa8da9c3 100644 --- a/lib/context_dev/models/batch_retrieve_params.rb +++ b/lib/context_dev/models/batch_retrieve_params.rb @@ -13,22 +13,9 @@ class BatchRetrieveParams < ContextDev::Internal::Type::BaseModel # @return [String] required :batch_id, String - # @!attribute tags - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. - # - # @return [Array, nil] - optional :tags, ContextDev::Internal::Type::ArrayOf[String] - - # @!method initialize(batch_id:, tags: nil, request_options: {}) - # Some parameter documentations has been truncated, see - # {ContextDev::Models::BatchRetrieveParams} for more details. - # + # @!method initialize(batch_id:, request_options: {}) # @param batch_id [String] ID of the batch to retrieve or cancel. # - # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are - # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/context_dev/models/batch_retrieve_response.rb b/lib/context_dev/models/batch_retrieve_response.rb index 95827820..ffccd30a 100644 --- a/lib/context_dev/models/batch_retrieve_response.rb +++ b/lib/context_dev/models/batch_retrieve_response.rb @@ -67,6 +67,12 @@ class BatchRetrieveResponse < ContextDev::Internal::Type::BaseModel # @return [Symbol, ContextDev::Models::BatchRetrieveResponse::Status] required :status, enum: -> { ContextDev::Models::BatchRetrieveResponse::Status } + # @!attribute tags + # Tags stored on the batch at submission. + # + # @return [Array] + required :tags, ContextDev::Internal::Type::ArrayOf[String] + # @!attribute timing # # @return [ContextDev::Models::BatchRetrieveResponse::Timing] @@ -90,7 +96,7 @@ class BatchRetrieveResponse < ContextDev::Internal::Type::BaseModel # @return [String, nil] optional :webhook_secret, String - # @!method initialize(id:, credits:, error:, errors:, input:, invalid_urls:, mode:, progress:, results:, status:, timing:, type:, key_metadata: nil, webhook_secret: nil) + # @!method initialize(id:, credits:, error:, errors:, input:, invalid_urls:, mode:, progress:, results:, status:, tags:, timing:, type:, key_metadata: nil, webhook_secret: nil) # Some parameter documentations has been truncated, see # {ContextDev::Models::BatchRetrieveResponse} for more details. # @@ -114,6 +120,8 @@ class BatchRetrieveResponse < ContextDev::Internal::Type::BaseModel # # @param status [Symbol, ContextDev::Models::BatchRetrieveResponse::Status] Current state. `completed`, `cancelled`, and `failed` are final. # + # @param tags [Array] Tags stored on the batch at submission. + # # @param timing [ContextDev::Models::BatchRetrieveResponse::Timing] # # @param type [Symbol, ContextDev::Models::BatchRetrieveResponse::Type] Output format. diff --git a/lib/context_dev/resources/batch.rb b/lib/context_dev/resources/batch.rb index 5b9c1d1f..3b478722 100644 --- a/lib/context_dev/resources/batch.rb +++ b/lib/context_dev/resources/batch.rb @@ -3,33 +3,25 @@ module ContextDev module Resources class Batch - # Some parameter documentations has been truncated, see - # {ContextDev::Models::BatchRetrieveParams} for more details. - # # Check progress and get download links when the batch finishes. Also returns the # rejected-URL list and webhook signing secret from submission, so nothing is lost # if the submit response was dropped. # - # @overload retrieve(batch_id, tags: nil, request_options: {}) + # @overload retrieve(batch_id, request_options: {}) # # @param batch_id [String] ID of the batch to retrieve or cancel. # - # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are - # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [ContextDev::Models::BatchRetrieveResponse] # # @see ContextDev::Models::BatchRetrieveParams def retrieve(batch_id, params = {}) - parsed, options = ContextDev::BatchRetrieveParams.dump_request(params) - query = ContextDev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["batch/%1$s", batch_id], - query: query, model: ContextDev::Models::BatchRetrieveResponse, - options: options + options: params[:request_options] ) end @@ -39,15 +31,19 @@ def retrieve(batch_id, params = {}) # List your batches from newest to oldest. Filter by status or continue with a # cursor. # - # @overload list(cursor: nil, limit: nil, status: nil, tags: nil, request_options: {}) + # @overload list(cursor: nil, limit: nil, q: nil, search_type: nil, status: nil, tags: nil, request_options: {}) # # @param cursor [String] Cursor from the previous page. # # @param limit [Integer] Batches per page. Defaults to 25. # + # @param q [String] Free-text search term, matched against the batch id, crawl source (start URL or + # + # @param search_type [Symbol, ContextDev::Models::BatchListParams::SearchType] `prefix` for as-you-type prefix matching (default), `exact` for full-token match + # # @param status [Symbol, ContextDev::Models::BatchListParams::Status] Filter by status. # - # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are + # @param tags [String] Comma-separated list of tags to filter by (matches batches having any of them). # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] # @@ -66,32 +62,24 @@ def list(params = {}) ) end - # Some parameter documentations has been truncated, see - # {ContextDev::Models::BatchCancelParams} for more details. - # # Stop a batch from starting new pages. In-progress pages finish, and unused # credits are refunded. # - # @overload cancel(batch_id, tags: nil, request_options: {}) + # @overload cancel(batch_id, request_options: {}) # # @param batch_id [String] ID of the batch to retrieve or cancel. # - # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are - # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [ContextDev::Models::BatchCancelResponse] # # @see ContextDev::Models::BatchCancelParams def cancel(batch_id, params = {}) - parsed, options = ContextDev::BatchCancelParams.dump_request(params) - query = ContextDev::Internal::Util.encode_query_params(parsed) @client.request( method: :post, path: ["batch/%1$s/cancel", batch_id], - query: query, model: ContextDev::Models::BatchCancelResponse, - options: options + options: params[:request_options] ) end @@ -102,7 +90,7 @@ def cancel(batch_id, params = {}) # as the downloadable result files. Use this instead of downloading and parsing # the NDJSON files yourself. # - # @overload get_results(batch_id, cursor: nil, limit: nil, tags: nil, request_options: {}) + # @overload get_results(batch_id, cursor: nil, limit: nil, request_options: {}) # # @param batch_id [String] ID of the batch to retrieve or cancel. # @@ -110,8 +98,6 @@ def cancel(batch_id, params = {}) # # @param limit [Integer] Records per page. Defaults to 25. A page can close early so its payload stays un # - # @param tags [Array] Optional comma-separated caller-defined tags for tracking this request. Tags are - # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [ContextDev::Models::BatchGetResultsResponse] diff --git a/rbi/context_dev/models/batch_cancel_params.rbi b/rbi/context_dev/models/batch_cancel_params.rbi index c0e4dfbd..428cd76e 100644 --- a/rbi/context_dev/models/batch_cancel_params.rbi +++ b/rbi/context_dev/models/batch_cancel_params.rbi @@ -15,40 +15,22 @@ module ContextDev sig { returns(String) } attr_accessor :batch_id - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. - sig { returns(T.nilable(T::Array[String])) } - attr_reader :tags - - sig { params(tags: T::Array[String]).void } - attr_writer :tags - sig do params( batch_id: String, - tags: T::Array[String], request_options: ContextDev::RequestOptions::OrHash ).returns(T.attached_class) end def self.new( # ID of the batch to retrieve or cancel. batch_id:, - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. - tags: nil, request_options: {} ) end sig do override.returns( - { - batch_id: String, - tags: T::Array[String], - request_options: ContextDev::RequestOptions - } + { batch_id: String, request_options: ContextDev::RequestOptions } ) end def to_hash diff --git a/rbi/context_dev/models/batch_cancel_response.rbi b/rbi/context_dev/models/batch_cancel_response.rbi index c20f8353..4fa3188e 100644 --- a/rbi/context_dev/models/batch_cancel_response.rbi +++ b/rbi/context_dev/models/batch_cancel_response.rbi @@ -91,6 +91,10 @@ module ContextDev end attr_accessor :status + # Tags stored on the batch at submission. + sig { returns(T::Array[String]) } + attr_accessor :tags + sig { returns(ContextDev::Models::BatchCancelResponse::Timing) } attr_reader :timing @@ -135,6 +139,7 @@ module ContextDev results: T.nilable(ContextDev::Models::BatchCancelResponse::Results::OrHash), status: ContextDev::Models::BatchCancelResponse::Status::OrSymbol, + tags: T::Array[String], timing: ContextDev::Models::BatchCancelResponse::Timing::OrHash, type: ContextDev::Models::BatchCancelResponse::Type::OrSymbol, key_metadata: @@ -161,6 +166,8 @@ module ContextDev results:, # Current state. `completed`, `cancelled`, and `failed` are final. status:, + # Tags stored on the batch at submission. + tags:, timing:, # Output format. type:, @@ -183,6 +190,7 @@ module ContextDev T.nilable(ContextDev::Models::BatchCancelResponse::Results), status: ContextDev::Models::BatchCancelResponse::Status::TaggedSymbol, + tags: T::Array[String], timing: ContextDev::Models::BatchCancelResponse::Timing, type: ContextDev::Models::BatchCancelResponse::Type::TaggedSymbol, key_metadata: ContextDev::Models::BatchCancelResponse::KeyMetadata diff --git a/rbi/context_dev/models/batch_get_results_params.rbi b/rbi/context_dev/models/batch_get_results_params.rbi index 9c6288d4..f4bfacf1 100644 --- a/rbi/context_dev/models/batch_get_results_params.rbi +++ b/rbi/context_dev/models/batch_get_results_params.rbi @@ -33,21 +33,11 @@ module ContextDev sig { params(limit: Integer).void } attr_writer :limit - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. - sig { returns(T.nilable(T::Array[String])) } - attr_reader :tags - - sig { params(tags: T::Array[String]).void } - attr_writer :tags - sig do params( batch_id: String, cursor: String, limit: Integer, - tags: T::Array[String], request_options: ContextDev::RequestOptions::OrHash ).returns(T.attached_class) end @@ -59,10 +49,6 @@ module ContextDev # Records per page. Defaults to 25. A page can close early so its payload stays # under ~8 MB; rely on next_cursor rather than counting records. limit: nil, - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. - tags: nil, request_options: {} ) end @@ -73,7 +59,6 @@ module ContextDev batch_id: String, cursor: String, limit: Integer, - tags: T::Array[String], request_options: ContextDev::RequestOptions } ) diff --git a/rbi/context_dev/models/batch_list_params.rbi b/rbi/context_dev/models/batch_list_params.rbi index 565f51ca..584f0e68 100644 --- a/rbi/context_dev/models/batch_list_params.rbi +++ b/rbi/context_dev/models/batch_list_params.rbi @@ -25,6 +25,28 @@ module ContextDev sig { params(limit: Integer).void } attr_writer :limit + # Free-text search term, matched against the batch id, crawl source (start URL or + # sitemap domain), and tags. + sig { returns(T.nilable(String)) } + attr_reader :q + + sig { params(q: String).void } + attr_writer :q + + # `prefix` for as-you-type prefix matching (default), `exact` for full-token + # matching. + sig do + returns(T.nilable(ContextDev::BatchListParams::SearchType::OrSymbol)) + end + attr_reader :search_type + + sig do + params( + search_type: ContextDev::BatchListParams::SearchType::OrSymbol + ).void + end + attr_writer :search_type + # Filter by status. sig { returns(T.nilable(ContextDev::BatchListParams::Status::OrSymbol)) } attr_reader :status @@ -32,21 +54,21 @@ module ContextDev sig { params(status: ContextDev::BatchListParams::Status::OrSymbol).void } attr_writer :status - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. - sig { returns(T.nilable(T::Array[String])) } + # Comma-separated list of tags to filter by (matches batches having any of them). + sig { returns(T.nilable(String)) } attr_reader :tags - sig { params(tags: T::Array[String]).void } + sig { params(tags: String).void } attr_writer :tags sig do params( cursor: String, limit: Integer, + q: String, + search_type: ContextDev::BatchListParams::SearchType::OrSymbol, status: ContextDev::BatchListParams::Status::OrSymbol, - tags: T::Array[String], + tags: String, request_options: ContextDev::RequestOptions::OrHash ).returns(T.attached_class) end @@ -55,11 +77,15 @@ module ContextDev cursor: nil, # Batches per page. Defaults to 25. limit: nil, + # Free-text search term, matched against the batch id, crawl source (start URL or + # sitemap domain), and tags. + q: nil, + # `prefix` for as-you-type prefix matching (default), `exact` for full-token + # matching. + search_type: nil, # Filter by status. status: nil, - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. + # Comma-separated list of tags to filter by (matches batches having any of them). tags: nil, request_options: {} ) @@ -70,8 +96,10 @@ module ContextDev { cursor: String, limit: Integer, + q: String, + search_type: ContextDev::BatchListParams::SearchType::OrSymbol, status: ContextDev::BatchListParams::Status::OrSymbol, - tags: T::Array[String], + tags: String, request_options: ContextDev::RequestOptions } ) @@ -79,6 +107,31 @@ module ContextDev def to_hash end + # `prefix` for as-you-type prefix matching (default), `exact` for full-token + # matching. + module SearchType + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::BatchListParams::SearchType) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + EXACT = + T.let(:exact, ContextDev::BatchListParams::SearchType::TaggedSymbol) + PREFIX = + T.let(:prefix, ContextDev::BatchListParams::SearchType::TaggedSymbol) + + sig do + override.returns( + T::Array[ContextDev::BatchListParams::SearchType::TaggedSymbol] + ) + end + def self.values + end + end + # Filter by status. module Status extend ContextDev::Internal::Type::Enum diff --git a/rbi/context_dev/models/batch_list_response.rbi b/rbi/context_dev/models/batch_list_response.rbi index 5330fe55..0d700896 100644 --- a/rbi/context_dev/models/batch_list_response.rbi +++ b/rbi/context_dev/models/batch_list_response.rbi @@ -192,6 +192,10 @@ module ContextDev end attr_accessor :status + # Tags stored on the batch at submission. + sig { returns(T::Array[String]) } + attr_accessor :tags + sig { returns(ContextDev::Models::BatchListResponse::Data::Timing) } attr_reader :timing @@ -234,6 +238,7 @@ module ContextDev ), status: ContextDev::Models::BatchListResponse::Data::Status::OrSymbol, + tags: T::Array[String], timing: ContextDev::Models::BatchListResponse::Data::Timing::OrHash, type: ContextDev::Models::BatchListResponse::Data::Type::OrSymbol ).returns(T.attached_class) @@ -258,6 +263,8 @@ module ContextDev results:, # Current state. `completed`, `cancelled`, and `failed` are final. status:, + # Tags stored on the batch at submission. + tags:, timing:, # Output format. type: @@ -281,6 +288,7 @@ module ContextDev T.nilable(ContextDev::Models::BatchListResponse::Data::Results), status: ContextDev::Models::BatchListResponse::Data::Status::TaggedSymbol, + tags: T::Array[String], timing: ContextDev::Models::BatchListResponse::Data::Timing, type: ContextDev::Models::BatchListResponse::Data::Type::TaggedSymbol diff --git a/rbi/context_dev/models/batch_retrieve_params.rbi b/rbi/context_dev/models/batch_retrieve_params.rbi index 6ca170d1..b061b125 100644 --- a/rbi/context_dev/models/batch_retrieve_params.rbi +++ b/rbi/context_dev/models/batch_retrieve_params.rbi @@ -15,40 +15,22 @@ module ContextDev sig { returns(String) } attr_accessor :batch_id - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. - sig { returns(T.nilable(T::Array[String])) } - attr_reader :tags - - sig { params(tags: T::Array[String]).void } - attr_writer :tags - sig do params( batch_id: String, - tags: T::Array[String], request_options: ContextDev::RequestOptions::OrHash ).returns(T.attached_class) end def self.new( # ID of the batch to retrieve or cancel. batch_id:, - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. - tags: nil, request_options: {} ) end sig do override.returns( - { - batch_id: String, - tags: T::Array[String], - request_options: ContextDev::RequestOptions - } + { batch_id: String, request_options: ContextDev::RequestOptions } ) end def to_hash diff --git a/rbi/context_dev/models/batch_retrieve_response.rbi b/rbi/context_dev/models/batch_retrieve_response.rbi index 6c358eb2..2518e6e9 100644 --- a/rbi/context_dev/models/batch_retrieve_response.rbi +++ b/rbi/context_dev/models/batch_retrieve_response.rbi @@ -103,6 +103,10 @@ module ContextDev end attr_accessor :status + # Tags stored on the batch at submission. + sig { returns(T::Array[String]) } + attr_accessor :tags + sig { returns(ContextDev::Models::BatchRetrieveResponse::Timing) } attr_reader :timing @@ -162,6 +166,7 @@ module ContextDev ContextDev::Models::BatchRetrieveResponse::Results::OrHash ), status: ContextDev::Models::BatchRetrieveResponse::Status::OrSymbol, + tags: T::Array[String], timing: ContextDev::Models::BatchRetrieveResponse::Timing::OrHash, type: ContextDev::Models::BatchRetrieveResponse::Type::OrSymbol, key_metadata: @@ -191,6 +196,8 @@ module ContextDev results:, # Current state. `completed`, `cancelled`, and `failed` are final. status:, + # Tags stored on the batch at submission. + tags:, timing:, # Output format. type:, @@ -217,6 +224,7 @@ module ContextDev T.nilable(ContextDev::Models::BatchRetrieveResponse::Results), status: ContextDev::Models::BatchRetrieveResponse::Status::TaggedSymbol, + tags: T::Array[String], timing: ContextDev::Models::BatchRetrieveResponse::Timing, type: ContextDev::Models::BatchRetrieveResponse::Type::TaggedSymbol, key_metadata: diff --git a/rbi/context_dev/resources/batch.rbi b/rbi/context_dev/resources/batch.rbi index d66eb762..d553f903 100644 --- a/rbi/context_dev/resources/batch.rbi +++ b/rbi/context_dev/resources/batch.rbi @@ -9,17 +9,12 @@ module ContextDev sig do params( batch_id: String, - tags: T::Array[String], request_options: ContextDev::RequestOptions::OrHash ).returns(ContextDev::Models::BatchRetrieveResponse) end def retrieve( # ID of the batch to retrieve or cancel. batch_id, - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. - tags: nil, request_options: {} ) end @@ -30,8 +25,10 @@ module ContextDev params( cursor: String, limit: Integer, + q: String, + search_type: ContextDev::BatchListParams::SearchType::OrSymbol, status: ContextDev::BatchListParams::Status::OrSymbol, - tags: T::Array[String], + tags: String, request_options: ContextDev::RequestOptions::OrHash ).returns(ContextDev::Models::BatchListResponse) end @@ -40,11 +37,15 @@ module ContextDev cursor: nil, # Batches per page. Defaults to 25. limit: nil, + # Free-text search term, matched against the batch id, crawl source (start URL or + # sitemap domain), and tags. + q: nil, + # `prefix` for as-you-type prefix matching (default), `exact` for full-token + # matching. + search_type: nil, # Filter by status. status: nil, - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. + # Comma-separated list of tags to filter by (matches batches having any of them). tags: nil, request_options: {} ) @@ -55,17 +56,12 @@ module ContextDev sig do params( batch_id: String, - tags: T::Array[String], request_options: ContextDev::RequestOptions::OrHash ).returns(ContextDev::Models::BatchCancelResponse) end def cancel( # ID of the batch to retrieve or cancel. batch_id, - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. - tags: nil, request_options: {} ) end @@ -78,7 +74,6 @@ module ContextDev batch_id: String, cursor: String, limit: Integer, - tags: T::Array[String], request_options: ContextDev::RequestOptions::OrHash ).returns(ContextDev::Models::BatchGetResultsResponse) end @@ -90,10 +85,6 @@ module ContextDev # Records per page. Defaults to 25. A page can close early so its payload stays # under ~8 MB; rely on next_cursor rather than counting records. limit: nil, - # Optional comma-separated caller-defined tags for tracking this request. Tags are - # recorded on the request's usage log and can be used to filter usage on the - # dashboard usage page. Up to 20 tags, each 1-50 characters. - tags: nil, request_options: {} ) end diff --git a/sig/context_dev/models/batch_cancel_params.rbs b/sig/context_dev/models/batch_cancel_params.rbs index eea7c805..d2a98e58 100644 --- a/sig/context_dev/models/batch_cancel_params.rbs +++ b/sig/context_dev/models/batch_cancel_params.rbs @@ -1,8 +1,7 @@ module ContextDev module Models type batch_cancel_params = - { batch_id: String, tags: ::Array[String] } - & ContextDev::Internal::Type::request_parameters + { batch_id: String } & ContextDev::Internal::Type::request_parameters class BatchCancelParams < ContextDev::Internal::Type::BaseModel extend ContextDev::Internal::Type::RequestParameters::Converter @@ -10,19 +9,13 @@ module ContextDev attr_accessor batch_id: String - attr_reader tags: ::Array[String]? - - def tags=: (::Array[String]) -> ::Array[String] - def initialize: ( batch_id: String, - ?tags: ::Array[String], ?request_options: ContextDev::request_opts ) -> void def to_hash: -> { batch_id: String, - tags: ::Array[String], request_options: ContextDev::RequestOptions } end diff --git a/sig/context_dev/models/batch_cancel_response.rbs b/sig/context_dev/models/batch_cancel_response.rbs index d611c8cf..9b4686e3 100644 --- a/sig/context_dev/models/batch_cancel_response.rbs +++ b/sig/context_dev/models/batch_cancel_response.rbs @@ -11,6 +11,7 @@ module ContextDev progress: ContextDev::Models::BatchCancelResponse::Progress, results: ContextDev::Models::BatchCancelResponse::Results?, status: ContextDev::Models::BatchCancelResponse::status, + tags: ::Array[String], timing: ContextDev::Models::BatchCancelResponse::Timing, type: ContextDev::Models::BatchCancelResponse::type_, key_metadata: ContextDev::Models::BatchCancelResponse::KeyMetadata @@ -35,6 +36,8 @@ module ContextDev attr_accessor status: ContextDev::Models::BatchCancelResponse::status + attr_accessor tags: ::Array[String] + attr_accessor timing: ContextDev::Models::BatchCancelResponse::Timing attr_accessor type: ContextDev::Models::BatchCancelResponse::type_ @@ -55,6 +58,7 @@ module ContextDev progress: ContextDev::Models::BatchCancelResponse::Progress, results: ContextDev::Models::BatchCancelResponse::Results?, status: ContextDev::Models::BatchCancelResponse::status, + tags: ::Array[String], timing: ContextDev::Models::BatchCancelResponse::Timing, type: ContextDev::Models::BatchCancelResponse::type_, ?key_metadata: ContextDev::Models::BatchCancelResponse::KeyMetadata @@ -70,6 +74,7 @@ module ContextDev progress: ContextDev::Models::BatchCancelResponse::Progress, results: ContextDev::Models::BatchCancelResponse::Results?, status: ContextDev::Models::BatchCancelResponse::status, + tags: ::Array[String], timing: ContextDev::Models::BatchCancelResponse::Timing, type: ContextDev::Models::BatchCancelResponse::type_, key_metadata: ContextDev::Models::BatchCancelResponse::KeyMetadata diff --git a/sig/context_dev/models/batch_get_results_params.rbs b/sig/context_dev/models/batch_get_results_params.rbs index 5f532df0..8dbb10c9 100644 --- a/sig/context_dev/models/batch_get_results_params.rbs +++ b/sig/context_dev/models/batch_get_results_params.rbs @@ -1,12 +1,7 @@ module ContextDev module Models type batch_get_results_params = - { - batch_id: String, - cursor: String, - limit: Integer, - tags: ::Array[String] - } + { batch_id: String, cursor: String, limit: Integer } & ContextDev::Internal::Type::request_parameters class BatchGetResultsParams < ContextDev::Internal::Type::BaseModel @@ -23,15 +18,10 @@ module ContextDev def limit=: (Integer) -> Integer - attr_reader tags: ::Array[String]? - - def tags=: (::Array[String]) -> ::Array[String] - def initialize: ( batch_id: String, ?cursor: String, ?limit: Integer, - ?tags: ::Array[String], ?request_options: ContextDev::request_opts ) -> void @@ -39,7 +29,6 @@ module ContextDev batch_id: String, cursor: String, limit: Integer, - tags: ::Array[String], request_options: ContextDev::RequestOptions } end diff --git a/sig/context_dev/models/batch_list_params.rbs b/sig/context_dev/models/batch_list_params.rbs index 31aeba31..8ebac2db 100644 --- a/sig/context_dev/models/batch_list_params.rbs +++ b/sig/context_dev/models/batch_list_params.rbs @@ -4,8 +4,10 @@ module ContextDev { cursor: String, limit: Integer, + q: String, + search_type: ContextDev::Models::BatchListParams::search_type, status: ContextDev::Models::BatchListParams::status, - tags: ::Array[String] + tags: String } & ContextDev::Internal::Type::request_parameters @@ -21,32 +23,57 @@ module ContextDev def limit=: (Integer) -> Integer + attr_reader q: String? + + def q=: (String) -> String + + attr_reader search_type: ContextDev::Models::BatchListParams::search_type? + + def search_type=: ( + ContextDev::Models::BatchListParams::search_type + ) -> ContextDev::Models::BatchListParams::search_type + attr_reader status: ContextDev::Models::BatchListParams::status? def status=: ( ContextDev::Models::BatchListParams::status ) -> ContextDev::Models::BatchListParams::status - attr_reader tags: ::Array[String]? + attr_reader tags: String? - def tags=: (::Array[String]) -> ::Array[String] + def tags=: (String) -> String def initialize: ( ?cursor: String, ?limit: Integer, + ?q: String, + ?search_type: ContextDev::Models::BatchListParams::search_type, ?status: ContextDev::Models::BatchListParams::status, - ?tags: ::Array[String], + ?tags: String, ?request_options: ContextDev::request_opts ) -> void def to_hash: -> { cursor: String, limit: Integer, + q: String, + search_type: ContextDev::Models::BatchListParams::search_type, status: ContextDev::Models::BatchListParams::status, - tags: ::Array[String], + tags: String, request_options: ContextDev::RequestOptions } + type search_type = :exact | :prefix + + module SearchType + extend ContextDev::Internal::Type::Enum + + EXACT: :exact + PREFIX: :prefix + + def self?.values: -> ::Array[ContextDev::Models::BatchListParams::search_type] + end + type status = :queued | :running | :cancelling | :completed | :cancelled | :failed diff --git a/sig/context_dev/models/batch_list_response.rbs b/sig/context_dev/models/batch_list_response.rbs index d8188cf4..6b59c70a 100644 --- a/sig/context_dev/models/batch_list_response.rbs +++ b/sig/context_dev/models/batch_list_response.rbs @@ -52,6 +52,7 @@ module ContextDev progress: ContextDev::Models::BatchListResponse::Data::Progress, results: ContextDev::Models::BatchListResponse::Data::Results?, status: ContextDev::Models::BatchListResponse::Data::status, + tags: ::Array[String], timing: ContextDev::Models::BatchListResponse::Data::Timing, type: ContextDev::Models::BatchListResponse::Data::type_ } @@ -75,6 +76,8 @@ module ContextDev attr_accessor status: ContextDev::Models::BatchListResponse::Data::status + attr_accessor tags: ::Array[String] + attr_accessor timing: ContextDev::Models::BatchListResponse::Data::Timing attr_accessor type: ContextDev::Models::BatchListResponse::Data::type_ @@ -89,6 +92,7 @@ module ContextDev progress: ContextDev::Models::BatchListResponse::Data::Progress, results: ContextDev::Models::BatchListResponse::Data::Results?, status: ContextDev::Models::BatchListResponse::Data::status, + tags: ::Array[String], timing: ContextDev::Models::BatchListResponse::Data::Timing, type: ContextDev::Models::BatchListResponse::Data::type_ ) -> void @@ -103,6 +107,7 @@ module ContextDev progress: ContextDev::Models::BatchListResponse::Data::Progress, results: ContextDev::Models::BatchListResponse::Data::Results?, status: ContextDev::Models::BatchListResponse::Data::status, + tags: ::Array[String], timing: ContextDev::Models::BatchListResponse::Data::Timing, type: ContextDev::Models::BatchListResponse::Data::type_ } diff --git a/sig/context_dev/models/batch_retrieve_params.rbs b/sig/context_dev/models/batch_retrieve_params.rbs index ffe90b46..6752157d 100644 --- a/sig/context_dev/models/batch_retrieve_params.rbs +++ b/sig/context_dev/models/batch_retrieve_params.rbs @@ -1,8 +1,7 @@ module ContextDev module Models type batch_retrieve_params = - { batch_id: String, tags: ::Array[String] } - & ContextDev::Internal::Type::request_parameters + { batch_id: String } & ContextDev::Internal::Type::request_parameters class BatchRetrieveParams < ContextDev::Internal::Type::BaseModel extend ContextDev::Internal::Type::RequestParameters::Converter @@ -10,19 +9,13 @@ module ContextDev attr_accessor batch_id: String - attr_reader tags: ::Array[String]? - - def tags=: (::Array[String]) -> ::Array[String] - def initialize: ( batch_id: String, - ?tags: ::Array[String], ?request_options: ContextDev::request_opts ) -> void def to_hash: -> { batch_id: String, - tags: ::Array[String], request_options: ContextDev::RequestOptions } end diff --git a/sig/context_dev/models/batch_retrieve_response.rbs b/sig/context_dev/models/batch_retrieve_response.rbs index c9a525e2..d2c913ef 100644 --- a/sig/context_dev/models/batch_retrieve_response.rbs +++ b/sig/context_dev/models/batch_retrieve_response.rbs @@ -12,6 +12,7 @@ module ContextDev progress: ContextDev::Models::BatchRetrieveResponse::Progress, results: ContextDev::Models::BatchRetrieveResponse::Results?, status: ContextDev::Models::BatchRetrieveResponse::status, + tags: ::Array[String], timing: ContextDev::Models::BatchRetrieveResponse::Timing, type: ContextDev::Models::BatchRetrieveResponse::type_, key_metadata: ContextDev::Models::BatchRetrieveResponse::KeyMetadata, @@ -39,6 +40,8 @@ module ContextDev attr_accessor status: ContextDev::Models::BatchRetrieveResponse::status + attr_accessor tags: ::Array[String] + attr_accessor timing: ContextDev::Models::BatchRetrieveResponse::Timing attr_accessor type: ContextDev::Models::BatchRetrieveResponse::type_ @@ -64,6 +67,7 @@ module ContextDev progress: ContextDev::Models::BatchRetrieveResponse::Progress, results: ContextDev::Models::BatchRetrieveResponse::Results?, status: ContextDev::Models::BatchRetrieveResponse::status, + tags: ::Array[String], timing: ContextDev::Models::BatchRetrieveResponse::Timing, type: ContextDev::Models::BatchRetrieveResponse::type_, ?key_metadata: ContextDev::Models::BatchRetrieveResponse::KeyMetadata, @@ -81,6 +85,7 @@ module ContextDev progress: ContextDev::Models::BatchRetrieveResponse::Progress, results: ContextDev::Models::BatchRetrieveResponse::Results?, status: ContextDev::Models::BatchRetrieveResponse::status, + tags: ::Array[String], timing: ContextDev::Models::BatchRetrieveResponse::Timing, type: ContextDev::Models::BatchRetrieveResponse::type_, key_metadata: ContextDev::Models::BatchRetrieveResponse::KeyMetadata, diff --git a/sig/context_dev/resources/batch.rbs b/sig/context_dev/resources/batch.rbs index af8dc081..be091b9c 100644 --- a/sig/context_dev/resources/batch.rbs +++ b/sig/context_dev/resources/batch.rbs @@ -3,21 +3,21 @@ module ContextDev class Batch def retrieve: ( String batch_id, - ?tags: ::Array[String], ?request_options: ContextDev::request_opts ) -> ContextDev::Models::BatchRetrieveResponse def list: ( ?cursor: String, ?limit: Integer, + ?q: String, + ?search_type: ContextDev::Models::BatchListParams::search_type, ?status: ContextDev::Models::BatchListParams::status, - ?tags: ::Array[String], + ?tags: String, ?request_options: ContextDev::request_opts ) -> ContextDev::Models::BatchListResponse def cancel: ( String batch_id, - ?tags: ::Array[String], ?request_options: ContextDev::request_opts ) -> ContextDev::Models::BatchCancelResponse @@ -25,7 +25,6 @@ module ContextDev String batch_id, ?cursor: String, ?limit: Integer, - ?tags: ::Array[String], ?request_options: ContextDev::request_opts ) -> ContextDev::Models::BatchGetResultsResponse diff --git a/test/context_dev/resources/batch_test.rb b/test/context_dev/resources/batch_test.rb index 120d434b..2926912e 100644 --- a/test/context_dev/resources/batch_test.rb +++ b/test/context_dev/resources/batch_test.rb @@ -24,6 +24,7 @@ def test_retrieve progress: ContextDev::Models::BatchRetrieveResponse::Progress, results: ContextDev::Models::BatchRetrieveResponse::Results | nil, status: ContextDev::Models::BatchRetrieveResponse::Status, + tags: ^(ContextDev::Internal::Type::ArrayOf[String]), timing: ContextDev::Models::BatchRetrieveResponse::Timing, type: ContextDev::Models::BatchRetrieveResponse::Type, key_metadata: ContextDev::Models::BatchRetrieveResponse::KeyMetadata | nil, @@ -71,6 +72,7 @@ def test_cancel progress: ContextDev::Models::BatchCancelResponse::Progress, results: ContextDev::Models::BatchCancelResponse::Results | nil, status: ContextDev::Models::BatchCancelResponse::Status, + tags: ^(ContextDev::Internal::Type::ArrayOf[String]), timing: ContextDev::Models::BatchCancelResponse::Timing, type: ContextDev::Models::BatchCancelResponse::Type, key_metadata: ContextDev::Models::BatchCancelResponse::KeyMetadata | nil From f3fb4dd25ca9ee05699477165752a020fe78f2fd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 23:26:30 +0000 Subject: [PATCH 06/11] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 86253ea2..eec42c92 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-cdff38301573d05fdad8416847402472ff6cb1ce75a9de9f99e8673ddec7c4a6.yml -openapi_spec_hash: 387fe6f53599abb0341764e00bcd0b26 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-1b0d50368dea5273a516e385bba67202320cc9692bbeba21735cd615e380c375.yml +openapi_spec_hash: e55a3d1cc7217e874931a231d180c247 config_hash: 2bea1743c84d63bd61f8501a6ea63065 From 0800773fb7320d87a4dcc98426072e7d451149e8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 05:57:07 +0000 Subject: [PATCH 07/11] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index eec42c92..e8bb28d0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-1b0d50368dea5273a516e385bba67202320cc9692bbeba21735cd615e380c375.yml -openapi_spec_hash: e55a3d1cc7217e874931a231d180c247 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-31c3cdf42b1a2e726724539dd613d902c72afdf75fa8da028c79eee9d6d71ea4.yml +openapi_spec_hash: 409abf0799543827d54ea7293ffa5b74 config_hash: 2bea1743c84d63bd61f8501a6ea63065 From 98fedb99aae187cff9284efd0a6c574b1b71d749 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 06:35:25 +0000 Subject: [PATCH 08/11] feat(api): api update --- .stats.yml | 4 +- .../models/web_web_scrape_html_response.rb | 94 ++++++++- .../models/web_web_scrape_md_response.rb | 94 ++++++++- .../models/web_web_scrape_html_response.rbi | 182 ++++++++++++++++++ .../models/web_web_scrape_md_response.rbi | 180 +++++++++++++++++ .../models/web_web_scrape_html_response.rbs | 85 ++++++++ .../models/web_web_scrape_md_response.rbs | 85 ++++++++ test/context_dev/resources/web_test.rb | 4 + 8 files changed, 724 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index e8bb28d0..75e4f88c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-31c3cdf42b1a2e726724539dd613d902c72afdf75fa8da028c79eee9d6d71ea4.yml -openapi_spec_hash: 409abf0799543827d54ea7293ffa5b74 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c7e18da06db76bc8a22f2466e13b1958aedf1791ae3310e289f4c5a3dd522936.yml +openapi_spec_hash: 17d1ac64568e4f0ef529692cd3667175 config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/lib/context_dev/models/web_web_scrape_html_response.rb b/lib/context_dev/models/web_web_scrape_html_response.rb index 84279a0f..95361fb6 100644 --- a/lib/context_dev/models/web_web_scrape_html_response.rb +++ b/lib/context_dev/models/web_web_scrape_html_response.rb @@ -39,6 +39,21 @@ class WebWebScrapeHTMLResponse < ContextDev::Internal::Type::BaseModel # @return [String] required :url, String + # @!attribute actions_applied + # One verified outcome per requested browser action, in request order. + # + # @return [Array, nil] + optional :actions_applied, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied] }, + api_name: :actionsApplied + + # @!attribute actions_html_stale + # True when an action was applied but the returned content could not be refreshed + # afterward. + # + # @return [Boolean, nil] + optional :actions_html_stale, ContextDev::Internal::Type::Boolean, api_name: :actionsHtmlStale + # @!attribute key_metadata # 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. @@ -46,7 +61,7 @@ class WebWebScrapeHTMLResponse < ContextDev::Internal::Type::BaseModel # @return [ContextDev::Models::WebWebScrapeHTMLResponse::KeyMetadata, nil] optional :key_metadata, -> { ContextDev::Models::WebWebScrapeHTMLResponse::KeyMetadata } - # @!method initialize(html:, metadata:, success:, type:, url:, key_metadata: nil) + # @!method initialize(html:, metadata:, success:, type:, url:, actions_applied: nil, actions_html_stale: nil, key_metadata: nil) # Some parameter documentations has been truncated, see # {ContextDev::Models::WebWebScrapeHTMLResponse} for more details. # @@ -60,6 +75,10 @@ class WebWebScrapeHTMLResponse < ContextDev::Internal::Type::BaseModel # # @param url [String] The URL that was scraped # + # @param actions_applied [Array] One verified outcome per requested browser action, in request order. + # + # @param actions_html_stale [Boolean] True when an action was applied but the returned content could not be refreshed + # # @param key_metadata [ContextDev::Models::WebWebScrapeHTMLResponse::KeyMetadata] Metadata about the API key used for the request. Included in every response when # @see ContextDev::Models::WebWebScrapeHTMLResponse#metadata @@ -349,6 +368,79 @@ module Type # @return [Array] end + class ActionsApplied < ContextDev::Internal::Type::BaseModel + # @!attribute instruction + # + # @return [String] + required :instruction, String + + # @!attribute status + # Applied means the requested page state was visibly verified. Failed means it was + # not verified. Skipped means it was not attempted. + # + # @return [Symbol, ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status] + required :status, enum: -> { ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status } + + # @!attribute completion_evidence + # Visible page evidence used to verify an applied action. + # + # @return [String, nil] + optional :completion_evidence, String, api_name: :completionEvidence + + # @!attribute duration_ms + # + # @return [Float, nil] + optional :duration_ms, Float, api_name: :durationMs + + # @!attribute error + # + # @return [String, nil] + optional :error, String + + # @!attribute method_ + # + # @return [String, nil] + optional :method_, String, api_name: :method + + # @!attribute target_description + # + # @return [String, nil] + optional :target_description, String, api_name: :targetDescription + + # @!method initialize(instruction:, status:, completion_evidence: nil, duration_ms: nil, error: nil, method_: nil, target_description: nil) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied} for more details. + # + # @param instruction [String] + # + # @param status [Symbol, ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status] Applied means the requested page state was visibly verified. Failed means it was + # + # @param completion_evidence [String] Visible page evidence used to verify an applied action. + # + # @param duration_ms [Float] + # + # @param error [String] + # + # @param method_ [String] + # + # @param target_description [String] + + # Applied means the requested page state was visibly verified. Failed means it was + # not verified. Skipped means it was not attempted. + # + # @see ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied#status + module Status + extend ContextDev::Internal::Type::Enum + + APPLIED = :applied + FAILED = :failed + SKIPPED = :skipped + + # @!method self.values + # @return [Array] + end + end + # @see ContextDev::Models::WebWebScrapeHTMLResponse#key_metadata class KeyMetadata < ContextDev::Internal::Type::BaseModel # @!attribute credits_consumed diff --git a/lib/context_dev/models/web_web_scrape_md_response.rb b/lib/context_dev/models/web_web_scrape_md_response.rb index afb0f5e2..03a86a1c 100644 --- a/lib/context_dev/models/web_web_scrape_md_response.rb +++ b/lib/context_dev/models/web_web_scrape_md_response.rb @@ -36,6 +36,21 @@ class WebWebScrapeMdResponse < ContextDev::Internal::Type::BaseModel # @return [String] required :url, String + # @!attribute actions_applied + # One verified outcome per requested browser action, in request order. + # + # @return [Array, nil] + optional :actions_applied, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied] }, + api_name: :actionsApplied + + # @!attribute actions_html_stale + # True when an action was applied but the returned content could not be refreshed + # afterward. + # + # @return [Boolean, nil] + optional :actions_html_stale, ContextDev::Internal::Type::Boolean, api_name: :actionsHtmlStale + # @!attribute key_metadata # 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. @@ -43,7 +58,7 @@ class WebWebScrapeMdResponse < ContextDev::Internal::Type::BaseModel # @return [ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata, nil] optional :key_metadata, -> { ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata } - # @!method initialize(content_length:, markdown:, metadata:, success:, url:, key_metadata: nil) + # @!method initialize(content_length:, markdown:, metadata:, success:, url:, actions_applied: nil, actions_html_stale: nil, key_metadata: nil) # Some parameter documentations has been truncated, see # {ContextDev::Models::WebWebScrapeMdResponse} for more details. # @@ -57,6 +72,10 @@ class WebWebScrapeMdResponse < ContextDev::Internal::Type::BaseModel # # @param url [String] The URL that was scraped # + # @param actions_applied [Array] One verified outcome per requested browser action, in request order. + # + # @param actions_html_stale [Boolean] True when an action was applied but the returned content could not be refreshed + # # @param key_metadata [ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata] Metadata about the API key used for the request. Included in every response when # @see ContextDev::Models::WebWebScrapeMdResponse#metadata @@ -318,6 +337,79 @@ module Success # @return [Array] end + class ActionsApplied < ContextDev::Internal::Type::BaseModel + # @!attribute instruction + # + # @return [String] + required :instruction, String + + # @!attribute status + # Applied means the requested page state was visibly verified. Failed means it was + # not verified. Skipped means it was not attempted. + # + # @return [Symbol, ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status] + required :status, enum: -> { ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status } + + # @!attribute completion_evidence + # Visible page evidence used to verify an applied action. + # + # @return [String, nil] + optional :completion_evidence, String, api_name: :completionEvidence + + # @!attribute duration_ms + # + # @return [Float, nil] + optional :duration_ms, Float, api_name: :durationMs + + # @!attribute error + # + # @return [String, nil] + optional :error, String + + # @!attribute method_ + # + # @return [String, nil] + optional :method_, String, api_name: :method + + # @!attribute target_description + # + # @return [String, nil] + optional :target_description, String, api_name: :targetDescription + + # @!method initialize(instruction:, status:, completion_evidence: nil, duration_ms: nil, error: nil, method_: nil, target_description: nil) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied} for more details. + # + # @param instruction [String] + # + # @param status [Symbol, ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status] Applied means the requested page state was visibly verified. Failed means it was + # + # @param completion_evidence [String] Visible page evidence used to verify an applied action. + # + # @param duration_ms [Float] + # + # @param error [String] + # + # @param method_ [String] + # + # @param target_description [String] + + # Applied means the requested page state was visibly verified. Failed means it was + # not verified. Skipped means it was not attempted. + # + # @see ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied#status + module Status + extend ContextDev::Internal::Type::Enum + + APPLIED = :applied + FAILED = :failed + SKIPPED = :skipped + + # @!method self.values + # @return [Array] + end + end + # @see ContextDev::Models::WebWebScrapeMdResponse#key_metadata class KeyMetadata < ContextDev::Internal::Type::BaseModel # @!attribute credits_consumed diff --git a/rbi/context_dev/models/web_web_scrape_html_response.rbi b/rbi/context_dev/models/web_web_scrape_html_response.rbi index c4fef9c4..2ccd098d 100644 --- a/rbi/context_dev/models/web_web_scrape_html_response.rbi +++ b/rbi/context_dev/models/web_web_scrape_html_response.rbi @@ -52,6 +52,36 @@ module ContextDev sig { returns(String) } attr_accessor :url + # One verified outcome per requested browser action, in request order. + sig do + returns( + T.nilable( + T::Array[ + ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied + ] + ) + ) + end + attr_reader :actions_applied + + sig do + params( + actions_applied: + T::Array[ + ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::OrHash + ] + ).void + end + attr_writer :actions_applied + + # True when an action was applied but the returned content could not be refreshed + # afterward. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :actions_html_stale + + sig { params(actions_html_stale: T::Boolean).void } + attr_writer :actions_html_stale + # 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. sig do @@ -78,6 +108,11 @@ module ContextDev ContextDev::Models::WebWebScrapeHTMLResponse::Success::OrBoolean, type: ContextDev::Models::WebWebScrapeHTMLResponse::Type::OrSymbol, url: String, + actions_applied: + T::Array[ + ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::OrHash + ], + actions_html_stale: T::Boolean, key_metadata: ContextDev::Models::WebWebScrapeHTMLResponse::KeyMetadata::OrHash ).returns(T.attached_class) @@ -98,6 +133,11 @@ module ContextDev type:, # The URL that was scraped url:, + # One verified outcome per requested browser action, in request order. + actions_applied: nil, + # True when an action was applied but the returned content could not be refreshed + # afterward. + actions_html_stale: nil, # 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. key_metadata: nil @@ -114,6 +154,11 @@ module ContextDev type: ContextDev::Models::WebWebScrapeHTMLResponse::Type::TaggedSymbol, url: String, + actions_applied: + T::Array[ + ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied + ], + actions_html_stale: T::Boolean, key_metadata: ContextDev::Models::WebWebScrapeHTMLResponse::KeyMetadata } @@ -705,6 +750,143 @@ module ContextDev end end + class ActionsApplied < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied, + ContextDev::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :instruction + + # Applied means the requested page state was visibly verified. Failed means it was + # not verified. Skipped means it was not attempted. + sig do + returns( + ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status::TaggedSymbol + ) + end + attr_accessor :status + + # Visible page evidence used to verify an applied action. + sig { returns(T.nilable(String)) } + attr_reader :completion_evidence + + sig { params(completion_evidence: String).void } + attr_writer :completion_evidence + + sig { returns(T.nilable(Float)) } + attr_reader :duration_ms + + sig { params(duration_ms: Float).void } + attr_writer :duration_ms + + sig { returns(T.nilable(String)) } + attr_reader :error + + sig { params(error: String).void } + attr_writer :error + + sig { returns(T.nilable(String)) } + attr_reader :method_ + + sig { params(method_: String).void } + attr_writer :method_ + + sig { returns(T.nilable(String)) } + attr_reader :target_description + + sig { params(target_description: String).void } + attr_writer :target_description + + sig do + params( + instruction: String, + status: + ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status::OrSymbol, + completion_evidence: String, + duration_ms: Float, + error: String, + method_: String, + target_description: String + ).returns(T.attached_class) + end + def self.new( + instruction:, + # Applied means the requested page state was visibly verified. Failed means it was + # not verified. Skipped means it was not attempted. + status:, + # Visible page evidence used to verify an applied action. + completion_evidence: nil, + duration_ms: nil, + error: nil, + method_: nil, + target_description: nil + ) + end + + sig do + override.returns( + { + instruction: String, + status: + ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status::TaggedSymbol, + completion_evidence: String, + duration_ms: Float, + error: String, + method_: String, + target_description: String + } + ) + end + def to_hash + end + + # Applied means the requested page state was visibly verified. Failed means it was + # not verified. Skipped means it was not attempted. + module Status + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + APPLIED = + T.let( + :applied, + ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status::TaggedSymbol + ) + FAILED = + T.let( + :failed, + ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status::TaggedSymbol + ) + SKIPPED = + T.let( + :skipped, + ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::Status::TaggedSymbol + ] + ) + end + def self.values + end + end + end + class KeyMetadata < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do diff --git a/rbi/context_dev/models/web_web_scrape_md_response.rbi b/rbi/context_dev/models/web_web_scrape_md_response.rbi index 06a64b8d..c6816a2a 100644 --- a/rbi/context_dev/models/web_web_scrape_md_response.rbi +++ b/rbi/context_dev/models/web_web_scrape_md_response.rbi @@ -44,6 +44,34 @@ module ContextDev sig { returns(String) } attr_accessor :url + # One verified outcome per requested browser action, in request order. + sig do + returns( + T.nilable( + T::Array[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied] + ) + ) + end + attr_reader :actions_applied + + sig do + params( + actions_applied: + T::Array[ + ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::OrHash + ] + ).void + end + attr_writer :actions_applied + + # True when an action was applied but the returned content could not be refreshed + # afterward. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :actions_html_stale + + sig { params(actions_html_stale: T::Boolean).void } + attr_writer :actions_html_stale + # 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. sig do @@ -70,6 +98,11 @@ module ContextDev success: ContextDev::Models::WebWebScrapeMdResponse::Success::OrBoolean, url: String, + actions_applied: + T::Array[ + ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::OrHash + ], + actions_html_stale: T::Boolean, key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata::OrHash ).returns(T.attached_class) @@ -87,6 +120,11 @@ module ContextDev success:, # The URL that was scraped url:, + # One verified outcome per requested browser action, in request order. + actions_applied: nil, + # True when an action was applied but the returned content could not be refreshed + # afterward. + actions_html_stale: nil, # 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. key_metadata: nil @@ -102,6 +140,11 @@ module ContextDev success: ContextDev::Models::WebWebScrapeMdResponse::Success::TaggedBoolean, url: String, + actions_applied: + T::Array[ + ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied + ], + actions_html_stale: T::Boolean, key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata } @@ -598,6 +641,143 @@ module ContextDev end end + class ActionsApplied < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied, + ContextDev::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :instruction + + # Applied means the requested page state was visibly verified. Failed means it was + # not verified. Skipped means it was not attempted. + sig do + returns( + ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::TaggedSymbol + ) + end + attr_accessor :status + + # Visible page evidence used to verify an applied action. + sig { returns(T.nilable(String)) } + attr_reader :completion_evidence + + sig { params(completion_evidence: String).void } + attr_writer :completion_evidence + + sig { returns(T.nilable(Float)) } + attr_reader :duration_ms + + sig { params(duration_ms: Float).void } + attr_writer :duration_ms + + sig { returns(T.nilable(String)) } + attr_reader :error + + sig { params(error: String).void } + attr_writer :error + + sig { returns(T.nilable(String)) } + attr_reader :method_ + + sig { params(method_: String).void } + attr_writer :method_ + + sig { returns(T.nilable(String)) } + attr_reader :target_description + + sig { params(target_description: String).void } + attr_writer :target_description + + sig do + params( + instruction: String, + status: + ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::OrSymbol, + completion_evidence: String, + duration_ms: Float, + error: String, + method_: String, + target_description: String + ).returns(T.attached_class) + end + def self.new( + instruction:, + # Applied means the requested page state was visibly verified. Failed means it was + # not verified. Skipped means it was not attempted. + status:, + # Visible page evidence used to verify an applied action. + completion_evidence: nil, + duration_ms: nil, + error: nil, + method_: nil, + target_description: nil + ) + end + + sig do + override.returns( + { + instruction: String, + status: + ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::TaggedSymbol, + completion_evidence: String, + duration_ms: Float, + error: String, + method_: String, + target_description: String + } + ) + end + def to_hash + end + + # Applied means the requested page state was visibly verified. Failed means it was + # not verified. Skipped means it was not attempted. + module Status + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + APPLIED = + T.let( + :applied, + ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::TaggedSymbol + ) + FAILED = + T.let( + :failed, + ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::TaggedSymbol + ) + SKIPPED = + T.let( + :skipped, + ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::Status::TaggedSymbol + ] + ) + end + def self.values + end + end + end + class KeyMetadata < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do diff --git a/sig/context_dev/models/web_web_scrape_html_response.rbs b/sig/context_dev/models/web_web_scrape_html_response.rbs index 58382156..1fb2b185 100644 --- a/sig/context_dev/models/web_web_scrape_html_response.rbs +++ b/sig/context_dev/models/web_web_scrape_html_response.rbs @@ -7,6 +7,8 @@ module ContextDev success: ContextDev::Models::WebWebScrapeHTMLResponse::success, type: ContextDev::Models::WebWebScrapeHTMLResponse::type_, url: String, + actions_applied: ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied], + actions_html_stale: bool, key_metadata: ContextDev::Models::WebWebScrapeHTMLResponse::KeyMetadata } @@ -21,6 +23,16 @@ module ContextDev attr_accessor url: String + attr_reader actions_applied: ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied]? + + def actions_applied=: ( + ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied] + ) -> ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied] + + attr_reader actions_html_stale: bool? + + def actions_html_stale=: (bool) -> bool + attr_reader key_metadata: ContextDev::Models::WebWebScrapeHTMLResponse::KeyMetadata? def key_metadata=: ( @@ -33,6 +45,8 @@ module ContextDev success: ContextDev::Models::WebWebScrapeHTMLResponse::success, type: ContextDev::Models::WebWebScrapeHTMLResponse::type_, url: String, + ?actions_applied: ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied], + ?actions_html_stale: bool, ?key_metadata: ContextDev::Models::WebWebScrapeHTMLResponse::KeyMetadata ) -> void @@ -42,6 +56,8 @@ module ContextDev success: ContextDev::Models::WebWebScrapeHTMLResponse::success, type: ContextDev::Models::WebWebScrapeHTMLResponse::type_, url: String, + actions_applied: ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied], + actions_html_stale: bool, key_metadata: ContextDev::Models::WebWebScrapeHTMLResponse::KeyMetadata } @@ -306,6 +322,75 @@ module ContextDev def self?.values: -> ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::type_] end + type actions_applied = + { + instruction: String, + status: ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::status, + completion_evidence: String, + duration_ms: Float, + error: String, + method_: String, + target_description: String + } + + class ActionsApplied < ContextDev::Internal::Type::BaseModel + attr_accessor instruction: String + + attr_accessor status: ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::status + + attr_reader completion_evidence: String? + + def completion_evidence=: (String) -> String + + attr_reader duration_ms: Float? + + def duration_ms=: (Float) -> Float + + attr_reader error: String? + + def error=: (String) -> String + + attr_reader method_: String? + + def method_=: (String) -> String + + attr_reader target_description: String? + + def target_description=: (String) -> String + + def initialize: ( + instruction: String, + status: ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::status, + ?completion_evidence: String, + ?duration_ms: Float, + ?error: String, + ?method_: String, + ?target_description: String + ) -> void + + def to_hash: -> { + instruction: String, + status: ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::status, + completion_evidence: String, + duration_ms: Float, + error: String, + method_: String, + target_description: String + } + + type status = :applied | :failed | :skipped + + module Status + extend ContextDev::Internal::Type::Enum + + APPLIED: :applied + FAILED: :failed + SKIPPED: :skipped + + def self?.values: -> ::Array[ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied::status] + end + end + type key_metadata = { credits_consumed: Integer, credits_remaining: Integer } diff --git a/sig/context_dev/models/web_web_scrape_md_response.rbs b/sig/context_dev/models/web_web_scrape_md_response.rbs index ba93554b..4a6ca937 100644 --- a/sig/context_dev/models/web_web_scrape_md_response.rbs +++ b/sig/context_dev/models/web_web_scrape_md_response.rbs @@ -7,6 +7,8 @@ module ContextDev metadata: ContextDev::Models::WebWebScrapeMdResponse::Metadata, success: ContextDev::Models::WebWebScrapeMdResponse::success, url: String, + actions_applied: ::Array[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied], + actions_html_stale: bool, key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata } @@ -21,6 +23,16 @@ module ContextDev attr_accessor url: String + attr_reader actions_applied: ::Array[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied]? + + def actions_applied=: ( + ::Array[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied] + ) -> ::Array[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied] + + attr_reader actions_html_stale: bool? + + def actions_html_stale=: (bool) -> bool + attr_reader key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata? def key_metadata=: ( @@ -33,6 +45,8 @@ module ContextDev metadata: ContextDev::Models::WebWebScrapeMdResponse::Metadata, success: ContextDev::Models::WebWebScrapeMdResponse::success, url: String, + ?actions_applied: ::Array[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied], + ?actions_html_stale: bool, ?key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata ) -> void @@ -42,6 +56,8 @@ module ContextDev metadata: ContextDev::Models::WebWebScrapeMdResponse::Metadata, success: ContextDev::Models::WebWebScrapeMdResponse::success, url: String, + actions_applied: ::Array[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied], + actions_html_stale: bool, key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata } @@ -269,6 +285,75 @@ module ContextDev def self?.values: -> ::Array[ContextDev::Models::WebWebScrapeMdResponse::success] end + type actions_applied = + { + instruction: String, + status: ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::status, + completion_evidence: String, + duration_ms: Float, + error: String, + method_: String, + target_description: String + } + + class ActionsApplied < ContextDev::Internal::Type::BaseModel + attr_accessor instruction: String + + attr_accessor status: ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::status + + attr_reader completion_evidence: String? + + def completion_evidence=: (String) -> String + + attr_reader duration_ms: Float? + + def duration_ms=: (Float) -> Float + + attr_reader error: String? + + def error=: (String) -> String + + attr_reader method_: String? + + def method_=: (String) -> String + + attr_reader target_description: String? + + def target_description=: (String) -> String + + def initialize: ( + instruction: String, + status: ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::status, + ?completion_evidence: String, + ?duration_ms: Float, + ?error: String, + ?method_: String, + ?target_description: String + ) -> void + + def to_hash: -> { + instruction: String, + status: ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::status, + completion_evidence: String, + duration_ms: Float, + error: String, + method_: String, + target_description: String + } + + type status = :applied | :failed | :skipped + + module Status + extend ContextDev::Internal::Type::Enum + + APPLIED: :applied + FAILED: :failed + SKIPPED: :skipped + + def self?.values: -> ::Array[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::status] + end + end + type key_metadata = { credits_consumed: Integer, credits_remaining: Integer } diff --git a/test/context_dev/resources/web_test.rb b/test/context_dev/resources/web_test.rb index e905e9a6..79e8a995 100644 --- a/test/context_dev/resources/web_test.rb +++ b/test/context_dev/resources/web_test.rb @@ -164,6 +164,8 @@ def test_web_scrape_html_required_params success: ContextDev::Models::WebWebScrapeHTMLResponse::Success, type: ContextDev::Models::WebWebScrapeHTMLResponse::Type, url: String, + actions_applied: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebWebScrapeHTMLResponse::ActionsApplied]) | nil, + actions_html_stale: ContextDev::Internal::Type::Boolean | nil, key_metadata: ContextDev::Models::WebWebScrapeHTMLResponse::KeyMetadata | nil } end @@ -204,6 +206,8 @@ def test_web_scrape_md_required_params metadata: ContextDev::Models::WebWebScrapeMdResponse::Metadata, success: ContextDev::Models::WebWebScrapeMdResponse::Success, url: String, + actions_applied: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied]) | nil, + actions_html_stale: ContextDev::Internal::Type::Boolean | nil, key_metadata: ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata | nil } end From 33236b3e9f580329dc7bc59a2c8d58f880b2fac5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 07:58:31 +0000 Subject: [PATCH 09/11] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 75e4f88c..b3a442f0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c7e18da06db76bc8a22f2466e13b1958aedf1791ae3310e289f4c5a3dd522936.yml -openapi_spec_hash: 17d1ac64568e4f0ef529692cd3667175 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-67d0edd5da21ac5e53c3d1f82d60e5f71a160938ed0e8f2e567b042978792405.yml +openapi_spec_hash: d52bec73da0d689ecce7b95235fc6846 config_hash: 2bea1743c84d63bd61f8501a6ea63065 From cedd9b1191e1297236c2aa6dede3fa640380b651 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 08:04:27 +0000 Subject: [PATCH 10/11] feat(api): api update --- .stats.yml | 4 +- lib/context_dev.rb | 2 + lib/context_dev/models.rb | 4 ++ .../models/batch_cancel_response.rb | 37 ++-------- lib/context_dev/models/batch_list_response.rb | 37 ++-------- .../models/batch_retrieve_response.rb | 37 ++-------- lib/context_dev/models/error.rb | 26 +++++++ lib/context_dev/models/error_count.rb | 26 +++++++ rbi/context_dev/models.rbi | 4 ++ .../models/batch_cancel_response.rbi | 57 +++------------ .../models/batch_list_response.rbi | 71 +++---------------- .../models/batch_retrieve_response.rbi | 61 +++------------- rbi/context_dev/models/error.rbi | 32 +++++++++ rbi/context_dev/models/error_count.rbi | 34 +++++++++ sig/context_dev/models.rbs | 4 ++ .../models/batch_cancel_response.rbs | 28 +++----- .../models/batch_list_response.rbs | 28 +++----- .../models/batch_retrieve_response.rbs | 28 +++----- sig/context_dev/models/error.rbs | 15 ++++ sig/context_dev/models/error_count.rbs | 15 ++++ test/context_dev/resources/batch_test.rb | 8 +-- 21 files changed, 240 insertions(+), 318 deletions(-) create mode 100644 lib/context_dev/models/error.rb create mode 100644 lib/context_dev/models/error_count.rb create mode 100644 rbi/context_dev/models/error.rbi create mode 100644 rbi/context_dev/models/error_count.rbi create mode 100644 sig/context_dev/models/error.rbs create mode 100644 sig/context_dev/models/error_count.rbs diff --git a/.stats.yml b/.stats.yml index b3a442f0..33b70809 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-67d0edd5da21ac5e53c3d1f82d60e5f71a160938ed0e8f2e567b042978792405.yml -openapi_spec_hash: d52bec73da0d689ecce7b95235fc6846 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-960cb623c7ec84bf4dc0f5945cbc19eec9cca48271071f400d96066eaa55dbd6.yml +openapi_spec_hash: 84fd39e3f4dc964bf0c32d4e95da1b34 config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/lib/context_dev.rb b/lib/context_dev.rb index c019087a..cf2e7604 100644 --- a/lib/context_dev.rb +++ b/lib/context_dev.rb @@ -70,6 +70,8 @@ require_relative "context_dev/models/brand_retrieve_response" require_relative "context_dev/models/brand_retrieve_simplified_params" require_relative "context_dev/models/brand_retrieve_simplified_response" +require_relative "context_dev/models/error" +require_relative "context_dev/models/error_count" require_relative "context_dev/models/industry_retrieve_naics_params" require_relative "context_dev/models/industry_retrieve_naics_response" require_relative "context_dev/models/industry_retrieve_sic_params" diff --git a/lib/context_dev/models.rb b/lib/context_dev/models.rb index 7e8287ab..2158b096 100644 --- a/lib/context_dev/models.rb +++ b/lib/context_dev/models.rb @@ -57,6 +57,10 @@ module ContextDev BrandRetrieveSimplifiedParams = ContextDev::Models::BrandRetrieveSimplifiedParams + Error = ContextDev::Models::Error + + ErrorCount = ContextDev::Models::ErrorCount + IndustryRetrieveNaicsParams = ContextDev::Models::IndustryRetrieveNaicsParams IndustryRetrieveSicParams = ContextDev::Models::IndustryRetrieveSicParams diff --git a/lib/context_dev/models/batch_cancel_response.rb b/lib/context_dev/models/batch_cancel_response.rb index f0a0b88d..6b92d64f 100644 --- a/lib/context_dev/models/batch_cancel_response.rb +++ b/lib/context_dev/models/batch_cancel_response.rb @@ -17,17 +17,16 @@ class BatchCancelResponse < ContextDev::Internal::Type::BaseModel required :credits, -> { ContextDev::Models::BatchCancelResponse::Credits } # @!attribute error - # Batch-level error. Null unless `status` is `failed`. + # Why the batch failed. # - # @return [ContextDev::Models::BatchCancelResponse::Error, nil] - required :error, -> { ContextDev::Models::BatchCancelResponse::Error }, nil?: true + # @return [ContextDev::Models::Error, nil] + required :error, -> { ContextDev::Error }, nil?: true # @!attribute errors # Page failures grouped by error code. # - # @return [Array] - required :errors, - -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchCancelResponse::Error] } + # @return [Array] + required :errors, -> { ContextDev::Internal::Type::ArrayOf[ContextDev::ErrorCount] } # @!attribute input # Submission counts. @@ -91,9 +90,9 @@ class BatchCancelResponse < ContextDev::Internal::Type::BaseModel # # @param credits [ContextDev::Models::BatchCancelResponse::Credits] Reserved and used credits. # - # @param error [ContextDev::Models::BatchCancelResponse::Error, nil] Batch-level error. Null unless `status` is `failed`. + # @param error [ContextDev::Models::Error, nil] Why the batch failed. # - # @param errors [Array] Page failures grouped by error code. + # @param errors [Array] Page failures grouped by error code. # # @param input [ContextDev::Models::BatchCancelResponse::Input] Submission counts. # @@ -135,28 +134,6 @@ class Credits < ContextDev::Internal::Type::BaseModel # @param estimated [Integer] Credits reserved when the batch was accepted. end - # @see ContextDev::Models::BatchCancelResponse#error - class Error < ContextDev::Internal::Type::BaseModel - # @!attribute code - # Batch error code. - # - # @return [String] - required :code, String - - # @!attribute message - # Batch error message. - # - # @return [String] - required :message, String - - # @!method initialize(code:, message:) - # Batch-level error. Null unless `status` is `failed`. - # - # @param code [String] Batch error code. - # - # @param message [String] Batch error message. - end - # @see ContextDev::Models::BatchCancelResponse#input class Input < ContextDev::Internal::Type::BaseModel # @!attribute accepted diff --git a/lib/context_dev/models/batch_list_response.rb b/lib/context_dev/models/batch_list_response.rb index a3adbf9d..94429714 100644 --- a/lib/context_dev/models/batch_list_response.rb +++ b/lib/context_dev/models/batch_list_response.rb @@ -55,17 +55,16 @@ class Data < ContextDev::Internal::Type::BaseModel required :credits, -> { ContextDev::Models::BatchListResponse::Data::Credits } # @!attribute error - # Batch-level error. Null unless `status` is `failed`. + # Why the batch failed. # - # @return [ContextDev::Models::BatchListResponse::Data::Error, nil] - required :error, -> { ContextDev::Models::BatchListResponse::Data::Error }, nil?: true + # @return [ContextDev::Models::Error, nil] + required :error, -> { ContextDev::Error }, nil?: true # @!attribute errors # Page failures grouped by error code. # - # @return [Array] - required :errors, - -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchListResponse::Data::Error] } + # @return [Array] + required :errors, -> { ContextDev::Internal::Type::ArrayOf[ContextDev::ErrorCount] } # @!attribute input # Submission counts. @@ -125,9 +124,9 @@ class Data < ContextDev::Internal::Type::BaseModel # # @param credits [ContextDev::Models::BatchListResponse::Data::Credits] Reserved and used credits. # - # @param error [ContextDev::Models::BatchListResponse::Data::Error, nil] Batch-level error. Null unless `status` is `failed`. + # @param error [ContextDev::Models::Error, nil] Why the batch failed. # - # @param errors [Array] Page failures grouped by error code. + # @param errors [Array] Page failures grouped by error code. # # @param input [ContextDev::Models::BatchListResponse::Data::Input] Submission counts. # @@ -167,28 +166,6 @@ class Credits < ContextDev::Internal::Type::BaseModel # @param estimated [Integer] Credits reserved when the batch was accepted. end - # @see ContextDev::Models::BatchListResponse::Data#error - class Error < ContextDev::Internal::Type::BaseModel - # @!attribute code - # Batch error code. - # - # @return [String] - required :code, String - - # @!attribute message - # Batch error message. - # - # @return [String] - required :message, String - - # @!method initialize(code:, message:) - # Batch-level error. Null unless `status` is `failed`. - # - # @param code [String] Batch error code. - # - # @param message [String] Batch error message. - end - # @see ContextDev::Models::BatchListResponse::Data#input class Input < ContextDev::Internal::Type::BaseModel # @!attribute accepted diff --git a/lib/context_dev/models/batch_retrieve_response.rb b/lib/context_dev/models/batch_retrieve_response.rb index ffccd30a..7f094b23 100644 --- a/lib/context_dev/models/batch_retrieve_response.rb +++ b/lib/context_dev/models/batch_retrieve_response.rb @@ -17,17 +17,16 @@ class BatchRetrieveResponse < ContextDev::Internal::Type::BaseModel required :credits, -> { ContextDev::Models::BatchRetrieveResponse::Credits } # @!attribute error - # Batch-level error. Null unless `status` is `failed`. + # Why the batch failed. # - # @return [ContextDev::Models::BatchRetrieveResponse::Error, nil] - required :error, -> { ContextDev::Models::BatchRetrieveResponse::Error }, nil?: true + # @return [ContextDev::Models::Error, nil] + required :error, -> { ContextDev::Error }, nil?: true # @!attribute errors # Page failures grouped by error code. # - # @return [Array] - required :errors, - -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchRetrieveResponse::Error] } + # @return [Array] + required :errors, -> { ContextDev::Internal::Type::ArrayOf[ContextDev::ErrorCount] } # @!attribute input # Submission counts. @@ -104,9 +103,9 @@ class BatchRetrieveResponse < ContextDev::Internal::Type::BaseModel # # @param credits [ContextDev::Models::BatchRetrieveResponse::Credits] Reserved and used credits. # - # @param error [ContextDev::Models::BatchRetrieveResponse::Error, nil] Batch-level error. Null unless `status` is `failed`. + # @param error [ContextDev::Models::Error, nil] Why the batch failed. # - # @param errors [Array] Page failures grouped by error code. + # @param errors [Array] Page failures grouped by error code. # # @param input [ContextDev::Models::BatchRetrieveResponse::Input] Submission counts. # @@ -152,28 +151,6 @@ class Credits < ContextDev::Internal::Type::BaseModel # @param estimated [Integer] Credits reserved when the batch was accepted. end - # @see ContextDev::Models::BatchRetrieveResponse#error - class Error < ContextDev::Internal::Type::BaseModel - # @!attribute code - # Batch error code. - # - # @return [String] - required :code, String - - # @!attribute message - # Batch error message. - # - # @return [String] - required :message, String - - # @!method initialize(code:, message:) - # Batch-level error. Null unless `status` is `failed`. - # - # @param code [String] Batch error code. - # - # @param message [String] Batch error message. - end - # @see ContextDev::Models::BatchRetrieveResponse#input class Input < ContextDev::Internal::Type::BaseModel # @!attribute accepted diff --git a/lib/context_dev/models/error.rb b/lib/context_dev/models/error.rb new file mode 100644 index 00000000..3e5e2c13 --- /dev/null +++ b/lib/context_dev/models/error.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module ContextDev + module Models + class Error < ContextDev::Internal::Type::BaseModel + # @!attribute code + # Batch error code. + # + # @return [String] + required :code, String + + # @!attribute message + # Batch error message. + # + # @return [String] + required :message, String + + # @!method initialize(code:, message:) + # Why the batch failed. + # + # @param code [String] Batch error code. + # + # @param message [String] Batch error message. + end + end +end diff --git a/lib/context_dev/models/error_count.rb b/lib/context_dev/models/error_count.rb new file mode 100644 index 00000000..98470828 --- /dev/null +++ b/lib/context_dev/models/error_count.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module ContextDev + module Models + class ErrorCount < ContextDev::Internal::Type::BaseModel + # @!attribute code + # Error code for these failures. + # + # @return [String] + required :code, String + + # @!attribute count + # Pages that failed with this code. + # + # @return [Integer] + required :count, Integer + + # @!method initialize(code:, count:) + # Page failures sharing one error code. + # + # @param code [String] Error code for these failures. + # + # @param count [Integer] Pages that failed with this code. + end + end +end diff --git a/rbi/context_dev/models.rbi b/rbi/context_dev/models.rbi index eee8b9c7..6e887bfa 100644 --- a/rbi/context_dev/models.rbi +++ b/rbi/context_dev/models.rbi @@ -20,6 +20,10 @@ module ContextDev BrandRetrieveSimplifiedParams = ContextDev::Models::BrandRetrieveSimplifiedParams + Error = ContextDev::Models::Error + + ErrorCount = ContextDev::Models::ErrorCount + IndustryRetrieveNaicsParams = ContextDev::Models::IndustryRetrieveNaicsParams IndustryRetrieveSicParams = ContextDev::Models::IndustryRetrieveSicParams diff --git a/rbi/context_dev/models/batch_cancel_response.rbi b/rbi/context_dev/models/batch_cancel_response.rbi index 4fa3188e..cbbdd28b 100644 --- a/rbi/context_dev/models/batch_cancel_response.rbi +++ b/rbi/context_dev/models/batch_cancel_response.rbi @@ -26,20 +26,15 @@ module ContextDev end attr_writer :credits - # Batch-level error. Null unless `status` is `failed`. - sig { returns(T.nilable(ContextDev::Models::BatchCancelResponse::Error)) } + # Why the batch failed. + sig { returns(T.nilable(ContextDev::Error)) } attr_reader :error - sig do - params( - error: - T.nilable(ContextDev::Models::BatchCancelResponse::Error::OrHash) - ).void - end + sig { params(error: T.nilable(ContextDev::Error::OrHash)).void } attr_writer :error # Page failures grouped by error code. - sig { returns(T::Array[ContextDev::Models::BatchCancelResponse::Error]) } + sig { returns(T::Array[ContextDev::ErrorCount]) } attr_accessor :errors # Submission counts. @@ -129,10 +124,8 @@ module ContextDev params( id: String, credits: ContextDev::Models::BatchCancelResponse::Credits::OrHash, - error: - T.nilable(ContextDev::Models::BatchCancelResponse::Error::OrHash), - errors: - T::Array[ContextDev::Models::BatchCancelResponse::Error::OrHash], + error: T.nilable(ContextDev::Error::OrHash), + errors: T::Array[ContextDev::ErrorCount::OrHash], input: ContextDev::Models::BatchCancelResponse::Input::OrHash, mode: ContextDev::Models::BatchCancelResponse::Mode::OrSymbol, progress: ContextDev::Models::BatchCancelResponse::Progress::OrHash, @@ -151,7 +144,7 @@ module ContextDev id:, # Reserved and used credits. credits:, - # Batch-level error. Null unless `status` is `failed`. + # Why the batch failed. error:, # Page failures grouped by error code. errors:, @@ -181,8 +174,8 @@ module ContextDev { id: String, credits: ContextDev::Models::BatchCancelResponse::Credits, - error: T.nilable(ContextDev::Models::BatchCancelResponse::Error), - errors: T::Array[ContextDev::Models::BatchCancelResponse::Error], + error: T.nilable(ContextDev::Error), + errors: T::Array[ContextDev::ErrorCount], input: ContextDev::Models::BatchCancelResponse::Input, mode: ContextDev::Models::BatchCancelResponse::Mode::TaggedSymbol, progress: ContextDev::Models::BatchCancelResponse::Progress, @@ -234,38 +227,6 @@ module ContextDev end end - class Error < ContextDev::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - ContextDev::Models::BatchCancelResponse::Error, - ContextDev::Internal::AnyHash - ) - end - - # Batch error code. - sig { returns(String) } - attr_accessor :code - - # Batch error message. - sig { returns(String) } - attr_accessor :message - - # Batch-level error. Null unless `status` is `failed`. - sig { params(code: String, message: String).returns(T.attached_class) } - def self.new( - # Batch error code. - code:, - # Batch error message. - message: - ) - end - - sig { override.returns({ code: String, message: String }) } - def to_hash - end - end - class Input < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do diff --git a/rbi/context_dev/models/batch_list_response.rbi b/rbi/context_dev/models/batch_list_response.rbi index 0d700896..0aa18e00 100644 --- a/rbi/context_dev/models/batch_list_response.rbi +++ b/rbi/context_dev/models/batch_list_response.rbi @@ -112,26 +112,15 @@ module ContextDev end attr_writer :credits - # Batch-level error. Null unless `status` is `failed`. - sig do - returns(T.nilable(ContextDev::Models::BatchListResponse::Data::Error)) - end + # Why the batch failed. + sig { returns(T.nilable(ContextDev::Error)) } attr_reader :error - sig do - params( - error: - T.nilable( - ContextDev::Models::BatchListResponse::Data::Error::OrHash - ) - ).void - end + sig { params(error: T.nilable(ContextDev::Error::OrHash)).void } attr_writer :error # Page failures grouped by error code. - sig do - returns(T::Array[ContextDev::Models::BatchListResponse::Data::Error]) - end + sig { returns(T::Array[ContextDev::ErrorCount]) } attr_accessor :errors # Submission counts. @@ -220,14 +209,8 @@ module ContextDev id: String, credits: ContextDev::Models::BatchListResponse::Data::Credits::OrHash, - error: - T.nilable( - ContextDev::Models::BatchListResponse::Data::Error::OrHash - ), - errors: - T::Array[ - ContextDev::Models::BatchListResponse::Data::Error::OrHash - ], + error: T.nilable(ContextDev::Error::OrHash), + errors: T::Array[ContextDev::ErrorCount::OrHash], input: ContextDev::Models::BatchListResponse::Data::Input::OrHash, mode: ContextDev::Models::BatchListResponse::Data::Mode::OrSymbol, progress: @@ -248,7 +231,7 @@ module ContextDev id:, # Reserved and used credits. credits:, - # Batch-level error. Null unless `status` is `failed`. + # Why the batch failed. error:, # Page failures grouped by error code. errors:, @@ -276,10 +259,8 @@ module ContextDev { id: String, credits: ContextDev::Models::BatchListResponse::Data::Credits, - error: - T.nilable(ContextDev::Models::BatchListResponse::Data::Error), - errors: - T::Array[ContextDev::Models::BatchListResponse::Data::Error], + error: T.nilable(ContextDev::Error), + errors: T::Array[ContextDev::ErrorCount], input: ContextDev::Models::BatchListResponse::Data::Input, mode: ContextDev::Models::BatchListResponse::Data::Mode::TaggedSymbol, @@ -334,40 +315,6 @@ module ContextDev end end - class Error < ContextDev::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - ContextDev::Models::BatchListResponse::Data::Error, - ContextDev::Internal::AnyHash - ) - end - - # Batch error code. - sig { returns(String) } - attr_accessor :code - - # Batch error message. - sig { returns(String) } - attr_accessor :message - - # Batch-level error. Null unless `status` is `failed`. - sig do - params(code: String, message: String).returns(T.attached_class) - end - def self.new( - # Batch error code. - code:, - # Batch error message. - message: - ) - end - - sig { override.returns({ code: String, message: String }) } - def to_hash - end - end - class Input < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do diff --git a/rbi/context_dev/models/batch_retrieve_response.rbi b/rbi/context_dev/models/batch_retrieve_response.rbi index 2518e6e9..a86b6453 100644 --- a/rbi/context_dev/models/batch_retrieve_response.rbi +++ b/rbi/context_dev/models/batch_retrieve_response.rbi @@ -26,24 +26,15 @@ module ContextDev end attr_writer :credits - # Batch-level error. Null unless `status` is `failed`. - sig do - returns(T.nilable(ContextDev::Models::BatchRetrieveResponse::Error)) - end + # Why the batch failed. + sig { returns(T.nilable(ContextDev::Error)) } attr_reader :error - sig do - params( - error: - T.nilable(ContextDev::Models::BatchRetrieveResponse::Error::OrHash) - ).void - end + sig { params(error: T.nilable(ContextDev::Error::OrHash)).void } attr_writer :error # Page failures grouped by error code. - sig do - returns(T::Array[ContextDev::Models::BatchRetrieveResponse::Error]) - end + sig { returns(T::Array[ContextDev::ErrorCount]) } attr_accessor :errors # Submission counts. @@ -150,10 +141,8 @@ module ContextDev params( id: String, credits: ContextDev::Models::BatchRetrieveResponse::Credits::OrHash, - error: - T.nilable(ContextDev::Models::BatchRetrieveResponse::Error::OrHash), - errors: - T::Array[ContextDev::Models::BatchRetrieveResponse::Error::OrHash], + error: T.nilable(ContextDev::Error::OrHash), + errors: T::Array[ContextDev::ErrorCount::OrHash], input: ContextDev::Models::BatchRetrieveResponse::Input::OrHash, invalid_urls: T::Array[ @@ -179,7 +168,7 @@ module ContextDev id:, # Reserved and used credits. credits:, - # Batch-level error. Null unless `status` is `failed`. + # Why the batch failed. error:, # Page failures grouped by error code. errors:, @@ -213,8 +202,8 @@ module ContextDev { id: String, credits: ContextDev::Models::BatchRetrieveResponse::Credits, - error: T.nilable(ContextDev::Models::BatchRetrieveResponse::Error), - errors: T::Array[ContextDev::Models::BatchRetrieveResponse::Error], + error: T.nilable(ContextDev::Error), + errors: T::Array[ContextDev::ErrorCount], input: ContextDev::Models::BatchRetrieveResponse::Input, invalid_urls: T::Array[ContextDev::Models::BatchRetrieveResponse::InvalidURL], @@ -270,38 +259,6 @@ module ContextDev end end - class Error < ContextDev::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - ContextDev::Models::BatchRetrieveResponse::Error, - ContextDev::Internal::AnyHash - ) - end - - # Batch error code. - sig { returns(String) } - attr_accessor :code - - # Batch error message. - sig { returns(String) } - attr_accessor :message - - # Batch-level error. Null unless `status` is `failed`. - sig { params(code: String, message: String).returns(T.attached_class) } - def self.new( - # Batch error code. - code:, - # Batch error message. - message: - ) - end - - sig { override.returns({ code: String, message: String }) } - def to_hash - end - end - class Input < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do diff --git a/rbi/context_dev/models/error.rbi b/rbi/context_dev/models/error.rbi new file mode 100644 index 00000000..6f0ce137 --- /dev/null +++ b/rbi/context_dev/models/error.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module ContextDev + module Models + class Error < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias { T.any(ContextDev::Error, ContextDev::Internal::AnyHash) } + + # Batch error code. + sig { returns(String) } + attr_accessor :code + + # Batch error message. + sig { returns(String) } + attr_accessor :message + + # Why the batch failed. + sig { params(code: String, message: String).returns(T.attached_class) } + def self.new( + # Batch error code. + code:, + # Batch error message. + message: + ) + end + + sig { override.returns({ code: String, message: String }) } + def to_hash + end + end + end +end diff --git a/rbi/context_dev/models/error_count.rbi b/rbi/context_dev/models/error_count.rbi new file mode 100644 index 00000000..a9c70143 --- /dev/null +++ b/rbi/context_dev/models/error_count.rbi @@ -0,0 +1,34 @@ +# typed: strong + +module ContextDev + module Models + class ErrorCount < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(ContextDev::ErrorCount, ContextDev::Internal::AnyHash) + end + + # Error code for these failures. + sig { returns(String) } + attr_accessor :code + + # Pages that failed with this code. + sig { returns(Integer) } + attr_accessor :count + + # Page failures sharing one error code. + sig { params(code: String, count: Integer).returns(T.attached_class) } + def self.new( + # Error code for these failures. + code:, + # Pages that failed with this code. + count: + ) + end + + sig { override.returns({ code: String, count: Integer }) } + def to_hash + end + end + end +end diff --git a/sig/context_dev/models.rbs b/sig/context_dev/models.rbs index 378e6575..66ce2bb6 100644 --- a/sig/context_dev/models.rbs +++ b/sig/context_dev/models.rbs @@ -17,6 +17,10 @@ module ContextDev class BrandRetrieveSimplifiedParams = ContextDev::Models::BrandRetrieveSimplifiedParams + class Error = ContextDev::Models::Error + + class ErrorCount = ContextDev::Models::ErrorCount + class IndustryRetrieveNaicsParams = ContextDev::Models::IndustryRetrieveNaicsParams class IndustryRetrieveSicParams = ContextDev::Models::IndustryRetrieveSicParams diff --git a/sig/context_dev/models/batch_cancel_response.rbs b/sig/context_dev/models/batch_cancel_response.rbs index 9b4686e3..5bdf7889 100644 --- a/sig/context_dev/models/batch_cancel_response.rbs +++ b/sig/context_dev/models/batch_cancel_response.rbs @@ -4,8 +4,8 @@ module ContextDev { id: String, credits: ContextDev::Models::BatchCancelResponse::Credits, - error: ContextDev::Models::BatchCancelResponse::Error?, - errors: ::Array[ContextDev::Models::BatchCancelResponse::Error], + error: ContextDev::Error?, + errors: ::Array[ContextDev::ErrorCount], input: ContextDev::Models::BatchCancelResponse::Input, mode: ContextDev::Models::BatchCancelResponse::mode, progress: ContextDev::Models::BatchCancelResponse::Progress, @@ -22,9 +22,9 @@ module ContextDev attr_accessor credits: ContextDev::Models::BatchCancelResponse::Credits - attr_accessor error: ContextDev::Models::BatchCancelResponse::Error? + attr_accessor error: ContextDev::Error? - attr_accessor errors: ::Array[ContextDev::Models::BatchCancelResponse::Error] + attr_accessor errors: ::Array[ContextDev::ErrorCount] attr_accessor input: ContextDev::Models::BatchCancelResponse::Input @@ -51,8 +51,8 @@ module ContextDev def initialize: ( id: String, credits: ContextDev::Models::BatchCancelResponse::Credits, - error: ContextDev::Models::BatchCancelResponse::Error?, - errors: ::Array[ContextDev::Models::BatchCancelResponse::Error], + error: ContextDev::Error?, + errors: ::Array[ContextDev::ErrorCount], input: ContextDev::Models::BatchCancelResponse::Input, mode: ContextDev::Models::BatchCancelResponse::mode, progress: ContextDev::Models::BatchCancelResponse::Progress, @@ -67,8 +67,8 @@ module ContextDev def to_hash: -> { id: String, credits: ContextDev::Models::BatchCancelResponse::Credits, - error: ContextDev::Models::BatchCancelResponse::Error?, - errors: ::Array[ContextDev::Models::BatchCancelResponse::Error], + error: ContextDev::Error?, + errors: ::Array[ContextDev::ErrorCount], input: ContextDev::Models::BatchCancelResponse::Input, mode: ContextDev::Models::BatchCancelResponse::mode, progress: ContextDev::Models::BatchCancelResponse::Progress, @@ -92,18 +92,6 @@ module ContextDev def to_hash: -> { charged: Integer, estimated: Integer } end - type error = { code: String, message: String } - - class Error < ContextDev::Internal::Type::BaseModel - attr_accessor code: String - - attr_accessor message: String - - def initialize: (code: String, message: String) -> void - - def to_hash: -> { code: String, message: String } - end - type input = { accepted: Integer, diff --git a/sig/context_dev/models/batch_list_response.rbs b/sig/context_dev/models/batch_list_response.rbs index 6b59c70a..571de08e 100644 --- a/sig/context_dev/models/batch_list_response.rbs +++ b/sig/context_dev/models/batch_list_response.rbs @@ -45,8 +45,8 @@ module ContextDev { id: String, credits: ContextDev::Models::BatchListResponse::Data::Credits, - error: ContextDev::Models::BatchListResponse::Data::Error?, - errors: ::Array[ContextDev::Models::BatchListResponse::Data::Error], + error: ContextDev::Error?, + errors: ::Array[ContextDev::ErrorCount], input: ContextDev::Models::BatchListResponse::Data::Input, mode: ContextDev::Models::BatchListResponse::Data::mode, progress: ContextDev::Models::BatchListResponse::Data::Progress, @@ -62,9 +62,9 @@ module ContextDev attr_accessor credits: ContextDev::Models::BatchListResponse::Data::Credits - attr_accessor error: ContextDev::Models::BatchListResponse::Data::Error? + attr_accessor error: ContextDev::Error? - attr_accessor errors: ::Array[ContextDev::Models::BatchListResponse::Data::Error] + attr_accessor errors: ::Array[ContextDev::ErrorCount] attr_accessor input: ContextDev::Models::BatchListResponse::Data::Input @@ -85,8 +85,8 @@ module ContextDev def initialize: ( id: String, credits: ContextDev::Models::BatchListResponse::Data::Credits, - error: ContextDev::Models::BatchListResponse::Data::Error?, - errors: ::Array[ContextDev::Models::BatchListResponse::Data::Error], + error: ContextDev::Error?, + errors: ::Array[ContextDev::ErrorCount], input: ContextDev::Models::BatchListResponse::Data::Input, mode: ContextDev::Models::BatchListResponse::Data::mode, progress: ContextDev::Models::BatchListResponse::Data::Progress, @@ -100,8 +100,8 @@ module ContextDev def to_hash: -> { id: String, credits: ContextDev::Models::BatchListResponse::Data::Credits, - error: ContextDev::Models::BatchListResponse::Data::Error?, - errors: ::Array[ContextDev::Models::BatchListResponse::Data::Error], + error: ContextDev::Error?, + errors: ::Array[ContextDev::ErrorCount], input: ContextDev::Models::BatchListResponse::Data::Input, mode: ContextDev::Models::BatchListResponse::Data::mode, progress: ContextDev::Models::BatchListResponse::Data::Progress, @@ -124,18 +124,6 @@ module ContextDev def to_hash: -> { charged: Integer, estimated: Integer } end - type error = { code: String, message: String } - - class Error < ContextDev::Internal::Type::BaseModel - attr_accessor code: String - - attr_accessor message: String - - def initialize: (code: String, message: String) -> void - - def to_hash: -> { code: String, message: String } - end - type input = { accepted: Integer, diff --git a/sig/context_dev/models/batch_retrieve_response.rbs b/sig/context_dev/models/batch_retrieve_response.rbs index d2c913ef..654bdcad 100644 --- a/sig/context_dev/models/batch_retrieve_response.rbs +++ b/sig/context_dev/models/batch_retrieve_response.rbs @@ -4,8 +4,8 @@ module ContextDev { id: String, credits: ContextDev::Models::BatchRetrieveResponse::Credits, - error: ContextDev::Models::BatchRetrieveResponse::Error?, - errors: ::Array[ContextDev::Models::BatchRetrieveResponse::Error], + error: ContextDev::Error?, + errors: ::Array[ContextDev::ErrorCount], input: ContextDev::Models::BatchRetrieveResponse::Input, invalid_urls: ::Array[ContextDev::Models::BatchRetrieveResponse::InvalidURL], mode: ContextDev::Models::BatchRetrieveResponse::mode, @@ -24,9 +24,9 @@ module ContextDev attr_accessor credits: ContextDev::Models::BatchRetrieveResponse::Credits - attr_accessor error: ContextDev::Models::BatchRetrieveResponse::Error? + attr_accessor error: ContextDev::Error? - attr_accessor errors: ::Array[ContextDev::Models::BatchRetrieveResponse::Error] + attr_accessor errors: ::Array[ContextDev::ErrorCount] attr_accessor input: ContextDev::Models::BatchRetrieveResponse::Input @@ -59,8 +59,8 @@ module ContextDev def initialize: ( id: String, credits: ContextDev::Models::BatchRetrieveResponse::Credits, - error: ContextDev::Models::BatchRetrieveResponse::Error?, - errors: ::Array[ContextDev::Models::BatchRetrieveResponse::Error], + error: ContextDev::Error?, + errors: ::Array[ContextDev::ErrorCount], input: ContextDev::Models::BatchRetrieveResponse::Input, invalid_urls: ::Array[ContextDev::Models::BatchRetrieveResponse::InvalidURL], mode: ContextDev::Models::BatchRetrieveResponse::mode, @@ -77,8 +77,8 @@ module ContextDev def to_hash: -> { id: String, credits: ContextDev::Models::BatchRetrieveResponse::Credits, - error: ContextDev::Models::BatchRetrieveResponse::Error?, - errors: ::Array[ContextDev::Models::BatchRetrieveResponse::Error], + error: ContextDev::Error?, + errors: ::Array[ContextDev::ErrorCount], input: ContextDev::Models::BatchRetrieveResponse::Input, invalid_urls: ::Array[ContextDev::Models::BatchRetrieveResponse::InvalidURL], mode: ContextDev::Models::BatchRetrieveResponse::mode, @@ -104,18 +104,6 @@ module ContextDev def to_hash: -> { charged: Integer, estimated: Integer } end - type error = { code: String, message: String } - - class Error < ContextDev::Internal::Type::BaseModel - attr_accessor code: String - - attr_accessor message: String - - def initialize: (code: String, message: String) -> void - - def to_hash: -> { code: String, message: String } - end - type input = { accepted: Integer, diff --git a/sig/context_dev/models/error.rbs b/sig/context_dev/models/error.rbs new file mode 100644 index 00000000..67829209 --- /dev/null +++ b/sig/context_dev/models/error.rbs @@ -0,0 +1,15 @@ +module ContextDev + module Models + type error = { code: String, message: String } + + class Error < ContextDev::Internal::Type::BaseModel + attr_accessor code: String + + attr_accessor message: String + + def initialize: (code: String, message: String) -> void + + def to_hash: -> { code: String, message: String } + end + end +end diff --git a/sig/context_dev/models/error_count.rbs b/sig/context_dev/models/error_count.rbs new file mode 100644 index 00000000..b0f2bf0a --- /dev/null +++ b/sig/context_dev/models/error_count.rbs @@ -0,0 +1,15 @@ +module ContextDev + module Models + type error_count = { code: String, count: Integer } + + class ErrorCount < ContextDev::Internal::Type::BaseModel + attr_accessor code: String + + attr_accessor count: Integer + + def initialize: (code: String, count: Integer) -> void + + def to_hash: -> { code: String, count: Integer } + end + end +end diff --git a/test/context_dev/resources/batch_test.rb b/test/context_dev/resources/batch_test.rb index 2926912e..1e5fb5de 100644 --- a/test/context_dev/resources/batch_test.rb +++ b/test/context_dev/resources/batch_test.rb @@ -16,8 +16,8 @@ def test_retrieve response => { id: String, credits: ContextDev::Models::BatchRetrieveResponse::Credits, - error: ContextDev::Models::BatchRetrieveResponse::Error | nil, - errors: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchRetrieveResponse::Error]), + error: ContextDev::Error | nil, + errors: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::ErrorCount]), input: ContextDev::Models::BatchRetrieveResponse::Input, invalid_urls: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchRetrieveResponse::InvalidURL]), mode: ContextDev::Models::BatchRetrieveResponse::Mode, @@ -65,8 +65,8 @@ def test_cancel response => { id: String, credits: ContextDev::Models::BatchCancelResponse::Credits, - error: ContextDev::Models::BatchCancelResponse::Error | nil, - errors: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::Models::BatchCancelResponse::Error]), + error: ContextDev::Error | nil, + errors: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::ErrorCount]), input: ContextDev::Models::BatchCancelResponse::Input, mode: ContextDev::Models::BatchCancelResponse::Mode, progress: ContextDev::Models::BatchCancelResponse::Progress, From 35dac87daedd555d3b1e1edbda16125a8ece4bad Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 08:04:53 +0000 Subject: [PATCH 11/11] release: 2.6.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ Gemfile.lock | 2 +- README.md | 2 +- lib/context_dev/version.rb | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4dedeaeb..511dd516 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.5.0" + ".": "2.6.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ecb46e3..4beb8aba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 2.6.0 (2026-07-31) + +Full Changelog: [v2.5.0...v2.6.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v2.5.0...v2.6.0) + +### Features + +* **api:** api update ([cedd9b1](https://github.com/context-dot-dev/context-ruby-sdk/commit/cedd9b1191e1297236c2aa6dede3fa640380b651)) +* **api:** api update ([98fedb9](https://github.com/context-dot-dev/context-ruby-sdk/commit/98fedb99aae187cff9284efd0a6c574b1b71d749)) +* **api:** api update ([7a5cc9a](https://github.com/context-dot-dev/context-ruby-sdk/commit/7a5cc9aa3bd2c746d0e47a58fbc426453db3b8c7)) +* **api:** api update ([6cfd0e8](https://github.com/context-dot-dev/context-ruby-sdk/commit/6cfd0e80f3860cfbddd595ac4c72461075775415)) +* **api:** api update ([99bdfb2](https://github.com/context-dot-dev/context-ruby-sdk/commit/99bdfb24af9adfac64ee68ca714fb1176c1d61c0)) +* **api:** manual updates ([d7a4669](https://github.com/context-dot-dev/context-ruby-sdk/commit/d7a46695c2ba5ec1f54eaedec751bfd1d1559c4b)) + ## 2.5.0 (2026-07-22) Full Changelog: [v2.4.0...v2.5.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v2.4.0...v2.5.0) diff --git a/Gemfile.lock b/Gemfile.lock index 432df4de..9d97d442 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - context.dev (2.5.0) + context.dev (2.6.0) cgi connection_pool diff --git a/README.md b/README.md index 9ecfef20..ff7902e9 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "context.dev", "~> 2.5.0" +gem "context.dev", "~> 2.6.0" ``` diff --git a/lib/context_dev/version.rb b/lib/context_dev/version.rb index 1b2239ad..0c784f60 100644 --- a/lib/context_dev/version.rb +++ b/lib/context_dev/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ContextDev - VERSION = "2.5.0" + VERSION = "2.6.0" end