@@ -20,6 +20,30 @@ export interface UpdatePasswordForm {
2020 newPassword : string ;
2121}
2222
23+ export type RefreshTokenRequest = RequestWithBody < RefreshTokenForm > ;
24+
25+ export interface RefreshTokenForm {
26+ refreshToken : string ;
27+ }
28+
29+ export type InitializeForgotPasswordRequest = RequestWithBody <
30+ InitializeForgotPasswordForm
31+ > ;
32+
33+ export interface InitializeForgotPasswordForm {
34+ username : string ;
35+ }
36+
37+ export type ConfirmForgotPasswordRequest = RequestWithBody <
38+ ConfirmForgotPasswordForm
39+ > ;
40+
41+ export interface ConfirmForgotPasswordForm {
42+ username : string ;
43+ newPassword : string ;
44+ confirmationCode : string ;
45+ }
46+
2347export class SecurityClient extends BaseClient {
2448 constructor ( config : ClientConfig , axiosInstance : AxiosInstance = axios ) {
2549 super ( config , axiosInstance ) ;
@@ -44,4 +68,35 @@ export class SecurityClient extends BaseClient {
4468 headers : config . headers ,
4569 } ) ;
4670 }
71+
72+ refresh ( request : RefreshTokenRequest ) : Promise < AxiosResponse < LoginResponse > > {
73+ const config = this . config . merge ( request as PortfolioRequest ) ;
74+ const url = `${ config . host } /security/refresh` ;
75+
76+ return this . axiosInstance . post < LoginResponse > ( url , request . body , {
77+ headers : config . headers ,
78+ } ) ;
79+ }
80+
81+ initForgotPassword (
82+ request : InitializeForgotPasswordRequest
83+ ) : Promise < AxiosResponse < PortfolioResponse > > {
84+ const config = this . config . merge ( request as PortfolioRequest ) ;
85+ const url = `${ config . host } /security/init-forgot-password` ;
86+
87+ return this . axiosInstance . post < PortfolioResponse > ( url , request . body , {
88+ headers : config . headers ,
89+ } ) ;
90+ }
91+
92+ confirmForgotPassword (
93+ request : ConfirmForgotPasswordRequest
94+ ) : Promise < AxiosResponse < PortfolioResponse > > {
95+ const config = this . config . merge ( request as PortfolioRequest ) ;
96+ const url = `${ config . host } /security/confirm-forgot-password` ;
97+
98+ return this . axiosInstance . post < PortfolioResponse > ( url , request . body , {
99+ headers : config . headers ,
100+ } ) ;
101+ }
47102}
0 commit comments