mmclient

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderEtagClient = "If-None-Match"
	HeaderAuth       = "Authorization"

	APIPathPP      = "/api/v1"
	APIUrlSuffixV4 = "/api/v4"
	APIUrlSuffix   = APIUrlSuffixV4
	AppsPluginName = "com.mattermost.apps"
)

Variables

This section is empty.

Functions

func StringInterfaceFromJSON

func StringInterfaceFromJSON(data io.Reader) map[string]interface{}

func StringInterfaceToJSON

func StringInterfaceToJSON(objmap map[string]interface{}) string

Types

type Client

type Client struct {
	*model.Client4
	*ClientPP
	// contains filtered or unexported fields
}

func AsActingUser

func AsActingUser(cc *apps.Context) *Client

func AsAdmin

func AsAdmin(cc *apps.Context) *Client

func AsBot

func AsBot(cc *apps.Context) *Client

func NewClient

func NewClient(userID, token, mattermostSiteURL string) *Client

func (*Client) CreatePost

func (client *Client) CreatePost(post *model.Post) (*model.Post, error)

func (*Client) DM

func (client *Client) DM(userID string, format string, args ...interface{})

func (*Client) DMPost

func (client *Client) DMPost(userID string, post *model.Post) (*model.Post, error)

func (*Client) KVDelete

func (client *Client) KVDelete(id string, prefix string) (bool, error)

func (*Client) KVGet

func (client *Client) KVGet(id string, prefix string) (map[string]interface{}, error)

func (*Client) KVSet

func (client *Client) KVSet(id string, prefix string, in map[string]interface{}) (map[string]interface{}, error)

func (*Client) Subscribe

func (client *Client) Subscribe(sub *apps.Subscription) (*apps.SubscriptionResponse, error)

func (*Client) Unsubscribe

func (client *Client) Unsubscribe(sub *apps.Subscription) (*apps.SubscriptionResponse, error)

type ClientPP

type ClientPP struct {
	URL        string       // The location of the server, for example  "http://localhost:8065"
	APIURL     string       // The api location of the server, for example "http://localhost:8065/api/v4"
	HTTPClient *http.Client // The http client
	AuthToken  string
	AuthType   string
	HTTPHeader map[string]string // Headers to be copied over for each request
	// contains filtered or unexported fields
}

func NewAPIClientPP

func NewAPIClientPP(url string) *ClientPP

func (*ClientPP) DoAPIDELETE

func (c *ClientPP) DoAPIDELETE(url string) (*http.Response, *model.AppError)

func (*ClientPP) DoAPIGET

func (c *ClientPP) DoAPIGET(url string, etag string) (*http.Response, *model.AppError)

func (*ClientPP) DoAPIPOST

func (c *ClientPP) DoAPIPOST(url string, data string) (*http.Response, *model.AppError)

func (*ClientPP) DoAPIRequest

func (c *ClientPP) DoAPIRequest(method, url, data, etag string) (*http.Response, *model.AppError)

func (*ClientPP) GetPluginRoute

func (c *ClientPP) GetPluginRoute(pluginID string) string

func (*ClientPP) GetPluginsRoute

func (c *ClientPP) GetPluginsRoute() string

func (*ClientPP) KVDelete

func (c *ClientPP) KVDelete(id string, prefix string) (bool, *model.Response)

func (*ClientPP) KVGet

func (c *ClientPP) KVGet(id string, prefix string) (map[string]interface{}, *model.Response)

func (*ClientPP) KVSet

func (c *ClientPP) KVSet(id string, prefix string, in map[string]interface{}) (map[string]interface{}, *model.Response)

func (*ClientPP) Subscribe

func (c *ClientPP) Subscribe(request *apps.Subscription) (*apps.SubscriptionResponse, *model.Response)

func (*ClientPP) Unsubscribe

func (c *ClientPP) Unsubscribe(request *apps.Subscription) (*apps.SubscriptionResponse, *model.Response)

Jump to

Keyboard shortcuts

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