/node-wikia

Wikia API Client written in node.js

Primary LanguageJavaScript

NPM version Build Status Dependency Status

Wikia API Client written in node.js

Install

$ npm install --save node-wikia

Usage

var Wikia = require('node-wikia');
var tibia = new Wikia('tibia');

/*
tibia
  .getNavigation()
    .then(function(data) {
      // do foo
    })
    .fail(function(err) {
      // do bar
    });
*/

API

Summary

Activity

Get information about the latest user activity on the current wiki

Articles

Get simplified article contents

Navigation

Get wiki navigation links (the main menu of given wiki)

  • getNavigation() - Get wiki navigation links (the main menu of given wiki)

Recommendations

Get recommendations for article from many sources

Related Pages

Get pages related to a given article ID

Search

Get results for combined (wiki and cross-wiki) search

Search Suggestion

Find suggested phrases for chosen query

User

Get details about selected users

=====

* required

Methods

getLatestActivity(options)

Options
Parameter Data Type
limit integer
namespaces array string
allowDuplicates boolean
Returns
{
  "items": [
    {
      "article": "integer",
      "user": "integer",
      "revisionId": "integer",
      "timestamp": "integer"
    }
  ],
  "basepath": "string"
}

getRecentlyChangedArticles(options)

Options
Parameter Data Type
limit integer
namespaces array string
allowDuplicates boolean
Returns
{
  "items": [
    {
      "article": "integer",
      "user": "integer",
      "revisionId": "integer",
      "timestamp": "integer"
    }
  ],
  "basepath": "string"
}

getArticleAsSimpleJson(id)

Arguments
Parameter Data Type
id* integer
Returns
{
  "sections": [
    {
      "title": "string",
      "level": "integer",
      "content": [
        {
          "type": "string",
          "text": "string",
          "elements": [
            {
              "text": "string",
              "elements": [
                "ListElement"
              ]
            }
          ]
        }
      ],
      "images": [
        {
          "src": "string",
          "caption": "string"
        }
      ]
    }
  ]
}

getArticleDetails(options)

Options
Parameter Data Type
ids* array integer
titles array string
abstract integer
width integer
height integer
Returns
{
  "items": [
    {
      "original_dimensions": {
        "width": "integer",
        "height": "integer"
      },
      "url": "string",
      "ns": "integer",
      "abstract": "string",
      "thumbnail": "string",
      "revision": {
        "id": "integer",
        "user": "string",
        "user_id": "integer",
        "timestamp": "integer"
      },
      "id": "integer",
      "title": "string",
      "type": "string",
      "comments": "integer"
    }
  ],
  "basepath": "string"
}

getArticlesList(options)

Options
Parameter Data Type
category array string
namespaces array string
limit integer
offset string
Returns
{
  "items": [
    {
      "id": "integer",
      "title": "string",
      "url": "string",
      "ns": "integer"
    }
  ],
  "offset": "string",
  "basepath": "string"
}

getArticlesListExpanded(options)

Options
Parameter Data Type
category array string
namespaces array string
limit integer
offset string
Returns
{
  "items": [
    {
      "original_dimensions": {
        "width": "integer",
        "height": "integer"
      },
      "url": "string",
      "ns": "integer",
      "abstract": "string",
      "thumbnail": "string",
      "revision": {
        "id": "integer",
        "user": "string",
        "user_id": "integer",
        "timestamp": "integer"
      },
      "id": "integer",
      "title": "string",
      "type": "string",
      "comments": "integer"
    }
  ],
  "offset": "string",
  "basepath": "string"
}

getArticlesMostLinked()

Returns
{
  "items": [
    {
      "url": "string",
      "ns": "integer",
      "id": "integer",
      "title": "string",
      "backlink_cnt": "integer"
    }
  ],
  "basepath": "string"
}

getArticlesMostLinkedExpanded()

Returns
{
  "items": [
    {
      "url": "string",
      "ns": "integer",
      "abstract": "string",
      "revision": {
        "id": "integer",
        "user": "string",
        "user_id": "integer",
        "timestamp": "integer"
      },
      "id": "integer",
      "title": "string",
      "type": "string",
      "backlink_cnt": "integer",
      "comments": "integer"
    }
  ],
  "basepath": "string"
}

getArticlesNewest(options)

Options
Parameter Data Type
namespaces array string
limit integer
minArticleQuality integer
Returns
{
  "quality": "integer",
  "original_dimensions": {
    "width": "integer",
    "height": "integer"
  },
  "url": "string",
  "ns": "integer",
  "abstract": "string",
  "creator": {
    "avatar": "string",
    "name": "string"
  },
  "thumbnail": "string",
  "creation_date": "string",
  "id": "integer",
  "title": "string"
}

getArticlesPopular(options)

Options
Parameter Data Type
limit integer
baseArticleId integer
Returns
{
  "items": [
    {
      "id": "integer",
      "title": "string",
      "url": "string"
    }
  ],
  "basepath": "string"
}

getArticlesPopularExpanded(options)

Options
Parameter Data Type
limit integer
baseArticleId integer
Returns
{
  "items": [
    {
      "original_dimensions": {
        "width": "integer",
        "height": "integer"
      },
      "url": "string",
      "ns": "integer",
      "abstract": "string",
      "thumbnail": "string",
      "revision": {
        "id": "integer",
        "user": "string",
        "user_id": "integer",
        "timestamp": "integer"
      },
      "id": "integer",
      "title": "string",
      "type": "string",
      "comments": "integer"
    }
  ],
  "basepath": "string"
}

getArticlesMostViewed(options)

Options
Parameter Data Type
namespaces array string
category array string
limit integer
baseArticleId integer
Returns
{
  "items": [
    {
      "id": "integer",
      "title": "string",
      "url": "string",
      "ns": "integer"
    }
  ],
  "basepath": "string"
}

getArticlesMostViewedExpanded(options)

Options
Parameter Data Type
namespaces array string
category array string
limit integer
baseArticleId integer
Returns
{
  "items": [
    {
      "original_dimensions": {
        "width": "integer",
        "height": "integer"
      },
      "url": "string",
      "ns": "integer",
      "abstract": "string",
      "thumbnail": "string",
      "revision": {
        "id": "integer",
        "user": "string",
        "user_id": "integer",
        "timestamp": "integer"
      },
      "id": "integer",
      "title": "string",
      "type": "string",
      "comments": "integer"
    }
  ],
  "basepath": "string"
}

getArticlesMostViewedByHub(options)

Options
Parameter Data Type
hub* array string
lang array string
namespaces array string
Returns
{
  "items": [
    {
      "wiki": {
        "id": "integer",
        "name": "string",
        "language": "string",
        "domain": "string"
      },
      "articles": [
        {
          "id": "integer",
          "ns": "integer"
        }
      ]
    }
  ]
}

getNavigation()

Returns
{
  "navigation": {
    "wikia": [
      {
        "text": "string",
        "href": "string",
        "children": [
          {
            "text": "string",
            "href": "string"
          }
        ]
      }
    ],
    "wiki": [
      "WikiaItem"
    ]
  }
}

getRecommendations(options)

Options
Parameter Data Type
id* integer
limit integer
Returns
{
  "items": [
    {
      "source": "string",
      "url": "string",
      "description": "string",
      "media": {
        "duration": "integer",
        "originalWidth": "integer",
        "thumbUrl": "string",
        "videoKey": "string",
        "originalHeight": "integer"
      },
      "title": "string",
      "type": "string"
    }
  ]
}

getRelatedPages(options)

Options
Parameter Data Type
ids* integer or array integer
limit integer
Returns
{
  "items": [
    {
      "url": "string",
      "text": "string",
      "imgUrl": "string",
      "id": "integer",
      "title": "string"
    }
  ],
  "basepath": "string"
}

getSearchCrossWiki(options)

Options
Parameter Data Type
query* string
hub array string
lang array string
rank array string
limit integer
batch integer
height integer
width integer
snippet integer
Returns
{
  "items": [
    {
      "headline": "string",
      "desc": "string",
      "stats": {
        "users": "integer",
        "articles": "integer",
        "pages": "integer",
        "admins": "integer",
        "activeUsers": "integer",
        "edits": "integer",
        "videos": "integer",
        "images": "integer"
      },
      "original_dimensions": {
        "width": "integer",
        "height": "integer"
      },
      "url": "string",
      "image": "string",
      "flags": [
        "string"
      ],
      "wam_score": "number",
      "id": "integer",
      "topUsers": [
        "string"
      ],
      "wordmark": "string",
      "title": "string",
      "lang": "string"
    }
  ]
}

getSearchList(options)

Options
Parameter Data Type
query* string
type string
rank array string
limit integer
minArticleQuality integer
batch integer
namespaces array integer
Returns
{
  "batches": "integer",
  "items": [
    {
      "quality": "integer",
      "url": "string",
      "ns": "integer",
      "id": "integer",
      "title": "string"
    }
  ],
  "total": "integer",
  "currentBatch": "integer",
  "next": "integer"
}

getSearchSuggestion(options)

Options
Parameter Data Type
query* string
Returns
{
  "items": [
    {
      "title": "string"
    }
  ]
}

getUsers(options)

Options
Parameter Data Type
ids* array integer
size integer
Returns
{
  "items": [
    {
      "name": "string",
      "avatar": "string",
      "url": "string",
      "user_id": "integer",
      "numberofedits": "integer",
      "title": "string"
    }
  ],
  "basepath": "string"
}

License

The MIT License (MIT)

Copyright (c) 2015 Gabriel Pedro

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.