Sha256: 401e3cc3d4c16cfb758ba894486378d9ae2f9874f3ea6fc58097ac7fde002c03

Contents?: true

Size: 1.63 KB

Versions: 22

Compression:

Stored size: 1.63 KB

Contents

# frozen_string_literal: true

module Mihari
  module Structs
    module Filters
      module Alert
        class SearchFilter < Dry::Struct
          attribute? :artifact_data, Types::String.optional
          attribute? :rule_id, Types::String.optional
          attribute? :tag_name, Types::String.optional
          attribute? :from_at, Types::DateTime.optional
          attribute? :to_at, Types::DateTime.optional
        end

        class SearchFilterWithPagination < SearchFilter
          attribute? :page, Types::Int.default(1)
          attribute? :limit, Types::Int.default(10)

          def without_pagination
            SearchFilter.new(
              artifact_data: artifact_data,
              from_at: from_at,
              rule_id: rule_id,
              tag_name: tag_name,
              to_at: to_at
            )
          end
        end
      end

      module Rule
        class SearchFilter < Dry::Struct
          attribute? :description, Types::String.optional
          attribute? :tag_name, Types::String.optional
          attribute? :title, Types::String.optional
          attribute? :from_at, Types::DateTime.optional
          attribute? :to_at, Types::DateTime.optional
        end

        class SearchFilterWithPagination < SearchFilter
          attribute? :page, Types::Int.default(1)
          attribute? :limit, Types::Int.default(10)

          def without_pagination
            SearchFilter.new(
              description: description,
              from_at: from_at,
              tag_name: tag_name,
              title: title,
              to_at: to_at
            )
          end
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
mihari-5.6.2 lib/mihari/structs/filters.rb
mihari-5.6.1 lib/mihari/structs/filters.rb
mihari-5.6.0 lib/mihari/structs/filters.rb
mihari-5.5.0 lib/mihari/structs/filters.rb
mihari-5.4.9 lib/mihari/structs/filters.rb
mihari-5.4.8 lib/mihari/structs/filters.rb
mihari-5.4.7 lib/mihari/structs/filters.rb
mihari-5.4.6 lib/mihari/structs/filters.rb
mihari-5.4.5 lib/mihari/structs/filters.rb
mihari-5.4.4 lib/mihari/structs/filters.rb
mihari-5.4.3 lib/mihari/structs/filters.rb
mihari-5.4.2 lib/mihari/structs/filters.rb
mihari-5.4.1 lib/mihari/structs/filters.rb
mihari-5.4.0 lib/mihari/structs/filters.rb
mihari-5.3.2 lib/mihari/structs/filters.rb
mihari-5.3.1 lib/mihari/structs/filters.rb
mihari-5.3.0 lib/mihari/structs/filters.rb
mihari-5.2.4 lib/mihari/structs/filters.rb
mihari-5.2.3 lib/mihari/structs/filters.rb
mihari-5.2.2 lib/mihari/structs/filters.rb