@@ -14,6 +14,7 @@ import {
14
14
FavoritesData ,
15
15
WatchHistory ,
16
16
CollectionWithCursorArgs ,
17
+ ProfilesData ,
17
18
} from '../models/IAccount&Authentication' ;
18
19
import {
19
20
CommonResponse ,
@@ -1377,6 +1378,95 @@ class Account extends BaseExtend {
1377
1378
} ,
1378
1379
} ) ;
1379
1380
}
1381
+
1382
+ async getProfiles ( ) : Promise <
1383
+ AxiosResponse < ProfilesData [ ] >
1384
+ > {
1385
+ const tokenObject = await this . request . getToken ( ) ;
1386
+ return this . request . get ( API . profiles , {
1387
+ headers : {
1388
+ Authorization : `Bearer ${ tokenObject . token } ` ,
1389
+ 'Content-Type' : 'application/x-www-form-urlencoded' ,
1390
+ } ,
1391
+ } ) ;
1392
+ }
1393
+
1394
+ async enterProfile ( id : string , pin ?:number ) : Promise < AxiosResponse < ProfilesData > > {
1395
+ const body = {
1396
+ pin,
1397
+ } ;
1398
+ const tokenObject = await this . request . getToken ( ) ;
1399
+ return this . request . post ( `${ API . getProfilesItem ( id ) } /token` , qs . stringify ( body ) , {
1400
+ headers : {
1401
+ Authorization : `Bearer ${ tokenObject . token } ` ,
1402
+ 'Content-Type' : 'application/x-www-form-urlencoded' ,
1403
+ } ,
1404
+ } ) ;
1405
+ }
1406
+
1407
+ async createProfile (
1408
+ name : string ,
1409
+ adult : boolean ,
1410
+ avatar_url ?: string ,
1411
+ pin ?:number ,
1412
+ ) : Promise <
1413
+ AxiosResponse < ProfilesData >
1414
+ > {
1415
+ const body = {
1416
+ name,
1417
+ adult,
1418
+ avatar_url,
1419
+ pin,
1420
+ } ;
1421
+ const tokenObject = await this . request . getToken ( ) ;
1422
+ return this . request . post ( API . profiles , qs . stringify ( body ) , {
1423
+ headers : {
1424
+ Authorization : `Bearer ${ tokenObject . token } ` ,
1425
+ 'Content-Type' : 'application/x-www-form-urlencoded' ,
1426
+ } ,
1427
+ } ) ;
1428
+ }
1429
+
1430
+ async getProfileDetails (
1431
+ id : string ,
1432
+ ) : Promise < AxiosResponse < ProfilesData > > {
1433
+ const tokenObject = await this . request . getToken ( ) ;
1434
+ return this . request . get ( API . getProfilesItem ( id ) , {
1435
+ headers : {
1436
+ Authorization : `Bearer ${ tokenObject . token } ` ,
1437
+ 'Content-Type' : 'application/x-www-form-urlencoded' ,
1438
+ } ,
1439
+ } ) ;
1440
+ }
1441
+ async updateProfile (
1442
+ id : string ,
1443
+ name : string ,
1444
+ avatar_url : string ,
1445
+ ) : Promise < AxiosResponse < ProfilesData > > {
1446
+ const body = {
1447
+ name,
1448
+ avatar_url,
1449
+ } ;
1450
+ const tokenObject = await this . request . getToken ( ) ;
1451
+ return this . request . put ( API . getProfilesItem ( id ) , qs . stringify ( body ) , {
1452
+ headers : {
1453
+ Authorization : `Bearer ${ tokenObject . token } ` ,
1454
+ 'Content-Type' : 'application/x-www-form-urlencoded' ,
1455
+ } ,
1456
+ } ) ;
1457
+ }
1458
+
1459
+ async deleteProfile (
1460
+ id : string ,
1461
+ ) : Promise < AxiosResponse < ProfilesData > > {
1462
+ const tokenObject = await this . request . getToken ( ) ;
1463
+ return this . request . delete ( API . getProfilesItem ( id ) , {
1464
+ headers : {
1465
+ Authorization : `Bearer ${ tokenObject . token } ` ,
1466
+ 'Content-Type' : 'application/x-www-form-urlencoded' ,
1467
+ } ,
1468
+ } ) ;
1469
+ }
1380
1470
}
1381
1471
1382
1472
export default Account ;
0 commit comments