lib/selenium/webdriver/bidi/protocol/storage.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 Storage < Domain
          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          PartitionKey = Serialization::Record.define(
            user_context: {wire_key: 'userContext', required: false, primitive: 'string'},
            source_origin: {wire_key: 'sourceOrigin', required: false, primitive: 'string'},
            extensible: true
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          CookieFilter = Serialization::Record.define(
            name: {wire_key: 'name', required: false, primitive: 'string'},
            value: {wire_key: 'value', required: false, ref: 'Network::BytesValue'},
            domain: {wire_key: 'domain', required: false, primitive: 'string'},
            path: {wire_key: 'path', required: false, primitive: 'string'},
            size: {wire_key: 'size', required: false},
            http_only: {wire_key: 'httpOnly', required: false, primitive: 'boolean'},
            secure: {wire_key: 'secure', required: false, primitive: 'boolean'},
            same_site: {wire_key: 'sameSite', required: false, enum: 'Network::SAME_SITE'},
            expiry: {wire_key: 'expiry', required: false},
            extensible: true
          )

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

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          StorageKeyPartitionDescriptor = Serialization::Record.define(
            type: {fixed: 'storageKey'},
            user_context: {wire_key: 'userContext', required: false, primitive: 'string'},
            source_origin: {wire_key: 'sourceOrigin', required: false, primitive: 'string'},
            extensible: true
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          class PartitionDescriptor < Serialization::Union
            discriminator 'type', {context: 'context', storage_key: 'storageKey'}
            variants(
              context: 'Storage::BrowsingContextPartitionDescriptor',
              storage_key: 'Storage::StorageKeyPartitionDescriptor'
            )
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          GetCookiesParameters = Serialization::Record.define(
            filter: {wire_key: 'filter', required: false, ref: 'Storage::CookieFilter'},
            partition: {wire_key: 'partition', required: false, ref: 'Storage::PartitionDescriptor'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          GetCookiesResult = Serialization::Record.define(
            cookies: {wire_key: 'cookies', ref: 'Network::Cookie', list: true},
            partition_key: {wire_key: 'partitionKey', ref: 'Storage::PartitionKey'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          PartialCookie = Serialization::Record.define(
            name: {wire_key: 'name', primitive: 'string'},
            value: {wire_key: 'value', ref: 'Network::BytesValue'},
            domain: {wire_key: 'domain', primitive: 'string'},
            path: {wire_key: 'path', required: false, primitive: 'string'},
            http_only: {wire_key: 'httpOnly', required: false, primitive: 'boolean'},
            secure: {wire_key: 'secure', required: false, primitive: 'boolean'},
            same_site: {wire_key: 'sameSite', required: false, enum: 'Network::SAME_SITE'},
            expiry: {wire_key: 'expiry', required: false},
            extensible: true
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          SetCookieParameters = Serialization::Record.define(
            cookie: {wire_key: 'cookie', ref: 'Storage::PartialCookie'},
            partition: {wire_key: 'partition', required: false, ref: 'Storage::PartitionDescriptor'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          SetCookieResult = Serialization::Record.define(
            partition_key: {wire_key: 'partitionKey', ref: 'Storage::PartitionKey'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          DeleteCookiesParameters = Serialization::Record.define(
            filter: {wire_key: 'filter', required: false, ref: 'Storage::CookieFilter'},
            partition: {wire_key: 'partition', required: false, ref: 'Storage::PartitionDescriptor'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          DeleteCookiesResult = Serialization::Record.define(
            partition_key: {wire_key: 'partitionKey', ref: 'Storage::PartitionKey'}
          )

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def delete_cookies(filter: Serialization::UNSET, partition: Serialization::UNSET)
            params = DeleteCookiesParameters.new(filter: filter, partition: partition)
            execute(cmd: 'storage.deleteCookies', params: params, result: Storage::DeleteCookiesResult)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def get_cookies(filter: Serialization::UNSET, partition: Serialization::UNSET)
            params = GetCookiesParameters.new(filter: filter, partition: partition)
            execute(cmd: 'storage.getCookies', params: params, result: Storage::GetCookiesResult)
          end

          # @api private
          # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
          def set_cookie(cookie:, partition: Serialization::UNSET)
            params = SetCookieParameters.new(cookie: cookie, partition: partition)
            execute(cmd: 'storage.setCookie', params: params, result: Storage::SetCookieResult)
          end
        end # Storage
      end # Protocol
    end # BiDi
  end # WebDriver
end # Selenium