api

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: Apache-2.0 Imports: 6 Imported by: 36

Documentation

Overview

Package api contains methods used by dendrite components in multi-process mode to send requests to the appservice component, typically in order to ask an application service for some information.

Index

Constants

View Source
const (
	ASProtocolPath = "/_matrix/app/unstable/thirdparty/protocol/"
	ASUserPath     = "/_matrix/app/unstable/thirdparty/user"
	ASLocationPath = "/_matrix/app/unstable/thirdparty/location"
)

Variables

This section is empty.

Functions

func RetrieveUserProfile

func RetrieveUserProfile(
	ctx context.Context,
	userID string,
	asAPI AppServiceInternalAPI,
	profileAPI userapi.ClientUserAPI,
) (*authtypes.Profile, error)

RetrieveUserProfile is a wrapper that queries both the local database and application services for a given user's profile TODO: Remove this, it's called from federationapi and clientapi but is a pure function

Types

type ASLocationResponse added in v0.10.7

type ASLocationResponse struct {
	Alias    string          `json:"alias"`
	Protocol string          `json:"protocol"`
	Fields   json.RawMessage `json:"fields"`
}

type ASProtocolResponse added in v0.10.7

type ASProtocolResponse struct {
	FieldTypes     map[string]FieldType `json:"field_types,omitempty"` // NOTSPEC: field_types is required by the spec
	Icon           string               `json:"icon"`
	Instances      []ProtocolInstance   `json:"instances"`
	LocationFields []string             `json:"location_fields"`
	UserFields     []string             `json:"user_fields"`
}

type ASUserResponse added in v0.10.7

type ASUserResponse struct {
	Protocol string          `json:"protocol"`
	UserID   string          `json:"userid"`
	Fields   json.RawMessage `json:"fields"`
}

type AppServiceInternalAPI added in v0.8.3

type AppServiceInternalAPI interface {
	// Check whether a room alias exists within any application service namespaces
	RoomAliasExists(
		ctx context.Context,
		req *RoomAliasExistsRequest,
		resp *RoomAliasExistsResponse,
	) error
	// Check whether a user ID exists within any application service namespaces
	UserIDExists(
		ctx context.Context,
		req *UserIDExistsRequest,
		resp *UserIDExistsResponse,
	) error

	Locations(ctx context.Context, req *LocationRequest, resp *LocationResponse) error
	User(ctx context.Context, request *UserRequest, response *UserResponse) error
	Protocols(ctx context.Context, req *ProtocolRequest, resp *ProtocolResponse) error
}

AppServiceInternalAPI is used to query user and room alias data from application services

type FieldType added in v0.10.7

type FieldType struct {
	Placeholder string `json:"placeholder"`
	Regexp      string `json:"regexp"`
}

type LocationRequest added in v0.10.7

type LocationRequest struct {
	Protocol string `json:"protocol"`
	Params   string `json:"params"`
}

type LocationResponse added in v0.10.7

type LocationResponse struct {
	Locations []ASLocationResponse `json:"locations,omitempty"`
	Exists    bool                 `json:"exists,omitempty"`
}

type ProtocolInstance added in v0.10.7

type ProtocolInstance struct {
	Description string          `json:"desc"`
	Icon        string          `json:"icon,omitempty"`
	NetworkID   string          `json:"network_id,omitempty"` // NOTSPEC: network_id is required by the spec
	Fields      json.RawMessage `json:"fields,omitempty"`     // NOTSPEC: fields is required by the spec
}

type ProtocolRequest added in v0.10.7

type ProtocolRequest struct {
	Protocol string `json:"protocol,omitempty"`
}

type ProtocolResponse added in v0.10.7

type ProtocolResponse struct {
	Protocols map[string]ASProtocolResponse `json:"protocols"`
	Exists    bool                          `json:"exists"`
}

type RoomAliasExistsRequest

type RoomAliasExistsRequest struct {
	// Alias we want to lookup
	Alias string `json:"alias"`
}

RoomAliasExistsRequest is a request to an application service about whether a room alias exists

type RoomAliasExistsResponse

type RoomAliasExistsResponse struct {
	AliasExists bool `json:"exists"`
}

RoomAliasExistsResponse is a response from an application service about whether a room alias exists

type UserIDExistsRequest

type UserIDExistsRequest struct {
	// UserID we want to lookup
	UserID string `json:"user_id"`
}

UserIDExistsRequest is a request to an application service about whether a user ID exists

type UserIDExistsRequestAccessToken

type UserIDExistsRequestAccessToken struct {
	// UserID we want to lookup
	UserID      string `json:"user_id"`
	AccessToken string `json:"access_token"`
}

UserIDExistsRequestAccessToken is a request to an application service about whether a user ID exists. Includes an access token

type UserIDExistsResponse

type UserIDExistsResponse struct {
	UserIDExists bool `json:"exists"`
}

UserIDExistsResponse is a response from an application service about whether a user ID exists

type UserRequest added in v0.10.7

type UserRequest struct {
	Protocol string `json:"protocol"`
	Params   string `json:"params"`
}

type UserResponse added in v0.10.7

type UserResponse struct {
	Users  []ASUserResponse `json:"users,omitempty"`
	Exists bool             `json:"exists,omitempty"`
}

Jump to

Keyboard shortcuts

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