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 ¶
- type Values
- func (v Values) Add(key, value string)
- func (v Values) AddRange(key string, values ...string)
- func (v Values) Del(key string)
- func (v Values) Encode() string
- func (v Values) EncodeMultipart() (data string, contentType string, err error)
- func (v Values) Get(key string) string
- func (v Values) Set(key, value string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Values ¶
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 ¶
Add adds the value to key. It appends to any existing values associated with key.
func (Values) AddRange ¶
AddRange adds multiple values to a key. It appends to any existing values associated with key.
func (Values) Encode ¶
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 ¶ added in v1.2.0
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.