lib/selenium/webdriver/bidi/protocol/emulation.rb



# frozen_string_literal: true

# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

# This file is automatically generated. DO NOT EDIT!
# Regenerate with: bazel run //rb/lib/selenium/webdriver:bidi-generate

module Selenium
  module WebDriver
    class BiDi
      module Protocol
        # @api private
        # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
        class Emulation < Domain
          FORCED_COLORS_MODE_THEME = {
            light: 'light',
            dark: 'dark'
          }.freeze

          SCREEN_ORIENTATION_NATURAL = {
            portrait: 'portrait',
            landscape: 'landscape'
          }.freeze

          SCREEN_ORIENTATION_TYPE = {
            portrait_primary: 'portrait-primary',
            portrait_secondary: 'portrait-secondary',
            landscape_primary: 'landscape-primary',
            landscape_secondary: 'landscape-secondary'
          }.freeze

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          SetForcedColorsModeThemeOverrideParameters = Serialization::Record.define(
            theme: {wire_key: 'theme', nullable: true, enum: 'Emulation::FORCED_COLORS_MODE_THEME'},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          class SetGeolocationOverrideParameters < Serialization::Union
            presence(
              'Emulation::SetGeolocationOverrideParameters::Coordinates' => ['coordinates'],
              'Emulation::SetGeolocationOverrideParameters::Error' => ['error']
            )

            # @api private
            # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
            Coordinates = Serialization::Record.define(
              contexts: {wire_key: 'contexts', required: false, list: true},
              user_contexts: {wire_key: 'userContexts', required: false, list: true},
              coordinates: {wire_key: 'coordinates', nullable: true, ref: 'Emulation::GeolocationCoordinates'}
            )

            # @api private
            # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
            Error = Serialization::Record.define(
              contexts: {wire_key: 'contexts', required: false, list: true},
              user_contexts: {wire_key: 'userContexts', required: false, list: true},
              error: {wire_key: 'error', ref: 'Emulation::GeolocationPositionError'}
            )
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          GeolocationCoordinates = Serialization::Record.define(
            latitude: {wire_key: 'latitude', primitive: 'integer'},
            longitude: {wire_key: 'longitude', primitive: 'integer'},
            accuracy: {wire_key: 'accuracy', required: false, primitive: 'number'},
            altitude: {wire_key: 'altitude', required: false, nullable: true, primitive: 'number'},
            altitude_accuracy: {wire_key: 'altitudeAccuracy', required: false, nullable: true, primitive: 'number'},
            heading: {wire_key: 'heading', required: false, nullable: true, primitive: 'integer'},
            speed: {wire_key: 'speed', required: false, nullable: true, primitive: 'number'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          GeolocationPositionError = Serialization::Record.define(type: {fixed: 'positionUnavailable'})

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          SetLocaleOverrideParameters = Serialization::Record.define(
            locale: {wire_key: 'locale', nullable: true, primitive: 'string'},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          SetNetworkConditionsParameters = Serialization::Record.define(
            network_conditions: {
              wire_key: 'networkConditions',
              nullable: true,
              ref: 'Emulation::NetworkConditionsOffline'
            },
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          NetworkConditionsOffline = Serialization::Record.define(type: {fixed: 'offline'})

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          ScreenArea = Serialization::Record.define(width: 'width', height: 'height')

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          SetScreenSettingsOverrideParameters = Serialization::Record.define(
            screen_area: {wire_key: 'screenArea', nullable: true, ref: 'Emulation::ScreenArea'},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          ScreenOrientation = Serialization::Record.define(
            natural: {wire_key: 'natural', enum: 'Emulation::SCREEN_ORIENTATION_NATURAL'},
            type: {wire_key: 'type', enum: 'Emulation::SCREEN_ORIENTATION_TYPE'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          SetScreenOrientationOverrideParameters = Serialization::Record.define(
            screen_orientation: {wire_key: 'screenOrientation', nullable: true, ref: 'Emulation::ScreenOrientation'},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          SetUserAgentOverrideParameters = Serialization::Record.define(
            user_agent: {wire_key: 'userAgent', nullable: true, primitive: 'string'},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          SetScriptingEnabledParameters = Serialization::Record.define(
            enabled: {wire_key: 'enabled', nullable: true},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          SetScrollbarTypeOverrideParameters = Serialization::Record.define(
            scrollbar_type: {wire_key: 'scrollbarType', nullable: true},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          SetTimezoneOverrideParameters = Serialization::Record.define(
            timezone: {wire_key: 'timezone', nullable: true, primitive: 'string'},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          SetTouchOverrideParameters = Serialization::Record.define(
            max_touch_points: {wire_key: 'maxTouchPoints', nullable: true},
            contexts: {wire_key: 'contexts', required: false, list: true},
            user_contexts: {wire_key: 'userContexts', required: false, list: true}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_forced_colors_mode_theme_override(
            theme:,
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            Serialization.validate!('theme', theme, Emulation::FORCED_COLORS_MODE_THEME)
            params = SetForcedColorsModeThemeOverrideParameters.new(
              theme: theme,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setForcedColorsModeThemeOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_geolocation_override(
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET,
            coordinates: Serialization::UNSET,
            error: Serialization::UNSET
          )
            params = SetGeolocationOverrideParameters.build(
              contexts: contexts,
              user_contexts: user_contexts,
              coordinates: coordinates,
              error: error
            )
            execute(cmd: 'emulation.setGeolocationOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_locale_override(locale:, contexts: Serialization::UNSET, user_contexts: Serialization::UNSET)
            params = SetLocaleOverrideParameters.new(locale: locale, contexts: contexts, user_contexts: user_contexts)
            execute(cmd: 'emulation.setLocaleOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_network_conditions(
            network_conditions:,
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            params = SetNetworkConditionsParameters.new(
              network_conditions: network_conditions,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setNetworkConditions', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_screen_orientation_override(
            screen_orientation:,
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            params = SetScreenOrientationOverrideParameters.new(
              screen_orientation: screen_orientation,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setScreenOrientationOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_screen_settings_override(
            screen_area:,
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            params = SetScreenSettingsOverrideParameters.new(
              screen_area: screen_area,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setScreenSettingsOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_scripting_enabled(enabled:, contexts: Serialization::UNSET, user_contexts: Serialization::UNSET)
            params = SetScriptingEnabledParameters.new(
              enabled: enabled,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setScriptingEnabled', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_scrollbar_type_override(
            scrollbar_type:,
            contexts: Serialization::UNSET,
            user_contexts: Serialization::UNSET
          )
            params = SetScrollbarTypeOverrideParameters.new(
              scrollbar_type: scrollbar_type,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setScrollbarTypeOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_timezone_override(timezone:, contexts: Serialization::UNSET, user_contexts: Serialization::UNSET)
            params = SetTimezoneOverrideParameters.new(
              timezone: timezone,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setTimezoneOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_touch_override(max_touch_points:, contexts: Serialization::UNSET, user_contexts: Serialization::UNSET)
            params = SetTouchOverrideParameters.new(
              max_touch_points: max_touch_points,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setTouchOverride', params: params)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_user_agent_override(user_agent:, contexts: Serialization::UNSET, user_contexts: Serialization::UNSET)
            params = SetUserAgentOverrideParameters.new(
              user_agent: user_agent,
              contexts: contexts,
              user_contexts: user_contexts
            )
            execute(cmd: 'emulation.setUserAgentOverride', params: params)
          end
        end # Emulation
      end # Protocol
    end # BiDi
  end # WebDriver
end # Selenium