diff --git a/spec/integ/matrix-client-methods.spec.ts b/spec/integ/matrix-client-methods.spec.ts index a665aef86..21d224150 100644 --- a/spec/integ/matrix-client-methods.spec.ts +++ b/spec/integ/matrix-client-methods.spec.ts @@ -1336,18 +1336,25 @@ describe("MatrixClient", function () { it.each([ { userId: "alice@localhost", + powerLevel: 100, expectation: { "alice@localhost": 100, }, }, { userId: ["alice@localhost", "bob@localhost"], + powerLevel: 100, expectation: { "alice@localhost": 100, "bob@localhost": 100, }, }, - ])("should modify power levels of $userId correctly", async ({ userId, expectation }) => { + { + userId: "alice@localhost", + powerLevel: undefined, + expectation: {}, + }, + ])("should modify power levels of $userId correctly", async ({ userId, powerLevel, expectation }) => { const event = { getType: () => "m.room.power_levels", getContent: () => ({ @@ -1364,7 +1371,7 @@ describe("MatrixClient", function () { }) .respond(200, {}); - const prom = client!.setPowerLevel("!room_id:server", userId, 100, event); + const prom = client!.setPowerLevel("!room_id:server", userId, powerLevel, event); await httpBackend!.flushAllExpected(); await prom; }); diff --git a/src/@types/IIdentityServerProvider.ts b/src/@types/IIdentityServerProvider.ts index 05793d53a..8e3049740 100644 --- a/src/@types/IIdentityServerProvider.ts +++ b/src/@types/IIdentityServerProvider.ts @@ -20,5 +20,5 @@ export interface IIdentityServerProvider { * for the associated client. * @returns Promise which resolves to the access token. */ - getAccessToken(): Promise; + getAccessToken(): Promise; } diff --git a/src/client.ts b/src/client.ts index 5ea515fe9..d46116675 100644 --- a/src/client.ts +++ b/src/client.ts @@ -4130,7 +4130,7 @@ export class MatrixClient extends TypedEventEmitter { let content = { @@ -4141,13 +4141,16 @@ export class MatrixClient extends TypedEventEmitter { - // TODO: Types - const params = { + ): Promise { + const params: Record = { client_secret: clientSecret, email: email, send_attempt: sendAttempt?.toString(), - next_link: nextLink, }; + if (nextLink) { + params.next_link = nextLink; + } - return this.http.idServerRequest( + return this.http.idServerRequest( Method.Post, "/validate/email/requestToken", params, @@ -8788,7 +8792,7 @@ export class MatrixClient extends TypedEventEmitter { - // TODO: Types - const params = { + ): Promise { + const params: Record = { client_secret: clientSecret, country: phoneCountry, phone_number: phoneNumber, send_attempt: sendAttempt?.toString(), - next_link: nextLink, }; + if (nextLink) { + params.next_link = nextLink; + } - return this.http.idServerRequest( + return this.http.idServerRequest( Method.Post, "/validate/msisdn/requestToken", params, diff --git a/src/http-api/fetch.ts b/src/http-api/fetch.ts index 1267fcc76..ecb09084b 100644 --- a/src/http-api/fetch.ts +++ b/src/http-api/fetch.ts @@ -70,7 +70,7 @@ export class FetchHttpApi { this.opts.idBaseUrl = url; } - public idServerRequest>( + public idServerRequest>( method: Method, path: string, params: Record | undefined,