Global

Members

CeL :function

Source:
See:
CeJS controller
Type:
  • function

(constant) KEY_SESSION :Symbol

Source:
key to get wiki_API operator when using wiki_API.
Type:
  • Symbol

(constant) KEY_wiki_session :Symbol

Source:
key to get wiki_API operator inside Wikiapi. this[KEY_wiki_session] inside module code will get wiki_API operator.
Type:
  • Symbol

(constant) page_data_attributes :Object

Source:
attributes of {Object} page_data, will setup by set_page_data_attributes.
Type:
  • Object

(constant) wiki_API

Source:
syntactic sugar for CeJS MediaWiki module. CeL.net.wiki === CeL.wiki

Methods

modify_data_entity(data_entity, optionsopt) → {Promise}

Source:
Modify data entity
Parameters:
Name Type Attributes Description
data_entity Object wiki_API data entity
options Object <optional>
options to run this function
Returns:
Promise object represents {Object} result data entity
Type
Promise

reject_edit_error(reject, error, resultopt) → {Boolean}

Source:
Handle the result of MediaWiki API when executing edit operation.
Parameters:
Name Type Attributes Description
reject function reject function
error any error object / message
result any <optional>
result of MediaWiki API
Returns:
Return true if the edit operation failed.
Type
Boolean

set_page_data_attributes(page_data, wiki) → {Promise}

Source:
Bind page_data_attributes to page_data
Parameters:
Name Type Description
page_data Object page data
wiki wiki_API wiki_API session
Returns:
Promise object represents {Object} page's data
Type
Promise

setup_data_entity(data_entity)

Source:
Bind properties to wiki_API data entity. 設定 wikidata entity object,讓我們能直接操作 entity.modify(),並且避免洩露 wiki_API session。
Parameters:
Name Type Description
data_entity Object wiki_API data entity

setup_wiki_session(wiki_session)

Source:
Bind wiki_API instance to Wikiapi instance
Parameters:
Name Type Description
wiki_session wiki_API wiki_API session

Wikiapi_list()

Source:
Examples

get list of [[w:en:Category:Chemical_elements]]

// <code>
const wiki = new Wikiapi;
let list = await wiki.categorymembers('Chemical elements');
console.log(list);
// Working on multiple pages
await wiki.for_each_page(
	// {Array} title liat / page data list
	list,
	page_data => {
		// ...
	});
// </code>

get pages transcluding {{w:en:Periodic table}}

// <code>
const wiki = new Wikiapi;
let list = await wiki.embeddedin('Template:Periodic table');
console.log(list);
// </code>