1
- import { subscriptionManagementApi } from './utils/axiosConfig' ;
1
+ import { accountManagementApi } from './utils/axiosConfig' ;
2
2
import { UserSubscriptions } from '../../models/UserSubscriptions' ;
3
3
import { LogHelper } from '../logging/logHelper' ;
4
4
@@ -7,7 +7,7 @@ const logHelper = new LogHelper();
7
7
export class SubscriptionRequests {
8
8
public async getUserSubscriptions ( userId : string ) : Promise < UserSubscriptions > {
9
9
try {
10
- const response = await subscriptionManagementApi . get ( `/subscription/user/${ userId } ` ) ;
10
+ const response = await accountManagementApi . get ( `/subscription/user/${ userId } ` ) ;
11
11
return response . data ;
12
12
} catch ( error ) {
13
13
logHelper . logErrorResponse ( error , `retrieve subscriptions for user with ID ${ userId } ` ) ;
@@ -17,7 +17,7 @@ export class SubscriptionRequests {
17
17
18
18
public async unsubscribe ( subscriptionId : string , userId : string ) : Promise < object > {
19
19
try {
20
- const response = await subscriptionManagementApi . delete ( `/subscription/${ subscriptionId } ` , {
20
+ const response = await accountManagementApi . delete ( `/subscription/${ subscriptionId } ` , {
21
21
headers : { 'x-user-id' : userId } ,
22
22
} ) ;
23
23
return response . data ;
@@ -29,7 +29,7 @@ export class SubscriptionRequests {
29
29
30
30
public async subscribe ( payload , userId : string ) : Promise < boolean > {
31
31
try {
32
- await subscriptionManagementApi . post ( '/subscription' , payload , {
32
+ await accountManagementApi . post ( '/subscription' , payload , {
33
33
headers : { 'x-user-id' : userId } ,
34
34
} ) ;
35
35
return true ;
@@ -41,7 +41,7 @@ export class SubscriptionRequests {
41
41
42
42
public async bulkDeleteSubscriptions ( subscriptionIds : string [ ] , userId : string ) : Promise < object > {
43
43
try {
44
- const response = await subscriptionManagementApi . delete ( '/subscription/v2 /bulk' , {
44
+ const response = await accountManagementApi . delete ( '/subscription/bulk' , {
45
45
headers : { 'x-user-id' : userId } ,
46
46
data : subscriptionIds ,
47
47
} ) ;
@@ -54,7 +54,7 @@ export class SubscriptionRequests {
54
54
55
55
public async addListTypeForLocationSubscriptions ( userId , payload ) : Promise < boolean > {
56
56
try {
57
- await subscriptionManagementApi . post ( `/subscription/add-list-types/${ userId } ` , payload ) ;
57
+ await accountManagementApi . post ( `/subscription/add-list-types/${ userId } ` , payload ) ;
58
58
return true ;
59
59
} catch ( error ) {
60
60
logHelper . logErrorResponse ( error , `add subscription's list type for user with ID ${ userId } ` ) ;
@@ -64,7 +64,7 @@ export class SubscriptionRequests {
64
64
65
65
public async configureListTypeForLocationSubscriptions ( userId , payload ) : Promise < boolean > {
66
66
try {
67
- await subscriptionManagementApi . put ( `/subscription/configure-list-types/${ userId } ` , payload ) ;
67
+ await accountManagementApi . put ( `/subscription/configure-list-types/${ userId } ` , payload ) ;
68
68
return true ;
69
69
} catch ( error ) {
70
70
logHelper . logErrorResponse ( error , `configure subscription's list type for user with ID ${ userId } ` ) ;
@@ -74,7 +74,7 @@ export class SubscriptionRequests {
74
74
75
75
public async retrieveSubscriptionChannels ( ) : Promise < string [ ] > {
76
76
try {
77
- const channelResponse = await subscriptionManagementApi . get ( '/meta/channels ' ) ;
77
+ const channelResponse = await accountManagementApi . get ( '/subscription/channel ' ) ;
78
78
return channelResponse . data ;
79
79
} catch ( error ) {
80
80
logHelper . logErrorResponse ( error , 'retrieve the list of subscription channels' ) ;
@@ -85,7 +85,7 @@ export class SubscriptionRequests {
85
85
public async deleteLocationSubscription ( locationId : number , userId : string ) : Promise < object > {
86
86
try {
87
87
const header = { headers : { 'x-user-id' : userId } } ;
88
- const response = await subscriptionManagementApi . delete ( `/subscription/location/${ locationId } ` , header ) ;
88
+ const response = await accountManagementApi . delete ( `/subscription/location/${ locationId } ` , header ) ;
89
89
return response . data ;
90
90
} catch ( error ) {
91
91
logHelper . logErrorResponse ( error , `delete subscriptions for location with ID ${ locationId } ` ) ;
@@ -95,7 +95,7 @@ export class SubscriptionRequests {
95
95
96
96
public async fulfillSubscriptions ( artefact ) : Promise < string > {
97
97
try {
98
- const response = await subscriptionManagementApi . post ( '/subscription/artefact-recipients' , artefact ) ;
98
+ const response = await accountManagementApi . post ( '/subscription/artefact-recipients' , artefact ) ;
99
99
return response . data ;
100
100
} catch ( error ) {
101
101
logHelper . logErrorResponse ( error , `fulfill subscriptions for artefact with ID ${ artefact . arterfactId } ` ) ;
0 commit comments