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
- Variables
- func RetrieveUserProfile(ctx context.Context, userID string, asAPI AppServiceInternalAPI, ...) (*authtypes.Profile, error)
- type ASLocationResponse
- type ASProtocolResponse
- type ASUserResponse
- type AppServiceInternalAPI
- type FieldType
- type LocationRequest
- type LocationResponse
- type ProtocolInstance
- type ProtocolRequest
- type ProtocolResponse
- type RoomAliasExistsRequest
- type RoomAliasExistsResponse
- type UserIDExistsRequest
- type UserIDExistsRequestAccessToken
- type UserIDExistsResponse
- type UserRequest
- type UserResponse
Constants ¶
const ( ASProtocolLegacyPath = "/_matrix/app/unstable/thirdparty/protocol/" ASUserLegacyPath = "/_matrix/app/unstable/thirdparty/user" ASLocationLegacyPath = "/_matrix/app/unstable/thirdparty/location" ASRoomAliasExistsLegacyPath = "/rooms/" ASUserExistsLegacyPath = "/users/" ASProtocolPath = "/_matrix/app/v1/thirdparty/protocol/" ASUserPath = "/_matrix/app/v1/thirdparty/user" ASLocationPath = "/_matrix/app/v1/thirdparty/location" ASRoomAliasExistsPath = "/_matrix/app/v1/rooms/" ASUserExistsPath = "/_matrix/app/v1/users/" )
Variables ¶
var ErrProfileNotExists = errors.New("no known profile for given user ID")
ErrProfileNotExists is returned when trying to lookup a user's profile that doesn't exist locally.
Functions ¶
func RetrieveUserProfile ¶
func RetrieveUserProfile( ctx context.Context, userID string, asAPI AppServiceInternalAPI, profileAPI userapi.ProfileAPI, ) (*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 ¶
type ASLocationResponse struct { Alias string `json:"alias"` Protocol string `json:"protocol"` Fields json.RawMessage `json:"fields"` }
type ASProtocolResponse ¶
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 ¶
type ASUserResponse struct { Protocol string `json:"protocol"` UserID string `json:"userid"` Fields json.RawMessage `json:"fields"` }
type AppServiceInternalAPI ¶
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 LocationRequest ¶
type LocationResponse ¶
type LocationResponse struct { Locations []ASLocationResponse `json:"locations,omitempty"` Exists bool `json:"exists,omitempty"` }
type ProtocolInstance ¶
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 ¶
type ProtocolRequest struct {
Protocol string `json:"protocol,omitempty"`
}
type ProtocolResponse ¶
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 ¶
type UserResponse ¶
type UserResponse struct { Users []ASUserResponse `json:"users,omitempty"` Exists bool `json:"exists,omitempty"` }