MCPcopy Index your code
hub / github.com/cgt/go-mwclient

github.com/cgt/go-mwclient @v1.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.3.0 ↗ · + Follow
85 symbols 269 edges 12 files 49 documented · 58% updated 2y ago★ 513 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

go-mwclient

go-mwclient is a Go package for interacting with the MediaWiki JSON API.

go-mwclient aims to be a thin wrapper around the MediaWiki API that takes care of the most tedious parts of interacting with the API (such as authentication and query continuation), but it does not aim to abstract away all the functionality of the API.

go-mwclient v1 uses version 2 of the MediaWiki JSON API.

The canonical import path for this package is

import cgt.name/pkg/go-mwclient // imports "mwclient"

Documentation: - GoDoc: http://godoc.org/cgt.name/pkg/go-mwclient - MediaWiki API docs: https://www.mediawiki.org/wiki/API:Main_page

As of v1.0.0, go-mwclient uses semantic versioning. The master branch contains the most recent v1.x.x release.

Installation

go get -u cgt.name/pkg/go-mwclient

Example

package main

import (
    "fmt"

    "cgt.name/pkg/go-mwclient"
)

func main() {
    // Initialize a *Client with New(), specifying the wiki's API URL
    // and your HTTP User-Agent. Try to use a meaningful User-Agent.
    w, err := mwclient.New("https://en.wikipedia.org/w/api.php", "myWikibot")
    if err != nil {
        panic(err)
    }

    // Log in.
    err = w.Login("USERNAME", "PASSWORD")
    if err != nil {
        panic(err)
    }

    // Specify parameters to send.
    parameters := map[string]string{
        "action":   "query",
        "list":     "recentchanges",
        "rclimit":  "2",
        "rctype":   "edit",
        "continue": "",
    }

    // Make the request.
    resp, err := w.Get(parameters)
    if err != nil {
        panic(err)
    }

    // Print the *jason.Object
    fmt.Println(resp)
}

Dependencies

Other than the standard library, go-mwclient depends on the following third party, open source packages:

Copyright

To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.

You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see http://creativecommons.org/publicdomain/zero/1.0/.

params package

The params package is based on the net/url package from the Go standard library, which is released under a BSD-style license. See params/LICENSE.

Contributions to the params package as part of this project are released to the public domain via CC0, as noted above and specified in the COPYING file.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Get
called by 30
core.go
Set
called by 16
params/params.go
Get
called by 11
params/params.go
Encode
called by 10
params/params.go
call
called by 8
core.go
Add
called by 8
params/params.go
Error
called by 7
errors.go
AddRange
called by 5
params/params.go

Shape

Method 39
Function 32
Struct 9
TypeAlias 4
FuncType 1

Languages

Go100%

Modules by API surface

core.go19 symbols
edit.go11 symbols
core_test.go11 symbols
errors.go10 symbols
params/params.go9 symbols
params/params_test.go8 symbols
edit_test.go7 symbols
query.go5 symbols
misc.go2 symbols
errors_test.go2 symbols
query_test.go1 symbols

For agents

$ claude mcp add go-mwclient \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact