mediawiki

package module
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2023 License: CC0-1.0 Imports: 15 Imported by: 1

README

Mediawiki

A Go SDK for MediaWiki.

I made this mostly for personal use, so it has some... quirks. Eventually I'll productionize this, but that time isn't now.

Documentation

Overview

Package params is a MediaWiki specific replacement for parts of net/url. Specifically, it contains a fork of url.Values (params.Values) that is based on map[string]string instead of map[string][]string. The purpose of this is that the MediaWiki API does not use multiple keys to allow multiple values for a key (e.g., "a=b&a=c"). Instead it uses one key with values separated by a pipe (e.g. "a=b|c").

Index

Constants

View Source
const (
	SiteinfoPropGeneral            = "general"
	SiteinfoPropNamespaces         = "namespaces"
	SiteinfoPropNamespacealiases   = "namespacealiases"
	SiteinfoPropSpecialpagealiases = "specialpagealiases"
	SiteinfoPropMagicwords         = "magicwords"
	SiteinfoPropInterwikimap       = "interwikimap"
	SiteinfoPropDbrepllag          = "dbrepllag"
	SiteinfoPropStatistics         = "statistics"
	SiteinfoPropUsergroups         = "usergroups"
	SiteinfoPropLibraries          = "libraries"
	SiteinfoPropExtensions         = "extensions"
	SiteinfoPropFileextensions     = "fileextensions"
	SiteinfoPropRightsinfo         = "rightsinfo"
	SiteinfoPropRestrictions       = "restrictions"
	SiteinfoPropLanguages          = "languages"
	SiteinfoPropLanguagevariants   = "languagevariants"
	SiteinfoPropSkins              = "skins"
	SiteinfoPropExtensiontags      = "extensiontags"
	SiteinfoPropFunctionhooks      = "functionhooks"
	SiteinfoPropShowhooks          = "showhooks"
	SiteinfoPropVariables          = "variables"
	SiteinfoPropProtocols          = "protocols"
	SiteinfoPropDefaultoptions     = "defaultoptions"
	SiteinfoPropUploaddialog       = "uploaddialog"
)
View Source
const DefaultUserAgent = "go-mediawiki (https://github.com/clockworksoul/mediawiki)"

DefaultUserAgent is the HTTP User-Agent used by default.

Variables

This section is empty.

Functions

func ParseResponse

func ParseResponse(b []byte, v any) error

func ParseResponseReader

func ParseResponseReader(in io.Reader, v any) error

Types

type AllUsersDir added in v0.0.2

type AllUsersDir string
const (
	AllusersAscending  AllUsersDir = "ascending"
	AllusersDescending AllUsersDir = "descending"
)

type AllpagesClient added in v0.0.2

type AllpagesClient struct {
	// contains filtered or unexported fields
}

func (*AllpagesClient) Continue added in v0.0.2

func (w *AllpagesClient) Continue(s string) *AllpagesClient

continue When more results are available, use this to continue.

func (*AllpagesClient) Dir added in v0.0.2

dir The direction in which to list. One of the following values: ascending, descending Default: ascending

func (*AllpagesClient) Do added in v0.0.2

func (w *AllpagesClient) Filterlanglinks(s string) *AllpagesClient

filterlanglinks Filter based on whether a page has langlinks. Note that this may not consider langlinks added by extensions. One of the following values: all, withlanglinks, withoutlanglinks Default: all

func (*AllpagesClient) Filterredir added in v0.0.2

func (w *AllpagesClient) Filterredir(s string) *AllpagesClient

filterredir Which pages to list. Note: Due to miser mode, using this may result in fewer than aplimit results returned before continuing; in extreme cases, zero results may be returned. One of the following values: all, nonredirects, redirects Default: all

func (*AllpagesClient) From added in v0.0.2

func (w *AllpagesClient) From(s string) *AllpagesClient

from The page title to start enumerating from.

func (*AllpagesClient) Limit added in v0.0.2

func (w *AllpagesClient) Limit(i int) *AllpagesClient

limit How many total pages to return. The value must be between 1 and 500. A value <= 0 indicates a value of "max" Default: 10

func (*AllpagesClient) Maxsize added in v0.0.2

func (w *AllpagesClient) Maxsize(i int) *AllpagesClient

maxsize Limit to pages with at most this many bytes.

func (*AllpagesClient) Minsize added in v0.0.2

func (w *AllpagesClient) Minsize(i int) *AllpagesClient

minsize Limit to pages with at least this many bytes.

func (*AllpagesClient) Namespace added in v0.0.2

func (w *AllpagesClient) Namespace(i Namespace) *AllpagesClient

namespace The namespace to enumerate. One of the following values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 486, 487, 710, 711, 828, 829, 1198, 1199, 2300, 2301, 2302, 2303, 2600, 5500, 5501 Default: 0

func (*AllpagesClient) Prefix added in v0.0.2

func (w *AllpagesClient) Prefix(s string) *AllpagesClient

prefix Search for all page titles that begin with this value.

func (*AllpagesClient) Prexpiry added in v0.0.2

func (w *AllpagesClient) Prexpiry(s string) *AllpagesClient

prexpiry Which protection expiry to filter the page on: indefinite - Get only pages with indefinite protection expiry. definite - Get only pages with a definite (specific) protection expiry. all - Get pages with any protections expiry. One of the following values: all, definite, indefinite Default: all

func (*AllpagesClient) Prfiltercascade added in v0.0.2

func (w *AllpagesClient) Prfiltercascade(s string) *AllpagesClient

prfiltercascade Filter protections based on cascadingness (ignored when apprtype isn't set). One of the following values: all, cascading, noncascading Default: all

func (*AllpagesClient) Prlevel added in v0.0.2

func (w *AllpagesClient) Prlevel(s ...string) *AllpagesClient

prlevel Filter protections based on protection level (must be used with apprtype= parameter). Values (separate with | or alternative): Can be empty, or autoconfirmed, sysop

func (*AllpagesClient) Prtype added in v0.0.2

func (w *AllpagesClient) Prtype(s ...string) *AllpagesClient

prtype Limit to protected pages only. Values (separate with | or alternative): edit, move, upload

func (*AllpagesClient) To added in v0.0.2

to The page title to stop enumerating at.

type AllpagesOption added in v0.0.2

type AllpagesOption func(map[string]string)

Allpages

type AllpagesResponse added in v0.0.2

type AllpagesResponse struct {
	QueryResponse
	BatchComplete string                    `json:"batchcomplete"`
	Continue      *AllpagesResponseContinue `json:"continue,omitempty"`
	Query         *AllpagesResponseQuery    `json:"query,omitempty"`
}

type AllpagesResponseContinue added in v0.0.2

type AllpagesResponseContinue struct {
	GapContinue string `json:"gapcontinue"`
	Continue    string `json:"continue"`
}

type AllpagesResponseQuery added in v0.0.2

type AllpagesResponseQuery struct {
	Pages map[string]QueryResponseQueryPage `json:"pages"`
}

type AllrevisionsClient added in v0.0.2

type AllrevisionsClient struct {
	// contains filtered or unexported fields
}

func (*AllrevisionsClient) Contentformat added in v0.0.2

func (w *AllrevisionsClient) Contentformat(s string) *AllrevisionsClient

contentformat Serialization format used for arvdifftotext and expected for output of content. One of the following values: application/json, application/octet-stream, application/unknown, application/x-binary, text/css, text/javascript, text/plain, text/unknown, text/x-wiki, unknown/unknown

func (*AllrevisionsClient) Continue added in v0.0.2

continue When more results are available, use this to continue.

func (*AllrevisionsClient) Diffto added in v0.0.2

diffto Use action=compare instead. Revision ID to diff each revision to. Use prev, next and cur for the previous, next and current revision respectively.

func (*AllrevisionsClient) Difftotext added in v0.0.2

func (w *AllrevisionsClient) Difftotext(s string) *AllrevisionsClient

difftotext Use action=compare instead. Text to diff each revision to. Only diffs a limited number of revisions. Overrides arvdiffto. If arvsection is set, only that section will be diffed against this text.

func (*AllrevisionsClient) Difftotextpst added in v0.0.2

func (w *AllrevisionsClient) Difftotextpst(b bool) *AllrevisionsClient

difftotextpst Use action=compare instead. Perform a pre-save transform on the text before diffing it. Only valid when used with arvdifftotext.

func (*AllrevisionsClient) Dir added in v0.0.2

dir

func (*AllrevisionsClient) Do added in v0.0.2

func (*AllrevisionsClient) End added in v0.0.2

end The timestamp to stop enumerating at.

func (*AllrevisionsClient) Excludeuser added in v0.0.2

func (w *AllrevisionsClient) Excludeuser(s string) *AllrevisionsClient

excludeuser Don't list revisions by this user.

func (*AllrevisionsClient) Expandtemplates added in v0.0.2

func (w *AllrevisionsClient) Expandtemplates(b bool) *AllrevisionsClient

expandtemplates Use action=expandtemplates instead. Expand templates in revision content (requires arvprop=content).

func (*AllrevisionsClient) Generatetitles added in v0.0.2

func (w *AllrevisionsClient) Generatetitles(b bool) *AllrevisionsClient

generatetitles When being used as a generator, generate titles rather than revision IDs.

func (*AllrevisionsClient) Generatexml added in v0.0.2

func (w *AllrevisionsClient) Generatexml(b bool) *AllrevisionsClient

generatexml Use action=expandtemplates or action=parse instead. Generate XML parse tree for revision content (requires arvprop=content).

func (*AllrevisionsClient) Limit added in v0.0.2

limit Limit how many revisions will be returned. The value must be between 1 and 500. A value of <= 0 indicates "max"

func (*AllrevisionsClient) Namespace added in v0.0.2

func (w *AllrevisionsClient) Namespace(i ...Namespace) *AllrevisionsClient

namespace Only list pages in this namespace. Note: Due to miser mode, using this may result in fewer than limit results returned before continuing; in extreme cases, zero results may be returned. To specify all values, use a value of less than 0.

func (*AllrevisionsClient) Parse added in v0.0.2

parse Use action=parse instead. Parse revision content (requires arvprop=content). For performance reasons, if this option is used, arvlimit is enforced to 1.

func (*AllrevisionsClient) Prop added in v0.0.2

prop

func (*AllrevisionsClient) Section added in v0.0.2

section Only retrieve the content of the section with this identifier.

func (*AllrevisionsClient) Slots added in v0.0.2

slots Which revision slots to return data for, when slot-related properties are included in arvprops. If omitted, data from the main slot will be returned in a backwards-compatible format. To specify all values, use *.

func (*AllrevisionsClient) Start added in v0.0.2

start The timestamp to start enumerating from.

func (*AllrevisionsClient) User added in v0.0.2

user Only list revisions by this user.

type AllrevisionsOption added in v0.0.2

type AllrevisionsOption func(map[string]string)

type AllrevisionsResponse added in v0.0.2

type AllrevisionsResponse struct {
	CoreResponse
	Batchcomplete any                           `json:"batchcomplete,omitempty"`
	Continue      *AllrevisionsResponseContinue `json:"continue,omitempty"`
	Query         *AllrevisionsResponseQuery    `json:"query,omitempty"`
}

type AllrevisionsResponseContinue added in v0.0.2

type AllrevisionsResponseContinue struct {
	Arvcontinue string `json:"arvcontinue,omitempty"`
	Continue    string `json:"continue,omitempty"`
}

type AllrevisionsResponseQuery added in v0.0.2

type AllrevisionsResponseQuery struct {
	Allrevisions []AllrevisionsResponseQueryRevision `json:"allrevisions,omitempty"`
}

type AllrevisionsResponseQueryRevision added in v0.0.2

type AllrevisionsResponseQueryRevision struct {
	PageId    int                                         `json:"pageid,omitempty"`
	Revisions []AllrevisionsResponseQueryRevisionRevision `json:"revisions,omitempty"`
	Namespace Namespace                                   `json:"ns"`
	Title     string                                      `json:"title,omitempty"`
}

type AllrevisionsResponseQueryRevisionRevision added in v0.0.2

type AllrevisionsResponseQueryRevisionRevision struct {
	RevId     int        `json:"revid,omitempty"`
	ParentId  int        `json:"parentid,omitempty"`
	Parsetree string     `json:"parsetree,omitempty"`
	User      string     `json:"user,omitempty"`
	Timestamp *time.Time `json:"timestamp,omitempty"`
	Comment   string     `json:"comment,omitempty"`
}

type AllusersClient added in v0.0.2

type AllusersClient struct {
	// contains filtered or unexported fields
}

func (*AllusersClient) Activeusers added in v0.0.2

func (w *AllusersClient) Activeusers(b bool) *AllusersClient

Activeusers Only list users active in the last 30 days.

func (*AllusersClient) Attachedwiki added in v0.0.2

func (w *AllusersClient) Attachedwiki(s string) *AllusersClient

Attachedwiki With usprop=centralids, indicate whether the user is attached with the wiki identified by this ID.

func (*AllusersClient) Dir added in v0.0.2

Dir Direction to sort in. One of the following values: ascending, descending Default: ascending

func (*AllusersClient) Do added in v0.0.2

func (*AllusersClient) ExcludeGroup added in v0.0.2

func (w *AllusersClient) ExcludeGroup(s ...string) *AllusersClient

ExcludeGroup Exclude users in the given groups. Values: accountcreator, autopatrolled, bot, bureaucrat, checkuser, confirmed, flow-bot, import, interface-admin, ipblock-exempt, no-ipinfo, push-subscription-manager, steward, suppress, sysop, translationadmin, transwiki, uploader

func (*AllusersClient) From added in v0.0.2

func (w *AllusersClient) From(s string) *AllusersClient

From The username to start enumerating from.

func (*AllusersClient) Group added in v0.0.2

func (w *AllusersClient) Group(s ...string) *AllusersClient

Group Only include users in the given groups. Values: accountcreator, autopatrolled, bot, bureaucrat, checkuser, confirmed, flow-bot, import, interface-admin, ipblock-exempt, no-ipinfo, push-subscription-manager, steward, suppress, sysop, translationadmin, transwiki, uploader

func (*AllusersClient) Limit added in v0.0.2

func (w *AllusersClient) Limit(i int) *AllusersClient

Limit A list of users to obtain information for. Separate values with | or alternative. Maximum number of values is 50 (500 for clients allowed higher limits).

func (*AllusersClient) Prefix added in v0.0.2

func (w *AllusersClient) Prefix(s string) *AllusersClient

Prefix Search for all users that begin with this value.

func (*AllusersClient) Prop added in v0.0.2

func (w *AllusersClient) Prop(s ...string) *AllusersClient

Prop Which pieces of information to include: Values (separate with | or alternative): blockinfo, centralids, editcount, groups, implicitgroups, registration, rights

func (*AllusersClient) Rights added in v0.0.2

func (w *AllusersClient) Rights(s ...string) *AllusersClient

Rights Only include users with the given rights. Does not include rights granted by implicit or auto-promoted groups like *, user, or autoconfirmed.

func (*AllusersClient) To added in v0.0.2

To The username to stop enumerating at.

func (*AllusersClient) Witheditsonly added in v0.0.2

func (w *AllusersClient) Witheditsonly(b bool) *AllusersClient

Witheditsonly Only list users who have made edits. Delete the talk page, if it exists.

type AllusersOption added in v0.0.2

type AllusersOption func(map[string]string)

Allusers

type AllusersQuery added in v0.0.2

type AllusersQuery struct {
	Allusers []AllusersResponseAllusers `json:"allusers"`
}

type AllusersResponse added in v0.0.2

type AllusersResponse struct {
	QueryResponse
	Query    *AllusersQuery            `json:"query,omitempty"`
	Continue *AllusersResponseContinue `json:"continue,omitempty"`
}

type AllusersResponseAllusers added in v0.0.2

type AllusersResponseAllusers struct {
	UserId int    `json:"userid,omitempty"`
	Name   string `json:"name,omitempty"`
}

type AllusersResponseContinue added in v0.0.2

type AllusersResponseContinue struct {
	From     string `json:"aufrom"`
	Continue string `json:"continue"`
}

type CategoryInfoResponse added in v0.0.2

type CategoryInfoResponse struct {
	QueryResponse
	Query *CategoryInfoResponseQuery `json:"query,omitempty"`
}

type CategoryInfoResponsePage added in v0.0.2

type CategoryInfoResponsePage struct {
	QueryResponseQueryPage
	CategoryInfo map[string]CategoryInfoResponsePagesCategoryInfo `json:"categoryinfo,omitempty"`
}

type CategoryInfoResponsePagesCategoryInfo added in v0.0.2

type CategoryInfoResponsePagesCategoryInfo struct {
	Files   int `json:"files"`
	Pages   int `json:"pages"`
	Size    int `json:"size"`
	Subcats int `json:"subcats"`
}

type CategoryInfoResponseQuery added in v0.0.2

type CategoryInfoResponseQuery struct {
	QueryResponseQuery
	Pages map[string]QueryResponseQueryPage `json:"pages"`
}

type CategoryMembers added in v0.0.2

type CategoryMembers struct {
	QueryResponse
	BatchComplete string                   `json:"batchcomplete"`
	Continue      *CategoryMembersContinue `json:"continue,omitempty"`
	Query         *CategoryMembersQuery    `json:"query"`
}

type CategoryMembersClient added in v0.0.2

type CategoryMembersClient struct {
	// contains filtered or unexported fields
}

func (*CategoryMembersClient) Continue added in v0.0.2

func (*CategoryMembersClient) Do added in v0.0.2

func (*CategoryMembersClient) Limit added in v0.0.2

func (*CategoryMembersClient) PageId added in v0.0.2

func (*CategoryMembersClient) Title added in v0.0.2

type CategoryMembersContinue added in v0.0.2

type CategoryMembersContinue struct {
	CmContinue string `json:"cmcontinue"`
	Continue   string `json:"continue"`
}

type CategoryMembersQuery added in v0.0.2

type CategoryMembersQuery struct {
	CategoryMembers []QueryResponseQueryPage `json:"categorymembers"`
}

type CategoryinfoClient added in v0.0.2

type CategoryinfoClient struct {
	// contains filtered or unexported fields
}

func (*CategoryinfoClient) Continue added in v0.0.2

Continue When more results are available, use this to continue.

func (*CategoryinfoClient) Converttitles added in v0.0.2

func (w *CategoryinfoClient) Converttitles(b bool) *CategoryinfoClient

Converttitles Convert titles to other variants if necessary. Only works if the wiki's content language supports variant conversion. Languages that support variant conversion include ban, en, crh, gan, iu, kk, ku, shi, sr, tg, uz and zh.

func (*CategoryinfoClient) Do added in v0.0.2

func (*CategoryinfoClient) Export added in v0.0.2

Export Export the current revisions of all given or generated pages.

func (*CategoryinfoClient) Exportnowrap added in v0.0.2

func (w *CategoryinfoClient) Exportnowrap(b bool) *CategoryinfoClient

Exportnowrap Return the export XML without wrapping it in an XML result (same format as Special:Export). Can only be used with query+export.

func (*CategoryinfoClient) Exportschema added in v0.0.2

func (w *CategoryinfoClient) Exportschema(s string) *CategoryinfoClient

Exportschema Target the given version of the XML dump format when exporting. Can only be used with query+export. One of the following values: 0.10, 0.11 Default: 0.10

func (*CategoryinfoClient) Generator added in v0.0.2

func (w *CategoryinfoClient) Generator(s string) *CategoryinfoClient

Generator

func (*CategoryinfoClient) Indexpageids added in v0.0.2

func (w *CategoryinfoClient) Indexpageids(b bool) *CategoryinfoClient

Indexpageids Include an additional pageids section listing all returned page IDs.

func (*CategoryinfoClient) Iwurl added in v0.0.2

Iwurl Whether to get the full URL if the title is an interwiki link.

func (*CategoryinfoClient) List added in v0.0.2

List Which lists to get.

func (*CategoryinfoClient) Meta added in v0.0.2

Meta Which metadata to get.

func (*CategoryinfoClient) Pageids added in v0.0.2

Pageids A list of page IDs to work on. Separate values with | or alternative. Maximum number of values is 50 (500 for clients allowed higher limits).

func (*CategoryinfoClient) Prop added in v0.0.2

Prop Which properties to get for the queried pages.

func (*CategoryinfoClient) Rawcontinue added in v0.0.2

func (w *CategoryinfoClient) Rawcontinue(b bool) *CategoryinfoClient

Rawcontinue Return raw query-continue data for continuation.

func (*CategoryinfoClient) Redirects added in v0.0.2

func (w *CategoryinfoClient) Redirects(b bool) *CategoryinfoClient

Redirects Automatically resolve redirects in query+titles, query+pageids, and query+revids, and in pages returned by query+generator.

func (*CategoryinfoClient) Revids added in v0.0.2

Revids A list of revision IDs to work on. Separate values with | or alternative. Maximum number of values is 50 (500 for clients allowed higher limits).

func (*CategoryinfoClient) Titles added in v0.0.2

Titles A list of titles to work on. Separate values with | or alternative. Maximum number of values is 50 (500 for clients allowed higher limits).

type Client

type Client struct {
	Client *http.Client

	// HTTP user agent
	UserAgent string

	// API token cache.
	// Maps from name of token (e.g., "csrf") to token value.
	// Use GetToken to obtain tokens.
	Tokens *Tokens

	Debug io.Writer
	// contains filtered or unexported fields
}

func New

func New(inURL, userAgent string) (*Client, error)

New returns a pointer to an initialized Client object. If the provided API URL is invalid (as defined by the net/url package), then it will return nil and the error from url.Parse().

The userAgent parameter will be joined with the DefaultUserAgent const and used as HTTP User-Agent. If userAgent is an empty string, DefaultUserAgent will be used by itself as User-Agent. The User-Agent set by New can be overriden by setting the UserAgent field on the returned *Client.

New disables maxlag by default. To enable it, simply set Client.Maxlag.On to true. The default timeout is 5 seconds and the default amount of retries is 3.

func (*Client) Allpages added in v0.0.2

func (c *Client) Allpages() *AllpagesClient

func (*Client) Allrevisions added in v0.0.2

func (c *Client) Allrevisions() *AllrevisionsClient

func (*Client) Allusers added in v0.0.2

func (c *Client) Allusers() *AllusersClient

func (*Client) BotLogin

func (w *Client) BotLogin(ctx context.Context, username, password string) (Response, error)

func (*Client) CategoryInfo added in v0.0.2

func (c *Client) CategoryInfo() *CategoryinfoClient

func (*Client) CategoryMembers added in v0.0.2

func (c *Client) CategoryMembers() *CategoryMembersClient

func (*Client) ClientLogin

func (w *Client) ClientLogin(ctx context.Context, username, password string, options ...ClientLoginOption) (Response, error)

Log in to the wiki using the interactive flow.

func (*Client) Delete added in v0.0.2

func (c *Client) Delete() *DeleteClient

func (*Client) Edit

func (c *Client) Edit() *EditClient

func (*Client) GetInto added in v0.0.2

func (w *Client) GetInto(ctx context.Context, v Values, a any) (string, error)

func (*Client) GetToken

func (w *Client) GetToken(ctx context.Context, token Token) (string, error)

Login attempts to login using the provided username and password. Do not use Login with OAuth.

func (*Client) Linkshere added in v0.0.3

func (c *Client) Linkshere() *LinkshereClient

func (*Client) Login

func (w *Client) Login(ctx context.Context, username, password string, options ...LoginOption) (Response, error)

Log in and get authentication cookies.

This action should only be used in combination with Special:BotPasswords; use for main-account login is deprecated and may fail without warning. To safely log in to the main account, use action=clientlogin.

func (*Client) Move added in v0.0.5

func (c *Client) Move() *MoveClient

func (*Client) PostInto added in v0.0.2

func (w *Client) PostInto(ctx context.Context, v Values, a any) (string, error)

func (*Client) Protect

func (c *Client) Protect() *ProtectClient

func (*Client) Revisions added in v0.0.2

func (c *Client) Revisions() *RevisionsClient

WithQueryProp Which properties to get for the queried pages.

func (*Client) Siteinfo added in v0.0.3

func (c *Client) Siteinfo() *SiteinfoClient

WithQueryProp Which properties to get for the queried pages.

func (*Client) Transcludedin added in v0.0.3

func (c *Client) Transcludedin() *TranscludedinClient

func (*Client) Upload

func (c *Client) Upload() *UploadClient

func (*Client) Users added in v0.0.2

func (c *Client) Users() *UsersClient

func (*Client) WithClientLoginAdditionalParam

func (w *Client) WithClientLoginAdditionalParam(key, s string) ClientLoginOption

This module accepts additional parameters depending on the available authentication requests. Use action=query&meta=authmanagerinfo with amirequestsfor=login (or a previous response from this module, if applicable) to determine the requests available and the fields that they use.

func (*Client) WithClientLoginContinue

func (w *Client) WithClientLoginContinue(b bool) ClientLoginOption

This request is a continuation after an earlier UI or REDIRECT response. Either this or loginreturnurl is required. Type: boolean (details)

func (*Client) WithClientLoginMergeRequestFields

func (w *Client) WithClientLoginMergeRequestFields(b bool) ClientLoginOption

Merge field information for all authentication requests into one array. Type: boolean (details)

func (*Client) WithClientLoginMessageFormat

func (w *Client) WithClientLoginMessageFormat(s string) ClientLoginOption

Format to use for returning messages. One of the following values: html, none, raw, wikitext Default: wikitext

func (*Client) WithClientLoginPreserveState

func (w *Client) WithClientLoginPreserveState(b bool) ClientLoginOption

Preserve state from a previous failed login attempt, if possible. Type: boolean (details)

func (*Client) WithClientLoginRequests

func (w *Client) WithClientLoginRequests(s ...string) ClientLoginOption

Only use these authentication requests, by the id returned from action=query&meta=authmanagerinfo with amirequestsfor=login or from a previous response from this module. Separate values with | or alternative. Maximum number of values is 50 (500 for clients allowed higher limits).

func (*Client) WithClientLoginReturnUrl

func (w *Client) WithClientLoginReturnUrl(s string) ClientLoginOption

Return URL for third-party authentication flows, must be absolute. Either this or logincontinue is required. Upon receiving a REDIRECT response, you will typically open a browser or web view to the specified redirecttarget URL for a third-party authentication flow. When that completes, the third party will send the browser or web view to this URL. You should extract any query or POST parameters from the URL and pass them as a logincontinue request to this API module.

func (*Client) WithLoginDomain

func (w *Client) WithLoginDomain(s string) LoginOption

Format to use for returning messages. One of the following values: html, none, raw, wikitext Default: wikitext

type ClientLoginOption

type ClientLoginOption func(map[string]string)

ClientLoginOption

type CoreResponse added in v0.0.2

type CoreResponse struct {
	RawJSON     string                   `json:"-"`
	ClientLogin *ResponseClientLogin     `json:"clientlogin,omitempty"`
	Error       *ResponseError           `json:"error,omitempty"`
	Warnings    map[string]ResponseError `json:"warnings,omitempty"`
}

type DeleteClient added in v0.0.2

type DeleteClient struct {
	// contains filtered or unexported fields
}

func (*DeleteClient) Deletetalk added in v0.0.2

func (w *DeleteClient) Deletetalk(b bool) *DeleteClient

Deletetalk Delete the talk page, if it exists.

func (*DeleteClient) Do added in v0.0.2

func (*DeleteClient) Oldimage added in v0.0.2

func (w *DeleteClient) Oldimage(s string) *DeleteClient

Oldimage The name of the old image to delete as provided by action=query&prop=imageinfo&iiprop=archivename.

func (*DeleteClient) Pageid added in v0.0.2

func (w *DeleteClient) Pageid(i int) *DeleteClient

Pageid Page ID of the page to delete. Cannot be used together with title.

func (*DeleteClient) Reason added in v0.0.2

func (w *DeleteClient) Reason(s string) *DeleteClient

Reason Reason for the deletion. If not set, an automatically generated reason will be used.

func (*DeleteClient) Tags added in v0.0.2

func (w *DeleteClient) Tags(s string) *DeleteClient

Tags Change tags to apply to the entry in the deletion log. Values (separate with | or alternative): possible vandalism, repeating characters

func (*DeleteClient) Title added in v0.0.2

func (w *DeleteClient) Title(s string) *DeleteClient

Title Title of the page to delete. Cannot be used together with pageid.

func (*DeleteClient) Unwatch added in v0.0.2

func (w *DeleteClient) Unwatch(b bool) *DeleteClient

Unwatch Remove the page from the current user's watchlist.

func (*DeleteClient) Watch added in v0.0.2

func (w *DeleteClient) Watch(b bool) *DeleteClient

Watch Add the page to the current user's watchlist.

func (*DeleteClient) Watchlist added in v0.0.2

func (w *DeleteClient) Watchlist(s string) *DeleteClient

Watchlist Unconditionally add or remove the page from the current user's watchlist, use preferences (ignored for bot users) or do not change watch. One of the following values: nochange, preferences, unwatch, watch Default: preferences

func (*DeleteClient) Watchlistexpiry added in v0.0.2

func (w *DeleteClient) Watchlistexpiry(s string) *DeleteClient

Watchlistexpiry Watchlist expiry timestamp. Omit this parameter entirely to leave the current expiry unchanged.

type DeleteDeleteResponse added in v0.0.2

type DeleteDeleteResponse struct {
	Title  string `json:"title"`
	Resaon string `json:"reason"`
	LogId  int    `json:"logid,omitempty"`
}

type DeleteOption added in v0.0.2

type DeleteOption func(map[string]string)

Delete

type DeleteResponse added in v0.0.2

type DeleteResponse struct {
	CoreResponse
	Delete *DeleteDeleteResponse `json:"delete,omitempty"`
}

type EditClient added in v0.0.2

type EditClient struct {
	// contains filtered or unexported fields
}

func (*EditClient) AppendText added in v0.0.2

func (w *EditClient) AppendText(s string) *EditClient

AppendText Add this text to the end of the page or section. Overrides text. Use section=new to append a new section, rather than this parameter.

func (*EditClient) BaseRevId added in v0.0.2

func (w *EditClient) BaseRevId(i int) *EditClient

BaseRevId ID of the base revision, used to detect edit conflicts. May be obtained through action=query&prop=revisions. Self-conflicts cause the edit to fail unless basetimestamp is set. Type: integer

func (*EditClient) BaseTimestamp added in v0.0.2

func (w *EditClient) BaseTimestamp(s string) *EditClient

BaseTimestamp Timestamp of the base revision, used to detect edit conflicts. May be obtained through action=query&prop=revisions&rvprop=timestamp. Self-conflicts are ignored. Type: timestamp (allowed formats)

func (*EditClient) Bot added in v0.0.2

func (w *EditClient) Bot(b bool) *EditClient

Bot Mark this edit as a bot edit. Type: boolean (details)

func (*EditClient) CaptchaId added in v0.0.2

func (w *EditClient) CaptchaId(s string) *EditClient

CaptchaId CAPTCHA ID from previous request

func (*EditClient) CaptchaWord added in v0.0.2

func (w *EditClient) CaptchaWord(s string) *EditClient

CaptchaWord Answer to the CAPTCHA

func (*EditClient) ContentFormat added in v0.0.2

func (w *EditClient) ContentFormat(s string) *EditClient

ContentFormat Content serialization format used for the input text. One of the following values: application/json, application/octet-stream, application/unknown, application/x-binary, text/css, text/javascript, text/plain, text/unknown, text/x-wiki, unknown/unknown

func (*EditClient) ContentModel added in v0.0.2

func (w *EditClient) ContentModel(s string) *EditClient

ContentModel Content model of the new content. One of the following values: GadgetDefinition, Json.JsonConfig, JsonSchema, Map.JsonConfig, MassMessageListContent, NewsletterContent, Scribunto, SecurePoll, Tabular.JsonConfig, css, flow-board, javascript, json, sanitized-css, text, translate-messagebundle, unknown, wikitext

func (*EditClient) CreateOnly added in v0.0.2

func (w *EditClient) CreateOnly(b bool) *EditClient

CreateOnly Don't edit the page if it exists already. Type: boolean (details)

func (*EditClient) Do added in v0.0.2

func (*EditClient) Md5 added in v0.0.2

func (w *EditClient) Md5(s string) *EditClient

Md5 The MD5 hash of the text parameter, or the prependtext and appendtext parameters concatenated. If set, the edit won't be done unless the hash is correct.

func (*EditClient) Minor added in v0.0.2

func (w *EditClient) Minor(b bool) *EditClient

Minor Mark this edit as a minor edit. Type: boolean (details)

func (*EditClient) NoCreate added in v0.0.2

func (w *EditClient) NoCreate(b bool) *EditClient

NoCreate Throw an error if the page doesn't exist. Type: boolean (details)

func (*EditClient) NotMinor added in v0.0.2

func (w *EditClient) NotMinor(b bool) *EditClient

NotMinor Do not mark this edit as a minor edit even if the "Mark all edits minor by default" user preference is set. Type: boolean (details)

func (*EditClient) PageId added in v0.0.2

func (w *EditClient) PageId(i int) *EditClient

PageId Page ID of the page to edit. Cannot be used together with title. Type: integer

func (*EditClient) PrependText added in v0.0.2

func (w *EditClient) PrependText(s string) *EditClient

PrependText Add this text to the beginning of the page or section. Overrides text.

func (*EditClient) Recreate added in v0.0.2

func (w *EditClient) Recreate(b bool) *EditClient

Recreate Override any errors about the page having been deleted in the meantime. Type: boolean (details)

func (*EditClient) Redirect added in v0.0.2

func (w *EditClient) Redirect(b bool) *EditClient

Redirect Automatically resolve redirects. Type: boolean (details)

func (*EditClient) Section added in v0.0.2

func (w *EditClient) Section(s string) *EditClient

Section Section identifier. 0 for the top section, new for a new section. Often a positive integer, but can also be non-numeric.

func (*EditClient) SectionTitle added in v0.0.2

func (w *EditClient) SectionTitle(s string) *EditClient

SectionTitle The title for a new section when using section=new.

func (*EditClient) StartTimestamp added in v0.0.2

func (w *EditClient) StartTimestamp(s string) *EditClient

StartTimestamp Timestamp when the editing process began, used to detect edit conflicts. An appropriate value may be obtained using curtimestamp when beginning the edit process (e.g. when loading the page content to edit). Type: timestamp (allowed formats)

func (*EditClient) Summary added in v0.0.2

func (w *EditClient) Summary(s string) *EditClient

Summary Edit summary. When this parameter is not provided or empty, an edit summary may be generated automatically. When using section=new and sectiontitle is not provided, the value of this parameter is used for the section title instead, and an edit summary is generated automatically.

func (*EditClient) Tags added in v0.0.2

func (w *EditClient) Tags(s string) *EditClient

Tags Change tags to apply to the revision. Values (separate with | or alternative): possible vandalism, repeating characters

func (*EditClient) Text added in v0.0.2

func (w *EditClient) Text(s string) *EditClient

Text Page content.

func (*EditClient) Title added in v0.0.2

func (w *EditClient) Title(s string) *EditClient

Title Title of the page to edit. Cannot be used together with EditPageId.

func (*EditClient) Undo added in v0.0.2

func (w *EditClient) Undo(s string) *EditClient

Undo Undo this revision. Overrides text, prependtext and appendtext. Type: integer The value must be no less than 0.

func (*EditClient) UndoAfter added in v0.0.2

func (w *EditClient) UndoAfter(s string) *EditClient

UndoAfter Undo all revisions from undo to this one. If not set, just undo one revision. Type: integer The value must be no less than 0.

func (*EditClient) Unwatch added in v0.0.2

func (w *EditClient) Unwatch(b bool) *EditClient

Unwatch Deprecated. Remove the page from the current user's watchlist. Type: boolean (details)

func (*EditClient) Watch added in v0.0.2

func (w *EditClient) Watch(b bool) *EditClient

Watch Deprecated. Add the page to the current user's watchlist. Type: boolean (details)

func (*EditClient) WatchListExpiry added in v0.0.2

func (w *EditClient) WatchListExpiry(s string) *EditClient

WatchListExpiry Watchlist expiry timestamp. Omit this parameter entirely to leave the current expiry unchanged. Type: expiry (details)

func (*EditClient) Watchlist added in v0.0.2

func (w *EditClient) Watchlist(s string) *EditClient

Watchlist Unconditionally add or remove the page from the current user's watchlist, use preferences (ignored for bot users) or do not change watch. One of the following values: nochange, preferences, unwatch, watch Default: preferences

type EditEditResponse added in v0.0.2

type EditEditResponse struct {
	Result       Result     `json:"result"`
	PageId       int        `json:"pageid"`
	Title        string     `json:"title"`
	ContentModel string     `json:"contentmodel"`
	OldRevId     int        `json:"oldrevid,omitempty"`
	NewRevId     int        `json:"newrevid,omitempty"`
	NewTimestamp *time.Time `json:"newtimestamp,omitempty"`
	Watched      any        `json:"watched,omitempty"`
	NoChange     any        `json:"nochange,omitempty"`
}

type EditOption

type EditOption func(map[string]string)

type EditResponse added in v0.0.2

type EditResponse struct {
	CoreResponse
	Edit *EditEditResponse `json:"edit,omitempty"`
}

type LinkshereClient added in v0.0.3

type LinkshereClient struct {
	// contains filtered or unexported fields
}

func (*LinkshereClient) Continue added in v0.0.3

func (w *LinkshereClient) Continue(s string) *LinkshereClient

Continue When more results are available, use this to continue.

func (*LinkshereClient) Do added in v0.0.3

func (*LinkshereClient) Limit added in v0.0.3

func (w *LinkshereClient) Limit(i int) *LinkshereClient

Limit How many to return. Type: integer The value must be between 1 and 500. For "max", use 0. Default: 10

func (*LinkshereClient) Namespace added in v0.0.3

func (w *LinkshereClient) Namespace(ns ...Namespace) *LinkshereClient

Namespace. Only include pages in these namespaces.

Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, etc.

To specify all values, use NamespaceAll.

func (*LinkshereClient) Prop added in v0.0.3

func (w *LinkshereClient) Prop(s ...string) *LinkshereClient

Prop. Which properties to get:

* pageid - Page ID of each page. * title - Title of each page. * redirect - Flag if the page is a redirect.

Values (separate with | or alternative): pageid, redirect, title Default: pageid|title|redirect

func (*LinkshereClient) Show added in v0.0.3

func (w *LinkshereClient) Show(s ...string) *LinkshereClient

Show Show only items that meet these criteria: * redirect - Only show redirects. * !redirect - Only show non-redirects.

Values (separate with | or alternative): !redirect, redirect

func (*LinkshereClient) Titles added in v0.0.3

func (w *LinkshereClient) Titles(s ...string) *LinkshereClient

Titles. A list of titles to work on. Separate values with | or alternative. Maximum number of values is 50 (500 for clients allowed higher limits).

type LinkshereContinue added in v0.0.3

type LinkshereContinue struct {
	Lhcontinue string `json:"lhcontinue"`
	Continue   string `json:"continue"`
}

type LinkshereFromPage added in v0.0.3

type LinkshereFromPage struct {
	Pageid    int             `json:"pageid"`
	Ns        Namespace       `json:"ns"`
	Title     string          `json:"title"`
	Missing   any             `json:"missing,omitempty"`
	Linkshere []LinksherePage `json:"linkshere,omitempty"`
}

type LinkshereOption added in v0.0.3

type LinkshereOption func(map[string]string)

type LinksherePage added in v0.0.3

type LinksherePage struct {
	Pageid   int       `json:"pageid"`
	Ns       Namespace `json:"ns"`
	Title    string    `json:"title"`
	Redirect any       `json:"redirect"`
}

type LinkshereQuery added in v0.0.3

type LinkshereQuery struct {
	Pages map[string]LinkshereFromPage `json:"pages"`
}

type LinkshereResponse added in v0.0.3

type LinkshereResponse struct {
	CoreResponse
	BatchComplete any                `json:"batchcomplete,omitempty"`
	Continue      *LinkshereContinue `json:"continue,omitempty"`
	Query         *LinkshereQuery    `json:"query,omitempty"`
}

type LoginOption

type LoginOption func(map[string]string)

LoginOption

type MoveClient added in v0.0.5

type MoveClient struct {
	// contains filtered or unexported fields
}

func (*MoveClient) Do added in v0.0.5

func (*MoveClient) From added in v0.0.5

func (w *MoveClient) From(s string) *MoveClient

From Title of the page to rename. Cannot be used together with fromid.

func (*MoveClient) Fromid added in v0.0.5

func (w *MoveClient) Fromid(i int) *MoveClient

Fromid Page ID of the page to rename. Cannot be used together with from.

func (*MoveClient) Ignorewarnings added in v0.0.5

func (w *MoveClient) Ignorewarnings(b bool) *MoveClient

Ignorewarnings Ignore any warnings.

func (*MoveClient) Movesubpages added in v0.0.5

func (w *MoveClient) Movesubpages(b bool) *MoveClient

Movesubpages Rename subpages, if applicable. Default: false

func (*MoveClient) Movetalk added in v0.0.5

func (w *MoveClient) Movetalk(b bool) *MoveClient

Movetalk Rename the talk page, if it exists. Default: false

func (*MoveClient) Noredirect added in v0.0.5

func (w *MoveClient) Noredirect(b bool) *MoveClient

Noredirect Don't create a redirect. Default: false

func (*MoveClient) Reason added in v0.0.5

func (w *MoveClient) Reason(s string) *MoveClient

Reason Reason for the rename. Default: (empty)

func (*MoveClient) Tags added in v0.0.5

func (w *MoveClient) Tags(s ...string) *MoveClient

Tags Change tags to apply to the entry in the move log and to the null revision on the destination page.

func (*MoveClient) To added in v0.0.5

func (w *MoveClient) To(s string) *MoveClient

To Title to rename the page to.

func (*MoveClient) Token added in v0.0.5

func (w *MoveClient) Token(s string) *MoveClient

Token A "csrf" token retrieved from action=query&meta=tokens

func (*MoveClient) Watchlist added in v0.0.5

func (w *MoveClient) Watchlist(s string) *MoveClient

Watchlist Unconditionally add or remove the page from the current user's watchlist, use preferences (ignored for bot users) or do not change watch. One of the following values: nochange, preferences, unwatch, watch Default: preferences

func (*MoveClient) Watchlistexpiry added in v0.0.5

func (w *MoveClient) Watchlistexpiry(s string) *MoveClient

Watchlistexpiry Watchlist expiry timestamp. Omit this parameter entirely to leave the current expiry unchanged.

type MoveOption added in v0.0.5

type MoveOption func(map[string]string)

type MoveResponse added in v0.0.5

type MoveResponse struct {
	CoreResponse
	Move *MoveResponseMove `json:"move,omitempty"`
}

type MoveResponseMove added in v0.0.5

type MoveResponseMove struct {
	From            string `json:"from"`
	To              string `json:"to"`
	Reason          string `json:"reason"`
	RedirectCreated any    `json:"redirectcreated,omitempty"`
	Talkfrom        string `json:"talkfrom,omitempty"`
	Talkto          string `json:"talkto,omitempty"`
}

type Namespace added in v0.0.3

type Namespace int64
const (
	// Namespace all is a special value used to indicate "all namespaces"
	// for functions like LinkshereClient.Namespace.
	NamespaceAll Namespace = -1024

	NamespaceMedia         Namespace = -2
	NamespaceSpecial       Namespace = -1
	NamespaceMain          Namespace = 0
	NamespaceTalk          Namespace = 1
	NamespaceUser          Namespace = 2
	NamespaceUserTalk      Namespace = 3
	NamespaceProject       Namespace = 4
	NamespaceProjectTalk   Namespace = 5
	NamespaceFile          Namespace = 6
	NamespaceFileTalk      Namespace = 7
	NamespaceMediaWiki     Namespace = 8
	NamespaceMediaWikiTalk Namespace = 9
	NamespaceTemplate      Namespace = 10
	NamespaceTemplateTalk  Namespace = 11
	NamespaceHelp          Namespace = 12
	NamespaceHelpTalk      Namespace = 13
	NamespaceCategory      Namespace = 14
	NamespaceCategoryTalk  Namespace = 15
)

func NewNamespace added in v0.0.3

func NewNamespace(name string, code int) Namespace

NewNamespace is a convenience function that simplifies the definition of named namespaces. Using NewNamespace will add the code and name to the internal lookup table, so that future calls to String() will return the assigned name. Note that this could be used to (accidentally or otherwise) redefine the standard namespace names.

func (Namespace) String added in v0.0.3

func (n Namespace) String() string

type ProtectClient added in v0.0.2

type ProtectClient struct {
	// contains filtered or unexported fields
}

func (*ProtectClient) Cascade added in v0.0.2

func (w *ProtectClient) Cascade(b bool) *ProtectClient

Cascade Enable cascading protection (i.e. protect transcluded templates and images used in this page). Ignored if none of the given protection levels support cascading.

func (*ProtectClient) Do added in v0.0.2

func (*ProtectClient) Expiry added in v0.0.2

func (w *ProtectClient) Expiry(s string) *ProtectClient

Expiry Expiry timestamps. If only one timestamp is set, it'll be used for all protections. Use infinite, indefinite, infinity, or never, for a never-expiring protection. Separate values with | or alternative. Maximum number of values is 50 (500 for clients allowed higher limits). Default: infinite

func (*ProtectClient) Pageid added in v0.0.2

func (w *ProtectClient) Pageid(i int) *ProtectClient

Pageid ID of the page to (un)protect. Cannot be used together with title.

func (*ProtectClient) Protections added in v0.0.2

func (w *ProtectClient) Protections(s string) *ProtectClient

Protections List of protection levels, formatted action=level (e.g. edit=sysop). A level of all means everyone is allowed to take the action, i.e. no restriction. Note: Any actions not listed will have restrictions removed. Separate values with | or alternative. Maximum number of values is 50 (500 for clients allowed higher limits).

func (*ProtectClient) Reason added in v0.0.2

func (w *ProtectClient) Reason(s string) *ProtectClient

Reason Reason for (un)protecting. Default: (empty)

func (*ProtectClient) Tags added in v0.0.2

func (w *ProtectClient) Tags(s ...string) *ProtectClient

Tags Change tags to apply to the entry in the protection log.

func (*ProtectClient) Title added in v0.0.2

func (w *ProtectClient) Title(s string) *ProtectClient

Title Title of the page to (un)protect. Cannot be used together with pageid.

func (*ProtectClient) Watch added in v0.0.2

func (w *ProtectClient) Watch(b bool) *ProtectClient

Watch If set, add the page being (un)protected to the current user's watchlist.

func (*ProtectClient) Watchlist added in v0.0.2

func (w *ProtectClient) Watchlist(s string) *ProtectClient

Watchlist Unconditionally add or remove the page from the current user's watchlist, use preferences (ignored for bot users) or do not change watch. One of the following values: nochange, preferences, unwatch, watch Default: preferences

func (*ProtectClient) Watchlistexpiry added in v0.0.2

func (w *ProtectClient) Watchlistexpiry(s string) *ProtectClient

Watchlistexpiry Watchlist expiry timestamp. Omit this parameter entirely to leave the current expiry unchanged.

type ProtectOption added in v0.0.2

type ProtectOption func(map[string]string)

type ProtectResponse added in v0.0.2

type ProtectResponse struct {
	CoreResponse
	Protect *struct {
		Title       string `json:"title,omitempty"`
		Reason      string `json:"reason,omitempty"`
		Protections []struct {
			Edit   string `json:"edit,omitempty"`
			Expiry string `json:"expiry,omitempty"`
		} `json:"protections,omitempty"`
	} `json:"protect,omitempty"`
}

type QueryOption added in v0.0.2

type QueryOption func(map[string]string)

type QueryResponse added in v0.0.2

type QueryResponse struct {
	CoreResponse
	BatchComplete any `json:"batchcomplete"`
}

type QueryResponseNormalized added in v0.0.2

type QueryResponseNormalized struct {
	Fromencoded bool   `json:"fromencoded,omitempty"`
	From        string `json:"from"`
	To          string `json:"to"`
}

type QueryResponseQuery added in v0.0.2

type QueryResponseQuery struct {
	Normalized []QueryResponseNormalized `json:"normalized,omitempty"`
	Pages      []QueryResponseQueryPage  `json:"pages"`
	Tokens     map[string]string         `json:"tokens,omitempty"`
}

type QueryResponseQueryPage added in v0.0.2

type QueryResponseQueryPage struct {
	PageId               int                              `json:"pageid,omitempty"`
	Namespace            Namespace                        `json:"ns"`
	Title                string                           `json:"title"`
	Revisions            []QueryResponseQueryPageRevision `json:"revisions,omitempty"`
	Missing              any                              `json:"missing,omitempty"`
	CategoryInfo         map[string]int                   `json:"categoryinfo,omitempty"`
	Contentmodel         string                           `json:"contentmodel,omitempty"`
	Pagelanguage         string                           `json:"pagelanguage,omitempty"`
	Pagelanguagehtmlcode string                           `json:"pagelanguagehtmlcode,omitempty"`
	Pagelanguagedir      string                           `json:"pagelanguagedir,omitempty"`
	Touched              *time.Time                       `json:"touched,omitempty"`
	Lastrevid            int                              `json:"lastrevid,omitempty"`
	Length               int                              `json:"length,omitempty"`
}

func (QueryResponseQueryPage) ArticlePageName added in v0.0.2

func (p QueryResponseQueryPage) ArticlePageName() string

Full page name of the associated subject (e.g. article or file). Useful on talk pages.

func (QueryResponseQueryPage) BasePageName added in v0.0.2

func (p QueryResponseQueryPage) BasePageName() string

Page title of the page in the immediately superior subpage level without the namespace. Would return Title/Foo on page Help:Title/Foo/Bar.

func (QueryResponseQueryPage) FullPageName added in v0.0.2

func (p QueryResponseQueryPage) FullPageName() string

Namespace and full page title (including all subpage levels).

func (QueryResponseQueryPage) PageName added in v0.0.2

func (p QueryResponseQueryPage) PageName() string

Full page title (including all subpage levels) without the namespace.

func (QueryResponseQueryPage) RootPageName added in v0.0.2

func (p QueryResponseQueryPage) RootPageName() string

Name of the root of the current page. Would return Title on page Help:Title/Foo/Bar.

func (QueryResponseQueryPage) SubPageName added in v0.0.2

func (p QueryResponseQueryPage) SubPageName() string

The subpage title. Would return Bar on page Help:Title/Foo/Bar. If no subpage exists the value of PageName() is returned.

func (QueryResponseQueryPage) TalkPageName added in v0.0.2

func (p QueryResponseQueryPage) TalkPageName() string

Full page name of the associated talk page.

type QueryResponseQueryPageRevision added in v0.0.2

type QueryResponseQueryPageRevision struct {
	RevId     int                                           `json:"revid,omitempty"`
	ParentId  int                                           `json:"parentid"`
	User      string                                        `json:"user,omitempty"`
	Timestamp *time.Time                                    `json:"timestamp,omitempty"`
	Comment   string                                        `json:"comment"`
	Slots     map[string]QueryResponseQueryPageRevisionSlot `json:"slots,omitempty"`
}

type QueryResponseQueryPageRevisionSlot added in v0.0.2

type QueryResponseQueryPageRevisionSlot struct {
	Content       string `json:"content"`
	ContentModel  string `json:"contentmodel"`
	ContentFormat string `json:"contentformat"`
}

type Response

type Response struct {
	CoreResponse
	RawJSON       string               `json:"-"`
	BatchComplete any                  `json:"batchcomplete,omitempty"`
	BotLogin      *ResponseBotLogin    `json:"login,omitempty"`
	ClientLogin   *ResponseClientLogin `json:"clientlogin,omitempty"`
	Edit          *ResponseEdit        `json:"edit,omitempty"`
	Query         *ResponseQuery       `json:"query,omitempty"`
	Warnings      *ResponseWarnings    `json:"warnings,omitempty"`
}

type ResponseBotLogin

type ResponseBotLogin struct {
	Result   Result `json:"result"`
	Reason   string `json:"reason"`
	UserId   int    `json:"lguserid"`
	UserName string `json:"lgusername"`
}

type ResponseClientLogin

type ResponseClientLogin struct {
	Status      string `json:"status"`
	Message     string `json:"message"`
	MessageCode string `json:"messagecode"`
}

type ResponseEdit

type ResponseEdit struct {
	Result       Result    `json:"result"`
	PageId       int       `json:"pageid"`
	Title        string    `json:"title"`
	ContentModel string    `json:"contentmodel"`
	OldRevId     int       `json:"oldrevid,omitempty"`
	NewRevId     int       `json:"newrevid,omitempty"`
	NewTimestamp time.Time `json:"newtimestamp,omitempty"`
	Watched      string    `json:"watched"`
}

type ResponseError

type ResponseError struct {
	Code        string `json:"code,omitempty"`
	Docref      string `json:"docref,omitempty"`
	Info        string `json:"info,omitempty"`
	Stasherrors []struct {
		Message string   `json:"message,omitempty"`
		Params  []string `json:"params,omitempty"`
		Code    string   `json:"code,omitempty"`
		Type    string   `json:"type,omitempty"`
	} `json:"stasherrors,omitempty"`
	Star string `json:"*,omitempty"`
}

type ResponseQuery

type ResponseQuery struct {
	Pages  []QueryResponseQueryPage `json:"pages"`
	Tokens map[string]string        `json:"tokens"`
}

type ResponseWarnings

type ResponseWarnings struct {
	Tokens map[string]string `json:"tokens"`
}

type Result added in v0.0.2

type Result string
const (
	Error   Result = "Error"
	Success Result = "Success"
	Warning Result = "Warning"
)

type RevisionsClient added in v0.0.2

type RevisionsClient struct {
	// contains filtered or unexported fields
}

func (*RevisionsClient) Contentformat added in v0.0.2

func (w *RevisionsClient) Contentformat(s string) *RevisionsClient

contentformat Serialization format used for rvdifftotext and expected for output of content. One of the following values: application/json, application/octet-stream, application/unknown, application/x-binary, text/css, text/javascript, text/plain, text/unknown, text/x-wiki, unknown/unknown

func (*RevisionsClient) Continue added in v0.0.2

func (w *RevisionsClient) Continue(s string) *RevisionsClient

continue When more results are available, use this to continue.

func (*RevisionsClient) Diffto added in v0.0.2

func (w *RevisionsClient) Diffto(s string) *RevisionsClient

diffto Use action=compare instead. Revision ID to diff each revision to. Use prev, next and cur for the previous, next and current revision respectively.

func (*RevisionsClient) Difftotext added in v0.0.2

func (w *RevisionsClient) Difftotext(s string) *RevisionsClient

difftotext Use action=compare instead. Text to diff each revision to. Only diffs a limited number of revisions. Overrides rvdiffto. If rvsection is set, only that section will be diffed against this text.

func (*RevisionsClient) Difftotextpst added in v0.0.2

func (w *RevisionsClient) Difftotextpst(b bool) *RevisionsClient

difftotextpst Use action=compare instead. Perform a pre-save transform on the text before diffing it. Only valid when used with rvdifftotext.

func (*RevisionsClient) Dir added in v0.0.2

dir

func (*RevisionsClient) Do added in v0.0.2

func (*RevisionsClient) End added in v0.0.2

end Enumerate up to this timestamp. May only be used with a single page (mode #2).

func (*RevisionsClient) Endid added in v0.0.2

func (w *RevisionsClient) Endid(i int) *RevisionsClient

endid Stop enumeration at this revision's timestamp. The revision must exist, but need not belong to this page. May only be used with a single page (mode #2).

func (*RevisionsClient) Excludeuser added in v0.0.2

func (w *RevisionsClient) Excludeuser(s string) *RevisionsClient

excludeuser Exclude revisions made by user. May only be used with a single page (mode #2).

func (*RevisionsClient) Expandtemplates added in v0.0.2

func (w *RevisionsClient) Expandtemplates(b bool) *RevisionsClient

expandtemplates Use action=expandtemplates instead. Expand templates in revision content (requires rvprop=content).

func (*RevisionsClient) Generatexml added in v0.0.2

func (w *RevisionsClient) Generatexml(b bool) *RevisionsClient

generatexml Use action=expandtemplates or action=parse instead. Generate XML parse tree for revision content (requires rvprop=content).

func (*RevisionsClient) Limit added in v0.0.2

func (w *RevisionsClient) Limit(i int) *RevisionsClient

limit Limit how many revisions will be returned. May only be used with a single page (mode #2). The value must be between 1 and 500.

func (*RevisionsClient) Parse added in v0.0.2

func (w *RevisionsClient) Parse(b bool) *RevisionsClient

parse Use action=parse instead. Parse revision content (requires rvprop=content). For performance reasons, if this option is used, rvlimit is enforced to 1.

func (*RevisionsClient) Prop added in v0.0.2

func (w *RevisionsClient) Prop(s ...string) *RevisionsClient

prop

func (*RevisionsClient) Section added in v0.0.2

func (w *RevisionsClient) Section(s string) *RevisionsClient

section Only retrieve the content of the section with this identifier.

func (*RevisionsClient) Slots added in v0.0.2

func (w *RevisionsClient) Slots(s string) *RevisionsClient

slots Which revision slots to return data for, when slot-related properties are included in rvprops. If omitted, data from the main slot will be returned in a backwards-compatible format. Values (separate with | or alternative): main To specify all values, use *.

func (*RevisionsClient) Start added in v0.0.2

start From which revision timestamp to start enumeration. May only be used with a single page (mode #2).

func (*RevisionsClient) Startid added in v0.0.2

func (w *RevisionsClient) Startid(i int) *RevisionsClient

startid Start enumeration from this revision's timestamp. The revision must exist, but need not belong to this page. May only be used with a single page (mode #2).

func (*RevisionsClient) Tag added in v0.0.2

tag Only list revisions tagged with this tag.

func (*RevisionsClient) Titles added in v0.0.2

func (w *RevisionsClient) Titles(s ...string) *RevisionsClient

func (*RevisionsClient) User added in v0.0.2

user Only include revisions made by user. May only be used with a single page (mode #2).

type RevisionsResponse added in v0.0.2

type RevisionsResponse struct {
	QueryResponse
	Query *RevisionsResponseQuery `json:"query,omitempty"`
}

type RevisionsResponseNormalized added in v0.0.2

type RevisionsResponseNormalized struct {
	Fromencoded bool   `json:"fromencoded"`
	From        string `json:"from"`
	To          string `json:"to"`
}

type RevisionsResponsePage added in v0.0.2

type RevisionsResponsePage struct {
	Namespace Namespace                   `json:"ns"`
	Title     string                      `json:"title,omitempty"`
	Missing   any                         `json:"missing,omitempty"`
	Pageid    int                         `json:"pageid,omitempty"`
	Revisions []RevisionsResponseRevision `json:"revisions,omitempty"`
}

type RevisionsResponseQuery added in v0.0.2

type RevisionsResponseQuery struct {
	Normalized []RevisionsResponseNormalized `json:"normalized,omitempty"`
	Pages      []RevisionsResponsePage       `json:"pages,omitempty"`
}

type RevisionsResponseRevision added in v0.0.2

type RevisionsResponseRevision struct {
	Revid         int                              `json:"revid,omitempty"`
	Parentid      int                              `json:"parentid"`
	Minor         bool                             `json:"minor"`
	User          string                           `json:"user,omitempty"`
	Userid        int                              `json:"userid,omitempty"`
	Timestamp     *time.Time                       `json:"timestamp,omitempty"`
	Size          int                              `json:"size,omitempty"`
	Sha1          string                           `json:"sha1,omitempty"`
	Roles         []string                         `json:"roles,omitempty"`
	Slots         map[string]RevisionsResponseSlot `json:"slots,omitempty"`
	Comment       string                           `json:"comment"`
	Parsedcomment string                           `json:"parsedcomment,omitempty"`
	Tags          []string                         `json:"tags,omitempty"`
}

type RevisionsResponseSlot added in v0.0.2

type RevisionsResponseSlot struct {
	Size          int    `json:"size,omitempty"`
	Sha1          string `json:"sha1,omitempty"`
	Contentmodel  string `json:"contentmodel,omitempty"`
	Contentformat string `json:"contentformat,omitempty"`
	Content       string `json:"content,omitempty"`
}

type SiteinfoClient added in v0.0.3

type SiteinfoClient struct {
	// contains filtered or unexported fields
}

func (*SiteinfoClient) Do added in v0.0.3

func (*SiteinfoClient) Filteriw added in v0.0.3

func (w *SiteinfoClient) Filteriw(s string) *SiteinfoClient

filteriw Return only local or only nonlocal entries of the interwiki map. One of the following values: !local, local

func (*SiteinfoClient) Inlanguagecode added in v0.0.3

func (w *SiteinfoClient) Inlanguagecode(s string) *SiteinfoClient

inlanguagecode Language code for localised language names (best effort) and skin names.

func (*SiteinfoClient) Numberingroup added in v0.0.3

func (w *SiteinfoClient) Numberingroup(b bool) *SiteinfoClient

numberingroup Lists the number of users in user groups.

func (*SiteinfoClient) Prop added in v0.0.3

func (w *SiteinfoClient) Prop(s ...string) *SiteinfoClient

prop Which information to get. One or more of: dbrepllag, defaultoptions, extensions, extensiontags, fileextensions, functionhooks, general, interwikimap, languages, languagevariants, libraries, magicwords, namespacealiases, namespaces, protocols, restrictions, rightsinfo, showhooks, skins, specialpagealiases, statistics, uploaddialog, usergroups, variables Default: general

func (*SiteinfoClient) Showalldb added in v0.0.3

func (w *SiteinfoClient) Showalldb(b bool) *SiteinfoClient

showalldb List all database servers, not just the one lagging the most.

type SiteinfoDbrepllag added in v0.0.3

type SiteinfoDbrepllag struct {
	Host string  `json:"host"`
	Lag  float64 `json:"lag"`
}

type SiteinfoExtension added in v0.0.3

type SiteinfoExtension struct {
	Type           string     `json:"type,omitempty"`
	Name           string     `json:"name,omitempty"`
	Descriptionmsg string     `json:"descriptionmsg,omitempty"`
	Author         string     `json:"author,omitempty"`
	URL            string     `json:"url,omitempty"`
	VcsSystem      string     `json:"vcs-system,omitempty"`
	VcsVersion     string     `json:"vcs-version,omitempty"`
	VcsURL         string     `json:"vcs-url,omitempty"`
	VcsDate        *time.Time `json:"vcs-date,omitempty"`
	LicenseName    string     `json:"license-name,omitempty"`
	License        string     `json:"license,omitempty"`
	Namemsg        string     `json:"namemsg,omitempty"`
	Version        string     `json:"version,omitempty"`
	Credits        string     `json:"credits,omitempty"`
	Description    string     `json:"description,omitempty"`
}

type SiteinfoFallbacks added in v0.0.3

type SiteinfoFallbacks struct {
	Fallbacks []string `json:"fallbacks,omitempty"`
}

type SiteinfoFileextension added in v0.0.3

type SiteinfoFileextension struct {
	Ext string `json:"ext"`
}

type SiteinfoGeneral added in v0.0.3

type SiteinfoGeneral struct {
	Mainpage                        string                                          `json:"mainpage,omitempty"`
	Base                            string                                          `json:"base,omitempty"`
	Sitename                        string                                          `json:"sitename,omitempty"`
	Generator                       string                                          `json:"generator,omitempty"`
	Phpversion                      string                                          `json:"phpversion,omitempty"`
	Phpsapi                         string                                          `json:"phpsapi,omitempty"`
	Dbtype                          string                                          `json:"dbtype,omitempty"`
	Dbversion                       string                                          `json:"dbversion,omitempty"`
	Langconversion                  string                                          `json:"langconversion"`
	Linkconversion                  string                                          `json:"linkconversion"`
	Titleconversion                 string                                          `json:"titleconversion"`
	Linkprefixcharset               string                                          `json:"linkprefixcharset"`
	Linkprefix                      string                                          `json:"linkprefix"`
	Linktrail                       string                                          `json:"linktrail,omitempty"`
	Legaltitlechars                 string                                          `json:"legaltitlechars,omitempty"`
	Invalidusernamechars            string                                          `json:"invalidusernamechars,omitempty"`
	Fixarabicunicode                string                                          `json:"fixarabicunicode"`
	Fixmalayalamunicode             string                                          `json:"fixmalayalamunicode"`
	GitHash                         string                                          `json:"git-hash,omitempty"`
	GitBranch                       string                                          `json:"git-branch,omitempty"`
	Case                            string                                          `json:"case,omitempty"`
	Lang                            string                                          `json:"lang,omitempty"`
	Fallback                        []interface{}                                   `json:"fallback"`
	Fallback8BitEncoding            string                                          `json:"fallback8bitEncoding,omitempty"`
	Writeapi                        string                                          `json:"writeapi"`
	Maxarticlesize                  int                                             `json:"maxarticlesize,omitempty"`
	Timezone                        string                                          `json:"timezone,omitempty"`
	Timeoffset                      int                                             `json:"timeoffset"`
	Articlepath                     string                                          `json:"articlepath,omitempty"`
	Scriptpath                      string                                          `json:"scriptpath"`
	Script                          string                                          `json:"script,omitempty"`
	Variantarticlepath              bool                                            `json:"variantarticlepath"`
	Server                          string                                          `json:"server,omitempty"`
	Servername                      string                                          `json:"servername,omitempty"`
	Wikiid                          string                                          `json:"wikiid,omitempty"`
	Time                            *time.Time                                      `json:"time,omitempty"`
	Misermode                       string                                          `json:"misermode,omitempty"`
	Uploadsenabled                  string                                          `json:"uploadsenabled"`
	Maxuploadsize                   int64                                           `json:"maxuploadsize,omitempty"`
	Minuploadchunksize              int                                             `json:"minuploadchunksize,omitempty"`
	Galleryoptions                  *SiteinfoGeneralGalleryoptions                  `json:"galleryoptions,omitempty"`
	Thumblimits                     []int                                           `json:"thumblimits,omitempty"`
	Imagelimits                     []SiteinfoGeneralImagelimits                    `json:"imagelimits,omitempty"`
	Favicon                         string                                          `json:"favicon,omitempty"`
	Centralidlookupprovider         string                                          `json:"centralidlookupprovider,omitempty"`
	Allcentralidlookupproviders     []string                                        `json:"allcentralidlookupproviders,omitempty"`
	Interwikimagic                  string                                          `json:"interwikimagic"`
	Magiclinks                      []string                                        `json:"magiclinks"`
	Categorycollation               string                                          `json:"categorycollation,omitempty"`
	Nofollowlinks                   string                                          `json:"nofollowlinks,omitempty"`
	Nofollownsexceptions            []interface{}                                   `json:"nofollownsexceptions,omitempty"`
	Nofollowdomainexceptions        []string                                        `json:"nofollowdomainexceptions,omitempty"`
	WmfConfig                       *SiteinfoGeneralWmfConfig                       `json:"wmf-config,omitempty"`
	Extensiondistributor            *SiteinfoGeneralExtensiondistributor            `json:"extensiondistributor,omitempty"`
	Mobileserver                    string                                          `json:"mobileserver,omitempty"`
	ReadinglistsConfig              *SiteinfoGeneralReadinglistsConfig              `json:"readinglists-config,omitempty"`
	Citeresponsivereferences        string                                          `json:"citeresponsivereferences,omitempty"`
	Linter                          *SiteinfoGeneralLinter                          `json:"linter,omitempty"`
	PageviewserviceSupportedMetrics *SiteinfoGeneralPageviewserviceSupportedMetrics `json:"pageviewservice-supported-metrics,omitempty"`
}

type SiteinfoGeneralExtensiondistributor added in v0.0.3

type SiteinfoGeneralExtensiondistributor struct {
	Snapshots []string `json:"snapshots,omitempty"`
	List      string   `json:"list,omitempty"`
}

type SiteinfoGeneralGalleryoptions added in v0.0.3

type SiteinfoGeneralGalleryoptions struct {
	ImagesPerRow   int    `json:"imagesPerRow"`
	ImageWidth     int    `json:"imageWidth"`
	ImageHeight    int    `json:"imageHeight"`
	CaptionLength  string `json:"captionLength"`
	ShowBytes      string `json:"showBytes"`
	Mode           string `json:"mode"`
	ShowDimensions string `json:"showDimensions"`
}

type SiteinfoGeneralImagelimits added in v0.0.3

type SiteinfoGeneralImagelimits struct {
	Width  int `json:"width,omitempty"`
	Height int `json:"height,omitempty"`
}

type SiteinfoGeneralLinter added in v0.0.3

type SiteinfoGeneralLinter struct {
	High   []string `json:"high,omitempty"`
	Medium []string `json:"medium,omitempty"`
	Low    []string `json:"low,omitempty"`
}

type SiteinfoGeneralMostviewed added in v0.0.3

type SiteinfoGeneralMostviewed struct {
	Pageviews string `json:"pageviews,omitempty"`
}

type SiteinfoGeneralPageviews added in v0.0.3

type SiteinfoGeneralPageviews struct {
	Pageviews string `json:"pageviews,omitempty"`
}

type SiteinfoGeneralPageviewserviceSupportedMetrics added in v0.0.3

type SiteinfoGeneralPageviewserviceSupportedMetrics struct {
	Pageviews  SiteinfoGeneralPageviews  `json:"pageviews,omitempty"`
	Siteviews  SiteinfoGeneralSiteviews  `json:"siteviews,omitempty"`
	Mostviewed SiteinfoGeneralMostviewed `json:"mostviewed,omitempty"`
}

type SiteinfoGeneralReadinglistsConfig added in v0.0.3

type SiteinfoGeneralReadinglistsConfig struct {
	MaxListsPerUser      int `json:"maxListsPerUser,omitempty"`
	MaxEntriesPerList    int `json:"maxEntriesPerList,omitempty"`
	DeletedRetentionDays int `json:"deletedRetentionDays,omitempty"`
}

type SiteinfoGeneralSiteviews added in v0.0.3

type SiteinfoGeneralSiteviews struct {
	Pageviews string `json:"pageviews,omitempty"`
	Uniques   string `json:"uniques,omitempty"`
}

type SiteinfoGeneralWmfConfig added in v0.0.3

type SiteinfoGeneralWmfConfig struct {
	WmfMasterDatacenter           string `json:"wmfMasterDatacenter,omitempty"`
	WmfEtcdLastModifiedIndex      int    `json:"wmfEtcdLastModifiedIndex,omitempty"`
	WmgCirrusSearchDefaultCluster string `json:"wmgCirrusSearchDefaultCluster,omitempty"`
	WgCirrusSearchDefaultCluster  string `json:"wgCirrusSearchDefaultCluster,omitempty"`
}

type SiteinfoInterwikiMap added in v0.0.3

type SiteinfoInterwikiMap struct {
	Prefix string `json:"prefix,omitempty"`
	Local  any    `json:"local,omitempty"`
	URL    string `json:"url,omitempty"`
	API    string `json:"api,omitempty"`
}

type SiteinfoLanguages added in v0.0.3

type SiteinfoLanguages struct {
	Code    string `json:"code,omitempty"`
	Bcp47   string `json:"bcp47,omitempty"`
	Comment string `json:"*,omitempty"`
}

type SiteinfoLibrary added in v0.0.3

type SiteinfoLibrary struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type SiteinfoMagicWords added in v0.0.3

type SiteinfoMagicWords struct {
	Name          string   `json:"name,omitempty"`
	Alises        []string `json:"aliases,omitempty"`
	CaseSensitive any      `json:"case-sensitive,omitempty"`
}

type SiteinfoNamespace added in v0.0.3

type SiteinfoNamespace struct {
	ID                  int    `json:"id"`
	Case                string `json:"case,omitempty"`
	Subpages            any    `json:"subpages,omitempty"`
	Canonical           string `json:"canonical,omitempty"`
	Content             any    `json:"content,omitempty"`
	NamespaceProtection string `json:"namespaceprotection,omitempty"`
	Comment             string `json:"*"`
}

type SiteinfoResponse added in v0.0.3

type SiteinfoResponse struct {
	QueryResponse
	Query *SiteinfoResponseQuery `json:"query,omitempty"`
}

type SiteinfoResponseQuery added in v0.0.3

type SiteinfoResponseQuery struct {
	General           *SiteinfoGeneral                        `json:"general,omitempty"`
	Namespaces        map[string]SiteinfoNamespace            `json:"namespaces,omitempty"`
	NamespacesAliases []SiteinfoNamespace                     `json:"namespacealiases,omitempty"`
	SpecialPageAlises []SiteinfoSpecialPageAlises             `json:"specialpagealiases,omitempty"`
	MagicWords        []SiteinfoMagicWords                    `json:"magicwords,omitempty"`
	InterwikiMap      []SiteinfoInterwikiMap                  `json:"interwikimap,omitempty"`
	Dbrepllag         []SiteinfoDbrepllag                     `json:"dbrepllag,omitempty"`
	Statistics        *SiteinfoStatistics                     `json:"statistics,omitempty"`
	Usergroups        []SiteinfoUsergroups                    `json:"usergroups,omitempty"`
	Libraries         []SiteinfoLibrary                       `json:"libraries,omitempty"`
	Extensions        []SiteinfoExtension                     `json:"extensions,omitempty"`
	Fileextensions    []SiteinfoFileextension                 `json:"fileextensions,omitempty"`
	Rightsinfo        *SiteinfoRightsinfo                     `json:"rightsinfo,omitempty"`
	Restrictions      *SiteinfoRestrictions                   `json:"restrictions,omitempty"`
	Languages         []SiteinfoLanguages                     `json:"languages,omitempty"`
	LanguageVariants  map[string]map[string]SiteinfoFallbacks `json:"languagevariants,omitempty"`
	Skins             []SiteinfoSkin                          `json:"skins,omitempty"`
	ExtensionTags     []string                                `json:"extensiontags,omitempty"`
	FunctionHooks     []string                                `json:"functionhooks,omitempty"`
	ShowHooks         []SiteinfoShowhooks                     `json:"showhooks,omitempty"`
	Variables         []string                                `json:"variables,omitempty"`
	Protocols         []string                                `json:"protocols,omitempty"`
	DefaultOptions    map[string]any                          `json:"defaultoptions,omitempty"`
	UploadDialog      *SiteinfoUploadDialog                   `json:"uploaddialog,omitempty"`
}

type SiteinfoRestrictions added in v0.0.3

type SiteinfoRestrictions struct {
	Types               []string `json:"types,omitempty"`
	Levels              []string `json:"levels,omitempty"`
	Cascadinglevels     []string `json:"cascadinglevels,omitempty"`
	Semiprotectedlevels []string `json:"semiprotectedlevels,omitempty"`
}

type SiteinfoRightsinfo added in v0.0.3

type SiteinfoRightsinfo struct {
	URL  string `json:"url"`
	Text string `json:"text"`
}

type SiteinfoShowhooks added in v0.0.3

type SiteinfoShowhooks struct {
	Name        string   `json:"name,omitempty"`
	Subscribers []string `json:"subscribers,omitempty"`
}

type SiteinfoSkin added in v0.0.3

type SiteinfoSkin struct {
	Code     string `json:"code,omitempty"`
	Default  any    `json:"default,omitempty"`
	Unusable any    `json:"unusable,omitempty"`
	Comment  string `json:"*,omitempty"`
}

type SiteinfoSpecialPageAlises added in v0.0.3

type SiteinfoSpecialPageAlises struct {
	RealName string   `json:"realname,omitempty"`
	Alises   []string `json:"aliases,omitempty"`
}

type SiteinfoStatistics added in v0.0.4

type SiteinfoStatistics struct {
	Pages       int `json:"pages"`
	Articles    int `json:"articles"`
	Edits       int `json:"edits"`
	Images      int `json:"images"`
	Users       int `json:"users"`
	Activeusers int `json:"activeusers"`
	Admins      int `json:"admins"`
	Jobs        int `json:"jobs"`
}

type SiteinfoUploadDialog added in v0.0.3

type SiteinfoUploadDialog struct {
	Fields          map[string]string `json:"fields,omitempty"`
	LicenseMessages map[string]string `json:"licensemessages,omitempty"`
	Comment         map[string]string `json:"comment,omitempty"`
	Format          map[string]string `json:"format,omitempty"`
}

type SiteinfoUsergroups added in v0.0.3

type SiteinfoUsergroups struct {
	Name   string   `json:"name,omitempty"`
	Rights []string `json:"rights,omitempty"`
}

type Token

type Token string
const (
	CSRFToken                   Token = "csrf"
	DeleteGlobalAccountToken    Token = "deleteglobalaccount"
	PatrolToken                 Token = "patrol"
	RollbackToken               Token = "rollback"
	SetGlobalAccountStatusToken Token = "setglobalaccountstatus"
	UserRightsToken             Token = "userrights"
	WatchToken                  Token = "watch"
	LoginToken                  Token = "login"
)

These consts represents MW API token names. They are meant to be used with the GetToken method like so:

ClientInstance.GetToken(mwclient.CSRFToken)

type Tokens

type Tokens struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type TranscludedinClient added in v0.0.3

type TranscludedinClient struct {
	// contains filtered or unexported fields
}

func (*TranscludedinClient) Continue added in v0.0.3

Continue When more results are available, use this to continue.

func (*TranscludedinClient) Do added in v0.0.3

func (*TranscludedinClient) Limit added in v0.0.3

Limit How many to return. Type: integer The value must be between 1 and 500. For "max", use 0. Default: 10

func (*TranscludedinClient) Namespace added in v0.0.3

func (w *TranscludedinClient) Namespace(ns ...Namespace) *TranscludedinClient

Namespace. Only include pages in these namespaces.

Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, etc.

To specify all values, use NamespaceAll.

func (*TranscludedinClient) Prop added in v0.0.3

Prop. Which properties to get:

* pageid - Page ID of each page. * title - Title of each page. * redirect - Flag if the page is a redirect.

Values (separate with | or alternative): pageid, redirect, title Default: pageid|title|redirect

func (*TranscludedinClient) Show added in v0.0.3

Show Show only items that meet these criteria: * redirect - Only show redirects. * !redirect - Only show non-redirects.

Values (separate with | or alternative): !redirect, redirect

func (*TranscludedinClient) Titles added in v0.0.3

Titles. A list of titles to work on. Separate values with | or alternative. Maximum number of values is 50 (500 for clients allowed higher limits).

type TranscludedinContinue added in v0.0.3

type TranscludedinContinue struct {
	Lhcontinue string `json:"lhcontinue"`
	Continue   string `json:"continue"`
}

type TranscludedinFromPage added in v0.0.3

type TranscludedinFromPage struct {
	Pageid        int                 `json:"pageid"`
	Ns            Namespace           `json:"ns"`
	Title         string              `json:"title"`
	Missing       any                 `json:"missing,omitempty"`
	Transcludedin []TranscludedinPage `json:"transcludedin,omitempty"`
}

type TranscludedinOption added in v0.0.3

type TranscludedinOption func(map[string]string)

type TranscludedinPage added in v0.0.3

type TranscludedinPage struct {
	Pageid   int       `json:"pageid"`
	Ns       Namespace `json:"ns"`
	Title    string    `json:"title"`
	Redirect any       `json:"redirect"`
}

type TranscludedinQuery added in v0.0.3

type TranscludedinQuery struct {
	Pages map[string]TranscludedinFromPage `json:"pages"`
}

type TranscludedinResponse added in v0.0.3

type TranscludedinResponse struct {
	CoreResponse
	BatchComplete any                    `json:"batchcomplete,omitempty"`
	Continue      *TranscludedinContinue `json:"continue,omitempty"`
	Query         *TranscludedinQuery    `json:"query,omitempty"`
}

type UploadClient added in v0.0.2

type UploadClient struct {
	// contains filtered or unexported fields
}

func (*UploadClient) Async added in v0.0.2

func (w *UploadClient) Async(b bool) *UploadClient

Async Make potentially large file operations asynchronous when possible.

func (*UploadClient) Checkstatus added in v0.0.2

func (w *UploadClient) Checkstatus(b bool) *UploadClient

Checkstatus Only fetch the upload status for the given file key.

func (*UploadClient) Chunk added in v0.0.2

func (w *UploadClient) Chunk(s string) *UploadClient

Chunk Chunk contents. Must be posted as a file upload using multipart/form-data.

func (*UploadClient) Comment added in v0.0.2

func (w *UploadClient) Comment(s string) *UploadClient

Comment Upload comment. Also used as the initial page text for new files if text is not specified. Default: (empty)

func (*UploadClient) Do added in v0.0.2

func (*UploadClient) File added in v0.0.2

func (w *UploadClient) File(f io.Reader) *UploadClient

File File contents. Must be posted as a file upload using multipart/form-data.

func (*UploadClient) Filekey added in v0.0.2

func (w *UploadClient) Filekey(s string) *UploadClient

Filekey Key that identifies a previous upload that was stashed temporarily.

func (*UploadClient) Filename added in v0.0.2

func (w *UploadClient) Filename(s string) *UploadClient

Filename Target filename.

func (*UploadClient) Filesize added in v0.0.2

func (w *UploadClient) Filesize(i int) *UploadClient

Filesize Filesize of entire upload. The value must be between 0 and 4,294,967,296.

func (*UploadClient) Ignorewarnings added in v0.0.2

func (w *UploadClient) Ignorewarnings(b bool) *UploadClient

Ignorewarnings Ignore any warnings.

func (*UploadClient) Offset added in v0.0.2

func (w *UploadClient) Offset(i int) *UploadClient

Offset Offset of chunk in bytes. The value must be no less than 0.

func (*UploadClient) Sessionkey added in v0.0.2

func (w *UploadClient) Sessionkey(s string) *UploadClient

Sessionkey Same as filekey, maintained for backward compatibility.

func (*UploadClient) Stash added in v0.0.2

func (w *UploadClient) Stash(b bool) *UploadClient

Stash If set, the server will stash the file temporarily instead of adding it to the repository.

func (*UploadClient) Tags added in v0.0.2

func (w *UploadClient) Tags(s ...string) *UploadClient

Tags Change tags to apply to the upload log entry and file page revision. Values (separate with | or alternative): possible vandalism, repeating characters

func (*UploadClient) Text added in v0.0.2

func (w *UploadClient) Text(s string) *UploadClient

Text Initial page text for new files.

func (*UploadClient) Token added in v0.0.2

func (w *UploadClient) Token(s string) *UploadClient

Token A "csrf" token retrieved from action=query&meta=tokens

func (*UploadClient) Url added in v0.0.2

func (w *UploadClient) Url(s string) *UploadClient

Url URL to fetch the file from.

func (*UploadClient) Watch added in v0.0.2

func (w *UploadClient) Watch(b bool) *UploadClient

Watch Watch the page.

func (*UploadClient) Watchlist added in v0.0.2

func (w *UploadClient) Watchlist(s string) *UploadClient

Watchlist Unconditionally add or remove the page from the current user's watchlist, use preferences (ignored for bot users) or do not change watch. One of the following values: nochange, preferences, watch Default: preferences

func (*UploadClient) Watchlistexpiry added in v0.0.2

func (w *UploadClient) Watchlistexpiry(s string) *UploadClient

Watchlistexpiry Watchlist expiry timestamp. Omit this parameter entirely to leave the current expiry unchanged.

type UploadOption added in v0.0.2

type UploadOption func(map[string]string)

type UploadResponse added in v0.0.2

type UploadResponse struct {
	CoreResponse
	Upload *UploadUploadResponse `json:"upload,omitempty"`
}

type UploadUploadImageinfo added in v0.0.2

type UploadUploadImageinfo struct {
	Bitdepth       int      `json:"bitdepth,omitempty"`
	Canonicaltitle string   `json:"canonicaltitle,omitempty"`
	Comment        string   `json:"comment"`
	Commonmetadata []string `json:"commonmetadata"`
	Descriptionurl string   `json:"descriptionurl,omitempty"`
	Extmetadata    struct {
		DateTime *struct {
			Value  *time.Time `json:"value,omitempty"`
			Source string     `json:"source,omitempty"`
			Hidden any        `json:"hidden,omitempty"`
		} `json:"DateTime,omitempty"`
		ObjectName *struct {
			Value  string `json:"value,omitempty"`
			Source string `json:"source,omitempty"`
			Hidden any    `json:"hidden,omitempty"`
		} `json:"ObjectName,omitempty"`
	} `json:"extmetadata,omitempty"`
	Height    int    `json:"height,omitempty"`
	HTML      string `json:"html,omitempty"`
	Mediatype string `json:"mediatype,omitempty"`
	Metadata  []struct {
		Name  string `json:"name,omitempty"`
		Value int    `json:"value,omitempty"`
	} `json:"metadata,omitempty"`
	Mime          string     `json:"mime,omitempty"`
	Parsedcomment string     `json:"parsedcomment"`
	Sha1          string     `json:"sha1,omitempty"`
	Size          int        `json:"size,omitempty"`
	Timestamp     *time.Time `json:"timestamp,omitempty"`
	URL           string     `json:"url,omitempty"`
	User          string     `json:"user,omitempty"`
	Userid        int        `json:"userid,omitempty"`
	Width         int        `json:"width,omitempty"`
}

type UploadUploadResponse added in v0.0.2

type UploadUploadResponse struct {
	Filename   string                 `json:"filename,omitempty"`
	Imageinfo  *UploadUploadImageinfo `json:"imageinfo,omitempty"`
	Result     Result                 `json:"result,omitempty"`
	Warnings   *UploadUploadWarnings  `json:"warnings,omitempty"`
	FileKey    string                 `json:"filekey,omitempty"`
	SessionKey string                 `json:"sessionkey,omitempty"`
}

type UploadUploadWarnings added in v0.0.2

type UploadUploadWarnings struct {
	Exists           string                        `json:"exists,omitempty"`
	NoChange         *UploadUploadWarningsNoChange `json:"nochange,omitempty"`
	DuplicateVersion string                        `json:"duplicate-version,omitempty"`
	WasDeleted       string                        `json:"was-deleted,omitempty"`
	Duplicate        []string                      `json:"duplicate,omitempty"`
	DuplicateArchive string                        `json:"duplicate-archive,omitempty"`
	BadFileName      string                        `json:"badfilename,omitempty"`
}

type UploadUploadWarningsNoChange added in v0.0.2

type UploadUploadWarningsNoChange struct {
	Timestamp *time.Time `json:"timestamp,omitempty"`
}

type UsersClient added in v0.0.2

type UsersClient struct {
	// contains filtered or unexported fields
}

func (*UsersClient) Attachedwiki added in v0.0.2

func (w *UsersClient) Attachedwiki(s string) *UsersClient

Usattachedwiki With usprop=centralids, indicate whether the user is attached with the wiki identified by this ID.

func (*UsersClient) Do added in v0.0.2

func (*UsersClient) Prop added in v0.0.2

func (w *UsersClient) Prop(s ...string) *UsersClient

Usprop

func (*UsersClient) Userids added in v0.0.2

func (w *UsersClient) Userids(i ...int) *UsersClient

Ususerids A list of user IDs to obtain information for. Separate values with | or alternative. Maximum number of values is 50 (500 for clients allowed higher limits).

func (*UsersClient) Users added in v0.0.2

func (w *UsersClient) Users(s ...string) *UsersClient

Ususers A list of users to obtain information for. Separate values with | or alternative. Maximum number of values is 50 (500 for clients allowed higher limits).

type UsersOption added in v0.0.2

type UsersOption func(map[string]string)

Users

type UsersQuery added in v0.0.2

type UsersQuery struct {
	Users []UsersResponseUser `json:"users"`
}

type UsersResponse added in v0.0.2

type UsersResponse struct {
	QueryResponse
	Query *UsersQuery `json:"query,omitempty"`
}

type UsersResponseUser added in v0.0.2

type UsersResponseUser struct {
	UserId  int    `json:"userid,omitempty"`
	Name    string `json:"name,omitempty"`
	Missing any    `json:"missing,omitempty"`
}

type Values

type Values map[string]string

Values maps a string key to a string value. It is typically used for query parameters and form values. Unlike in the http.Header map, the keys in a Values map are case-sensitive.

func (Values) Add

func (v Values) Add(key, value string)

Add adds the value to key. It appends to any existing values associated with key.

func (Values) AddRange

func (v Values) AddRange(key string, values ...string)

AddRange adds multiple values to a key. It appends to any existing values associated with key.

func (Values) Del

func (v Values) Del(key string)

Del deletes the value associated with key.

func (Values) Encode

func (v Values) Encode() string

Encode encodes the values into “URL encoded” form ("bar=baz&foo=quux") sorted by key. Encode is a slightly modified version of Values.Encode() from net/url. It encodes url.Values into URL encoded form, sorted by key, with the exception of the key "token", which will be appended to the end instead of being subject to regular sorting. This is done in accordance with MW API guidelines to ensure that an action will not be executed if the query string has been cut off for some reason.

func (Values) EncodeMultipart

func (v Values) EncodeMultipart() (data string, contentType string, err error)

EncodeMultipart returns a “multipart encoded” version of the parameters as a string, along with a Content-Type header string to use, and an error if something somehow goes dramatically wrong.

func (Values) Get

func (v Values) Get(key string) string

Get gets the value associated with the given key. If there are no values associated with the key, Get returns the empty string.

func (Values) Set

func (v Values) Set(key, value string)

Set sets the key to value. It replaces any existing values.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL