You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-05 00:42:10 +03:00
types: improve types for registration calls (#2390)
This commit is contained in:
committed by
GitHub
parent
e81d84502b
commit
a9516d047f
@@ -633,6 +633,19 @@ interface IJoinedMembersResponse {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IRegisterRequestParams {
|
||||||
|
auth?: IAuthData;
|
||||||
|
username?: string;
|
||||||
|
password?: string;
|
||||||
|
refresh_token?: boolean;
|
||||||
|
guest_access_token?: string;
|
||||||
|
x_show_msisdn?: boolean;
|
||||||
|
bind_msisdn?: boolean;
|
||||||
|
bind_email?: boolean;
|
||||||
|
inhibit_login?: boolean;
|
||||||
|
initial_device_display_name?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IPublicRoomsChunkRoom {
|
export interface IPublicRoomsChunkRoom {
|
||||||
room_id: string;
|
room_id: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
@@ -6846,7 +6859,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|||||||
guestAccessToken?: string,
|
guestAccessToken?: string,
|
||||||
inhibitLogin?: boolean,
|
inhibitLogin?: boolean,
|
||||||
callback?: Callback,
|
callback?: Callback,
|
||||||
): Promise<any> { // TODO: Types (many)
|
): Promise<IAuthData> {
|
||||||
// backwards compat
|
// backwards compat
|
||||||
if (bindThreepids === true) {
|
if (bindThreepids === true) {
|
||||||
bindThreepids = { email: true };
|
bindThreepids = { email: true };
|
||||||
@@ -6862,7 +6875,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|||||||
auth.session = sessionId;
|
auth.session = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const params: any = {
|
const params: IRegisterRequestParams = {
|
||||||
auth: auth,
|
auth: auth,
|
||||||
refresh_token: true, // always ask for a refresh token - does nothing if unsupported
|
refresh_token: true, // always ask for a refresh token - does nothing if unsupported
|
||||||
};
|
};
|
||||||
@@ -6933,8 +6946,8 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
|||||||
* @return {Promise} Resolves: to the /register response
|
* @return {Promise} Resolves: to the /register response
|
||||||
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||||
*/
|
*/
|
||||||
public registerRequest(data: any, kind?: string, callback?: Callback): Promise<any> { // TODO: Types
|
public registerRequest(data: IRegisterRequestParams, kind?: string, callback?: Callback): Promise<IAuthData> {
|
||||||
const params: any = {};
|
const params: { kind?: string } = {};
|
||||||
if (kind) {
|
if (kind) {
|
||||||
params.kind = kind;
|
params.kind = kind;
|
||||||
}
|
}
|
||||||
|
@@ -46,9 +46,16 @@ export interface IAuthData {
|
|||||||
session?: string;
|
session?: string;
|
||||||
completed?: string[];
|
completed?: string[];
|
||||||
flows?: IFlow[];
|
flows?: IFlow[];
|
||||||
|
available_flows?: IFlow[];
|
||||||
|
stages?: string[];
|
||||||
|
required_stages?: AuthType[];
|
||||||
params?: Record<string, Record<string, any>>;
|
params?: Record<string, Record<string, any>>;
|
||||||
|
data?: Record<string, string>;
|
||||||
errcode?: string;
|
errcode?: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
|
user_id?: string;
|
||||||
|
device_id?: string;
|
||||||
|
access_token?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum AuthType {
|
export enum AuthType {
|
||||||
|
Reference in New Issue
Block a user