Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc5fb3e6

Browse files
zaycodesbrendajerop
authored andcommitted
Added Sample codes for API:Main_module
1 parent0c92aa5 commitc5fb3e6

File tree

9 files changed

+124
-7
lines changed

9 files changed

+124
-7
lines changed

‎javascript/README.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Code snippets in Javascript demonstrating how to use various modules of the [Med
1919
*[validatepassword.js](validatepassword.js): validate a password against the wiki's password policies
2020
*[API:Resetpassword](https://www.mediawiki.org/wiki/API:Resetpassword)
2121
*[reset_password.js](reset_password.js): Reset password for all users with an email address.
22+
*[API:Feedcontributions](https://www.mediawiki.org/wiki/API:Feedcontributions)
23+
*[get_user_contributions_feed.js](get_user_contributions_feed.js): Show contributions of a user as an RSS feed.
2224

2325
###Page Operations
2426
*[API:Parse](https://www.mediawiki.org/wiki/API:Parse)
@@ -111,8 +113,6 @@ Code snippets in Javascript demonstrating how to use various modules of the [Med
111113
*[get_feed_recent_changes.js](get_feed_recent_changes.js): Show recent changes as an RSS feed.
112114
*[API:Setnotificationtimestamp](https://www.mediawiki.org/wiki/API:Setnotificationtimestamp)
113115
*[set_notification_timestamp.js](set_notification_timestamp.js): Reset the notification status for the entire watchlist.
114-
*[API:Feedcontributions](https://www.mediawiki.org/wiki/API:Feedcontributions)
115-
*[get_user_contributions_feed.js](get_user_contributions_feed.js): Show contributions of a user as an RSS feed.
116116

117117
###Search
118118
*[API:Search](https://www.mediawiki.org/wiki/API:Search)
@@ -131,4 +131,5 @@ Code snippets in Javascript demonstrating how to use various modules of the [Med
131131
###Basics
132132
*[API:Parameter information](https://www.mediawiki.org/wiki/API:Parameter_information)
133133
*[paraminfo.js](paraminfo.js): get information about another action API module and its parameters
134-
134+
*[API:Main_module](https://www.mediawiki.org/wiki/API:Main_module)
135+
*[main_module.js](main_module.js): Get help for the main module.

‎javascript/main_module.js‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//This file is autogenerated. See modules.json and autogenerator.py for details
2+
3+
/*
4+
main_module.js
5+
6+
MediaWiki API Demos
7+
Demo of `Main module` module: Get help for the main module.
8+
9+
MIT License
10+
*/
11+
12+
varurl="https://en.wikipedia.org/w/api.php";
13+
14+
varparams={
15+
action:"help",
16+
format:"json"
17+
};
18+
19+
url=url+"?origin=*";
20+
Object.keys(params).forEach(function(key){url+="&"+key+"="+params[key];});
21+
22+
fetch(url)
23+
.then(function(response){returnresponse.json();})
24+
.then(function(response){console.log(response);})
25+
.catch(function(error){console.log(error);});

‎mediawikijs/README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ These code snippets are usefull to create Userscripts and Gadgets.
3535
*[validatepassword.js](validatepassword.js): validate a password against the wiki's password policies
3636
*[API:Resetpassword](https://www.mediawiki.org/wiki/API:Resetpassword)
3737
*[reset_password.py](reset_password.py): Reset password for all users with an email address.
38+
*[API:Feedcontributions](https://www.mediawiki.org/wiki/API:Feedcontributions)
39+
*[get_user_contributions_feed.js](get_user_contributions_feed.js): Show contributions of a user as an RSS feed.
3840

3941
###Page Operations
4042
*[API:Parse](https://www.mediawiki.org/wiki/API:Parse)
@@ -175,8 +177,6 @@ These code snippets are usefull to create Userscripts and Gadgets.
175177
*[get_feed_recent_changes.js](get_feed_recent_changes.js): Show recent changes as an RSS feed.
176178
*[API:Setnotificationtimestamp](https://www.mediawiki.org/wiki/API:Setnotificationtimestamp)
177179
*[set_notification_timestamp.js](set_notification_timestamp.js): Reset the notification status for the entire watchlist.
178-
*[API:Feedcontributions](https://www.mediawiki.org/wiki/API:Feedcontributions)
179-
*[get_user_contributions_feed.js](get_user_contributions_feed.js): Show contributions of a user as an RSS feed.
180180

181181
###Search
182182
*[API:Search](https://www.mediawiki.org/wiki/API:Search)
@@ -197,4 +197,6 @@ These code snippets are usefull to create Userscripts and Gadgets.
197197
###Basics
198198
*[API:Parameter information](https://www.mediawiki.org/wiki/API:Parameter_information)
199199
*[paraminfo.js](paraminfo.js): get information about another action API module and its parameters
200+
*[API:Main_module](https://www.mediawiki.org/wiki/API:Main_module)
201+
*[main_module.js](main_module.js): Get help for the main module.
200202

‎mediawikijs/main_module.js‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// This file is autogenerated. See modules.json and autogenerator.py for details
2+
3+
/*
4+
main_module.js
5+
6+
MediaWiki API Demos
7+
Demo of `Main module` module: Get help for the main module.
8+
9+
MIT License
10+
*/
11+
12+
varparams={
13+
action:'help',
14+
format:'json'
15+
},
16+
api=newmw.Api();
17+
18+
api.get(params).done(function(data){
19+
console.log(data);
20+
});

‎modules.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,5 +742,14 @@
742742
"user":"Jimbo Wales",
743743
"format":"json"
744744
}
745+
},
746+
{
747+
"filename":"main_module",
748+
"docstring":"Demo of `Main module` module: Get help for the main module.",
749+
"endpoint":"https://en.wikipedia.org/w/api.php",
750+
"params": {
751+
"action":"help",
752+
"format":"json"
753+
}
745754
}
746755
]

‎php/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,5 @@ Code snippets in PHP demonstrating how to use various modules of the [MediaWiki
199199
###Basics
200200
*[API:Parameter information](https://www.mediawiki.org/wiki/API:Parameter_information)
201201
*[paraminfo.php](paraminfo.php): get information about another action API module and its parameters
202+
*[API:Main_module](https://www.mediawiki.org/wiki/API:Main_module)
203+
*[main_module.php](main_module.php): Get help for the main module.

‎php/main_module.php‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
//This file is autogenerated. See modules.json and autogenerator.py for details
4+
5+
/*
6+
main_module.php
7+
8+
MediaWiki API Demos
9+
Demo of `Main module` module: Get help for the main module.
10+
11+
MIT License
12+
*/
13+
14+
$endPoint ="https://en.wikipedia.org/w/api.php";
15+
$params = [
16+
"action" =>"help",
17+
"format" =>"json"
18+
];
19+
20+
$url =$endPoint ."?" .http_build_query($params );
21+
22+
$ch =curl_init($url );
23+
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true );
24+
$output =curl_exec($ch );
25+
curl_close($ch );
26+
27+
$result =json_decode($output,true );
28+
var_dump($result );

‎python/README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Code snippets in Python demonstrating how to use various modules of the [MediaWi
3939
*[validatepassword.py](validatepassword.py): validate a password against the wiki's password policies
4040
*[API:Resetpassword](https://www.mediawiki.org/wiki/API:Resetpassword)
4141
*[reset_password.py](reset_password.py): Reset password for all users with an email address.
42+
*[API:Feedcontributions](https://www.mediawiki.org/wiki/API:Feedcontributions)
43+
*[get_user_contributions_feed.py](get_user_contributions_feed.py): Show contributions of a user as an RSS feed.
4244

4345
###Page Operations
4446
*[API:Parse](https://www.mediawiki.org/wiki/API:Parse)
@@ -185,8 +187,6 @@ Code snippets in Python demonstrating how to use various modules of the [MediaWi
185187
*[get_feed_recent_changes.py](get_feed_recent_changes.py): Show recent changes as an RSS feed.
186188
*[API:Setnotificationtimestamp](https://www.mediawiki.org/wiki/API:Setnotificationtimestamp)
187189
*[set_notification_timestamp.py](set_notification_timestamp.py): Reset the notification status for the entire watchlist.
188-
*[API:Feedcontributions](https://www.mediawiki.org/wiki/API:Feedcontributions)
189-
*[get_user_contributions_feed.py](get_user_contributions_feed.py): Show contributions of a user as an RSS feed.
190190

191191
###Search
192192
*[API:Search](https://www.mediawiki.org/wiki/API:Search)
@@ -205,3 +205,5 @@ Code snippets in Python demonstrating how to use various modules of the [MediaWi
205205
###Basics
206206
*[API:Parameter information](https://www.mediawiki.org/wiki/API:Parameter_information)
207207
*[paraminfo.py](paraminfo.py): get information about another action API module and its parameters
208+
*[API:Main_module](https://www.mediawiki.org/wiki/API:Main_module)
209+
*[main_module.py](main_module.py): Get help for the main module.

‎python/main_module.py‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#This file is auto-generated. See modules.json and autogenerator.py for details
2+
3+
#!/usr/bin/python3
4+
5+
"""
6+
main_module.py
7+
8+
MediaWiki API Demos
9+
Demo of `Main module` module: Get help for the main module.
10+
11+
MIT License
12+
"""
13+
14+
importrequests
15+
16+
S=requests.Session()
17+
18+
URL="https://en.wikipedia.org/w/api.php"
19+
20+
PARAMS= {
21+
"action":"help",
22+
"format":"json"
23+
}
24+
25+
R=S.get(url=URL,params=PARAMS)
26+
DATA=R.json()
27+
28+
print(DATA)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp