https://github.com/johnnythetank/angular-wikipedia-api-factory
AngularJS Factory for Wikipedia JSONP REST API
https://github.com/johnnythetank/angular-wikipedia-api-factory
angular angular-factory angularjs api factory wikipedia wikipedia-api
Last synced: 7 months ago
JSON representation
AngularJS Factory for Wikipedia JSONP REST API
- Host: GitHub
- URL: https://github.com/johnnythetank/angular-wikipedia-api-factory
- Owner: JohnnyTheTank
- License: mit
- Created: 2016-06-17T09:46:02.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-12T21:26:52.000Z (about 8 years ago)
- Last Synced: 2024-11-11T11:45:39.487Z (7 months ago)
- Topics: angular, angular-factory, angularjs, api, factory, wikipedia, wikipedia-api
- Language: JavaScript
- Size: 18.6 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**angular-wikipedia-api-factory** is an angularjs module with a wikipedia api factory.
[](https://badge.fury.io/js/angular-wikipedia-api-factory)
[](https://badge.fury.io/bo/angular-wikipedia-api-factory)
Author: Jonathan Hornung ([JohnnyTheTank](https://github.com/JohnnyTheTank))## Usage
1. Install via either [bower](http://bower.io/), [npm](https://www.npmjs.com/) or downloaded files:
1. `bower install --save angular-wikipedia-api-factory`
2. `npm install --save angular-wikipedia-api-factory`
3. download [angular-wikipedia-api-factory.zip](https://github.com/JohnnyTheTank/angular-wikipedia-api-factory/zipball/master)
2. Include dependencies in your HTML.
1. When using bower:
```html
```
2. When using npm:
```html
```
3. when using downloaded files
```html
```
3. Add **`jtt_wikipedia`** to your application's module dependencies
```JavaScript
angular.module('app', ['jtt_wikipedia']);
```
4. Use the factory `wikipediaFactory````JavaScript
angular.module('app')
.controller('appController', function($scope, wikipediaFactory){
wikipediaFactory.getArticle({
term: 'Oktoberfest'
}).then(function (_data) {
//on success
});
});
```### factory methods
#### searchArticles
```js
wikipediaFactory.searchArticles({
term: '', // Searchterm
lang: '', // (optional) default: 'en'
gsrlimit: '', // (optional) default: 10. valid values: 0-500
pithumbsize: '', // (optional) default: 400
pilimit: '', // (optional) 'max': images for all articles, otherwise only for the first
exlimit: '', // (optional) 'max': extracts for all articles, otherwise only for the first
exintro: '', // (optional) '1': if we just want the intro, otherwise it shows all sections
}).then(function (_data) {
//on success
}).catch(function (_data) {
//on error
});
``````js
wikipediaFactory.searchArticlesByTitle({
term: '', // Searchterm
lang: '', // (optional) default: 'en'
gsrlimit: '', // (optional) default: 10. valid values: 0-500
pithumbsize: '', // (optional) default: 400
pilimit: '', // (optional) 'max': images for all articles, otherwise only for the first
exlimit: '', // (optional) 'max': extracts for all articles, otherwise only for the first
exintro: '', // (optional) '1': if we just want the intro, otherwise it shows all sections
}).then(function (_data) {
//on success
}).catch(function (_data) {
//on error
});
```#### getArticle
```js
wikipediaFactory.getArticle({
term: '', // Searchterm
lang: '', // (optional) default: 'en'
pithumbsize: '', // (optional) default: '400'
}).then(function (_data) {
//on success
}).catch(function (_data) {
//on error
});
```## Wikipedia JSONP API
* Documentation: https://www.mediawiki.org/wiki/API:Main_page/en
* API Sandbox: https://www.mediawiki.org/wiki/Special:ApiSandbox## More angular-api-factories
[bandsintown](https://github.com/JohnnyTheTank/angular-bandsintown-api-factory) - [dailymotion](https://github.com/JohnnyTheTank/angular-dailymotion-api-factory) - [facebook](https://github.com/JohnnyTheTank/angular-facebook-api-factory) - [flickr](https://github.com/JohnnyTheTank/angular-flickr-api-factory) - [footballdata](https://github.com/JohnnyTheTank/angular-footballdata-api-factory) - [github](https://github.com/JohnnyTheTank/angular-github-api-factory) - [openweathermap](https://github.com/JohnnyTheTank/angular-openweathermap-api-factory) - [tumblr](https://github.com/JohnnyTheTank/angular-tumblr-api-factory) - [vimeo](https://github.com/JohnnyTheTank/angular-vimeo-api-factory) - **wikipedia** - [youtube](https://github.com/JohnnyTheTank/angular-youtube-api-factory)## License
MIT