public class Mediawiki extends MediaWikiApiImpl implements MediawikiApi
LOGGER, protectionMarker, throwExceptionOnError
Constructor and Description |
---|
Mediawiki() |
Modifier and Type | Method and Description |
---|---|
Delete |
delete(String title,
String reason)
delete the given page for the given reason
|
Edit |
edit(String pageTitle,
String text,
String summary)
Edits a page by setting its text to the supplied value.
|
Edit |
edit(String pageTitle,
String text,
String summary,
boolean minor,
boolean bot,
int sectionNumber,
String sectionTitle,
Calendar basetime)
edit
|
List<Img> |
getAllImagesByTimeStamp(String aistart,
String aiend,
int ailimit)
get all Images by the given time stamps
|
List<P> |
getAllPages(String apfrom,
int aplimit)
getAllPages
|
List<Bl> |
getBacklinks(String pageTitle,
String params,
int limit)
get the backlinks for the given pagetitle
|
General |
getGeneral()
get the siteinfo
|
Ii |
getImageInfo(String pageTitle)
get the Image Info for the given pageTitle
|
List<Ii> |
getImageInfosForPage(String pageTitle,
int limit)
get the imageInfos for all images on the given page Title
|
List<Im> |
getImagesOnPage(String pageTitle,
int imLimit)
get the Images on the given page
|
List<Iu> |
getImageUsage(String imageTitle,
String params,
int limit)
get the imageusage for the given imageTitle
|
String |
getIsoTimeStamp()
get an ISO time stamp (utility function) FIXME may have to move out of the
main API
|
String |
getPageContent(String pageTitle)
get the page Content for the given page Title
|
String |
getPageHtml(String pageTitle)
get the html rendered version of a page
|
String |
getScriptPath()
get the script Path
|
List<S> |
getSections(String pageTitle)
get the sections for the given pageTitle
|
String |
getSectionText(String pageTitle,
int sectionNumber)
get the content of the given section
|
SiteInfo |
getSiteInfo()
get the general siteinfo
|
String |
getSiteurl() |
String |
getVersion()
get the Version of this wiki
|
void |
init(String siteurl,
String scriptPath)
overrideable method to do pre setup stuff
|
boolean |
isDebug()
get the state of the debug mode
|
boolean |
isLoggedIn()
check whether there is a User logged In
|
Login |
login(String username,
String password)
login the given user with the given password
See API:Login
|
void |
logout()
Log the current user out See API:Logout
|
void |
setDebug(boolean pDebug)
set the debug mode
|
void |
setScriptPath(String scriptPath)
set the scriptPath of this Wiki
|
void |
setSiteurl(String siteurl)
set the siteurl
|
void |
upload(File file,
String filename,
String contents,
String reason)
Uploads an image.
|
void |
upload(Ii ii,
String fileName,
String pageContent)
upload the image described in the given imageinfo
|
copyToWiki, decode, encode, fromXML, getProtectionMarker, handleError, handleError, handleError, isThrowExceptionOnError, normalizeTitle, setProtectionMarker, setThrowExceptionOnError, setVersion
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
copyToWiki, isThrowExceptionOnError, normalizeTitle, setProtectionMarker, setThrowExceptionOnError
public String getSiteurl()
getSiteurl
in interface MediawikiApi
public void setSiteurl(String siteurl) throws Exception
MediawikiApi
setSiteurl
in interface MediawikiApi
Exception
- - if the url is not o.k.public String getScriptPath()
MediawikiApi
getScriptPath
in interface MediawikiApi
public void setScriptPath(String scriptPath)
MediawikiApi
setScriptPath
in interface MediawikiApi
scriptPath
- the scriptPath to setpublic void init(String siteurl, String scriptPath) throws Exception
MediawikiApi
init
in interface MediawikiApi
siteurl
- - the url to usescriptPath
- - the script path to useException
public String getVersion() throws Exception
MediaWikiApiImpl
getVersion
in interface MediawikiApi
getVersion
in class MediaWikiApiImpl
Exception
public Login login(String username, String password) throws Exception
MediawikiApi
login
in interface MediawikiApi
Exception
public boolean isLoggedIn()
MediawikiApi
isLoggedIn
in interface MediawikiApi
public String getPageContent(String pageTitle) throws Exception
MediawikiApi
getPageContent
in interface MediawikiApi
Exception
public String getPageHtml(String pageTitle) throws Exception
MediawikiApi
getPageHtml
in interface MediawikiApi
Exception
public String getSectionText(String pageTitle, int sectionNumber) throws Exception
MediawikiApi
getSectionText
in interface MediawikiApi
Exception
public void logout() throws Exception
MediawikiApi
logout
in interface MediawikiApi
Exception
public Edit edit(String pageTitle, String text, String summary) throws Exception
MediawikiApi
edit
in interface MediawikiApi
pageTitle
- the title of the pagetext
- the text of the pagesummary
- the edit summary. Summaries longer than 200 characters are
truncated server-side.Exception
- - if the edit failsMediawikiApi.getPageContent(java.lang.String)
public Edit edit(String pageTitle, String text, String summary, boolean minor, boolean bot, int sectionNumber, String sectionTitle, Calendar basetime) throws Exception
MediawikiApi
edit
in interface MediawikiApi
minor
- - true if this is a minor editbot
- whether to mark the edit as a bot edit (ignored if one does not
have the necessary permissions)sectionNumber
- the section to edit. Use -1 to specify a new section and -2 to
disable section editing.sectionTitle
- the title of a new sectionbasetime
- the timestamp of the revision on which text is based,
used to check for edit conflicts. null disables this.Exception
MediawikiApi.getPageContent(java.lang.String)
public String getIsoTimeStamp()
MediawikiApi
getIsoTimeStamp
in interface MediawikiApi
public void setDebug(boolean pDebug)
MediawikiApi
setDebug
in interface MediawikiApi
public boolean isDebug()
MediawikiApi
isDebug
in interface MediawikiApi
public void upload(File file, String filename, String contents, String reason) throws Exception
MediawikiApi
upload
in interface MediawikiApi
file
- the image filefilename
- the target file name (may contain File)contents
- the contents of the image description page, set to "" if
overwriting an existing filereason
- an upload summary (defaults to contents, use "" to not
specify one)Exception
- - if the upload failspublic List<P> getAllPages(String apfrom, int aplimit) throws Exception
MediawikiApi
getAllPages
in interface MediawikiApi
apfrom
- - may be null or emptyException
public List<S> getSections(String pageTitle) throws Exception
MediawikiApi
getSections
in interface MediawikiApi
Exception
public Ii getImageInfo(String pageTitle) throws Exception
MediawikiApi
getImageInfo
in interface MediawikiApi
pageTitle
- - the pageTitle to get the ImageInfo forException
public void upload(Ii ii, String fileName, String pageContent) throws Exception
MediawikiApi
upload
in interface MediawikiApi
pageContent
- the contents of the image description page, set to "" if
overwriting an existing fileException
public SiteInfo getSiteInfo() throws Exception
MediawikiApi
getSiteInfo
in interface MediawikiApi
getSiteInfo
in class MediaWikiApiImpl
Exception
public Delete delete(String title, String reason) throws Exception
MediawikiApi
delete
in interface MediawikiApi
Exception
public List<Img> getAllImagesByTimeStamp(String aistart, String aiend, int ailimit)
MediawikiApi
getAllImagesByTimeStamp
in interface MediawikiApi
aistart
- - start time stampaiend
- - end time stampailimit
- - how many images to getpublic List<Bl> getBacklinks(String pageTitle, String params, int limit) throws Exception
MediawikiApi
getBacklinks
in interface MediawikiApi
params
- - extra paramsException
public List<Iu> getImageUsage(String imageTitle, String params, int limit) throws Exception
MediawikiApi
getImageUsage
in interface MediawikiApi
params
- - extra paramsException
public List<Im> getImagesOnPage(String pageTitle, int imLimit) throws Exception
MediawikiApi
getImagesOnPage
in interface MediawikiApi
Exception
public List<Ii> getImageInfosForPage(String pageTitle, int limit) throws Exception
MediawikiApi
getImageInfosForPage
in interface MediawikiApi
Exception
Copyright © 2018 BITPlan GmbH. All rights reserved.