httpin

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const AppIDPath = "/{appid}"
View Source
const AppIDVar = "appid"
View Source
const (
	// MaxKVStoreValueLength is the maximum length in bytes that a value in the KV store of an app can contain
	MaxKVStoreValueLength = 8192
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppMetadataForClient added in v1.2.0

type AppMetadataForClient struct {
	BotUserID   string `json:"bot_user_id,omitempty"`
	BotUsername string `json:"bot_username,omitempty"`
}

type CallResponse added in v1.2.0

type CallResponse struct {
	apps.CallResponse

	// Used to provide info about the App to client, e.g. the bot user id
	AppMetadata AppMetadataForClient `json:"app_metadata"`
}

CallResponse contains everything the CallResponse struct contains, plus some additional data for the client, such as information about the App's bot account.

Apps will use the CallResponse struct to respond to a CallRequest, and the proxy will decorate the response using the CallResponse to provide additional information.

type Service

type Service struct {
	AppServices appservices.Service
	Config      config.Service
	Proxy       proxy.Service
	// contains filtered or unexported fields
}

func NewService

func NewService(proxy proxy.Service, appservices appservices.Service, conf config.Service) *Service

func (*Service) Call added in v1.2.0

func (s *Service) Call(r *incoming.Request, w http.ResponseWriter, req *http.Request)

Call handles a call request for an App.

Path: /api/v1/call
Method: POST
Input: CallRequest
Output: CallResponse

func (*Service) DisableApp added in v1.2.0

func (s *Service) DisableApp(r *incoming.Request, w http.ResponseWriter, req *http.Request)

DisableApp disables an App .

Path: /api/v1/disable-app
Method: POST
Input: JSON {app_id}
Output: text message of operation's success.

func (*Service) EnableApp added in v1.2.0

func (s *Service) EnableApp(r *incoming.Request, w http.ResponseWriter, req *http.Request)

EnableApp enables an App .

Path: /api/v1/enable-app
Method: POST
Input: JSON {app_id}
Output: text message of operation's success.

func (*Service) GetApp added in v1.2.0

func (s *Service) GetApp(r *incoming.Request, w http.ResponseWriter, req *http.Request)

GetApp returns the App's record. If requestor is a system administrator, the raw record with secrets is returned, otherwise the output is sanitized.

Path: /apps/{AppID}
Method: GET
Input: none
Output: App

func (*Service) GetBindings added in v1.2.0

func (s *Service) GetBindings(r *incoming.Request, w http.ResponseWriter, req *http.Request)

GetBindings returns combined bindings for all Apps.

Path: /api/v1/bindings
Method: GET
Input: none
Output: []Binding

func (*Service) GetBotIDs added in v1.2.0

func (s *Service) GetBotIDs(r *incoming.Request, w http.ResponseWriter, req *http.Request)

GetBotIDs returns the list of all Apps' bot user IDs.

Path: /api/v1/bot-ids
Method: GET
Input: none
Output: []string - the list of Bot user IDs for all installed Apps.

func (*Service) GetMarketplace added in v1.2.0

func (s *Service) GetMarketplace(r *incoming.Request, w http.ResponseWriter, req *http.Request)

func (*Service) GetOAuthAppIDs added in v1.2.0

func (s *Service) GetOAuthAppIDs(r *incoming.Request, w http.ResponseWriter, req *http.Request)

GetBindings returns combined bindings for all Apps.

Path: /api/v1/get-oauth-app-ids
Method: GET
Input: none
Output: []string - the list of OAuth ClientIDs for all installed Apps.

func (*Service) GetSubscriptions added in v1.2.0

func (s *Service) GetSubscriptions(r *incoming.Request, w http.ResponseWriter, req *http.Request)

GetSubscriptions returns a users current list of subscriptions.

Path: /api/v1/subscribe
Method: GET
Input: None
Output: []Subscription

func (*Service) HandleFunc added in v1.2.0

func (s *Service) HandleFunc(path string, handlerFunc handlerFunc) *mux.Route

func (*Service) InstallApp added in v1.2.0

func (s *Service) InstallApp(r *incoming.Request, w http.ResponseWriter, req *http.Request)

InstallApp installs an App that is already deployed, either locally or in the Marketplace (if applicable).

Path: /api/v1/install-app
Method: POST
Input: JSON {app_id, deploy_type}
Output: JSON, unsanitized App record

func (*Service) KVDelete added in v1.2.0

func (s *Service) KVDelete(r *incoming.Request, w http.ResponseWriter, req *http.Request)

KVDelete removes a (App-specific) value from the KV store.

Path: /api/v1/kv/[{prefix}/]{key}
Methods: DELETE
Input: none
Output: none

func (*Service) KVGet added in v1.2.0

func (s *Service) KVGet(r *incoming.Request, w http.ResponseWriter, req *http.Request)

KVGet returns a value stored by the App in the KV store.

Path: /api/v1/kv/[{prefix}/]{key}
Method: GET
Input: none
Output: a JSON object

func (*Service) KVPut added in v1.2.0

func (s *Service) KVPut(r *incoming.Request, w http.ResponseWriter, req *http.Request)

KVPut stores an App-provided JSON document in the KV store.

Path: /api/v1/kv/[{prefix}/]{key}
Methods: POST, PUT
Output: a JSON object
Output:
  changed: set to true if the key value was changed.

func (*Service) OAuth2GetUser added in v1.2.0

func (s *Service) OAuth2GetUser(r *incoming.Request, w http.ResponseWriter, req *http.Request)

func (*Service) OAuth2StoreApp added in v1.2.0

func (s *Service) OAuth2StoreApp(r *incoming.Request, w http.ResponseWriter, req *http.Request)

func (*Service) OAuth2StoreUser added in v1.2.0

func (s *Service) OAuth2StoreUser(r *incoming.Request, w http.ResponseWriter, req *http.Request)

func (*Service) PathPrefix added in v1.2.0

func (s *Service) PathPrefix(prefix string) *Service

func (*Service) Ping added in v1.2.0

func (s *Service) Ping(r *incoming.Request, w http.ResponseWriter, req *http.Request)

func (*Service) RemoteOAuth2Complete added in v1.2.0

func (s *Service) RemoteOAuth2Complete(r *incoming.Request, w http.ResponseWriter, req *http.Request)

func (*Service) RemoteOAuth2Connect added in v1.2.0

func (s *Service) RemoteOAuth2Connect(r *incoming.Request, w http.ResponseWriter, req *http.Request)

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP is the go http.Handler (mux compliant).

func (*Service) ServePluginHTTP added in v1.2.0

func (s *Service) ServePluginHTTP(c *plugin.Context, w http.ResponseWriter, req *http.Request)

ServePluginHTTP is the interface invoked from the plugin's ServeHTTP

func (*Service) Static added in v1.2.0

func (s *Service) Static(r *incoming.Request, w http.ResponseWriter, req *http.Request)

func (*Service) Subscribe added in v1.2.0

func (s *Service) Subscribe(r *incoming.Request, w http.ResponseWriter, req *http.Request)

Subscribe starts or updates an App subscription to Mattermost events.

Path: /api/v1/subscribe
Method: POST
Input: Subscription
Output: None

func (*Service) UninstallApp added in v1.2.0

func (s *Service) UninstallApp(r *incoming.Request, w http.ResponseWriter, req *http.Request)

UninstallApp uninstalls an App .

Path: /api/v1/uninstall-app
Method: POST
Input: JSON {app_id}
Output: None

func (*Service) Unsubscribe added in v1.2.0

func (s *Service) Unsubscribe(r *incoming.Request, w http.ResponseWriter, req *http.Request)

Unsubscribe removes an App's subscription to Mattermost events.

Path: /api/v1/unsubscribe
Method: POST
Input: Subscription
Output: None

func (*Service) UpdateAppListing added in v1.2.0

func (s *Service) UpdateAppListing(r *incoming.Request, w http.ResponseWriter, req *http.Request)

UpdateAppListing adds (or updates) the specified Manifest to the local manifest store, making the App installable. The resulting listed manifest will combine the deployment information from the prior listing, and the new manifests as follows:

  1. The "core" manifest (except Deploy) is updated to the new values.
  2. Deploy types from the previously listed manifest are updated from the new manifest, or preserved.
  3. Deploy types specified in "add_deploys" are copied from the new manifest.
  4. "remove"

_

Path: /api/v1/add-listed-app
Method: POST
Input: JSON{
	Manifest...
	"add_deploys": []string e.g. ["aws_lambda","http"]
	"remove_deploys": []string e.g. ["aws_lambda","http"]
}
Output: The updated listing manifest

func (*Service) Webhook added in v1.2.0

func (s *Service) Webhook(r *incoming.Request, w http.ResponseWriter, req *http.Request)

func (*Service) WebhookValidateAuthentication added in v1.2.0

func (s *Service) WebhookValidateAuthentication(r *incoming.Request, w http.ResponseWriter, req *http.Request)

type VersionInfo added in v1.2.0

type VersionInfo struct {
	Version string `json:"version"`
}

Jump to

Keyboard shortcuts

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