Merge pull request #743 from vector-im/make-hsapi-public

Make hs api public
This commit is contained in:
Robert Long 2022-06-13 22:36:00 -07:00 committed by GitHub
commit 4a2ea5f7f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 5 deletions

View File

@ -19,7 +19,7 @@ export type {ILogItem} from "./logging/types";
export {IDBLogPersister} from "./logging/IDBLogPersister";
export {ConsoleReporter} from "./logging/ConsoleReporter";
export {Platform} from "./platform/web/Platform.js";
export {Client, LoadStatus} from "./matrix/Client.js";
export {Client, LoadStatus, LoginFailure} from "./matrix/Client.js";
export {RoomStatus} from "./matrix/room/common";
export {AttachmentUpload} from "./matrix/room/AttachmentUpload";
export {CallIntent} from "./matrix/calls/callEventTypes";

View File

@ -133,6 +133,14 @@ export class Session {
this.needsKeyBackup = new ObservableValue(false);
}
get hsApi() {
return this._hsApi;
}
get sessionInfo() {
return this._sessionInfo;
}
get fingerprintKey() {
return this._e2eeAccount?.identityKeys.ed25519;
}

View File

@ -302,6 +302,14 @@ export class HomeServerApi {
return this._get(`/profile/${encodeURIComponent(userId)}`);
}
setProfileDisplayName(userId, displayName, options?: BaseRequestOptions): IHomeServerRequest {
return this._put(`/profile/${encodeURIComponent(userId)}/displayname`, {}, { displayname: displayName }, options);
}
setProfileAvatarUrl(userId, avatarUrl, options?: BaseRequestOptions): IHomeServerRequest {
return this._put(`/profile/${encodeURIComponent(userId)}/avatar_url`, {}, { avatar_url: avatarUrl }, options);
}
createRoom(payload: Record<string, any>, options?: BaseRequestOptions): IHomeServerRequest {
return this._post(`/createRoom`, {}, payload, options);
}

View File

@ -151,9 +151,10 @@ export class RoomBeingCreated extends EventEmitter<{change: never}> {
createOptions.room_alias_name = this.options.alias;
}
if (this.options.type !== undefined) {
createOptions.creation_content = {
type: this.options.type === RoomType.World ? "org.matrix.msc3815.world" : undefined,
};
let type: string | undefined = undefined;
if (this.options.type === RoomType.World) type = "org.matrix.msc3815.world";
if (this.options.type === RoomType.Profile) type = "org.matrix.msc3815.profile";
createOptions.creation_content = { type };
}
if (this.options.isFederationDisabled === true) {
if (createOptions.creation_content === undefined) createOptions.creation_content = {};

View File

@ -48,7 +48,8 @@ export enum RoomVisibility {
}
export enum RoomType {
World
World,
Profile,
}
type RoomResponse = {