Sha256: d57c8fdbed88da3412828438a2742ffb2b5e10e2f57315fa48a362d1fec46a44

Contents?: true

Size: 1.92 KB

Versions: 4

Compression:

Stored size: 1.92 KB

Contents

# frozen_string_literal: true

module MediaWiktory::Wikipedia
  module Actions
    # Mark notifications as seen for the current user.
    #
    # Usage:
    #
    # ```ruby
    # api.echomarkseen.token(value).perform # returns string with raw output
    # # or
    # api.echomarkseen.token(value).response # returns output parsed and wrapped into Response object
    # ```
    #
    # See {Base} for generic explanation of working with MediaWiki actions and
    # {MediaWiktory::Wikipedia::Response} for working with action responses.
    #
    # All action's parameters are documented as its public methods, see below.
    #
    class Echomarkseen < MediaWiktory::Wikipedia::Actions::Post

      # A "csrf" token retrieved from action=query&meta=tokens
      #
      # @param value [String]
      # @return [self]
      def token(value)
        merge(token: value.to_s)
      end

      # Type of notifications to mark as seen: 'alert', 'message' or 'all'.
      #
      # @param value [String] One of "alert", "message", "all".
      # @return [self]
      def type(value)
        _type(value) or fail ArgumentError, "Unknown value for type: #{value}"
      end

      # @private
      def _type(value)
        defined?(super) && super || ["alert", "message", "all"].include?(value.to_s) && merge(type: value.to_s)
      end

      # Timestamp format to use for output, 'ISO_8601' or 'MW'.  'MW' is deprecated here, so all clients should switch to 'ISO_8601'.  This parameter will be removed, and 'ISO_8601' will become the only output format.
      #
      # @param value [String] One of "ISO_8601", "MW".
      # @return [self]
      def timestampFormat(value)
        _timestampFormat(value) or fail ArgumentError, "Unknown value for timestampFormat: #{value}"
      end

      # @private
      def _timestampFormat(value)
        defined?(super) && super || ["ISO_8601", "MW"].include?(value.to_s) && merge(timestampFormat: value.to_s)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mediawiktory-0.1.3 lib/mediawiktory/wikipedia/actions/echomarkseen.rb
mediawiktory-0.1.2 lib/mediawiktory/wikipedia/actions/echomarkseen.rb
mediawiktory-0.1.1 lib/mediawiktory/wikipedia/actions/echomarkseen.rb
mediawiktory-0.1.0 lib/mediawiktory/wikipedia/actions/echomarkseen.rb