File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ type UploadTorrentParams = {
51
51
category : string
52
52
description : string
53
53
tags : Array < number >
54
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
54
55
file : any
55
56
}
56
57
@@ -102,6 +103,7 @@ export class TorrentResource implements IRestResource {
102
103
}
103
104
104
105
async deleteTorrent ( infoHash : string ) : Promise < DeleteTorrentResponseData > {
106
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
105
107
return await fetchDelete < any , DeleteTorrentResponse > (
106
108
`${ this . client . apiBaseUrl } /torrent/${ infoHash } ` ,
107
109
{ } ,
Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ type RegisterUserParams = {
23
23
confirm_password : string
24
24
}
25
25
26
+ type ChangePasswordParams = {
27
+ current_password : string
28
+ password : string
29
+ confirm_password : string
30
+ }
31
+
26
32
type Token = {
27
33
token : string
28
34
}
@@ -89,4 +95,21 @@ export class UserResource implements IRestResource {
89
95
return Promise . reject ( err . response ?. data ?. error ?? err ) ;
90
96
} ) ;
91
97
}
98
+
99
+ async changePassword ( params : ChangePasswordParams , username : string ) : Promise < boolean > {
100
+ return await fetchPost < void > (
101
+ `${ this . client . apiBaseUrl } /user/${ username } /change-password` ,
102
+ JSON . stringify ( params ) ,
103
+ {
104
+ "Authorization" : `Bearer ${ this . client . authToken } ` ,
105
+ "Content-Type" : "application/json"
106
+ }
107
+ )
108
+ . then ( ( ) => {
109
+ return Promise . resolve ( true ) ;
110
+ } )
111
+ . catch ( ( err ) => {
112
+ return Promise . reject ( err . response ?. data ?. error ?? err ) ;
113
+ } ) ;
114
+ }
92
115
}
You can’t perform that action at this time.
0 commit comments