mwstake/mediawiki-component-commonwebapis
Composer 安装命令:
composer require mwstake/mediawiki-component-commonwebapis
包简介
Provides various web APIs (Action API and REST)
README 文档
README
Common Web APIs for MediaWiki
Provides various web APIs (Action API and REST).
This code is meant to be executed within the MediaWiki application context. No standalone usage is intended.
Compatibility
3.0.x-> MediaWiki 1.432.0.x-> MediaWiki 1.391.0.x-> MediaWiki 1.35
Prerequisites
Use in a MediaWiki extension
Require this component in the composer.json of your extension:
{
"require": {
"mwstake/mediawiki-component-commonwebapis": "~3"
}
}
Getting the available endpoints
$endpoints = MediaWikiServices::getInstance()->getService( 'MWStakeCommonWebAPIs' )->getAvailableEndpoints();
will yield a list of all registered endpoints as well as their REST path configuration
Clientside abstraction
To make it easier to access these endpoints from JS, an abstraction is implemented.
To enable it, load RL module ext.mws.commonwebapis and use it like this:
mw.loader.using( 'ext.mws.commonwebapis' ).then( function () { mws.commonwebapi.user.query( { query: 'MyUser' } ); } );
REST API
Filtering
In order to specify filters, you can use the filter parameter. It is an JSON-encoded array of objects. Each object has the following properties:
property- The field to filter onvalue- The value to filter onoperator- The operator to use for the filter. Possible values areeq(equals),neq(not equals),lt(less than),lte(less than or equal),gt(greater than),gte(greater than or equal),like(like),nlike(not like),in(in),nin(not in),isnull(is null),isnotnull(is not null),between(between),nbetween(not between),ilike(case insensitive like),nilike(case insensitive not like),regexp(regular expression),nregexp(not regular expression). Depending on the type of the filter, some operators might not be available.type- The type of the value. Possible values arestring,integer,float,boolean,list
Sorting
In order to specify sorting, you can use the sort parameter. It is an JSON-encoded array of objects. Each object has the following properties:
property- The field to sort ondirection- The direction to sort. Possible values areasc(ascending) anddesc(descending)
Example
mw.loader.using( 'ext.mws.commonwebapis' ).then( function () { mws.commonwebapi.user.query( { filter: JSON.stringify( [ { field: 'user_name', value: 'MyUser', operator: 'eq', type: 'string' } ] ), sort: JSON.stringify( [ { field: 'user_name', direction: 'asc' } ] ) } ); } );
mwstake/mediawiki-component-commonwebapis 适用场景与选型建议
mwstake/mediawiki-component-commonwebapis 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 36.4k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 04 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mwstake/mediawiki-component-commonwebapis 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mwstake/mediawiki-component-commonwebapis 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 36.4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-only
- 更新时间: 2021-04-09