mw

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLogin = errors.New("ErrLogin")
View Source
var FIRST_RUN = ""
View Source
var MAP_MW_ERROR_WARNING = map[UploadWarning]string{
	UPLOAD_WARNING_SAME_FILE_NO_CHANGE: "fileexists-no-change",
}

Functions

func NewStateForGetAllPages

func NewStateForGetAllPages() map[string]string

Types

type ApiCredentials

type ApiCredentials struct {
	CsrfToken   *CsrfToken
	LoginResult *LoginResult
}

func GetApiCredentials

func GetApiCredentials(config *Config, hook *HookOptions) (*ApiCredentials, error)

type Config

type Config struct {
	BaseAddress string
	Login       string
	Password    string
}

type CsrfToken

type CsrfToken struct {
	Token string
}

type EditResult

type EditResult struct {
	Success bool
}

func Edit

func Edit(
	config *Config,
	credentials *ApiCredentials,
	title string,
	content string,
	summary string,
	hook *HookOptions,
) (*EditResult, error)

type HookOptions

type HookOptions struct {
	BeforeRequest        func(string)
	AfterRequest         func(map[string]string)
	OnReceivedLoginToken func(map[string]string)
	OnLogin              func(map[string]string)
	OnCsrf               func(map[string]string)
}

type Image

type Image struct {
	Name    string
	Content []byte
}

func GetAllImages

func GetAllImages(config *Config, credentials *ApiCredentials, continuation string, hook *HookOptions) ([]Image, string, bool, error)

type LoginResult

type LoginResult struct {
	Cookie string
}

type LoginTokenSet

type LoginTokenSet struct {
	Token  string
	Cookie string
}

type Page

type Page struct {
	Name    string
	Content string
	Exists  bool
}

func GetAllPages

func GetAllPages(
	config *Config,
	credentials *ApiCredentials,
	stateSerialized map[string]string,
	hook *HookOptions) ([]Page, map[string]string, bool, error)

func GetPage

func GetPage(config *Config, credentials *ApiCredentials, title string, hook *HookOptions) (*Page, error)

type StateGetAllPages

type StateGetAllPages struct {
	FirstRun   bool
	Namespaces []string
	ApContinue string
}

type UploadResult

type UploadResult struct {
	Success bool
}

type UploadWarning

type UploadWarning int
const (
	UPLOAD_WARNING_NONE                UploadWarning = iota
	UPLOAD_WARNING_SAME_FILE_NO_CHANGE               = iota
)

func Upload

func Upload(config *Config, credentials *ApiCredentials, fileName string, fileContent io.Reader) (error, []UploadWarning, bool)

Jump to

Keyboard shortcuts

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