@@ -192,13 +192,14 @@ import {
192192} from "./webrtc/groupCall" ;
193193import { MediaHandler } from "./webrtc/mediaHandler" ;
194194import { GroupCallEventHandler } from "./webrtc/groupCallEventHandler" ;
195- import { IRefreshTokenResponse } from "./@types/auth" ;
195+ import { ILoginFlowsResponse , IRefreshTokenResponse , SSOAction , IRefreshTokenResponse } from "./@types/auth" ;
196196import { TypedEventEmitter } from "./models/typed-event-emitter" ;
197197import { ReceiptType } from "./@types/read_receipts" ;
198198import { MSC3575SlidingSyncRequest , MSC3575SlidingSyncResponse , SlidingSync } from "./sliding-sync" ;
199199import { SlidingSyncSdk } from "./sliding-sync-sdk" ;
200200import { Thread , THREAD_RELATION_TYPE } from "./models/thread" ;
201201import { MBeaconInfoEventContent , M_BEACON_INFO } from "./@types/beacon" ;
202+ import { UnstableValue } from "./NamespacedValue" ;
202203import { ToDeviceMessageQueue } from "./ToDeviceMessageQueue" ;
203204import { ToDeviceBatch } from "./models/ToDeviceMessage" ;
204205import { IgnoredInvites } from "./models/invites-ignorer" ;
@@ -897,6 +898,8 @@ export type ClientEventHandlerMap = {
897898 & HttpApiEventHandlerMap
898899 & BeaconEventHandlerMap ;
899900
901+ const SSO_ACTION_PARAM = new UnstableValue ( "action" , "org.matrix.msc3824.action" ) ;
902+
900903/**
901904 * Represents a Matrix Client. Only directly construct this if you want to use
902905 * custom modules. Normally, {@link createClient} should be used
@@ -7179,10 +7182,10 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
71797182
71807183 /**
71817184 * @param {module:client.callback } callback Optional.
7182- * @return {Promise } Resolves: TODO
7185+ * @return {Promise<ILoginFlowsResponse> } Resolves to the available login flows
71837186 * @return {module:http-api.MatrixError } Rejects: with an error response.
71847187 */
7185- public loginFlows ( callback ?: Callback ) : Promise < any > { // TODO: Types
7188+ public loginFlows ( callback ?: Callback ) : Promise < ILoginFlowsResponse > {
71867189 return this . http . request ( callback , Method . Get , "/login" ) ;
71877190 }
71887191
@@ -7258,15 +7261,26 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
72587261 * @param {string } loginType The type of SSO login we are doing (sso or cas).
72597262 * Defaults to 'sso'.
72607263 * @param {string } idpId The ID of the Identity Provider being targeted, optional.
7264+ * @param {SSOAction } action the SSO flow to indicate to the IdP, optional.
72617265 * @return {string } The HS URL to hit to begin the SSO login process.
72627266 */
7263- public getSsoLoginUrl ( redirectUrl : string , loginType = "sso" , idpId ?: string ) : string {
7267+ public getSsoLoginUrl (
7268+ redirectUrl : string ,
7269+ loginType = "sso" ,
7270+ idpId ?: string ,
7271+ action ?: SSOAction ,
7272+ ) : string {
72647273 let url = "/login/" + loginType + "/redirect" ;
72657274 if ( idpId ) {
72667275 url += "/" + idpId ;
72677276 }
72687277
7269- return this . http . getUrl ( url , { redirectUrl } , PREFIX_R0 ) ;
7278+ const params = {
7279+ redirectUrl,
7280+ [ SSO_ACTION_PARAM . unstable ! ] : action ,
7281+ } ;
7282+
7283+ return this . http . getUrl ( url , params , PREFIX_R0 ) ;
72707284 }
72717285
72727286 /**
0 commit comments