# Global

##

### Members

#### CeL :function

Source:
  - wikiapi.js, line 17
See:
  - https://github.com/kanasimi/CeJS

CeJS controller

##### Type:

- function

#### (constant) KEY_SESSION :Symbol

Source:
  - wikiapi.js, line 61

key to get wiki_API operator when using wiki_API.

##### Type:

- Symbol

#### (constant) KEY_wiki_session :Symbol

Source:
  - wikiapi.js, line 74

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:
  - wikiapi.js, line 178

attributes of {Object} page_data, will setup by set_page_data_attributes.

##### Type:

- Object

#### (constant) wiki_API

Source:
  - wikiapi.js, line 53

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

### Methods

#### modify_data_entity(data_entity, optionsopt) → {Promise}

Source:
  - wikiapi.js, line 731

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:
  - wikiapi.js, line 370

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:
  - wikiapi.js, line 231

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:
  - wikiapi.js, line 710

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:
  - wikiapi.js, line 101

Bind wiki_API instance to Wikiapi instance

##### Parameters:

Name | Type | Description
--- | --- | ---
`wiki_session` | wiki_API | wiki_API session

#### Wikiapi_list()

Source:
  - wikiapi.js, line 853

##### 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>