Module: MediaWiktory::Wikipedia::Modules::Allimages

Defined in:
lib/mediawiktory/wikipedia/modules/allimages.rb

Overview

Enumerate all images sequentially.

The "submodule" (MediaWiki API term) is included in action after setting some param, providing additional tweaking for this param. Example (for Actions::Query and its submodules):

api.query             # returns Actions::Query
   .prop(:revisions)  # adds prop=revisions to action URL, and includes Modules::Revisions into action
   .limit(10)         # method of Modules::Revisions, adds rvlimit=10 to URL

All submodule's parameters are documented as its public methods, see below.

Instance Method Summary collapse

Instance Method Details

#continue(value) ⇒ self

When more results are available, use this to continue.

Parameters:

  • value (String)

Returns:

  • (self)


67
68
69
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 67

def continue(value)
  merge(aicontinue: value.to_s)
end

#dir(value) ⇒ self

The direction in which to list.

Parameters:

  • value (String)

    One of "ascending", "descending", "newer", "older".

Returns:

  • (self)


38
39
40
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 38

def dir(value)
  _dir(value) or fail ArgumentError, "Unknown value for dir: #{value}"
end

#end(value) ⇒ self

The timestamp to end enumerating. Can only be used with aisort=timestamp.

Parameters:

  • value (Time)

Returns:

  • (self)


83
84
85
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 83

def end(value)
  merge(aiend: value.iso8601)
end

#filterbots(value) ⇒ self

How to filter files uploaded by bots. Can only be used with aisort=timestamp. Cannot be used together with aiuser.

Parameters:

  • value (String)

    One of "all", "bots", "nobots".

Returns:

  • (self)


152
153
154
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 152

def filterbots(value)
  _filterbots(value) or fail ArgumentError, "Unknown value for filterbots: #{value}"
end

#from(value) ⇒ self

The image title to start enumerating from. Can only be used with aisort=name.

Parameters:

  • value (String)

Returns:

  • (self)


51
52
53
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 51

def from(value)
  merge(aifrom: value.to_s)
end

#limit(value) ⇒ self

How many images in total to return.

Parameters:

  • value (Integer, "max")

Returns:

  • (self)


178
179
180
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 178

def limit(value)
  merge(ailimit: value.to_s)
end

#maxsize(value) ⇒ self

Limit to images with at most this many bytes.

Parameters:

  • value (Integer)

Returns:

  • (self)


120
121
122
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 120

def maxsize(value)
  merge(aimaxsize: value.to_s)
end

#mime(*values) ⇒ self

Disabled due to miser mode.

Parameters:

  • values (Array<String>)

Returns:

  • (self)


165
166
167
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 165

def mime(*values)
  values.inject(self) { |res, val| res._mime(val) }
end

#minsize(value) ⇒ self

Limit to images with at least this many bytes.

Parameters:

  • value (Integer)

Returns:

  • (self)


112
113
114
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 112

def minsize(value)
  merge(aiminsize: value.to_s)
end

#prefix(value) ⇒ self

Search for all image titles that begin with this value. Can only be used with aisort=name.

Parameters:

  • value (String)

Returns:

  • (self)


104
105
106
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 104

def prefix(value)
  merge(aiprefix: value.to_s)
end

#prop(*values) ⇒ self

Which file information to get:

Parameters:

  • values (Array<String>)

    Allowed values: "timestamp" (Adds timestamp for the uploaded version), "user" (Adds the user who uploaded each file version), "userid" (Add the ID of the user that uploaded each file version), "comment" (Comment on the version), "parsedcomment" (Parse the comment on the version), "canonicaltitle" (Adds the canonical title of the file), "url" (Gives URL to the file and the description page), "size" (Adds the size of the file in bytes and the height, width and page count (if applicable)), "dimensions" (Alias for size), "sha1" (Adds SHA-1 hash for the file), "mime" (Adds MIME type of the file), "mediatype" (Adds the media type of the file), "metadata" (Lists Exif metadata for the version of the file), "commonmetadata" (Lists file format generic metadata for the version of the file), "extmetadata" (Lists formatted metadata combined from multiple sources. Results are HTML formatted), "bitdepth" (Adds the bit depth of the version), "badfile" (Adds whether the file is on the MediaWiki:Bad image list).

Returns:

  • (self)


91
92
93
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 91

def prop(*values)
  values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" }
end

#sha1(value) ⇒ self

SHA1 hash of image. Overrides aisha1base36.

Parameters:

  • value (String)

Returns:

  • (self)


128
129
130
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 128

def sha1(value)
  merge(aisha1: value.to_s)
end

#sha1base36(value) ⇒ self

SHA1 hash of image in base 36 (used in MediaWiki).

Parameters:

  • value (String)

Returns:

  • (self)


136
137
138
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 136

def sha1base36(value)
  merge(aisha1base36: value.to_s)
end

#sort(value) ⇒ self

Property to sort by.

Parameters:

  • value (String)

    One of "name", "timestamp".

Returns:

  • (self)


25
26
27
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 25

def sort(value)
  _sort(value) or fail ArgumentError, "Unknown value for sort: #{value}"
end

#start(value) ⇒ self

The timestamp to start enumerating from. Can only be used with aisort=timestamp.

Parameters:

  • value (Time)

Returns:

  • (self)


75
76
77
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 75

def start(value)
  merge(aistart: value.iso8601)
end

#to(value) ⇒ self

The image title to stop enumerating at. Can only be used with aisort=name.

Parameters:

  • value (String)

Returns:

  • (self)


59
60
61
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 59

def to(value)
  merge(aito: value.to_s)
end

#user(value) ⇒ self

Only return files uploaded by this user. Can only be used with aisort=timestamp. Cannot be used together with aifilterbots.

Parameters:

  • value (String)

Returns:

  • (self)


144
145
146
# File 'lib/mediawiktory/wikipedia/modules/allimages.rb', line 144

def user(value)
  merge(aiuser: value.to_s)
end