madon.go
author Mikael Berthe <mikael@lilotux.net>
Fri, 28 Apr 2017 15:43:11 +0200
changeset 149 5f922977d7c7
parent 145 d7ccfe67fa9e
child 151 f87b6ca9de6d
permissions -rw-r--r--
Add support for limits and paging ({since,max}_id) API parameters

/*
Copyright 2017 Ollivier Robert
Copyright 2017 Mikael Berthe

Licensed under the MIT license.  Please see the LICENSE file is this directory.
*/

package madon

import (
	"errors"
)

// LimitParams contains common limit/paging options for the Mastodon REST API
type LimitParams struct {
	SinceID, MaxID, Limit int
}

// apiCallParams is a map with the parameters for an API call
type apiCallParams map[string]string

const (
	// MadonVersion contains the version of the Madon library
	MadonVersion = "1.0"

	// API version implemented in this library
	apiVersion     = "v1"
	currentAPIPath = "/api/" + apiVersion

	// NoRedirect is the URI for no redirection in the App registration
	NoRedirect = "urn:ietf:wg:oauth:2.0:oob"
)

// Error codes
var (
	ErrUninitializedClient = errors.New("use of uninitialized madon client")
	ErrAlreadyRegistered   = errors.New("app already registered")
	ErrEntityNotFound      = errors.New("entity not found")
	ErrInvalidParameter    = errors.New("incorrect parameter")
	ErrInvalidID           = errors.New("incorrect entity ID")
)