mmclient

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

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

	AppsPluginName = "com.mattermost.apps"
)
View Source
const (
	// Top-level path
	PathAPI = "/api/v1"

	// Other sub-paths.
	PathKV          = "/kv"
	PathSubscribe   = "/subscribe"
	PathUnsubscribe = "/unsubscribe"

	PathBotIDs      = "/bot-ids"
	PathOAuthAppIDs = "/oauth-app-ids"

	PathOAuth2App         = "/oauth2/app"
	PathOAuth2User        = "/oauth2/user"
	PathOAuth2CreateState = "/oauth2/create-state"
)

Paths for the REST APIs exposed by the proxy plugin itself

Variables

This section is empty.

Functions

This section is empty.

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 (c *Client) CreatePost(post *model.Post) (*model.Post, error)

func (*Client) DM

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

func (*Client) DMPost

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

func (*Client) GetOAuth2User added in v0.3.0

func (c *Client) GetOAuth2User(appID apps.AppID, ref interface{}) error

func (*Client) KVDelete

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

func (*Client) KVGet

func (c *Client) KVGet(id string, prefix string, ref interface{}) error

func (*Client) KVSet

func (c *Client) KVSet(id string, prefix string, in interface{}) (interface{}, error)

func (*Client) StoreOAuth2App added in v0.3.0

func (c *Client) StoreOAuth2App(appID apps.AppID, clientID, clientSecret string) error

func (*Client) StoreOAuth2User added in v0.3.0

func (c *Client) StoreOAuth2User(appID apps.AppID, ref interface{}) error

func (*Client) Subscribe

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

func (*Client) Unsubscribe

func (c *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) GetOAuth2User added in v0.3.0

func (c *ClientPP) GetOAuth2User(appID apps.AppID, ref interface{}) *model.Response

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, ref interface{}) *model.Response

func (*ClientPP) KVSet

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

func (*ClientPP) SetOAuthToken added in v0.3.0

func (c *ClientPP) SetOAuthToken(token string)

func (*ClientPP) StoreOAuth2App added in v0.3.0

func (c *ClientPP) StoreOAuth2App(appID apps.AppID, clientID, clientSecret string) *model.Response

func (*ClientPP) StoreOAuth2User added in v0.3.0

func (c *ClientPP) StoreOAuth2User(appID apps.AppID, ref 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